aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-01-02 23:08:15 +0100
committerGitHub <noreply@github.com>2024-01-02 23:08:15 +0100
commit48e85f9790a4408eaff0fc70041e5353b951ef8c (patch)
treec850e22df56ba5d3a56be11725c46c4454663039 /src/main/java/at/hannibal2/skyhanni
parente44ac393a54019a26d55fa509d84c9ccba0114bf (diff)
downloadskyhanni-48e85f9790a4408eaff0fc70041e5353b951ef8c.tar.gz
skyhanni-48e85f9790a4408eaff0fc70041e5353b951ef8c.tar.bz2
skyhanni-48e85f9790a4408eaff0fc70041e5353b951ef8c.zip
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
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/IslandType.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt2
3 files changed, 10 insertions, 7 deletions
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(?<profile>.*)".toPattern()
- private val lobbyTypePattern = "(?<lobbyType>.*lobby)\\d+".toPattern()
+ private val group = RepoPattern.group("data.hypixeldata")
+ private val tabListProfilePattern by group.pattern("tablistprofile", "§e§lProfile: §r§a(?<profile>.*)")
+ private val lobbyTypePattern by group.pattern("lobbytype", "(?<lobbyType>.*lobby)\\d+")
+ private val islandNamePattern by group.pattern("islandname", "§b§l(Area|Dungeon): §r§7(?<island>.*)")
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 <K> MutableMap<K, Int>.addOrPut(key: K, number: Int): Int {
val currentValue = this[key] ?: 0