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

@@ -62,15 +62,18 @@ public class ClientSessionManager
public void start()
{
try
executorService.execute(() ->
{
sessionId = sessionClient.open();
log.debug("Opened session {}", sessionId);
}
catch (IOException ex)
{
log.warn("error opening session", ex);
}
try
{
sessionId = sessionClient.open();
log.debug("Opened session {}", sessionId);
}
catch (IOException ex)
{
log.warn("error opening session", ex);
}
});
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 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 channelColor = null;
@@ -217,7 +217,7 @@ public class ChatMessageManager
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();
if (usernameColor == null)
{
@@ -842,7 +842,7 @@ public class ChatMessageManager
@VisibleForTesting
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 Collection<ChatColor> chatColors = colorCache.get(type);
for (ChatColor chatColor : chatColors)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -70,7 +70,7 @@ class BarrowsBrotherSlainOverlay extends OverlayPanel
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";
panelComponent.getChildren().add(LineComponent.builder()
.left(brother.getName())
@@ -109,12 +109,12 @@ class BarrowsBrotherSlainOverlay extends OverlayPanel
private int rewardPotential()
{
// this is from [proc,barrows_overlay_reward]
int brothers = client.getVar(Varbits.BARROWS_KILLED_AHRIM)
+ client.getVar(Varbits.BARROWS_KILLED_DHAROK)
+ client.getVar(Varbits.BARROWS_KILLED_GUTHAN)
+ client.getVar(Varbits.BARROWS_KILLED_KARIL)
+ client.getVar(Varbits.BARROWS_KILLED_TORAG)
+ client.getVar(Varbits.BARROWS_KILLED_VERAC);
return client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) + brothers * 2;
int brothers = client.getVarbitValue(Varbits.BARROWS_KILLED_AHRIM)
+ client.getVarbitValue(Varbits.BARROWS_KILLED_DHAROK)
+ client.getVarbitValue(Varbits.BARROWS_KILLED_GUTHAN)
+ client.getVarbitValue(Varbits.BARROWS_KILLED_KARIL)
+ client.getVarbitValue(Varbits.BARROWS_KILLED_TORAG)
+ client.getVarbitValue(Varbits.BARROWS_KILLED_VERAC);
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.RequiredArgsConstructor;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.WorldPoint;
@RequiredArgsConstructor
@@ -42,5 +43,6 @@ enum BarrowsBrothers
private final String name;
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.drawString(brotherLetter, miniMapLocation.getX() + 1, miniMapLocation.getY() + 1);
if (client.getVar(brother.getKilledVarbit()) > 0)
if (client.getVarbitValue(brother.getKilledVarbit()) > 0)
{
graphics.setColor(config.deadBrotherLocColor());
}

View File

@@ -24,13 +24,15 @@
*/
package net.runelite.client.plugins.blastfurnace;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.api.ItemID;
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),
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),
GOLD_BAR(Varbits.BLAST_FURNACE_GOLD_BAR, ItemID.GOLD_BAR);
private static final Map<Varbits, BarsOres> 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
@Getter(onMethod_ = {@Varbit})
private final int varbit;
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
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)
{

View File

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

View File

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

View File

@@ -73,11 +73,11 @@ class BlastMineOreCountOverlay extends OverlayPanel
if (config.showOreOverlay())
{
blastMineWidget.setHidden(true);
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVar(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.MITHRIL_ORE, client.getVar(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.RUNITE_ORE, client.getVar(Varbits.BLAST_MINE_RUNITE))));
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVarbitValue(Varbits.BLAST_MINE_COAL))));
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.getVarbitValue(Varbits.BLAST_MINE_MITHRIL))));
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.getVarbitValue(Varbits.BLAST_MINE_RUNITE))));
}
else
{

View File

@@ -406,7 +406,7 @@ public class ChatChannelPlugin extends Plugin
int rankIcon = -1;
// 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);
channelColor = MoreObjects.firstNonNull(chatColorConfig.transparentFriendsChatChannelName(), CHAT_FC_NAME_TRANSPARENT_BACKGROUND);
@@ -462,7 +462,7 @@ public class ChatChannelPlugin extends Plugin
final Color textColor;
// 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(
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
{
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_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]+)?)");
@@ -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_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_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]+)?))" +
"(?:<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>\\.");
@@ -156,6 +156,7 @@ public class ChatCommandsPlugin extends Plugin
private String lastBossKill;
private int lastBossTime = -1;
private double lastPb = -1;
private String lastTeamSize;
private int modIconIdx = -1;
@Inject
@@ -394,8 +395,30 @@ public class ChatCommandsPlugin extends Plugin
if (lastPb > -1)
{
log.debug("Got out-of-order personal best for {}: {}", renamedBoss, lastPb);
setPb(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);
}
if (lastTeamSize != null)
{
log.debug("Setting team size pb: {}", lastTeamSize);
setPb(renamedBoss + " " + lastTeamSize, lastPb);
}
lastPb = -1;
lastTeamSize = null;
}
else
{
@@ -554,16 +577,26 @@ public class ChatCommandsPlugin extends Plugin
double seconds = timeStringToSeconds(matcher.group("pb"));
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
log.debug("Got personal best for {}: {}", lastBossKill, seconds);
setPb(lastBossKill, seconds);
lastPb = -1;
lastTeamSize = null;
}
else
{
// Some bosses send the pb message, and then the kill message!
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);
if (matcher.find())
{
double s = timeStringToSeconds(matcher.group(1));
double s = timeStringToSeconds(matcher.group("time"));
pb = Math.min(pb, s);
}
}
@@ -1128,7 +1161,7 @@ public class ChatCommandsPlugin extends Plugin
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();
executor.execute(() ->
@@ -1919,15 +1952,57 @@ public class ChatCommandsPlugin extends Plugin
case "herbi":
return "Herbiboar";
// cox
// Chambers of Xeric
case "cox":
case "xeric":
case "chambers":
case "olm":
case "raids":
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 "xeric cm":
case "chambers cm":
@@ -1935,15 +2010,70 @@ public class ChatCommandsPlugin extends Plugin
case "raids cm":
case "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 "theatre":
case "verzik":
case "verzik vitur":
case "raids 2":
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 "tob sm":
case "tob story mode":
@@ -1954,6 +2084,7 @@ public class ChatCommandsPlugin extends Plugin
case "tob entry":
return "Theatre of Blood Entry Mode";
// Theatre of Blood Hard Mode
case "theatre of blood: hard mode":
case "tob cm":
case "tob hm":
@@ -1961,6 +2092,18 @@ public class ChatCommandsPlugin extends Plugin
case "tob hard":
case "hmt":
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
case "gaunt":
@@ -2256,4 +2399,13 @@ public class ChatCommandsPlugin extends Plugin
}
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()
&& ((clue.getHasFirePit() == null || client.getVar(clue.getHasFirePit()) != 1)
&& ((clue.getFirePitVarbitId() == -1 || client.getVarbitValue(clue.getFirePitVarbitId()) != 1)
&& (inventoryItems == null || !HAS_LIGHT.fulfilledBy(inventoryItems))
&& (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_FILL_COLOR = new Color(0, 255, 0, 20);
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
};
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
};
@@ -431,13 +431,13 @@ public class ClueScrollPlugin extends Plugin
List<Item> items = new ArrayList<>(RUNEPOUCH_AMOUNT_VARBITS.length);
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)
{
continue;
}
int varbId = client.getVar(RUNEPOUCH_RUNE_VARBITS[i]);
int varbId = client.getVarbitValue(RUNEPOUCH_RUNE_VARBITS[i]);
RunepouchRune rune = RunepouchRune.getRune(varbId);
if (rune == null)
{

View File

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

View File

@@ -28,7 +28,7 @@ import java.awt.Graphics2D;
import lombok.AccessLevel;
import lombok.Getter;
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.ui.overlay.components.PanelComponent;
@@ -43,8 +43,8 @@ public abstract class ClueScroll
private boolean requiresLight;
@Setter(AccessLevel.PROTECTED)
@Getter(AccessLevel.PUBLIC)
private Varbits hasFirePit;
@Getter(onMethod_ = {@Varbit}, value = AccessLevel.PUBLIC)
private int firePitVarbitId = -1;
@Setter(AccessLevel.PROTECTED)
@Getter(AccessLevel.PUBLIC)

View File

@@ -32,14 +32,21 @@ import javax.annotation.Nullable;
import lombok.Getter;
import lombok.NonNull;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
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.components.LineComponent;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
import static net.runelite.client.plugins.cluescrolls.clues.Enemy.*;
@Getter
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 boolean lightRequired;
private final Varbits lightSource;
@Getter(onMethod_ = {@Varbit})
private final int lightSourceVarbitId;
private final Enemy enemy;
private CoordinateClueInfo(@NonNull String directions)
@@ -62,15 +70,15 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
this.directions = directions;
this.enemy = enemy;
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.enemy = enemy;
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);
if (clueInfo != null)
{
setHasFirePit(clueInfo.getLightSource());
setFirePitVarbitId(clueInfo.getLightSourceVarbitId());
setRequiresLight(clueInfo.lightRequired);
setEnemy(clueInfo.getEnemy());
}

View File

@@ -41,6 +41,7 @@ import static net.runelite.api.ItemID.*;
import net.runelite.api.Perspective;
import net.runelite.api.ScriptID;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
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;
}
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);
setRequiresLight(true);
setHasFirePit(firePit);
setFirePitVarbitId(firePitVarbitId);
}
@Override

View File

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

View File

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

View File

@@ -235,7 +235,7 @@ public class CorpPlugin extends Plugin
{
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
if (myDamage > 0)
{

View File

@@ -99,7 +99,7 @@ public class CrowdsourcingCooking
int cookingLevel = client.getBoostedSkillLevel(Skill.COOKING);
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);
manager.storeEvent(data);
}

View File

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

View File

@@ -127,7 +127,7 @@ public class CrowdsourcingZMI
}
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);
Multiset<Integer> currentInventorySnapshot = getInventorySnapshot();
final Multiset<Integer> itemsReceived = Multisets.difference(currentInventorySnapshot, previousInventorySnapshot);

View File

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

View File

@@ -28,12 +28,9 @@ package net.runelite.client.plugins.devtools;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
@@ -59,9 +56,6 @@ import net.runelite.api.TileItem;
import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint;
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.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
@@ -122,11 +116,6 @@ class DevToolsOverlay extends Overlay
renderTileObjects(graphics);
}
if (plugin.getInventory().isActive())
{
renderInventory(graphics);
}
if (plugin.getProjectiles().isActive())
{
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)
{
for (Projectile projectile : client.getProjectiles())

View File

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

View File

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

View File

@@ -25,6 +25,7 @@
package net.runelite.client.plugins.devtools;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
import com.google.inject.Inject;
import java.awt.BorderLayout;
@@ -32,6 +33,7 @@ import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -45,6 +47,7 @@ import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.border.CompoundBorder;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.IndexDataBase;
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.FontManager;
@Slf4j
class VarInspector extends DevToolsFrame
{
@Getter
@@ -84,6 +88,26 @@ class VarInspector extends DevToolsFrame
private final static int MAX_LOG_ENTRIES = 10_000;
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 ClientThread clientThread;
@@ -218,15 +242,7 @@ class VarInspector extends DevToolsFrame
// Example: 4101 collides with 4104-4129
client.setVarbitValue(oldVarps2, i, neew);
String name = Integer.toString(i);
for (Varbits varbit : Varbits.values())
{
if (varbit.getId() == i)
{
name = String.format("%s(%d)", varbit.name(), i);
break;
}
}
final String name = VARBIT_NAMES.getOrDefault(i, Integer.toString(i));
addVarLog(VarType.VARBIT, name, old, neew);
}
}

View File

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

View File

@@ -198,8 +198,8 @@ public class DriftNetPlugin extends Plugin
for (DriftNet net : NETS)
{
DriftNetStatus status = DriftNetStatus.of(client.getVar(net.getStatusVarbit()));
int count = client.getVar(net.getCountVarbit());
DriftNetStatus status = DriftNetStatus.of(client.getVarbitValue(net.getStatusVarbit()));
int count = client.getVarbitValue(net.getCountVarbit());
net.setStatus(status);
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.WidgetID;
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_GROUP;
import net.runelite.api.widgets.WidgetItem;
@@ -126,7 +125,7 @@ public class ExaminePlugin extends Plugin
break;
case CC_OP_LOW_PRIORITY:
{
type = ExamineType.ITEM_BANK_EQ;
type = ExamineType.IF3_ITEM;
int[] qi = findItemFromWidget(event.getParam1(), event.getParam0());
if (qi == null)
{
@@ -173,7 +172,7 @@ public class ExaminePlugin extends Plugin
type = ExamineType.NPC;
break;
case GAMEMESSAGE:
type = ExamineType.ITEM_BANK_EQ;
type = ExamineType.IF3_ITEM;
break;
default:
return;
@@ -197,7 +196,7 @@ public class ExaminePlugin extends Plugin
log.debug("Got examine for {} {}: {}", pendingExamine.getType(), pendingExamine.getId(), event.getMessage());
// 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 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);
int widgetChild = TO_CHILD(widgetId);
Widget widget = client.getWidget(widgetGroup, widgetChild);
final int widgetGroup = TO_GROUP(widgetId);
final Widget widget = client.getWidget(widgetId);
if (widget == null)
{
return null;
@@ -239,42 +236,18 @@ public class ExaminePlugin extends Plugin
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)
{
Widget widgetItem = widget.getChild(actionParam);
Widget widgetItem = widget.getChild(childIdx);
if (widgetItem != null)
{
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);
if (widgetItem != null)
Widget widgetItem = widget.getChild(childIdx);
if (widgetItem != null && widgetItem.getItemId() > -1)
{
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
}

View File

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

View File

@@ -203,7 +203,7 @@ public class XpDropPlugin extends Plugin
else
{
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);
widget.setTextColor(color);
}

View File

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

View File

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

View File

@@ -199,7 +199,7 @@ public class HerbiboarPlugin extends Plugin
{
for (TrailToSpot trail : spot.getTrails())
{
int value = client.getVar(trail.getVarbit());
int value = client.getVarbitValue(trail.getVarbitId());
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
// 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;
if (!wasStarted && started)

View File

@@ -27,8 +27,9 @@ package net.runelite.client.plugins.herbiboars;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import lombok.Getter;
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.
@@ -42,9 +43,10 @@ class TrailToSpot
* 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()}.
*/
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.
*/
private final int value;

View File

@@ -280,6 +280,7 @@ public class HiscorePanel extends PluginPanel
minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS));
minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING));
minigamePanel.add(makeHiscorePanel(SOUL_WARS_ZEAL));
minigamePanel.add(makeHiscorePanel(RIFTS_CLOSED));
minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE));
minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER));
@@ -605,6 +606,18 @@ public class HiscorePanel extends PluginPanel
}
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:
{
Skill leaguePoints = result.getLeaguePoints();

View File

@@ -534,7 +534,7 @@ public class IdleNotifierPlugin extends Plugin
{
return false;
}
if (config.getOxygenThreshold() >= client.getVar(Varbits.OXYGEN_LEVEL) * 0.1)
if (config.getOxygenThreshold() >= client.getVarbitValue(Varbits.OXYGEN_LEVEL) * 0.1)
{
if (!notifyOxygen)
{
@@ -557,7 +557,7 @@ public class IdleNotifierPlugin extends Plugin
}
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)
{

View File

@@ -471,7 +471,7 @@ public class ItemChargePlugin extends Plugin
@Subscribe
private void onVarbitChanged(VarbitChanged event)
{
int explorerRingCharge = client.getVar(Varbits.EXPLORER_RING_ALCHS);
int explorerRingCharge = client.getVarbitValue(Varbits.EXPLORER_RING_ALCHS);
if (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())
{
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);
}
@@ -413,7 +413,7 @@ public class ItemStatPlugin extends Plugin
{
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);
}

View File

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

View File

@@ -192,7 +192,7 @@ public class KeyRemappingPlugin extends Plugin
{
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;
setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor));
}

View File

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

View File

@@ -149,6 +149,18 @@ public interface MenuEntrySwapperConfig extends Config
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(
keyName = "swapAdmire",
name = "Admire",
@@ -838,15 +850,4 @@ public interface MenuEntrySwapperConfig extends Config
{
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.MenuEntry;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.ObjectComposition;
import net.runelite.api.events.ClientTick;
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 ITEM_KEY_PREFIX = "item_";
private static final String OBJECT_KEY_PREFIX = "object_";
private static final String NPC_KEY_PREFIX = "npc_";
// Shift click
private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE_SC = new WidgetMenuOption(CONFIGURE,
@@ -141,13 +143,13 @@ public class MenuEntrySwapperPlugin extends Plugin
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_SECOND_OPTION,
MenuAction.NPC_THIRD_OPTION,
MenuAction.NPC_FOURTH_OPTION,
MenuAction.NPC_FIFTH_OPTION,
MenuAction.EXAMINE_NPC);
MenuAction.NPC_FIFTH_OPTION
);
private static final List<MenuAction> OBJECT_MENU_TYPES = ImmutableList.of(
MenuAction.GAME_OBJECT_FIRST_OPTION,
@@ -159,7 +161,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private static final Set<String> ESSENCE_MINE_NPCS = ImmutableSet.of(
"aubury",
"sedridor",
"archmage sedridor",
"wizard distentor",
"wizard cromperty",
"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-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)
@@ -543,6 +543,7 @@ public class MenuEntrySwapperPlugin extends Plugin
if (!configuringShiftClick && !configuringLeftClick)
{
configureObjectClick(event);
configureNpcClick(event);
return;
}
@@ -646,16 +647,9 @@ public class MenuEntrySwapperPlugin extends Plugin
final ObjectComposition composition = client.getObjectDefinition(entry.getIdentifier());
final String[] actions = composition.getActions();
final MenuAction currentAction;
Integer swapConfig = getObjectSwapConfig(composition.getId());
if (swapConfig != null)
{
currentAction = OBJECT_MENU_TYPES.get(swapConfig);
}
else
{
currentAction = defaultAction(composition);
}
final Integer swapConfig = getObjectSwapConfig(composition.getId());
final MenuAction currentAction = swapConfig != null ? OBJECT_MENU_TYPES.get(swapConfig) :
defaultAction(composition);
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
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
Collection<Swap> swaps = this.swaps.get(option);
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)
{
if (index1 == index2)
{
return;
}
MenuEntry entry1 = entries[index1],
entry2 = entries[index2];
@@ -1112,4 +1243,38 @@ public class MenuEntrySwapperPlugin extends Plugin
}
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()
{
curSackSize = client.getVar(Varbits.SACK_NUMBER);
boolean sackUpgraded = client.getVar(Varbits.SACK_UPGRADED) == 1;
curSackSize = client.getVarbitValue(Varbits.SACK_NUMBER);
boolean sackUpgraded = client.getVarbitValue(Varbits.SACK_UPGRADED) == 1;
maxSackSize = sackUpgraded ? SACK_LARGE_SIZE : SACK_SIZE;
}

View File

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

View File

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

View File

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

View File

@@ -28,6 +28,7 @@ import java.awt.Graphics2D;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.widgets.WidgetItem;
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.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
@@ -448,28 +447,15 @@ public class AlchemyRoom extends MTARoom
@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;
}
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
if (inventory.isHidden())
{
return;
}
for (WidgetItem item : inventory.getWidgetItems())
{
if (item.getId() != best.getId())
{
continue;
}
drawItem(graphics, item, Color.GREEN);
}
drawItem(graphics, widgetItem, Color.GREEN);
}
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.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.events.AreaSoundEffectPlayed;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.ClientTick;
@@ -783,7 +784,8 @@ public class MusicPlugin extends Plugin
@Getter
private final String name;
private final VarPlayer var;
private final Varbits mutedVar;
@Varbit
private final int mutedVarbitId;
private final IntSupplier getter;
private final Consumer<Integer> setter;
private final IntConsumer volumeChanger;
@@ -797,14 +799,14 @@ public class MusicPlugin extends Plugin
private Slider windowSlider;
Channel(String name,
VarPlayer var, Varbits mutedVar,
VarPlayer var, @Varbit int mutedVarbitId,
IntSupplier getter, Consumer<Integer> setter,
IntConsumer volumeChanger, int max,
WidgetInfo sideRoot)
{
this.name = name;
this.var = var;
this.mutedVar = mutedVar;
this.mutedVarbitId = mutedVarbitId;
this.getter = getter;
this.setter = setter;
this.volumeChanger = volumeChanger;
@@ -824,7 +826,7 @@ public class MusicPlugin extends Plugin
int raw = client.getVar(var);
if (raw == 0)
{
raw = -client.getVar(mutedVar);
raw = -client.getVarbitValue(mutedVarbitId);
}
value = raw * this.max / 100;

View File

@@ -93,7 +93,7 @@ class NightmareZoneOverlay extends OverlayPanel
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);
panelComponent.getChildren().add(LineComponent.builder()
@@ -114,7 +114,7 @@ class NightmareZoneOverlay extends OverlayPanel
private void renderAbsorptionCounter()
{
int absorptionPoints = client.getVar(Varbits.NMZ_ABSORPTION);
int absorptionPoints = client.getVarbitValue(Varbits.NMZ_ABSORPTION);
if (absorptionPoints == 0)
{
if (absorptionCounter != null)

View File

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

View File

@@ -226,7 +226,7 @@ class OpponentInfoOverlay extends OverlayPanel
*/
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)
{
int opponentId = client.getVar(VarPlayer.HP_HUD_NPC_ID);

View File

@@ -85,7 +85,7 @@ class PyramidPlunderOverlay extends Overlay
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
// 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())
{
if (config.highlightUrnsFloor() > currentFloor && URN_IDS.contains(object.getId())
@@ -127,7 +127,7 @@ class PyramidPlunderOverlay extends Overlay
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
if (client.getVar(Varbits.PYRAMID_PLUNDER_ROOM_LOCATION) != 1)
if (client.getVarbitValue(Varbits.PYRAMID_PLUNDER_ROOM_LOCATION) != 1)
{
return;
}

View File

@@ -171,7 +171,7 @@ public class PyramidPlunderPlugin extends Plugin
{
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);
timer = new PyramidPlunderTimer(remaining, itemManager.getImage(PHARAOHS_SCEPTRE), this,
config, client);
@@ -217,6 +217,6 @@ public class PyramidPlunderPlugin extends Plugin
{
return client.getLocalPlayer() != null
&& 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
public String getTooltip()
{
int floor = client.getVar(Varbits.PYRAMID_PLUNDER_ROOM);
int thievingLevel = client.getVar(Varbits.PYRAMID_PLUNDER_THIEVING_LEVEL);
int floor = client.getVarbitValue(Varbits.PYRAMID_PLUNDER_ROOM);
int thievingLevel = client.getVarbitValue(Varbits.PYRAMID_PLUNDER_THIEVING_LEVEL);
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()
{
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()

View File

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

View File

@@ -264,7 +264,7 @@ public class RaidsPlugin extends Plugin
public void onVarbitChanged(VarbitChanged event)
{
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 (tempPartyID != raidPartyID)
@@ -321,8 +321,8 @@ public class RaidsPlugin extends Plugin
if (config.pointsMessage())
{
int totalPoints = client.getVar(Varbits.TOTAL_POINTS);
int personalPoints = client.getVar(Varbits.PERSONAL_POINTS);
int totalPoints = client.getVarbitValue(Varbits.TOTAL_POINTS);
int personalPoints = client.getVarbitValue(Varbits.PERSONAL_POINTS);
double percentage = personalPoints / (totalPoints / 100.0);
@@ -425,7 +425,7 @@ public class RaidsPlugin extends Plugin
return;
}
inRaidChambers = client.getVar(Varbits.IN_RAID) == 1;
inRaidChambers = client.getVarbitValue(Varbits.IN_RAID) == 1;
if (!inRaidChambers)
{

View File

@@ -144,7 +144,7 @@ public class RegenMeterPlugin extends Plugin
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;
}

View File

@@ -215,7 +215,7 @@ public class RunEnergyPlugin extends Plugin
final int effectiveWeight = Math.max(client.getWeight(), 0);
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%
}

View File

@@ -33,6 +33,7 @@ import net.runelite.api.Client;
import net.runelite.api.ItemID;
import net.runelite.api.Point;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.RunepouchRune;
@@ -47,12 +48,10 @@ import net.runelite.client.util.ColorUtil;
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
};
private static final Varbits[] RUNE_VARBITS =
{
private static final int[] RUNE_VARBITS = {
Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3
};
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 RunepouchConfig config;
private final TooltipManager tooltipManager;
private final ItemManager itemManager;
@Inject
private ItemManager itemManager;
@Inject
RunepouchOverlay(Client client, RunepouchConfig config, TooltipManager tooltipManager)
RunepouchOverlay(Client client, RunepouchConfig config, TooltipManager tooltipManager, ItemManager itemManager)
{
this.tooltipManager = tooltipManager;
this.client = client;
this.config = config;
this.itemManager = itemManager;
showOnInventory();
showOnBank();
}
@@ -91,16 +89,15 @@ public class RunepouchOverlay extends WidgetItemOverlay
for (int i = 0; i < AMOUNT_VARBITS.length; i++)
{
Varbits amountVarbit = AMOUNT_VARBITS[i];
int amount = client.getVar(amountVarbit);
@Varbit int amountVarbit = AMOUNT_VARBITS[i];
int amount = client.getVarbitValue(amountVarbit);
if (amount <= 0)
{
continue;
}
Varbits runeVarbit = RUNE_VARBITS[i];
int runeId = client.getVar(runeVarbit);
@Varbit int runeVarbit = RUNE_VARBITS[i];
int runeId = client.getVarbitValue(runeVarbit);
RunepouchRune rune = RunepouchRune.getRune(runeId);
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 fileName = "Collection log (" + entry + ")";
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);
if (!fileName.isEmpty())
@@ -663,7 +663,7 @@ public class ScreenshotPlugin extends Plugin
String fileName = "Collection log (" + entry + ")";
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 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.NpcSpawned;
import net.runelite.api.events.StatChanged;
import net.runelite.api.vars.SlayerUnlock;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier;

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 2018 Abex
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.slayer;
import net.runelite.api.Client;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
/**
* Unlockables in the slayer interface
*/
enum SlayerUnlock
{
// Copied from enum 834 in the cache
// enum 854 contains if you can disable the unlock
GARGOYLE_SMASHER(0),
SLUG_SALTER(1),
REPTILE_FREEZER(2),
SHROOM_SPRAYER(3),
DARK_BEAST_EXTEND(4),
SLAYER_HELMET(5),
SLAYER_RINGS(6),
BROADER_FLETCHING(7),
ANKOU_EXTEND(8),
SUQAH_EXTEND(9),
BLACK_DRAGON_EXTEND(10),
METAL_DRAGON_EXTEND(11),
SPIRITUAL_MAGE_EXTEND(12),
ABYSSAL_DEMON_EXTEND(13),
BLACK_DEMON_EXTEND(14),
GREATER_DEMON_EXTEND(15),
MITHRIL_DRAGON_UNLOCK(16),
AVIANSIES_ENABLE(17),
TZHAAR_ENABLE(18),
BOSS_ENABLE(19),
BLOODVELD_EXTEND(20),
ABERRANT_SPECTRE_EXTEND(21),
AVIANSIES_EXTEND(22),
MITHRIL_DRAGON_EXTEND(23),
CAVE_HORROR_EXTEND(24),
DUST_DEVIL_EXTEND(25),
SKELETAL_WYVERN_EXTEND(26),
GARGOYLE_EXTEND(27),
NECHRYAEL_EXTEND(28),
CAVE_KRAKEN_EXTEND(29),
LIZARDMEN_ENABLE(30),
KBD_SLAYER_HELM(31),
KALPHITE_QUEEN_SLAYER_HELM(32),
ABYSSAL_DEMON_SAYER_HELM(33),
RED_DRAGON_ENABLE(34),
SUPERIOR_ENABLE(35, Varbits.SUPERIOR_ENABLED),
SCABARITE_EXTEND(36),
MITHRIL_DRAGON_NOTES(37),
SKOTIZO_SLAYER_HELM(38),
FOSSIL_ISLAND_WYVERN_EXTEND(39),
ADAMANT_DRAGON_EXTEND(40),
RUNE_DRAGON_EXTEND(41),
VORKATH_SLAYER_HELM(42),
FOSSIL_ISLAND_WYVERN_DISABLE(43, Varbits.FOSSIL_ISLAND_WYVERN_DISABLE),
GROTESQUE_GUARDIAN_DOUBLE_COUNT(44),
HYDRA_SLAYER_HELM(45),
BASILISK_EXTEND(46),
BASILISK_UNLOCK(47),
OLM_SLAYER_HELM(48),
VAMPYRE_EXTEND(49),
VAMPYRE_UNLOCK(50);
@Varbit
private final int toggleVarbit;
SlayerUnlock(int index)
{
assert index == ordinal();
this.toggleVarbit = -1;
}
SlayerUnlock(int index, @Varbit int varbit)
{
assert index == ordinal();
this.toggleVarbit = varbit;
}
/**
* @return true if this unlock is bought
*/
public boolean isOwned(Client client)
{
VarPlayer varp = ordinal() > 32 ? VarPlayer.SLAYER_UNLOCK_2 : VarPlayer.SLAYER_UNLOCK_1;
return (client.getVar(varp) & (1 << (ordinal() % 32))) != 0;
}
/**
* @return true if this unlock is bought and enabled
*/
public boolean isEnabled(Client client)
{
if (isOwned(client))
{
if (toggleVarbit == -1)
{
return true;
}
return client.getVarbitValue(toggleVarbit) == 0;
}
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 int SKILL_ICON_HEIGHT = 35;
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 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> currentValueSupplier;
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 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 Color fill = colorSupplier.get();
refreshSkills();
graphics.setColor(BACKGROUND);
graphics.drawRect(x, y, WIDTH - BORDER_SIZE, height - BORDER_SIZE);
graphics.fillRect(x, y, WIDTH, height);
graphics.drawRect(x, y, width - BORDER_SIZE, height - BORDER_SIZE);
graphics.fillRect(x, y, width, height);
graphics.setColor(fill);
graphics.fillRect(x + BORDER_SIZE,
y + BORDER_SIZE + (height - filledHeight),
WIDTH - BORDER_SIZE * 2,
width - BORDER_SIZE * 2,
filledHeight - BORDER_SIZE * 2);
if (config.enableRestorationBars())
{
renderRestore(graphics, x, y, height);
renderRestore(graphics, x, y, width, height);
}
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();
if (skillIconEnabled)
{
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);
}
@@ -111,7 +119,7 @@ class BarRenderer
graphics.setFont(FontManager.getRunescapeSmallFont());
final String counterText = Integer.toString(currentValue);
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 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 int heal = healSupplier.get();
@@ -150,7 +158,7 @@ class BarRenderer
graphics.fillRect(x + BORDER_SIZE,
fillY,
WIDTH - BORDER_SIZE * 2,
width - BORDER_SIZE * 2,
fillHeight);
}

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.statusbars;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
import net.runelite.client.plugins.statusbars.config.BarMode;
@@ -95,4 +96,18 @@ public interface StatusBarsConfig extends Config
{
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;
}
if (client.getVar(Varbits.PARASITE) >= 1)
if (client.getVarbitValue(Varbits.PARASITE) >= 1)
{
return PARASITE_COLOR;
}
@@ -193,7 +193,7 @@ class StatusBarsOverlay extends Overlay
() -> 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;
}
@@ -245,18 +245,21 @@ class StatusBarsOverlay extends Overlay
final Point offsetLeft = curViewport.getOffsetLeft();
final Point offsetRight = curViewport.getOffsetRight();
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)
{
width = config.barWidth();
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());
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());
}
else
{
width = BarRenderer.DEFAULT_WIDTH;
height = HEIGHT;
offsetLeftBarX = (location.getX() - offsetLeft.getX());
offsetLeftBarY = (location.getY() - offsetLeft.getY());
@@ -271,12 +274,12 @@ class StatusBarsOverlay extends Overlay
if (left != null)
{
left.renderBar(config, g, offsetLeftBarX, offsetLeftBarY, height);
left.renderBar(config, g, offsetLeftBarX, offsetLeftBarY, width, height);
}
if (right != null)
{
right.renderBar(config, g, offsetRightBarX, offsetRightBarY, height);
right.renderBar(config, g, offsetRightBarX, offsetRightBarY, width, height);
}
return null;

View File

@@ -123,7 +123,7 @@ public class StatusBarsPlugin extends Plugin
barsDisplayed = true;
}
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();
barsDisplayed = true;

View File

@@ -206,13 +206,13 @@ public class TimersPlugin extends Plugin
@Subscribe
public void onVarbitChanged(VarbitChanged event)
{
int raidVarb = client.getVar(Varbits.IN_RAID);
int vengCooldownVarb = client.getVar(Varbits.VENGEANCE_COOLDOWN);
int isVengeancedVarb = client.getVar(Varbits.VENGEANCE_ACTIVE);
int raidVarb = client.getVarbitValue(Varbits.IN_RAID);
int vengCooldownVarb = client.getVarbitValue(Varbits.VENGEANCE_COOLDOWN);
int isVengeancedVarb = client.getVarbitValue(Varbits.VENGEANCE_ACTIVE);
int poisonVarp = client.getVar(VarPlayer.POISON);
int pvpVarb = client.getVar(Varbits.PVP_SPEC_ORB);
int corruptionCooldownVarb = client.getVar(Varbits.CORRUPTION_COOLDOWN);
int imbuedHeartCooldownVarb = client.getVar(Varbits.IMBUED_HEART_COOLDOWN);
int pvpVarb = client.getVarbitValue(Varbits.PVP_SPEC_ORB);
int corruptionCooldownVarb = client.getVarbitValue(Varbits.CORRUPTION_COOLDOWN);
int imbuedHeartCooldownVarb = client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN);
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 (client.getVar(Varbits.IN_RAID) == 1)
if (client.getVarbitValue(Varbits.IN_RAID) == 1)
{
createGameTimer(OVERLOAD_RAID);
}

View File

@@ -128,7 +128,7 @@ public class TimestampPlugin extends Plugin
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();
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2018 Abex
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.timetracking.farming;
/**
* An enumeration of possible autoweed settings.
*/
enum Autoweed
{
/**
* Access to autoweed has not been unlocked.
*/
UNOWNED,
/**
* Autoweed is disabled.
*/
OFF,
/**
* Autoweed is enabled.
*/
ON
}

View File

@@ -28,7 +28,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.runelite.api.Varbits;
import net.runelite.api.annotations.Varbit;
import net.runelite.client.plugins.timetracking.TimeTrackingConfig;
@RequiredArgsConstructor(
@@ -40,16 +40,17 @@ class FarmingPatch
@Setter(AccessLevel.PACKAGE)
private FarmingRegion region;
private final String name;
private final Varbits varbit;
@Getter(onMethod_ = {@Varbit})
private final int varbit;
private final PatchImplementation implementation;
String configKey()
{
return region.getRegionID() + "." + varbit.getId();
return region.getRegionID() + "." + varbit;
}
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;
import lombok.Getter;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldPoint;
@Getter
@@ -35,7 +34,6 @@ public class FarmingRegion
private final int regionID;
private final boolean definite;
private final FarmingPatch[] patches;
private final Varbits[] varbits;
FarmingRegion(String name, int regionID, boolean definite, FarmingPatch... patches)
{
@@ -43,12 +41,9 @@ public class FarmingRegion
this.regionID = regionID;
this.definite = definite;
this.patches = patches;
this.varbits = new Varbits[patches.length];
for (int i = 0; i < patches.length; i++)
for (FarmingPatch p : patches)
{
FarmingPatch p = patches[i];
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.WidgetNode;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.vars.Autoweed;
import net.runelite.api.widgets.WidgetModalMode;
import net.runelite.client.Notifier;
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)))
{
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)))
{
configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, botanist);
@@ -144,9 +143,9 @@ public class FarmingTracker
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
Varbits varbit = patch.getVarbit();
int varbit = patch.getVarbit();
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);
if (storedValue != null)
@@ -173,7 +172,7 @@ public class FarmingTracker
else if (!newRegionLoaded && timeSinceModalClose > 1)
{
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)
{

View File

@@ -131,7 +131,7 @@ public class WikiPlugin extends Plugin
children[0] = null;
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);
}
@@ -157,7 +157,7 @@ public class WikiPlugin extends Plugin
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,
// 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
public void onVarbitChanged(VarbitChanged varbitChanged)
{
int timerValue = client.getVar(Varbits.WINTERTODT_TIMER);
int timerValue = client.getVarbitValue(Varbits.WINTERTODT_TIMER);
if (timerValue != previousTimerValue)
{
int timeToNotify = config.roundNotification();

View File

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

View File

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

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.client.ui.overlay;
import com.google.common.base.Preconditions;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
@@ -83,11 +84,47 @@ public abstract class Overlay implements LayoutableRenderableEntity
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)
{
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)
{
drawHooks.add(layer.getId());

View File

@@ -886,7 +886,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
{
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);
}

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",
// it just has its children hidden.
if (client.getVar(Varbits.EXPERIENCE_TRACKER_COUNTER) == 30 // Off
&& client.getVar(Varbits.EXPERIENCE_TRACKER_PROGRESS_BAR) == 0) // Off
if (client.getVarbitValue(Varbits.EXPERIENCE_TRACKER_COUNTER) == 30 // Off
&& client.getVarbitValue(Varbits.EXPERIENCE_TRACKER_PROGRESS_BAR) == 0) // Off
{
return null;
}
@@ -234,7 +234,7 @@ public class WidgetOverlay extends Overlay
}
OverlayPosition position;
switch (client.getVar(Varbits.EXPERIENCE_TRACKER_POSITION))
switch (client.getVarbitValue(Varbits.EXPERIENCE_TRACKER_POSITION))
{
case 0:
default:
@@ -269,7 +269,7 @@ public class WidgetOverlay extends Overlay
public Dimension render(Graphics2D graphics)
{
// 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);
}

View File

@@ -62,6 +62,14 @@
"z1": 0,
"z2": 0
},
{
"rx1": 23,
"ry1": 20,
"rx2": 31,
"ry2": 20,
"z1": 0,
"z2": 0
},
{ // Eastern part of the castle
"rx1": 36,
"ry1": 15,
@@ -69,6 +77,14 @@
"ry2": 16,
"z1": 0,
"z2": 0
},
{ // Rising Sun Inn
"rx1": 12,
"ry1": 51,
"rx2": 12,
"ry2": 51,
"z1": 0,
"z2": 0
}
],
"12895":[ // Prif NW
@@ -383,6 +399,34 @@
"z2": 2
}
],
"14386": [ // South Meiyerditch
{
"rx1": 21,
"ry1": 19,
"rx2": 22,
"ry2": 23,
"z1": 1,
"z2": 1
},
{
"rx1": 35,
"ry1": 43,
"rx2": 38,
"ry2": 43,
"z1": 1,
"z2": 1
}
],
"14387": [ // North Meiyerditch
{
"rx1": 50,
"ry1": 4,
"rx2": 50,
"ry2": 4,
"z1": 0,
"z2": 0
}
],
"14388": [ // Darkmeyer
{
"rx1": 34,
@@ -1910,6 +1954,22 @@
"ry2": 40,
"z1": 0,
"z2": 1
},
{
"rx1": 31,
"ry1": 34,
"rx2": 33,
"ry2": 36,
"z1": 2,
"z2": 2
},
{
"rx1": 37,
"ry1": 39,
"rx2": 39,
"ry2": 41,
"z1": 2,
"z2": 2
}
],
"9531": [ // Jatiszo
@@ -1960,7 +2020,23 @@
"z2": 0
}
],
"11061": [ // West Catherby
"11061": [ // West Catherby & Keep Le Faye
{
"rx1": 11,
"ry1": 6,
"rx2": 11,
"ry2": 13,
"z1": 0,
"z2": 0
},
{
"rx1": 14,
"ry1": 3,
"rx2": 22,
"ry2": 6,
"z1": 2,
"z2": 2
},
{
"rx1": 55,
"ry1": 20,
@@ -1978,6 +2054,14 @@
"ry2": 48,
"z1": 0,
"z2": 0
},
{
"rx1": 16,
"ry1": 47,
"rx2": 19,
"ry2": 47,
"z1": 0,
"z2": 0
}
],
"5945": [ // West Shayzien Encampment
@@ -2042,6 +2126,22 @@
"ry2": 54,
"z1": 0,
"z2": 1
},
{
"rx1": 48,
"ry1": 50,
"rx2": 51,
"ry2": 50,
"z1": 0,
"z2": 0
},
{
"rx1": 43,
"ry1": 55,
"rx2": 43,
"ry2": 59,
"z1": 0,
"z2": 0
}
],
"11570": [ // Rimmington Dock
@@ -2131,6 +2231,14 @@
}
],
"14646": [ // Port Phasmatys
{
"rx1": 27,
"ry1": 25,
"rx2": 30,
"ry2": 26,
"z1": 0,
"z2": 0
},
{
"rx1": 46,
"ry1": 47,
@@ -2429,6 +2537,22 @@
"rx2": 23,
"ry2": 37,
"z1": 0,
"z2": 1
},
{
"rx1": 30,
"ry1": 32,
"rx2": 30,
"ry2": 32,
"z1": 0,
"z2": 0
},
{
"rx1": 30,
"ry1": 39,
"rx2": 30,
"ry2": 39,
"z1": 0,
"z2": 0
}
],
@@ -3420,5 +3544,215 @@
"z1": 2,
"z2": 2
}
],
"10292": [ // North & North of East Ardougne (south of Fishing Guild)
{
"rx1": 19,
"ry1": 16,
"rx2": 24,
"ry2": 20,
"z1": 0,
"z2": 0
}
],
"6475": [ // Misthalin Mystery manor
{
"rx1": 30,
"ry1": 23,
"rx2": 40,
"ry2": 23,
"z1": 0,
"z2": 0
},
{
"rx1": 25,
"ry1": 35,
"rx2": 29,
"ry2": 37,
"z1": 0,
"z2": 0
}
],
"9035": [ // Chaos runecrafting altar
{
"rx1": 0,
"ry1": 0,
"rx2": 63,
"ry2": 63,
"z1": 0,
"z2": 3
}
],
"14908": [ // Fossil Island House on the Hill
{
"rx1": 45,
"ry1": 23,
"rx2": 45,
"ry2": 23,
"z1": 0,
"z2": 0
},
{
"rx1": 48,
"ry1": 22,
"rx2": 48,
"ry2": 22,
"z1": 0,
"z2": 0
},
{
"rx1": 57,
"ry1": 22,
"rx2": 58,
"ry2": 24,
"z1": 0,
"z2": 0
},
{
"rx1": 60,
"ry1": 26,
"rx2": 60,
"ry2": 32,
"z1": 0,
"z2": 0
},
{
"rx1": 61,
"ry1": 27,
"rx2": 61,
"ry2": 31,
"z1": 0,
"z2": 0
},
{
"rx1": 58,
"ry1": 26,
"rx2": 58,
"ry2": 32,
"z1": 1,
"z2": 1
}
],
"10803": [ // Witchaven
{
"rx1": 15,
"ry1": 27,
"rx2": 16,
"ry2": 28,
"z1": 0,
"z2": 0
}
],
"11829": [ // North of Falador
{
"rx1": 59,
"ry1": 1,
"rx2": 59,
"ry2": 1,
"z1": 0,
"z2": 0
},
{
"rx1": 63,
"ry1": 1,
"rx2": 63,
"ry2": 1,
"z1": 0,
"z2": 0
}
],
"12084": [ // East Falador
{
"rx1": 11,
"ry1": 62,
"rx2": 11,
"ry2": 62,
"z1": 0,
"z2": 0
},
{
"rx1": 31,
"ry1": 60,
"rx2": 31,
"ry2": 60,
"z1": 0,
"z2": 0
},
{
"rx1": 40,
"ry1": 60,
"rx2": 40,
"ry2": 60,
"z1": 0,
"z2": 0
},
{
"rx1": 52,
"ry1": 60,
"rx2": 52,
"ry2": 60,
"z1": 0,
"z2": 0
},
{
"rx1": 53,
"ry1": 59,
"rx2": 53,
"ry2": 59,
"z1": 0,
"z2": 0
},
{
"rx1": 54,
"ry1": 58,
"rx2": 54,
"ry2": 58,
"z1": 0,
"z2": 0
},
{
"rx1": 55,
"ry1": 57,
"rx2": 55,
"ry2": 57,
"z1": 0,
"z2": 0
},
{
"rx1": 56,
"ry1": 56,
"rx2": 56,
"ry2": 56,
"z1": 0,
"z2": 0
},
{
"rx1": 50,
"ry1": 28,
"rx2": 50,
"ry2": 28,
"z1": 0,
"z2": 0
}
],
"12085": [ // North of East Falador
{
"rx1": 0,
"ry1": 0,
"rx2": 0,
"ry2": 0,
"z1": 0,
"z2": 0
}
],
"8527": [ // Braindeath Island distillery
{
"rx1": 26,
"ry1": 35,
"rx2": 52,
"ry2": 50,
"z1": 2,
"z2": 2
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

View File

@@ -71,6 +71,7 @@ public class HiscoreClientTest
+ "254,92\n"
+ "-1,-1\n" // lms
+ "1,241\n" // soul wars
+ "1,2739\n" // gotr
+ "24870,37\n"
+ "15020,388\n"
+ "50463,147\n"
@@ -148,6 +149,7 @@ public class HiscoreClientTest
assertEquals(254, result.getClueScrollMaster().getRank());
assertEquals(-1, result.getLastManStanding().getLevel());
assertEquals(241, result.getSoulWarsZeal().getLevel());
assertEquals(2739, result.getRiftsClosed().getLevel());
assertEquals(2460, result.getLeaguePoints().getLevel());
assertEquals(37, result.getAbyssalSire().getLevel());
assertEquals(92357, result.getCallisto().getRank());

View File

@@ -0,0 +1,189 @@
/*
* Copyright (c) 2018, 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.client.plugins.attackstyles;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import java.util.Set;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Skill;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class AttackStylesPluginTest
{
@Mock
@Bind
Client client;
@Mock
@Bind
OverlayManager overlayManager;
@Mock
@Bind
AttackStylesConfig attackConfig;
@Inject
AttackStylesPlugin attackPlugin;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
}
/*
* Verify that red text is displayed when attacking with a style that gains experience
* in one of the unwanted skills.
*/
@Test
public void testWarning()
{
ConfigChanged warnForAttackEvent = new ConfigChanged();
warnForAttackEvent.setGroup("attackIndicator");
warnForAttackEvent.setKey("warnForAttack");
warnForAttackEvent.setNewValue("true");
attackPlugin.onConfigChanged(warnForAttackEvent);
// Verify there is a warned skill
Set<Skill> warnedSkills = attackPlugin.getWarnedSkills();
assertTrue(warnedSkills.contains(Skill.ATTACK));
// Set mock client to attack in style that gives attack xp
when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.ACCURATE.ordinal());
// verify that earning xp in a warned skill will display red text on the widget
attackPlugin.onVarbitChanged(new VarbitChanged());
assertTrue(attackPlugin.isWarnedSkillSelected());
// Switch to attack style that doesn't give attack xp
when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.AGGRESSIVE.ordinal());
// Verify the widget will now display white text
attackPlugin.onVarbitChanged(new VarbitChanged());
warnedSkills = attackPlugin.getWarnedSkills();
assertTrue(warnedSkills.contains(Skill.ATTACK));
assertFalse(attackPlugin.isWarnedSkillSelected());
}
/*
* Verify that attack style widgets are hidden when filtered with the AttackStylesPlugin.
*/
@Test
public void testHiddenWidget()
{
ConfigChanged warnForAttackEvent = new ConfigChanged();
warnForAttackEvent.setGroup("attackIndicator");
warnForAttackEvent.setKey("warnForAttack");
warnForAttackEvent.setNewValue("true");
attackPlugin.onConfigChanged(warnForAttackEvent);
// Set up mock widgets for atk and str attack styles
Widget atkWidget = mock(Widget.class);
Widget strWidget = mock(Widget.class);
when(client.getWidget(WidgetInfo.COMBAT_STYLE_ONE)).thenReturn(atkWidget);
when(client.getWidget(WidgetInfo.COMBAT_STYLE_TWO)).thenReturn(strWidget);
// Set widgets to return their hidden value in widgetsToHide when isHidden() is called
when(atkWidget.isHidden()).thenAnswer(x -> isAtkHidden());
when(strWidget.isHidden()).thenAnswer(x -> isStrHidden());
// equip type_4 weapon type on player
when(client.getVarbitValue(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal());
attackPlugin.onVarbitChanged(new VarbitChanged());
// Verify there is a warned skill
Set<Skill> warnedSkills = attackPlugin.getWarnedSkills();
assertTrue(warnedSkills.contains(Skill.ATTACK));
// Enable hiding widgets
ConfigChanged hideWidgetEvent = new ConfigChanged();
hideWidgetEvent.setGroup("attackIndicator");
hideWidgetEvent.setKey("removeWarnedStyles");
hideWidgetEvent.setNewValue("true");
attackPlugin.onConfigChanged(hideWidgetEvent);
when(attackConfig.removeWarnedStyles()).thenReturn(true);
// verify that the accurate attack style widget is hidden
assertTrue(atkWidget.isHidden());
// add another warned skill
ConfigChanged warnForStrengthEvent = new ConfigChanged();
warnForStrengthEvent.setGroup("attackIndicator");
warnForStrengthEvent.setKey("warnForStrength");
warnForStrengthEvent.setNewValue("true");
attackPlugin.onConfigChanged(warnForStrengthEvent);
// verify that the aggressive attack style widget is now hidden
assertTrue(strWidget.isHidden());
// disable hiding attack style widgets
hideWidgetEvent.setGroup("attackIndicator");
hideWidgetEvent.setKey("removeWarnedStyles");
hideWidgetEvent.setNewValue("false");
attackPlugin.onConfigChanged(hideWidgetEvent);
// verify that the aggressive and accurate attack style widgets are no longer hidden
assertFalse(attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4,
WidgetInfo.COMBAT_STYLE_ONE));
assertFalse(attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4,
WidgetInfo.COMBAT_STYLE_THREE));
}
private boolean isAtkHidden()
{
if (attackPlugin.getHiddenWidgets().size() == 0)
{
return false;
}
return attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, WidgetInfo.COMBAT_STYLE_ONE);
}
private boolean isStrHidden()
{
if (attackPlugin.getHiddenWidgets().size() == 0)
{
return false;
}
return attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, WidgetInfo.COMBAT_STYLE_TWO);
}
}

View File

@@ -41,6 +41,7 @@ import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.api.ScriptID;
import net.runelite.api.Varbits;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptPostFired;
@@ -164,6 +165,9 @@ public class ChatCommandsPluginTest
@Test
public void testTheatreOfBlood()
{
when(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB1)).thenReturn(1);
when(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB2)).thenReturn(15);
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "",
"Wave 'The Final Challenge' (Normal Mode) complete!<br>" +
"Duration: <col=ff0000>2:42.0</col><br>" +
@@ -178,11 +182,14 @@ public class ChatCommandsPluginTest
verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73);
verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood", 17 * 60 + .2);
verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood 2 players", 17 * 60 + .2);
}
@Test
public void testTheatreOfBloodNoPb()
{
when(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB1)).thenReturn(1);
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "",
"Wave 'The Final Challenge' (Normal Mode) complete!<br>" +
"Duration: <col=ff0000>2:42</col><br>" +
@@ -197,11 +204,14 @@ public class ChatCommandsPluginTest
verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73);
verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood", 13 * 60 + 52.8);
verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood solo", 13 * 60 + 52.8);
}
@Test
public void testTheatreOfBloodEntryMode()
{
when(client.getVarbitValue(Varbits.THEATRE_OF_BLOOD_ORB1)).thenReturn(1);
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "",
"Wave 'The Final Challenge' (Entry Mode) complete!<br>" +
"Duration: <col=ff0000>2:42</col><br>" +
@@ -216,6 +226,7 @@ public class ChatCommandsPluginTest
verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood entry mode", 73);
verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood entry mode", 17 * 60.);
verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood entry mode solo", 17 * 60.);
}
@Test
@@ -556,45 +567,45 @@ public class ChatCommandsPluginTest
@Test
public void testCoXKill()
{
ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>24+ players</col> Duration:</col> <col=ff0000>37:04</col> (new personal best)</col>>", null, 0);
ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>24+ players</col> Duration:</col> <col=ff0000>37:04.20</col> (new personal best)</col>>", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: <col=ff0000>51</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 51);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 37 * 60 + 4.0);
// Precise times
chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>24+ players</col> Duration:</col> <col=ff0000>37:04.20</col> (new personal best)</col>>", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: <col=ff0000>51</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 37 * 60 + 4.2);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric 24+ players", 37 * 60 + 4.2);
}
@Test
public void testCoXKillNoPb()
{
ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>11-15 players</col> Duration:</col> <col=ff0000>23:25</col> Personal best: </col><col=ff0000>20:19</col>", null, 0);
ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>11-15 players</col> Duration:</col> <col=ff0000>23:25.40</col> Personal best: </col><col=ff0000>20:19.20</col>", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: <col=ff0000>52</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 52);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 20 * 60 + 19.0);
// Precise times
chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>11-15 players</col> Duration:</col> <col=ff0000>23:25.40</col> Personal best: </col><col=ff0000>20:19.20</col>", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: <col=ff0000>52</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 20 * 60 + 19.2);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric 11-15 players", 20 * 60 + 19.2);
}
@Test
public void testCoxCmNoPb()
{
ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "",
"<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>3 players</col> Duration:</col> <col=ff0000>41:10</col> Personal best: </col><col=ff0000>40:03</col>", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "",
"Your completed Chambers of Xeric Challenge Mode count is: <col=ff0000>13</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric challenge mode", 13);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric challenge mode", 40 * 60 + 3.);
verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric challenge mode 3 players", 40 * 60 + 3.);
}
@Test

View File

@@ -216,10 +216,10 @@ public class ClueScrollPluginTest
when(container.getItems()).thenReturn(inventory);
when(container.contains(ItemID.RUNE_POUCH)).thenReturn(true);
when(client.getVar(Varbits.RUNE_POUCH_RUNE1)).thenReturn(9); // Cosmic Rune
when(client.getVar(Varbits.RUNE_POUCH_AMOUNT1)).thenReturn(20);
when(client.getVar(Varbits.RUNE_POUCH_RUNE3)).thenReturn(4); // Fire Rune
when(client.getVar(Varbits.RUNE_POUCH_AMOUNT3)).thenReturn(4000);
when(client.getVarbitValue(Varbits.RUNE_POUCH_RUNE1)).thenReturn(9); // Cosmic Rune
when(client.getVarbitValue(Varbits.RUNE_POUCH_AMOUNT1)).thenReturn(20);
when(client.getVarbitValue(Varbits.RUNE_POUCH_RUNE3)).thenReturn(4); // Fire Rune
when(client.getVarbitValue(Varbits.RUNE_POUCH_AMOUNT3)).thenReturn(4000);
plugin.onItemContainerChanged(event);

View File

@@ -34,6 +34,8 @@ import net.runelite.api.GameState;
import net.runelite.api.KeyCode;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.ObjectComposition;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.MenuEntryAdded;
@@ -95,6 +97,11 @@ public class MenuEntrySwapperPluginTest
when(client.getGameState()).thenReturn(GameState.LOGGED_IN);
when(client.getObjectDefinition(anyInt())).thenReturn(mock(ObjectComposition.class));
NPC npc = mock(NPC.class);
NPCComposition composition = mock(NPCComposition.class);
when(npc.getTransformedComposition()).thenReturn(composition);
when(client.getCachedNPCs()).thenReturn(new NPC[] { npc });
when(client.getMenuEntries()).thenAnswer((Answer<MenuEntry[]>) invocationOnMock ->
{
// The menu implementation returns a copy of the array, which causes swap() to not

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