Skip to content

Commit

Permalink
Backend: Add Dark Auction as IslandType and fix IslandType detection …
Browse files Browse the repository at this point in the history
…for dungeons (hannibal002#823)

Added Dark Auction as IslandType and fix IslandType detection for dungeons. hannibal002#823
  • Loading branch information
j10a1n15 authored Jan 2, 2024
1 parent e44ac39 commit 48e85f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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(""),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 48e85f9

Please sign in to comment.