From 62a5925ec28fa0f41cd8324477d4a3f64caa9c2e Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Mon, 15 Apr 2024 19:00:33 +0200 Subject: Improvementt: Add Dungeon Room Id to Lobby Code (#1428) --- .../java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon') diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index fca4e0668..264f31bf2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -58,6 +58,10 @@ object DungeonAPI { "complete", "§.\\s+§.§.(?:The|Master Mode) Catacombs §.§.- §.§.(?:Floor )?(?M?[IV]{1,3}|Entrance)" ) + private val dungeonRoomPattern by patternGroup.pattern( + "room", + "§7\\d+\\/\\d+\\/\\d+ §\\w+ (?[\\w,-]+)" + ) fun inDungeon() = IslandType.CATACOMBS.isInIsland() @@ -102,7 +106,11 @@ object DungeonAPI { return DungeonFloor.valueOf(floor.replace("M", "F")) } - fun getRoomID() = ScoreboardData.sidebarLines.firstOrNull()?.removeColor()?.split(" ")?.getOrNull(2) + fun getRoomID(): String? { + return ScoreboardData.sidebarLinesFormatted.matchFirst(dungeonRoomPattern) { + group("roomId") + } + } fun getColor(level: Int): String = when { level >= 50 -> "§c§l" -- cgit