diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-15 19:00:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 19:00:33 +0200 |
commit | 62a5925ec28fa0f41cd8324477d4a3f64caa9c2e (patch) | |
tree | 1a08cff092f4ad2efa8d660ce1716c079e768233 /src/main/java/at | |
parent | 2df3ef3191c5f98aedb15ebe640230d9400b02e0 (diff) | |
download | skyhanni-62a5925ec28fa0f41cd8324477d4a3f64caa9c2e.tar.gz skyhanni-62a5925ec28fa0f41cd8324477d4a3f64caa9c2e.tar.bz2 skyhanni-62a5925ec28fa0f41cd8324477d4a3f64caa9c2e.zip |
Improvementt: Add Dungeon Room Id to Lobby Code (#1428)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt | 10 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt | 12 |
2 files changed, 13 insertions, 9 deletions
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 )?(?<floor>M?[IV]{1,3}|Entrance)" ) + private val dungeonRoomPattern by patternGroup.pattern( + "room", + "§7\\d+\\/\\d+\\/\\d+ §\\w+ (?<roomId>[\\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" diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 8c1c1afc1..f8b8d5c71 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -524,14 +524,10 @@ private fun getTimeDisplayPair(): List<ScoreboardElementType> { } private fun getLobbyDisplayPair(): List<ScoreboardElementType> { - val lobbyCode = HypixelData.serverId ?: "<hidden>" - return listOf( - if (lobbyCode == "<hidden>") { - "<hidden>" - } else { - "§8$lobbyCode" - } to HorizontalAlignment.LEFT - ) + val lobbyCode = HypixelData.serverId + val roomId = DungeonAPI.getRoomID().let { if (it == null) "" else "§8$it" } + val lobbyDisplay = if (lobbyCode == null) "<hidden>" else "§8$lobbyCode $roomId" + return listOf(lobbyDisplay to HorizontalAlignment.LEFT) } private fun getPowerDisplayPair() = listOf( |