Merge pull request #6927 from MagicfTail/fix-veng
Change the vengeance indicators to use varbits
This commit is contained in:
@@ -427,7 +427,17 @@ public enum Varbits
|
|||||||
CURRENT_BANK_TAB(4150),
|
CURRENT_BANK_TAB(4150),
|
||||||
|
|
||||||
WORLDHOPPER_FAVROITE_1(4597),
|
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.
|
* The raw varbit ID.
|
||||||
|
|||||||
@@ -28,14 +28,13 @@ import java.awt.Color;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.GraphicID;
|
|
||||||
import net.runelite.api.SpriteID;
|
import net.runelite.api.SpriteID;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.client.game.SpriteManager;
|
||||||
|
|
||||||
enum GameIndicator
|
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)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final String description;
|
private final String description;
|
||||||
@@ -43,24 +42,21 @@ enum GameIndicator
|
|||||||
private String text;
|
private String text;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private Color textColor;
|
private Color textColor;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
|
||||||
private final int graphicId;
|
|
||||||
private final int imageId;
|
private final int imageId;
|
||||||
private final GameTimerImageType imageType;
|
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.imageId = imageId;
|
||||||
this.imageType = idType;
|
this.imageType = idType;
|
||||||
this.graphicId = graphicId;
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.textColor = textColor;
|
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)
|
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),
|
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),
|
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),
|
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),
|
VENGEANCE(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance", 30, ChronoUnit.SECONDS),
|
||||||
VENGEANCEOTHER(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance Other", GraphicID.VENGEANCE_OTHER, 30, ChronoUnit.SECONDS),
|
|
||||||
ANTIDOTEPLUS(ItemID.ANTIDOTE4, GameTimerImageType.ITEM, "Antidote+", 518, ChronoUnit.SECONDS),
|
ANTIDOTEPLUS(ItemID.ANTIDOTE4, GameTimerImageType.ITEM, "Antidote+", 518, ChronoUnit.SECONDS),
|
||||||
ANTIVENOM(ItemID.ANTIVENOM4, GameTimerImageType.ITEM, "Anti-venom", 12, ChronoUnit.MINUTES, true),
|
ANTIVENOM(ItemID.ANTIVENOM4, GameTimerImageType.ITEM, "Anti-venom", 12, ChronoUnit.MINUTES, true),
|
||||||
EXSUPERANTIFIRE(ItemID.EXTENDED_SUPER_ANTIFIRE4, GameTimerImageType.ITEM, "Extended Super AntiFire", 6, ChronoUnit.MINUTES),
|
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.NpcDespawned;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.api.events.WidgetHiddenChanged;
|
import net.runelite.api.events.WidgetHiddenChanged;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import static net.runelite.api.widgets.WidgetInfo.PVP_WORLD_SAFE_ZONE;
|
import static net.runelite.api.widgets.WidgetInfo.PVP_WORLD_SAFE_ZONE;
|
||||||
import net.runelite.client.config.ConfigManager;
|
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.GameIndicator.VENGEANCE_ACTIVE;
|
||||||
import static net.runelite.client.plugins.timers.GameTimer.*;
|
import static net.runelite.client.plugins.timers.GameTimer.*;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
import net.runelite.client.util.Text;
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Timers",
|
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_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_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 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 TimerTimer freezeTimer;
|
||||||
private int freezeTime = -1; // time frozen, in game ticks
|
private int freezeTime = -1; // time frozen, in game ticks
|
||||||
|
|
||||||
private int lastRaidVarb;
|
private int lastRaidVarb;
|
||||||
private int lastWildernessVarb;
|
private int lastWildernessVarb;
|
||||||
|
private int lastVengCooldownVarb;
|
||||||
|
private int lastIsVengeancedVarb;
|
||||||
private WorldPoint lastPoint;
|
private WorldPoint lastPoint;
|
||||||
private TeleportWidget lastTeleportClicked;
|
private TeleportWidget lastTeleportClicked;
|
||||||
private int lastAnimation;
|
private int lastAnimation;
|
||||||
@@ -159,6 +157,9 @@ public class TimersPlugin extends Plugin
|
|||||||
public void onVarbitChanged(VarbitChanged event)
|
public void onVarbitChanged(VarbitChanged event)
|
||||||
{
|
{
|
||||||
int raidVarb = client.getVar(Varbits.IN_RAID);
|
int raidVarb = client.getVar(Varbits.IN_RAID);
|
||||||
|
int vengCooldownVarb = client.getVar(Varbits.VENGEANCE_COOLDOWN);
|
||||||
|
int isVengeancedVarb = client.getVar(Varbits.VENGEANCE_ACTIVE);
|
||||||
|
|
||||||
if (lastRaidVarb != raidVarb)
|
if (lastRaidVarb != raidVarb)
|
||||||
{
|
{
|
||||||
removeGameTimer(OVERLOAD_RAID);
|
removeGameTimer(OVERLOAD_RAID);
|
||||||
@@ -166,6 +167,34 @@ public class TimersPlugin extends Plugin
|
|||||||
lastRaidVarb = raidVarb;
|
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);
|
int inWilderness = client.getVar(Varbits.IN_WILDERNESS);
|
||||||
|
|
||||||
if (lastWildernessVarb != inWilderness
|
if (lastWildernessVarb != inWilderness
|
||||||
@@ -263,7 +292,11 @@ public class TimersPlugin extends Plugin
|
|||||||
if (!config.showVengeance())
|
if (!config.showVengeance())
|
||||||
{
|
{
|
||||||
removeGameTimer(VENGEANCE);
|
removeGameTimer(VENGEANCE);
|
||||||
removeGameTimer(VENGEANCEOTHER);
|
}
|
||||||
|
|
||||||
|
if (!config.showVengeanceActive())
|
||||||
|
{
|
||||||
|
removeGameIndicator(VENGEANCE_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.showTeleblock())
|
if (!config.showTeleblock())
|
||||||
@@ -401,12 +434,6 @@ public class TimersPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onChatMessage(ChatMessage event)
|
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)
|
if (event.getType() != ChatMessageType.FILTERED && event.getType() != ChatMessageType.SERVER)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -612,7 +639,6 @@ public class TimersPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
case HOPPING:
|
case HOPPING:
|
||||||
case LOGIN_SCREEN:
|
case LOGIN_SCREEN:
|
||||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
|
||||||
removeTbTimers();
|
removeTbTimers();
|
||||||
break;
|
break;
|
||||||
case LOGGED_IN:
|
case LOGGED_IN:
|
||||||
@@ -657,13 +683,6 @@ public class TimersPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.showVengeance()
|
|
||||||
&& actor.getAnimation() == AnimationID.ENERGY_TRANSFER_VENGEANCE_OTHER
|
|
||||||
&& actor.getInteracting().getGraphic() == VENGEANCEOTHER.getGraphicId())
|
|
||||||
{
|
|
||||||
createGameTimer(VENGEANCEOTHER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.showHomeMinigameTeleports()
|
if (config.showHomeMinigameTeleports()
|
||||||
&& client.getLocalPlayer().getAnimation() == AnimationID.IDLE
|
&& client.getLocalPlayer().getAnimation() == AnimationID.IDLE
|
||||||
&& (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5
|
&& (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5
|
||||||
@@ -682,15 +701,6 @@ public class TimersPlugin extends Plugin
|
|||||||
lastAnimation = client.getLocalPlayer().getAnimation();
|
lastAnimation = client.getLocalPlayer().getAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onWidgetLoaded(WidgetLoaded event)
|
|
||||||
{
|
|
||||||
if (config.showVengeanceActive() && event.getGroupId() == WidgetID.ENTERING_HOUSE_GROUP_ID)
|
|
||||||
{
|
|
||||||
removeGameIndicator(VENGEANCE_ACTIVE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGraphicChanged(GraphicChanged event)
|
public void onGraphicChanged(GraphicChanged event)
|
||||||
{
|
{
|
||||||
@@ -706,16 +716,6 @@ public class TimersPlugin extends Plugin
|
|||||||
createGameTimer(IMBUEDHEART);
|
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 (config.showFreezes())
|
||||||
{
|
{
|
||||||
if (actor.getGraphic() == BIND.getGraphicId())
|
if (actor.getGraphic() == BIND.getGraphicId())
|
||||||
|
|||||||
Reference in New Issue
Block a user