Merge pull request #3084 from devLotto/emoteclue-improvements
emoteclues: display when item is in inventory
This commit is contained in:
@@ -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 class ClueScrollPlugin extends Plugin
|
||||
npcsToMark = null;
|
||||
objectsToMark = null;
|
||||
equippedItems = null;
|
||||
inventoryItems = null;
|
||||
|
||||
if (clue instanceof LocationsClueScroll)
|
||||
{
|
||||
@@ -346,11 +350,18 @@ public class ClueScrollPlugin extends Plugin
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -609,25 +609,32 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
||||
{
|
||||
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 ? "X" : "-")
|
||||
.rightColor(found ? Color.GREEN : Color.RED)
|
||||
.right(equipmentFulfilled || inventoryFulfilled ? "\u2713" : "\u2717")
|
||||
.rightColor(equipmentFulfilled ? Color.GREEN : (inventoryFulfilled ? Color.ORANGE : Color.RED))
|
||||
.build());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user