From 3115142853c3610f26db422f766ecc59f4d7aff4 Mon Sep 17 00:00:00 2001 From: Robert <42982719+Zytion@users.noreply.github.com> Date: Thu, 29 Apr 2021 20:22:28 -0400 Subject: [PATCH] timers: add pickpocket stun timer --- .../runelite/client/plugins/timers/GameTimer.java | 4 +++- .../client/plugins/timers/TimersConfig.java | 10 ++++++++++ .../client/plugins/timers/TimersPlugin.java | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java index 18a6a1c3ea..6278889dde 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java @@ -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; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java index 5874b62125..b7c0245187 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java @@ -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; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index 73ee344030..8efa8c2ed5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -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."; private static final String WARD_OF_ARCEUUS_MESSAGE = ">Your defence against Arceuus magic has been strengthened."; + 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 (?\\d+) minutes?(?:, (?\\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);