spec counter plugin: fix other NPC hitsplats affecting specs

This commit is contained in:
Trevor
2020-03-24 13:05:44 -04:00
committed by Adam
parent f6da67cd2d
commit 2deadaed2e

View File

@@ -61,7 +61,7 @@ public class SpecialCounterPlugin extends Plugin
{
private int currentWorld = -1;
private int specialPercentage = -1;
private boolean specialUsed;
private NPC specedNPC;
private SpecialWeapon specialWeapon;
private final Set<Integer> interactedNpcIds = new HashSet<>();
@@ -129,7 +129,11 @@ public class SpecialCounterPlugin extends Plugin
this.specialPercentage = specialPercentage;
this.specialWeapon = usedSpecialWeapon();
specialUsed = true;
Actor interacting = client.getLocalPlayer().getInteracting();
if (interacting instanceof NPC)
{
specedNPC = (NPC) interacting;
}
}
@Subscribe
@@ -152,9 +156,9 @@ public class SpecialCounterPlugin extends Plugin
addInteracting(interactingId);
}
if (specialUsed)
if (specedNPC == hitsplatApplied.getActor())
{
specialUsed = false;
specedNPC = null;
if (specialWeapon != null)
{
@@ -189,6 +193,12 @@ public class SpecialCounterPlugin extends Plugin
{
NPC actor = npcDespawned.getNpc();
// if the NPC despawns before the hitsplat is shown
if (specedNPC == actor)
{
specedNPC = null;
}
if (actor.isDead() && interactedNpcIds.contains(actor.getId()))
{
removeCounters();