From 848c73e556e6350b7223eff0500042558c6eaba5 Mon Sep 17 00:00:00 2001 From: Lotto Date: Tue, 22 May 2018 23:57:19 +0200 Subject: [PATCH] emoteclues: display when item is in inventory --- .../plugins/cluescrolls/ClueScrollPlugin.java | 17 +++++++++++--- .../plugins/cluescrolls/clues/EmoteClue.java | 23 ++++++++++++------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java index 672436e13fa..b8ffa936959 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java @@ -112,6 +112,9 @@ public class ClueScrollPlugin extends Plugin @Getter private Item[] equippedItems; + @Getter + private Item[] inventoryItems; + @Getter private Instant clueTimeout; @@ -260,6 +263,7 @@ public void onGameTick(final GameTick event) npcsToMark = null; objectsToMark = null; equippedItems = null; + inventoryItems = null; if (clue instanceof LocationsClueScroll) { @@ -346,11 +350,18 @@ public void onGameTick(final GameTick event) if (clue instanceof EmoteClue) { - ItemContainer container = client.getItemContainer(InventoryID.EQUIPMENT); + ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - if (container != null) + if (equipment != null) { - equippedItems = container.getItems(); + equippedItems = equipment.getItems(); + } + + ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); + + if (inventory != null) + { + inventoryItems = inventory.getItems(); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java index 99764b04e15..a35dbc93c47 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java @@ -609,25 +609,32 @@ public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plug { panelComponent.getChildren().add(LineComponent.builder().left("Equip:").build()); - Item[] items = plugin.getEquippedItems(); + Item[] equipment = plugin.getEquippedItems(); + Item[] inventory = plugin.getInventoryItems(); - // If items is null, the player is wearing nothing - if (items == null) + // If equipment is null, the player is wearing nothing + if (equipment == null) { - items = new Item[0]; + equipment = new Item[0]; + } + + // If inventory is null, the player has nothing in their inventory + if (inventory == null) + { + inventory = new Item[0]; } for (ItemRequirement requirement : getItemRequirements()) { - boolean found = requirement.fulfilledBy(items); + boolean equipmentFulfilled = requirement.fulfilledBy(equipment); + boolean inventoryFulfilled = requirement.fulfilledBy(inventory); panelComponent.getChildren().add(LineComponent.builder() .left(requirement.getCollectiveName(plugin.getClient())) .leftColor(TITLED_CONTENT_COLOR) - .right(found ? "\u2713" : "\u2717") - .rightColor(found ? Color.GREEN : Color.RED) + .right(equipmentFulfilled || inventoryFulfilled ? "\u2713" : "\u2717") + .rightColor(equipmentFulfilled ? Color.GREEN : (inventoryFulfilled ? Color.ORANGE : Color.RED)) .build()); - } } }