diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java index 6a44468381..106f64cc75 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java @@ -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.", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java index a1fd31954e..42aabfcef3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java @@ -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; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java index 6b2f3edab4..ed180fe59e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java @@ -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; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java index 686cecbf2a..b3d4d1c801 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java @@ -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()); } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java index 0cb6174d6e..4f2bc0b18d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java @@ -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); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 2a3c541bd1..b15cebb7e4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -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: [0-9:.]+\\. Personal best: (?[0-9:]+(?:\\.[0-9]+)?)"); private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)(?:(?:Fight |Lap |Challenge |Corrupted challenge )?duration:|Subdued in) [0-9:.]+\\. Personal best: (?:)?(?[0-9:]+(?:\\.[0-9]+)?)"); private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)(?:(?:Fight |Lap |Challenge |Corrupted challenge )?duration:|Subdued in) (?[0-9:]+(?:\\.[0-9]+)?) \\(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 (?\\d) time: (?[0-9:]+(?:\\.[0-9]+)?)(?: \\(new personal best\\)|. Personal best: (?[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); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 5519be978a..b29c67be58 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -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 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; } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 9d1ebc4acb..14cfb0bf75 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -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); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java index c64e7c06b9..160e06518e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java @@ -109,7 +109,7 @@ public class ScreenshotPlugin extends Plugin private static final Pattern BOSSKILL_MESSAGE_PATTERN = Pattern.compile("Your (.+) kill count is: (\\d+)."); private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+?\\(((?:\\d+,?)+) coins\\))(?:)?"); private static final Pattern UNTRADEABLE_DROP_PATTERN = Pattern.compile(".*Untradeable drop: ([^<>]+)(?:)?"); - 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\\.*? (?been|rebuilt|.+?ed)? ?(?:the )?'?(?.+?)'?(?: [Qq]uest)?[!.]?$"); private static final Pattern QUEST_PATTERN_2 = Pattern.compile("'?(?.+?)'?(?: [Qq]uest)? (?[a-z]\\w+?ed)?(?: f.*?)?[!.]?$"); private static final ImmutableList 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); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 5fe725c00f..ab2ec35046 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -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 diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java index 47b6f14fca..9ded0bfe8c 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java @@ -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)); + } }