|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
|
|
|
|
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
|
|
|
|
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.com>
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
@@ -26,94 +27,95 @@
|
|
|
|
|
package net.runelite.client.plugins.timers;
|
|
|
|
|
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import lombok.Getter;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import net.runelite.api.GraphicID;
|
|
|
|
|
import net.runelite.api.ItemID;
|
|
|
|
|
import net.runelite.api.SpriteID;
|
|
|
|
|
import net.runelite.client.game.ItemManager;
|
|
|
|
|
import net.runelite.client.game.SpriteManager;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public enum GameTimer
|
|
|
|
|
{
|
|
|
|
|
STAMINA("stamina", "Stamina", 2, ChronoUnit.MINUTES),
|
|
|
|
|
ANTIFIRE("antifire", "Antifire", 6, ChronoUnit.MINUTES),
|
|
|
|
|
EXANTIFIRE("exantifire", "Extended antifire", 12, ChronoUnit.MINUTES),
|
|
|
|
|
OVERLOAD("overload", "Overload", 5, ChronoUnit.MINUTES),
|
|
|
|
|
CANNON("cannon", "Cannon", 25, ChronoUnit.MINUTES),
|
|
|
|
|
MAGICIMBUE("magicimbue", "Magic imbue", 12, ChronoUnit.SECONDS),
|
|
|
|
|
FULLTB("teleblock", "Full Teleblock", 5, ChronoUnit.MINUTES),
|
|
|
|
|
HALFTB("teleblock", "Half Teleblock", 150, ChronoUnit.SECONDS),
|
|
|
|
|
ANTIVENOMPLUS("antivenomplus", "Anti-venom+", 3, ChronoUnit.MINUTES),
|
|
|
|
|
SUPERANTIFIRE("superantifire", "Super antifire", 3, ChronoUnit.MINUTES),
|
|
|
|
|
ANTIDOTEPLUSPLUS("antidoteplusplus", "Antidote++", 12, ChronoUnit.MINUTES),
|
|
|
|
|
BIND("bind", "Bind", GraphicID.BIND, 5, ChronoUnit.SECONDS),
|
|
|
|
|
HALFBIND("bind", "Half Bind", GraphicID.BIND, 2500, ChronoUnit.MILLIS),
|
|
|
|
|
SNARE("snare", "Snare", GraphicID.SNARE, 10, ChronoUnit.SECONDS),
|
|
|
|
|
HALFSNARE("snare", "Half Snare", GraphicID.SNARE, 5, ChronoUnit.SECONDS),
|
|
|
|
|
ENTANGLE("entangle", "Engangle", GraphicID.ENTANGLE, 15, ChronoUnit.SECONDS),
|
|
|
|
|
HALFENTANGLE("entangle", "Half Entangle", GraphicID.ENTANGLE, 7500, ChronoUnit.MILLIS),
|
|
|
|
|
ICERUSH("icerush", "Ice rush", GraphicID.ICE_RUSH, 5, ChronoUnit.SECONDS),
|
|
|
|
|
ICEBURST("iceburst", "Ice burst", GraphicID.ICE_BURST, 10, ChronoUnit.SECONDS),
|
|
|
|
|
ICEBLITZ("iceblitz", "Ice blitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS),
|
|
|
|
|
ICEBARRAGE("icebarrage", "Ice barrage", GraphicID.ICE_BARRAGE, 20, ChronoUnit.SECONDS),
|
|
|
|
|
IMBUEDHEART("imbuedheart", "Imbued heart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS),
|
|
|
|
|
VENGEANCE("vengeance", "Vengeance", GraphicID.VENGEANCE, 30, ChronoUnit.SECONDS),
|
|
|
|
|
VENGEANCEOTHER("vengeanceother", "Vengeance Other", GraphicID.VENGEANCE_OTHER, 30, ChronoUnit.SECONDS),
|
|
|
|
|
ANTIDOTEPLUS("antidoteplus", "Antidote+", 518, ChronoUnit.SECONDS),
|
|
|
|
|
ANTIVENOM("antivenom", "Anti-venom", 12, ChronoUnit.MINUTES),
|
|
|
|
|
EXSUPERANTIFIRE("exsuperantifire", "Extended Super AntiFire", 6, ChronoUnit.MINUTES),
|
|
|
|
|
SANFEW("sanfew", "Sanfew serum", 6, ChronoUnit.MINUTES),
|
|
|
|
|
OVERLOAD_RAID("overloadraid", "Overload", 5, ChronoUnit.MINUTES),
|
|
|
|
|
PRAYER_ENHANCE("prayerenhance", "Prayer enhance", 275, ChronoUnit.SECONDS),
|
|
|
|
|
GOD_WARS_ALTAR("altar", "God wars altar", 10, ChronoUnit.MINUTES),
|
|
|
|
|
ANTIPOISON("antipoison", "Antipoison", 90, ChronoUnit.SECONDS),
|
|
|
|
|
SUPERANTIPOISON("superantipoison", "Superantipoison", 346, ChronoUnit.SECONDS),
|
|
|
|
|
CHARGE("charge", "Charge", 6, ChronoUnit.MINUTES),
|
|
|
|
|
STAFF_OF_THE_DEAD("staffofthedead", "Staff of the Dead", 1, ChronoUnit.MINUTES);
|
|
|
|
|
STAMINA(ItemID.STAMINA_POTION4, GameTimerImageType.ITEM, "Stamina", 2, ChronoUnit.MINUTES),
|
|
|
|
|
ANTIFIRE(ItemID.ANTIFIRE_POTION4, GameTimerImageType.ITEM, "Antifire", 6, ChronoUnit.MINUTES),
|
|
|
|
|
EXANTIFIRE(ItemID.EXTENDED_ANTIFIRE4, GameTimerImageType.ITEM, "Extended antifire", 12, ChronoUnit.MINUTES),
|
|
|
|
|
OVERLOAD(ItemID.OVERLOAD_4, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES),
|
|
|
|
|
CANNON(ItemID.CANNON_BARRELS, GameTimerImageType.ITEM, "Cannon", 25, ChronoUnit.MINUTES),
|
|
|
|
|
MAGICIMBUE(SpriteID.SPELL_MAGIC_IMBUE, GameTimerImageType.SPRITE, "Magic imbue", 12, ChronoUnit.SECONDS),
|
|
|
|
|
FULLTB(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Full Teleblock", 5, ChronoUnit.MINUTES),
|
|
|
|
|
HALFTB(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Half Teleblock", 150, ChronoUnit.SECONDS),
|
|
|
|
|
ANTIVENOMPLUS(ItemID.ANTIVENOM4_12913, GameTimerImageType.ITEM, "Anti-venom+", 3, ChronoUnit.MINUTES),
|
|
|
|
|
SUPERANTIFIRE(ItemID.SUPER_ANTIFIRE_POTION4, GameTimerImageType.ITEM, "Super antifire", 3, ChronoUnit.MINUTES),
|
|
|
|
|
ANTIDOTEPLUSPLUS(ItemID.ANTIDOTE4_5952, GameTimerImageType.ITEM, "Antidote++", 12, ChronoUnit.MINUTES),
|
|
|
|
|
BIND(SpriteID.SPELL_BIND, GameTimerImageType.SPRITE, "Bind", GraphicID.BIND, 5, ChronoUnit.SECONDS),
|
|
|
|
|
HALFBIND(SpriteID.SPELL_BIND, GameTimerImageType.SPRITE, "Half Bind", GraphicID.BIND, 2500, ChronoUnit.MILLIS),
|
|
|
|
|
SNARE(SpriteID.SPELL_SNARE, GameTimerImageType.SPRITE, "Snare", GraphicID.SNARE, 10, ChronoUnit.SECONDS),
|
|
|
|
|
HALFSNARE(SpriteID.SPELL_SNARE, GameTimerImageType.SPRITE, "Half Snare", GraphicID.SNARE, 5, ChronoUnit.SECONDS),
|
|
|
|
|
ENTANGLE(SpriteID.SPELL_ENTANGLE, GameTimerImageType.SPRITE, "Engangle", GraphicID.ENTANGLE, 15, ChronoUnit.SECONDS),
|
|
|
|
|
HALFENTANGLE(SpriteID.SPELL_ENTANGLE, GameTimerImageType.SPRITE, "Half Entangle", GraphicID.ENTANGLE, 7500, ChronoUnit.MILLIS),
|
|
|
|
|
ICERUSH(SpriteID.SPELL_ICE_RUSH, GameTimerImageType.SPRITE, "Ice rush", GraphicID.ICE_RUSH, 5, ChronoUnit.SECONDS),
|
|
|
|
|
ICEBURST(SpriteID.SPELL_ICE_BURST, GameTimerImageType.SPRITE, "Ice burst", GraphicID.ICE_BURST, 10, ChronoUnit.SECONDS),
|
|
|
|
|
ICEBLITZ(SpriteID.SPELL_ICE_BLITZ, GameTimerImageType.SPRITE, "Ice blitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS),
|
|
|
|
|
ICEBARRAGE(SpriteID.SPELL_ICE_BARRAGE, GameTimerImageType.SPRITE, "Ice barrage", GraphicID.ICE_BARRAGE, 20, 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),
|
|
|
|
|
VENGEANCEOTHER(SpriteID.SPELL_VENGEANCE_OTHER, GameTimerImageType.SPRITE, "Vengeance Other", GraphicID.VENGEANCE_OTHER, 30, ChronoUnit.SECONDS),
|
|
|
|
|
ANTIDOTEPLUS(ItemID.ANTIDOTE4, GameTimerImageType.ITEM, "Antidote+", 518, ChronoUnit.SECONDS),
|
|
|
|
|
ANTIVENOM(ItemID.ANTIVENOM4, GameTimerImageType.ITEM, "Anti-venom", 12, ChronoUnit.MINUTES),
|
|
|
|
|
EXSUPERANTIFIRE(ItemID.EXTENDED_SUPER_ANTIFIRE4, GameTimerImageType.ITEM, "Extended Super AntiFire", 6, ChronoUnit.MINUTES),
|
|
|
|
|
SANFEW(ItemID.SANFEW_SERUM4, GameTimerImageType.ITEM, "Sanfew serum", 6, ChronoUnit.MINUTES),
|
|
|
|
|
OVERLOAD_RAID(ItemID.OVERLOAD_4_20996, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES),
|
|
|
|
|
PRAYER_ENHANCE(ItemID.PRAYER_ENHANCE_4, GameTimerImageType.ITEM, "Prayer enhance", 275, ChronoUnit.SECONDS),
|
|
|
|
|
GOD_WARS_ALTAR(SpriteID.SKILL_PRAYER, GameTimerImageType.SPRITE, "God wars altar", 10, ChronoUnit.MINUTES),
|
|
|
|
|
ANTIPOISON(ItemID.ANTIPOISON4, GameTimerImageType.ITEM, "Antipoison", 90, ChronoUnit.SECONDS),
|
|
|
|
|
SUPERANTIPOISON(ItemID.SUPERANTIPOISON4, GameTimerImageType.ITEM, "Superantipoison", 346, ChronoUnit.SECONDS),
|
|
|
|
|
CHARGE(SpriteID.SPELL_CHARGE, GameTimerImageType.SPRITE, "Charge", 6, ChronoUnit.MINUTES),
|
|
|
|
|
STAFF_OF_THE_DEAD(ItemID.STAFF_OF_THE_DEAD, GameTimerImageType.ITEM, "Staff of the Dead", 1, ChronoUnit.MINUTES);
|
|
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
|
private final String imageResource;
|
|
|
|
|
@Getter
|
|
|
|
|
private final Duration duration;
|
|
|
|
|
@Getter
|
|
|
|
|
private final Integer graphicId;
|
|
|
|
|
@Getter
|
|
|
|
|
private final String description;
|
|
|
|
|
private int imageId = -1;
|
|
|
|
|
private GameTimerImageType imageType;
|
|
|
|
|
|
|
|
|
|
private BufferedImage image;
|
|
|
|
|
|
|
|
|
|
GameTimer(String imageResource, String description, Integer graphicId, long time, ChronoUnit unit)
|
|
|
|
|
GameTimer(int imageId, GameTimerImageType idType, String description, Integer graphicId, long time, ChronoUnit unit)
|
|
|
|
|
{
|
|
|
|
|
this.imageResource = imageResource;
|
|
|
|
|
this.description = description;
|
|
|
|
|
this.graphicId = graphicId;
|
|
|
|
|
this.duration = Duration.of(time, unit);
|
|
|
|
|
this.imageId = imageId;
|
|
|
|
|
this.imageType = idType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GameTimer(String imageResource, String description, long time, ChronoUnit unit)
|
|
|
|
|
GameTimer(int imageId, GameTimerImageType idType, String description, long time, ChronoUnit unit)
|
|
|
|
|
{
|
|
|
|
|
this(imageResource, description, null, time, unit);
|
|
|
|
|
this(imageId, idType, description, null, time, unit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BufferedImage getImage()
|
|
|
|
|
public BufferedImage getImage(ItemManager itemManager, SpriteManager spriteManager)
|
|
|
|
|
{
|
|
|
|
|
if (image != null)
|
|
|
|
|
{
|
|
|
|
|
return image;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
switch (imageType)
|
|
|
|
|
{
|
|
|
|
|
synchronized (ImageIO.class)
|
|
|
|
|
{
|
|
|
|
|
image = ImageIO.read(GameTimer.class.getResourceAsStream(imageResource + ".png"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (IOException ex)
|
|
|
|
|
{
|
|
|
|
|
log.warn("unable to load image", ex);
|
|
|
|
|
case ITEM:
|
|
|
|
|
image = itemManager.getImage(imageId);
|
|
|
|
|
break;
|
|
|
|
|
case SPRITE:
|
|
|
|
|
image = spriteManager.getSprite(imageId, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return image;
|
|
|
|
|
|