Skip to content

Commit

Permalink
emoteclues: display when item is in inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderhenne committed May 22, 2018
1 parent fe8ead3 commit 848c73e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public class ClueScrollPlugin extends Plugin
@Getter
private Item[] equippedItems;

@Getter
private Item[] inventoryItems;

@Getter
private Instant clueTimeout;

Expand Down Expand Up @@ -260,6 +263,7 @@ public void onGameTick(final GameTick event)
npcsToMark = null;
objectsToMark = null;
equippedItems = null;
inventoryItems = null;

if (clue instanceof LocationsClueScroll)
{
Expand Down Expand Up @@ -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();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

}
}
}
Expand Down

0 comments on commit 848c73e

Please sign in to comment.