Merge pull request #443 from Sethtroll/addtimers

Fix up timer plugin/add missing potions
This commit is contained in:
Adam
2018-01-26 18:23:59 -05:00
committed by GitHub
8 changed files with 163 additions and 39 deletions

View File

@@ -38,29 +38,33 @@ import net.runelite.api.GraphicID;
@Slf4j
public enum GameTimer
{
STAMINA("stamina", 2, ChronoUnit.MINUTES),
ANTIFIRE("antifire", 6, ChronoUnit.MINUTES),
EXANTIFIRE("exantifire", 12, ChronoUnit.MINUTES),
OVERLOAD("overload", 5, ChronoUnit.MINUTES),
CANNON("cannon", 25, ChronoUnit.MINUTES),
MAGICIMBUE("magicimbue", 15, ChronoUnit.SECONDS),
FULLTB("teleblock", 5, ChronoUnit.MINUTES),
HALFTB("teleblock", 150, ChronoUnit.SECONDS),
SUPERANTIVENOM("antivenom", 3, ChronoUnit.MINUTES),
SUPERANTIFIRE("superantifire", 2, ChronoUnit.MINUTES),
ANTIDOTEPLUSPLUS("antidoteplusplus", 12, ChronoUnit.MINUTES),
BIND("bind", GraphicID.BIND, 5, ChronoUnit.SECONDS),
HALFBIND("bind", GraphicID.BIND, 2500, ChronoUnit.MILLIS),
SNARE("snare", GraphicID.SNARE, 10, ChronoUnit.SECONDS),
HALFSNARE("snare", GraphicID.SNARE, 5, ChronoUnit.SECONDS),
ENTANGLE("entangle", GraphicID.ENTANGLE, 15, ChronoUnit.SECONDS),
HALFENTANGLE("entangle", GraphicID.ENTANGLE, 7500, ChronoUnit.MILLIS),
ICERUSH("icerush", GraphicID.ICE_RUSH, 5, ChronoUnit.SECONDS),
ICEBURST("iceburst", GraphicID.ICE_BURST, 10, ChronoUnit.SECONDS),
ICEBLITZ("iceblitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS),
ICEBARRAGE("icebarrage", GraphicID.ICE_BARRAGE, 20, ChronoUnit.SECONDS),
IMBUEDHEART("imbuedheart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS),
VENGEANCE("vengeance", GraphicID.VENGEANCE, 30, ChronoUnit.SECONDS);
STAMINA("stamina", "Stamina", 2, ChronoUnit.MINUTES),
ANTIFIRE("antifire", "Antifire", 6, ChronoUnit.MINUTES),
EXANTIFIRE("exantifire", "Extended antifire", 12, ChronoUnit.MINUTES),
OVERLOAD("overload", "Overload", 5, ChronoUnit.MINUTES),
CANNON("cannon", "Cannon", 25, ChronoUnit.MINUTES),
MAGICIMBUE("magicimbue", "Magic imbue", 15, ChronoUnit.SECONDS),
FULLTB("teleblock", "Full Teleblock", 5, ChronoUnit.MINUTES),
HALFTB("teleblock", "Half Teleblock", 150, ChronoUnit.SECONDS),
ANTIVENOMPLUS("antivenomplus", "Anti-venom+", 3, ChronoUnit.MINUTES),
SUPERANTIFIRE("superantifire", "Super antifire", 2, ChronoUnit.MINUTES),
ANTIDOTEPLUSPLUS("antidoteplusplus", "Antidote++", 12, ChronoUnit.MINUTES),
BIND("bind", "Bind", GraphicID.BIND, 5, ChronoUnit.SECONDS),
HALFBIND("bind", "Half Bind", GraphicID.BIND, 2500, ChronoUnit.MILLIS),
SNARE("snare", "Snare", GraphicID.SNARE, 10, ChronoUnit.SECONDS),
HALFSNARE("snare", "Half Snare", GraphicID.SNARE, 5, ChronoUnit.SECONDS),
ENTANGLE("entangle", "Engangle", GraphicID.ENTANGLE, 15, ChronoUnit.SECONDS),
HALFENTANGLE("entangle", "Half Entangle", GraphicID.ENTANGLE, 7500, ChronoUnit.MILLIS),
ICERUSH("icerush", "Ice rush", GraphicID.ICE_RUSH, 5, ChronoUnit.SECONDS),
ICEBURST("iceburst", "Ice burst", GraphicID.ICE_BURST, 10, ChronoUnit.SECONDS),
ICEBLITZ("iceblitz", "Ice blitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS),
ICEBARRAGE("icebarrage", "Ice barrage", GraphicID.ICE_BARRAGE, 20, ChronoUnit.SECONDS),
IMBUEDHEART("imbuedheart", "Imbued heart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS),
VENGEANCE("vengeance", "Vengeance", GraphicID.VENGEANCE, 30, ChronoUnit.SECONDS),
ANTIDOTEPLUS("antidoteplus", "Antidote+", 518, ChronoUnit.SECONDS),
ANTIVENOM("antivenom", "Anto-venom", 12, ChronoUnit.MINUTES),
EXSUPERANTIFIRE("exsuperantifire", "Extended Super AntiFire", 6, ChronoUnit.MINUTES),
SANFEW("sanfew", "Sanfew serum", 6, ChronoUnit.MINUTES);
@Getter
private final String imageResource;
@@ -68,19 +72,22 @@ public enum GameTimer
private final Duration duration;
@Getter
private final Integer graphicId;
@Getter
private final String description;
private BufferedImage image;
GameTimer(String imageResource, Integer graphicId, long time, ChronoUnit unit)
GameTimer(String imageResource, String description, Integer graphicId, long time, ChronoUnit unit)
{
this.imageResource = imageResource;
this.description = description;
this.graphicId = graphicId;
this.duration = Duration.of(time, unit);
}
GameTimer(String imageResource, long time, ChronoUnit unit)
GameTimer(String imageResource, String description, long time, ChronoUnit unit)
{
this(imageResource, null, time, unit);
this(imageResource, description, null, time, unit);
}
public BufferedImage getImage()

View File

@@ -67,7 +67,7 @@ public interface TimersConfig extends Config
@ConfigItem(
keyName = "showExAntiFire",
name = "Extended Antifire timer",
name = "Extended antifire timer",
description = "Configures whether extended antifire timer is displayed"
)
default boolean showExAntiFire()
@@ -97,7 +97,7 @@ public interface TimersConfig extends Config
@ConfigItem(
keyName = "showMagicImbue",
name = "Magic Imbue timer",
name = "Magic imbue timer",
description = "Configures whether magic imbue timer is displayed"
)
default boolean showMagicImbue()
@@ -116,18 +116,18 @@ public interface TimersConfig extends Config
}
@ConfigItem(
keyName = "showAntiVenom",
name = "Anti Venom+ timer",
keyName = "showAntiVenomPlus",
name = "Anti-venom+ timer",
description = "Configures whether anti venom+ timer is displayed"
)
default boolean showAntiVenom()
default boolean showAntiVenomPlus()
{
return true;
}
@ConfigItem(
keyName = "showSuperAntiFire",
name = "Super Antifire timer",
name = "Super antifire timer",
description = "Configures whether super antifire timer is displayed"
)
default boolean showSuperAntiFire()
@@ -147,7 +147,7 @@ public interface TimersConfig extends Config
@ConfigItem(
keyName = "showImbuedHeart",
name = "Imbued Heart timer",
name = "Imbued heart timer",
description = "Configures whether imbued heart timer is displayed"
)
default boolean showImbuedHeart()
@@ -174,4 +174,44 @@ public interface TimersConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "showExSuperAntifire",
name = "Extended super antifire timer",
description = "Configures whether extended super antifire timer is displayed"
)
default boolean showExSuperAntifire()
{
return true;
}
@ConfigItem(
keyName = "showSanfew",
name = "Sanfew serum timer",
description = "Configures whether sanfew serum timer is displayed"
)
default boolean showSanfew()
{
return true;
}
@ConfigItem(
keyName = "showAntidotePlus",
name = "Antidote+ timer",
description = "Configures whether antidote+ timer is displayed"
)
default boolean showAntidotePlus()
{
return true;
}
@ConfigItem(
keyName = "showAntiVenom",
name = "Anti-venom timer",
description = "Configures whether antivenom timer is displayed"
)
default boolean showAntiVenom()
{
return true;
}
}

View File

@@ -24,17 +24,21 @@
*/
package net.runelite.client.plugins.timers;
import static net.runelite.client.plugins.timers.GameTimer.ANTIDOTEPLUS;
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.ANTIVENOM;
import static net.runelite.client.plugins.timers.GameTimer.ANTIVENOMPLUS;
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.EXSUPERANTIFIRE;
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.SANFEW;
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 static net.runelite.client.plugins.timers.GameTimer.BIND;
import static net.runelite.client.plugins.timers.GameTimer.ENTANGLE;
import static net.runelite.client.plugins.timers.GameTimer.HALFBIND;
@@ -123,9 +127,9 @@ public class TimersPlugin extends Plugin
removeGameTimer(MAGICIMBUE);
}
if (!config.showAntiVenom())
if (!config.showAntiVenomPlus())
{
removeGameTimer(SUPERANTIVENOM);
removeGameTimer(ANTIVENOMPLUS);
}
if (!config.showTeleblock())
@@ -143,6 +147,50 @@ public class TimersPlugin extends Plugin
{
removeGameTimer(ANTIDOTEPLUSPLUS);
}
if (!config.showAntidotePlus())
{
removeGameTimer(ANTIDOTEPLUS);
}
if (!config.showAntiVenom())
{
removeGameTimer(ANTIVENOM);
}
if (!config.showAntiVenomPlus())
{
removeGameTimer(ANTIVENOMPLUS);
}
if (!config.showSanfew())
{
removeGameTimer(SANFEW);
}
if (!config.showVengeance())
{
removeGameTimer(VENGEANCE);
}
if (!config.showImbuedHeart())
{
removeGameTimer(IMBUEDHEART);
}
if (!config.showFreezes())
{
removeGameTimer(BIND);
removeGameTimer(HALFBIND);
removeGameTimer(SNARE);
removeGameTimer(HALFSNARE);
removeGameTimer(ENTANGLE);
removeGameTimer(HALFENTANGLE);
removeGameTimer(ICERUSH);
removeGameTimer(ICEBURST);
removeGameTimer(ICEBLITZ);
removeGameTimer(ICEBARRAGE);
}
}
@Subscribe
@@ -157,6 +205,19 @@ public class TimersPlugin extends Plugin
{
// Needs menu option hook because drink message is intercepting with antipoison message
createGameTimer(ANTIDOTEPLUSPLUS);
return;
}
if (config.showAntidotePlus()
&& event.getMenuOption().contains("Drink")
&& (event.getId() == ItemID.ANTIDOTE1
|| event.getId() == ItemID.ANTIDOTE2
|| event.getId() == ItemID.ANTIDOTE3
|| event.getId() == ItemID.ANTIDOTE4))
{
// Needs menu option hook because drink message is intercepting with antipoison message
createGameTimer(ANTIDOTEPLUS);
return;
}
}
@@ -188,6 +249,11 @@ public class TimersPlugin extends Plugin
createGameTimer(EXANTIFIRE);
}
if (event.getMessage().equals("You drink some of your extended super antifire potion.") && config.showExSuperAntifire())
{
createGameTimer(EXSUPERANTIFIRE);
}
if (event.getMessage().equals("<col=7f007f>Your antifire potion has expired.</col>"))
{
//they have the same expired message
@@ -210,9 +276,9 @@ public class TimersPlugin extends Plugin
removeGameTimer(CANNON);
}
if (event.getMessage().contains("You drink some of your super antivenom potion") && config.showAntiVenom())
if (event.getMessage().contains("You drink some of your super antivenom potion") && config.showAntiVenomPlus())
{
createGameTimer(SUPERANTIVENOM);
createGameTimer(ANTIVENOMPLUS);
}
if (event.getMessage().equals("You are charged to combine runes!") && config.showMagicImbue())
@@ -249,6 +315,16 @@ public class TimersPlugin extends Plugin
{
removeGameTimer(IMBUEDHEART);
}
if (event.getMessage().contains("You drink some of your antivenom potion") && config.showAntiVenom())
{
createGameTimer(ANTIVENOM);
}
if (event.getMessage().contains("You drink some of your Sanfew Serum.") && config.showSanfew())
{
createGameTimer(SANFEW);
}
}
@Subscribe
@@ -336,6 +412,7 @@ public class TimersPlugin extends Plugin
removeGameTimer(timer);
TimerTimer t = new TimerTimer(timer);
t.setTooltip(timer.getDescription());
infoBoxManager.addInfoBox(t);
}
@@ -343,4 +420,4 @@ public class TimersPlugin extends Plugin
{
infoBoxManager.removeIf(t -> t instanceof TimerTimer && ((TimerTimer) t).getTimer() == timer);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B