timers plugin: change vengeance timers to use varbits
This is more reliable than looking at animations and overheads Co-authored-by: Magic fTail <runecnielsen3132@gmail.com>
This commit is contained in:
@@ -427,7 +427,17 @@ public enum Varbits
|
||||
CURRENT_BANK_TAB(4150),
|
||||
|
||||
WORLDHOPPER_FAVROITE_1(4597),
|
||||
WORLDHOPPER_FAVROITE_2(4598);
|
||||
WORLDHOPPER_FAVROITE_2(4598),
|
||||
|
||||
/**
|
||||
* Vengeance is active
|
||||
*/
|
||||
VENGEANCE_ACTIVE(2450),
|
||||
|
||||
/**
|
||||
* Spell cooldowns
|
||||
*/
|
||||
VENGEANCE_COOLDOWN(2451);
|
||||
|
||||
/**
|
||||
* The raw varbit ID.
|
||||
|
||||
@@ -28,14 +28,13 @@ import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.GraphicID;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
|
||||
enum GameIndicator
|
||||
{
|
||||
VENGEANCE_ACTIVE(SpriteID.SPELL_VENGEANCE_OTHER, GameTimerImageType.SPRITE, GraphicID.VENGEANCE, "Vengeance active");
|
||||
VENGEANCE_ACTIVE(SpriteID.SPELL_VENGEANCE_OTHER, GameTimerImageType.SPRITE, "Vengeance active");
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final String description;
|
||||
@@ -43,24 +42,21 @@ enum GameIndicator
|
||||
private String text;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color textColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final int graphicId;
|
||||
private final int imageId;
|
||||
private final GameTimerImageType imageType;
|
||||
|
||||
GameIndicator(int imageId, GameTimerImageType idType, int graphicId, String description, String text, Color textColor)
|
||||
GameIndicator(int imageId, GameTimerImageType idType, String description, String text, Color textColor)
|
||||
{
|
||||
this.imageId = imageId;
|
||||
this.imageType = idType;
|
||||
this.graphicId = graphicId;
|
||||
this.description = description;
|
||||
this.text = text;
|
||||
this.textColor = textColor;
|
||||
}
|
||||
|
||||
GameIndicator(int imageId, GameTimerImageType idType, int graphicId, String description) // No text
|
||||
GameIndicator(int imageId, GameTimerImageType idType, String description)
|
||||
{
|
||||
this(imageId, idType, graphicId, description, "", null);
|
||||
this(imageId, idType, description, "", null);
|
||||
}
|
||||
|
||||
BufferedImage getImage(ItemManager itemManager, SpriteManager spriteManager)
|
||||
|
||||
@@ -62,8 +62,7 @@ enum GameTimer
|
||||
ICEBLITZ(SpriteID.SPELL_ICE_BLITZ, GameTimerImageType.SPRITE, "Ice blitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS, true),
|
||||
ICEBARRAGE(SpriteID.SPELL_ICE_BARRAGE, GameTimerImageType.SPRITE, "Ice barrage", GraphicID.ICE_BARRAGE, 20, ChronoUnit.SECONDS, true),
|
||||
IMBUEDHEART(ItemID.IMBUED_HEART, GameTimerImageType.ITEM, "Imbued heart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS),
|
||||
VENGEANCE(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance", GraphicID.VENGEANCE, 30, ChronoUnit.SECONDS),
|
||||
VENGEANCEOTHER(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance Other", GraphicID.VENGEANCE_OTHER, 30, ChronoUnit.SECONDS),
|
||||
VENGEANCE(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance", 30, ChronoUnit.SECONDS),
|
||||
ANTIDOTEPLUS(ItemID.ANTIDOTE4, GameTimerImageType.ITEM, "Antidote+", 518, ChronoUnit.SECONDS),
|
||||
ANTIVENOM(ItemID.ANTIVENOM4, GameTimerImageType.ITEM, "Anti-venom", 12, ChronoUnit.MINUTES, true),
|
||||
EXSUPERANTIFIRE(ItemID.EXTENDED_SUPER_ANTIFIRE4, GameTimerImageType.ITEM, "Extended Super AntiFire", 6, ChronoUnit.MINUTES),
|
||||
|
||||
@@ -58,9 +58,7 @@ import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetHiddenChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import static net.runelite.api.widgets.WidgetInfo.PVP_WORLD_SAFE_ZONE;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -72,7 +70,6 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import static net.runelite.client.plugins.timers.GameIndicator.VENGEANCE_ACTIVE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.*;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Timers",
|
||||
@@ -109,13 +106,14 @@ public class TimersPlugin extends Plugin
|
||||
private static final String SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion";
|
||||
private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your super antifire potion has expired.</col>";
|
||||
private static final String SUPER_ANTIVENOM_DRINK_MESSAGE = "You drink some of your super antivenom potion";
|
||||
private static final String VENGEANCE_USED_MESSAGE = "Taste vengeance!";
|
||||
|
||||
private TimerTimer freezeTimer;
|
||||
private int freezeTime = -1; // time frozen, in game ticks
|
||||
|
||||
private int lastRaidVarb;
|
||||
private int lastWildernessVarb;
|
||||
private int lastVengCooldownVarb;
|
||||
private int lastIsVengeancedVarb;
|
||||
private WorldPoint lastPoint;
|
||||
private TeleportWidget lastTeleportClicked;
|
||||
private int lastAnimation;
|
||||
@@ -159,6 +157,9 @@ public class TimersPlugin extends Plugin
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
int raidVarb = client.getVar(Varbits.IN_RAID);
|
||||
int vengCooldownVarb = client.getVar(Varbits.VENGEANCE_COOLDOWN);
|
||||
int isVengeancedVarb = client.getVar(Varbits.VENGEANCE_ACTIVE);
|
||||
|
||||
if (lastRaidVarb != raidVarb)
|
||||
{
|
||||
removeGameTimer(OVERLOAD_RAID);
|
||||
@@ -166,6 +167,34 @@ public class TimersPlugin extends Plugin
|
||||
lastRaidVarb = raidVarb;
|
||||
}
|
||||
|
||||
if (lastVengCooldownVarb != vengCooldownVarb && config.showVengeance())
|
||||
{
|
||||
if (vengCooldownVarb == 1)
|
||||
{
|
||||
createGameTimer(VENGEANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeGameTimer(VENGEANCE);
|
||||
}
|
||||
|
||||
lastVengCooldownVarb = vengCooldownVarb;
|
||||
}
|
||||
|
||||
if (lastIsVengeancedVarb != isVengeancedVarb && config.showVengeanceActive())
|
||||
{
|
||||
if (isVengeancedVarb == 1)
|
||||
{
|
||||
createGameIndicator(VENGEANCE_ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
||||
}
|
||||
|
||||
lastIsVengeancedVarb = isVengeancedVarb;
|
||||
}
|
||||
|
||||
int inWilderness = client.getVar(Varbits.IN_WILDERNESS);
|
||||
|
||||
if (lastWildernessVarb != inWilderness
|
||||
@@ -263,7 +292,11 @@ public class TimersPlugin extends Plugin
|
||||
if (!config.showVengeance())
|
||||
{
|
||||
removeGameTimer(VENGEANCE);
|
||||
removeGameTimer(VENGEANCEOTHER);
|
||||
}
|
||||
|
||||
if (!config.showVengeanceActive())
|
||||
{
|
||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
||||
}
|
||||
|
||||
if (!config.showTeleblock())
|
||||
@@ -401,12 +434,6 @@ public class TimersPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
if (config.showVengeanceActive() && event.getMessage().equals(VENGEANCE_USED_MESSAGE) && event.getType() == ChatMessageType.PUBLIC
|
||||
&& Text.toJagexName(event.getName()).equals(client.getLocalPlayer().getName()))
|
||||
{
|
||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
||||
}
|
||||
|
||||
if (event.getType() != ChatMessageType.FILTERED && event.getType() != ChatMessageType.SERVER)
|
||||
{
|
||||
return;
|
||||
@@ -612,7 +639,6 @@ public class TimersPlugin extends Plugin
|
||||
{
|
||||
case HOPPING:
|
||||
case LOGIN_SCREEN:
|
||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
||||
removeTbTimers();
|
||||
break;
|
||||
case LOGGED_IN:
|
||||
@@ -657,13 +683,6 @@ public class TimersPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.showVengeance()
|
||||
&& actor.getAnimation() == AnimationID.ENERGY_TRANSFER_VENGEANCE_OTHER
|
||||
&& actor.getInteracting().getGraphic() == VENGEANCEOTHER.getGraphicId())
|
||||
{
|
||||
createGameTimer(VENGEANCEOTHER);
|
||||
}
|
||||
|
||||
if (config.showHomeMinigameTeleports()
|
||||
&& client.getLocalPlayer().getAnimation() == AnimationID.IDLE
|
||||
&& (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5
|
||||
@@ -682,15 +701,6 @@ public class TimersPlugin extends Plugin
|
||||
lastAnimation = client.getLocalPlayer().getAnimation();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (config.showVengeanceActive() && event.getGroupId() == WidgetID.ENTERING_HOUSE_GROUP_ID)
|
||||
{
|
||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGraphicChanged(GraphicChanged event)
|
||||
{
|
||||
@@ -706,16 +716,6 @@ public class TimersPlugin extends Plugin
|
||||
createGameTimer(IMBUEDHEART);
|
||||
}
|
||||
|
||||
if (config.showVengeance() && actor.getGraphic() == VENGEANCE.getGraphicId())
|
||||
{
|
||||
createGameTimer(VENGEANCE);
|
||||
}
|
||||
|
||||
if (config.showVengeanceActive() && actor.getGraphic() == VENGEANCE_ACTIVE.getGraphicId())
|
||||
{
|
||||
createGameIndicator(VENGEANCE_ACTIVE);
|
||||
}
|
||||
|
||||
if (config.showFreezes())
|
||||
{
|
||||
if (actor.getGraphic() == BIND.getGraphicId())
|
||||
|
||||
Reference in New Issue
Block a user