From f6873a3bdf52c85db9097b57efef7748c4410240 Mon Sep 17 00:00:00 2001 From: James <38226001+james-munson@users.noreply.github.com> Date: Sun, 21 Apr 2019 11:35:17 -0700 Subject: [PATCH] Add Skull Timer (#32) --- .../client/plugins/timers/GameTimer.java | 3 ++- .../client/plugins/timers/TimersPlugin.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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 03473991f5..f187d27043 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 @@ -78,7 +78,8 @@ enum GameTimer STAFF_OF_THE_DEAD(ItemID.STAFF_OF_THE_DEAD, GameTimerImageType.ITEM, "Staff of the Dead", 1, ChronoUnit.MINUTES), ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS, true), HOME_TELEPORT(SpriteID.SPELL_LUMBRIDGE_HOME_TELEPORT, GameTimerImageType.SPRITE, "Home Teleport", 30, ChronoUnit.MINUTES), - MINIGAME_TELEPORT(SpriteID.TAB_QUESTS_RED_MINIGAMES, GameTimerImageType.SPRITE, "Minigame Teleport", 20, ChronoUnit.MINUTES); + MINIGAME_TELEPORT(SpriteID.TAB_QUESTS_RED_MINIGAMES, GameTimerImageType.SPRITE, "Minigame Teleport", 20, ChronoUnit.MINUTES), + SKULL(SpriteID.PLAYER_KILLER_SKULL_523, GameTimerImageType.SPRITE, "Skull", 20, ChronoUnit.MINUTES); @Getter private final Duration duration; 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 5672ffdd31..18a97e0f00 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 @@ -43,6 +43,7 @@ import net.runelite.api.NPC; import net.runelite.api.NpcID; import net.runelite.api.Player; import net.runelite.api.Prayer; +import net.runelite.api.SkullIcon; import net.runelite.api.Varbits; import net.runelite.api.WorldType; import net.runelite.api.coords.WorldPoint; @@ -120,6 +121,7 @@ public class TimersPlugin extends Plugin private int lastAnimation; private boolean loggedInRace; private boolean widgetHiddenChangedOnPvpWorld; + private boolean skulledLastTick = false; @Inject private ItemManager itemManager; @@ -608,6 +610,21 @@ public class TimersPlugin extends Plugin Player player = client.getLocalPlayer(); WorldPoint currentWorldPoint = player.getWorldLocation(); + final boolean isSkulled = player.getSkullIcon() != null && player.getSkullIcon() != SkullIcon.SKULL_FIGHT_PIT; + + if (isSkulled != skulledLastTick) + { + skulledLastTick = isSkulled; + if (isSkulled) + { + createGameTimer(SKULL); + } + else + { + removeGameTimer(SKULL); + } + } + if (freezeTimer != null) { // assume movement means unfrozen