Merge pull request #5298 from Nightfirecat/home-minigame-teleport-timers
Add home and minigame teleport cooldown timers
This commit is contained in:
@@ -133,6 +133,17 @@ public final class AnimationID
|
||||
public static final int DEMONIC_GORILLA_AOE_ATTACK = 7228;
|
||||
public static final int DEMONIC_GORILLA_PRAYER_SWITCH = 7228;
|
||||
public static final int DEMONIC_GORILLA_DEFEND = 7224;
|
||||
public static final int BOOK_HOME_TELEPORT_1 = 4847;
|
||||
public static final int BOOK_HOME_TELEPORT_2 = 4850;
|
||||
public static final int BOOK_HOME_TELEPORT_3 = 4853;
|
||||
public static final int BOOK_HOME_TELEPORT_4 = 4855;
|
||||
public static final int BOOK_HOME_TELEPORT_5 = 4857;
|
||||
public static final int COW_HOME_TELEPORT_1 = 1696;
|
||||
public static final int COW_HOME_TELEPORT_2 = 1697;
|
||||
public static final int COW_HOME_TELEPORT_3 = 1698;
|
||||
public static final int COW_HOME_TELEPORT_4 = 1699;
|
||||
public static final int COW_HOME_TELEPORT_5 = 1700;
|
||||
public static final int COW_HOME_TELEPORT_6 = 1701;
|
||||
|
||||
// NPC animations
|
||||
public static final int TZTOK_JAD_MAGIC_ATTACK = 2656;
|
||||
|
||||
@@ -37,6 +37,10 @@ public class GraphicID
|
||||
public static final int ICE_BARRAGE = 369;
|
||||
public static final int VENGEANCE_OTHER = 725;
|
||||
public static final int VENGEANCE = 726;
|
||||
public static final int BOOK_HOME_TELEPORT_1 = 800;
|
||||
public static final int BOOK_HOME_TELEPORT_2 = 802;
|
||||
public static final int BOOK_HOME_TELEPORT_3 = 803;
|
||||
public static final int BOOK_HOME_TELEPORT_4 = 804;
|
||||
public static final int STAFF_OF_THE_DEAD = 1228;
|
||||
public static final int IMBUED_HEART = 1316;
|
||||
public static final int FLYING_FISH = 1387;
|
||||
|
||||
@@ -114,6 +114,8 @@ public class WidgetID
|
||||
public static final int DIALOG_OPTION_GROUP_ID = 219;
|
||||
public static final int DIALOG_PLAYER_GROUP_ID = 217;
|
||||
public static final int FOSSIL_ISLAND_OXYGENBAR_ID = 609;
|
||||
public static final int MINIGAME_TAB_ID = 76;
|
||||
public static final int SPELLBOOK_GROUP_ID = 218;
|
||||
|
||||
static class WorldMap
|
||||
{
|
||||
@@ -650,4 +652,29 @@ public class WidgetID
|
||||
{
|
||||
static final int FOSSIL_ISLAND_OXYGEN_BAR = 4;
|
||||
}
|
||||
|
||||
static class Minigames
|
||||
{
|
||||
static final int TELEPORT_BUTTON = 29;
|
||||
}
|
||||
|
||||
static class StandardSpellBook
|
||||
{
|
||||
static final int LUMBRIDGE_HOME_TELEPORT = 1;
|
||||
}
|
||||
|
||||
static class AncientSpellBook
|
||||
{
|
||||
static final int EDGEVILLE_HOME_TELEPORT = 97;
|
||||
}
|
||||
|
||||
static class LunarSpellBook
|
||||
{
|
||||
static final int LUNAR_HOME_TELEPORT = 99;
|
||||
}
|
||||
|
||||
static class ArceuusSpellBook
|
||||
{
|
||||
static final int ARCEUUS_HOME_TELEPORT = 145;
|
||||
}
|
||||
}
|
||||
@@ -406,7 +406,14 @@ public enum WidgetInfo
|
||||
|
||||
WORLD_SWITCHER_LIST(WidgetID.WORLD_SWITCHER_GROUP_ID, WidgetID.WorldSwitcher.WORLD_LIST),
|
||||
|
||||
FOSSIL_ISLAND_OXYGENBAR(WidgetID.FOSSIL_ISLAND_OXYGENBAR_ID, WidgetID.FossilOxygen.FOSSIL_ISLAND_OXYGEN_BAR);
|
||||
FOSSIL_ISLAND_OXYGENBAR(WidgetID.FOSSIL_ISLAND_OXYGENBAR_ID, WidgetID.FossilOxygen.FOSSIL_ISLAND_OXYGEN_BAR),
|
||||
|
||||
MINIGAME_TELEPORT_BUTTON(WidgetID.MINIGAME_TAB_ID, WidgetID.Minigames.TELEPORT_BUTTON),
|
||||
|
||||
SPELL_LUMBRIDGE_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.LUMBRIDGE_HOME_TELEPORT),
|
||||
SPELL_EDGEVILLE_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.AncientSpellBook.EDGEVILLE_HOME_TELEPORT),
|
||||
SPELL_LUNAR_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.LunarSpellBook.LUNAR_HOME_TELEPORT),
|
||||
SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.ArceuusSpellBook.ARCEUUS_HOME_TELEPORT);
|
||||
|
||||
private final int groupId;
|
||||
private final int childId;
|
||||
|
||||
@@ -75,7 +75,9 @@ enum GameTimer
|
||||
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),
|
||||
ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS);
|
||||
ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS),
|
||||
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);
|
||||
|
||||
@Getter
|
||||
private final Duration duration;
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.plugins.timers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
|
||||
enum TeleportWidget
|
||||
{
|
||||
HOME_TELEPORT,
|
||||
MINIGAME_TELEPORT;
|
||||
|
||||
private static final Collection HOME_TELEPORT_IDS = ImmutableList.of(
|
||||
WidgetInfo.SPELL_LUMBRIDGE_HOME_TELEPORT.getId(),
|
||||
WidgetInfo.SPELL_EDGEVILLE_HOME_TELEPORT.getId(),
|
||||
WidgetInfo.SPELL_LUNAR_HOME_TELEPORT.getId(),
|
||||
WidgetInfo.SPELL_ARCEUUS_HOME_TELEPORT.getId()
|
||||
);
|
||||
private static final Collection MINIGAME_TELEPORT_IDS = ImmutableList.of(
|
||||
WidgetInfo.MINIGAME_TELEPORT_BUTTON.getId()
|
||||
);
|
||||
|
||||
@Nullable
|
||||
static TeleportWidget of(int widgetId)
|
||||
{
|
||||
if (HOME_TELEPORT_IDS.contains(widgetId))
|
||||
{
|
||||
return HOME_TELEPORT;
|
||||
}
|
||||
else if (MINIGAME_TELEPORT_IDS.contains(widgetId))
|
||||
{
|
||||
return MINIGAME_TELEPORT;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,17 @@ public interface TimersConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "showHomeMinigameTeleports",
|
||||
name = "Teleport cooldown timers",
|
||||
description = "Configures whether timers for home and minigame teleport cooldowns are displayed"
|
||||
)
|
||||
default boolean showHomeMinigameTeleports()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "showAntipoison",
|
||||
name = "Antipoison timer",
|
||||
description = "Configures whether Antipoison timer is displayed"
|
||||
@@ -43,7 +54,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
position = 2,
|
||||
keyName = "showSuperantipoison",
|
||||
name = "Superantipoison timer",
|
||||
description = "Configures whether Superantipoison timer is displayed"
|
||||
@@ -54,7 +65,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
position = 3,
|
||||
keyName = "showAntidotePlus",
|
||||
name = "Antidote+ timer",
|
||||
description = "Configures whether antidote+ timer is displayed"
|
||||
@@ -65,7 +76,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
position = 4,
|
||||
keyName = "showAntidotePlusPlus",
|
||||
name = "Antidote++ timer",
|
||||
description = "Configures whether antidote++ timer is displayed"
|
||||
@@ -76,7 +87,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
position = 5,
|
||||
keyName = "showSanfew",
|
||||
name = "Sanfew serum timer",
|
||||
description = "Configures whether sanfew serum timer is displayed"
|
||||
@@ -87,7 +98,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
position = 6,
|
||||
keyName = "showAntiVenom",
|
||||
name = "Anti-venom timer",
|
||||
description = "Configures whether antivenom timer is displayed"
|
||||
@@ -98,7 +109,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
position = 7,
|
||||
keyName = "showAntiVenomPlus",
|
||||
name = "Anti-venom+ timer",
|
||||
description = "Configures whether anti venom+ timer is displayed"
|
||||
@@ -109,7 +120,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
position = 8,
|
||||
keyName = "showAntiFire",
|
||||
name = "Antifire timer",
|
||||
description = "Configures whether antifire timer is displayed"
|
||||
@@ -120,7 +131,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
position = 9,
|
||||
keyName = "showExAntiFire",
|
||||
name = "Extended antifire timer",
|
||||
description = "Configures whether extended antifire timer is displayed"
|
||||
@@ -131,7 +142,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
position = 10,
|
||||
keyName = "showSuperAntiFire",
|
||||
name = "Super antifire timer",
|
||||
description = "Configures whether super antifire timer is displayed"
|
||||
@@ -142,7 +153,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
position = 11,
|
||||
keyName = "showExSuperAntifire",
|
||||
name = "Extended super antifire timer",
|
||||
description = "Configures whether extended super antifire timer is displayed"
|
||||
@@ -153,7 +164,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
position = 12,
|
||||
keyName = "showStamina",
|
||||
name = "Stamina timer",
|
||||
description = "Configures whether stamina timer is displayed"
|
||||
@@ -164,7 +175,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
position = 13,
|
||||
keyName = "showOverload",
|
||||
name = "Overload timer",
|
||||
description = "Configures whether overload timer is displayed"
|
||||
@@ -175,7 +186,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
position = 14,
|
||||
keyName = "showPrayerEnhance",
|
||||
name = "Prayer enhance timer",
|
||||
description = "Configures whether prayer enhance timer is displayed"
|
||||
@@ -186,7 +197,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
position = 15,
|
||||
keyName = "showCannon",
|
||||
name = "Cannon timer",
|
||||
description = "Configures whether cannon timer is displayed"
|
||||
@@ -197,7 +208,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
position = 16,
|
||||
keyName = "showMagicImbue",
|
||||
name = "Magic imbue timer",
|
||||
description = "Configures whether magic imbue timer is displayed"
|
||||
@@ -208,7 +219,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
position = 17,
|
||||
keyName = "showCharge",
|
||||
name = "Charge timer",
|
||||
description = "Configures whether to show a timer for the Charge spell"
|
||||
@@ -219,7 +230,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 17,
|
||||
position = 18,
|
||||
keyName = "showImbuedHeart",
|
||||
name = "Imbued heart timer",
|
||||
description = "Configures whether imbued heart timer is displayed"
|
||||
@@ -230,7 +241,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 18,
|
||||
position = 19,
|
||||
keyName = "showVengeance",
|
||||
name = "Vengeance timer",
|
||||
description = "Configures whether vengeance timer is displayed"
|
||||
@@ -241,7 +252,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 19,
|
||||
position = 20,
|
||||
keyName = "showVengeanceOther",
|
||||
name = "Vengeance Other timer",
|
||||
description = "Configures whether vengeance other timer is displayed"
|
||||
@@ -252,7 +263,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 20,
|
||||
position = 21,
|
||||
keyName = "showTeleblock",
|
||||
name = "Teleblock timer",
|
||||
description = "Configures whether teleblock timer is displayed"
|
||||
@@ -263,7 +274,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 21,
|
||||
position = 22,
|
||||
keyName = "showFreezes",
|
||||
name = "Freeze timer",
|
||||
description = "Configures whether freeze timer is displayed"
|
||||
@@ -274,7 +285,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 22,
|
||||
position = 23,
|
||||
keyName = "showGodWarsAltar",
|
||||
name = "God wars altar timer",
|
||||
description = "Configures whether god wars altar timer is displayed"
|
||||
@@ -285,7 +296,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 23,
|
||||
position = 24,
|
||||
keyName = "showStaffOfTheDead",
|
||||
name = "Staff of the Dead timer",
|
||||
description = "Configures whether staff of the dead timer is displayed"
|
||||
@@ -296,7 +307,7 @@ public interface TimersConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 24,
|
||||
position = 25,
|
||||
keyName = "showAbyssalSireStun",
|
||||
name = "Abyssal Sire Stun Timer",
|
||||
description = "Configures whether Abyssal Sire stun timer is displayed"
|
||||
|
||||
@@ -102,6 +102,8 @@ public class TimersPlugin extends Plugin
|
||||
|
||||
private int lastRaidVarb;
|
||||
private WorldPoint lastPoint;
|
||||
private TeleportWidget lastTeleportClicked;
|
||||
private int lastAnimation;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
@@ -128,6 +130,10 @@ public class TimersPlugin extends Plugin
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
infoBoxManager.removeIf(t -> t instanceof TimerTimer);
|
||||
lastRaidVarb = -1;
|
||||
lastPoint = null;
|
||||
lastTeleportClicked = null;
|
||||
lastAnimation = -1;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -145,6 +151,12 @@ public class TimersPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void updateConfig(ConfigChanged event)
|
||||
{
|
||||
if (!config.showHomeMinigameTeleports())
|
||||
{
|
||||
removeGameTimer(HOME_TELEPORT);
|
||||
removeGameTimer(MINIGAME_TELEPORT);
|
||||
}
|
||||
|
||||
if (!config.showAntidotePlus())
|
||||
{
|
||||
removeGameTimer(ANTIDOTEPLUS);
|
||||
@@ -317,6 +329,12 @@ public class TimersPlugin extends Plugin
|
||||
createGameTimer(STAMINA);
|
||||
return;
|
||||
}
|
||||
|
||||
TeleportWidget teleportWidget = TeleportWidget.of(event.getWidgetId());
|
||||
if (teleportWidget != null)
|
||||
{
|
||||
lastTeleportClicked = teleportWidget;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -558,6 +576,23 @@ public class TimersPlugin extends Plugin
|
||||
{
|
||||
createGameTimer(VENGEANCEOTHER);
|
||||
}
|
||||
|
||||
if (config.showHomeMinigameTeleports()
|
||||
&& client.getLocalPlayer().getAnimation() == AnimationID.IDLE
|
||||
&& (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5
|
||||
|| lastAnimation == AnimationID.COW_HOME_TELEPORT_6))
|
||||
{
|
||||
if (lastTeleportClicked == TeleportWidget.HOME_TELEPORT)
|
||||
{
|
||||
createGameTimer(HOME_TELEPORT);
|
||||
}
|
||||
else if (lastTeleportClicked == TeleportWidget.MINIGAME_TELEPORT)
|
||||
{
|
||||
createGameTimer(MINIGAME_TELEPORT);
|
||||
}
|
||||
}
|
||||
|
||||
lastAnimation = client.getLocalPlayer().getAnimation();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user