Merge pull request #341 from deathbeam/superantifire-timer
Add support for super antifire potion and antidote++ potion
This commit is contained in:
@@ -44,7 +44,9 @@ 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),
|
||||
ANTIDOTEPLUSPLUS("antidoteplusplus", 12, ChronoUnit.MINUTES);
|
||||
|
||||
private final String imageResource;
|
||||
private final Duration duration;
|
||||
|
||||
@@ -124,4 +124,24 @@ 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;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showAntidotePlusPlus",
|
||||
name = "Antidote++ timer",
|
||||
description = "Configures whether antidote++ timer is displayed"
|
||||
)
|
||||
default boolean showAntidotePlusPlus()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,16 +24,28 @@
|
||||
*/
|
||||
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;
|
||||
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;
|
||||
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 static net.runelite.client.plugins.timers.GameTimer.*;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -90,11 +102,37 @@ public class TimersPlugin extends Plugin
|
||||
{
|
||||
removeGameTimer(SUPERANTIVENOM);
|
||||
}
|
||||
|
||||
if (!config.showTeleblock())
|
||||
{
|
||||
removeGameTimer(FULLTB);
|
||||
removeGameTimer(HALFTB);
|
||||
}
|
||||
|
||||
if (!config.showSuperAntiFire())
|
||||
{
|
||||
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
|
||||
@@ -171,6 +209,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: 751 B |
Binary file not shown.
|
After Width: | Height: | Size: 818 B |
Reference in New Issue
Block a user