Skip to content

Commit

Permalink
chat commands: add gotr kc
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Mar 24, 2022
1 parent 3f68859 commit 5c77312
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: <col=ff0000>([0-9,]+)</col>\\.");
private static final Pattern HS_KC_GHC_PATTERN = Pattern.compile("You have opened the Grand Hallowed Coffin <col=ff0000>([0-9,]+)</col> 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: <col=ff0000>([0-9,]+)</col>.");

private static final String TOTAL_LEVEL_COMMAND_STRING = "!total";
private static final String PRICE_COMMAND_STRING = "!price";
Expand Down Expand Up @@ -538,6 +539,13 @@ else if (result.equals("were defeated"))
}
}
}

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
Expand Down Expand Up @@ -2152,6 +2160,11 @@ private static String longBossName(String boss)
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1074,4 +1074,13 @@ public void testCounters()
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: <col=ff0000>7</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);

verify(configManager).setRSProfileConfiguration("killcount", "guardians of the rift", 7);
}
}

0 comments on commit 5c77312

Please sign in to comment.