From 1c76e38d4da9d608f74ec3ec87cf0c07b3b1615a Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Thu, 31 May 2018 17:04:02 +0100 Subject: [PATCH 1/2] Add Charge Timer --- .../main/java/net/runelite/api/GraphicID.java | 1 + .../client/plugins/timers/GameTimer.java | 3 ++- .../client/plugins/timers/TimersConfig.java | 21 +++++++++++++----- .../client/plugins/timers/TimersPlugin.java | 11 +++++++++ .../runelite/client/plugins/timers/charge.png | Bin 0 -> 908 bytes 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/timers/charge.png diff --git a/runelite-api/src/main/java/net/runelite/api/GraphicID.java b/runelite-api/src/main/java/net/runelite/api/GraphicID.java index 7ef582f2d6..d13f5b9396 100644 --- a/runelite-api/src/main/java/net/runelite/api/GraphicID.java +++ b/runelite-api/src/main/java/net/runelite/api/GraphicID.java @@ -26,6 +26,7 @@ package net.runelite.api; public class GraphicID { + public static final int CHARGE = 111; public static final int ENTANGLE = 179; public static final int SNARE = 180; public static final int BIND = 181; 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 150ccb16ce..988fc90706 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 @@ -69,7 +69,8 @@ public enum GameTimer PRAYER_ENHANCE("prayerenhance", "Prayer enhance", 275, ChronoUnit.SECONDS), GOD_WARS_ALTAR("altar", "God wars altar", 10, ChronoUnit.MINUTES), ANTIPOISON("antipoison", "Antipoison", 90, ChronoUnit.SECONDS), - SUPERANTIPOISON("superantipoison", "Superantipoison", 346, ChronoUnit.SECONDS); + SUPERANTIPOISON("superantipoison", "Superantipoison", 346, ChronoUnit.SECONDS), + CHARGE("charge", "Charge", GraphicID.CHARGE, 6, ChronoUnit.MINUTES); @Getter private final String imageResource; 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 df6ac55643..310f7a9b42 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 @@ -213,6 +213,17 @@ public interface TimersConfig extends Config @ConfigItem( position = 16, + keyName = "showCharge", + name = "Charge timer", + description = "Configures whether to show a timer for the Charge spell" + ) + default boolean showCharge() + { + return true; + } + + @ConfigItem( + position = 17, keyName = "showImbuedHeart", name = "Imbued heart timer", description = "Configures whether imbued heart timer is displayed" @@ -223,7 +234,7 @@ public interface TimersConfig extends Config } @ConfigItem( - position = 17, + position = 18, keyName = "showVengeance", name = "Vengeance timer", description = "Configures whether vengeance timer is displayed" @@ -234,7 +245,7 @@ public interface TimersConfig extends Config } @ConfigItem( - position = 18, + position = 19, keyName = "showVengeanceOther", name = "Vengeance Other timer", description = "Configures whether vengeance other timer is displayed" @@ -245,7 +256,7 @@ public interface TimersConfig extends Config } @ConfigItem( - position = 19, + position = 20, keyName = "showTeleblock", name = "Teleblock timer", description = "Configures whether teleblock timer is displayed" @@ -256,7 +267,7 @@ public interface TimersConfig extends Config } @ConfigItem( - position = 20, + position = 21, keyName = "showFreezes", name = "Freeze timer", description = "Configures whether freeze timer is displayed" @@ -267,7 +278,7 @@ public interface TimersConfig extends Config } @ConfigItem( - position = 21, + position = 22, keyName = "showGodWarsAltar", name = "God wars altar timer", description = "Configures whether god wars altar timer is displayed" 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 e9d264d8de..e72f727df1 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 @@ -51,6 +51,7 @@ import static net.runelite.client.plugins.timers.GameTimer.ANTIVENOM; import static net.runelite.client.plugins.timers.GameTimer.ANTIVENOMPLUS; import static net.runelite.client.plugins.timers.GameTimer.BIND; import static net.runelite.client.plugins.timers.GameTimer.CANNON; +import static net.runelite.client.plugins.timers.GameTimer.CHARGE; import static net.runelite.client.plugins.timers.GameTimer.ENTANGLE; import static net.runelite.client.plugins.timers.GameTimer.EXANTIFIRE; import static net.runelite.client.plugins.timers.GameTimer.EXSUPERANTIFIRE; @@ -121,6 +122,11 @@ public class TimersPlugin extends Plugin @Subscribe public void updateConfig(ConfigChanged event) { + if (!config.showCharge()) + { + removeGameTimer(CHARGE); + } + if (!config.showStamina()) { removeGameTimer(STAMINA); @@ -425,6 +431,11 @@ public class TimersPlugin extends Plugin return; } + if (config.showCharge() && actor.getGraphic() == CHARGE.getGraphicId()) + { + createGameTimer(CHARGE); + } + if (config.showImbuedHeart() && actor.getGraphic() == IMBUEDHEART.getGraphicId()) { createGameTimer(IMBUEDHEART); diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timers/charge.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timers/charge.png new file mode 100644 index 0000000000000000000000000000000000000000..ac40b6bb1609296410783be6bc8fc7dd31f82d62 GIT binary patch literal 908 zcmV;719SX|P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;2FkAZe8V00R6;L_t(IPkmI|auPuhoxQSbE(Vs}4JMcb z^&`#AnDW&ppDf>E5?@nZzDFS}>;mxvG;loKOE5;TtGZ@sdd{5F-81H)S(btC8MwZI z?HbI&bMqX7D&qn3R{1>(FEQJ|BUtbH5}od+g@7UdAAJ9cVeb+vJk&MIKnYf@8jSN} z4D%NRJ%i1dA(J?6V>4>QH!gd~1K zMB23UIC%uaa@Zs>7*SDif`EHM$rtpjccC(cnMWX(Zdn#V9m@7$84qdFQp^dx7VYvN zPY9i?P(|AwW`&2Y2&PnP@ zr5ov_xFhSGREwvZ0JV+Bl(&tjo?`M#kmy2@YmiDq-K(o#LsmVnX*~s3efZ( zIzJmVY0iHD%USa2tMpJMmEO`uC=OTgq_GQ!1nhFO{+Nu3&)P}L18s;T1PW~H>5hIk z;~hYlN=XRVOtuuvX1+92nksH84D`Q!L4JLq^Jk>fS{GZpSW0sB>S>1wx|O!!GDpB< zY&zLFx}7To(&bg6%H6yf9wOvm8(#Rba{?$}9BPh;f{C$qX|%;Sho5-?2fJUq)CWag zAtO@PcuJ8UVK_d96PBRzFo>l24VjHe95p!byiGED%*}32k&RB3UFEKx(hR-N#XIEV z6RgxqDOwY Date: Sat, 2 Jun 2018 23:39:07 +0100 Subject: [PATCH 2/2] Reorder updateConfig to match TimerConfig --- .../client/plugins/timers/TimersPlugin.java | 110 +++++++++--------- 1 file changed, 55 insertions(+), 55 deletions(-) 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 e72f727df1..31f9603fb1 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 @@ -122,51 +122,9 @@ public class TimersPlugin extends Plugin @Subscribe public void updateConfig(ConfigChanged event) { - if (!config.showCharge()) + if (!config.showAntidotePlus()) { - removeGameTimer(CHARGE); - } - - if (!config.showStamina()) - { - removeGameTimer(STAMINA); - } - - if (!config.showAntiFire()) - { - removeGameTimer(ANTIFIRE); - } - - if (!config.showExAntiFire()) - { - removeGameTimer(EXANTIFIRE); - } - - if (!config.showOverload()) - { - removeGameTimer(OVERLOAD); - removeGameTimer(OVERLOAD_RAID); - } - - if (!config.showCannon()) - { - removeGameTimer(CANNON); - } - - if (!config.showMagicImbue()) - { - removeGameTimer(MAGICIMBUE); - } - - if (!config.showTeleblock()) - { - removeGameTimer(FULLTB); - removeGameTimer(HALFTB); - } - - if (!config.showSuperAntiFire()) - { - removeGameTimer(SUPERANTIFIRE); + removeGameTimer(ANTIDOTEPLUS); } if (!config.showAntidotePlusPlus()) @@ -174,9 +132,9 @@ public class TimersPlugin extends Plugin removeGameTimer(ANTIDOTEPLUSPLUS); } - if (!config.showAntidotePlus()) + if (!config.showSanfew()) { - removeGameTimer(ANTIDOTEPLUS); + removeGameTimer(SANFEW); } if (!config.showAntiVenom()) @@ -189,9 +147,55 @@ public class TimersPlugin extends Plugin removeGameTimer(ANTIVENOMPLUS); } - if (!config.showSanfew()) + if (!config.showAntiFire()) { - removeGameTimer(SANFEW); + removeGameTimer(ANTIFIRE); + } + + if (!config.showExAntiFire()) + { + removeGameTimer(EXANTIFIRE); + } + + if (!config.showSuperAntiFire()) + { + removeGameTimer(SUPERANTIFIRE); + } + + if (!config.showStamina()) + { + removeGameTimer(STAMINA); + } + + if (!config.showOverload()) + { + removeGameTimer(OVERLOAD); + removeGameTimer(OVERLOAD_RAID); + } + + if (!config.showPrayerEnhance()) + { + removeGameTimer(PRAYER_ENHANCE); + } + + if (!config.showCannon()) + { + removeGameTimer(CANNON); + } + + if (!config.showMagicImbue()) + { + removeGameTimer(MAGICIMBUE); + } + + if (!config.showCharge()) + { + removeGameTimer(CHARGE); + } + + if (!config.showImbuedHeart()) + { + removeGameTimer(IMBUEDHEART); } if (!config.showVengeance()) @@ -204,9 +208,10 @@ public class TimersPlugin extends Plugin removeGameTimer(VENGEANCEOTHER); } - if (!config.showImbuedHeart()) + if (!config.showTeleblock()) { - removeGameTimer(IMBUEDHEART); + removeGameTimer(FULLTB); + removeGameTimer(HALFTB); } if (!config.showFreezes()) @@ -222,11 +227,6 @@ public class TimersPlugin extends Plugin removeGameTimer(ICEBLITZ); removeGameTimer(ICEBARRAGE); } - - if (!config.showPrayerEnhance()) - { - removeGameTimer(PRAYER_ENHANCE); - } } @Subscribe