Skip to content

Commit

Permalink
feat: add herbiboar to kill count notifier (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanthdavis authored Nov 22, 2024
1 parent 2e2a759 commit 2a8c4a1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Unreleased

- Minor: Add herbiboar support to kill count notifier. (#602)
- Minor: Enable the leagues notifier again. (#597)
- Bugfix: Identify all CoX members from raiding party widget. (#600)
- Dev: Clarify json example for kill counter notifier to include `time` and `isPersonalBest`. (#601)
Expand Down
2 changes: 1 addition & 1 deletion docs/json-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ JSON for Kill Count Notifications:
}
```

When an associated duration is not found, `extra.time` is reported as zero seconds and `extra.isPersonalBest` is not populated.
When an associated duration is not found, `extra.time` and `extra.isPersonalBest` are not populated.

Note: when `boss` is `Penance Queen`, `count` refers to the high level gamble count, rather than kill count.

Expand Down
1 change: 1 addition & 0 deletions src/main/java/dinkplugin/VersionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@ public static Version of(@NotNull String version) {
register("1.10.2", "Chat notifier can read commands and RL notifications");
register("1.10.5", "Pet notifications now report rarity and luck");
register("1.10.12", "Rarity is now reported for notable pickpocket loot");
register("1.10.14", "Kill count notifier now triggers for Herbiboar");
}
}
6 changes: 5 additions & 1 deletion src/main/java/dinkplugin/notifiers/KillCountNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class KillCountNotifier extends BaseNotifier {
public static final int KILL_COUNT_SPAM_FILTER = 4930;
public static final String SPAM_WARNING = "Kill Count Notifier requires disabling the in-game setting: Filter out boss kill-count with spam-filter";

private static final Pattern PRIMARY_REGEX = Pattern.compile("Your (?<key>.+)\\s(?<type>kill|chest|completion)\\s?count is: (?<value>[\\d,]+)\\b", Pattern.CASE_INSENSITIVE);
private static final Pattern PRIMARY_REGEX = Pattern.compile("Your (?<key>.+)\\s(?<type>kill|chest|completion|harvest)\\s?count is: (?<value>[\\d,]+)\\b", Pattern.CASE_INSENSITIVE);
private static final Pattern SECONDARY_REGEX = Pattern.compile("Your (?:completed|subdued) (?<key>.+) count is: (?<value>[\\d,]+)\\b");
private static final Pattern TIME_REGEX = Pattern.compile("(?:Duration|time|Subdued in):? (?<time>[\\d:]+(.\\d+)?)\\.?", Pattern.CASE_INSENSITIVE);

Expand Down Expand Up @@ -245,6 +245,10 @@ private static String parsePrimaryBoss(String boss, String type) {
return KillCountService.CG_BOSS;
return null;

case "harvest":
if (KillCountService.HERBIBOAR.equalsIgnoreCase(boss))
return KillCountService.HERBIBOAR;

case "kill":
return boss;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dinkplugin/util/KillCountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class KillCountService {

public static final String GAUNTLET_NAME = "Gauntlet", GAUNTLET_BOSS = "Crystalline Hunllef";
public static final String CG_NAME = "Corrupted Gauntlet", CG_BOSS = "Corrupted Hunllef";
public static final String HERBIBOAR = "Herbiboar";
public static final String TOA = "Tombs of Amascut";
public static final String TOB = "Theatre of Blood";
public static final String COX = "Chambers of Xeric";
Expand Down Expand Up @@ -146,7 +147,7 @@ public void onGameMessage(String message) {
// herbiboar count (for pet tracking)
if (message.startsWith(HERBIBOAR_PREFIX)) {
int harvestCount = Integer.parseInt(message.substring(HERBIBOAR_PREFIX.length(), message.length() - 1).replace(",", ""));
killCounts.put("Herbiboar", harvestCount);
killCounts.put(HERBIBOAR, harvestCount);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/dinkplugin/notifiers/MatchersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ void killCountRegexFindsMatch(String message, Pair<String, Integer> expected) {
@ParameterizedTest(name = "Kill count message should not trigger on: {0}")
@ValueSource(
strings = {
"Forsen: forsen",
"Your heriboar harvest count is: 69."
"Forsen: forsen"
}
)
void killCountRegexDoesNotMatch(String message) {
Expand All @@ -130,6 +129,7 @@ public Stream<? extends Arguments> provideArguments(ExtensionContext context) {

// skilling special case
Arguments.of("Your subdued Wintertodt count is: 359", Pair.of("Wintertodt", 359)),
Arguments.of("Your herbiboar harvest count is: 2332.", Pair.of("Herbiboar", 2332)),

// minigame special cases
Arguments.of("Your Barrows chest count is: 268", Pair.of("Barrows", 268)),
Expand Down Expand Up @@ -169,7 +169,7 @@ void gambleRegexDoesNotMatch(String message) {

private static class GambleProvider implements ArgumentsProvider {
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) throws Exception {
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
return Stream.of(
Arguments.of("Magic seed! High level gamble count: 1.", new GambleNotifier.ParsedData("Magic seed", 1, null, 1)),
Arguments.of("Limpwurt root (x 37)! High level gamble count: 65.", new GambleNotifier.ParsedData("Limpwurt root", 37, null, 65)),
Expand Down

0 comments on commit 2a8c4a1

Please sign in to comment.