Merge branch 'master' of https://www.github.com/runelite/runelite into 23112021
This commit is contained in:
@@ -41,8 +41,6 @@ public class KourendDiaryRequirement extends GenericDiaryRequirement
|
||||
add("Steal from a Hosidius Food Stall.",
|
||||
new SkillRequirement(Skill.THIEVING, 25),
|
||||
new FavourRequirement(FavourRequirement.Favour.HOSIDIUS, 15));
|
||||
add("Browse the Warrens General Store.",
|
||||
new QuestRequirement(Quest.THE_QUEEN_OF_THIEVES, true));
|
||||
add("Enter your Player Owned House from Hosidius.",
|
||||
new SkillRequirement(Skill.CONSTRUCTION, 25));
|
||||
add("Create a Strength potion in the Lovakengj Pub.",
|
||||
|
||||
@@ -42,7 +42,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
|
||||
public class BarrowsBrotherSlainOverlay extends OverlayPanel
|
||||
class BarrowsBrotherSlainOverlay extends OverlayPanel
|
||||
{
|
||||
private static final DecimalFormat REWARD_POTENTIAL_FORMATTER = new DecimalFormat("##0.00%");
|
||||
|
||||
@@ -61,21 +61,13 @@ public class BarrowsBrotherSlainOverlay extends OverlayPanel
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
// Only render the brothers slain overlay if the vanilla interface is loaded
|
||||
final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS);
|
||||
if (barrowsBrothers == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Hide original brother and potential overlays
|
||||
barrowsBrothers.setHidden(true);
|
||||
|
||||
final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL);
|
||||
if (potential != null)
|
||||
{
|
||||
potential.setHidden(true);
|
||||
}
|
||||
|
||||
for (BarrowsBrothers brother : BarrowsBrothers.values())
|
||||
{
|
||||
final boolean brotherSlain = client.getVar(brother.getKilledVarbit()) > 0;
|
||||
|
||||
@@ -30,7 +30,8 @@ import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public enum BarrowsBrothers
|
||||
@Getter
|
||||
enum BarrowsBrothers
|
||||
{
|
||||
AHRIM("Ahrim", new WorldPoint(3566, 3289, 0), Varbits.BARROWS_KILLED_AHRIM),
|
||||
DHAROK("Dharok", new WorldPoint(3575, 3298, 0), Varbits.BARROWS_KILLED_DHAROK),
|
||||
@@ -39,10 +40,7 @@ public enum BarrowsBrothers
|
||||
TORAG("Torag", new WorldPoint(3553, 3283, 0), Varbits.BARROWS_KILLED_TORAG),
|
||||
VERAC("Verac", new WorldPoint(3557, 3298, 0), Varbits.BARROWS_KILLED_VERAC);
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
@Getter
|
||||
private final WorldPoint location;
|
||||
@Getter
|
||||
private final Varbits killedVarbit;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.awt.Rectangle;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -56,13 +57,12 @@ class BarrowsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
Widget puzzleAnswer = plugin.getPuzzleAnswer();
|
||||
|
||||
if (config.showBrotherLoc())
|
||||
if (plugin.isBarrowsLoaded() && config.showBrotherLoc())
|
||||
{
|
||||
renderBarrowsBrothers(graphics);
|
||||
}
|
||||
|
||||
Widget puzzleAnswer = plugin.getPuzzleAnswer();
|
||||
if (puzzleAnswer != null && config.showPuzzleAnswer() && !puzzleAnswer.isHidden())
|
||||
{
|
||||
Rectangle answerRect = puzzleAnswer.getBounds();
|
||||
@@ -78,20 +78,19 @@ class BarrowsOverlay extends Overlay
|
||||
for (BarrowsBrothers brother : BarrowsBrothers.values())
|
||||
{
|
||||
LocalPoint localLocation = LocalPoint.fromWorld(client, brother.getLocation());
|
||||
|
||||
if (localLocation == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String brotherLetter = Character.toString(brother.getName().charAt(0));
|
||||
net.runelite.api.Point minimapText = Perspective.getCanvasTextMiniMapLocation(client, graphics,
|
||||
Point miniMapLocation = Perspective.getCanvasTextMiniMapLocation(client, graphics,
|
||||
localLocation, brotherLetter);
|
||||
|
||||
if (minimapText != null)
|
||||
if (miniMapLocation != null)
|
||||
{
|
||||
graphics.setColor(Color.black);
|
||||
graphics.drawString(brotherLetter, minimapText.getX() + 1, minimapText.getY() + 1);
|
||||
graphics.drawString(brotherLetter, miniMapLocation.getX() + 1, miniMapLocation.getY() + 1);
|
||||
|
||||
if (client.getVar(brother.getKilledVarbit()) > 0)
|
||||
{
|
||||
@@ -102,7 +101,7 @@ class BarrowsOverlay extends Overlay
|
||||
graphics.setColor(config.brotherLocColor());
|
||||
}
|
||||
|
||||
graphics.drawString(brotherLetter, minimapText.getX(), minimapText.getY());
|
||||
graphics.drawString(brotherLetter, miniMapLocation.getX(), miniMapLocation.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.events.BeforeRender;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.WidgetClosed;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
@@ -59,6 +60,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
|
||||
import net.runelite.client.ui.overlay.infobox.LoopTimer;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Barrows Brothers",
|
||||
@@ -75,6 +77,7 @@ public class BarrowsPlugin extends Plugin
|
||||
|
||||
private static final long PRAYER_DRAIN_INTERVAL_MS = 18200;
|
||||
private static final int CRYPT_REGION_ID = 14231;
|
||||
private static final int BARROWS_REGION_ID = 14131;
|
||||
|
||||
private LoopTimer barrowsPrayerDrainTimer;
|
||||
|
||||
@@ -214,6 +217,26 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onBeforeRender(BeforeRender beforeRender)
|
||||
{
|
||||
// The barrows brothers and potential overlays have timers to unhide them each tick. Set them
|
||||
// hidden here instead of in the overlay, because if the overlay renders on the ABOVE_WIDGETS
|
||||
// layer due to being moved outside of the snap corner, it will be running after the overlays
|
||||
// had already been rendered.
|
||||
final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS);
|
||||
if (barrowsBrothers != null)
|
||||
{
|
||||
barrowsBrothers.setHidden(true);
|
||||
}
|
||||
|
||||
final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL);
|
||||
if (potential != null)
|
||||
{
|
||||
potential.setHidden(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetClosed(WidgetClosed widgetClosed)
|
||||
{
|
||||
@@ -256,4 +279,9 @@ public class BarrowsPlugin extends Plugin
|
||||
Player localPlayer = client.getLocalPlayer();
|
||||
return localPlayer != null && localPlayer.getWorldLocation().getRegionID() == CRYPT_REGION_ID;
|
||||
}
|
||||
|
||||
boolean isBarrowsLoaded()
|
||||
{
|
||||
return ArrayUtils.contains(client.getMapRegions(), BARROWS_REGION_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ public class ChatCommandsPlugin extends Plugin
|
||||
private static final Pattern TOB_WAVE_DURATION_PATTERN = Pattern.compile("Theatre of Blood wave completion time: <col=ff0000>[0-9:.]+</col>\\. Personal best: (?<pb>[0-9:]+(?:\\.[0-9]+)?)");
|
||||
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)(?:(?:Fight |Lap |Challenge |Corrupted challenge )?duration:|Subdued in) <col=[0-9a-f]{6}>[0-9:.]+</col>\\. Personal best: (?:<col=ff0000>)?(?<pb>[0-9:]+(?:\\.[0-9]+)?)");
|
||||
private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)(?:(?:Fight |Lap |Challenge |Corrupted challenge )?duration:|Subdued in) <col=[0-9a-f]{6}>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col> \\(new personal best\\)");
|
||||
private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?");
|
||||
private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?");
|
||||
private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won ([\\d,]+|one) duels?");
|
||||
private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost ([\\d,]+|one) duels?");
|
||||
private static final Pattern 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 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]+)?))" +
|
||||
@@ -415,7 +415,8 @@ public class ChatCommandsPlugin extends Plugin
|
||||
if (matcher.find())
|
||||
{
|
||||
final int oldWins = getKc("Duel Arena Wins");
|
||||
final int wins = Integer.parseInt(matcher.group(2));
|
||||
final int wins = matcher.group(2).equals("one") ? 1 :
|
||||
Integer.parseInt(matcher.group(2).replace(",", ""));
|
||||
final String result = matcher.group(1);
|
||||
int winningStreak = getKc("Duel Arena Win Streak");
|
||||
int losingStreak = getKc("Duel Arena Lose Streak");
|
||||
@@ -443,7 +444,8 @@ public class ChatCommandsPlugin extends Plugin
|
||||
matcher = DUEL_ARENA_LOSSES_PATTERN.matcher(message);
|
||||
if (matcher.find())
|
||||
{
|
||||
int losses = Integer.parseInt(matcher.group(1));
|
||||
int losses = matcher.group(1).equals("one") ? 1 :
|
||||
Integer.parseInt(matcher.group(1).replace(",", ""));
|
||||
|
||||
setKc("Duel Arena Losses", losses);
|
||||
}
|
||||
|
||||
@@ -253,6 +253,9 @@ public class LootTrackerPlugin extends Plugin
|
||||
private static final String TEMPOROSS_LOOT_STRING = "You found some loot: ";
|
||||
private static final int TEMPOROSS_REGION = 12588;
|
||||
|
||||
// Mahogany Homes
|
||||
private static final String MAHOGANY_CRATE_EVENT = "Supply crate (Mahogany Homes)";
|
||||
|
||||
private static final Set<Character> VOWELS = ImmutableSet.of('a', 'e', 'i', 'o', 'u');
|
||||
|
||||
@Inject
|
||||
@@ -816,7 +819,8 @@ public class LootTrackerPlugin extends Plugin
|
||||
|| BIRDNEST_EVENT.equals(eventType)
|
||||
|| SPOILS_OF_WAR_EVENT.equals(eventType)
|
||||
|| TEMPOROSS_EVENT.equals(eventType)
|
||||
|| TEMPOROSS_CASKET_EVENT.equals(eventType))
|
||||
|| TEMPOROSS_CASKET_EVENT.equals(eventType)
|
||||
|| MAHOGANY_CRATE_EVENT.equals(eventType))
|
||||
{
|
||||
processInventoryLoot(eventType, lootRecordType, metadata, event.getItemContainer(), Collections.emptyList());
|
||||
resetEvent();
|
||||
@@ -876,6 +880,10 @@ public class LootTrackerPlugin extends Plugin
|
||||
setEvent(LootRecordType.EVENT, itemManager.getItemComposition(event.getId()).getName());
|
||||
takeInventorySnapshot();
|
||||
break;
|
||||
case ItemID.SUPPLY_CRATE_24884:
|
||||
setEvent(LootRecordType.EVENT, MAHOGANY_CRATE_EVENT, client.getBoostedSkillLevel(Skill.CONSTRUCTION));
|
||||
takeInventorySnapshot();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,6 +362,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
swap("wear", "teleport", config::swapTeleportItem);
|
||||
swap("wield", "teleport", config::swapTeleportItem);
|
||||
swap("wield", "invoke", config::swapTeleportItem);
|
||||
swap("wear", "teleports", config::swapTeleportItem);
|
||||
|
||||
swap("wear", "farm teleport", () -> config.swapArdougneCloakMode() == ArdougneCloakMode.FARM);
|
||||
swap("wear", "monastery teleport", () -> config.swapArdougneCloakMode() == ArdougneCloakMode.MONASTERY);
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
private static final Pattern BOSSKILL_MESSAGE_PATTERN = Pattern.compile("Your (.+) kill count is: <col=ff0000>(\\d+)</col>.");
|
||||
private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+?\\(((?:\\d+,?)+) coins\\))(?:</col>)?");
|
||||
private static final Pattern UNTRADEABLE_DROP_PATTERN = Pattern.compile(".*Untradeable drop: ([^<>]+)(?:</col>)?");
|
||||
private static final Pattern DUEL_END_PATTERN = Pattern.compile("You have now (won|lost) ([0-9]+) duels?\\.");
|
||||
private static final Pattern DUEL_END_PATTERN = Pattern.compile("You have now (won|lost) ([0-9,]+) duels?\\.");
|
||||
private static final Pattern QUEST_PATTERN_1 = Pattern.compile(".+?ve\\.*? (?<verb>been|rebuilt|.+?ed)? ?(?:the )?'?(?<quest>.+?)'?(?: [Qq]uest)?[!.]?$");
|
||||
private static final Pattern QUEST_PATTERN_2 = Pattern.compile("'?(?<quest>.+?)'?(?: [Qq]uest)? (?<verb>[a-z]\\w+?ed)?(?: f.*?)?[!.]?$");
|
||||
private static final ImmutableList<String> RFD_TAGS = ImmutableList.of("Another Cook", "freed", "defeated", "saved");
|
||||
@@ -482,7 +482,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
if (m.find())
|
||||
{
|
||||
String result = m.group(1);
|
||||
String count = m.group(2);
|
||||
String count = m.group(2).replace(",", "");
|
||||
String fileName = "Duel " + result + " (" + count + ")";
|
||||
takeScreenshot(fileName, SD_DUELS);
|
||||
}
|
||||
|
||||
@@ -324,29 +324,29 @@ public class ChatCommandsPluginTest
|
||||
@Test
|
||||
public void testDuelArenaWin()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0);
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 1,909 duels.", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena wins", 27);
|
||||
chatMessageEvent = new ChatMessage(null, TRADE, "", "You have lost 1,999 duels.", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena wins", 1909);
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena win streak", 1);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena losses", 1999);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuelArenaWin2()
|
||||
public void testDuelArenaLoss()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0);
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 1,909 duels.", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena wins", 22);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuelArenaLose()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0);
|
||||
chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 1999 duels.", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena losses", 999);
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena wins", 1909);
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "duel arena losses", 1999);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.function.Consumer;
|
||||
import javax.inject.Inject;
|
||||
import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
|
||||
import static net.runelite.api.ChatMessageType.TRADE;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.VarClientStr;
|
||||
@@ -60,6 +61,7 @@ import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
@@ -135,6 +137,7 @@ public class ScreenshotPluginTest
|
||||
when(screenshotConfig.valuableDropThreshold()).thenReturn(1000);
|
||||
when(screenshotConfig.screenshotUntradeableDrop()).thenReturn(true);
|
||||
when(screenshotConfig.screenshotCollectionLogEntries()).thenReturn(true);
|
||||
when(screenshotConfig.screenshotDuels()).thenReturn(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -424,4 +427,32 @@ public class ScreenshotPluginTest
|
||||
|
||||
verifyNoMoreInteractions(drawManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuelWin()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 1,909 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(any(Consumer.class));
|
||||
|
||||
chatMessageEvent = new ChatMessage(null, TRADE, "", "You have lost 145 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verifyNoMoreInteractions(drawManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuelLoss()
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 1,909 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(drawManager, never()).requestNextFrameListener(any(Consumer.class));
|
||||
|
||||
chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 1,909 duels.", null, 0);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(any(Consumer.class));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user