From 1a7aa4666bdac7d9f35a9d4a090c313c35c3a1e0 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 27 Jun 2019 22:43:44 -0700 Subject: [PATCH] npc indicators: Fix long respawn timer bug By killing a monster which has a known respawn timer and leaving its respawn area (by walking away or teleporting) and returning to it some time after it has respawned, the plugin can erroneously overwrite its respawn time with a much longer one. This commit fixes that issue by assuming that the lower of the observed respawn time and the previously recorded respawn time is the correct one. --- .../plugins/npchighlight/NpcIndicatorsPlugin.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java index 183272586d..5bb9eb357d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java @@ -548,7 +548,16 @@ public class NpcIndicatorsPlugin extends Plugin if (mn.getDiedOnTick() != -1) { - mn.setRespawnTime(client.getTickCount() + 1 - mn.getDiedOnTick()); + final int respawnTime = client.getTickCount() + 1 - mn.getDiedOnTick(); + + // By killing a monster and leaving the area before seeing it again, an erroneously lengthy + // respawn time can be recorded. Thus, if the respawn time is already set and is greater than + // the observed time, assume that the lower observed respawn time is correct. + if (mn.getRespawnTime() == -1 || respawnTime < mn.getRespawnTime()) + { + mn.setRespawnTime(respawnTime); + } + mn.setDiedOnTick(-1); }