From 5cd865f43f539be1969d3940f7754b7086c74b54 Mon Sep 17 00:00:00 2001 From: ReeeMan <39725162+ReeeMan@users.noreply.github.com> Date: Sun, 6 Dec 2020 01:17:02 +0000 Subject: [PATCH] Update lootManager with upstream to fix Nightmare in loottracker. (#2872) Co-authored-by: Your Name --- .../net/runelite/client/game/LootManager.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java index 4bb3f2bdbe..61e23e2c9e 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java @@ -55,6 +55,7 @@ import net.runelite.api.events.ItemQuantityChanged; import net.runelite.api.events.ItemSpawned; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.PlayerDespawned; +import net.runelite.api.events.NpcDefinitionChanged; import net.runelite.client.eventbus.EventBus; import net.runelite.client.events.NpcLootReceived; import net.runelite.client.events.PlayerLootReceived; @@ -112,6 +113,7 @@ public class LootManager eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned); eventBus.subscribe(ItemQuantityChanged.class, this, this::onItemQuantityChanged); eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); + eventBus.subscribe(NpcDefinitionChanged.class, this, this::onNpcDefinitionChanged); } private void onNpcDespawned(NpcDespawned npcDespawned) @@ -246,11 +248,6 @@ public class LootManager // Big Kraken drops loot wherever player is standing when animation starts. krakenPlayerLocation = client.getLocalPlayer().getWorldLocation(); } - else if (id == NpcID.THE_NIGHTMARE_9433) - { - delayedLootNpc = npc; - delayedLootTickLimit = 16; - } else { // These NPCs drop loot on death animation, which is right now. @@ -259,6 +256,16 @@ public class LootManager } } + public void onNpcDefinitionChanged(NpcDefinitionChanged npcChanged) + { + final NPC npc = npcChanged.getNpc(); + if (npc.getId() == NpcID.THE_NIGHTMARE_9433) + { + delayedLootNpc = npc; + delayedLootTickLimit = 15; + } + } + private void onGameTick(GameTick gameTick) { if (delayedLootNpc != null && delayedLootTickLimit-- > 0) @@ -439,4 +446,4 @@ public class LootManager final List itemStacks = itemSpawns.get(packed); return Collections.unmodifiableList(itemStacks); } -} +} \ No newline at end of file