From 54935e6e6e17f9f7ca54b3bef53b24f65278e86d Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 23 Apr 2023 12:21:34 +0200 Subject: Dungeon puzzle widget now works as intended. --- README.md | 1 - .../java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java | 4 ++++ .../skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eac4ec16..4b28a2e8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ This will be merged into Skyblocker when ready. It's not at the moment, but you ### Known Issues * Relevant for players: * Crimson Isle is not yet supported. (Getting Combat 24 is just... oof) - * Dungeon puzzles HUD isn't working correctly * Minor visual bugs when using ImmediatelyFast * Relevant for devs: * Scraping the entire player list every frame isn't ideal. (possible optimisation for later) diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java index 8cd77ac2..4a30cf0f 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/util/StrMan.java @@ -44,6 +44,10 @@ public class StrMan { return null; } String str = txt.getString(); + if (str.length() == 0) { + return null; + } + Matcher m = p.matcher(str); if (!m.matches()) { LOGGER.error("ERROR: Regex {} failed for input \"{}\"", p.pattern(), str); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java index 906d449b..3aba547c 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/DungeonPuzzleWidget.java @@ -24,9 +24,9 @@ public class DungeonPuzzleWidget extends Widget { // match a puzzle entry // group 1: name // group 2: status - // yes, that " ?" is needed. + // " ?.*" to diescard the solver's name if present // the teleport maze has a trailing whitespace that messes with the regex - private static final Pattern PUZZLE_PATTERN = Pattern.compile(" (.*): \\[(.*)\\] ?"); + private static final Pattern PUZZLE_PATTERN = Pattern.compile(" (.*): \\[(.*)\\] ?.*"); public DungeonPuzzleWidget(List list) { super(TITLE, Formatting.DARK_PURPLE.getColorValue()); @@ -43,6 +43,9 @@ public class DungeonPuzzleWidget extends Widget { IcoTextComponent itc = new IcoTextComponent(Ico.SIGN, t); this.addComponent(itc); pos++; + // code points for puzzle status chars unsolved and solved: 10022, 10004 + // not sure which one is which + // still need to find out codepoint for the puzzle failed char } this.pack(); -- cgit