Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-04-14 03:36:55 +02:00
112 changed files with 2502 additions and 832 deletions

View File

@@ -34,6 +34,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.annotations.VisibleForExternalPlugins; import net.runelite.api.annotations.VisibleForExternalPlugins;
import net.runelite.api.clan.ClanChannel; import net.runelite.api.clan.ClanChannel;
import net.runelite.api.clan.ClanID; import net.runelite.api.clan.ClanID;
@@ -854,12 +855,22 @@ public interface Client extends OAuthApi, GameEngine
int getVar(VarPlayer varPlayer); int getVar(VarPlayer varPlayer);
/** /**
* Gets a value corresponding to the passed variable. * Gets a value corresponding to the passed varbit.
* *
* @param varbit the variable * @param varbit the varbit id
* @return the value
* @see Client#getVarbitValue(int)
*/
@Deprecated
int getVar(@Varbit int varbit);
/**
* Gets a value corresponding to the passed varbit.
*
* @param varbit the varbit id
* @return the value * @return the value
*/ */
int getVar(Varbits varbit); int getVarbitValue(@Varbit int varbit);
/** /**
* Gets an int value corresponding to the passed variable. * Gets an int value corresponding to the passed variable.
@@ -877,15 +888,6 @@ public interface Client extends OAuthApi, GameEngine
*/ */
String getVar(VarClientStr varClientStr); String getVar(VarClientStr varClientStr);
/**
* Gets the value of a given Varbit.
*
* @param varbitId the varbit id
* @return the value
*/
@VisibleForExternalPlugins
int getVarbitValue(int varbitId);
/** /**
* Gets the value of a given VarClientInt * Gets the value of a given VarClientInt
* *
@@ -915,12 +917,12 @@ public interface Client extends OAuthApi, GameEngine
void setVar(VarClientInt varClientStr, int value); void setVar(VarClientInt varClientStr, int value);
/** /**
* Sets the value of a given variable. * Sets the value of a varbit
* *
* @param varbit the variable * @param varbit the varbit id
* @param value the new value * @param value the new value
*/ */
void setVarbit(Varbits varbit, int value); void setVarbit(@Varbit int varbit, int value);
/** /**
* Gets the varbit composition for a given varbit id * Gets the varbit composition for a given varbit id
@@ -939,7 +941,7 @@ public interface Client extends OAuthApi, GameEngine
* @return the value * @return the value
* @see Varbits * @see Varbits
*/ */
int getVarbitValue(int[] varps, int varbitId); int getVarbitValue(int[] varps, @Varbit int varbitId);
/** /**
* Gets the value of a given VarPlayer. * Gets the value of a given VarPlayer.
@@ -961,7 +963,7 @@ public interface Client extends OAuthApi, GameEngine
* @param value the value * @param value the value
* @see Varbits * @see Varbits
*/ */
void setVarbitValue(int[] varps, int varbit, int value); void setVarbitValue(int[] varps, @Varbit int varbit, int value);
/** /**
* Mark the given varp as changed, causing var listeners to be * Mark the given varp as changed, causing var listeners to be

View File

@@ -40,4 +40,18 @@ public interface FriendsChatManager extends NameableContainer<FriendsChatMember>
* @return * @return
*/ */
String getName(); String getName();
/**
* Get the local player's rank in the friend chat
*
* @return
*/
FriendsChatRank getMyRank();
/**
* Get the rank required to kick members from the friends chat
*
* @return
*/
FriendsChatRank getKickRank();
} }

View File

@@ -337,7 +337,7 @@ public class Perspective
Widget minimapDrawWidget; Widget minimapDrawWidget;
if (client.isResized()) if (client.isResized())
{ {
if (client.getVar(Varbits.SIDE_PANELS) == 1) if (client.getVarbitValue(Varbits.SIDE_PANELS) == 1)
{ {
minimapDrawWidget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_DRAW_AREA); minimapDrawWidget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_DRAW_AREA);
} }

View File

@@ -24,15 +24,12 @@
*/ */
package net.runelite.api; package net.runelite.api;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.annotations.Varbit;
/** /**
* An enumeration of different prayer spells. * An enumeration of different prayer spells.
*/ */
@Getter
@AllArgsConstructor
public enum Prayer public enum Prayer
{ {
/** /**
@@ -152,19 +149,40 @@ public enum Prayer
*/ */
AUGURY(Varbits.PRAYER_AUGURY, 40.0, WidgetInfo.PRAYER_AUGURY); AUGURY(Varbits.PRAYER_AUGURY, 40.0, WidgetInfo.PRAYER_AUGURY);
private final int varbit;
private final double drainRate;
private final WidgetInfo widgetInfo;
Prayer(@Varbit int varbit, double drainRate, WidgetInfo widgetInfo)
{
this.varbit = varbit;
this.drainRate = drainRate;
this.widgetInfo = widgetInfo;
}
/** /**
* Gets the varbit that stores whether the prayer is active or not. * Gets the varbit that stores whether the prayer is active or not.
*
* @return the prayer active varbit
*/ */
private final Varbits varbit; @Varbit
public int getVarbit()
{
return varbit;
}
/** /**
* Gets the prayer drain rate (measured in pray points/minute) * Gets the prayer drain rate (measured in pray points/minute)
*
* @return the prayer drain rate
*/ */
private final double drainRate; public double getDrainRate()
{
/** return drainRate;
* Gets the widget info for prayer }
*/
private final WidgetInfo widgetInfo; public WidgetInfo getWidgetInfo()
{
return widgetInfo;
}
} }

View File

@@ -447,6 +447,6 @@ public final class ScriptID
@ScriptArguments(integer = 4) @ScriptArguments(integer = 4)
public static final int QUEST_FILTER = 3238; public static final int QUEST_FILTER = 3238;
@ScriptArguments(integer = 18, string = 1) @ScriptArguments(integer = 7)
public static final int GROUP_IRONMAN_STORAGE_BUILD = 5269; public static final int GROUP_IRONMAN_STORAGE_BUILD = 5269;
} }

View File

@@ -24,209 +24,204 @@
*/ */
package net.runelite.api; package net.runelite.api;
import lombok.AllArgsConstructor;
import lombok.Getter;
/** /**
* Server controlled "content-developer" integers. * Server controlled "content-developer" integers.
* *
* @see VarPlayer * @see VarPlayer
* * <p>
* These differ from a {@link VarPlayer} in that VarBits can be * These differ from a {@link VarPlayer} in that VarBits can be
* less than 32 bits. One or more VarBits can be assigned to a * less than 32 bits. One or more VarBits can be assigned to a
* backing VarPlayer, each with a static range of bits that it is * backing VarPlayer, each with a static range of bits that it is
* allowed to access. This allows a more compact representation * allowed to access. This allows a more compact representation
* of small values, like booleans * of small values, like booleans
*/ */
@AllArgsConstructor public final class Varbits
@Getter
public enum Varbits
{ {
/* /*
* If chatbox is transparent or not * If chatbox is transparent or not
*/ */
TRANSPARENT_CHATBOX(4608), public static final int TRANSPARENT_CHATBOX = 4608;
/* /*
* If the player has an active stamina potion effect or not * If the player has an active stamina potion effect or not
*/ */
RUN_SLOWED_DEPLETION_ACTIVE(25), public static final int RUN_SLOWED_DEPLETION_ACTIVE = 25;
/** /**
* If scrollbar in resizable mode chat is on the left * If scrollbar in resizable mode chat is on the left
*/ */
CHAT_SCROLLBAR_ON_LEFT(6374), public static final int CHAT_SCROLLBAR_ON_LEFT = 6374;
/** /**
* Runepouch * Runepouch
*/ */
RUNE_POUCH_RUNE1(29), public static final int RUNE_POUCH_RUNE1 = 29;
RUNE_POUCH_RUNE2(1622), public static final int RUNE_POUCH_RUNE2 = 1622;
RUNE_POUCH_RUNE3(1623), public static final int RUNE_POUCH_RUNE3 = 1623;
RUNE_POUCH_AMOUNT1(1624), public static final int RUNE_POUCH_AMOUNT1 = 1624;
RUNE_POUCH_AMOUNT2(1625), public static final int RUNE_POUCH_AMOUNT2 = 1625;
RUNE_POUCH_AMOUNT3(1626), public static final int RUNE_POUCH_AMOUNT3 = 1626;
/** /**
* Prayers * Prayers
*/ */
QUICK_PRAYER(4103), public static final int QUICK_PRAYER = 4103;
PRAYER_THICK_SKIN(4104), public static final int PRAYER_THICK_SKIN = 4104;
PRAYER_BURST_OF_STRENGTH(4105), public static final int PRAYER_BURST_OF_STRENGTH = 4105;
PRAYER_CLARITY_OF_THOUGHT(4106), public static final int PRAYER_CLARITY_OF_THOUGHT = 4106;
PRAYER_SHARP_EYE(4122), public static final int PRAYER_SHARP_EYE = 4122;
PRAYER_MYSTIC_WILL(4123), public static final int PRAYER_MYSTIC_WILL = 4123;
PRAYER_ROCK_SKIN(4107), public static final int PRAYER_ROCK_SKIN = 4107;
PRAYER_SUPERHUMAN_STRENGTH(4108), public static final int PRAYER_SUPERHUMAN_STRENGTH = 4108;
PRAYER_IMPROVED_REFLEXES(4109), public static final int PRAYER_IMPROVED_REFLEXES = 4109;
PRAYER_RAPID_RESTORE(4110), public static final int PRAYER_RAPID_RESTORE = 4110;
PRAYER_RAPID_HEAL(4111), public static final int PRAYER_RAPID_HEAL = 4111;
PRAYER_PROTECT_ITEM(4112), public static final int PRAYER_PROTECT_ITEM = 4112;
PRAYER_HAWK_EYE(4124), public static final int PRAYER_HAWK_EYE = 4124;
PRAYER_MYSTIC_LORE(4125), public static final int PRAYER_MYSTIC_LORE = 4125;
PRAYER_STEEL_SKIN(4113), public static final int PRAYER_STEEL_SKIN = 4113;
PRAYER_ULTIMATE_STRENGTH(4114), public static final int PRAYER_ULTIMATE_STRENGTH = 4114;
PRAYER_INCREDIBLE_REFLEXES(4115), public static final int PRAYER_INCREDIBLE_REFLEXES = 4115;
PRAYER_PROTECT_FROM_MAGIC(4116), public static final int PRAYER_PROTECT_FROM_MAGIC = 4116;
PRAYER_PROTECT_FROM_MISSILES(4117), public static final int PRAYER_PROTECT_FROM_MISSILES = 4117;
PRAYER_PROTECT_FROM_MELEE(4118), public static final int PRAYER_PROTECT_FROM_MELEE = 4118;
PRAYER_EAGLE_EYE(4126), public static final int PRAYER_EAGLE_EYE = 4126;
PRAYER_MYSTIC_MIGHT(4127), public static final int PRAYER_MYSTIC_MIGHT = 4127;
PRAYER_RETRIBUTION(4119), public static final int PRAYER_RETRIBUTION = 4119;
PRAYER_REDEMPTION(4120), public static final int PRAYER_REDEMPTION = 4120;
PRAYER_SMITE(4121), public static final int PRAYER_SMITE = 4121;
PRAYER_CHIVALRY(4128), public static final int PRAYER_CHIVALRY = 4128;
PRAYER_PIETY(4129), public static final int PRAYER_PIETY = 4129;
PRAYER_PRESERVE(5466), public static final int PRAYER_PRESERVE = 5466;
PRAYER_RIGOUR(5464), public static final int PRAYER_RIGOUR = 5464;
PRAYER_AUGURY(5465), public static final int PRAYER_AUGURY = 5465;
RIGOUR_UNLOCKED(5451), public static final int RIGOUR_UNLOCKED = 5451;
AUGURY_UNLOCKED(5452), public static final int AUGURY_UNLOCKED = 5452;
PRESERVE_UNLOCKED(5453), public static final int PRESERVE_UNLOCKED = 5453;
/** /**
* Diary Entries * Diary Entries
*/ */
DIARY_ARDOUGNE_EASY(4458), public static final int DIARY_ARDOUGNE_EASY = 4458;
DIARY_ARDOUGNE_MEDIUM(4459), public static final int DIARY_ARDOUGNE_MEDIUM = 4459;
DIARY_ARDOUGNE_HARD(4460), public static final int DIARY_ARDOUGNE_HARD = 4460;
DIARY_ARDOUGNE_ELITE(4461), public static final int DIARY_ARDOUGNE_ELITE = 4461;
DIARY_DESERT_EASY(4483), public static final int DIARY_DESERT_EASY = 4483;
DIARY_DESERT_MEDIUM(4484), public static final int DIARY_DESERT_MEDIUM = 4484;
DIARY_DESERT_HARD(4485), public static final int DIARY_DESERT_HARD = 4485;
DIARY_DESERT_ELITE(4486), public static final int DIARY_DESERT_ELITE = 4486;
DIARY_FALADOR_EASY(4462), public static final int DIARY_FALADOR_EASY = 4462;
DIARY_FALADOR_MEDIUM(4463), public static final int DIARY_FALADOR_MEDIUM = 4463;
DIARY_FALADOR_HARD(4464), public static final int DIARY_FALADOR_HARD = 4464;
DIARY_FALADOR_ELITE(4465), public static final int DIARY_FALADOR_ELITE = 4465;
DIARY_FREMENNIK_EASY(4491), public static final int DIARY_FREMENNIK_EASY = 4491;
DIARY_FREMENNIK_MEDIUM(4492), public static final int DIARY_FREMENNIK_MEDIUM = 4492;
DIARY_FREMENNIK_HARD(4493), public static final int DIARY_FREMENNIK_HARD = 4493;
DIARY_FREMENNIK_ELITE(4494), public static final int DIARY_FREMENNIK_ELITE = 4494;
DIARY_KANDARIN_EASY(4475), public static final int DIARY_KANDARIN_EASY = 4475;
DIARY_KANDARIN_MEDIUM(4476), public static final int DIARY_KANDARIN_MEDIUM = 4476;
DIARY_KANDARIN_HARD(4477), public static final int DIARY_KANDARIN_HARD = 4477;
DIARY_KANDARIN_ELITE(4478), public static final int DIARY_KANDARIN_ELITE = 4478;
DIARY_KARAMJA_EASY(3578), public static final int DIARY_KARAMJA_EASY = 3578;
DIARY_KARAMJA_MEDIUM(3599), public static final int DIARY_KARAMJA_MEDIUM = 3599;
DIARY_KARAMJA_HARD(3611), public static final int DIARY_KARAMJA_HARD = 3611;
DIARY_KARAMJA_ELITE(4566), public static final int DIARY_KARAMJA_ELITE = 4566;
DIARY_KOUREND_EASY(7925), public static final int DIARY_KOUREND_EASY = 7925;
DIARY_KOUREND_MEDIUM(7926), public static final int DIARY_KOUREND_MEDIUM = 7926;
DIARY_KOUREND_HARD(7927), public static final int DIARY_KOUREND_HARD = 7927;
DIARY_KOUREND_ELITE(7928), public static final int DIARY_KOUREND_ELITE = 7928;
DIARY_LUMBRIDGE_EASY(4495), public static final int DIARY_LUMBRIDGE_EASY = 4495;
DIARY_LUMBRIDGE_MEDIUM(4496), public static final int DIARY_LUMBRIDGE_MEDIUM = 4496;
DIARY_LUMBRIDGE_HARD(4497), public static final int DIARY_LUMBRIDGE_HARD = 4497;
DIARY_LUMBRIDGE_ELITE(4498), public static final int DIARY_LUMBRIDGE_ELITE = 4498;
DIARY_MORYTANIA_EASY(4487), public static final int DIARY_MORYTANIA_EASY = 4487;
DIARY_MORYTANIA_MEDIUM(4488), public static final int DIARY_MORYTANIA_MEDIUM = 4488;
DIARY_MORYTANIA_HARD(4489), public static final int DIARY_MORYTANIA_HARD = 4489;
DIARY_MORYTANIA_ELITE(4490), public static final int DIARY_MORYTANIA_ELITE = 4490;
DIARY_VARROCK_EASY(4479), public static final int DIARY_VARROCK_EASY = 4479;
DIARY_VARROCK_MEDIUM(4480), public static final int DIARY_VARROCK_MEDIUM = 4480;
DIARY_VARROCK_HARD(4481), public static final int DIARY_VARROCK_HARD = 4481;
DIARY_VARROCK_ELITE(4482), public static final int DIARY_VARROCK_ELITE = 4482;
DIARY_WESTERN_EASY(4471), public static final int DIARY_WESTERN_EASY = 4471;
DIARY_WESTERN_MEDIUM(4472), public static final int DIARY_WESTERN_MEDIUM = 4472;
DIARY_WESTERN_HARD(4473), public static final int DIARY_WESTERN_HARD = 4473;
DIARY_WESTERN_ELITE(4474), public static final int DIARY_WESTERN_ELITE = 4474;
DIARY_WILDERNESS_EASY(4466), public static final int DIARY_WILDERNESS_EASY = 4466;
DIARY_WILDERNESS_MEDIUM(4467), public static final int DIARY_WILDERNESS_MEDIUM = 4467;
DIARY_WILDERNESS_HARD(4468), public static final int DIARY_WILDERNESS_HARD = 4468;
DIARY_WILDERNESS_ELITE(4469), public static final int DIARY_WILDERNESS_ELITE = 4469;
/** /**
* Kourend house favours * Kourend house favours
*/ */
KOUREND_FAVOR_ARCEUUS(4896), public static final int KOUREND_FAVOR_ARCEUUS = 4896;
KOUREND_FAVOR_HOSIDIUS(4895), public static final int KOUREND_FAVOR_HOSIDIUS = 4895;
KOUREND_FAVOR_LOVAKENGJ(4898), public static final int KOUREND_FAVOR_LOVAKENGJ = 4898;
KOUREND_FAVOR_PISCARILIUS(4899), public static final int KOUREND_FAVOR_PISCARILIUS = 4899;
KOUREND_FAVOR_SHAYZIEN(4894), public static final int KOUREND_FAVOR_SHAYZIEN = 4894;
/** /**
* Equipped weapon type * Equipped weapon type
*/ */
EQUIPPED_WEAPON_TYPE(357), public static final int EQUIPPED_WEAPON_TYPE = 357;
/** /**
* Defensive casting mode * Defensive casting mode
*/ */
DEFENSIVE_CASTING_MODE(2668), public static final int DEFENSIVE_CASTING_MODE = 2668;
/** /**
* Spells being auto-casted * Spells being auto-casted
*/ */
AUTO_CAST_SPELL(276), public static final int AUTO_CAST_SPELL = 276;
/** /**
* Options * Options
*/ */
SIDE_PANELS(4607), public static final int SIDE_PANELS = 4607;
/** /**
* Herbiboar Trails * Herbiboar Trails
*/ */
HB_TRAIL_31303(5737), public static final int HB_TRAIL_31303 = 5737;
HB_TRAIL_31306(5738), public static final int HB_TRAIL_31306 = 5738;
HB_TRAIL_31309(5739), public static final int HB_TRAIL_31309 = 5739;
HB_TRAIL_31312(5740), public static final int HB_TRAIL_31312 = 5740;
HB_TRAIL_31315(5741), public static final int HB_TRAIL_31315 = 5741;
HB_TRAIL_31318(5742), public static final int HB_TRAIL_31318 = 5742;
HB_TRAIL_31321(5743), public static final int HB_TRAIL_31321 = 5743;
HB_TRAIL_31324(5744), public static final int HB_TRAIL_31324 = 5744;
HB_TRAIL_31327(5745), public static final int HB_TRAIL_31327 = 5745;
HB_TRAIL_31330(5746), public static final int HB_TRAIL_31330 = 5746;
HB_TRAIL_31333(5768), public static final int HB_TRAIL_31333 = 5768;
HB_TRAIL_31336(5769), public static final int HB_TRAIL_31336 = 5769;
HB_TRAIL_31339(5770), public static final int HB_TRAIL_31339 = 5770;
HB_TRAIL_31342(5771), public static final int HB_TRAIL_31342 = 5771;
HB_TRAIL_31345(5772), public static final int HB_TRAIL_31345 = 5772;
HB_TRAIL_31348(5773), public static final int HB_TRAIL_31348 = 5773;
HB_TRAIL_31351(5774), public static final int HB_TRAIL_31351 = 5774;
HB_TRAIL_31354(5775), public static final int HB_TRAIL_31354 = 5775;
HB_TRAIL_31357(5776), public static final int HB_TRAIL_31357 = 5776;
HB_TRAIL_31360(5777), public static final int HB_TRAIL_31360 = 5777;
HB_TRAIL_31363(5747), public static final int HB_TRAIL_31363 = 5747;
HB_TRAIL_31366(5748), public static final int HB_TRAIL_31366 = 5748;
HB_TRAIL_31369(5749), public static final int HB_TRAIL_31369 = 5749;
HB_TRAIL_31372(5750), public static final int HB_TRAIL_31372 = 5750;
HB_FINISH(5766), public static final int HB_FINISH = 5766;
/** /**
* Started hunting Herbiboar. * Started hunting Herbiboar.
@@ -234,181 +229,186 @@ public enum Varbits
* NOTE: This value remains at 0 even after starting a Herbiboar trail up until searching the first object along the * NOTE: This value remains at 0 even after starting a Herbiboar trail up until searching the first object along the
* hunting path. * hunting path.
*/ */
HB_STARTED(5767), public static final int HB_STARTED = 5767;
/** /**
* Barbarian Assault * Barbarian Assault
*/ */
IN_GAME_BA(3923), public static final int IN_GAME_BA = 3923;
BA_GC(4768), public static final int BA_GC = 4768;
/** /**
* 0 = Outside wilderness * 0 = Outside wilderness
* 1 = In wilderness * 1 = In wilderness
*/ */
IN_WILDERNESS(5963), public static final int IN_WILDERNESS = 5963;
/** /**
* Fishing Trawler * Fishing Trawler
* FISHING_TRAWLER_ACTIVITY Expected values: 0-255 * FISHING_TRAWLER_ACTIVITY Expected values: 0-255
*/ */
FISHING_TRAWLER_ACTIVITY(3377), public static final int FISHING_TRAWLER_ACTIVITY = 3377;
/** /**
* Blast Furnace Bar Dispenser * Blast Furnace Bar Dispenser
* * <p>
* These are the expected values: * These are the expected values:
* 0 = No bars being processed * 0 = No bars being processed
* 1 = Ores are being processed on the conveyor belt, bar dispenser cannot be checked * 1 = Ores are being processed on the conveyor belt, bar dispenser cannot be checked
* 2 = Bars are cooling down * 2 = Bars are cooling down
* 3 = Bars can be collected * 3 = Bars can be collected
*/ */
BAR_DISPENSER(936), public static final int BAR_DISPENSER = 936;
/** /**
* Motherlode mine sack * Motherlode mine sack
*/ */
SACK_NUMBER(5558), public static final int SACK_NUMBER = 5558;
SACK_UPGRADED(5556), public static final int SACK_UPGRADED = 5556;
/** /**
* Experience tracker * Experience tracker
* * <p>
* EXPERIENCE_TRACKER_POSITION expected values: * EXPERIENCE_TRACKER_POSITION expected values:
* 0 = Right * 0 = Right
* 1 = Middle * 1 = Middle
* 2 = Left * 2 = Left
*/ */
EXPERIENCE_TRACKER_POSITION(4692), public static final int EXPERIENCE_TRACKER_POSITION = 4692;
EXPERIENCE_TRACKER_COUNTER(4697), public static final int EXPERIENCE_TRACKER_COUNTER = 4697;
EXPERIENCE_TRACKER_PROGRESS_BAR(4698), public static final int EXPERIENCE_TRACKER_PROGRESS_BAR = 4698;
/** /**
* Experience drop color * Experience drop color
*/ */
EXPERIENCE_DROP_COLOR(4695), public static final int EXPERIENCE_DROP_COLOR = 4695;
/** /**
* Tithe Farm * Tithe Farm
*/ */
TITHE_FARM_SACK_AMOUNT(4900), public static final int TITHE_FARM_SACK_AMOUNT = 4900;
TITHE_FARM_SACK_ICON(5370), public static final int TITHE_FARM_SACK_ICON = 5370;
TITHE_FARM_POINTS(4893), public static final int TITHE_FARM_POINTS = 4893;
/** /**
* Blast Mine * Blast Mine
*/ */
BLAST_MINE_COAL(4924), public static final int BLAST_MINE_COAL = 4924;
BLAST_MINE_GOLD(4925), public static final int BLAST_MINE_GOLD = 4925;
BLAST_MINE_MITHRIL(4926), public static final int BLAST_MINE_MITHRIL = 4926;
BLAST_MINE_ADAMANTITE(4921), public static final int BLAST_MINE_ADAMANTITE = 4921;
BLAST_MINE_RUNITE(4922), public static final int BLAST_MINE_RUNITE = 4922;
/** /**
* Raids * Raids
*/ */
IN_RAID(5432), public static final int IN_RAID = 5432;
TOTAL_POINTS(5431), public static final int TOTAL_POINTS = 5431;
PERSONAL_POINTS(5422), public static final int PERSONAL_POINTS = 5422;
RAID_PARTY_SIZE(5424), public static final int RAID_PARTY_SIZE = 5424;
// 0 = raid not started, >0 = raid started // 0 = raid not started, >0 = raid started
RAID_STATE(5425), public static final int RAID_STATE = 5425;
/** /**
* Making Friends with My Arm fire pits * Making Friends with My Arm fire pits
* * <p>
* Expected values: * Expected values:
* 0 = Not built * 0 = Not built
* 1 = Built * 1 = Built
*/ */
FIRE_PIT_GIANT_MOLE(6532), public static final int FIRE_PIT_GIANT_MOLE = 6532;
FIRE_PIT_LUMBRIDGE_SWAMP(6533), public static final int FIRE_PIT_LUMBRIDGE_SWAMP = 6533;
FIRE_PIT_MOS_LE_HARMLESS(6534), public static final int FIRE_PIT_MOS_LE_HARMLESS = 6534;
/** /**
* Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating * Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating
*/ */
THEATRE_OF_BLOOD(6440), public static final int THEATRE_OF_BLOOD = 6440;
/**
* Theatre of Blood orb healths
* 0=hide 1-27=% of health - 27 is 100% health and 1 is 0% health, 30=dead
*/
public static final int THEATRE_OF_BLOOD_ORB1 = 6442;
public static final int THEATRE_OF_BLOOD_ORB2 = 6443;
public static final int THEATRE_OF_BLOOD_ORB3 = 6444;
public static final int THEATRE_OF_BLOOD_ORB4 = 6445;
public static final int THEATRE_OF_BLOOD_ORB5 = 6446;
/** /**
* Nightmare Zone * Nightmare Zone
*/ */
NMZ_ABSORPTION(3956), public static final int NMZ_ABSORPTION = 3956;
NMZ_POINTS(3949), public static final int NMZ_POINTS = 3949;
/** /**
* Blast Furnace * Blast Furnace
*/ */
BLAST_FURNACE_COPPER_ORE(959), public static final int BLAST_FURNACE_COPPER_ORE = 959;
BLAST_FURNACE_TIN_ORE(950), public static final int BLAST_FURNACE_TIN_ORE = 950;
BLAST_FURNACE_IRON_ORE(951), public static final int BLAST_FURNACE_IRON_ORE = 951;
BLAST_FURNACE_COAL(949), public static final int BLAST_FURNACE_COAL = 949;
BLAST_FURNACE_MITHRIL_ORE(952), public static final int BLAST_FURNACE_MITHRIL_ORE = 952;
BLAST_FURNACE_ADAMANTITE_ORE(953), public static final int BLAST_FURNACE_ADAMANTITE_ORE = 953;
BLAST_FURNACE_RUNITE_ORE(954), public static final int BLAST_FURNACE_RUNITE_ORE = 954;
BLAST_FURNACE_SILVER_ORE(956), public static final int BLAST_FURNACE_SILVER_ORE = 956;
BLAST_FURNACE_GOLD_ORE(955), public static final int BLAST_FURNACE_GOLD_ORE = 955;
BLAST_FURNACE_BRONZE_BAR(941), public static final int BLAST_FURNACE_BRONZE_BAR = 941;
BLAST_FURNACE_IRON_BAR(942), public static final int BLAST_FURNACE_IRON_BAR = 942;
BLAST_FURNACE_STEEL_BAR(943), public static final int BLAST_FURNACE_STEEL_BAR = 943;
BLAST_FURNACE_MITHRIL_BAR(944), public static final int BLAST_FURNACE_MITHRIL_BAR = 944;
BLAST_FURNACE_ADAMANTITE_BAR(945), public static final int BLAST_FURNACE_ADAMANTITE_BAR = 945;
BLAST_FURNACE_RUNITE_BAR(946), public static final int BLAST_FURNACE_RUNITE_BAR = 946;
BLAST_FURNACE_SILVER_BAR(948), public static final int BLAST_FURNACE_SILVER_BAR = 948;
BLAST_FURNACE_GOLD_BAR(947), public static final int BLAST_FURNACE_GOLD_BAR = 947;
BLAST_FURNACE_COFFER(5357), public static final int BLAST_FURNACE_COFFER = 5357;
/** /**
* Pyramid plunder * Pyramid plunder
*/ */
PYRAMID_PLUNDER_ROOM_LOCATION(2365), public static final int PYRAMID_PLUNDER_ROOM_LOCATION = 2365;
PYRAMID_PLUNDER_TIMER(2375), public static final int PYRAMID_PLUNDER_TIMER = 2375;
PYRAMID_PLUNDER_THIEVING_LEVEL(2376), public static final int PYRAMID_PLUNDER_THIEVING_LEVEL = 2376;
PYRAMID_PLUNDER_ROOM(2377), public static final int PYRAMID_PLUNDER_ROOM = 2377;
/** /**
* Barrows * Barrows
*/ */
BARROWS_KILLED_AHRIM(457), public static final int BARROWS_KILLED_AHRIM = 457;
BARROWS_KILLED_DHAROK(458), public static final int BARROWS_KILLED_DHAROK = 458;
BARROWS_KILLED_GUTHAN(459), public static final int BARROWS_KILLED_GUTHAN = 459;
BARROWS_KILLED_KARIL(460), public static final int BARROWS_KILLED_KARIL = 460;
BARROWS_KILLED_TORAG(461), public static final int BARROWS_KILLED_TORAG = 461;
BARROWS_KILLED_VERAC(462), public static final int BARROWS_KILLED_VERAC = 462;
BARROWS_REWARD_POTENTIAL(463), public static final int BARROWS_REWARD_POTENTIAL = 463;
BARROWS_NPCS_SLAIN(464), public static final int BARROWS_NPCS_SLAIN = 464;
/** /**
* Spicy stew ingredients * Spicy stew ingredients
*/ */
SPICY_STEW_RED_SPICES(1879), public static final int SPICY_STEW_RED_SPICES = 1879;
SPICY_STEW_YELLOW_SPICES(1880), public static final int SPICY_STEW_YELLOW_SPICES = 1880;
SPICY_STEW_BROWN_SPICES(1881), public static final int SPICY_STEW_BROWN_SPICES = 1881;
SPICY_STEW_ORANGE_SPICES(1882), public static final int SPICY_STEW_ORANGE_SPICES = 1882;
/** /**
* Multicombat area * Multicombat area
*/ */
MULTICOMBAT_AREA(4605), public static final int MULTICOMBAT_AREA = 4605;
/** /**
* Kingdom of Miscellania Management * Kingdom of Miscellania Management
* Kingdom Approval is represented as a 7-bit unsigned integer; 127 corresponds to 100% approval * Kingdom Approval is represented as a 7-bit unsigned integer; 127 corresponds to 100% approval
*/ */
KINGDOM_APPROVAL(72), public static final int KINGDOM_APPROVAL = 72;
KINGDOM_COFFER(74), public static final int KINGDOM_COFFER = 74;
// TODO: Remove next major
@Deprecated
KINGDOM_FAVOR(72),
/** /**
* The Hand in the Sand quest status * The Hand in the Sand quest status
*/ */
QUEST_THE_HAND_IN_THE_SAND(1527), public static final int QUEST_THE_HAND_IN_THE_SAND = 1527;
/** /**
* 0 = Sir Bedivere * 0 = Sir Bedivere
@@ -421,263 +421,255 @@ public enum Varbits
* 7 = Sir Lancelot * 7 = Sir Lancelot
* 8 = Completed (Chivalry and Piety are unlocked) * 8 = Completed (Chivalry and Piety are unlocked)
*/ */
CAMELOT_TRAINING_ROOM_STATUS(3909), public static final int CAMELOT_TRAINING_ROOM_STATUS = 3909;
/** /**
* Daily Tasks (Collection availability) * Daily Tasks =Collection availability)
*/ */
DAILY_HERB_BOXES_COLLECTED(3961), public static final int DAILY_HERB_BOXES_COLLECTED = 3961;
DAILY_STAVES_COLLECTED(4539), public static final int DAILY_STAVES_COLLECTED = 4539;
DAILY_ESSENCE_COLLECTED(4547), public static final int DAILY_ESSENCE_COLLECTED = 4547;
DAILY_RUNES_COLLECTED(4540), public static final int DAILY_RUNES_COLLECTED = 4540;
DAILY_SAND_COLLECTED(4549), public static final int DAILY_SAND_COLLECTED = 4549;
DAILY_FLAX_STATE(4559), public static final int DAILY_FLAX_STATE = 4559;
DAILY_ARROWS_STATE(4563), public static final int DAILY_ARROWS_STATE = 4563;
/** /**
* This varbit tracks how much bonemeal has been redeemed from Robin * This varbit tracks how much bonemeal has been redeemed from Robin
* The player gets 13 for each diary completed above and including Medium, for a maxiumum of 39 * The player gets 13 for each diary completed above and including Medium, for a maxiumum of 39
*/ */
DAILY_BONEMEAL_STATE(4543), public static final int DAILY_BONEMEAL_STATE = 4543;
DAILY_DYNAMITE_COLLECTED(7939), public static final int DAILY_DYNAMITE_COLLECTED = 7939;
/** /**
* Fairy Ring * Fairy Ring
*/ */
FAIR_RING_LAST_DESTINATION(5374), public static final int FAIR_RING_LAST_DESTINATION = 5374;
FAIRY_RING_DIAL_ADCB(3985), //Left dial public static final int FAIRY_RING_DIAL_ADCB = 3985; //Left dial
FAIRY_RIGH_DIAL_ILJK(3986), //Middle dial public static final int FAIRY_RIGH_DIAL_ILJK = 3986; //Middle dial
FAIRY_RING_DIAL_PSRQ(3987), //Right dial public static final int FAIRY_RING_DIAL_PSRQ = 3987; //Right dial
/** /**
* Transmog controllers for farming * Transmog controllers for farming
*/ */
FARMING_4771(4771), public static final int FARMING_4771 = 4771;
FARMING_4772(4772), public static final int FARMING_4772 = 4772;
FARMING_4773(4773), public static final int FARMING_4773 = 4773;
FARMING_4774(4774), public static final int FARMING_4774 = 4774;
FARMING_4775(4775), public static final int FARMING_4775 = 4775;
FARMING_7904(7904), public static final int FARMING_7904 = 7904;
FARMING_7905(7905), public static final int FARMING_7905 = 7905;
FARMING_7906(7906), public static final int FARMING_7906 = 7906;
FARMING_7907(7907), public static final int FARMING_7907 = 7907;
FARMING_7908(7908), public static final int FARMING_7908 = 7908;
FARMING_7909(7909), public static final int FARMING_7909 = 7909;
FARMING_7910(7910), public static final int FARMING_7910 = 7910;
FARMING_7911(7911), public static final int FARMING_7911 = 7911;
FARMING_7912(7912), public static final int FARMING_7912 = 7912;
/** /**
* Transmog controllers for grapes * Transmog controllers for grapes
*/ */
GRAPES_4953(4953), public static final int GRAPES_4953 = 4953;
GRAPES_4954(4954), public static final int GRAPES_4954 = 4954;
GRAPES_4955(4955), public static final int GRAPES_4955 = 4955;
GRAPES_4956(4956), public static final int GRAPES_4956 = 4956;
GRAPES_4957(4957), public static final int GRAPES_4957 = 4957;
GRAPES_4958(4958), public static final int GRAPES_4958 = 4958;
GRAPES_4959(4959), public static final int GRAPES_4959 = 4959;
GRAPES_4960(4960), public static final int GRAPES_4960 = 4960;
GRAPES_4961(4961), public static final int GRAPES_4961 = 4961;
GRAPES_4962(4962), public static final int GRAPES_4962 = 4962;
GRAPES_4963(4963), public static final int GRAPES_4963 = 4963;
GRAPES_4964(4964), public static final int GRAPES_4964 = 4964;
/** /**
* Automatically weed farming patches * Automatically weed farming patches
*/ */
AUTOWEED(5557), public static final int AUTOWEED = 5557;
/** /**
* The varbit that stores the players {@code AccountType}. * The varbit that stores the players {@code AccountType}.
*/ */
ACCOUNT_TYPE(1777), public static final int ACCOUNT_TYPE = 1777;
/** /**
* The varbit that stores the oxygen percentage for player * The varbit that stores the oxygen percentage for player
*/ */
OXYGEN_LEVEL(5811), public static final int OXYGEN_LEVEL = 5811;
/** /**
* Drift net status * Drift net status
* * <p>
* Expected values * Expected values
* 0 = Unset * 0 = Unset
* 1 = Set up * 1 = Set up
* 2 = Caught some fish * 2 = Caught some fish
* 3 = Full * 3 = Full
*/ */
NORTH_NET_STATUS(5812), public static final int NORTH_NET_STATUS = 5812;
SOUTH_NET_STATUS(5814), public static final int SOUTH_NET_STATUS = 5814;
/** /**
* Drift net catch count * Drift net catch count
*/ */
NORTH_NET_CATCH_COUNT(5813), public static final int NORTH_NET_CATCH_COUNT = 5813;
SOUTH_NET_CATCH_COUNT(5815), public static final int SOUTH_NET_CATCH_COUNT = 5815;
/** /**
* Drift net collect interface * Drift net collect interface
* * <p>
* Expected values: * Expected values:
* 0 = Not open * 0 = Not open
* 1 = North interface open * 1 = North interface open
* 2 = South interface open * 2 = South interface open
*/ */
DRIFT_NET_COLLECT(5933), public static final int DRIFT_NET_COLLECT = 5933;
/** /**
* Corp beast damage * Corp beast damage
*/ */
CORP_DAMAGE(999), public static final int CORP_DAMAGE = 999;
/** /**
* Toggleable slayer unlocks * Toggleable slayer unlocks
*/ */
SUPERIOR_ENABLED(5362), public static final int SUPERIOR_ENABLED = 5362;
FOSSIL_ISLAND_WYVERN_DISABLE(6251), public static final int FOSSIL_ISLAND_WYVERN_DISABLE = 6251;
BANK_REARRANGE_MODE(3959), public static final int BANK_REARRANGE_MODE = 3959;
CURRENT_BANK_TAB(4150), public static final int CURRENT_BANK_TAB = 4150;
WORLDHOPPER_FAVROITE_1(4597), public static final int WORLDHOPPER_FAVROITE_1 = 4597;
WORLDHOPPER_FAVROITE_2(4598), public static final int WORLDHOPPER_FAVROITE_2 = 4598;
/** /**
* Vengeance is active * Vengeance is active
*/ */
VENGEANCE_ACTIVE(2450), public static final int VENGEANCE_ACTIVE = 2450;
/** /**
* Spell cooldowns * Spell cooldowns
*/ */
VENGEANCE_COOLDOWN(2451), public static final int VENGEANCE_COOLDOWN = 2451;
CORRUPTION_COOLDOWN(12288), public static final int CORRUPTION_COOLDOWN = 12288;
/** /**
* Imbued Heart cooldown * Imbued Heart cooldown
* Number of game tick remaining on cooldown in intervals of 10; for a value X there are 10 * X game ticks remaining. * Number of game tick remaining on cooldown in intervals of 10; for a value X there are 10 * X game ticks remaining.
* The heart regains its power once this reaches 0. * The heart regains its power once this reaches 0.
*/ */
IMBUED_HEART_COOLDOWN(5361), public static final int IMBUED_HEART_COOLDOWN = 5361;
/** /**
* Amount of items in each bank tab * Amount of items in each bank tab
*/ */
BANK_TAB_ONE_COUNT(4171), public static final int BANK_TAB_ONE_COUNT = 4171;
BANK_TAB_TWO_COUNT(4172), public static final int BANK_TAB_TWO_COUNT = 4172;
BANK_TAB_THREE_COUNT(4173), public static final int BANK_TAB_THREE_COUNT = 4173;
BANK_TAB_FOUR_COUNT(4174), public static final int BANK_TAB_FOUR_COUNT = 4174;
BANK_TAB_FIVE_COUNT(4175), public static final int BANK_TAB_FIVE_COUNT = 4175;
BANK_TAB_SIX_COUNT(4176), public static final int BANK_TAB_SIX_COUNT = 4176;
BANK_TAB_SEVEN_COUNT(4177), public static final int BANK_TAB_SEVEN_COUNT = 4177;
BANK_TAB_EIGHT_COUNT(4178), public static final int BANK_TAB_EIGHT_COUNT = 4178;
BANK_TAB_NINE_COUNT(4179), public static final int BANK_TAB_NINE_COUNT = 4179;
/** /**
* Type of GE offer currently being created * Type of GE offer currently being created
* 0 = buy * 0 = buy
* 1 = sell * 1 = sell
*/ */
GE_OFFER_CREATION_TYPE(4397), public static final int GE_OFFER_CREATION_TYPE = 4397;
GE_OFFER_PRICE_PER_ITEM(4398), public static final int GE_OFFER_PRICE_PER_ITEM = 4398;
/** /**
* The active tab within the quest interface * The active tab within the quest interface
*/ */
QUEST_TAB(8168), public static final int QUEST_TAB = 8168;
/** /**
* Explorer ring * Explorer ring
*/ */
EXPLORER_RING_ALCHTYPE(5398), public static final int EXPLORER_RING_ALCHTYPE = 5398;
EXPLORER_RING_TELEPORTS(4552), public static final int EXPLORER_RING_TELEPORTS = 4552;
EXPLORER_RING_ALCHS(4554), public static final int EXPLORER_RING_ALCHS = 4554;
EXPLORER_RING_RUNENERGY(4553), public static final int EXPLORER_RING_RUNENERGY = 4553;
WINTERTODT_TIMER(7980), public static final int WINTERTODT_TIMER = 7980;
/** /**
* League relics * League relics
*/ */
LEAGUE_RELIC_1(10049), public static final int LEAGUE_RELIC_1 = 10049;
LEAGUE_RELIC_2(10050), public static final int LEAGUE_RELIC_2 = 10050;
LEAGUE_RELIC_3(10051), public static final int LEAGUE_RELIC_3 = 10051;
LEAGUE_RELIC_4(10052), public static final int LEAGUE_RELIC_4 = 10052;
LEAGUE_RELIC_5(10053), public static final int LEAGUE_RELIC_5 = 10053;
LEAGUE_RELIC_6(11696), public static final int LEAGUE_RELIC_6 = 11696;
/** /**
* Muted volume restore values * Muted volume restore values
*/ */
MUTED_MUSIC_VOLUME(9666), public static final int MUTED_MUSIC_VOLUME = 9666;
MUTED_SOUND_EFFECT_VOLUME(9674), public static final int MUTED_SOUND_EFFECT_VOLUME = 9674;
MUTED_AREA_EFFECT_VOLUME(9675), public static final int MUTED_AREA_EFFECT_VOLUME = 9675;
/** /**
* Parasite infection status during nightmare of ashihama bossfight * Parasite infection status during nightmare of ashihama bossfight
* * <p>
* 0 = not infected * 0 = not infected
* 1 = infected * 1 = infected
*
*/ */
PARASITE(10151), public static final int PARASITE = 10151;
/** /**
* Whether the vanilla wiki entity lookup is displayed under the minimap * Whether the vanilla wiki entity lookup is displayed under the minimap
* * <p>
* 0 = Enabled * 0 = Enabled
* 1 = Disabled * 1 = Disabled
*
*/ */
WIKI_ENTITY_LOOKUP(10113), public static final int WIKI_ENTITY_LOOKUP = 10113;
/** /**
* Whether the Special Attack orb is disabled due to being in a PvP area * Whether the Special Attack orb is disabled due to being in a PvP area
* * <p>
* 0 = Enabled (player is not in PvP) * 0 = Enabled =player is not in PvP)
* 1 = Disabled (player in in PvP) * 1 = Disabled =player in in PvP)
* *
* @see <a href="https://oldschool.runescape.wiki/w/Minimap#Special_attack_orb">The OSRS Wiki's Minimap page</a> * @see <a href="https://oldschool.runescape.wiki/w/Minimap#Special_attack_orb">The OSRS Wiki's Minimap page</a>
*/ */
PVP_SPEC_ORB(8121), public static final int PVP_SPEC_ORB = 8121;
/** /**
* Collection Log notification settings whenever a new item is added * Collection Log notification settings whenever a new item is added
* * <p>
* 0 = no notification * 0 = no notification
* 1 = chat notification only * 1 = chat notification only
* 2 = popup notification only * 2 = popup notification only
* 3 = chat and popup * 3 = chat and popup
*/ */
COLLECTION_LOG_NOTIFICATION(11959), public static final int COLLECTION_LOG_NOTIFICATION = 11959;
/** /**
* Combat Achievements popup settings whenever a new task is completed * Combat Achievements popup settings whenever a new task is completed
* * <p>
* 0 = popup notification enabled * 0 = popup notification enabled
* 1 = popup notification disabled * 1 = popup notification disabled
*/ */
COMBAT_ACHIEVEMENTS_POPUP(12455), public static final int COMBAT_ACHIEVEMENTS_POPUP = 12455;
/** /**
* Show boss health overlay setting * Show boss health overlay setting
* 0 = on * 0 = on
* 1 = off * 1 = off
*/ */
BOSS_HEALTH_OVERLAY(12389), public static final int BOSS_HEALTH_OVERLAY = 12389;
/** /**
* Whether the PVP kill-death stats widget should be drawn while in the wilderness or in PVP worlds. * Whether the PVP kill-death stats widget should be drawn while in the wilderness or in PVP worlds.
* * <p>
* 0 = Disabled * 0 = Disabled
* 1 = Enabled * 1 = Enabled
*/ */
SHOW_PVP_KDR_STATS(4143), public static final int SHOW_PVP_KDR_STATS = 4143;
;
/**
* The raw varbit ID.
*/
private final int id;
} }

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2022, Adam <Adam@sigterm.info>
* 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.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import net.runelite.api.Varbits;
import org.intellij.lang.annotations.MagicConstant;
@MagicConstant(valuesFromClass = Varbits.class)
@Documented
@Retention(RetentionPolicy.SOURCE)
public @interface Varbit
{
}

View File

@@ -61,6 +61,8 @@ public class ClientSessionManager
} }
public void start() public void start()
{
executorService.execute(() ->
{ {
try try
{ {
@@ -71,6 +73,7 @@ public class ClientSessionManager
{ {
log.warn("error opening session", ex); log.warn("error opening session", ex);
} }
});
scheduledFuture = executorService.scheduleWithFixedDelay(RunnableExceptionLogger.wrap(this::ping), 1, 10, TimeUnit.MINUTES); scheduledFuture = executorService.scheduleWithFixedDelay(RunnableExceptionLogger.wrap(this::ping), 1, 10, TimeUnit.MINUTES);
} }

View File

@@ -106,7 +106,7 @@ public class ChatMessageManager
final String channel = stringStack[size - 4]; final String channel = stringStack[size - 4];
final ChatMessageType chatMessageType = messageNode.getType(); final ChatMessageType chatMessageType = messageNode.getType();
final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; final boolean isChatboxTransparent = client.isResized() && client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) == 1;
Color usernameColor = null; Color usernameColor = null;
Color channelColor = null; Color channelColor = null;
@@ -217,7 +217,7 @@ public class ChatMessageManager
return; return;
} }
boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; boolean isChatboxTransparent = client.isResized() && client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) == 1;
Color usernameColor = isChatboxTransparent ? chatColorConfig.transparentPrivateUsernames() : chatColorConfig.opaquePrivateUsernames(); Color usernameColor = isChatboxTransparent ? chatColorConfig.transparentPrivateUsernames() : chatColorConfig.opaquePrivateUsernames();
if (usernameColor == null) if (usernameColor == null)
{ {
@@ -842,7 +842,7 @@ public class ChatMessageManager
@VisibleForTesting @VisibleForTesting
String formatRuneLiteMessage(String runeLiteFormatMessage, ChatMessageType type, boolean pmbox) String formatRuneLiteMessage(String runeLiteFormatMessage, ChatMessageType type, boolean pmbox)
{ {
final boolean transparentChatbox = client.getVar(Varbits.TRANSPARENT_CHATBOX) != 0; final boolean transparentChatbox = client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) != 0;
final boolean transparent = client.isResized() && transparentChatbox; final boolean transparent = client.isResized() && transparentChatbox;
final Collection<ChatColor> chatColors = colorCache.get(type); final Collection<ChatColor> chatColors = colorCache.get(type);
for (ChatColor chatColor : chatColors) for (ChatColor chatColor : chatColors)

View File

@@ -66,6 +66,7 @@ public class HiscoreResult
private Skill clueScrollMaster; private Skill clueScrollMaster;
private Skill lastManStanding; private Skill lastManStanding;
private Skill soulWarsZeal; private Skill soulWarsZeal;
private Skill riftsClosed;
private Skill abyssalSire; private Skill abyssalSire;
private Skill alchemicalHydra; private Skill alchemicalHydra;
private Skill barrowsChests; private Skill barrowsChests;
@@ -191,6 +192,8 @@ public class HiscoreResult
return lastManStanding; return lastManStanding;
case SOUL_WARS_ZEAL: case SOUL_WARS_ZEAL:
return soulWarsZeal; return soulWarsZeal;
case RIFTS_CLOSED:
return riftsClosed;
case ABYSSAL_SIRE: case ABYSSAL_SIRE:
return abyssalSire; return abyssalSire;
case ALCHEMICAL_HYDRA: case ALCHEMICAL_HYDRA:

View File

@@ -85,6 +85,10 @@ class HiscoreResultBuilder
hiscoreResult.setClueScrollMaster(skills.get(index++)); hiscoreResult.setClueScrollMaster(skills.get(index++));
hiscoreResult.setLastManStanding(skills.get(index++)); hiscoreResult.setLastManStanding(skills.get(index++));
hiscoreResult.setSoulWarsZeal(skills.get(index++)); hiscoreResult.setSoulWarsZeal(skills.get(index++));
if (skills.size() > 84)
{
hiscoreResult.setRiftsClosed(skills.get(index++));
}
// seasonal doesn't have boss hiscores // seasonal doesn't have boss hiscores
if (index < skills.size()) if (index < skills.size())
{ {
@@ -115,10 +119,7 @@ class HiscoreResultBuilder
hiscoreResult.setKreearra(skills.get(index++)); hiscoreResult.setKreearra(skills.get(index++));
hiscoreResult.setKrilTsutsaroth(skills.get(index++)); hiscoreResult.setKrilTsutsaroth(skills.get(index++));
hiscoreResult.setMimic(skills.get(index++)); hiscoreResult.setMimic(skills.get(index++));
if (skills.size() > 83)
{
hiscoreResult.setNex(skills.get(index++)); hiscoreResult.setNex(skills.get(index++));
}
hiscoreResult.setNightmare(skills.get(index++)); hiscoreResult.setNightmare(skills.get(index++));
hiscoreResult.setPhosanisNightmare(skills.get(index++)); hiscoreResult.setPhosanisNightmare(skills.get(index++));
hiscoreResult.setObor(skills.get(index++)); hiscoreResult.setObor(skills.get(index++));

View File

@@ -70,6 +70,7 @@ public enum HiscoreSkill
CLUE_SCROLL_MASTER("Clue Scrolls (master)", ACTIVITY), CLUE_SCROLL_MASTER("Clue Scrolls (master)", ACTIVITY),
LAST_MAN_STANDING("Last Man Standing", ACTIVITY), LAST_MAN_STANDING("Last Man Standing", ACTIVITY),
SOUL_WARS_ZEAL("Soul Wars Zeal", ACTIVITY), SOUL_WARS_ZEAL("Soul Wars Zeal", ACTIVITY),
RIFTS_CLOSED("Rifts closed", ACTIVITY),
ABYSSAL_SIRE("Abyssal Sire", BOSS), ABYSSAL_SIRE("Abyssal Sire", BOSS),
ALCHEMICAL_HYDRA("Alchemical Hydra", BOSS), ALCHEMICAL_HYDRA("Alchemical Hydra", BOSS),
BARROWS_CHESTS("Barrows Chests", BOSS), BARROWS_CHESTS("Barrows Chests", BOSS),

View File

@@ -28,6 +28,7 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter @Getter
@@ -37,7 +38,6 @@ public class FavourRequirement implements Requirement
* An enumeration of Kourend house favour the player can earn. * An enumeration of Kourend house favour the player can earn.
*/ */
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter
public enum Favour public enum Favour
{ {
ARCEUUS("Arceuus", Varbits.KOUREND_FAVOR_ARCEUUS), ARCEUUS("Arceuus", Varbits.KOUREND_FAVOR_ARCEUUS),
@@ -46,8 +46,10 @@ public class FavourRequirement implements Requirement
PISCARILIUS("Piscarilius", Varbits.KOUREND_FAVOR_PISCARILIUS), PISCARILIUS("Piscarilius", Varbits.KOUREND_FAVOR_PISCARILIUS),
SHAYZIEN("Shayzien", Varbits.KOUREND_FAVOR_SHAYZIEN); SHAYZIEN("Shayzien", Varbits.KOUREND_FAVOR_SHAYZIEN);
@Getter
private final String name; private final String name;
private final Varbits varbit; @Getter(onMethod_ = {@Varbit})
private final int varbit;
} }
private final Favour house; private final Favour house;
@@ -62,7 +64,7 @@ public class FavourRequirement implements Requirement
@Override @Override
public boolean satisfiesRequirement(Client client) public boolean satisfiesRequirement(Client client)
{ {
int realFavour = client.getVar(house.getVarbit()); int realFavour = client.getVarbitValue(house.getVarbit());
return (realFavour / 10) >= percent; return (realFavour / 10) >= percent;
} }
} }

View File

@@ -105,8 +105,8 @@ public class AttackStylesPlugin extends Plugin
{ {
resetWarnings(); resetWarnings();
attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
equippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE); equippedWeaponTypeVarbit = client.getVarbitValue(Varbits.EQUIPPED_WEAPON_TYPE);
castingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE); castingModeVarbit = client.getVarbitValue(Varbits.DEFENSIVE_CASTING_MODE);
updateAttackStyle( updateAttackStyle(
equippedWeaponTypeVarbit, equippedWeaponTypeVarbit,
attackStyleVarbit, attackStyleVarbit,
@@ -174,8 +174,8 @@ public class AttackStylesPlugin extends Plugin
public void onVarbitChanged(VarbitChanged event) public void onVarbitChanged(VarbitChanged event)
{ {
int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
int currentEquippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE); int currentEquippedWeaponTypeVarbit = client.getVarbitValue(Varbits.EQUIPPED_WEAPON_TYPE);
int currentCastingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE); int currentCastingModeVarbit = client.getVarbitValue(Varbits.DEFENSIVE_CASTING_MODE);
if (attackStyleVarbit != currentAttackStyleVarbit || equippedWeaponTypeVarbit != currentEquippedWeaponTypeVarbit || castingModeVarbit != currentCastingModeVarbit) if (attackStyleVarbit != currentAttackStyleVarbit || equippedWeaponTypeVarbit != currentEquippedWeaponTypeVarbit || castingModeVarbit != currentCastingModeVarbit)
{ {

View File

@@ -788,7 +788,7 @@ public class TabInterface
return; return;
} }
if (client.getVar(Varbits.BANK_REARRANGE_MODE) == 0) if (client.getVarbitValue(Varbits.BANK_REARRANGE_MODE) == 0)
{ {
tabManager.swap(source.getName(), dest.getName()); tabManager.swap(source.getName(), dest.getName());
} }

View File

@@ -177,7 +177,7 @@ public class BarbarianAssaultPlugin extends Plugin
@Subscribe @Subscribe
public void onVarbitChanged(VarbitChanged event) public void onVarbitChanged(VarbitChanged event)
{ {
int inGame = client.getVar(Varbits.IN_GAME_BA); int inGame = client.getVarbitValue(Varbits.IN_GAME_BA);
if (inGameBit != inGame) if (inGameBit != inGame)
{ {

View File

@@ -70,7 +70,7 @@ class BarrowsBrotherSlainOverlay extends OverlayPanel
for (BarrowsBrothers brother : BarrowsBrothers.values()) for (BarrowsBrothers brother : BarrowsBrothers.values())
{ {
final boolean brotherSlain = client.getVar(brother.getKilledVarbit()) > 0; final boolean brotherSlain = client.getVarbitValue(brother.getKilledVarbit()) > 0;
String slain = brotherSlain ? "\u2713" : "\u2717"; String slain = brotherSlain ? "\u2713" : "\u2717";
panelComponent.getChildren().add(LineComponent.builder() panelComponent.getChildren().add(LineComponent.builder()
.left(brother.getName()) .left(brother.getName())
@@ -109,12 +109,12 @@ class BarrowsBrotherSlainOverlay extends OverlayPanel
private int rewardPotential() private int rewardPotential()
{ {
// this is from [proc,barrows_overlay_reward] // this is from [proc,barrows_overlay_reward]
int brothers = client.getVar(Varbits.BARROWS_KILLED_AHRIM) int brothers = client.getVarbitValue(Varbits.BARROWS_KILLED_AHRIM)
+ client.getVar(Varbits.BARROWS_KILLED_DHAROK) + client.getVarbitValue(Varbits.BARROWS_KILLED_DHAROK)
+ client.getVar(Varbits.BARROWS_KILLED_GUTHAN) + client.getVarbitValue(Varbits.BARROWS_KILLED_GUTHAN)
+ client.getVar(Varbits.BARROWS_KILLED_KARIL) + client.getVarbitValue(Varbits.BARROWS_KILLED_KARIL)
+ client.getVar(Varbits.BARROWS_KILLED_TORAG) + client.getVarbitValue(Varbits.BARROWS_KILLED_TORAG)
+ client.getVar(Varbits.BARROWS_KILLED_VERAC); + client.getVarbitValue(Varbits.BARROWS_KILLED_VERAC);
return client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) + brothers * 2; return client.getVarbitValue(Varbits.BARROWS_REWARD_POTENTIAL) + brothers * 2;
} }
} }

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.barrows;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
@RequiredArgsConstructor @RequiredArgsConstructor
@@ -42,5 +43,6 @@ enum BarrowsBrothers
private final String name; private final String name;
private final WorldPoint location; private final WorldPoint location;
private final Varbits killedVarbit; @Getter(onMethod_ = {@Varbit})
private final int killedVarbit;
} }

View File

@@ -92,7 +92,7 @@ class BarrowsOverlay extends Overlay
graphics.setColor(Color.black); graphics.setColor(Color.black);
graphics.drawString(brotherLetter, miniMapLocation.getX() + 1, miniMapLocation.getY() + 1); graphics.drawString(brotherLetter, miniMapLocation.getX() + 1, miniMapLocation.getY() + 1);
if (client.getVar(brother.getKilledVarbit()) > 0) if (client.getVarbitValue(brother.getKilledVarbit()) > 0)
{ {
graphics.setColor(config.deadBrotherLocColor()); graphics.setColor(config.deadBrotherLocColor());
} }

View File

@@ -24,13 +24,15 @@
*/ */
package net.runelite.client.plugins.blastfurnace; package net.runelite.client.plugins.blastfurnace;
import com.google.common.collect.ImmutableMap; import lombok.AllArgsConstructor;
import java.util.Map;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
public enum BarsOres @AllArgsConstructor
@Getter
enum BarsOres
{ {
COPPER_ORE(Varbits.BLAST_FURNACE_COPPER_ORE, ItemID.COPPER_ORE), COPPER_ORE(Varbits.BLAST_FURNACE_COPPER_ORE, ItemID.COPPER_ORE),
TIN_ORE(Varbits.BLAST_FURNACE_TIN_ORE, ItemID.TIN_ORE), TIN_ORE(Varbits.BLAST_FURNACE_TIN_ORE, ItemID.TIN_ORE),
@@ -50,33 +52,7 @@ public enum BarsOres
SILVER_BAR(Varbits.BLAST_FURNACE_SILVER_BAR, ItemID.SILVER_BAR), SILVER_BAR(Varbits.BLAST_FURNACE_SILVER_BAR, ItemID.SILVER_BAR),
GOLD_BAR(Varbits.BLAST_FURNACE_GOLD_BAR, ItemID.GOLD_BAR); GOLD_BAR(Varbits.BLAST_FURNACE_GOLD_BAR, ItemID.GOLD_BAR);
private static final Map<Varbits, BarsOres> VARBIT; @Getter(onMethod_ = {@Varbit})
private final int varbit;
static
{
ImmutableMap.Builder<Varbits, BarsOres> builder = new ImmutableMap.Builder<>();
for (BarsOres s : values())
{
builder.put(s.getVarbit(), s);
}
VARBIT = builder.build();
}
@Getter
private final Varbits varbit;
@Getter
private final int itemID; private final int itemID;
BarsOres(Varbits varbit, int itemID)
{
this.varbit = varbit;
this.itemID = itemID;
}
public static BarsOres getVarbit(Varbits varbit)
{
return VARBIT.get(varbit);
}
} }

View File

@@ -60,7 +60,7 @@ class BlastFurnaceClickBoxOverlay extends Overlay
@Override @Override
public Dimension render(Graphics2D graphics) public Dimension render(Graphics2D graphics)
{ {
int dispenserState = client.getVar(Varbits.BAR_DISPENSER); int dispenserState = client.getVarbitValue(Varbits.BAR_DISPENSER);
if (config.showConveyorBelt() && plugin.getConveyorBelt() != null) if (config.showConveyorBelt() && plugin.getConveyorBelt() != null)
{ {

View File

@@ -71,7 +71,7 @@ class BlastFurnaceCofferOverlay extends OverlayPanel
if (sack != null) if (sack != null)
{ {
final int coffer = client.getVar(BLAST_FURNACE_COFFER); final int coffer = client.getVarbitValue(BLAST_FURNACE_COFFER);
sack.setHidden(true); sack.setHidden(true);

View File

@@ -67,7 +67,7 @@ class BlastFurnaceOverlay extends OverlayPanel
for (BarsOres varbit : BarsOres.values()) for (BarsOres varbit : BarsOres.values())
{ {
int amount = client.getVar(varbit.getVarbit()); int amount = client.getVarbitValue(varbit.getVarbit());
if (amount == 0) if (amount == 0)
{ {

View File

@@ -73,11 +73,11 @@ class BlastMineOreCountOverlay extends OverlayPanel
if (config.showOreOverlay()) if (config.showOreOverlay())
{ {
blastMineWidget.setHidden(true); blastMineWidget.setHidden(true);
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVar(Varbits.BLAST_MINE_COAL)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVarbitValue(Varbits.BLAST_MINE_COAL))));
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.GOLD_ORE, client.getVar(Varbits.BLAST_MINE_GOLD)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.GOLD_ORE, client.getVarbitValue(Varbits.BLAST_MINE_GOLD))));
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.MITHRIL_ORE, client.getVar(Varbits.BLAST_MINE_MITHRIL)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.MITHRIL_ORE, client.getVarbitValue(Varbits.BLAST_MINE_MITHRIL))));
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.ADAMANTITE_ORE, client.getVar(Varbits.BLAST_MINE_ADAMANTITE)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.ADAMANTITE_ORE, client.getVarbitValue(Varbits.BLAST_MINE_ADAMANTITE))));
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.RUNITE_ORE, client.getVar(Varbits.BLAST_MINE_RUNITE)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.RUNITE_ORE, client.getVarbitValue(Varbits.BLAST_MINE_RUNITE))));
} }
else else
{ {

View File

@@ -406,7 +406,7 @@ public class ChatChannelPlugin extends Plugin
int rankIcon = -1; int rankIcon = -1;
// Use configured friends chat info colors if set, otherwise default to the jagex text and fc name colors // Use configured friends chat info colors if set, otherwise default to the jagex text and fc name colors
if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1) if (client.isResized() && client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) == 1)
{ {
textColor = MoreObjects.firstNonNull(chatColorConfig.transparentFriendsChatInfo(), CHAT_FC_TEXT_TRANSPARENT_BACKGROUND); textColor = MoreObjects.firstNonNull(chatColorConfig.transparentFriendsChatInfo(), CHAT_FC_TEXT_TRANSPARENT_BACKGROUND);
channelColor = MoreObjects.firstNonNull(chatColorConfig.transparentFriendsChatChannelName(), CHAT_FC_NAME_TRANSPARENT_BACKGROUND); channelColor = MoreObjects.firstNonNull(chatColorConfig.transparentFriendsChatChannelName(), CHAT_FC_NAME_TRANSPARENT_BACKGROUND);
@@ -462,7 +462,7 @@ public class ChatChannelPlugin extends Plugin
final Color textColor; final Color textColor;
// Use configured clan chat info colors if set, otherwise default to the jagex text and fc name colors // Use configured clan chat info colors if set, otherwise default to the jagex text and fc name colors
if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1) if (client.isResized() && client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) == 1)
{ {
textColor = MoreObjects.firstNonNull( textColor = MoreObjects.firstNonNull(
chatType == MemberActivity.ChatType.CLAN_CHAT ? chatColorConfig.transparentClanChatInfo() : chatColorConfig.transparentClanChatGuestInfo(), chatType == MemberActivity.ChatType.CLAN_CHAT ? chatColorConfig.transparentClanChatInfo() : chatColorConfig.transparentClanChatGuestInfo(),

View File

@@ -107,7 +107,7 @@ import org.apache.commons.text.WordUtils;
public class ChatCommandsPlugin extends Plugin public class ChatCommandsPlugin extends Plugin
{ {
private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (?:completion count for |subdued |completed )?(.+?) (?:(?:kill|harvest|lap|completion) )?(?:count )?is: <col=ff0000>(\\d+)</col>"); private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (?:completion count for |subdued |completed )?(.+?) (?:(?:kill|harvest|lap|completion) )?(?:count )?is: <col=ff0000>(\\d+)</col>");
private static final String TEAM_SIZES = "(?:\\d+(?:\\+|-\\d+)? players|Solo)"; private static final String TEAM_SIZES = "(?<teamsize>\\d+(?:\\+|-\\d+)? players|Solo)";
private static final Pattern RAIDS_PB_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + TEAM_SIZES + "</col> Duration:</col> <col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col> \\(new personal best\\)</col>"); private static final Pattern RAIDS_PB_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + TEAM_SIZES + "</col> Duration:</col> <col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col> \\(new personal best\\)</col>");
private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + TEAM_SIZES + "</col> Duration:</col> <col=ff0000>[0-9:.]+</col> Personal best: </col><col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col>"); private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + TEAM_SIZES + "</col> Duration:</col> <col=ff0000>[0-9:.]+</col> Personal best: </col><col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col>");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)(?:(?:Fight |Lap |Challenge |Corrupted challenge )?duration:|Subdued in|(?<!total )completion time:) <col=[0-9a-f]{6}>[0-9:.]+</col>\\. Personal best: (?:<col=ff0000>)?(?<pb>[0-9:]+(?:\\.[0-9]+)?)"); private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)(?:(?:Fight |Lap |Challenge |Corrupted challenge )?duration:|Subdued in|(?<!total )completion time:) <col=[0-9a-f]{6}>[0-9:.]+</col>\\. Personal best: (?:<col=ff0000>)?(?<pb>[0-9:]+(?:\\.[0-9]+)?)");
@@ -115,7 +115,7 @@ public class ChatCommandsPlugin extends Plugin
private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won ([\\d,]+|one) duels?"); private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won ([\\d,]+|one) duels?");
private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost ([\\d,]+|one) duels?"); private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost ([\\d,]+|one) duels?");
private static final Pattern ADVENTURE_LOG_TITLE_PATTERN = Pattern.compile("The Exploits of (.+)"); private static final Pattern ADVENTURE_LOG_TITLE_PATTERN = Pattern.compile("The Exploits of (.+)");
private static final Pattern ADVENTURE_LOG_PB_PATTERN = Pattern.compile("Fastest (?:kill|run)(?: - \\(Team size: " + TEAM_SIZES + "\\))?: ([0-9:]+(?:\\.[0-9]+)?)"); private static final Pattern ADVENTURE_LOG_PB_PATTERN = Pattern.compile("Fastest (?:kill|run)(?: - \\(Team size: " + TEAM_SIZES + "\\))?: (?<time>[0-9:]+(?:\\.[0-9]+)?)");
private static final Pattern HS_PB_PATTERN = Pattern.compile("Floor (?<floor>\\d) time: <col=ff0000>(?<floortime>[0-9:]+(?:\\.[0-9]+)?)</col>(?: \\(new personal best\\)|. Personal best: (?<floorpb>[0-9:]+(?:\\.[0-9]+)?))" + private static final Pattern HS_PB_PATTERN = Pattern.compile("Floor (?<floor>\\d) time: <col=ff0000>(?<floortime>[0-9:]+(?:\\.[0-9]+)?)</col>(?: \\(new personal best\\)|. Personal best: (?<floorpb>[0-9:]+(?:\\.[0-9]+)?))" +
"(?:<br>Overall time: <col=ff0000>(?<otime>[0-9:]+(?:\\.[0-9]+)?)</col>(?: \\(new personal best\\)|. Personal best: (?<opb>[0-9:]+(?:\\.[0-9]+)?)))?"); "(?:<br>Overall time: <col=ff0000>(?<otime>[0-9:]+(?:\\.[0-9]+)?)</col>(?: \\(new personal best\\)|. Personal best: (?<opb>[0-9:]+(?:\\.[0-9]+)?)))?");
private static final Pattern HS_KC_FLOOR_PATTERN = Pattern.compile("You have completed Floor (\\d) of the Hallowed Sepulchre! Total completions: <col=ff0000>([0-9,]+)</col>\\."); private static final Pattern HS_KC_FLOOR_PATTERN = Pattern.compile("You have completed Floor (\\d) of the Hallowed Sepulchre! Total completions: <col=ff0000>([0-9,]+)</col>\\.");
@@ -156,6 +156,7 @@ public class ChatCommandsPlugin extends Plugin
private String lastBossKill; private String lastBossKill;
private int lastBossTime = -1; private int lastBossTime = -1;
private double lastPb = -1; private double lastPb = -1;
private String lastTeamSize;
private int modIconIdx = -1; private int modIconIdx = -1;
@Inject @Inject
@@ -394,8 +395,30 @@ public class ChatCommandsPlugin extends Plugin
if (lastPb > -1) if (lastPb > -1)
{ {
log.debug("Got out-of-order personal best for {}: {}", renamedBoss, lastPb); log.debug("Got out-of-order personal best for {}: {}", renamedBoss, lastPb);
if (renamedBoss.contains("Theatre of Blood"))
{
// TOB team size isn't sent in the kill message, but can be computed from varbits
int tobTeamSize = tobTeamSize();
lastTeamSize = tobTeamSize == 1 ? "Solo" : (tobTeamSize + " players");
}
final double pb = getPb(renamedBoss);
// If a raid with a team size, only update the pb if it is lower than the existing pb
// so that the pb is the overall lowest of any team size
if (lastTeamSize == null || pb == 0 || lastPb < pb)
{
log.debug("Setting overall pb (old: {})", pb);
setPb(renamedBoss, lastPb); setPb(renamedBoss, lastPb);
}
if (lastTeamSize != null)
{
log.debug("Setting team size pb: {}", lastTeamSize);
setPb(renamedBoss + " " + lastTeamSize, lastPb);
}
lastPb = -1; lastPb = -1;
lastTeamSize = null;
} }
else else
{ {
@@ -554,16 +577,26 @@ public class ChatCommandsPlugin extends Plugin
double seconds = timeStringToSeconds(matcher.group("pb")); double seconds = timeStringToSeconds(matcher.group("pb"));
if (lastBossKill != null) if (lastBossKill != null)
{ {
// Most bosses sent boss kill message, and then pb message, so we // Most bosses send boss kill message, and then pb message, so we
// use the remembered lastBossKill // use the remembered lastBossKill
log.debug("Got personal best for {}: {}", lastBossKill, seconds); log.debug("Got personal best for {}: {}", lastBossKill, seconds);
setPb(lastBossKill, seconds); setPb(lastBossKill, seconds);
lastPb = -1; lastPb = -1;
lastTeamSize = null;
} }
else else
{ {
// Some bosses send the pb message, and then the kill message! // Some bosses send the pb message, and then the kill message!
lastPb = seconds; lastPb = seconds;
try
{
lastTeamSize = matcher.group("teamsize");
}
catch (IllegalArgumentException ex)
{
// pattern has no team size
lastTeamSize = null;
}
} }
} }
@@ -654,7 +687,7 @@ public class ChatCommandsPlugin extends Plugin
Matcher matcher = ADVENTURE_LOG_PB_PATTERN.matcher(line); Matcher matcher = ADVENTURE_LOG_PB_PATTERN.matcher(line);
if (matcher.find()) if (matcher.find())
{ {
double s = timeStringToSeconds(matcher.group(1)); double s = timeStringToSeconds(matcher.group("time"));
pb = Math.min(pb, s); pb = Math.min(pb, s);
} }
} }
@@ -1128,7 +1161,7 @@ public class ChatCommandsPlugin extends Plugin
private boolean gambleCountSubmit(ChatInput chatInput, String value) private boolean gambleCountSubmit(ChatInput chatInput, String value)
{ {
final int gc = client.getVar(Varbits.BA_GC); final int gc = client.getVarbitValue(Varbits.BA_GC);
final String playerName = client.getLocalPlayer().getName(); final String playerName = client.getLocalPlayer().getName();
executor.execute(() -> executor.execute(() ->
@@ -1919,15 +1952,57 @@ public class ChatCommandsPlugin extends Plugin
case "herbi": case "herbi":
return "Herbiboar"; return "Herbiboar";
// cox // Chambers of Xeric
case "cox": case "cox":
case "xeric": case "xeric":
case "chambers": case "chambers":
case "olm": case "olm":
case "raids": case "raids":
return "Chambers of Xeric"; return "Chambers of Xeric";
case "cox 1":
case "cox solo":
return "Chambers of Xeric Solo";
case "cox 2":
case "cox duo":
return "Chambers of Xeric 2 players";
case "cox 3":
return "Chambers of Xeric 3 players";
case "cox 4":
return "Chambers of Xeric 4 players";
case "cox 5":
return "Chambers of Xeric 5 players";
case "cox 6":
return "Chambers of Xeric 6 players";
case "cox 7":
return "Chambers of Xeric 7 players";
case "cox 8":
return "Chambers of Xeric 8 players";
case "cox 9":
return "Chambers of Xeric 9 players";
case "cox 10":
return "Chambers of Xeric 10 players";
case "cox 11-15":
case "cox 11":
case "cox 12":
case "cox 13":
case "cox 14":
case "cox 15":
return "Chambers of Xeric 11-15 players";
case "cox 16-23":
case "cox 16":
case "cox 17":
case "cox 18":
case "cox 19":
case "cox 20":
case "cox 21":
case "cox 22":
case "cox 23":
return "Chambers of Xeric 16-23 players";
case "cox 24":
case "cox 24+":
return "Chambers of Xeric 24+ players";
// cox cm // Chambers of Xeric Challenge Mode
case "cox cm": case "cox cm":
case "xeric cm": case "xeric cm":
case "chambers cm": case "chambers cm":
@@ -1935,15 +2010,70 @@ public class ChatCommandsPlugin extends Plugin
case "raids cm": case "raids cm":
case "chambers of xeric - challenge mode": case "chambers of xeric - challenge mode":
return "Chambers of Xeric Challenge Mode"; return "Chambers of Xeric Challenge Mode";
case "cox cm 1":
case "cox cm solo":
return "Chambers of Xeric Challenge Mode Solo";
case "cox cm 2":
case "cox cm duo":
return "Chambers of Xeric Challenge Mode 2 players";
case "cox cm 3":
return "Chambers of Xeric Challenge Mode 3 players";
case "cox cm 4":
return "Chambers of Xeric Challenge Mode 4 players";
case "cox cm 5":
return "Chambers of Xeric Challenge Mode 5 players";
case "cox cm 6":
return "Chambers of Xeric Challenge Mode 6 players";
case "cox cm 7":
return "Chambers of Xeric Challenge Mode 7 players";
case "cox cm 8":
return "Chambers of Xeric Challenge Mode 8 players";
case "cox cm 9":
return "Chambers of Xeric Challenge Mode 9 players";
case "cox cm 10":
return "Chambers of Xeric Challenge Mode 10 players";
case "cox cm 11-15":
case "cox cm 11":
case "cox cm 12":
case "cox cm 13":
case "cox cm 14":
case "cox cm 15":
return "Chambers of Xeric Challenge Mode 11-15 players";
case "cox cm 16-23":
case "cox cm 16":
case "cox cm 17":
case "cox cm 18":
case "cox cm 19":
case "cox cm 20":
case "cox cm 21":
case "cox cm 22":
case "cox cm 23":
return "Chambers of Xeric Challenge Mode 16-23 players";
case "cox cm 24":
case "cox cm 24+":
return "Chambers of Xeric Challenge Mode 24+ players";
// tob // Theatre of Blood
case "tob": case "tob":
case "theatre": case "theatre":
case "verzik": case "verzik":
case "verzik vitur": case "verzik vitur":
case "raids 2": case "raids 2":
return "Theatre of Blood"; return "Theatre of Blood";
case "tob 1":
case "tob solo":
return "Theatre of Blood Solo";
case "tob 2":
case "tob duo":
return "Theatre of Blood 2 players";
case "tob 3":
return "Theatre of Blood 3 players";
case "tob 4":
return "Theatre of Blood 4 players";
case "tob 5":
return "Theatre of Blood 5 players";
// Theatre of Blood Entry Mode
case "theatre of blood: story mode": case "theatre of blood: story mode":
case "tob sm": case "tob sm":
case "tob story mode": case "tob story mode":
@@ -1954,6 +2084,7 @@ public class ChatCommandsPlugin extends Plugin
case "tob entry": case "tob entry":
return "Theatre of Blood Entry Mode"; return "Theatre of Blood Entry Mode";
// Theatre of Blood Hard Mode
case "theatre of blood: hard mode": case "theatre of blood: hard mode":
case "tob cm": case "tob cm":
case "tob hm": case "tob hm":
@@ -1961,6 +2092,18 @@ public class ChatCommandsPlugin extends Plugin
case "tob hard": case "tob hard":
case "hmt": case "hmt":
return "Theatre of Blood Hard Mode"; return "Theatre of Blood Hard Mode";
case "hmt 1":
case "hmt solo":
return "Theatre of Blood Hard Mode Solo";
case "hmt 2":
case "hmt duo":
return "Theatre of Blood Hard Mode 2 players";
case "hmt 3":
return "Theatre of Blood Hard Mode 3 players";
case "hmt 4":
return "Theatre of Blood Hard Mode 4 players";
case "hmt 5":
return "Theatre of Blood Hard Mode 5 players";
// The Gauntlet // The Gauntlet
case "gaunt": case "gaunt":
@@ -2256,4 +2399,13 @@ public class ChatCommandsPlugin extends Plugin
} }
return null; return null;
} }
private int tobTeamSize()
{
return Math.min(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB1), 1) +
Math.min(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB2), 1) +
Math.min(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB3), 1) +
Math.min(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB4), 1) +
Math.min(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB5), 1);
}
} }

View File

@@ -113,7 +113,7 @@ public class ClueScrollOverlay extends OverlayPanel
} }
if (clue.isRequiresLight() if (clue.isRequiresLight()
&& ((clue.getHasFirePit() == null || client.getVar(clue.getHasFirePit()) != 1) && ((clue.getFirePitVarbitId() == -1 || client.getVarbitValue(clue.getFirePitVarbitId()) != 1)
&& (inventoryItems == null || !HAS_LIGHT.fulfilledBy(inventoryItems)) && (inventoryItems == null || !HAS_LIGHT.fulfilledBy(inventoryItems))
&& (equippedItems == null || !HAS_LIGHT.fulfilledBy(equippedItems)))) && (equippedItems == null || !HAS_LIGHT.fulfilledBy(equippedItems))))
{ {

View File

@@ -145,10 +145,10 @@ public class ClueScrollPlugin extends Plugin
private static final Color HIGHLIGHT_HOVER_BORDER_COLOR = HIGHLIGHT_BORDER_COLOR.darker(); private static final Color HIGHLIGHT_HOVER_BORDER_COLOR = HIGHLIGHT_BORDER_COLOR.darker();
private static final Color HIGHLIGHT_FILL_COLOR = new Color(0, 255, 0, 20); private static final Color HIGHLIGHT_FILL_COLOR = new Color(0, 255, 0, 20);
private static final String CLUE_TAG_NAME = "clue"; private static final String CLUE_TAG_NAME = "clue";
private static final Varbits[] RUNEPOUCH_AMOUNT_VARBITS = { private static final int[] RUNEPOUCH_AMOUNT_VARBITS = {
Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3 Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3
}; };
private static final Varbits[] RUNEPOUCH_RUNE_VARBITS = { private static final int[] RUNEPOUCH_RUNE_VARBITS = {
Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3 Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3
}; };
@@ -431,13 +431,13 @@ public class ClueScrollPlugin extends Plugin
List<Item> items = new ArrayList<>(RUNEPOUCH_AMOUNT_VARBITS.length); List<Item> items = new ArrayList<>(RUNEPOUCH_AMOUNT_VARBITS.length);
for (int i = 0; i < RUNEPOUCH_AMOUNT_VARBITS.length; i++) for (int i = 0; i < RUNEPOUCH_AMOUNT_VARBITS.length; i++)
{ {
int amount = client.getVar(RUNEPOUCH_AMOUNT_VARBITS[i]); int amount = client.getVarbitValue(RUNEPOUCH_AMOUNT_VARBITS[i]);
if (amount <= 0) if (amount <= 0)
{ {
continue; continue;
} }
int varbId = client.getVar(RUNEPOUCH_RUNE_VARBITS[i]); int varbId = client.getVarbitValue(RUNEPOUCH_RUNE_VARBITS[i]);
RunepouchRune rune = RunepouchRune.getRune(varbId); RunepouchRune rune = RunepouchRune.getRune(varbId);
if (rune == null) if (rune == null)
{ {

View File

@@ -701,7 +701,7 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc
.build(), .build(),
AnagramClue.builder() AnagramClue.builder()
.text("DISORDER") .text("DISORDER")
.npc("Sedridor") .npc("Archmage Sedridor")
.location(new WorldPoint(3102, 9570, 0)) .location(new WorldPoint(3102, 9570, 0))
.area("Wizards' Tower basement") .area("Wizards' Tower basement")
.build(), .build(),

View File

@@ -28,7 +28,7 @@ import java.awt.Graphics2D;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import net.runelite.api.Varbits; import net.runelite.api.annotations.Varbit;
import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin;
import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.PanelComponent;
@@ -43,8 +43,8 @@ public abstract class ClueScroll
private boolean requiresLight; private boolean requiresLight;
@Setter(AccessLevel.PROTECTED) @Setter(AccessLevel.PROTECTED)
@Getter(AccessLevel.PUBLIC) @Getter(onMethod_ = {@Varbit}, value = AccessLevel.PUBLIC)
private Varbits hasFirePit; private int firePitVarbitId = -1;
@Setter(AccessLevel.PROTECTED) @Setter(AccessLevel.PROTECTED)
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)

View File

@@ -32,14 +32,21 @@ import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.ANCIENT_WIZARDS;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.ARMADYLEAN_GUARD;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.ARMADYLEAN_OR_BANDOSIAN_GUARD;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.BANDOSIAN_GUARD;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.BRASSICAN_MAGE;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.SARADOMIN_WIZARD;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.ZAMORAK_WIZARD;
import net.runelite.client.ui.overlay.OverlayUtil; import net.runelite.client.ui.overlay.OverlayUtil;
import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.LineComponent;
import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.TitleComponent; import net.runelite.client.ui.overlay.components.TitleComponent;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.*;
@Getter @Getter
public class CoordinateClue extends ClueScroll implements TextClueScroll, LocationClueScroll public class CoordinateClue extends ClueScroll implements TextClueScroll, LocationClueScroll
@@ -49,7 +56,8 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
{ {
private final String directions; private final String directions;
private final boolean lightRequired; private final boolean lightRequired;
private final Varbits lightSource; @Getter(onMethod_ = {@Varbit})
private final int lightSourceVarbitId;
private final Enemy enemy; private final Enemy enemy;
private CoordinateClueInfo(@NonNull String directions) private CoordinateClueInfo(@NonNull String directions)
@@ -62,15 +70,15 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
this.directions = directions; this.directions = directions;
this.enemy = enemy; this.enemy = enemy;
this.lightRequired = false; this.lightRequired = false;
this.lightSource = null; this.lightSourceVarbitId = -1;
} }
private CoordinateClueInfo(@Nonnull String directions, Enemy enemy, boolean lightRequired, Varbits lightSource) private CoordinateClueInfo(@Nonnull String directions, Enemy enemy, boolean lightRequired, @Varbit int lightSourceVarbitId)
{ {
this.directions = directions; this.directions = directions;
this.enemy = enemy; this.enemy = enemy;
this.lightRequired = lightRequired; this.lightRequired = lightRequired;
this.lightSource = lightSource; this.lightSourceVarbitId = lightSourceVarbitId;
} }
} }
@@ -257,7 +265,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
final CoordinateClueInfo clueInfo = CLUES.get(location); final CoordinateClueInfo clueInfo = CLUES.get(location);
if (clueInfo != null) if (clueInfo != null)
{ {
setHasFirePit(clueInfo.getLightSource()); setFirePitVarbitId(clueInfo.getLightSourceVarbitId());
setRequiresLight(clueInfo.lightRequired); setRequiresLight(clueInfo.lightRequired);
setEnemy(clueInfo.getEnemy()); setEnemy(clueInfo.getEnemy());
} }

View File

@@ -41,6 +41,7 @@ import static net.runelite.api.ItemID.*;
import net.runelite.api.Perspective; import net.runelite.api.Perspective;
import net.runelite.api.ScriptID; import net.runelite.api.ScriptID;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR;
@@ -253,11 +254,11 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
this.itemRequirements = itemRequirements; this.itemRequirements = itemRequirements;
} }
private EmoteClue(String text, String locationName, @Nullable STASHUnit stashUnit, WorldPoint location, Emote firstEmote, Emote secondEmote, @Nonnull Varbits firePit, @Nonnull ItemRequirement... itemRequirements) private EmoteClue(String text, String locationName, @Nullable STASHUnit stashUnit, WorldPoint location, Emote firstEmote, Emote secondEmote, @Varbit int firePitVarbitId, @Nonnull ItemRequirement... itemRequirements)
{ {
this(text, locationName, stashUnit, location, firstEmote, secondEmote, itemRequirements); this(text, locationName, stashUnit, location, firstEmote, secondEmote, itemRequirements);
setRequiresLight(true); setRequiresLight(true);
setHasFirePit(firePit); setFirePitVarbitId(firePitVarbitId);
} }
@Override @Override

View File

@@ -236,7 +236,7 @@ class PluginListItem extends JPanel implements SearchablePlugin
buttonPanel.add(onOffToggle); buttonPanel.add(onOffToggle);
if (pluginConfig.getPlugin() != null) if (pluginConfig.getPlugin() != null)
{ {
onOffToggle.addItemListener(i -> onOffToggle.addActionListener(i ->
{ {
if (onOffToggle.isSelected()) if (onOffToggle.isSelected())
{ {

View File

@@ -79,7 +79,7 @@ class CorpDamageOverlay extends OverlayPanel
return null; return null;
} }
int myDamage = client.getVar(Varbits.CORP_DAMAGE); int myDamage = client.getVarbitValue(Varbits.CORP_DAMAGE);
int totalDamage = corpPlugin.getTotalDamage(); int totalDamage = corpPlugin.getTotalDamage();
int players = corpPlugin.getPlayers().size(); int players = corpPlugin.getPlayers().size();

View File

@@ -235,7 +235,7 @@ public class CorpPlugin extends Plugin
{ {
if (corp != null) if (corp != null)
{ {
int myDamage = client.getVar(Varbits.CORP_DAMAGE); int myDamage = client.getVarbitValue(Varbits.CORP_DAMAGE);
// avoid resetting our counter when the client's is reset // avoid resetting our counter when the client's is reset
if (myDamage > 0) if (myDamage > 0)
{ {

View File

@@ -99,7 +99,7 @@ public class CrowdsourcingCooking
int cookingLevel = client.getBoostedSkillLevel(Skill.COOKING); int cookingLevel = client.getBoostedSkillLevel(Skill.COOKING);
boolean hasCookingGauntlets = hasCookingGauntlets(); boolean hasCookingGauntlets = hasCookingGauntlets();
boolean kourendElite = client.getVar(Varbits.DIARY_KOUREND_ELITE) == 1; boolean kourendElite = client.getVarbitValue(Varbits.DIARY_KOUREND_ELITE) == 1;
CookingData data = new CookingData(message, hasCookingGauntlets, inHosidiusKitchen, kourendElite, lastGameObjectClicked, cookingLevel); CookingData data = new CookingData(message, hasCookingGauntlets, inHosidiusKitchen, kourendElite, lastGameObjectClicked, cookingLevel);
manager.storeEvent(data); manager.storeEvent(data);
} }

View File

@@ -82,10 +82,10 @@ public class CrowdsourcingThieving
private int getArdougneDiary() private int getArdougneDiary()
{ {
int easy = client.getVar(Varbits.DIARY_ARDOUGNE_EASY); int easy = client.getVarbitValue(Varbits.DIARY_ARDOUGNE_EASY);
int medium = client.getVar(Varbits.DIARY_ARDOUGNE_MEDIUM); int medium = client.getVarbitValue(Varbits.DIARY_ARDOUGNE_MEDIUM);
int hard = client.getVar(Varbits.DIARY_ARDOUGNE_HARD); int hard = client.getVarbitValue(Varbits.DIARY_ARDOUGNE_HARD);
int elite = client.getVar(Varbits.DIARY_ARDOUGNE_ELITE); int elite = client.getVarbitValue(Varbits.DIARY_ARDOUGNE_ELITE);
return easy + 2 * medium + 4 * hard + 8 * elite; return easy + 2 * medium + 4 * hard + 8 * elite;
} }

View File

@@ -127,7 +127,7 @@ public class CrowdsourcingZMI
} }
int tickDelta = itemContainerChangedTick - illegalActionTick; int tickDelta = itemContainerChangedTick - illegalActionTick;
boolean ardougneMedium = client.getVar(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1; boolean ardougneMedium = client.getVarbitValue(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1;
int runecraftBoostedLevel = client.getBoostedSkillLevel(Skill.RUNECRAFT); int runecraftBoostedLevel = client.getBoostedSkillLevel(Skill.RUNECRAFT);
Multiset<Integer> currentInventorySnapshot = getInventorySnapshot(); Multiset<Integer> currentInventorySnapshot = getInventorySnapshot();
final Multiset<Integer> itemsReceived = Multisets.difference(currentInventorySnapshot, previousInventorySnapshot); final Multiset<Integer> itemsReceived = Multisets.difference(currentInventorySnapshot, previousInventorySnapshot);

View File

@@ -171,7 +171,7 @@ public class DailyTasksPlugin extends Plugin
{ {
if (client.getAccountType() == AccountType.NORMAL if (client.getAccountType() == AccountType.NORMAL
&& client.getVar(VarPlayer.NMZ_REWARD_POINTS) >= HERB_BOX_COST && client.getVar(VarPlayer.NMZ_REWARD_POINTS) >= HERB_BOX_COST
&& (client.getVar(Varbits.DAILY_HERB_BOXES_COLLECTED) < HERB_BOX_MAX && (client.getVarbitValue(Varbits.DAILY_HERB_BOXES_COLLECTED) < HERB_BOX_MAX
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(HERB_BOX_MESSAGE); sendChatMessage(HERB_BOX_MESSAGE);
@@ -180,8 +180,8 @@ public class DailyTasksPlugin extends Plugin
private void checkStaves(boolean dailyReset) private void checkStaves(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_VARROCK_EASY) == 1 if (client.getVarbitValue(Varbits.DIARY_VARROCK_EASY) == 1
&& (client.getVar(Varbits.DAILY_STAVES_COLLECTED) == 0 && (client.getVarbitValue(Varbits.DAILY_STAVES_COLLECTED) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(STAVES_MESSAGE); sendChatMessage(STAVES_MESSAGE);
@@ -190,8 +190,8 @@ public class DailyTasksPlugin extends Plugin
private void checkEssence(boolean dailyReset) private void checkEssence(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1 if (client.getVarbitValue(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1
&& (client.getVar(Varbits.DAILY_ESSENCE_COLLECTED) == 0 && (client.getVarbitValue(Varbits.DAILY_ESSENCE_COLLECTED) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(ESSENCE_MESSAGE); sendChatMessage(ESSENCE_MESSAGE);
@@ -200,8 +200,8 @@ public class DailyTasksPlugin extends Plugin
private void checkRunes(boolean dailyReset) private void checkRunes(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_WILDERNESS_EASY) == 1 if (client.getVarbitValue(Varbits.DIARY_WILDERNESS_EASY) == 1
&& (client.getVar(Varbits.DAILY_RUNES_COLLECTED) == 0 && (client.getVarbitValue(Varbits.DAILY_RUNES_COLLECTED) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(RUNES_MESSAGE); sendChatMessage(RUNES_MESSAGE);
@@ -211,8 +211,8 @@ public class DailyTasksPlugin extends Plugin
private void checkSand(boolean dailyReset) private void checkSand(boolean dailyReset)
{ {
if (client.getAccountType() != AccountType.ULTIMATE_IRONMAN if (client.getAccountType() != AccountType.ULTIMATE_IRONMAN
&& client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE && client.getVarbitValue(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE
&& (client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0 && (client.getVarbitValue(Varbits.DAILY_SAND_COLLECTED) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(SAND_MESSAGE); sendChatMessage(SAND_MESSAGE);
@@ -221,8 +221,8 @@ public class DailyTasksPlugin extends Plugin
private void checkFlax(boolean dailyReset) private void checkFlax(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_KANDARIN_EASY) == 1 if (client.getVarbitValue(Varbits.DIARY_KANDARIN_EASY) == 1
&& (client.getVar(Varbits.DAILY_FLAX_STATE) == 0 && (client.getVarbitValue(Varbits.DAILY_FLAX_STATE) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(FLAX_MESSAGE); sendChatMessage(FLAX_MESSAGE);
@@ -231,8 +231,8 @@ public class DailyTasksPlugin extends Plugin
private void checkArrows(boolean dailyReset) private void checkArrows(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_WESTERN_EASY) == 1 if (client.getVarbitValue(Varbits.DIARY_WESTERN_EASY) == 1
&& (client.getVar(Varbits.DAILY_ARROWS_STATE) == 0 && (client.getVarbitValue(Varbits.DAILY_ARROWS_STATE) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(ARROWS_MESSAGE); sendChatMessage(ARROWS_MESSAGE);
@@ -241,14 +241,14 @@ public class DailyTasksPlugin extends Plugin
private void checkBonemeal(boolean dailyReset) private void checkBonemeal(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_MORYTANIA_MEDIUM) == 1) if (client.getVarbitValue(Varbits.DIARY_MORYTANIA_MEDIUM) == 1)
{ {
int collected = client.getVar(Varbits.DAILY_BONEMEAL_STATE); int collected = client.getVarbitValue(Varbits.DAILY_BONEMEAL_STATE);
int max = BONEMEAL_PER_DIARY; int max = BONEMEAL_PER_DIARY;
if (client.getVar(Varbits.DIARY_MORYTANIA_HARD) == 1) if (client.getVarbitValue(Varbits.DIARY_MORYTANIA_HARD) == 1)
{ {
max += BONEMEAL_PER_DIARY; max += BONEMEAL_PER_DIARY;
if (client.getVar(Varbits.DIARY_MORYTANIA_ELITE) == 1) if (client.getVarbitValue(Varbits.DIARY_MORYTANIA_ELITE) == 1)
{ {
max += BONEMEAL_PER_DIARY; max += BONEMEAL_PER_DIARY;
} }
@@ -262,8 +262,8 @@ public class DailyTasksPlugin extends Plugin
private void checkDynamite(boolean dailyReset) private void checkDynamite(boolean dailyReset)
{ {
if (client.getVar(Varbits.DIARY_KOUREND_MEDIUM) == 1 if (client.getVarbitValue(Varbits.DIARY_KOUREND_MEDIUM) == 1
&& (client.getVar(Varbits.DAILY_DYNAMITE_COLLECTED) == 0 && (client.getVarbitValue(Varbits.DAILY_DYNAMITE_COLLECTED) == 0
|| dailyReset)) || dailyReset))
{ {
sendChatMessage(DYNAMITE_MESSAGE); sendChatMessage(DYNAMITE_MESSAGE);

View File

@@ -28,12 +28,9 @@ package net.runelite.client.plugins.devtools;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape; import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
@@ -59,9 +56,6 @@ import net.runelite.api.TileItem;
import net.runelite.api.TileObject; import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.ui.FontManager; import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayLayer;
@@ -122,11 +116,6 @@ class DevToolsOverlay extends Overlay
renderTileObjects(graphics); renderTileObjects(graphics);
} }
if (plugin.getInventory().isActive())
{
renderInventory(graphics);
}
if (plugin.getProjectiles().isActive()) if (plugin.getProjectiles().isActive())
{ {
renderProjectiles(graphics); renderProjectiles(graphics);
@@ -412,35 +401,6 @@ class DevToolsOverlay extends Overlay
} }
} }
private void renderInventory(Graphics2D graphics)
{
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
if (inventoryWidget == null || inventoryWidget.isHidden())
{
return;
}
for (WidgetItem item : inventoryWidget.getWidgetItems())
{
Rectangle slotBounds = item.getCanvasBounds();
String idText = "" + item.getId();
FontMetrics fm = graphics.getFontMetrics();
Rectangle2D textBounds = fm.getStringBounds(idText, graphics);
int textX = (int) (slotBounds.getX() + (slotBounds.getWidth() / 2) - (textBounds.getWidth() / 2));
int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (textBounds.getHeight() / 2));
graphics.setColor(new Color(255, 255, 255, 65));
graphics.fill(slotBounds);
graphics.setColor(Color.BLACK);
graphics.drawString(idText, textX + 1, textY + 1);
graphics.setColor(YELLOW);
graphics.drawString(idText, textX, textY);
}
}
private void renderProjectiles(Graphics2D graphics) private void renderProjectiles(Graphics2D graphics)
{ {
for (Projectile projectile : client.getProjectiles()) for (Projectile projectile : client.getProjectiles())

View File

@@ -107,7 +107,6 @@ class DevToolsPanel extends PluginPanel
container.add(plugin.getWalls()); container.add(plugin.getWalls());
container.add(plugin.getDecorations()); container.add(plugin.getDecorations());
container.add(plugin.getInventory());
container.add(plugin.getProjectiles()); container.add(plugin.getProjectiles());
container.add(plugin.getLocation()); container.add(plugin.getLocation());

View File

@@ -125,7 +125,6 @@ public class DevToolsPlugin extends Plugin
private DevToolsButton graphicsObjects; private DevToolsButton graphicsObjects;
private DevToolsButton walls; private DevToolsButton walls;
private DevToolsButton decorations; private DevToolsButton decorations;
private DevToolsButton inventory;
private DevToolsButton projectiles; private DevToolsButton projectiles;
private DevToolsButton location; private DevToolsButton location;
private DevToolsButton chunkBorders; private DevToolsButton chunkBorders;
@@ -168,7 +167,6 @@ public class DevToolsPlugin extends Plugin
walls = new DevToolsButton("Walls"); walls = new DevToolsButton("Walls");
decorations = new DevToolsButton("Decorations"); decorations = new DevToolsButton("Decorations");
inventory = new DevToolsButton("Inventory");
projectiles = new DevToolsButton("Projectiles"); projectiles = new DevToolsButton("Projectiles");
location = new DevToolsButton("Location"); location = new DevToolsButton("Location");

View File

@@ -25,6 +25,7 @@
package net.runelite.client.plugins.devtools; package net.runelite.client.plugins.devtools;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.inject.Inject; import com.google.inject.Inject;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@@ -32,6 +33,7 @@ import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentListener;
import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -45,6 +47,7 @@ import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.CompoundBorder; import javax.swing.border.CompoundBorder;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.IndexDataBase; import net.runelite.api.IndexDataBase;
import net.runelite.api.VarClientInt; import net.runelite.api.VarClientInt;
@@ -62,6 +65,7 @@ import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.DynamicGridLayout; import net.runelite.client.ui.DynamicGridLayout;
import net.runelite.client.ui.FontManager; import net.runelite.client.ui.FontManager;
@Slf4j
class VarInspector extends DevToolsFrame class VarInspector extends DevToolsFrame
{ {
@Getter @Getter
@@ -84,6 +88,26 @@ class VarInspector extends DevToolsFrame
private final static int MAX_LOG_ENTRIES = 10_000; private final static int MAX_LOG_ENTRIES = 10_000;
private static final int VARBITS_ARCHIVE_ID = 14; private static final int VARBITS_ARCHIVE_ID = 14;
private static final Map<Integer, String> VARBIT_NAMES;
static
{
ImmutableMap.Builder<Integer, String> builder = new ImmutableMap.Builder<>();
try
{
for (Field f : Varbits.class.getDeclaredFields())
{
builder.put(f.getInt(null), f.getName());
}
}
catch (IllegalAccessException ex)
{
log.error("error setting up varbit names", ex);
}
VARBIT_NAMES = builder.build();
}
private final Client client; private final Client client;
private final ClientThread clientThread; private final ClientThread clientThread;
@@ -218,15 +242,7 @@ class VarInspector extends DevToolsFrame
// Example: 4101 collides with 4104-4129 // Example: 4101 collides with 4104-4129
client.setVarbitValue(oldVarps2, i, neew); client.setVarbitValue(oldVarps2, i, neew);
String name = Integer.toString(i); final String name = VARBIT_NAMES.getOrDefault(i, Integer.toString(i));
for (Varbits varbit : Varbits.values())
{
if (varbit.getId() == i)
{
name = String.format("%s(%d)", varbit.name(), i);
break;
}
}
addVarLog(VarType.VARBIT, name, old, neew); addVarLog(VarType.VARBIT, name, old, neew);
} }
} }

View File

@@ -27,10 +27,11 @@ package net.runelite.client.plugins.driftnet;
import java.util.Set; import java.util.Set;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import net.runelite.api.GameObject; import net.runelite.api.GameObject;
import net.runelite.api.Varbits; import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
@Data @Data
@@ -38,8 +39,10 @@ import net.runelite.api.coords.WorldPoint;
class DriftNet class DriftNet
{ {
private final int objectId; private final int objectId;
private final Varbits statusVarbit; @Getter(onMethod_ = {@Varbit})
private final Varbits countVarbit; private final int statusVarbit;
@Getter(onMethod_ = {@Varbit})
private final int countVarbit;
private final Set<WorldPoint> adjacentTiles; private final Set<WorldPoint> adjacentTiles;
private GameObject net; private GameObject net;

View File

@@ -198,8 +198,8 @@ public class DriftNetPlugin extends Plugin
for (DriftNet net : NETS) for (DriftNet net : NETS)
{ {
DriftNetStatus status = DriftNetStatus.of(client.getVar(net.getStatusVarbit())); DriftNetStatus status = DriftNetStatus.of(client.getVarbitValue(net.getStatusVarbit()));
int count = client.getVar(net.getCountVarbit()); int count = client.getVarbitValue(net.getCountVarbit());
net.setStatus(status); net.setStatus(status);
net.setCount(count); net.setCount(count);

View File

@@ -40,7 +40,6 @@ import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID; 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.SEED_VAULT_ITEM_CONTAINER;
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import net.runelite.api.widgets.WidgetItem; import net.runelite.api.widgets.WidgetItem;
@@ -126,7 +125,7 @@ public class ExaminePlugin extends Plugin
break; break;
case CC_OP_LOW_PRIORITY: case CC_OP_LOW_PRIORITY:
{ {
type = ExamineType.ITEM_BANK_EQ; type = ExamineType.IF3_ITEM;
int[] qi = findItemFromWidget(event.getParam1(), event.getParam0()); int[] qi = findItemFromWidget(event.getParam1(), event.getParam0());
if (qi == null) if (qi == null)
{ {
@@ -173,7 +172,7 @@ public class ExaminePlugin extends Plugin
type = ExamineType.NPC; type = ExamineType.NPC;
break; break;
case GAMEMESSAGE: case GAMEMESSAGE:
type = ExamineType.ITEM_BANK_EQ; type = ExamineType.IF3_ITEM;
break; break;
default: default:
return; return;
@@ -197,7 +196,7 @@ public class ExaminePlugin extends Plugin
log.debug("Got examine for {} {}: {}", pendingExamine.getType(), pendingExamine.getId(), event.getMessage()); log.debug("Got examine for {} {}: {}", pendingExamine.getType(), pendingExamine.getId(), event.getMessage());
// If it is an item, show the price of it // If it is an item, show the price of it
if (pendingExamine.getType() == ExamineType.ITEM || pendingExamine.getType() == ExamineType.ITEM_BANK_EQ) if (pendingExamine.getType() == ExamineType.ITEM || pendingExamine.getType() == ExamineType.IF3_ITEM)
{ {
final int itemId = pendingExamine.getId(); final int itemId = pendingExamine.getId();
final int itemQuantity = pendingExamine.getQuantity(); final int itemQuantity = pendingExamine.getQuantity();
@@ -212,12 +211,10 @@ public class ExaminePlugin extends Plugin
} }
} }
private int[] findItemFromWidget(int widgetId, int actionParam) private int[] findItemFromWidget(int widgetId, int childIdx)
{ {
int widgetGroup = TO_GROUP(widgetId); final int widgetGroup = TO_GROUP(widgetId);
int widgetChild = TO_CHILD(widgetId); final Widget widget = client.getWidget(widgetId);
Widget widget = client.getWidget(widgetGroup, widgetChild);
if (widget == null) if (widget == null)
{ {
return null; return null;
@@ -239,42 +236,18 @@ public class ExaminePlugin extends Plugin
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }
} }
else if (WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup
|| WidgetInfo.RUNE_POUCH_ITEM_CONTAINER.getGroupId() == widgetGroup)
{
Widget widgetItem = widget.getChild(actionParam);
if (widgetItem != null)
{
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
}
}
else if (WidgetInfo.BANK_ITEM_CONTAINER.getGroupId() == widgetGroup
|| WidgetInfo.CLUE_SCROLL_REWARD_ITEM_CONTAINER.getGroupId() == widgetGroup
|| WidgetInfo.LOOTING_BAG_CONTAINER.getGroupId() == widgetGroup
|| WidgetID.SEED_VAULT_INVENTORY_GROUP_ID == widgetGroup
|| WidgetID.SEED_BOX_GROUP_ID == widgetGroup
|| WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID == widgetGroup
|| WidgetID.PLAYER_TRADE_INVENTORY_GROUP_ID == widgetGroup
|| WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID == widgetGroup)
{
Widget widgetItem = widget.getChild(actionParam);
if (widgetItem != null)
{
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
}
}
else if (WidgetID.SHOP_GROUP_ID == widgetGroup) else if (WidgetID.SHOP_GROUP_ID == widgetGroup)
{ {
Widget widgetItem = widget.getChild(actionParam); Widget widgetItem = widget.getChild(childIdx);
if (widgetItem != null) if (widgetItem != null)
{ {
return new int[]{1, widgetItem.getItemId()}; return new int[]{1, widgetItem.getItemId()};
} }
} }
else if (WidgetID.SEED_VAULT_GROUP_ID == widgetGroup) else
{ {
Widget widgetItem = client.getWidget(SEED_VAULT_ITEM_CONTAINER).getChild(actionParam); Widget widgetItem = widget.getChild(childIdx);
if (widgetItem != null) if (widgetItem != null && widgetItem.getItemId() > -1)
{ {
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
} }

View File

@@ -24,10 +24,10 @@
*/ */
package net.runelite.client.plugins.examine; package net.runelite.client.plugins.examine;
public enum ExamineType enum ExamineType
{ {
ITEM, ITEM,
ITEM_BANK_EQ, IF3_ITEM,
NPC, NPC,
OBJECT; OBJECT;
} }

View File

@@ -203,7 +203,7 @@ public class XpDropPlugin extends Plugin
else else
{ {
EnumComposition colorEnum = client.getEnum(EnumID.XPDROP_COLORS); EnumComposition colorEnum = client.getEnum(EnumID.XPDROP_COLORS);
int defaultColorId = client.getVar(Varbits.EXPERIENCE_DROP_COLOR); int defaultColorId = client.getVarbitValue(Varbits.EXPERIENCE_DROP_COLOR);
int color = colorEnum.getIntValue(defaultColorId); int color = colorEnum.getIntValue(defaultColorId);
widget.setTextColor(color); widget.setTextColor(color);
} }

View File

@@ -171,8 +171,8 @@ public class FairyRingPlugin extends Plugin
String destination; String destination;
try try
{ {
FairyRings fairyRingDestination = getFairyRingDestination(client.getVar(Varbits.FAIRY_RING_DIAL_ADCB), FairyRings fairyRingDestination = getFairyRingDestination(client.getVarbitValue(Varbits.FAIRY_RING_DIAL_ADCB),
client.getVar(Varbits.FAIRY_RIGH_DIAL_ILJK), client.getVar(Varbits.FAIRY_RING_DIAL_PSRQ)); client.getVarbitValue(Varbits.FAIRY_RIGH_DIAL_ILJK), client.getVarbitValue(Varbits.FAIRY_RING_DIAL_PSRQ));
destination = fairyRingDestination.getDestination(); destination = fairyRingDestination.getDestination();
} }
catch (IllegalArgumentException ex) catch (IllegalArgumentException ex)

View File

@@ -387,7 +387,7 @@ public class FishingPlugin extends Plugin
return; return;
} }
int trawlerContribution = client.getVar(Varbits.FISHING_TRAWLER_ACTIVITY); int trawlerContribution = client.getVarbitValue(Varbits.FISHING_TRAWLER_ACTIVITY);
trawlerContributionWidget.setText("Contribution: " + trawlerContribution); trawlerContributionWidget.setText("Contribution: " + trawlerContribution);
} }

View File

@@ -199,7 +199,7 @@ public class HerbiboarPlugin extends Plugin
{ {
for (TrailToSpot trail : spot.getTrails()) for (TrailToSpot trail : spot.getTrails())
{ {
int value = client.getVar(trail.getVarbit()); int value = client.getVarbitValue(trail.getVarbitId());
if (value == trail.getValue()) if (value == trail.getValue())
{ {
@@ -222,11 +222,11 @@ public class HerbiboarPlugin extends Plugin
} }
} }
finishId = client.getVar(Varbits.HB_FINISH); finishId = client.getVarbitValue(Varbits.HB_FINISH);
// The started varbit doesn't get set until the first spot of the rotation has been searched // The started varbit doesn't get set until the first spot of the rotation has been searched
// so we need to use the current group as an indicator of the rotation being started // so we need to use the current group as an indicator of the rotation being started
started = client.getVar(Varbits.HB_STARTED) > 0 || currentGroup != null; started = client.getVarbitValue(Varbits.HB_STARTED) > 0 || currentGroup != null;
boolean finished = !pathActive && started; boolean finished = !pathActive && started;
if (!wasStarted && started) if (!wasStarted && started)

View File

@@ -27,8 +27,9 @@ package net.runelite.client.plugins.herbiboars;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import java.util.Set; import java.util.Set;
import lombok.Getter;
import lombok.Value; import lombok.Value;
import net.runelite.api.Varbits; import net.runelite.api.annotations.Varbit;
/** /**
* A representation of a trail of footsteps which appears when hunting for the Herbiboar. * A representation of a trail of footsteps which appears when hunting for the Herbiboar.
@@ -42,9 +43,10 @@ class TrailToSpot
* equal to that of {@link TrailToSpot#getValue()}. Once the next object along the trail has been searched, this * equal to that of {@link TrailToSpot#getValue()}. Once the next object along the trail has been searched, this
* Varbit's value will be greater than that of {@link TrailToSpot#getValue()}. * Varbit's value will be greater than that of {@link TrailToSpot#getValue()}.
*/ */
private final Varbits varbit; @Getter(onMethod_ = {@Varbit})
private final int varbitId;
/** /**
* The cutoff reference value to compare against the value of {@link TrailToSpot#getVarbit()} to determine its state * The cutoff reference value to compare against the value of {@link TrailToSpot#getVarbitId()} ()} to determine its state
* along the current trail. * along the current trail.
*/ */
private final int value; private final int value;

View File

@@ -280,6 +280,7 @@ public class HiscorePanel extends PluginPanel
minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS)); minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS));
minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING)); minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING));
minigamePanel.add(makeHiscorePanel(SOUL_WARS_ZEAL)); minigamePanel.add(makeHiscorePanel(SOUL_WARS_ZEAL));
minigamePanel.add(makeHiscorePanel(RIFTS_CLOSED));
minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE)); minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE));
minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER)); minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER));
@@ -605,6 +606,18 @@ public class HiscorePanel extends PluginPanel
} }
break; break;
} }
case RIFTS_CLOSED:
{
Skill riftsClosed = result.getRiftsClosed();
String rank = (riftsClosed.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(riftsClosed.getRank());
content += "<p><span style = 'color:white'>Rifts closed</span></p>";
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
if (riftsClosed.getLevel() > -1)
{
content += "<p><span style = 'color:white'>Rifts:</span> " + QuantityFormatter.formatNumber(riftsClosed.getLevel()) + "</p>";
}
break;
}
case LEAGUE_POINTS: case LEAGUE_POINTS:
{ {
Skill leaguePoints = result.getLeaguePoints(); Skill leaguePoints = result.getLeaguePoints();

View File

@@ -534,7 +534,7 @@ public class IdleNotifierPlugin extends Plugin
{ {
return false; return false;
} }
if (config.getOxygenThreshold() >= client.getVar(Varbits.OXYGEN_LEVEL) * 0.1) if (config.getOxygenThreshold() >= client.getVarbitValue(Varbits.OXYGEN_LEVEL) * 0.1)
{ {
if (!notifyOxygen) if (!notifyOxygen)
{ {
@@ -557,7 +557,7 @@ public class IdleNotifierPlugin extends Plugin
} }
if (client.getRealSkillLevel(Skill.HITPOINTS) > config.getHitpointsThreshold()) if (client.getRealSkillLevel(Skill.HITPOINTS) > config.getHitpointsThreshold())
{ {
if (client.getBoostedSkillLevel(Skill.HITPOINTS) + client.getVar(Varbits.NMZ_ABSORPTION) <= config.getHitpointsThreshold()) if (client.getBoostedSkillLevel(Skill.HITPOINTS) + client.getVarbitValue(Varbits.NMZ_ABSORPTION) <= config.getHitpointsThreshold())
{ {
if (!notifyHitpoints) if (!notifyHitpoints)
{ {

View File

@@ -471,7 +471,7 @@ public class ItemChargePlugin extends Plugin
@Subscribe @Subscribe
private void onVarbitChanged(VarbitChanged event) private void onVarbitChanged(VarbitChanged event)
{ {
int explorerRingCharge = client.getVar(Varbits.EXPLORER_RING_ALCHS); int explorerRingCharge = client.getVarbitValue(Varbits.EXPLORER_RING_ALCHS);
if (lastExplorerRingCharge != explorerRingCharge) if (lastExplorerRingCharge != explorerRingCharge)
{ {
lastExplorerRingCharge = explorerRingCharge; lastExplorerRingCharge = explorerRingCharge;

View File

@@ -157,7 +157,7 @@ public class ItemStatPlugin extends Plugin
if (event.getScriptId() == ScriptID.GE_OFFERS_SETUP_BUILD && config.geStats()) if (event.getScriptId() == ScriptID.GE_OFFERS_SETUP_BUILD && config.geStats())
{ {
int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM); int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM);
if (currentGeItem != -1 && client.getVar(Varbits.GE_OFFER_CREATION_TYPE) == 0) if (currentGeItem != -1 && client.getVarbitValue(Varbits.GE_OFFER_CREATION_TYPE) == 0)
{ {
createItemInformation(currentGeItem); createItemInformation(currentGeItem);
} }
@@ -413,7 +413,7 @@ public class ItemStatPlugin extends Plugin
{ {
if (client.isResized()) if (client.isResized())
{ {
if (client.getVar(Varbits.SIDE_PANELS) == 1) if (client.getVarbitValue(Varbits.SIDE_PANELS) == 1)
{ {
return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_CONTAINER); return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_CONTAINER);
} }

View File

@@ -41,10 +41,10 @@ public class SpicyStew implements Effect
/* /*
* Spice boosts listed in the colour order of [Spicy stew -> Smell] * Spice boosts listed in the colour order of [Spicy stew -> Smell]
*/ */
int redBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_RED_SPICES)); int redBoost = spiceBoostOf(client.getVarbitValue(Varbits.SPICY_STEW_RED_SPICES));
int yellowBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_YELLOW_SPICES)); int yellowBoost = spiceBoostOf(client.getVarbitValue(Varbits.SPICY_STEW_YELLOW_SPICES));
int orangeBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_ORANGE_SPICES)); int orangeBoost = spiceBoostOf(client.getVarbitValue(Varbits.SPICY_STEW_ORANGE_SPICES));
int brownBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_BROWN_SPICES)); int brownBoost = spiceBoostOf(client.getVarbitValue(Varbits.SPICY_STEW_BROWN_SPICES));
List<StatChange> changes = new ArrayList<>(); List<StatChange> changes = new ArrayList<>();

View File

@@ -192,7 +192,7 @@ public class KeyRemappingPlugin extends Plugin
{ {
if (client.getGameState() == GameState.LOGGED_IN) if (client.getGameState() == GameState.LOGGED_IN)
{ {
final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; final boolean isChatboxTransparent = client.isResized() && client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) == 1;
final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND; final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND;
setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor)); setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor));
} }

View File

@@ -110,8 +110,8 @@ public class KingdomPlugin extends Plugin
@Subscribe @Subscribe
public void onVarbitChanged(VarbitChanged event) public void onVarbitChanged(VarbitChanged event)
{ {
final int coffer = client.getVar(Varbits.KINGDOM_COFFER); final int coffer = client.getVarbitValue(Varbits.KINGDOM_COFFER);
final int approval = client.getVar(Varbits.KINGDOM_APPROVAL); final int approval = client.getVarbitValue(Varbits.KINGDOM_APPROVAL);
if (client.getGameState() == GameState.LOGGED_IN if (client.getGameState() == GameState.LOGGED_IN
&& isThroneOfMiscellaniaCompleted() && isThroneOfMiscellaniaCompleted()

View File

@@ -149,6 +149,18 @@ public interface MenuEntrySwapperConfig extends Config
return true; return true;
} }
@ConfigItem(
position = -2,
keyName = "npcLeftClickCustomization",
name = "Customizable left-click",
description = "Allows customization of left-clicks on NPCs",
section = npcSection
)
default boolean npcLeftClickCustomization()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = "swapAdmire", keyName = "swapAdmire",
name = "Admire", name = "Admire",
@@ -838,15 +850,4 @@ public interface MenuEntrySwapperConfig extends Config
{ {
return false; return false;
} }
@ConfigItem(
keyName = "swapDepositPool",
name = "Deposit Pool - Only Runes",
description = "Swap Deposit with Deposit Runes on the Deposit Pool in Guardians of the Rift.",
section = objectSection
)
default boolean swapDepositPool()
{
return false;
}
} }

View File

@@ -54,6 +54,7 @@ import net.runelite.api.KeyCode;
import net.runelite.api.MenuAction; import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry; import net.runelite.api.MenuEntry;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.ObjectComposition; import net.runelite.api.ObjectComposition;
import net.runelite.api.events.ClientTick; import net.runelite.api.events.ClientTick;
import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuEntryAdded;
@@ -99,6 +100,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private static final String SHIFTCLICK_CONFIG_GROUP = "shiftclick"; private static final String SHIFTCLICK_CONFIG_GROUP = "shiftclick";
private static final String ITEM_KEY_PREFIX = "item_"; private static final String ITEM_KEY_PREFIX = "item_";
private static final String OBJECT_KEY_PREFIX = "object_"; private static final String OBJECT_KEY_PREFIX = "object_";
private static final String NPC_KEY_PREFIX = "npc_";
// Shift click // Shift click
private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE_SC = new WidgetMenuOption(CONFIGURE, private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE_SC = new WidgetMenuOption(CONFIGURE,
@@ -141,13 +143,13 @@ public class MenuEntrySwapperPlugin extends Plugin
MenuAction.ITEM_USE MenuAction.ITEM_USE
); );
private static final Set<MenuAction> NPC_MENU_TYPES = ImmutableSet.of( private static final List<MenuAction> NPC_MENU_TYPES = ImmutableList.of(
MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_FIRST_OPTION,
MenuAction.NPC_SECOND_OPTION, MenuAction.NPC_SECOND_OPTION,
MenuAction.NPC_THIRD_OPTION, MenuAction.NPC_THIRD_OPTION,
MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FOURTH_OPTION,
MenuAction.NPC_FIFTH_OPTION, MenuAction.NPC_FIFTH_OPTION
MenuAction.EXAMINE_NPC); );
private static final List<MenuAction> OBJECT_MENU_TYPES = ImmutableList.of( private static final List<MenuAction> OBJECT_MENU_TYPES = ImmutableList.of(
MenuAction.GAME_OBJECT_FIRST_OPTION, MenuAction.GAME_OBJECT_FIRST_OPTION,
@@ -159,7 +161,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private static final Set<String> ESSENCE_MINE_NPCS = ImmutableSet.of( private static final Set<String> ESSENCE_MINE_NPCS = ImmutableSet.of(
"aubury", "aubury",
"sedridor", "archmage sedridor",
"wizard distentor", "wizard distentor",
"wizard cromperty", "wizard cromperty",
"brimstail" "brimstail"
@@ -440,8 +442,6 @@ public class MenuEntrySwapperPlugin extends Plugin
swap("climb", "climb-up", () -> (shiftModifier() ? config.swapStairsShiftClick() : config.swapStairsLeftClick()) == MenuEntrySwapperConfig.StairsMode.CLIMB_UP); swap("climb", "climb-up", () -> (shiftModifier() ? config.swapStairsShiftClick() : config.swapStairsLeftClick()) == MenuEntrySwapperConfig.StairsMode.CLIMB_UP);
swap("climb", "climb-down", () -> (shiftModifier() ? config.swapStairsShiftClick() : config.swapStairsLeftClick()) == MenuEntrySwapperConfig.StairsMode.CLIMB_DOWN); swap("climb", "climb-down", () -> (shiftModifier() ? config.swapStairsShiftClick() : config.swapStairsLeftClick()) == MenuEntrySwapperConfig.StairsMode.CLIMB_DOWN);
swap("deposit", "deposit-runes", config::swapDepositPool);
} }
public Swap swap(String option, String swappedOption, Supplier<Boolean> enabled) public Swap swap(String option, String swappedOption, Supplier<Boolean> enabled)
@@ -543,6 +543,7 @@ public class MenuEntrySwapperPlugin extends Plugin
if (!configuringShiftClick && !configuringLeftClick) if (!configuringShiftClick && !configuringLeftClick)
{ {
configureObjectClick(event); configureObjectClick(event);
configureNpcClick(event);
return; return;
} }
@@ -646,16 +647,9 @@ public class MenuEntrySwapperPlugin extends Plugin
final ObjectComposition composition = client.getObjectDefinition(entry.getIdentifier()); final ObjectComposition composition = client.getObjectDefinition(entry.getIdentifier());
final String[] actions = composition.getActions(); final String[] actions = composition.getActions();
final MenuAction currentAction; final Integer swapConfig = getObjectSwapConfig(composition.getId());
Integer swapConfig = getObjectSwapConfig(composition.getId()); final MenuAction currentAction = swapConfig != null ? OBJECT_MENU_TYPES.get(swapConfig) :
if (swapConfig != null) defaultAction(composition);
{
currentAction = OBJECT_MENU_TYPES.get(swapConfig);
}
else
{
currentAction = defaultAction(composition);
}
for (int actionIdx = 0; actionIdx < OBJECT_MENU_TYPES.size(); ++actionIdx) for (int actionIdx = 0; actionIdx < OBJECT_MENU_TYPES.size(); ++actionIdx)
{ {
@@ -704,6 +698,111 @@ public class MenuEntrySwapperPlugin extends Plugin
} }
} }
private void configureNpcClick(MenuOpened event)
{
if (!shiftModifier() || !config.npcLeftClickCustomization())
{
return;
}
MenuEntry[] entries = event.getMenuEntries();
for (int idx = entries.length - 1; idx >= 0; --idx)
{
final MenuEntry entry = entries[idx];
final MenuAction type = entry.getType();
final int id = entry.getIdentifier();
if (type == MenuAction.EXAMINE_NPC)
{
final NPC npc = client.getCachedNPCs()[id];
final NPCComposition composition = npc.getTransformedComposition();
final String[] actions = composition.getActions();
final Integer swapConfig = getNpcSwapConfig(composition.getId());
final boolean hasAttack = Arrays.stream(composition.getActions()).anyMatch("Attack"::equalsIgnoreCase);
final MenuAction currentAction = swapConfig != null ? NPC_MENU_TYPES.get(swapConfig) :
// Attackable NPCs always have Attack as the first, last (deprioritized), or when hidden, no, option.
// Due to this the default action would be either Attack or the first non-Attack option, based on
// the game settings. Since it may be valid to swap an option up to override Attack, even when Attack
// is left-click, we cannot assume any default currentAction on attackable NPCs.
// Non-attackable NPCS have a predictable default action which we can prevent a swap to if no swap
// config is set, which just avoids showing a Swap option on a 1-op NPC, which looks odd.
(hasAttack ? null : defaultAction(composition));
for (int actionIdx = 0; actionIdx < NPC_MENU_TYPES.size(); ++actionIdx)
{
// Attack can be swapped with the in-game settings, and this becomes very confusing if we try
// to swap Attack and the game also tries to swap it (by deprioritizing), so just use the in-game
// setting.
if (Strings.isNullOrEmpty(actions[actionIdx]) || "Attack".equalsIgnoreCase(actions[actionIdx]))
{
continue;
}
final int menuIdx = actionIdx;
final MenuAction menuAction = NPC_MENU_TYPES.get(actionIdx);
if (currentAction == menuAction)
{
continue;
}
if ("Pickpocket".equals(actions[actionIdx])
|| "Knock-Out".equals(actions[actionIdx])
|| "Lure".equals(actions[actionIdx]))
{
// https://secure.runescape.com/m=news/another-message-about-unofficial-clients?oldschool=1
continue;
}
client.createMenuEntry(idx)
.setOption("Swap " + actions[actionIdx])
.setTarget(entry.getTarget())
.setType(MenuAction.RUNELITE)
.onClick(e ->
{
final String message = new ChatMessageBuilder()
.append("The default left click option for '").append(composition.getName()).append("' ")
.append("has been set to '").append(actions[menuIdx]).append("'.")
.build();
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage(message)
.build());
log.debug("Set npc swap for {} to {}", composition.getId(), menuAction);
setNpcSwapConfig(composition.getId(), menuIdx);
});
}
if (getNpcSwapConfig(composition.getId()) != null)
{
// Reset
client.createMenuEntry(idx)
.setOption("Reset swap")
.setTarget(entry.getTarget())
.setType(MenuAction.RUNELITE)
.onClick(e ->
{
final String message = new ChatMessageBuilder()
.append("The default left click option for '").append(composition.getName()).append("' ")
.append("has been reset.")
.build();
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage(message)
.build());
log.debug("Unset npc swap for {}", composition.getId());
unsetNpcSwapConfig(composition.getId());
});
}
}
}
}
@Subscribe @Subscribe
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
{ {
@@ -860,6 +959,33 @@ public class MenuEntrySwapperPlugin extends Plugin
} }
} }
if (NPC_MENU_TYPES.contains(menuAction))
{
final NPC npc = client.getCachedNPCs()[eventId];
final NPCComposition composition = npc.getTransformedComposition();
Integer customOption = getNpcSwapConfig(composition.getId());
if (customOption != null)
{
MenuAction swapAction = NPC_MENU_TYPES.get(customOption);
if (swapAction == menuAction)
{
// Advance to the top-most op for this NPC. Normally menuEntries.length - 1 is examine, and swapping
// with that works due to it being sorted later, but if other plugins like NPC indicators add additional
// menus before examine that are also >1000, like RUNELITE menus, that would result in the >1000 menus being
// reordered relative to each other.
int i = index;
while (i < menuEntries.length - 1 && NPC_MENU_TYPES.contains(menuEntries[i + 1].getType()))
{
++i;
}
swap(optionIndexes, menuEntries, index, i);
return;
}
}
}
// Built-in swaps // Built-in swaps
Collection<Swap> swaps = this.swaps.get(option); Collection<Swap> swaps = this.swaps.get(option);
for (Swap swap : swaps) for (Swap swap : swaps)
@@ -979,6 +1105,11 @@ public class MenuEntrySwapperPlugin extends Plugin
private void swap(ArrayListMultimap<String, Integer> optionIndexes, MenuEntry[] entries, int index1, int index2) private void swap(ArrayListMultimap<String, Integer> optionIndexes, MenuEntry[] entries, int index1, int index2)
{ {
if (index1 == index2)
{
return;
}
MenuEntry entry1 = entries[index1], MenuEntry entry1 = entries[index1],
entry2 = entries[index2]; entry2 = entries[index2];
@@ -1112,4 +1243,38 @@ public class MenuEntrySwapperPlugin extends Plugin
} }
return null; return null;
} }
private Integer getNpcSwapConfig(int npcId)
{
String config = configManager.getConfiguration(MenuEntrySwapperConfig.GROUP, NPC_KEY_PREFIX + npcId);
if (config == null || config.isEmpty())
{
return null;
}
return Integer.parseInt(config);
}
private void setNpcSwapConfig(int npcId, int index)
{
configManager.setConfiguration(MenuEntrySwapperConfig.GROUP, NPC_KEY_PREFIX + npcId, index);
}
private void unsetNpcSwapConfig(int npcId)
{
configManager.unsetConfiguration(MenuEntrySwapperConfig.GROUP, NPC_KEY_PREFIX + npcId);
}
private static MenuAction defaultAction(NPCComposition composition)
{
String[] actions = composition.getActions();
for (int i = 0; i < NPC_MENU_TYPES.size(); ++i)
{
if (!Strings.isNullOrEmpty(actions[i]) && !actions[i].equalsIgnoreCase("Attack"))
{
return NPC_MENU_TYPES.get(i);
}
}
return null;
}
} }

View File

@@ -490,8 +490,8 @@ public class MotherlodePlugin extends Plugin
private void refreshSackValues() private void refreshSackValues()
{ {
curSackSize = client.getVar(Varbits.SACK_NUMBER); curSackSize = client.getVarbitValue(Varbits.SACK_NUMBER);
boolean sackUpgraded = client.getVar(Varbits.SACK_UPGRADED) == 1; boolean sackUpgraded = client.getVarbitValue(Varbits.SACK_UPGRADED) == 1;
maxSackSize = sackUpgraded ? SACK_LARGE_SIZE : SACK_SIZE; maxSackSize = sackUpgraded ? SACK_LARGE_SIZE : SACK_SIZE;
} }

View File

@@ -85,7 +85,7 @@ class MotherlodeSackOverlay extends OverlayPanel
panelComponent.getChildren().add(LineComponent.builder() panelComponent.getChildren().add(LineComponent.builder()
.left("Pay-dirt in sack:") .left("Pay-dirt in sack:")
.right(String.valueOf(client.getVar(Varbits.SACK_NUMBER))) .right(String.valueOf(client.getVarbitValue(Varbits.SACK_NUMBER)))
.build()); .build());
} }

View File

@@ -24,38 +24,31 @@
*/ */
package net.runelite.client.plugins.mta; package net.runelite.client.plugins.mta;
import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.client.ui.FontManager; import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.WidgetItemOverlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
public class MTAInventoryOverlay extends Overlay class MTAItemOverlay extends WidgetItemOverlay
{ {
private final MTAPlugin plugin; private final MTAPlugin plugin;
@Inject @Inject
public MTAInventoryOverlay(MTAPlugin plugin) public MTAItemOverlay(MTAPlugin plugin)
{ {
this.plugin = plugin; this.plugin = plugin;
setPosition(OverlayPosition.DYNAMIC); showOnInventory();
setLayer(OverlayLayer.ABOVE_WIDGETS);
} }
@Override @Override
public Dimension render(Graphics2D graphics) public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem)
{ {
for (MTARoom room : plugin.getRooms()) for (MTARoom room : plugin.getRooms())
{ {
if (room.inside()) if (room.inside())
{ {
graphics.setFont(FontManager.getRunescapeBoldFont()); room.renderItemOverlay(graphics, itemId, widgetItem);
room.over(graphics);
} }
} }
return null;
} }
} }

View File

@@ -41,7 +41,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor( @PluginDescriptor(
name = "Mage Training Arena", name = "Mage Training Arena",
description = "Show helpful information for the Mage Training Arena minigame", description = "Show helpful information for the Mage Training Arena minigame",
tags = {"mta", "magic", "minigame", "overlay"} tags = {"mta", "magic", "minigame", "overlay"},
enabledByDefault = false
) )
public class MTAPlugin extends Plugin public class MTAPlugin extends Plugin
{ {
@@ -62,7 +63,7 @@ public class MTAPlugin extends Plugin
@Inject @Inject
private MTASceneOverlay sceneOverlay; private MTASceneOverlay sceneOverlay;
@Inject @Inject
private MTAInventoryOverlay inventoryOverlay; private MTAItemOverlay itemOverlay;
@Getter(AccessLevel.PROTECTED) @Getter(AccessLevel.PROTECTED)
private MTARoom[] rooms; private MTARoom[] rooms;
@@ -77,7 +78,7 @@ public class MTAPlugin extends Plugin
public void startUp() public void startUp()
{ {
overlayManager.add(sceneOverlay); overlayManager.add(sceneOverlay);
overlayManager.add(inventoryOverlay); overlayManager.add(itemOverlay);
this.rooms = new MTARoom[]{alchemyRoom, graveyardRoom, telekineticRoom, enchantmentRoom}; this.rooms = new MTARoom[]{alchemyRoom, graveyardRoom, telekineticRoom, enchantmentRoom};
@@ -91,7 +92,7 @@ public class MTAPlugin extends Plugin
public void shutDown() public void shutDown()
{ {
overlayManager.remove(sceneOverlay); overlayManager.remove(sceneOverlay);
overlayManager.remove(inventoryOverlay); overlayManager.remove(itemOverlay);
for (MTARoom room : rooms) for (MTARoom room : rooms)
{ {

View File

@@ -28,6 +28,7 @@ import java.awt.Graphics2D;
import javax.inject.Inject; import javax.inject.Inject;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.widgets.WidgetItem;
public abstract class MTARoom public abstract class MTARoom
{ {
@@ -46,7 +47,7 @@ public abstract class MTARoom
{ {
} }
public void over(Graphics2D graphics2D) public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem)
{ {
} }
} }

View File

@@ -63,7 +63,6 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem; import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -448,28 +447,15 @@ public class AlchemyRoom extends MTARoom
@Override @Override
public void over(Graphics2D graphics) public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem)
{ {
if (!inside() || !config.alchemy() || best == null) assert inside();
if (best == null || best.getId() != itemId || !config.alchemy())
{ {
return; return;
} }
Widget inventory = client.getWidget(WidgetInfo.INVENTORY); drawItem(graphics, widgetItem, Color.GREEN);
if (inventory.isHidden())
{
return;
}
for (WidgetItem item : inventory.getWidgetItems())
{
if (item.getId() != best.getId())
{
continue;
}
drawItem(graphics, item, Color.GREEN);
}
} }
private void drawItem(Graphics2D graphics, WidgetItem item, Color border) private void drawItem(Graphics2D graphics, WidgetItem item, Color border)

View File

@@ -59,6 +59,7 @@ import net.runelite.api.StructID;
import net.runelite.api.VarClientInt; import net.runelite.api.VarClientInt;
import net.runelite.api.VarPlayer; import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.events.AreaSoundEffectPlayed; import net.runelite.api.events.AreaSoundEffectPlayed;
import net.runelite.api.events.BeforeRender; import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.ClientTick; import net.runelite.api.events.ClientTick;
@@ -783,7 +784,8 @@ public class MusicPlugin extends Plugin
@Getter @Getter
private final String name; private final String name;
private final VarPlayer var; private final VarPlayer var;
private final Varbits mutedVar; @Varbit
private final int mutedVarbitId;
private final IntSupplier getter; private final IntSupplier getter;
private final Consumer<Integer> setter; private final Consumer<Integer> setter;
private final IntConsumer volumeChanger; private final IntConsumer volumeChanger;
@@ -797,14 +799,14 @@ public class MusicPlugin extends Plugin
private Slider windowSlider; private Slider windowSlider;
Channel(String name, Channel(String name,
VarPlayer var, Varbits mutedVar, VarPlayer var, @Varbit int mutedVarbitId,
IntSupplier getter, Consumer<Integer> setter, IntSupplier getter, Consumer<Integer> setter,
IntConsumer volumeChanger, int max, IntConsumer volumeChanger, int max,
WidgetInfo sideRoot) WidgetInfo sideRoot)
{ {
this.name = name; this.name = name;
this.var = var; this.var = var;
this.mutedVar = mutedVar; this.mutedVarbitId = mutedVarbitId;
this.getter = getter; this.getter = getter;
this.setter = setter; this.setter = setter;
this.volumeChanger = volumeChanger; this.volumeChanger = volumeChanger;
@@ -824,7 +826,7 @@ public class MusicPlugin extends Plugin
int raw = client.getVar(var); int raw = client.getVar(var);
if (raw == 0) if (raw == 0)
{ {
raw = -client.getVar(mutedVar); raw = -client.getVarbitValue(mutedVarbitId);
} }
value = raw * this.max / 100; value = raw * this.max / 100;

View File

@@ -93,7 +93,7 @@ class NightmareZoneOverlay extends OverlayPanel
renderAbsorptionCounter(); renderAbsorptionCounter();
final int currentPoints = client.getVar(Varbits.NMZ_POINTS); final int currentPoints = client.getVarbitValue(Varbits.NMZ_POINTS);
final int totalPoints = currentPoints + client.getVar(VarPlayer.NMZ_REWARD_POINTS); final int totalPoints = currentPoints + client.getVar(VarPlayer.NMZ_REWARD_POINTS);
panelComponent.getChildren().add(LineComponent.builder() panelComponent.getChildren().add(LineComponent.builder()
@@ -114,7 +114,7 @@ class NightmareZoneOverlay extends OverlayPanel
private void renderAbsorptionCounter() private void renderAbsorptionCounter()
{ {
int absorptionPoints = client.getVar(Varbits.NMZ_ABSORPTION); int absorptionPoints = client.getVarbitValue(Varbits.NMZ_ABSORPTION);
if (absorptionPoints == 0) if (absorptionPoints == 0)
{ {
if (absorptionCounter != null) if (absorptionCounter != null)

View File

@@ -244,7 +244,7 @@ public class NightmareZonePlugin extends Plugin
private void checkAbsorption() private void checkAbsorption()
{ {
int absorptionPoints = client.getVar(Varbits.NMZ_ABSORPTION); int absorptionPoints = client.getVarbitValue(Varbits.NMZ_ABSORPTION);
if (!absorptionNotificationSend) if (!absorptionNotificationSend)
{ {
@@ -266,7 +266,7 @@ public class NightmareZonePlugin extends Plugin
private int calculatePointsPerHour() private int calculatePointsPerHour()
{ {
Instant now = Instant.now(); Instant now = Instant.now();
final int currentPoints = client.getVar(Varbits.NMZ_POINTS); final int currentPoints = client.getVarbitValue(Varbits.NMZ_POINTS);
if (nmzSessionStartTime == null) if (nmzSessionStartTime == null)
{ {

View File

@@ -226,7 +226,7 @@ class OpponentInfoOverlay extends OverlayPanel
*/ */
private boolean hasHpHud(Actor opponent) private boolean hasHpHud(Actor opponent)
{ {
boolean settingEnabled = client.getVar(Varbits.BOSS_HEALTH_OVERLAY) == 0; boolean settingEnabled = client.getVarbitValue(Varbits.BOSS_HEALTH_OVERLAY) == 0;
if (settingEnabled && opponent instanceof NPC) if (settingEnabled && opponent instanceof NPC)
{ {
int opponentId = client.getVar(VarPlayer.HP_HUD_NPC_ID); int opponentId = client.getVar(VarPlayer.HP_HUD_NPC_ID);

View File

@@ -85,7 +85,7 @@ class PyramidPlunderOverlay extends Overlay
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation(); LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
// Highlight convex hulls of urns, chests, and sarcophagus // Highlight convex hulls of urns, chests, and sarcophagus
int currentFloor = client.getVar(Varbits.PYRAMID_PLUNDER_ROOM); int currentFloor = client.getVarbitValue(Varbits.PYRAMID_PLUNDER_ROOM);
for (GameObject object : plugin.getObjectsToHighlight()) for (GameObject object : plugin.getObjectsToHighlight())
{ {
if (config.highlightUrnsFloor() > currentFloor && URN_IDS.contains(object.getId()) if (config.highlightUrnsFloor() > currentFloor && URN_IDS.contains(object.getId())
@@ -127,7 +127,7 @@ class PyramidPlunderOverlay extends Overlay
if (SPEARTRAP_ID == object.getId()) if (SPEARTRAP_ID == object.getId())
{ {
// this varbit is set to 1 when you enter a room and 0 once you get passed the spike traps // this varbit is set to 1 when you enter a room and 0 once you get passed the spike traps
if (client.getVar(Varbits.PYRAMID_PLUNDER_ROOM_LOCATION) != 1) if (client.getVarbitValue(Varbits.PYRAMID_PLUNDER_ROOM_LOCATION) != 1)
{ {
return; return;
} }

View File

@@ -171,7 +171,7 @@ public class PyramidPlunderPlugin extends Plugin
{ {
if (timer == null) if (timer == null)
{ {
int ppTimer = client.getVar(Varbits.PYRAMID_PLUNDER_TIMER); int ppTimer = client.getVarbitValue(Varbits.PYRAMID_PLUNDER_TIMER);
Duration remaining = PYRAMID_PLUNDER_DURATION.minus(ppTimer, RSTimeUnit.GAME_TICKS); Duration remaining = PYRAMID_PLUNDER_DURATION.minus(ppTimer, RSTimeUnit.GAME_TICKS);
timer = new PyramidPlunderTimer(remaining, itemManager.getImage(PHARAOHS_SCEPTRE), this, timer = new PyramidPlunderTimer(remaining, itemManager.getImage(PHARAOHS_SCEPTRE), this,
config, client); config, client);
@@ -217,6 +217,6 @@ public class PyramidPlunderPlugin extends Plugin
{ {
return client.getLocalPlayer() != null return client.getLocalPlayer() != null
&& PYRAMID_PLUNDER_REGION == client.getLocalPlayer().getWorldLocation().getRegionID() && PYRAMID_PLUNDER_REGION == client.getLocalPlayer().getWorldLocation().getRegionID()
&& client.getVar(Varbits.PYRAMID_PLUNDER_TIMER) > 0; && client.getVarbitValue(Varbits.PYRAMID_PLUNDER_TIMER) > 0;
} }
} }

View File

@@ -61,8 +61,8 @@ class PyramidPlunderTimer extends Timer
@Override @Override
public String getTooltip() public String getTooltip()
{ {
int floor = client.getVar(Varbits.PYRAMID_PLUNDER_ROOM); int floor = client.getVarbitValue(Varbits.PYRAMID_PLUNDER_ROOM);
int thievingLevel = client.getVar(Varbits.PYRAMID_PLUNDER_THIEVING_LEVEL); int thievingLevel = client.getVarbitValue(Varbits.PYRAMID_PLUNDER_THIEVING_LEVEL);
return String.format("Time remaining. Floor: %d. Thieving level: %d", floor, thievingLevel); return String.format("Time remaining. Floor: %d. Thieving level: %d", floor, thievingLevel);
} }

View File

@@ -166,7 +166,7 @@ public class QuestListPlugin extends Plugin
private boolean isOnQuestTab() private boolean isOnQuestTab()
{ {
return client.getVar(Varbits.QUEST_TAB) == 0 && client.getVar(VarClientInt.INVENTORY_TAB) == 2; return client.getVarbitValue(Varbits.QUEST_TAB) == 0 && client.getVar(VarClientInt.INVENTORY_TAB) == 2;
} }
private boolean isChatboxOpen() private boolean isChatboxOpen()

View File

@@ -206,7 +206,7 @@ class RaidsOverlay extends OverlayPanel
if (plugin.isInRaidChambers()) if (plugin.isInRaidChambers())
{ {
// If the raid has started // If the raid has started
if (client.getVar(Varbits.RAID_STATE) > 0) if (client.getVarbitValue(Varbits.RAID_STATE) > 0)
{ {
if (client.getPlane() == OLM_PLANE) if (client.getPlane() == OLM_PLANE)
{ {

View File

@@ -264,7 +264,7 @@ public class RaidsPlugin extends Plugin
public void onVarbitChanged(VarbitChanged event) public void onVarbitChanged(VarbitChanged event)
{ {
int tempPartyID = client.getVar(VarPlayer.IN_RAID_PARTY); int tempPartyID = client.getVar(VarPlayer.IN_RAID_PARTY);
boolean tempInRaid = client.getVar(Varbits.IN_RAID) == 1; boolean tempInRaid = client.getVarbitValue(Varbits.IN_RAID) == 1;
// if the player's party state has changed // if the player's party state has changed
if (tempPartyID != raidPartyID) if (tempPartyID != raidPartyID)
@@ -321,8 +321,8 @@ public class RaidsPlugin extends Plugin
if (config.pointsMessage()) if (config.pointsMessage())
{ {
int totalPoints = client.getVar(Varbits.TOTAL_POINTS); int totalPoints = client.getVarbitValue(Varbits.TOTAL_POINTS);
int personalPoints = client.getVar(Varbits.PERSONAL_POINTS); int personalPoints = client.getVarbitValue(Varbits.PERSONAL_POINTS);
double percentage = personalPoints / (totalPoints / 100.0); double percentage = personalPoints / (totalPoints / 100.0);
@@ -425,7 +425,7 @@ public class RaidsPlugin extends Plugin
return; return;
} }
inRaidChambers = client.getVar(Varbits.IN_RAID) == 1; inRaidChambers = client.getVarbitValue(Varbits.IN_RAID) == 1;
if (!inRaidChambers) if (!inRaidChambers)
{ {

View File

@@ -144,7 +144,7 @@ public class RegenMeterPlugin extends Plugin
ticksPerHPRegen /= 2; ticksPerHPRegen /= 2;
} }
if (client.getVar(Varbits.LEAGUE_RELIC_3) == TRAILBLAZER_LEAGUE_FLUID_STRIKES_RELIC) if (client.getVarbitValue(Varbits.LEAGUE_RELIC_3) == TRAILBLAZER_LEAGUE_FLUID_STRIKES_RELIC)
{ {
ticksPerHPRegen /= 4; ticksPerHPRegen /= 4;
} }

View File

@@ -215,7 +215,7 @@ public class RunEnergyPlugin extends Plugin
final int effectiveWeight = Math.max(client.getWeight(), 0); final int effectiveWeight = Math.max(client.getWeight(), 0);
double lossRate = (Math.min(effectiveWeight, 64) / 100.0) + 0.64; double lossRate = (Math.min(effectiveWeight, 64) / 100.0) + 0.64;
if (client.getVar(Varbits.RUN_SLOWED_DEPLETION_ACTIVE) != 0) if (client.getVarbitValue(Varbits.RUN_SLOWED_DEPLETION_ACTIVE) != 0)
{ {
lossRate *= 0.3; // Stamina effect reduces energy depletion to 30% lossRate *= 0.3; // Stamina effect reduces energy depletion to 30%
} }

View File

@@ -33,6 +33,7 @@ import net.runelite.api.Client;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.Point; import net.runelite.api.Point;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.widgets.WidgetItem; import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.RunepouchRune; import net.runelite.client.game.RunepouchRune;
@@ -47,12 +48,10 @@ import net.runelite.client.util.ColorUtil;
public class RunepouchOverlay extends WidgetItemOverlay public class RunepouchOverlay extends WidgetItemOverlay
{ {
private static final Varbits[] AMOUNT_VARBITS = private static final int[] AMOUNT_VARBITS = {
{
Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3 Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3
}; };
private static final Varbits[] RUNE_VARBITS = private static final int[] RUNE_VARBITS = {
{
Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3 Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3
}; };
private static final Dimension IMAGE_SIZE = new Dimension(11, 11); private static final Dimension IMAGE_SIZE = new Dimension(11, 11);
@@ -60,16 +59,15 @@ public class RunepouchOverlay extends WidgetItemOverlay
private final Client client; private final Client client;
private final RunepouchConfig config; private final RunepouchConfig config;
private final TooltipManager tooltipManager; private final TooltipManager tooltipManager;
private final ItemManager itemManager;
@Inject @Inject
private ItemManager itemManager; RunepouchOverlay(Client client, RunepouchConfig config, TooltipManager tooltipManager, ItemManager itemManager)
@Inject
RunepouchOverlay(Client client, RunepouchConfig config, TooltipManager tooltipManager)
{ {
this.tooltipManager = tooltipManager; this.tooltipManager = tooltipManager;
this.client = client; this.client = client;
this.config = config; this.config = config;
this.itemManager = itemManager;
showOnInventory(); showOnInventory();
showOnBank(); showOnBank();
} }
@@ -91,16 +89,15 @@ public class RunepouchOverlay extends WidgetItemOverlay
for (int i = 0; i < AMOUNT_VARBITS.length; i++) for (int i = 0; i < AMOUNT_VARBITS.length; i++)
{ {
Varbits amountVarbit = AMOUNT_VARBITS[i]; @Varbit int amountVarbit = AMOUNT_VARBITS[i];
int amount = client.getVarbitValue(amountVarbit);
int amount = client.getVar(amountVarbit);
if (amount <= 0) if (amount <= 0)
{ {
continue; continue;
} }
Varbits runeVarbit = RUNE_VARBITS[i]; @Varbit int runeVarbit = RUNE_VARBITS[i];
int runeId = client.getVar(runeVarbit); int runeId = client.getVarbitValue(runeVarbit);
RunepouchRune rune = RunepouchRune.getRune(runeId); RunepouchRune rune = RunepouchRune.getRune(runeId);
if (rune == null) if (rune == null)
{ {

View File

@@ -490,14 +490,14 @@ public class ScreenshotPlugin extends Plugin
} }
} }
if (config.screenshotCollectionLogEntries() && chatMessage.startsWith(COLLECTION_LOG_TEXT) && client.getVar(Varbits.COLLECTION_LOG_NOTIFICATION) == 1) if (config.screenshotCollectionLogEntries() && chatMessage.startsWith(COLLECTION_LOG_TEXT) && client.getVarbitValue(Varbits.COLLECTION_LOG_NOTIFICATION) == 1)
{ {
String entry = Text.removeTags(chatMessage).substring(COLLECTION_LOG_TEXT.length()); String entry = Text.removeTags(chatMessage).substring(COLLECTION_LOG_TEXT.length());
String fileName = "Collection log (" + entry + ")"; String fileName = "Collection log (" + entry + ")";
takeScreenshot(fileName, SD_COLLECTION_LOG); takeScreenshot(fileName, SD_COLLECTION_LOG);
} }
if (chatMessage.contains("combat task") && config.screenshotCombatAchievements() && client.getVar(Varbits.COMBAT_ACHIEVEMENTS_POPUP) == 1) if (chatMessage.contains("combat task") && config.screenshotCombatAchievements() && client.getVarbitValue(Varbits.COMBAT_ACHIEVEMENTS_POPUP) == 1)
{ {
String fileName = parseCombatAchievementWidget(chatMessage); String fileName = parseCombatAchievementWidget(chatMessage);
if (!fileName.isEmpty()) if (!fileName.isEmpty())
@@ -663,7 +663,7 @@ public class ScreenshotPlugin extends Plugin
String fileName = "Collection log (" + entry + ")"; String fileName = "Collection log (" + entry + ")";
takeScreenshot(fileName, SD_COLLECTION_LOG); takeScreenshot(fileName, SD_COLLECTION_LOG);
} }
if (topText.equalsIgnoreCase("Combat Task Completed!") && config.screenshotCombatAchievements() && client.getVar(Varbits.COMBAT_ACHIEVEMENTS_POPUP) == 0) if (topText.equalsIgnoreCase("Combat Task Completed!") && config.screenshotCombatAchievements() && client.getVarbitValue(Varbits.COMBAT_ACHIEVEMENTS_POPUP) == 0)
{ {
String entry = Text.removeTags(bottomText).substring("Task Completed: ".length()); String entry = Text.removeTags(bottomText).substring("Task Completed: ".length());
String fileName = "Combat task (" + entry.replaceAll("[:?]", "") + ")"; String fileName = "Combat task (" + entry.replaceAll("[:?]", "") + ")";

View File

@@ -70,7 +70,6 @@ import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.StatChanged; import net.runelite.api.events.StatChanged;
import net.runelite.api.vars.SlayerUnlock;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;

View File

@@ -22,16 +22,17 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.api.vars; package net.runelite.client.plugins.slayer;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.VarPlayer; import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
/** /**
* Unlockables in the slayer interface * Unlockables in the slayer interface
*/ */
public enum SlayerUnlock enum SlayerUnlock
{ {
// Copied from enum 834 in the cache // Copied from enum 834 in the cache
// enum 854 contains if you can disable the unlock // enum 854 contains if you can disable the unlock
@@ -87,17 +88,19 @@ public enum SlayerUnlock
VAMPYRE_EXTEND(49), VAMPYRE_EXTEND(49),
VAMPYRE_UNLOCK(50); VAMPYRE_UNLOCK(50);
private Varbits toggleVarbit; @Varbit
private final int toggleVarbit;
SlayerUnlock(int index) SlayerUnlock(int index)
{ {
this(index, null); assert index == ordinal();
this.toggleVarbit = -1;
} }
SlayerUnlock(int index, Varbits toggleVarbit) SlayerUnlock(int index, @Varbit int varbit)
{ {
assert index == ordinal(); assert index == ordinal();
this.toggleVarbit = toggleVarbit; this.toggleVarbit = varbit;
} }
/** /**
@@ -116,11 +119,11 @@ public enum SlayerUnlock
{ {
if (isOwned(client)) if (isOwned(client))
{ {
if (toggleVarbit == null) if (toggleVarbit == -1)
{ {
return true; return true;
} }
return client.getVar(toggleVarbit) == 0; return client.getVarbitValue(toggleVarbit) == 0;
} }
return false; return false;
} }

View File

@@ -41,8 +41,11 @@ class BarRenderer
private static final Color OVERHEAL_COLOR = new Color(216, 255, 139, 150); private static final Color OVERHEAL_COLOR = new Color(216, 255, 139, 150);
private static final int SKILL_ICON_HEIGHT = 35; private static final int SKILL_ICON_HEIGHT = 35;
private static final int COUNTER_ICON_HEIGHT = 18; private static final int COUNTER_ICON_HEIGHT = 18;
private static final int WIDTH = 20;
private static final int BORDER_SIZE = 1; private static final int BORDER_SIZE = 1;
private static final int MIN_ICON_AND_COUNTER_WIDTH = 16;
static final int DEFAULT_WIDTH = 20;
static final int MIN_WIDTH = 3;
static final int MAX_WIDTH = 40;
private final Supplier<Integer> maxValueSupplier; private final Supplier<Integer> maxValueSupplier;
private final Supplier<Integer> currentValueSupplier; private final Supplier<Integer> currentValueSupplier;
private final Supplier<Integer> healSupplier; private final Supplier<Integer> healSupplier;
@@ -67,42 +70,47 @@ class BarRenderer
* @param y The location on the client where it will draw the bar on the y axis starting on the bottom side. * @param y The location on the client where it will draw the bar on the y axis starting on the bottom side.
* @param height The height of the bar. * @param height The height of the bar.
*/ */
void renderBar(StatusBarsConfig config, Graphics2D graphics, int x, int y, int height) void renderBar(StatusBarsConfig config, Graphics2D graphics, int x, int y, int width, int height)
{ {
final int filledHeight = getBarHeight(maxValue, currentValue, height); final int filledHeight = getBarHeight(maxValue, currentValue, height);
final Color fill = colorSupplier.get(); final Color fill = colorSupplier.get();
refreshSkills(); refreshSkills();
graphics.setColor(BACKGROUND); graphics.setColor(BACKGROUND);
graphics.drawRect(x, y, WIDTH - BORDER_SIZE, height - BORDER_SIZE); graphics.drawRect(x, y, width - BORDER_SIZE, height - BORDER_SIZE);
graphics.fillRect(x, y, WIDTH, height); graphics.fillRect(x, y, width, height);
graphics.setColor(fill); graphics.setColor(fill);
graphics.fillRect(x + BORDER_SIZE, graphics.fillRect(x + BORDER_SIZE,
y + BORDER_SIZE + (height - filledHeight), y + BORDER_SIZE + (height - filledHeight),
WIDTH - BORDER_SIZE * 2, width - BORDER_SIZE * 2,
filledHeight - BORDER_SIZE * 2); filledHeight - BORDER_SIZE * 2);
if (config.enableRestorationBars()) if (config.enableRestorationBars())
{ {
renderRestore(graphics, x, y, height); renderRestore(graphics, x, y, width, height);
} }
if (config.enableSkillIcon() || config.enableCounter()) if (config.enableSkillIcon() || config.enableCounter())
{ {
renderIconsAndCounters(config, graphics, x, y); renderIconsAndCounters(config, graphics, x, y, width);
} }
} }
private void renderIconsAndCounters(StatusBarsConfig config, Graphics2D graphics, int x, int y) private void renderIconsAndCounters(StatusBarsConfig config, Graphics2D graphics, int x, int y, int width)
{ {
// Icons and counters overlap the bar at small widths, so they are not drawn when the bars are too small
if (width < MIN_ICON_AND_COUNTER_WIDTH)
{
return;
}
final boolean skillIconEnabled = config.enableSkillIcon(); final boolean skillIconEnabled = config.enableSkillIcon();
if (skillIconEnabled) if (skillIconEnabled)
{ {
final Image icon = iconSupplier.get(); final Image icon = iconSupplier.get();
final int xDraw = x + (WIDTH / 2) - (icon.getWidth(null) / 2); final int xDraw = x + (width / 2) - (icon.getWidth(null) / 2);
graphics.drawImage(icon, xDraw, y, null); graphics.drawImage(icon, xDraw, y, null);
} }
@@ -111,7 +119,7 @@ class BarRenderer
graphics.setFont(FontManager.getRunescapeSmallFont()); graphics.setFont(FontManager.getRunescapeSmallFont());
final String counterText = Integer.toString(currentValue); final String counterText = Integer.toString(currentValue);
final int widthOfCounter = graphics.getFontMetrics().stringWidth(counterText); final int widthOfCounter = graphics.getFontMetrics().stringWidth(counterText);
final int centerText = (WIDTH / 2) - (widthOfCounter / 2); final int centerText = (width / 2) - (widthOfCounter / 2);
final int yOffset = skillIconEnabled ? SKILL_ICON_HEIGHT : COUNTER_ICON_HEIGHT; final int yOffset = skillIconEnabled ? SKILL_ICON_HEIGHT : COUNTER_ICON_HEIGHT;
final TextComponent textComponent = new TextComponent(); final TextComponent textComponent = new TextComponent();
@@ -121,7 +129,7 @@ class BarRenderer
} }
} }
private void renderRestore(Graphics2D graphics, int x, int y, int height) private void renderRestore(Graphics2D graphics, int x, int y, int width, int height)
{ {
final Color color = healColorSupplier.get(); final Color color = healColorSupplier.get();
final int heal = healSupplier.get(); final int heal = healSupplier.get();
@@ -150,7 +158,7 @@ class BarRenderer
graphics.fillRect(x + BORDER_SIZE, graphics.fillRect(x + BORDER_SIZE,
fillY, fillY,
WIDTH - BORDER_SIZE * 2, width - BORDER_SIZE * 2,
fillHeight); fillHeight);
} }

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.statusbars;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units; import net.runelite.client.config.Units;
import net.runelite.client.plugins.statusbars.config.BarMode; import net.runelite.client.plugins.statusbars.config.BarMode;
@@ -95,4 +96,18 @@ public interface StatusBarsConfig extends Config
{ {
return 0; return 0;
} }
@Range(
min = BarRenderer.MIN_WIDTH,
max = BarRenderer.MAX_WIDTH
)
@ConfigItem(
keyName = "barWidth",
name = "Bar Width",
description = "The width of the status bars in the modern resizeable layout."
)
default int barWidth()
{
return BarRenderer.DEFAULT_WIDTH;
}
} }

View File

@@ -135,7 +135,7 @@ class StatusBarsOverlay extends Overlay
return DISEASE_COLOR; return DISEASE_COLOR;
} }
if (client.getVar(Varbits.PARASITE) >= 1) if (client.getVarbitValue(Varbits.PARASITE) >= 1)
{ {
return PARASITE_COLOR; return PARASITE_COLOR;
} }
@@ -193,7 +193,7 @@ class StatusBarsOverlay extends Overlay
() -> getRestoreValue("Run Energy"), () -> getRestoreValue("Run Energy"),
() -> () ->
{ {
if (client.getVar(Varbits.RUN_SLOWED_DEPLETION_ACTIVE) != 0) if (client.getVarbitValue(Varbits.RUN_SLOWED_DEPLETION_ACTIVE) != 0)
{ {
return RUN_STAMINA_COLOR; return RUN_STAMINA_COLOR;
} }
@@ -245,18 +245,21 @@ class StatusBarsOverlay extends Overlay
final Point offsetLeft = curViewport.getOffsetLeft(); final Point offsetLeft = curViewport.getOffsetLeft();
final Point offsetRight = curViewport.getOffsetRight(); final Point offsetRight = curViewport.getOffsetRight();
final Point location = curWidget.getCanvasLocation(); final Point location = curWidget.getCanvasLocation();
final int height, offsetLeftBarX, offsetLeftBarY, offsetRightBarX, offsetRightBarY; final int width, height, offsetLeftBarX, offsetLeftBarY, offsetRightBarX, offsetRightBarY;
if (curViewport == Viewport.RESIZED_BOTTOM) if (curViewport == Viewport.RESIZED_BOTTOM)
{ {
width = config.barWidth();
height = RESIZED_BOTTOM_HEIGHT; height = RESIZED_BOTTOM_HEIGHT;
offsetLeftBarX = (location.getX() + RESIZED_BOTTOM_OFFSET_X - offsetLeft.getX()); final int barWidthOffset = width - BarRenderer.DEFAULT_WIDTH;
offsetLeftBarX = (location.getX() + RESIZED_BOTTOM_OFFSET_X - offsetLeft.getX() - 2 * barWidthOffset);
offsetLeftBarY = (location.getY() - RESIZED_BOTTOM_OFFSET_Y - offsetLeft.getY()); offsetLeftBarY = (location.getY() - RESIZED_BOTTOM_OFFSET_Y - offsetLeft.getY());
offsetRightBarX = (location.getX() + RESIZED_BOTTOM_OFFSET_X - offsetRight.getX()); offsetRightBarX = (location.getX() + RESIZED_BOTTOM_OFFSET_X - offsetRight.getX() - barWidthOffset);
offsetRightBarY = (location.getY() - RESIZED_BOTTOM_OFFSET_Y - offsetRight.getY()); offsetRightBarY = (location.getY() - RESIZED_BOTTOM_OFFSET_Y - offsetRight.getY());
} }
else else
{ {
width = BarRenderer.DEFAULT_WIDTH;
height = HEIGHT; height = HEIGHT;
offsetLeftBarX = (location.getX() - offsetLeft.getX()); offsetLeftBarX = (location.getX() - offsetLeft.getX());
offsetLeftBarY = (location.getY() - offsetLeft.getY()); offsetLeftBarY = (location.getY() - offsetLeft.getY());
@@ -271,12 +274,12 @@ class StatusBarsOverlay extends Overlay
if (left != null) if (left != null)
{ {
left.renderBar(config, g, offsetLeftBarX, offsetLeftBarY, height); left.renderBar(config, g, offsetLeftBarX, offsetLeftBarY, width, height);
} }
if (right != null) if (right != null)
{ {
right.renderBar(config, g, offsetRightBarX, offsetRightBarY, height); right.renderBar(config, g, offsetRightBarX, offsetRightBarY, width, height);
} }
return null; return null;

View File

@@ -123,7 +123,7 @@ public class StatusBarsPlugin extends Plugin
barsDisplayed = true; barsDisplayed = true;
} }
else if ((interacting instanceof NPC && ArrayUtils.contains(((NPC) interacting).getComposition().getActions(), "Attack")) else if ((interacting instanceof NPC && ArrayUtils.contains(((NPC) interacting).getComposition().getActions(), "Attack"))
|| (interacting instanceof Player && client.getVar(Varbits.PVP_SPEC_ORB) == 1)) || (interacting instanceof Player && client.getVarbitValue(Varbits.PVP_SPEC_ORB) == 1))
{ {
lastCombatActionTickCount = client.getTickCount(); lastCombatActionTickCount = client.getTickCount();
barsDisplayed = true; barsDisplayed = true;

View File

@@ -206,13 +206,13 @@ public class TimersPlugin extends Plugin
@Subscribe @Subscribe
public void onVarbitChanged(VarbitChanged event) public void onVarbitChanged(VarbitChanged event)
{ {
int raidVarb = client.getVar(Varbits.IN_RAID); int raidVarb = client.getVarbitValue(Varbits.IN_RAID);
int vengCooldownVarb = client.getVar(Varbits.VENGEANCE_COOLDOWN); int vengCooldownVarb = client.getVarbitValue(Varbits.VENGEANCE_COOLDOWN);
int isVengeancedVarb = client.getVar(Varbits.VENGEANCE_ACTIVE); int isVengeancedVarb = client.getVarbitValue(Varbits.VENGEANCE_ACTIVE);
int poisonVarp = client.getVar(VarPlayer.POISON); int poisonVarp = client.getVar(VarPlayer.POISON);
int pvpVarb = client.getVar(Varbits.PVP_SPEC_ORB); int pvpVarb = client.getVarbitValue(Varbits.PVP_SPEC_ORB);
int corruptionCooldownVarb = client.getVar(Varbits.CORRUPTION_COOLDOWN); int corruptionCooldownVarb = client.getVarbitValue(Varbits.CORRUPTION_COOLDOWN);
int imbuedHeartCooldownVarb = client.getVar(Varbits.IMBUED_HEART_COOLDOWN); int imbuedHeartCooldownVarb = client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN);
if (lastRaidVarb != raidVarb) if (lastRaidVarb != raidVarb)
{ {
@@ -576,7 +576,7 @@ public class TimersPlugin extends Plugin
if (config.showOverload() && message.startsWith("You drink some of your") && message.contains("overload")) if (config.showOverload() && message.startsWith("You drink some of your") && message.contains("overload"))
{ {
if (client.getVar(Varbits.IN_RAID) == 1) if (client.getVarbitValue(Varbits.IN_RAID) == 1)
{ {
createGameTimer(OVERLOAD_RAID); createGameTimer(OVERLOAD_RAID);
} }

View File

@@ -128,7 +128,7 @@ public class TimestampPlugin extends Plugin
private Color getTimestampColour() private Color getTimestampColour()
{ {
boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; boolean isChatboxTransparent = client.isResized() && client.getVarbitValue(Varbits.TRANSPARENT_CHATBOX) == 1;
return isChatboxTransparent ? config.transparentTimestamp() : config.opaqueTimestamp(); return isChatboxTransparent ? config.transparentTimestamp() : config.opaqueTimestamp();
} }

View File

@@ -22,12 +22,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.api.vars; package net.runelite.client.plugins.timetracking.farming;
/** /**
* An enumeration of possible autoweed settings. * An enumeration of possible autoweed settings.
*/ */
public enum Autoweed enum Autoweed
{ {
/** /**
* Access to autoweed has not been unlocked. * Access to autoweed has not been unlocked.

View File

@@ -28,7 +28,7 @@ import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import net.runelite.api.Varbits; import net.runelite.api.annotations.Varbit;
import net.runelite.client.plugins.timetracking.TimeTrackingConfig; import net.runelite.client.plugins.timetracking.TimeTrackingConfig;
@RequiredArgsConstructor( @RequiredArgsConstructor(
@@ -40,16 +40,17 @@ class FarmingPatch
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
private FarmingRegion region; private FarmingRegion region;
private final String name; private final String name;
private final Varbits varbit; @Getter(onMethod_ = {@Varbit})
private final int varbit;
private final PatchImplementation implementation; private final PatchImplementation implementation;
String configKey() String configKey()
{ {
return region.getRegionID() + "." + varbit.getId(); return region.getRegionID() + "." + varbit;
} }
String notifyConfigKey() String notifyConfigKey()
{ {
return TimeTrackingConfig.NOTIFY + "." + region.getRegionID() + "." + varbit.getId(); return TimeTrackingConfig.NOTIFY + "." + region.getRegionID() + "." + varbit;
} }
} }

View File

@@ -25,7 +25,6 @@
package net.runelite.client.plugins.timetracking.farming; package net.runelite.client.plugins.timetracking.farming;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
@Getter @Getter
@@ -35,7 +34,6 @@ public class FarmingRegion
private final int regionID; private final int regionID;
private final boolean definite; private final boolean definite;
private final FarmingPatch[] patches; private final FarmingPatch[] patches;
private final Varbits[] varbits;
FarmingRegion(String name, int regionID, boolean definite, FarmingPatch... patches) FarmingRegion(String name, int regionID, boolean definite, FarmingPatch... patches)
{ {
@@ -43,12 +41,9 @@ public class FarmingRegion
this.regionID = regionID; this.regionID = regionID;
this.definite = definite; this.definite = definite;
this.patches = patches; this.patches = patches;
this.varbits = new Varbits[patches.length]; for (FarmingPatch p : patches)
for (int i = 0; i < patches.length; i++)
{ {
FarmingPatch p = patches[i];
p.setRegion(this); p.setRegion(this);
varbits[i] = p.getVarbit();
} }
} }

View File

@@ -42,7 +42,6 @@ import net.runelite.api.GameState;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.WidgetNode; import net.runelite.api.WidgetNode;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.vars.Autoweed;
import net.runelite.api.widgets.WidgetModalMode; import net.runelite.api.widgets.WidgetModalMode;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
@@ -111,7 +110,7 @@ public class FarmingTracker
} }
{ {
String autoweed = Integer.toString(client.getVar(Varbits.AUTOWEED)); String autoweed = Integer.toString(client.getVarbitValue(Varbits.AUTOWEED));
if (!autoweed.equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED))) if (!autoweed.equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED)))
{ {
configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED, autoweed); configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED, autoweed);
@@ -120,7 +119,7 @@ public class FarmingTracker
} }
{ {
boolean botanist = client.getVar(Varbits.LEAGUE_RELIC_5) == 1; boolean botanist = client.getVarbitValue(Varbits.LEAGUE_RELIC_5) == 1;
if (!Boolean.valueOf(botanist).equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, Boolean.class))) if (!Boolean.valueOf(botanist).equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, Boolean.class)))
{ {
configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, botanist); configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, botanist);
@@ -144,9 +143,9 @@ public class FarmingTracker
for (FarmingPatch patch : region.getPatches()) for (FarmingPatch patch : region.getPatches())
{ {
// Write the config value if it doesn't match what is current, or it is more than 5 minutes old // Write the config value if it doesn't match what is current, or it is more than 5 minutes old
Varbits varbit = patch.getVarbit(); int varbit = patch.getVarbit();
String key = patch.configKey(); String key = patch.configKey();
String strVarbit = Integer.toString(client.getVar(varbit)); String strVarbit = Integer.toString(client.getVarbitValue(varbit));
String storedValue = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key); String storedValue = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key);
if (storedValue != null) if (storedValue != null)
@@ -173,7 +172,7 @@ public class FarmingTracker
else if (!newRegionLoaded && timeSinceModalClose > 1) else if (!newRegionLoaded && timeSinceModalClose > 1)
{ {
PatchState previousPatchState = patch.getImplementation().forVarbitValue(Integer.parseInt(parts[0])); PatchState previousPatchState = patch.getImplementation().forVarbitValue(Integer.parseInt(parts[0]));
PatchState currentPatchState = patch.getImplementation().forVarbitValue(client.getVar(varbit)); PatchState currentPatchState = patch.getImplementation().forVarbitValue(client.getVarbitValue(varbit));
if (previousPatchState == null || currentPatchState == null) if (previousPatchState == null || currentPatchState == null)
{ {

View File

@@ -131,7 +131,7 @@ public class WikiPlugin extends Plugin
children[0] = null; children[0] = null;
Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER); Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER);
if (vanilla != null && client.getVar(Varbits.WIKI_ENTITY_LOOKUP) == 0) if (vanilla != null && client.getVarbitValue(Varbits.WIKI_ENTITY_LOOKUP) == 0)
{ {
vanilla.setHidden(false); vanilla.setHidden(false);
} }
@@ -157,7 +157,7 @@ public class WikiPlugin extends Plugin
return; return;
} }
if (client.getVar(Varbits.WIKI_ENTITY_LOOKUP) == 1) // disabled if (client.getVarbitValue(Varbits.WIKI_ENTITY_LOOKUP) == 1) // disabled
{ {
// when the wiki entity lookup option is disabled the banner parent layer, // when the wiki entity lookup option is disabled the banner parent layer,
// which is used for var transmit events, is not positioned. This is copied // which is used for var transmit events, is not positioned. This is copied

View File

@@ -194,7 +194,7 @@ public class WintertodtPlugin extends Plugin
@Subscribe @Subscribe
public void onVarbitChanged(VarbitChanged varbitChanged) public void onVarbitChanged(VarbitChanged varbitChanged)
{ {
int timerValue = client.getVar(Varbits.WINTERTODT_TIMER); int timerValue = client.getVarbitValue(Varbits.WINTERTODT_TIMER);
if (timerValue != previousTimerValue) if (timerValue != previousTimerValue)
{ {
int timeToNotify = config.roundNotification(); int timeToNotify = config.roundNotification();

View File

@@ -335,8 +335,8 @@ public class WorldHopperPlugin extends Plugin
int old1 = favoriteWorld1; int old1 = favoriteWorld1;
int old2 = favoriteWorld2; int old2 = favoriteWorld2;
favoriteWorld1 = client.getVar(Varbits.WORLDHOPPER_FAVROITE_1); favoriteWorld1 = client.getVarbitValue(Varbits.WORLDHOPPER_FAVROITE_1);
favoriteWorld2 = client.getVar(Varbits.WORLDHOPPER_FAVROITE_2); favoriteWorld2 = client.getVarbitValue(Varbits.WORLDHOPPER_FAVROITE_2);
if (old1 != favoriteWorld1 || old2 != favoriteWorld2) if (old1 != favoriteWorld1 || old2 != favoriteWorld2)
{ {

View File

@@ -45,15 +45,15 @@ enum XpWorldType
@Override @Override
int modifier(Client client) int modifier(Client client)
{ {
if (client.getVar(Varbits.LEAGUE_RELIC_6) != 0) if (client.getVarbitValue(Varbits.LEAGUE_RELIC_6) != 0)
{ {
return 16; return 16;
} }
if (client.getVar(Varbits.LEAGUE_RELIC_4) != 0) if (client.getVarbitValue(Varbits.LEAGUE_RELIC_4) != 0)
{ {
return 12; return 12;
} }
if (client.getVar(Varbits.LEAGUE_RELIC_2) != 0) if (client.getVarbitValue(Varbits.LEAGUE_RELIC_2) != 0)
{ {
return 8; return 8;
} }

View File

@@ -24,6 +24,7 @@
*/ */
package net.runelite.client.ui.overlay; package net.runelite.client.ui.overlay;
import com.google.common.base.Preconditions;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
@@ -83,11 +84,47 @@ public abstract class Overlay implements LayoutableRenderableEntity
return this.getClass().getSimpleName(); return this.getClass().getSimpleName();
} }
/**
* Configure to draw this overlay after the given interface is drawn. Except
* in rare circumstances, you probably also want to {@link #setLayer(OverlayLayer)} to
* {@link OverlayLayer#MANUAL} to avoid the overlay being drawn a 2nd time during the
* default {@link OverlayLayer#UNDER_WIDGETS} pass.
* @param interfaceId The interface id
* @see net.runelite.api.widgets.WidgetID
*/
protected void drawAfterInterface(int interfaceId) protected void drawAfterInterface(int interfaceId)
{ {
drawHooks.add(interfaceId << 16 | 0xffff); drawHooks.add(interfaceId << 16 | 0xffff);
} }
/**
* Configure to draw this overlay after the given layer is drawn. Except
* in rare circumstances, you probably also want to {@link #setLayer(OverlayLayer)} to
* {@link OverlayLayer#MANUAL} to avoid the overlay being drawn a 2nd time during the
* default {@link OverlayLayer#UNDER_WIDGETS} pass.
*
* The layer must be a widget of {@link net.runelite.api.widgets.WidgetType} {@link net.runelite.api.widgets.WidgetType#LAYER}
* @param groupId The widget group id
* @param childId The widget child id
* @see net.runelite.api.widgets.WidgetID
*/
protected void drawAfterLayer(int groupId, int childId)
{
Preconditions.checkArgument(groupId >= 0 && groupId <= 0xffff, "groupId outside of valid range");
Preconditions.checkArgument(childId >= 0 && childId <= 0xffff, "childId outside of valid range");
drawHooks.add(groupId << 16 | childId);
}
/**
* Configure to draw this overlay after the given layer is drawn. Except
* in rare circumstances, you probably also want to {@link #setLayer(OverlayLayer)} to
* {@link OverlayLayer#MANUAL} to avoid the overlay being drawn a 2nd time during the
* default {@link OverlayLayer#UNDER_WIDGETS} pass.
*
* The layer must be a widget of {@link net.runelite.api.widgets.WidgetType} {@link net.runelite.api.widgets.WidgetType#LAYER}
* @param layer The layer
* @see WidgetInfo
*/
protected void drawAfterLayer(WidgetInfo layer) protected void drawAfterLayer(WidgetInfo layer)
{ {
drawHooks.add(layer.getId()); drawHooks.add(layer.getId());

View File

@@ -886,7 +886,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
{ {
if (client.isResized()) if (client.isResized())
{ {
if (client.getVar(Varbits.SIDE_PANELS) == 1) if (client.getVarbitValue(Varbits.SIDE_PANELS) == 1)
{ {
return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE); return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE);
} }

View File

@@ -209,8 +209,8 @@ public class WidgetOverlay extends Overlay
{ {
// The xptracker component layer isn't hidden if the counter and process bar are both configured "Off", // The xptracker component layer isn't hidden if the counter and process bar are both configured "Off",
// it just has its children hidden. // it just has its children hidden.
if (client.getVar(Varbits.EXPERIENCE_TRACKER_COUNTER) == 30 // Off if (client.getVarbitValue(Varbits.EXPERIENCE_TRACKER_COUNTER) == 30 // Off
&& client.getVar(Varbits.EXPERIENCE_TRACKER_PROGRESS_BAR) == 0) // Off && client.getVarbitValue(Varbits.EXPERIENCE_TRACKER_PROGRESS_BAR) == 0) // Off
{ {
return null; return null;
} }
@@ -234,7 +234,7 @@ public class WidgetOverlay extends Overlay
} }
OverlayPosition position; OverlayPosition position;
switch (client.getVar(Varbits.EXPERIENCE_TRACKER_POSITION)) switch (client.getVarbitValue(Varbits.EXPERIENCE_TRACKER_POSITION))
{ {
case 0: case 0:
default: default:
@@ -269,7 +269,7 @@ public class WidgetOverlay extends Overlay
public Dimension render(Graphics2D graphics) public Dimension render(Graphics2D graphics)
{ {
// Don't draw widget overlay if the PVP KDR stats text will be empty // Don't draw widget overlay if the PVP KDR stats text will be empty
if (client.getVar(Varbits.SHOW_PVP_KDR_STATS) == 1) if (client.getVarbitValue(Varbits.SHOW_PVP_KDR_STATS) == 1)
{ {
return super.render(graphics); return super.render(graphics);
} }

Some files were not shown because too many files have changed in this diff Show More