Skip to content

Commit

Permalink
check npc cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Jun 15, 2024
1 parent 4d031a6 commit 477a8ae
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,26 +324,29 @@ public void onVarbitChanged(VarbitChanged event)
lastSpecHpChange = lastHpChangeCycle == client.getGameCycle();
hitsplatTick = serverTicks + getHitDelay(specialWeapon, target);

// Check if the counters should be reset
NPC npc = (NPC) target;
int interactingId = npc.getId();
int npcIndex = npc.getIndex();
log.debug("Special attack used - cycle: {} percent: {} weapon: {} server cycle {} hitsplat cycle {} hp change: {}",
client.getGameCycle(), specialPercentage, specialWeapon, serverTicks, hitsplatTick, lastSpecHpChange);

if (IGNORED_NPCS.contains(interactingId))
// Check if the counters should be reset
if (target instanceof NPC)
{
return;
}
NPC npc = (NPC) target;
int interactingId = npc.getId();
int npcIndex = npc.getIndex();

// If this is a new NPC reset the counters
if (!interactedNpcIndexes.contains(npcIndex))
{
log.debug("Removing counters due to interact change");
removeCounters();
interactedNpcIndexes.add(npcIndex);
}
if (IGNORED_NPCS.contains(interactingId))
{
return;
}

log.debug("Special attack used - cycle: {} percent: {} weapon: {} server cycle {} hitsplat cycle {} hp change: {}",
client.getGameCycle(), specialPercentage, specialWeapon, serverTicks, hitsplatTick, lastSpecHpChange);
// If this is a new NPC reset the counters
if (!interactedNpcIndexes.contains(npcIndex))
{
log.debug("Removing counters due to interact change");
removeCounters();
interactedNpcIndexes.add(npcIndex);
}
}
});
}

Expand Down

0 comments on commit 477a8ae

Please sign in to comment.