timers: add divine potions
Co-authored-by: Alexsuperfly <alexcsumner@gmail.com>
This commit is contained in:
@@ -78,7 +78,13 @@ enum GameTimer
|
|||||||
ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS, true),
|
ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS, true),
|
||||||
HOME_TELEPORT(SpriteID.SPELL_LUMBRIDGE_HOME_TELEPORT, GameTimerImageType.SPRITE, "Home Teleport", 30, ChronoUnit.MINUTES),
|
HOME_TELEPORT(SpriteID.SPELL_LUMBRIDGE_HOME_TELEPORT, GameTimerImageType.SPRITE, "Home Teleport", 30, ChronoUnit.MINUTES),
|
||||||
MINIGAME_TELEPORT(SpriteID.TAB_QUESTS_RED_MINIGAMES, GameTimerImageType.SPRITE, "Minigame Teleport", 20, ChronoUnit.MINUTES),
|
MINIGAME_TELEPORT(SpriteID.TAB_QUESTS_RED_MINIGAMES, GameTimerImageType.SPRITE, "Minigame Teleport", 20, ChronoUnit.MINUTES),
|
||||||
DRAGON_FIRE_SHIELD(ItemID.DRAGONFIRE_SHIELD_11284, GameTimerImageType.ITEM, "Dragonfire Shield Special", 2, ChronoUnit.MINUTES);
|
DRAGON_FIRE_SHIELD(ItemID.DRAGONFIRE_SHIELD_11284, GameTimerImageType.ITEM, "Dragonfire Shield Special", 2, ChronoUnit.MINUTES),
|
||||||
|
DIVINE_SUPER_ATTACK(ItemID.DIVINE_SUPER_ATTACK_POTION4, GameTimerImageType.ITEM, "Divine Super Attack", 5, ChronoUnit.MINUTES, true),
|
||||||
|
DIVINE_SUPER_STRENGTH(ItemID.DIVINE_SUPER_STRENGTH_POTION4, GameTimerImageType.ITEM, "Divine Super Strength", 5, ChronoUnit.MINUTES, true),
|
||||||
|
DIVINE_SUPER_DEFENCE(ItemID.DIVINE_SUPER_DEFENCE_POTION4, GameTimerImageType.ITEM, "Divine Super Defence", 5, ChronoUnit.MINUTES, true),
|
||||||
|
DIVINE_SUPER_COMBAT(ItemID.DIVINE_SUPER_COMBAT_POTION4, GameTimerImageType.ITEM, "Divine Super Combat", 5, ChronoUnit.MINUTES, true),
|
||||||
|
DIVINE_RANGING(ItemID.DIVINE_RANGING_POTION4, GameTimerImageType.ITEM, "Divine Ranging", 5, ChronoUnit.MINUTES, true),
|
||||||
|
DIVINE_MAGIC(ItemID.DIVINE_MAGIC_POTION4, GameTimerImageType.ITEM, "Divine Magic", 5, ChronoUnit.MINUTES, true);
|
||||||
|
|
||||||
private final Duration duration;
|
private final Duration duration;
|
||||||
private final Integer graphicId;
|
private final Integer graphicId;
|
||||||
|
|||||||
@@ -91,6 +91,16 @@ public interface TimersConfig extends Config
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showDivine",
|
||||||
|
name = "Divine potion timer",
|
||||||
|
description = "Configures whether divine potion timer is displayed"
|
||||||
|
)
|
||||||
|
default boolean showDivine()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showCannon",
|
keyName = "showCannon",
|
||||||
name = "Cannon timer",
|
name = "Cannon timer",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
package net.runelite.client.plugins.timers;
|
package net.runelite.client.plugins.timers;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -108,6 +109,7 @@ public class TimersPlugin extends Plugin
|
|||||||
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.</col>");
|
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.</col>");
|
||||||
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes, 0 seconds\\.</col>");
|
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes, 0 seconds\\.</col>");
|
||||||
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.</col>");
|
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.</col>");
|
||||||
|
private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\.");
|
||||||
|
|
||||||
private TimerTimer freezeTimer;
|
private TimerTimer freezeTimer;
|
||||||
private int freezeTime = -1; // time frozen, in game ticks
|
private int freezeTime = -1; // time frozen, in game ticks
|
||||||
@@ -268,6 +270,16 @@ public class TimersPlugin extends Plugin
|
|||||||
removeGameTimer(PRAYER_ENHANCE);
|
removeGameTimer(PRAYER_ENHANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.showDivine())
|
||||||
|
{
|
||||||
|
removeGameTimer(DIVINE_SUPER_ATTACK);
|
||||||
|
removeGameTimer(DIVINE_SUPER_STRENGTH);
|
||||||
|
removeGameTimer(DIVINE_SUPER_DEFENCE);
|
||||||
|
removeGameTimer(DIVINE_SUPER_COMBAT);
|
||||||
|
removeGameTimer(DIVINE_RANGING);
|
||||||
|
removeGameTimer(DIVINE_MAGIC);
|
||||||
|
}
|
||||||
|
|
||||||
if (!config.showCannon())
|
if (!config.showCannon())
|
||||||
{
|
{
|
||||||
removeGameTimer(CANNON);
|
removeGameTimer(CANNON);
|
||||||
@@ -600,6 +612,40 @@ public class TimersPlugin extends Plugin
|
|||||||
freezeTimer = createGameTimer(ICEBARRAGE);
|
freezeTimer = createGameTimer(ICEBARRAGE);
|
||||||
freezeTime = client.getTickCount();
|
freezeTime = client.getTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.showDivine())
|
||||||
|
{
|
||||||
|
Matcher mDivine = DIVINE_POTION_PATTERN.matcher(event.getMessage());
|
||||||
|
if (mDivine.find())
|
||||||
|
{
|
||||||
|
switch (mDivine.group(1))
|
||||||
|
{
|
||||||
|
case "super attack":
|
||||||
|
createGameTimer(DIVINE_SUPER_ATTACK);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "super strength":
|
||||||
|
createGameTimer(DIVINE_SUPER_STRENGTH);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "super defence":
|
||||||
|
createGameTimer(DIVINE_SUPER_DEFENCE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "combat":
|
||||||
|
createGameTimer(DIVINE_SUPER_COMBAT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "ranging":
|
||||||
|
createGameTimer(DIVINE_RANGING);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "magic":
|
||||||
|
createGameTimer(DIVINE_MAGIC);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
Reference in New Issue
Block a user