From 48e85f9790a4408eaff0fc70041e5353b951ef8c Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Tue, 2 Jan 2024 23:08:15 +0100 Subject: Backend: Add Dark Auction as IslandType and fix IslandType detection for dungeons (#823) Added Dark Auction as IslandType and fix IslandType detection for dungeons. #823 --- src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 12 +++++++----- src/main/java/at/hannibal2/skyhanni/data/IslandType.kt | 3 ++- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index b92647b9a..60630a675 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraft.client.Minecraft @@ -25,9 +26,10 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent import kotlin.concurrent.thread class HypixelData { - // TODO USE SH-REPO - private val tabListProfilePattern = "§e§lProfile: §r§a(?.*)".toPattern() - private val lobbyTypePattern = "(?.*lobby)\\d+".toPattern() + private val group = RepoPattern.group("data.hypixeldata") + private val tabListProfilePattern by group.pattern("tablistprofile", "§e§lProfile: §r§a(?.*)") + private val lobbyTypePattern by group.pattern("lobbytype", "(?.*lobby)\\d+") + private val islandNamePattern by group.pattern("islandname", "§b§l(Area|Dungeon): §r§7(?.*)") private var lastLocRaw = 0L @@ -209,8 +211,8 @@ class HypixelData { var newIsland = "" var guesting = false for (line in TabListData.getTabList()) { - if (line.startsWith("§b§lArea: ")) { - newIsland = line.split(": ")[1].removeColor() + islandNamePattern.matchMatcher(line) { + newIsland = group("island") } if (line == " Status: §r§9Guest") { guesting = true diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt index 7e1ac4159..aa942f5bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt @@ -12,6 +12,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") { CATACOMBS("Catacombs", "dungeon"), HUB("Hub", "village"), + DARK_AUCTION("Dark Auction"), THE_FARMING_ISLANDS("The Farming Islands"), CRYSTAL_HOLLOWS("Crystal Hollows"), THE_PARK("The Park", "floating_islands_1"), @@ -20,7 +21,7 @@ enum class IslandType(val displayName: String, val modeName: String = "null") { GARDEN("Garden"), GARDEN_GUEST("Garden Guest"), SPIDER_DEN("Spider's Den"), - WINTER("Jerry's Workshop"), //todo confirm + WINTER("Jerry's Workshop"), THE_RIFT("The Rift"), NONE(""), diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index bda72e394..ce3c07d90 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -527,7 +527,7 @@ object LorenzUtils { && tileSign.signText[3].unformattedText.removeColor() == "speed cap!") } - fun IslandType.isInIsland() = inSkyBlock && (skyBlockIsland == this || this == IslandType.CATACOMBS && inDungeons) + fun IslandType.isInIsland() = inSkyBlock && skyBlockIsland == this fun MutableMap.addOrPut(key: K, number: Int): Int { val currentValue = this[key] ?: 0 -- cgit