From cc8b8c9bcfbd52b0e20237e768d042fd120a5176 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 14 Jun 2020 11:25:07 -0400 Subject: [PATCH] chat commands: add hallowed sepulchre kc --- .../chatcommands/ChatCommandsPlugin.java | 18 ++++++++++++++++++ .../chatcommands/ChatCommandsPluginTest.java | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) 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 93daedf8be..0b129164af 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 @@ -108,6 +108,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 String TOTAL_LEVEL_COMMAND_STRING = "!total"; private static final String PRICE_COMMAND_STRING = "!price"; @@ -394,6 +396,21 @@ public class ChatCommandsPlugin extends Plugin } } + matcher = HS_KC_FLOOR_PATTERN.matcher(message); + if (matcher.find()) + { + int floor = Integer.parseInt(matcher.group(1)); + int kc = Integer.parseInt(matcher.group(2)); + setKc("Hallowed Sepulchre Floor " + floor, kc); + } + + matcher = HS_KC_GHC_PATTERN.matcher(message); + if (matcher.find()) + { + int kc = Integer.parseInt(matcher.group(1)); + setKc("Hallowed Sepulchre", kc); + } + lastBossKill = null; } @@ -1647,6 +1664,7 @@ public class ChatCommandsPlugin extends Plugin // Hallowed Sepulchre case "hs": case "sepulchre": + case "ghc": return "Hallowed Sepulchre"; case "hs1": case "hs 1": 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 0ecf43b2d3..5de68a0cb7 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 @@ -648,4 +648,22 @@ public class ChatCommandsPluginTest verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 5", 3 * 60 + 4); verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre", 7 * 60 + 47); } + + @Test + public void testHsFloorKc() + { + ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have completed Floor 5 of the Hallowed Sepulchre! Total completions: 81.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessage); + + verify(configManager).setConfiguration("killcount.adam", "hallowed sepulchre floor 5", 81); + } + + @Test + public void testHsGhcKc() + { + ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have opened the Grand Hallowed Coffin 36 times!", null, 0); + chatCommandsPlugin.onChatMessage(chatMessage); + + verify(configManager).setConfiguration("killcount.adam", "hallowed sepulchre", 36); + } }