aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky
diff options
context:
space:
mode:
authorRime <81419447+Emirlol@users.noreply.github.com>2024-01-18 13:28:04 +0300
committerRime <81419447+Emirlol@users.noreply.github.com>2024-01-21 09:37:49 +0300
commit2bfe8c5d5d9c39f270984e1f2d511c67cdc917f9 (patch)
tree3fc031c26cce17fe2300524e41c58cd37e5695f4 /src/main/java/de/hysky
parentd9c69b47127c6aae71333831654402f1924924c8 (diff)
downloadSkyblocker-2bfe8c5d5d9c39f270984e1f2d511c67cdc917f9.tar.gz
Skyblocker-2bfe8c5d5d9c39f270984e1f2d511c67cdc917f9.tar.bz2
Skyblocker-2bfe8c5d5d9c39f270984e1f2d511c67cdc917f9.zip
Check chat messages for dungeon start instead of scoreboard
Diffstat (limited to 'src/main/java/de/hysky')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java26
1 files changed, 14 insertions, 12 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 b27ca660..98d3d79b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
@@ -39,7 +39,6 @@ public class DungeonScore {
private static final Logger LOGGER = LoggerFactory.getLogger("Skyblocker Dungeon Score");
//Scoreboard patterns
private static final Pattern CLEARED_PATTERN = Pattern.compile("Cleared: (?<cleared>\\d+)%.*");
- private static final Pattern DUNGEON_START_PATTERN = Pattern.compile("(?:Auto-closing|Starting) in: \\d:\\d+");
private static final Pattern FLOOR_PATTERN = Pattern.compile(".*?(?=T)The Catacombs \\((?<floor>[EFM]\\D*\\d*)\\)");
//Playerlist patterns
private static final Pattern SECRETS_PATTERN = Pattern.compile("Secrets Found: (?<secper>\\d+\\.?\\d*)%");
@@ -72,10 +71,14 @@ public class DungeonScore {
SkyblockEvents.LEAVE.register(SpiritPetCache::clear);
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> reset());
ClientReceiveMessageEvents.GAME.register((message, overlay) -> {
- if (!Utils.isInDungeons() || !dungeonStarted) return;
+ if (overlay || !Utils.isInDungeons()) return;
String str = message.getString();
- checkMessageForDeaths(str);
- checkMessageForWatcher(str);
+ if (!dungeonStarted) {
+ checkMessageForMort(str);
+ } else {
+ checkMessageForDeaths(str);
+ checkMessageForWatcher(str);
+ }
});
}
@@ -85,10 +88,8 @@ public class DungeonScore {
reset();
return;
}
- if (!dungeonStarted) {
- if (checkIfDungeonStarted()) onDungeonStart();
- return;
- }
+ if (!dungeonStarted) return;
+
score = calculateScore();
if (!sent270 && !sent300 && score >= 270 && score < 300) {
if (SCORE_CONFIG.enableDungeonScore270Message) {
@@ -182,10 +183,6 @@ public class DungeonScore {
return paulScore + cryptsScore + mimicScore;
}
- private static boolean checkIfDungeonStarted() {
- return Utils.STRING_SCOREBOARD.stream().noneMatch(s -> DUNGEON_START_PATTERN.matcher(s).matches());
- }
-
public static boolean isEntityMimic(Entity entity) {
if (!Utils.isInDungeons()) return false;
if (!floorHasMimics) return false;
@@ -325,6 +322,11 @@ public class DungeonScore {
if (message.equals("[BOSS] The Watcher: You have proven yourself. You may pass.")) bloodRoomCompleted = true;
}
+ private static void checkMessageForMort(String message) {
+ if (!message.equals("§e[NPC] §bMort§f: You should find it useful if you get lost.")) return;
+ onDungeonStart();
+ }
+
public static void setCurrentFloor() {
for (String sidebarLine : Utils.STRING_SCOREBOARD) {
Matcher floorMatcher = FLOOR_PATTERN.matcher(sidebarLine);