Revert "npc indicators: verify compoistion id of tagged npcs"

This is breaking ammonite crabs due to them changing composition after
spawning

This reverts commit 01f134795d.
This commit is contained in:
Adam
2020-05-16 12:20:18 -04:00
parent 9dd8c59d0a
commit 8ab929d001

View File

@@ -145,9 +145,9 @@ public class NpcIndicatorsPlugin extends Plugin
private List<String> highlights = new ArrayList<>(); private List<String> highlights = new ArrayList<>();
/** /**
* NPC ids marked with the Tag option, index -> composition id * NPC ids marked with the Tag option
*/ */
private final Map<Integer, Integer> npcTags = new HashMap<>(); private final Set<Integer> npcTags = new HashSet<>();
/** /**
* Tagged NPCs that spawned this tick, which need to be verified that * Tagged NPCs that spawned this tick, which need to be verified that
@@ -294,7 +294,7 @@ public class NpcIndicatorsPlugin extends Plugin
} }
final int id = click.getId(); final int id = click.getId();
final Integer removedId = npcTags.remove(id); final boolean removed = npcTags.remove(id);
final NPC[] cachedNPCs = client.getCachedNPCs(); final NPC[] cachedNPCs = client.getCachedNPCs();
final NPC npc = cachedNPCs[id]; final NPC npc = cachedNPCs[id];
@@ -303,7 +303,7 @@ public class NpcIndicatorsPlugin extends Plugin
return; return;
} }
if (removedId != null) if (removed)
{ {
highlightedNpcs.remove(npc); highlightedNpcs.remove(npc);
memorizedNpcs.remove(npc.getIndex()); memorizedNpcs.remove(npc.getIndex());
@@ -311,7 +311,7 @@ public class NpcIndicatorsPlugin extends Plugin
else else
{ {
memorizeNpc(npc); memorizeNpc(npc);
npcTags.put(id, npc.getId()); npcTags.add(id);
highlightedNpcs.add(npc); highlightedNpcs.add(npc);
} }
@@ -329,8 +329,7 @@ public class NpcIndicatorsPlugin extends Plugin
return; return;
} }
Integer taggedId = npcTags.get(npc.getIndex()); if (npcTags.contains(npc.getIndex()))
if (taggedId != null && taggedId == npc.getId())
{ {
memorizeNpc(npc); memorizeNpc(npc);
highlightedNpcs.add(npc); highlightedNpcs.add(npc);
@@ -476,8 +475,7 @@ public class NpcIndicatorsPlugin extends Plugin
continue; continue;
} }
Integer taggedId = npcTags.get(npc.getIndex()); if (npcTags.contains(npc.getIndex()))
if (taggedId != null && taggedId == npc.getId())
{ {
highlightedNpcs.add(npc); highlightedNpcs.add(npc);
continue; continue;