Skip to content

Commit

Permalink
Merge remote-tracking branch 'runelite/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 committed Jun 22, 2022
2 parents 0e97e8b + 9ce80d4 commit f78b07a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class RuntimeConfig
private Map<String, String> outageLinks;

private Set<Integer> ignoreDeadNpcs;
private Set<Integer> forceDeadNpcs;

public boolean showOutageMessage()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class LootManager

private final EventBus eventBus;
private final Client client;
private final NpcUtil npcUtil;
private final ListMultimap<Integer, ItemStack> itemSpawns = ArrayListMultimap.create();
private final Set<LocalPoint> killPoints = new HashSet<>();
private WorldPoint playerLocationLastTick;
Expand All @@ -80,10 +81,11 @@ public class LootManager
private int delayedLootTickLimit;

@Inject
private LootManager(EventBus eventBus, Client client)
private LootManager(EventBus eventBus, Client client, NpcUtil npcUtil)
{
this.eventBus = eventBus;
this.client = client;
this.npcUtil = npcUtil;
eventBus.register(this);
}

Expand All @@ -98,7 +100,7 @@ public void onNpcDespawned(NpcDespawned npcDespawned)
delayedLootTickLimit = 0;
}

if (!npc.isDead())
if (!npcUtil.isDying(npc))
{
int id = npc.getId();
switch (id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public boolean isDying(final NPC npc)
case NpcID.ANCIENT_ZYGOMITE:
case NpcID.ROCKSLUG:
case NpcID.ROCKSLUG_422:
case NpcID.GIANT_ROCKSLUG:
case NpcID.DESERT_LIZARD:
case NpcID.DESERT_LIZARD_460:
case NpcID.DESERT_LIZARD_461:
Expand All @@ -94,6 +95,12 @@ public boolean isDying(final NPC npc)
case NpcID.GROWTHLING:
case NpcID.KALPHITE_QUEEN_963: // KQ's first form sometimes regenerates 1hp after reaching 0hp, thus not dying
return false;
// These NPCs transform and have their `isDead()` reset to `false` despite actually being dead in these forms
case NpcID.DRAKE_8613:
case NpcID.GUARDIAN_DRAKE_10401:
case NpcID.ALCHEMICAL_HYDRA_8634:
case NpcID.NEX_11282:
return true;
default:
if (runtimeConfig != null)
{
Expand All @@ -102,6 +109,12 @@ public boolean isDying(final NPC npc)
{
return false;
}

Set<Integer> forceDeadNpcs = runtimeConfig.getForceDeadNpcs();
if (forceDeadNpcs != null && forceDeadNpcs.contains(id))
{
return true;
}
}

final NPCComposition npcComposition = npc.getTransformedComposition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.runelite.api.events.NpcDespawned;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.NpcUtil;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
Expand All @@ -49,6 +50,9 @@ public class BossTimersPlugin extends Plugin
@Inject
private ItemManager itemManager;

@Inject
private NpcUtil npcUtil;

@Override
protected void shutDown() throws Exception
{
Expand All @@ -60,7 +64,7 @@ public void onNpcDespawned(NpcDespawned npcDespawned)
{
NPC npc = npcDespawned.getNpc();

if (!npc.isDead())
if (!npcUtil.isDying(npc))
{
return;
}
Expand Down

0 comments on commit f78b07a

Please sign in to comment.