From 5fb97e2b6daf002c9b695b79ea571ccc32317098 Mon Sep 17 00:00:00 2001 From: Jonathan Pritchard Date: Tue, 23 Mar 2021 07:28:05 -0700 Subject: [PATCH] chat commands: fix hs kc patterns to match values greater than 999 --- .../client/plugins/chatcommands/ChatCommandsPlugin.java | 8 ++++---- .../plugins/chatcommands/ChatCommandsPluginTest.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) 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 e9c2f0c174..61b202bc05 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 @@ -110,8 +110,8 @@ public class ChatCommandsPlugin extends Plugin private static final Pattern ADVENTURE_LOG_PB_PATTERN = Pattern.compile("(" + ADVENTURE_LOG_BOSS_PB_PATTERN + "(?: - " + ADVENTURE_LOG_BOSS_PB_PATTERN + ")*) (?:" + ADVENTURE_LOG_COX_PB_PATTERN + "( )*)+"); private static final Pattern HS_PB_PATTERN = Pattern.compile("Floor (?\\d) time: (?[0-9:]+)(?: \\(new personal best\\)|. Personal best: (?[0-9:]+))" + "(?:
Overall time: (?[0-9:]+)(?: \\(new personal best\\)|. Personal best: (?[0-9:]+)))?"); - private static final Pattern HS_KC_FLOOR_PATTERN = Pattern.compile("You have completed Floor (\\d) of the Hallowed Sepulchre! Total completions: (\\d+)\\."); - private static final Pattern HS_KC_GHC_PATTERN = Pattern.compile("You have opened the Grand Hallowed Coffin (\\d+) times?!"); + private static final Pattern HS_KC_FLOOR_PATTERN = Pattern.compile("You have completed Floor (\\d) of the Hallowed Sepulchre! Total completions: ([0-9,]+)\\."); + private static final Pattern HS_KC_GHC_PATTERN = Pattern.compile("You have opened the Grand Hallowed Coffin ([0-9,]+) times?!"); private static final String TOTAL_LEVEL_COMMAND_STRING = "!total"; private static final String PRICE_COMMAND_STRING = "!price"; @@ -394,14 +394,14 @@ public class ChatCommandsPlugin extends Plugin if (matcher.find()) { int floor = Integer.parseInt(matcher.group(1)); - int kc = Integer.parseInt(matcher.group(2)); + int kc = Integer.parseInt(matcher.group(2).replaceAll(",", "")); setKc("Hallowed Sepulchre Floor " + floor, kc); } matcher = HS_KC_GHC_PATTERN.matcher(message); if (matcher.find()) { - int kc = Integer.parseInt(matcher.group(1)); + int kc = Integer.parseInt(matcher.group(1).replaceAll(",", "")); setKc("Hallowed Sepulchre", kc); } 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 9b5eaea2a0..328bb5e715 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 @@ -635,19 +635,19 @@ public class ChatCommandsPluginTest @Test public void testHsFloorKc() { - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have completed Floor 5 of the Hallowed Sepulchre! Total completions: 81.", null, 0); + ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have completed Floor 5 of the Hallowed Sepulchre! Total completions: 1,114.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre floor 5", 81); + verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre floor 5", 1114); } @Test public void testHsGhcKc() { - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have opened the Grand Hallowed Coffin 36 times!", null, 0); + ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have opened the Grand Hallowed Coffin 1,542 times!", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre", 36); + verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre", 1542); } @Test