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 ad0e3a0727..006c8c7700 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
@@ -92,7 +92,7 @@ public class ChatCommandsPlugin extends Plugin
{
private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (.+) (?:kill|harvest|lap|completion) count is:
(\\d+)");
private static final Pattern RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: (\\d+)");
- private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)");
+ private static final Pattern RAIDS_PB_PATTERN = Pattern.compile("Congratulations - your raid is complete!
Team size: (?:[0-9]+ players|Solo) Duration: ([0-9:]+) \\(new personal best\\)");
private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: (\\d+)");
private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: (\\d+)");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: [0-9:]+\\. Personal best: ([0-9:]+)");
@@ -100,7 +100,9 @@ public class ChatCommandsPlugin extends Plugin
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 ADVENTURE_LOG_TITLE_PATTERN = Pattern.compile("The Exploits of (.+)");
- private static final Pattern ADVENTURE_LOG_PB_PATTERN = Pattern.compile("([a-zA-Z]+(?: [a-zA-Z]+)*) Fastest (?:kill|run): ([0-9:]+)");
+ private static final Pattern ADVENTURE_LOG_COX_PB_PATTERN = Pattern.compile("Fastest (?:kill|run)(?: - \\(Team size: (?:[0-9]+ players|Solo)\\))?: ([0-9:]+)");
+ private static final Pattern ADVENTURE_LOG_BOSS_PB_PATTERN = Pattern.compile("[a-zA-Z]+(?: [a-zA-Z]+)*");
+ 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 String TOTAL_LEVEL_COMMAND_STRING = "!total";
private static final String PRICE_COMMAND_STRING = "!price";
@@ -350,7 +352,7 @@ public class ChatCommandsPlugin extends Plugin
matchPb(matcher);
}
- matcher = RAIDS_DURATION_PATTERN.matcher(message);
+ matcher = RAIDS_PB_PATTERN.matcher(message);
if (matcher.find())
{
matchPb(matcher);
@@ -450,9 +452,28 @@ public class ChatCommandsPlugin extends Plugin
Matcher mCounterText = ADVENTURE_LOG_PB_PATTERN.matcher(counterText);
while (mCounterText.find())
{
- String bossName = mCounterText.group(1);
- String pbTime = mCounterText.group(2);
- setPb(longBossName(bossName), timeStringToSeconds(pbTime));
+ String bossName = longBossName(mCounterText.group(1));
+ if (bossName.equalsIgnoreCase("chambers of xeric") ||
+ bossName.equalsIgnoreCase("chambers of xeric challenge mode"))
+ {
+ Matcher mCoxRuns = ADVENTURE_LOG_COX_PB_PATTERN.matcher(mCounterText.group());
+ int bestPbTime = Integer.MAX_VALUE;
+ while (mCoxRuns.find())
+ {
+ bestPbTime = Math.min(timeStringToSeconds(mCoxRuns.group(1)), bestPbTime);
+ }
+ // So we don't reset people's already saved PB's if they had one before the update
+ int currentPb = getPb(bossName);
+ if (currentPb == 0 || currentPb > bestPbTime)
+ {
+ setPb(bossName, bestPbTime);
+ }
+ }
+ else
+ {
+ String pbTime = mCounterText.group(2);
+ setPb(bossName, timeStringToSeconds(pbTime));
+ }
}
}
}
@@ -1556,6 +1577,7 @@ public class ChatCommandsPlugin extends Plugin
case "chambers cm":
case "olm cm":
case "raids cm":
+ case "chambers of xeric - challenge mode":
return "Chambers of Xeric Challenge Mode";
// tob
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 f0b3954bfa..905d90ae29 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
@@ -368,7 +368,7 @@ public class ChatCommandsPluginTest
@Test
public void testCoXKill()
{
- ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete! Duration: 37:04", null, 0);
+ ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 4 players Duration: 37:04 (new personal best)>", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 51.", null, 0);
@@ -383,7 +383,7 @@ public class ChatCommandsPluginTest
{
when(configManager.getConfiguration(anyString(), anyString(), any())).thenReturn(2224);
- ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete! Duration: 1:45:04", null, 0);
+ ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 3 players Duration: 37:10 (new personal best)", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0);
@@ -405,6 +405,7 @@ public class ChatCommandsPluginTest
when(advLogWidget.getChild(ChatCommandsPlugin.ADV_LOG_EXPLOITS_TEXT_INDEX)).thenReturn(advLogExploitsTextWidget);
when(advLogExploitsTextWidget.getText()).thenReturn("The Exploits of " + PLAYER_NAME);
when(client.getWidget(WidgetInfo.ADVENTURE_LOG)).thenReturn(advLogWidget);
+ when(configManager.getConfiguration(anyString(), anyString(), any())).thenReturn(2224);
WidgetLoaded advLogEvent = new WidgetLoaded();
advLogEvent.setGroupId(ADVENTURE_LOG_ID);
@@ -425,9 +426,10 @@ public class ChatCommandsPluginTest
"Fastest kill: 2:49
Alchemical Hydra
Fastest kill: -" +
"
Hespori
Fastest kill: 0:57
Nightmare
" +
"Fastest kill: 3:30
The Gauntlet
Fastest run: -" +
- "
The Corrupted Gauntlet
Fastest run: -
Fragment of Seren
" +
- "Fastest kill: -
Barbarian Assault
High-level gambles: " +
- "15
Fremennik spirits rested: 0";
+ "
The Corrupted Gauntlet
Fastest run: -
Fragment of Seren
Fastest kill: -" +
+ "
Chambers of Xeric
Fastest run - (Team size: 4 players): 24:17" +
+ "
Chambers of Xeric - Challenge mode
Fastest run - (Team size: Solo): 22:15" +
+ "
Barbarian Assault
High-level gambles: 0
Fremennik spirits rested: 0";
Widget countersPage = mock(Widget.class);
when(countersPage.getText()).thenReturn(COUNTER_TEXT);
@@ -444,6 +446,8 @@ public class ChatCommandsPluginTest
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(2 * 60 + 49));
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("hespori"), eq(57));
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("nightmare"), eq(3 * 60 + 30));
+ verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), eq(24 * 60 + 17));
+ verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric challenge mode"), eq(22 * 60 + 15));
}
@Test
@@ -478,9 +482,10 @@ public class ChatCommandsPluginTest
"Fastest kill: -
Alchemical Hydra
Fastest kill: -" +
"
Hespori
Fastest kill: 1:42
Nightmare
" +
"Fastest kill: -
The Gauntlet
Fastest run: -" +
- "
The Corrupted Gauntlet
Fastest run: -
Fragment of Seren
" +
- "Fastest kill: -
Barbarian Assault
High-level gambles: " +
- "0
Fremennik spirits rested: 0";
+ "
The Corrupted Gauntlet
Fastest run: -
Fragment of Seren
Fastest kill: -" +
+ "
Chambers of Xeric
Fastest run - (Team size: Solo): 21:23
Fastest run - (Team size: 3 players): 27:16" +
+ "
Chambers of Xeric - Challenge mode
Fastest run - (Team size: Solo): 34:30
Fastest run - (Team size: 4 players): 21:26" +
+ "
Barbarian Assault
High-level gambles: 0
Fremennik spirits rested: 0";
Widget countersPage = mock(Widget.class);
when(countersPage.getText()).thenReturn(COUNTER_TEXT);
@@ -495,6 +500,8 @@ public class ChatCommandsPluginTest
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(2 * 60 + 55));
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("vorkath"), eq(1 * 60 + 37));
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("hespori"), eq(1 * 60 + 42));
+ verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), eq(21 * 60 + 23));
+ verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric challenge mode"), eq(21 * 60 + 26));
}
@Test