diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-07 01:58:03 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-07 01:58:03 +0100 |
commit | 87520e30a3627bcfca4ebde7dfce84f4af346857 (patch) | |
tree | 01fc07e98099ca8a86d4d71d09f2cee9a41a5a01 /src/main | |
parent | 1db51193a1a1475ef2b0b2949d224e38ed06962c (diff) | |
download | skyhanni-87520e30a3627bcfca4ebde7dfce84f4af346857.tar.gz skyhanni-87520e30a3627bcfca4ebde7dfce84f4af346857.tar.bz2 skyhanni-87520e30a3627bcfca4ebde7dfce84f4af346857.zip |
Add support for ironman, stranded and bingo.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 55 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 6 |
2 files changed, 48 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 53a1286d3..8026ecac8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -19,6 +19,13 @@ class HypixelData { var skyblock = false var skyBlockIsland: String = "" + //Ironman, Stranded and Bingo + var noTrade = false + + var ironman = false + var stranded = false + var bingo = false + fun readSkyBlockArea(): String { for (line in ScoreboardData.sidebarLinesFormatted()) { if (line.startsWith(" §7⏣ ")) { @@ -28,7 +35,6 @@ class HypixelData { return "invalid" } - } var loggerIslandChange = LorenzLogger("debug/island_change") @@ -57,7 +63,6 @@ class HypixelData { if (!hypixel) return val message = event.message.removeColor().lowercase() - if (message.startsWith("your profile was changed to:")) { val stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim() ProfileJoinEvent(stripped).postAndCatch() @@ -65,7 +70,6 @@ class HypixelData { if (message.startsWith("you are playing on profile:")) { val stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim() ProfileJoinEvent(stripped).postAndCatch() - } } @@ -80,13 +84,42 @@ class HypixelData { if (tick % 5 != 0) return - val newState = checkScoreboard() - if (newState) { + val inSkyBlock = checkScoreboard() + if (inSkyBlock) { checkIsland() + checkSidebar() } - if (newState == skyblock) return - skyblock = newState + if (inSkyBlock == skyblock) return + skyblock = inSkyBlock + } + + private fun checkSidebar() { + ironman = false + stranded = false + bingo = false + + for (line in ScoreboardData.sidebarLinesFormatted()) { + when (line) { + " §7Ⓑ §7Bingo", // No Rank + " §bⒷ §bBingo", // Rank 1 + " §9Ⓑ §9Bingo", // Rank 2 + " §5Ⓑ §5Bingo", // Rank 3 + " §6Ⓑ §6Bingo", // Rank 4 + -> { + bingo = true + } + + // TODO implemennt stranded check + + " §7♲ §7Ironman" -> { + ironman = true + } + + } + } + + noTrade = ironman || stranded || bingo } private fun checkIsland() { @@ -115,12 +148,8 @@ class HypixelData { val minecraft = Minecraft.getMinecraft() val world = minecraft.theWorld ?: return false - val sidebarObjective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false - - val displayName = sidebarObjective.displayName - + val objective = world.scoreboard.getObjectiveInDisplaySlot(1) ?: return false + val displayName = objective.displayName return displayName.removeColor().contains("SKYBLOCK") - } - }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index e37aedbc6..f6e2e319c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -33,6 +33,12 @@ object LorenzUtils { val inKuudraFight: Boolean get() = skyBlockIsland == "Instanced" + val noTradeMode: Boolean + get() = HypixelData.noTrade + + val isBingoProfile: Boolean + get() = inSkyblock && HypixelData.bingo + const val DEBUG_PREFIX = "[SkyHanni Debug] §7" private val log = LorenzLogger("chat/mod_sent") |