clues: add support for beginner maps
This commit is contained in:
@@ -134,6 +134,11 @@ public class WidgetID
|
||||
public static final int KEPT_ON_DEATH_GROUP_ID = 4;
|
||||
public static final int GUIDE_PRICE_GROUP_ID = 464;
|
||||
public static final int SEED_VAULT_INVENTORY_GROUP_ID = 630;
|
||||
public static final int BEGINNER_CLUE_MAP_CHAMPIONS_GUILD = 346;
|
||||
public static final int BEGINNER_CLUE_MAP_VARROCK_EAST_MINE = 347;
|
||||
public static final int BEGINNER_CLUE_MAP_DRAYNOR = 348;
|
||||
public static final int BEGINNER_CLUE_MAP_NORTH_OF_FALADOR = 351;
|
||||
public static final int BEGINNER_CLUE_MAP_WIZARDS_TOWER = 356;
|
||||
|
||||
static class WorldMap
|
||||
{
|
||||
|
||||
@@ -68,7 +68,9 @@ import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -76,6 +78,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.AnagramClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.BeginnerMapClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.CipherClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.CoordinateClue;
|
||||
@@ -389,6 +392,18 @@ public class ClueScrollPlugin extends Plugin
|
||||
updateClue(findClueScroll());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() < WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD
|
||||
|| event.getGroupId() > WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateClue(BeginnerMapClue.forWidgetID(event.getGroupId()));
|
||||
}
|
||||
|
||||
public BufferedImage getClueScrollImage()
|
||||
{
|
||||
return itemManager.getImage(ItemID.CLUE_SCROLL_MASTER);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Hydrox6 <ikada@protonmail.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.plugins.cluescrolls.clues;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
|
||||
@Getter
|
||||
public class BeginnerMapClue extends MapClue implements LocationClueScroll
|
||||
{
|
||||
private static final ImmutableList<BeginnerMapClue> CLUES = ImmutableList.of(
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD, new WorldPoint(3166, 3361, 0), "South West of the Champion's Guild"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_VARROCK_EAST_MINE, new WorldPoint(3290, 3374, 0), "Outside Varrock East Mine"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_DRAYNOR, new WorldPoint(3093, 3226, 0), "South of Draynor Village Bank"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_NORTH_OF_FALADOR, new WorldPoint(3043, 3398, 0), "In the standing stones north of Falador"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER, new WorldPoint(3110, 3152, 0), "On the south side of the Wizard's Tower")
|
||||
);
|
||||
|
||||
private final int widgetGroupID;
|
||||
|
||||
private BeginnerMapClue(int widgetGroupID, WorldPoint location, String description)
|
||||
{
|
||||
super(-1, location, description);
|
||||
this.widgetGroupID = widgetGroupID;
|
||||
setRequiresSpade(true);
|
||||
}
|
||||
|
||||
// Beginner Map Clues all use the same ItemID, but the WidgetID used to display them is unique
|
||||
public static BeginnerMapClue forWidgetID(int widgetGroupID)
|
||||
{
|
||||
for (BeginnerMapClue clue : CLUES)
|
||||
{
|
||||
if (clue.widgetGroupID == widgetGroupID)
|
||||
{
|
||||
return clue;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MapClue extends ClueScroll implements ObjectClueScroll
|
||||
this(itemId, location, objectId, null);
|
||||
}
|
||||
|
||||
private MapClue(int itemId, WorldPoint location, String description)
|
||||
MapClue(int itemId, WorldPoint location, String description)
|
||||
{
|
||||
this(itemId, location, -1, description);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user