Merge pull request #3210 from SRLJustin/0206-upstream
This commit is contained in:
@@ -1979,6 +1979,7 @@ public interface Client extends OAuthApi, GameEngine
|
|||||||
*
|
*
|
||||||
* @param delay the number of game cycles to delay dragging
|
* @param delay the number of game cycles to delay dragging
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void setInventoryDragDelay(int delay);
|
void setInventoryDragDelay(int delay);
|
||||||
|
|
||||||
boolean isHdMinimapEnabled();
|
boolean isHdMinimapEnabled();
|
||||||
@@ -2086,11 +2087,13 @@ public interface Client extends OAuthApi, GameEngine
|
|||||||
/**
|
/**
|
||||||
* Get the if1 widget whose item is being dragged
|
* Get the if1 widget whose item is being dragged
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
Widget getIf1DraggedWidget();
|
Widget getIf1DraggedWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item index of the item being dragged on an if1 widget
|
* Get the item index of the item being dragged on an if1 widget
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
int getIf1DraggedItemIndex();
|
int getIf1DraggedItemIndex();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* Menu action for using an item in your inventory on a tile object (GameObject or GroundObject).
|
* Menu action for using an item in your inventory on a tile object (GameObject or GroundObject).
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_USE_ON_GAME_OBJECT(1),
|
ITEM_USE_ON_GAME_OBJECT(1),
|
||||||
/**
|
/**
|
||||||
* Menu action for using a widget on a tile object (GameObject or GroundObject).
|
* Menu action for using a widget on a tile object (GameObject or GroundObject).
|
||||||
@@ -64,6 +65,7 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* Menu action for using an item in your inventory on an NPC.
|
* Menu action for using an item in your inventory on an NPC.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_USE_ON_NPC(7),
|
ITEM_USE_ON_NPC(7),
|
||||||
/**
|
/**
|
||||||
* Menu action for using a widget on an NPC.
|
* Menu action for using a widget on an NPC.
|
||||||
@@ -93,6 +95,7 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* Menu action for using an item on a player.
|
* Menu action for using an item on a player.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_USE_ON_PLAYER(14),
|
ITEM_USE_ON_PLAYER(14),
|
||||||
/**
|
/**
|
||||||
* Menu action for using a widget on a player.
|
* Menu action for using a widget on a player.
|
||||||
@@ -102,6 +105,7 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* Menu action for using an item on an item on the ground.
|
* Menu action for using an item on an item on the ground.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_USE_ON_GROUND_ITEM(16),
|
ITEM_USE_ON_GROUND_ITEM(16),
|
||||||
/**
|
/**
|
||||||
* Menu action for using a widget on an item on the ground.
|
* Menu action for using a widget on an item on the ground.
|
||||||
@@ -161,6 +165,7 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* Menu action when using an item on another item
|
* Menu action when using an item on another item
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_USE_ON_ITEM(31),
|
ITEM_USE_ON_ITEM(31),
|
||||||
/**
|
/**
|
||||||
* Menu action when using a component on an item
|
* Menu action when using a component on an item
|
||||||
@@ -170,26 +175,32 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* First menu action for an item.
|
* First menu action for an item.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_FIRST_OPTION(33),
|
ITEM_FIRST_OPTION(33),
|
||||||
/**
|
/**
|
||||||
* Second menu action for an item.
|
* Second menu action for an item.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_SECOND_OPTION(34),
|
ITEM_SECOND_OPTION(34),
|
||||||
/**
|
/**
|
||||||
* Third menu action for an item.
|
* Third menu action for an item.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_THIRD_OPTION(35),
|
ITEM_THIRD_OPTION(35),
|
||||||
/**
|
/**
|
||||||
* Fourth menu action for an item.
|
* Fourth menu action for an item.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_FOURTH_OPTION(36),
|
ITEM_FOURTH_OPTION(36),
|
||||||
/**
|
/**
|
||||||
* Fifth menu action for an item.
|
* Fifth menu action for an item.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_FIFTH_OPTION(37),
|
ITEM_FIFTH_OPTION(37),
|
||||||
/**
|
/**
|
||||||
* Menu action to use an item.
|
* Menu action to use an item.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
ITEM_USE(38),
|
ITEM_USE(38),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,6 +263,7 @@ public enum MenuAction
|
|||||||
/**
|
/**
|
||||||
* Menu action triggered by examining item in inventory.
|
* Menu action triggered by examining item in inventory.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
EXAMINE_ITEM(1005),
|
EXAMINE_ITEM(1005),
|
||||||
/**
|
/**
|
||||||
* Menu action triggered by canceling a menu.
|
* Menu action triggered by canceling a menu.
|
||||||
|
|||||||
@@ -47,6 +47,21 @@ public final class Varbits
|
|||||||
*/
|
*/
|
||||||
public static final int RUN_SLOWED_DEPLETION_ACTIVE = 25;
|
public static final int RUN_SLOWED_DEPLETION_ACTIVE = 25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stamina effect timer
|
||||||
|
* Number of game ticks remaining on stamina effect in intervals of 10; for a value X there are 10 * X game ticks remaining.
|
||||||
|
* The stamina effect expires once this reaches 0.
|
||||||
|
*/
|
||||||
|
public static final int STAMINA_EFFECT = 24;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring of endurance effect timer, stamina duration extended from using the ring of endurance
|
||||||
|
* Number of game ticks remaining on ring of endurance effect in intervals of 10; for a value X there are 10 * X game ticks remaining.
|
||||||
|
* Unequipping the ring of endurance will cause this to change to 0.
|
||||||
|
* When this reaches 0, {@link #STAMINA_EFFECT} will begin counting down.
|
||||||
|
*/
|
||||||
|
public static final int RING_OF_ENDURANCE_EFFECT = 10385;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If scrollbar in resizable mode chat is on the left
|
* If scrollbar in resizable mode chat is on the left
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -478,6 +478,7 @@ public interface Widget
|
|||||||
*
|
*
|
||||||
* @return any items displayed, or null if there are no items
|
* @return any items displayed, or null if there are no items
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
Collection<WidgetItem> getWidgetItems();
|
Collection<WidgetItem> getWidgetItems();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -488,6 +489,7 @@ public interface Widget
|
|||||||
* does not exist
|
* does not exist
|
||||||
* @throws IndexOutOfBoundsException if the index is out of bounds
|
* @throws IndexOutOfBoundsException if the index is out of bounds
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
WidgetItem getWidgetItem(int index);
|
WidgetItem getWidgetItem(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ package net.runelite.client.account;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -123,7 +123,7 @@ public class SessionManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Writer fw = new OutputStreamWriter(new FileOutputStream(sessionFile), StandardCharsets.UTF_8))
|
try (Writer fw = new OutputStreamWriter(Files.newOutputStream(sessionFile.toPath()), StandardCharsets.UTF_8))
|
||||||
{
|
{
|
||||||
gson.toJson(accountSession, fw);
|
gson.toJson(accountSession, fw);
|
||||||
|
|
||||||
|
|||||||
@@ -2044,6 +2044,7 @@ public class ChatCommandsPlugin extends Plugin
|
|||||||
return "Chambers of Xeric 24+ players";
|
return "Chambers of Xeric 24+ players";
|
||||||
|
|
||||||
// Chambers of Xeric Challenge Mode
|
// Chambers of Xeric Challenge Mode
|
||||||
|
case "chambers of xeric: challenge mode":
|
||||||
case "cox cm":
|
case "cox cm":
|
||||||
case "xeric cm":
|
case "xeric cm":
|
||||||
case "chambers cm":
|
case "chambers cm":
|
||||||
@@ -2344,6 +2345,7 @@ public class ChatCommandsPlugin extends Plugin
|
|||||||
// Guardians of the Rift
|
// Guardians of the Rift
|
||||||
case "gotr":
|
case "gotr":
|
||||||
case "runetodt":
|
case "runetodt":
|
||||||
|
case "rifts closed":
|
||||||
return "Guardians of the Rift";
|
return "Guardians of the Rift";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -2433,7 +2435,9 @@ public class ChatCommandsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
for (HiscoreSkill skill : HiscoreSkill.values())
|
for (HiscoreSkill skill : HiscoreSkill.values())
|
||||||
{
|
{
|
||||||
if (skill.getName().equals(s))
|
// longBossName the skill name to normalize from hiscore name
|
||||||
|
// to our internal name (removing the colon)
|
||||||
|
if (longBossName(skill.getName()).equals(s))
|
||||||
{
|
{
|
||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,10 @@ enum ItemIdentification
|
|||||||
DRAGONSTONE(Type.GEM, "Dragon", "DR", ItemID.UNCUT_DRAGONSTONE, ItemID.DRAGONSTONE),
|
DRAGONSTONE(Type.GEM, "Dragon", "DR", ItemID.UNCUT_DRAGONSTONE, ItemID.DRAGONSTONE),
|
||||||
ONYX(Type.GEM, "Onyx", "ON", ItemID.UNCUT_ONYX, ItemID.ONYX),
|
ONYX(Type.GEM, "Onyx", "ON", ItemID.UNCUT_ONYX, ItemID.ONYX),
|
||||||
ZENYTE(Type.GEM, "Zenyte", "Z", ItemID.UNCUT_ZENYTE, ItemID.ZENYTE),
|
ZENYTE(Type.GEM, "Zenyte", "Z", ItemID.UNCUT_ZENYTE, ItemID.ZENYTE),
|
||||||
|
SHADOW_DIAMOND(Type.GEM, "Shadow", "SHD", ItemID.SHADOW_DIAMOND),
|
||||||
|
BLOOD_DIAMOND(Type.GEM, "Blood", "BD", ItemID.BLOOD_DIAMOND),
|
||||||
|
ICE_DIAMOND(Type.GEM, "Ice", "ID", ItemID.ICE_DIAMOND),
|
||||||
|
SMOKE_DIAMOND(Type.GEM, "Smoke", "SMD", ItemID.SMOKE_DIAMOND),
|
||||||
|
|
||||||
// Potions
|
// Potions
|
||||||
ATTACK(Type.POTION, "Att", "A", ItemID.ATTACK_POTION4, ItemID.ATTACK_POTION3, ItemID.ATTACK_POTION2, ItemID.ATTACK_POTION1),
|
ATTACK(Type.POTION, "Att", "A", ItemID.ATTACK_POTION4, ItemID.ATTACK_POTION3, ItemID.ATTACK_POTION2, ItemID.ATTACK_POTION1),
|
||||||
|
|||||||
@@ -102,20 +102,15 @@ public class TimersPlugin extends Plugin
|
|||||||
private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion.";
|
private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion.";
|
||||||
private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion.";
|
private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion.";
|
||||||
private static final String FROZEN_MESSAGE = "<col=ef1020>You have been frozen!</col>";
|
private static final String FROZEN_MESSAGE = "<col=ef1020>You have been frozen!</col>";
|
||||||
private static final String GAUNTLET_ENTER_MESSAGE = "You enter the Gauntlet.";
|
|
||||||
private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer.";
|
private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer.";
|
||||||
private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended.";
|
private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended.";
|
||||||
private static final String MAGIC_IMBUE_MESSAGE = "You are charged to combine runes!";
|
private static final String MAGIC_IMBUE_MESSAGE = "You are charged to combine runes!";
|
||||||
private static final String STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE = "Your protection fades away";
|
private static final String STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE = "Your protection fades away";
|
||||||
private static final String STAFF_OF_THE_DEAD_SPEC_MESSAGE = "Spirits of deceased evildoers offer you their protection";
|
private static final String STAFF_OF_THE_DEAD_SPEC_MESSAGE = "Spirits of deceased evildoers offer you their protection";
|
||||||
private static final String STAMINA_DRINK_MESSAGE = "You drink some of your stamina potion.";
|
|
||||||
private static final String STAMINA_SHARED_DRINK_MESSAGE = "You have received a shared dose of stamina potion.";
|
|
||||||
private static final String STAMINA_EXPIRED_MESSAGE = "<col=8f4808>Your stamina potion has expired.</col>";
|
|
||||||
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 KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed ";
|
private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed ";
|
||||||
private static final String PRAYER_ENHANCE_EXPIRED = "<col=ff0000>Your prayer enhance effect has worn off.</col>";
|
private static final String PRAYER_ENHANCE_EXPIRED = "<col=ff0000>Your prayer enhance effect has worn off.</col>";
|
||||||
private static final String ENDURANCE_EFFECT_MESSAGE = "Your Ring of endurance doubles the duration of your stamina potion's effect.";
|
|
||||||
private static final String SHADOW_VEIL_MESSAGE = ">Your thieving abilities have been enhanced.</col>";
|
private static final String SHADOW_VEIL_MESSAGE = ">Your thieving abilities have been enhanced.</col>";
|
||||||
private static final String DEATH_CHARGE_MESSAGE = ">Upon the death of your next foe, some of your special attack energy will be restored.</col>";
|
private static final String DEATH_CHARGE_MESSAGE = ">Upon the death of your next foe, some of your special attack energy will be restored.</col>";
|
||||||
private static final String DEATH_CHARGE_ACTIVATE_MESSAGE = ">Some of your special attack energy has been restored.</col>";
|
private static final String DEATH_CHARGE_ACTIVATE_MESSAGE = ">Some of your special attack energy has been restored.</col>";
|
||||||
@@ -144,7 +139,6 @@ public class TimersPlugin extends Plugin
|
|||||||
private int freezeTime = -1; // time frozen, in game ticks
|
private int freezeTime = -1; // time frozen, in game ticks
|
||||||
|
|
||||||
private TimerTimer staminaTimer;
|
private TimerTimer staminaTimer;
|
||||||
private boolean wasWearingEndurance;
|
|
||||||
|
|
||||||
private int lastRaidVarb;
|
private int lastRaidVarb;
|
||||||
private int lastVengCooldownVarb;
|
private int lastVengCooldownVarb;
|
||||||
@@ -154,6 +148,7 @@ public class TimersPlugin extends Plugin
|
|||||||
private int lastCorruptionVarb;
|
private int lastCorruptionVarb;
|
||||||
private int lastHomeTeleport;
|
private int lastHomeTeleport;
|
||||||
private int lastMinigameTeleport;
|
private int lastMinigameTeleport;
|
||||||
|
private int lastStaminaEffect;
|
||||||
private int lastImbuedHeartVarb;
|
private int lastImbuedHeartVarb;
|
||||||
private boolean imbuedHeartTimerActive;
|
private boolean imbuedHeartTimerActive;
|
||||||
private int nextPoisonTick;
|
private int nextPoisonTick;
|
||||||
@@ -209,6 +204,7 @@ public class TimersPlugin extends Plugin
|
|||||||
lastImbuedHeartVarb = 0;
|
lastImbuedHeartVarb = 0;
|
||||||
lastHomeTeleport = 0;
|
lastHomeTeleport = 0;
|
||||||
lastMinigameTeleport = 0;
|
lastMinigameTeleport = 0;
|
||||||
|
lastStaminaEffect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -223,6 +219,11 @@ public class TimersPlugin extends Plugin
|
|||||||
int imbuedHeartCooldownVarb = client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN);
|
int imbuedHeartCooldownVarb = client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN);
|
||||||
int homeTeleportVarp = client.getVar(VarPlayer.LAST_HOME_TELEPORT);
|
int homeTeleportVarp = client.getVar(VarPlayer.LAST_HOME_TELEPORT);
|
||||||
int minigameTeleportVarp = client.getVar(VarPlayer.LAST_MINIGAME_TELEPORT);
|
int minigameTeleportVarp = client.getVar(VarPlayer.LAST_MINIGAME_TELEPORT);
|
||||||
|
int staminaEffectActive = client.getVarbitValue(Varbits.RUN_SLOWED_DEPLETION_ACTIVE);
|
||||||
|
int staminaPotionEffectVarb = client.getVarbitValue(Varbits.STAMINA_EFFECT);
|
||||||
|
int enduranceRingEffectVarb = client.getVarbitValue(Varbits.RING_OF_ENDURANCE_EFFECT);
|
||||||
|
|
||||||
|
final int totalStaminaEffect = staminaPotionEffectVarb + enduranceRingEffectVarb;
|
||||||
|
|
||||||
if (lastRaidVarb != raidVarb)
|
if (lastRaidVarb != raidVarb)
|
||||||
{
|
{
|
||||||
@@ -341,6 +342,33 @@ public class TimersPlugin extends Plugin
|
|||||||
checkTeleport(VarPlayer.LAST_MINIGAME_TELEPORT);
|
checkTeleport(VarPlayer.LAST_MINIGAME_TELEPORT);
|
||||||
lastMinigameTeleport = minigameTeleportVarp;
|
lastMinigameTeleport = minigameTeleportVarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// staminaEffectActive is checked to match https://github.com/Joshua-F/cs2-scripts/blob/741271f0c3395048c1bad4af7881a13734516adf/scripts/%5Bproc%2Cbuff_bar_get_value%5D.cs2#L25
|
||||||
|
if (staminaEffectActive == 1 && lastStaminaEffect != totalStaminaEffect && config.showStamina())
|
||||||
|
{
|
||||||
|
final Duration staminaDuration = Duration.of(10L * totalStaminaEffect, RSTimeUnit.GAME_TICKS);
|
||||||
|
|
||||||
|
if (staminaTimer == null && totalStaminaEffect > 0)
|
||||||
|
{
|
||||||
|
staminaTimer = createGameTimer(STAMINA, staminaDuration);
|
||||||
|
}
|
||||||
|
else if (totalStaminaEffect == 0)
|
||||||
|
{
|
||||||
|
removeGameTimer(STAMINA);
|
||||||
|
staminaTimer = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Instant endInstant = Instant.now().plus(staminaDuration);
|
||||||
|
int timeDifference = (int) Duration.between(staminaTimer.getEndTime(), endInstant).getSeconds();
|
||||||
|
if (timeDifference != 0)
|
||||||
|
{
|
||||||
|
Duration remainingDuration = Duration.between(staminaTimer.getStartTime(), endInstant);
|
||||||
|
staminaTimer.setDuration(remainingDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastStaminaEffect = totalStaminaEffect;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -372,6 +400,7 @@ public class TimersPlugin extends Plugin
|
|||||||
if (!config.showStamina())
|
if (!config.showStamina())
|
||||||
{
|
{
|
||||||
removeGameTimer(STAMINA);
|
removeGameTimer(STAMINA);
|
||||||
|
staminaTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.showOverload())
|
if (!config.showOverload())
|
||||||
@@ -468,18 +497,6 @@ public class TimersPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (event.isItemOp() && event.getMenuOption().equals("Drink"))
|
if (event.isItemOp() && event.getMenuOption().equals("Drink"))
|
||||||
{
|
{
|
||||||
if ((event.getItemId() == ItemID.STAMINA_MIX1
|
|
||||||
|| event.getItemId() == ItemID.STAMINA_MIX2
|
|
||||||
|| event.getItemId() == ItemID.EGNIOL_POTION_1
|
|
||||||
|| event.getItemId() == ItemID.EGNIOL_POTION_2
|
|
||||||
|| event.getItemId() == ItemID.EGNIOL_POTION_3
|
|
||||||
|| event.getItemId() == ItemID.EGNIOL_POTION_4)
|
|
||||||
&& config.showStamina())
|
|
||||||
{
|
|
||||||
// Needs menu option hook because mixes use a common drink message, distinct from their standard potion messages
|
|
||||||
createStaminaTimer();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((event.getItemId() == ItemID.ANTIFIRE_MIX1
|
if ((event.getItemId() == ItemID.ANTIFIRE_MIX1
|
||||||
|| event.getItemId() == ItemID.ANTIFIRE_MIX2)
|
|| event.getItemId() == ItemID.ANTIFIRE_MIX2)
|
||||||
@@ -550,22 +567,6 @@ public class TimersPlugin extends Plugin
|
|||||||
createGameTimer(ABYSSAL_SIRE_STUN);
|
createGameTimer(ABYSSAL_SIRE_STUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.equals(ENDURANCE_EFFECT_MESSAGE))
|
|
||||||
{
|
|
||||||
wasWearingEndurance = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.showStamina() && (message.equals(STAMINA_DRINK_MESSAGE) || message.equals(STAMINA_SHARED_DRINK_MESSAGE)))
|
|
||||||
{
|
|
||||||
createStaminaTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.equals(STAMINA_EXPIRED_MESSAGE) || message.equals(GAUNTLET_ENTER_MESSAGE))
|
|
||||||
{
|
|
||||||
removeGameTimer(STAMINA);
|
|
||||||
staminaTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.showAntiFire() && message.equals(ANTIFIRE_DRINK_MESSAGE))
|
if (config.showAntiFire() && message.equals(ANTIFIRE_DRINK_MESSAGE))
|
||||||
{
|
{
|
||||||
createGameTimer(ANTIFIRE);
|
createGameTimer(ANTIFIRE);
|
||||||
@@ -1064,7 +1065,7 @@ public class TimersPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove SOTD timer and update stamina timer when equipment is changed.
|
* Remove SOTD timer when equipment is changed.
|
||||||
*/
|
*/
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onItemContainerChanged(ItemContainerChanged itemContainerChanged)
|
public void onItemContainerChanged(ItemContainerChanged itemContainerChanged)
|
||||||
@@ -1087,29 +1088,6 @@ public class TimersPlugin extends Plugin
|
|||||||
removeGameTimer(STAFF_OF_THE_DEAD);
|
removeGameTimer(STAFF_OF_THE_DEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasWearingEndurance)
|
|
||||||
{
|
|
||||||
Item ring = container.getItem(EquipmentInventorySlot.RING.getSlotIdx());
|
|
||||||
|
|
||||||
// when using the last ring charge the ring changes to the uncharged version, ignore that and don't
|
|
||||||
// halve the timer
|
|
||||||
if (ring == null || (ring.getId() != ItemID.RING_OF_ENDURANCE && ring.getId() != ItemID.RING_OF_ENDURANCE_UNCHARGED_24844))
|
|
||||||
{
|
|
||||||
wasWearingEndurance = false;
|
|
||||||
if (staminaTimer != null)
|
|
||||||
{
|
|
||||||
// Remaining duration gets divided by 2
|
|
||||||
Duration remainingDuration = Duration.between(Instant.now(), staminaTimer.getEndTime()).dividedBy(2);
|
|
||||||
// This relies on the chat message to be removed, which could be after the timer has been culled;
|
|
||||||
// so check there is still remaining time
|
|
||||||
if (!remainingDuration.isNegative() && !remainingDuration.isZero())
|
|
||||||
{
|
|
||||||
log.debug("Halving stamina timer");
|
|
||||||
staminaTimer.setDuration(remainingDuration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -1139,12 +1117,6 @@ public class TimersPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createStaminaTimer()
|
|
||||||
{
|
|
||||||
Duration duration = Duration.ofMinutes(wasWearingEndurance ? 4 : 2);
|
|
||||||
staminaTimer = createGameTimer(STAMINA, duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
private TimerTimer createGameTimer(final GameTimer timer)
|
private TimerTimer createGameTimer(final GameTimer timer)
|
||||||
{
|
{
|
||||||
if (timer.getDuration() == null)
|
if (timer.getDuration() == null)
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ public class ClientLoader implements Supplier<Applet>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try (HashingOutputStream hos = new HashingOutputStream(Hashing.sha512(), new FileOutputStream(PATCHED_CACHE));
|
try (HashingOutputStream hos = new HashingOutputStream(Hashing.sha512(), java.nio.file.Files.newOutputStream(PATCHED_CACHE.toPath()));
|
||||||
InputStream patch = ClientLoader.class.getResourceAsStream("/client.patch"))
|
InputStream patch = ClientLoader.class.getResourceAsStream("/client.patch"))
|
||||||
{
|
{
|
||||||
new FileByFileV1DeltaApplier().applyDelta(VANILLA_CACHE, patch, hos);
|
new FileByFileV1DeltaApplier().applyDelta(VANILLA_CACHE, patch, hos);
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ public class ChatCommandsPluginTest
|
|||||||
|
|
||||||
HiscoreResult hiscoreResult = new HiscoreResult();
|
HiscoreResult hiscoreResult = new HiscoreResult();
|
||||||
hiscoreResult.setPlayer(PLAYER_NAME);
|
hiscoreResult.setPlayer(PLAYER_NAME);
|
||||||
hiscoreResult.setZulrah(new Skill(10, 1000, -1));
|
hiscoreResult.setChambersOfXericChallengeMode(new Skill(10, 1000, -1));
|
||||||
|
|
||||||
when(hiscoreClient.lookup(eq(PLAYER_NAME), nullable(HiscoreEndpoint.class))).thenReturn(hiscoreResult);
|
when(hiscoreClient.lookup(eq(PLAYER_NAME), nullable(HiscoreEndpoint.class))).thenReturn(hiscoreResult);
|
||||||
|
|
||||||
@@ -628,9 +628,9 @@ public class ChatCommandsPluginTest
|
|||||||
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||||
chatMessage.setName(PLAYER_NAME);
|
chatMessage.setName(PLAYER_NAME);
|
||||||
chatMessage.setMessageNode(messageNode);
|
chatMessage.setMessageNode(messageNode);
|
||||||
chatCommandsPlugin.playerSkillLookup(chatMessage, "!lvl zulrah");
|
chatCommandsPlugin.playerSkillLookup(chatMessage, "!lvl cox cm");
|
||||||
|
|
||||||
verify(messageNode).setRuneLiteFormatMessage("<colNORMAL>Level <colHIGHLIGHT>Zulrah: 1000<colNORMAL> Rank: <colHIGHLIGHT>10");
|
verify(messageNode).setRuneLiteFormatMessage("<colNORMAL>Level <colHIGHLIGHT>Chambers of Xeric: Challenge Mode: 1000<colNORMAL> Rank: <colHIGHLIGHT>10");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -33,12 +33,9 @@ import java.time.Instant;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.InventoryID;
|
|
||||||
import net.runelite.api.ItemContainer;
|
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.client.game.SpriteManager;
|
||||||
@@ -59,7 +56,6 @@ import static org.mockito.ArgumentMatchers.nullable;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import static org.mockito.Mockito.atLeastOnce;
|
import static org.mockito.Mockito.atLeastOnce;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -236,8 +232,10 @@ public class TimersPluginTest
|
|||||||
public void testStamina()
|
public void testStamina()
|
||||||
{
|
{
|
||||||
when(timersConfig.showStamina()).thenReturn(true);
|
when(timersConfig.showStamina()).thenReturn(true);
|
||||||
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You drink some of your stamina potion.", "", 0);
|
when(client.getVarbitValue(Varbits.RUN_SLOWED_DEPLETION_ACTIVE)).thenReturn(1);
|
||||||
timersPlugin.onChatMessage(chatMessage);
|
when(client.getVarbitValue(Varbits.STAMINA_EFFECT)).thenReturn(20);
|
||||||
|
when(client.getVarbitValue(Varbits.RING_OF_ENDURANCE_EFFECT)).thenReturn(0);
|
||||||
|
timersPlugin.onVarbitChanged(new VarbitChanged());
|
||||||
|
|
||||||
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
verify(infoBoxManager).addInfoBox(captor.capture());
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
@@ -264,12 +262,10 @@ public class TimersPluginTest
|
|||||||
public void testEndurance()
|
public void testEndurance()
|
||||||
{
|
{
|
||||||
when(timersConfig.showStamina()).thenReturn(true);
|
when(timersConfig.showStamina()).thenReturn(true);
|
||||||
|
when(client.getVarbitValue(Varbits.RUN_SLOWED_DEPLETION_ACTIVE)).thenReturn(1);
|
||||||
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "Your Ring of endurance doubles the duration of your stamina potion's effect.", "", 0);
|
when(client.getVarbitValue(Varbits.STAMINA_EFFECT)).thenReturn(20);
|
||||||
timersPlugin.onChatMessage(chatMessage);
|
when(client.getVarbitValue(Varbits.RING_OF_ENDURANCE_EFFECT)).thenReturn(20);
|
||||||
|
timersPlugin.onVarbitChanged(new VarbitChanged());
|
||||||
chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You drink some of your stamina potion.", "", 0);
|
|
||||||
timersPlugin.onChatMessage(chatMessage);
|
|
||||||
|
|
||||||
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
verify(infoBoxManager).addInfoBox(captor.capture());
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
@@ -278,10 +274,10 @@ public class TimersPluginTest
|
|||||||
assertEquals(Duration.ofMinutes(4), infoBox.getDuration());
|
assertEquals(Duration.ofMinutes(4), infoBox.getDuration());
|
||||||
|
|
||||||
// unwield ring
|
// unwield ring
|
||||||
timersPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), mock(ItemContainer.class)));
|
when(client.getVarbitValue(Varbits.RING_OF_ENDURANCE_EFFECT)).thenReturn(0);
|
||||||
// some time has elapsed in the test; this should be just under 2 mins
|
timersPlugin.onVarbitChanged(new VarbitChanged());
|
||||||
int mins = (int) infoBox.getDuration().toMinutes();
|
int mins = (int) infoBox.getDuration().toMinutes();
|
||||||
assertTrue(mins == 1 || mins == 2);
|
assertEquals(2, mins);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user