aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/dungeon
diff options
context:
space:
mode:
authorRime <81419447+Emirlol@users.noreply.github.com>2024-01-20 18:57:08 +0300
committerRime <81419447+Emirlol@users.noreply.github.com>2024-01-21 09:37:49 +0300
commit4fd8d4f727ce611eb28218e6a47080894a78b7b1 (patch)
tree5ece8b197b3aedce847b86c75bc772f8412e92f6 /src/main/java/de/hysky/skyblocker/skyblock/dungeon
parentac6ac5096bf60c39ddf52bad41a6123afa51b097 (diff)
downloadSkyblocker-4fd8d4f727ce611eb28218e6a47080894a78b7b1.tar.gz
Skyblocker-4fd8d4f727ce611eb28218e6a47080894a78b7b1.tar.bz2
Skyblocker-4fd8d4f727ce611eb28218e6a47080894a78b7b1.zip
Fix mimic messages not increasing score when mimic filter is disabled
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dungeon')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
index cb834e7f..10605d8b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
@@ -48,6 +48,7 @@ public class DungeonScore {
private static final Pattern COMPLETED_ROOMS_PATTERN = Pattern.compile(" *Completed Rooms: (?<rooms>\\d+)");
//Chat patterns
private static final Pattern DEATHS_PATTERN = Pattern.compile(" \\u2620 (?<whodied>\\S+) .*");
+ private static final Pattern MIMIC_PATTERN = Pattern.compile(".*?(?:Mimic dead!?|Mimic Killed!|\\$SKYTILS-DUNGEON-SCORE-MIMIC\\$|\\Q" + MIMIC_MESSAGE_CONFIG.mimicMessage + "\\E)$");
//Other patterns
private static final Pattern MIMIC_FLOORS_PATTERN = Pattern.compile("[FM][67]");
@@ -80,6 +81,7 @@ public class DungeonScore {
} else {
checkMessageForDeaths(str);
checkMessageForWatcher(str);
+ if (floorHasMimics) checkMessageForMimic(str); //Only called when the message is not cancelled & isn't on the action bar, complementing MimicFilter
}
});
ClientReceiveMessageEvents.GAME_CANCELED.register((message, overlay) -> {
@@ -210,8 +212,8 @@ public class DungeonScore {
mimicKilled = true;
}
- public static void setMimicKilled(boolean state) {
- mimicKilled = state;
+ public static void onMimicKill() {
+ mimicKilled = true;
}
//This is not very accurate at the beginning of the dungeon since clear percentage is rounded to the closest integer, so at lower percentages its effect on the result is quite high.
@@ -330,6 +332,11 @@ public class DungeonScore {
onDungeonStart();
}
+ private static void checkMessageForMimic(String message) {
+ if (!MIMIC_PATTERN.matcher(message).matches()) return;
+ onMimicKill();
+ }
+
public static void setCurrentFloor() {
for (String sidebarLine : Utils.STRING_SCOREBOARD) {
Matcher floorMatcher = FLOOR_PATTERN.matcher(sidebarLine);