timers: Fix NMZ Overload timer not disappearing

Unlike with the CoX Overloads, the plugin did not check if the player
was still in the area for the Nightmare Zone Overloads, causing the
timer to not disappear after leaving. The plugin now removes the timer
if the player has left NMZ and has drunk an Overload potion.
This commit is contained in:
Sean Patiag
2020-09-20 07:24:41 -07:00
committed by Jordan Atwood
parent 03566d6702
commit 0e71c88b4d

View File

@@ -121,6 +121,7 @@ public class TimersPlugin extends Plugin
static final int FIGHT_CAVES_REGION_ID = 9551;
static final int INFERNO_REGION_ID = 9043;
private static final int NMZ_MAP_REGION_ID = 9033;
private static final Pattern TZHAAR_WAVE_MESSAGE = Pattern.compile("Wave: (\\d+)");
private static final String TZHAAR_DEFEATED_MESSAGE = "You have been defeated!";
private static final Pattern TZHAAR_COMPLETE_MESSAGE = Pattern.compile("Your (TzTok-Jad|TzKal-Zuk) kill count is:");
@@ -718,6 +719,11 @@ public class TimersPlugin extends Plugin
return client.getMapRegions() != null && ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION_ID);
}
private boolean isInNightmareZone()
{
return client.getLocalPlayer() != null && client.getLocalPlayer().getWorldLocation().getPlane() > 0 && ArrayUtils.contains(client.getMapRegions(), NMZ_MAP_REGION_ID);
}
private void createTzhaarTimer()
{
removeTzhaarTimer();
@@ -783,6 +789,11 @@ public class TimersPlugin extends Plugin
switch (gameStateChanged.getGameState())
{
case LOADING:
if (!isInNightmareZone())
{
removeGameTimer(OVERLOAD);
}
if (tzhaarTimer != null && !isInFightCaves() && !isInInferno())
{
removeTzhaarTimer();