timers: add pickpocket stun timer

This commit is contained in:
Robert
2021-04-29 20:22:28 -04:00
committed by Adam
parent 5f3d6dfdcb
commit 3115142853
3 changed files with 27 additions and 2 deletions

View File

@@ -86,7 +86,9 @@ enum GameTimer
RESURRECT_THRALL_COOLDOWN(SpriteID.SPELL_RESURRECT_SUPERIOR_SKELETON_DISABLED, GameTimerImageType.SPRITE, "Resurrect thrall cooldown", 12, GAME_TICKS),
WARD_OF_ARCEUUS_COOLDOWN(SpriteID.SPELL_WARD_OF_ARCEUUS_DISABLED, GameTimerImageType.SPRITE, "Ward of Arceuus cooldown", 30, ChronoUnit.SECONDS),
DEATH_CHARGE_COOLDOWN(SpriteID.SPELL_DEATH_CHARGE_DISABLED, GameTimerImageType.SPRITE, "Death charge cooldown", 60, ChronoUnit.SECONDS),
CORRUPTION_COOLDOWN(SpriteID.SPELL_GREATER_CORRUPTION_DISABLED, GameTimerImageType.SPRITE, "Corruption cooldown", 30, ChronoUnit.SECONDS);
CORRUPTION_COOLDOWN(SpriteID.SPELL_GREATER_CORRUPTION_DISABLED, GameTimerImageType.SPRITE, "Corruption cooldown", 30, ChronoUnit.SECONDS),
PICKPOCKET_STUN(SpriteID.SKILL_THIEVING, GameTimerImageType.SPRITE, "Stunned", true)
;
@Nullable
private final Duration duration;

View File

@@ -283,4 +283,14 @@ public interface TimersConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "showPickpocketStun",
name = "Pickpocket stun timer",
description = "Configures whether pickpocket stun timer is displayed"
)
default boolean showPickpocketStun()
{
return true;
}
}

View File

@@ -82,7 +82,7 @@ import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "Timers",
description = "Show various timers in an infobox",
tags = {"combat", "items", "magic", "potions", "prayer", "overlay", "abyssal", "sire", "inferno", "fight", "caves", "cape", "timer", "tzhaar"}
tags = {"combat", "items", "magic", "potions", "prayer", "overlay", "abyssal", "sire", "inferno", "fight", "caves", "cape", "timer", "tzhaar", "thieving", "pickpocket"}
)
@Slf4j
public class TimersPlugin extends Plugin
@@ -126,6 +126,7 @@ public class TimersPlugin extends Plugin
private static final String RESURRECT_THRALL_DISAPPEAR_MESSAGE_START = ">Your ";
private static final String RESURRECT_THRALL_DISAPPEAR_MESSAGE_END = " thrall returns to the grave.</col>";
private static final String WARD_OF_ARCEUUS_MESSAGE = ">Your defence against Arceuus magic has been strengthened.</col>";
private static final String PICKPOCKET_FAILURE_MESSAGE = "You fail to pick the ";
private static final Pattern TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you(?: by .+)?\\. It will expire in (?<mins>\\d+) minutes?(?:, (?<secs>\\d+) seconds?)?\\.");
private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\.");
@@ -502,6 +503,18 @@ public class TimersPlugin extends Plugin
return;
}
if (message.contains(PICKPOCKET_FAILURE_MESSAGE) && config.showPickpocketStun() && message.contains("pocket"))
{
if (message.contains("hero") || message.contains("elf"))
{
createGameTimer(PICKPOCKET_STUN, Duration.ofSeconds(6));
}
else
{
createGameTimer(PICKPOCKET_STUN, Duration.ofSeconds(5));
}
}
if (message.equals(ABYSSAL_SIRE_STUN_MESSAGE) && config.showAbyssalSireStun())
{
createGameTimer(ABYSSAL_SIRE_STUN);