From 5c77312edff517b5ed565cbe1328518c4a4c3b01 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 23 Mar 2022 21:34:28 -0400 Subject: [PATCH] chat commands: add gotr kc --- .../plugins/chatcommands/ChatCommandsPlugin.java | 13 +++++++++++++ .../chatcommands/ChatCommandsPluginTest.java | 9 +++++++++ 2 files changed, 22 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 3d86d52ad9..981b2f4328 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 @@ -123,6 +123,7 @@ public class ChatCommandsPlugin extends Plugin 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 Pattern COLLECTION_LOG_ITEM_PATTERN = Pattern.compile("New item added to your collection log: (.*)"); + private static final Pattern GUARDIANS_OF_THE_RIFT_PATTERN = Pattern.compile("Amount of Rifts you have closed: ([0-9,]+)."); private static final String TOTAL_LEVEL_COMMAND_STRING = "!total"; private static final String PRICE_COMMAND_STRING = "!price"; @@ -538,6 +539,13 @@ public class ChatCommandsPlugin extends Plugin } } } + + matcher = GUARDIANS_OF_THE_RIFT_PATTERN.matcher(message); + if (matcher.find()) + { + int kc = Integer.parseInt(matcher.group(1)); + setKc("Guardians of the Rift", kc); + } } @VisibleForTesting @@ -2152,6 +2160,11 @@ public class ChatCommandsPlugin extends Plugin case "jad 6": return "TzHaar-Ket-Rak's Sixth Challenge"; + // Guardians of the Rift + case "gotr": + case "runetodt": + return "Guardians of the Rift"; + default: return WordUtils.capitalize(boss); } 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 42d5b729c5..e95a3fc267 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 @@ -1074,4 +1074,13 @@ public class ChatCommandsPluginTest verify(configManager).setRSProfileConfiguration("personalbest", "tempoross", 234.0); verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 1360.0); // the lowest time } + + @Test + public void testGuardiansOfTheRift() + { + ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Amount of Rifts you have closed: 7.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessage); + + verify(configManager).setRSProfileConfiguration("killcount", "guardians of the rift", 7); + } }