timers plugin: fix teleblock timers

Co-authored-by: jordibenck <jordi.b-98@hotmail.com>
This commit is contained in:
Adam
2019-07-01 19:10:17 -04:00
committed by Adam
parent 60a23c901b
commit 166e547f67
2 changed files with 163 additions and 20 deletions

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.timers;
import com.google.inject.Provides;
import java.awt.image.BufferedImage;
import java.util.regex.Pattern;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Actor;
@@ -88,13 +89,10 @@ public class TimersPlugin extends Plugin
private static final String CANNON_REPAIR_MESSAGE = "You repair your cannon, restoring it to working order.";
private static final String CHARGE_EXPIRED_MESSAGE = "<col=ef1020>Your magical charge fades away.</col>";
private static final String CHARGE_MESSAGE = "<col=ef1020>You feel charged with magic power.</col>";
private static final String DEADMAN_HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you. It will expire in 1 minute, 15 seconds.</col>";
private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion.";
private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion.";
private static final String FROZEN_MESSAGE = "<col=ef1020>You have been frozen!</col>";
private static final String FULL_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you. It will expire in 5 minutes, 0 seconds.</col>";
private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer.";
private static final String HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you. It will expire in 2 minutes, 30 seconds.</col>";
private static final String IMBUED_HEART_READY_MESSAGE = "<col=ef1020>Your imbued heart has regained its magical power.</col>";
private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended.";
private static final String MAGIC_IMBUE_MESSAGE = "You are charged to combine runes!";
@@ -108,6 +106,10 @@ public class TimersPlugin extends Plugin
private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your super antifire potion has expired.</col>";
private static final String SUPER_ANTIVENOM_DRINK_MESSAGE = "You drink some of your super antivenom potion";
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 1 minute, 15 seconds.</col>");
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 5 minutes, 0 seconds.</col>");
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 2 minutes, 30 seconds.</col>");
private TimerTimer freezeTimer;
private int freezeTime = -1; // time frozen, in game ticks
@@ -518,28 +520,29 @@ public class TimersPlugin extends Plugin
removeGameTimer(MAGICIMBUE);
}
if (config.showTeleblock() && event.getMessage().equals(FULL_TELEBLOCK_MESSAGE))
if (config.showTeleblock())
{
createGameTimer(FULLTB);
}
if (config.showTeleblock() && event.getMessage().equals(HALF_TELEBLOCK_MESSAGE))
{
if (client.getWorldType().contains(WorldType.DEADMAN)
&& !client.getWorldType().contains(WorldType.SEASONAL_DEADMAN)
&& !client.getWorldType().contains(WorldType.DEADMAN_TOURNAMENT))
if (FULL_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
{
createGameTimer(DMM_FULLTB);
createGameTimer(FULLTB);
}
else
else if (HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
{
createGameTimer(HALFTB);
if (client.getWorldType().contains(WorldType.DEADMAN)
&& !client.getWorldType().contains(WorldType.SEASONAL_DEADMAN)
&& !client.getWorldType().contains(WorldType.DEADMAN_TOURNAMENT))
{
createGameTimer(DMM_FULLTB);
}
else
{
createGameTimer(HALFTB);
}
}
else if (DEADMAN_HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
{
createGameTimer(DMM_HALFTB);
}
}
if (config.showTeleblock() && event.getMessage().equals(DEADMAN_HALF_TELEBLOCK_MESSAGE))
{
createGameTimer(DMM_HALFTB);
}
if (config.showAntiFire() && event.getMessage().contains(SUPER_ANTIFIRE_DRINK_MESSAGE))