Add support for super antifire potion

Add support for newly introduced super antifire potion to TimersPlugin.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-01-08 22:50:00 +01:00
parent 26aec4fe1c
commit c431a18a37
4 changed files with 38 additions and 2 deletions

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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("<col=7f007f>Your super antifire potion has expired.</col>") && config.showSuperAntiFire())
{
removeGameTimer(SUPERANTIFIRE);
}
}
public void createGameTimer(GameTimer timer)

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B