Skip to content

Commit

Permalink
npc util: move rtconfig overrides before isDying switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Aug 28, 2024
1 parent 762497d commit f944d47
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ private NpcUtil(@Nullable RuntimeConfig runtimeConfig, EventBus eventBus)
public boolean isDying(final NPC npc)
{
final int id = npc.getId();

if (runtimeConfig != null)
{
Set<Integer> ignoredNpcs = runtimeConfig.getIgnoreDeadNpcs();
if (ignoredNpcs != null && ignoredNpcs.contains(id))
{
return false;
}

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

Set<Integer> pureIsDeadNpcs = runtimeConfig.getNonAttackNpcs();
if (pureIsDeadNpcs != null && pureIsDeadNpcs.contains(id))
{
return npc.isDead();
}
}

switch (id)
{
// These NPCs hit 0hp but don't actually die
Expand Down Expand Up @@ -159,27 +181,6 @@ public boolean isDying(final NPC npc)
case NpcID.ZALCANO_9050:
return npc.isDead();
default:
if (runtimeConfig != null)
{
Set<Integer> ignoredNpcs = runtimeConfig.getIgnoreDeadNpcs();
if (ignoredNpcs != null && ignoredNpcs.contains(id))
{
return false;
}

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

Set<Integer> pureIsDeadNpcs = runtimeConfig.getNonAttackNpcs();
if (pureIsDeadNpcs != null && pureIsDeadNpcs.contains(id))
{
return npc.isDead();
}
}

final NPCComposition npcComposition = npc.getTransformedComposition();
if (npcComposition == null)
{
Expand Down

0 comments on commit f944d47

Please sign in to comment.