loottracker: Fix duplicate cox and tob chest loots
This prevents loot entries for Chamber of Xeric and Theatre of Blood chests from being duplicated when viewed multiple times. Fixes runelite/runelite#4754
This commit is contained in:
@@ -51,6 +51,7 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.ItemContainer;
|
||||
@@ -60,6 +61,7 @@ import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -140,6 +142,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
private LootTrackerPanel panel;
|
||||
private NavigationButton navButton;
|
||||
private String eventType;
|
||||
private boolean chestLooted;
|
||||
|
||||
private List<String> ignoredItems = new ArrayList<>();
|
||||
|
||||
@@ -282,6 +285,16 @@ public class LootTrackerPlugin extends Plugin
|
||||
{
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
lootTrackerClient = null;
|
||||
chestLooted = false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(final GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOADING)
|
||||
{
|
||||
chestLooted = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -329,10 +342,19 @@ public class LootTrackerPlugin extends Plugin
|
||||
container = client.getItemContainer(InventoryID.BARROWS_REWARD);
|
||||
break;
|
||||
case (WidgetID.CHAMBERS_OF_XERIC_REWARD_GROUP_ID):
|
||||
if (chestLooted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
eventType = "Chambers of Xeric";
|
||||
container = client.getItemContainer(InventoryID.CHAMBERS_OF_XERIC_CHEST);
|
||||
chestLooted = true;
|
||||
break;
|
||||
case (WidgetID.THEATRE_OF_BLOOD_GROUP_ID):
|
||||
if (chestLooted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int region = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()).getRegionID();
|
||||
if (region != THEATRE_OF_BLOOD_REGION)
|
||||
{
|
||||
@@ -340,6 +362,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
}
|
||||
eventType = "Theatre of Blood";
|
||||
container = client.getItemContainer(InventoryID.THEATRE_OF_BLOOD_CHEST);
|
||||
chestLooted = true;
|
||||
break;
|
||||
case (WidgetID.CLUE_SCROLL_REWARD_GROUP_ID):
|
||||
// event type should be set via ChatMessage for clue scrolls.
|
||||
|
||||
Reference in New Issue
Block a user