Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend: Add Dark Auction as IslandType and fix IslandType detection for dungeons #823

Merged
merged 7 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading