From c431a18a37fd86234add5daa8ee1881732d2ab0a Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 8 Jan 2018 22:50:00 +0100 Subject: [PATCH 1/2] Add support for super antifire potion Add support for newly introduced super antifire potion to TimersPlugin. Signed-off-by: Tomas Slusny --- .../client/plugins/timers/GameTimer.java | 3 +- .../client/plugins/timers/TimersConfig.java | 10 +++++++ .../client/plugins/timers/TimersPlugin.java | 27 +++++++++++++++++- .../client/plugins/timers/superantifire.png | Bin 0 -> 818 bytes 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/timers/superantifire.png 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 397ca1cee9..29b28a214c 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 @@ -44,7 +44,8 @@ public enum GameTimer MAGICIMBUE("magicimbue", 15, ChronoUnit.SECONDS), FULLTB("teleblock", 5, ChronoUnit.MINUTES), HALFTB("teleblock", 150, ChronoUnit.SECONDS), - SUPERANTIVENOM("antivenom", 3, ChronoUnit.MINUTES); + SUPERANTIVENOM("antivenom", 3, ChronoUnit.MINUTES), + SUPERANTIFIRE("superantifire", 2, ChronoUnit.MINUTES); private final String imageResource; 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 44e8cc4003..f7e1ad04e3 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 @@ -124,4 +124,14 @@ public interface TimersConfig extends Config { return true; } + + @ConfigItem( + keyName = "showSuperAntiFire", + name = "Super Antifire timer", + description = "Configures whether super antifire timer is displayed" + ) + default boolean showSuperAntiFire() + { + 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 75b659a6cd..124cdbb123 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 @@ -24,6 +24,16 @@ */ package net.runelite.client.plugins.timers; +import static net.runelite.client.plugins.timers.GameTimer.ANTIFIRE; +import static net.runelite.client.plugins.timers.GameTimer.CANNON; +import static net.runelite.client.plugins.timers.GameTimer.EXANTIFIRE; +import static net.runelite.client.plugins.timers.GameTimer.FULLTB; +import static net.runelite.client.plugins.timers.GameTimer.HALFTB; +import static net.runelite.client.plugins.timers.GameTimer.MAGICIMBUE; +import static net.runelite.client.plugins.timers.GameTimer.OVERLOAD; +import static net.runelite.client.plugins.timers.GameTimer.STAMINA; +import static net.runelite.client.plugins.timers.GameTimer.SUPERANTIFIRE; +import static net.runelite.client.plugins.timers.GameTimer.SUPERANTIVENOM; import com.google.common.eventbus.Subscribe; import com.google.inject.Provides; import javax.inject.Inject; @@ -33,7 +43,6 @@ import net.runelite.client.events.ChatMessage; import net.runelite.client.events.ConfigChanged; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import static net.runelite.client.plugins.timers.GameTimer.*; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; @PluginDescriptor( @@ -90,11 +99,17 @@ public class TimersPlugin extends Plugin { removeGameTimer(SUPERANTIVENOM); } + if (!config.showTeleblock()) { removeGameTimer(FULLTB); removeGameTimer(HALFTB); } + + if (!config.showSuperAntiFire()) + { + removeGameTimer(SUPERANTIFIRE); + } } @Subscribe @@ -171,6 +186,16 @@ public class TimersPlugin extends Plugin { createGameTimer(HALFTB); } + + if (event.getMessage().contains("You drink some of your super antifire potion") && config.showSuperAntiFire()) + { + createGameTimer(SUPERANTIFIRE); + } + + if (event.getMessage().equals("Your super antifire potion has expired.") && config.showSuperAntiFire()) + { + removeGameTimer(SUPERANTIFIRE); + } } public void createGameTimer(GameTimer timer) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timers/superantifire.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timers/superantifire.png new file mode 100644 index 0000000000000000000000000000000000000000..6bd815a555c32bd2ce06bb62455842c287fa4e3a GIT binary patch literal 818 zcmV-21I_%2P)Px%>`6pHR7l6Amc5HqR~W{B?|aU z2$o_NLq>zOWLD=t)JF`18=e!no_Rh@C$JNaY2WIYYpZj~C z=RNNkq4Fg*{N1GTjw-=#zMf-ir_I*ZK5Lsz9{sUWDeSABI``>WVk%(&{%4g>KK_uq z_g~mFVXYE96zp~*F&Z(ZO2hPBy^N_4jL{}|U0J@^)oTlQr$Cc#H`47yQcrk({u15? z9zT9G)`p3mo;c9};NhRO^4i|s2XxvU>Wwx#JKOIcRHIQJX^-9AoMeesvq>}0k0DyG zm!DHg618D zG)c0As#fl-siKWW4G|$FLwXV_`hWTq&gJu%8AegQilVAqyf}BfKD~2&kz|RF*5*pW z&8DY*uz|MUyf3NPjVt$|9nO2a4^wGJNM{=-5fP#dPa_q@sl#i)iB6@}LCV`- zeoq$ql+jYTN@3@F-s(i!q4eun14S`2M234?R1t9nr3Qivq?E`~dlKm=rI}%71LaFU zEElHImgQ%mhU#eB9*V0dio>~3gw>-}btB&DVdCCp#r__6kKGm`D6XXSE+FFg{KDmu zRsn(!1V5VOpty(@w7sxI``!kZ4UIbm$b7w5YQijy6<5(Rte{2tDucv*Zxu{#E`D{y z$5HWuv=^2+ma z#>&wn`P+q`OM$}&h$x+Ihfa5&gU$i#yKmUt-)43DHNP+aIx@6n+IfHH`eJW}7K6Io w-RJfC3Y+;Vzx?&X#1o+MztrU4CLbqn0g!V+9a!q;tN;K207*qoM6N<$f}9VGzW@LL literal 0 HcmV?d00001 From e75d7986894f02fc9185e3209dcd4e350d86f0fd Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 9 Jan 2018 00:55:34 +0100 Subject: [PATCH 2/2] Add Antidote++ timer to TimerPlugin Add missing Antidote++ timer to TimerPlugin Closes #334 Signed-off-by: Tomas Slusny --- .../client/plugins/timers/GameTimer.java | 3 ++- .../client/plugins/timers/TimersConfig.java | 10 ++++++++ .../client/plugins/timers/TimersPlugin.java | 23 ++++++++++++++++++ .../plugins/timers/antidoteplusplus.png | Bin 0 -> 751 bytes 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/timers/antidoteplusplus.png 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 29b28a214c..c961e68e24 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 @@ -45,7 +45,8 @@ public enum GameTimer FULLTB("teleblock", 5, ChronoUnit.MINUTES), HALFTB("teleblock", 150, ChronoUnit.SECONDS), SUPERANTIVENOM("antivenom", 3, ChronoUnit.MINUTES), - SUPERANTIFIRE("superantifire", 2, ChronoUnit.MINUTES); + SUPERANTIFIRE("superantifire", 2, ChronoUnit.MINUTES), + ANTIDOTEPLUSPLUS("antidoteplusplus", 12, ChronoUnit.MINUTES); private final String imageResource; 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 f7e1ad04e3..12f77b56df 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 @@ -134,4 +134,14 @@ public interface TimersConfig extends Config { return true; } + + @ConfigItem( + keyName = "showAntidotePlusPlus", + name = "Antidote++ timer", + description = "Configures whether antidote++ timer is displayed" + ) + default boolean showAntidotePlusPlus() + { + 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 124cdbb123..12098e141c 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 @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.timers; +import static net.runelite.client.plugins.timers.GameTimer.ANTIDOTEPLUSPLUS; import static net.runelite.client.plugins.timers.GameTimer.ANTIFIRE; import static net.runelite.client.plugins.timers.GameTimer.CANNON; import static net.runelite.client.plugins.timers.GameTimer.EXANTIFIRE; @@ -38,9 +39,11 @@ import com.google.common.eventbus.Subscribe; import com.google.inject.Provides; import javax.inject.Inject; import net.runelite.api.ChatMessageType; +import net.runelite.api.ItemID; import net.runelite.client.config.ConfigManager; import net.runelite.client.events.ChatMessage; import net.runelite.client.events.ConfigChanged; +import net.runelite.client.events.MenuOptionClicked; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; @@ -110,6 +113,26 @@ public class TimersPlugin extends Plugin { removeGameTimer(SUPERANTIFIRE); } + + if (!config.showAntidotePlusPlus()) + { + removeGameTimer(ANTIDOTEPLUSPLUS); + } + } + + @Subscribe + public void onMenuOptionClicked(MenuOptionClicked event) + { + if (config.showAntidotePlusPlus() + && event.getMenuOption().contains("Drink") + && (event.getId() == ItemID.ANTIDOTE1_5958 + || event.getId() == ItemID.ANTIDOTE2_5956 + || event.getId() == ItemID.ANTIDOTE3_5954 + || event.getId() == ItemID.ANTIDOTE4_5952)) + { + // Needs menu option hook because drink message is intercepting with antipoison message + createGameTimer(ANTIDOTEPLUSPLUS); + } } @Subscribe diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timers/antidoteplusplus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timers/antidoteplusplus.png new file mode 100644 index 0000000000000000000000000000000000000000..e269b23c73fe46fb281e282a4d9c31c3bf66bc0c GIT binary patch literal 751 zcmVPx%sYygZR7l62mQ8CDQ51&Xd+to8)275C(v5q;l@?-3mtFW5y6_hWqM}fwpi39x z+HDu^ims%Bf)OkTVsWK{8^MJwrA-ZKrqg6{&v7vy$)xkqX5d0*CV9_u&U@~;Q7FBX zr0+$Q{-R9q$%6*koj%&_9uEF_c>Cc`sjyWRb*X+C#)Ponf9>Pyl}mX3Vq1!YsZ2B$ z33r1(HC9{AH!?5Jkx-@+yD=W94wFb~dFfbu03yfhbFW-b^+j#$OGqVi2 zHJzE61^~QnI?1zcw}yT{z?9oZr_(vVQLY<_sUb+`s0$W`?;qpX>rNs%HBwIwYsw7Y z_i^lb@Crm#kx?5Pui&~<5MhV_>+3JkIy}JEr;mjjp|DSz%_ipNY9I=mgoTsO6Zfg> zI#5bML;!>xG!&hvPl1c`+Yk{51S|ql1X6^0eQ~lrU0rK{S>VoYMT82~3oS795g7lx zq)Kkzy@qPlPCfm*a|BHa76IBK+*q8?rOiygR&z25v?h>Nu!vyUbXHO&ckW+@7w?u)vn&ECj?Sc|q?Q#L zPWX&9Zq_*M;?j_o0Km3&%AoA@RobkGHg2)eEECbQUa?sTZM+#YVWA$<5+Lf?(=VlB zT2sobm{!|_0W;d|9=?6u10X6HC_%ufx)qsaR|x*e0KRW<)ahYw*Tc^rhslgp<45x9 zS|ds`9l$WqJ240XgI4PVo)_R?-^1sv-BUwb6`l8w9ybzU!$8ny?Cf;WY4@=C=6CK1 hQ2Jjg|6TrZ@*ngq8*}r8Wz7Hp002ovPDHLkV1mwkTvPx6 literal 0 HcmV?d00001