diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-30 15:52:55 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-30 15:52:55 +0100 |
commit | 76df235e2ccc807a83382995763472fac4f171b1 (patch) | |
tree | bb25b04c5fc9351dcba08be1723573bef06fd288 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | 33b5429348dc5f274bf1cfaf530a77343eaf3fb6 (diff) | |
download | skyhanni-76df235e2ccc807a83382995763472fac4f171b1.tar.gz skyhanni-76df235e2ccc807a83382995763472fac4f171b1.tar.bz2 skyhanni-76df235e2ccc807a83382995763472fac4f171b1.zip |
Adding Great Spook support for Non God Pot Effect display.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index b5268a9bc..80e69332e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -34,21 +34,28 @@ class NonGodPotEffectDisplay { private val effectDuration = mutableMapOf<NonGodPotEffect, Timer>() private var display = emptyList<String>() - enum class NonGodPotEffect(val apiName: String, val displayName: String, val isMixin: Boolean = false) { - SMOLDERING("smoldering_polarization", "§aSmoldering Polarization I"), - GLOWY("mushed_glowy_tonic", "§2Mushed Glowy Tonic I"), - WISP("wisp_ice", "§bWisp's Ice-Flavored Water I"), - GOBLIN("goblin_king_scent", "§2King's Scent I"), - - INVISIBILITY("invisibility", "§8Invisibility I"), // when wearing sorrow armor - - REV("ZOMBIE_BRAIN", "§cZombie Brain Mixin", true), - TARA("SPIDER_EGG", "§6Spider Egg Mixin", true), - SVEN("WOLF_FUR", "§bWolf Fur Mixin", true), - VOID("END_PORTAL_FUMES", "§6Ender Portal Fumes", true), - BLAZE("GABAGOEY", "§fGabagoey", true), - - DEEP_TERROR("DEEPTERROR", "§4Deepterror", true), + // TODO move the whole list into the repo + enum class NonGodPotEffect( + val tabListName: String, + val isMixin: Boolean = false, + val inventoryItemName: String = tabListName + ) { + SMOLDERING("§aSmoldering Polarization I"), + GLOWY("§2Mushed Glowy Tonic I"), + WISP("§bWisp's Ice-Flavored Water I"), + GOBLIN("§2King's Scent I"), + + INVISIBILITY("§8Invisibility I"), // when wearing sorrow armor + + REV("§cZombie Brain Mixin", true), + TARA("§6Spider Egg Mixin", true), + SVEN("§bWolf Fur Mixin", true), + VOID("§6Ender Portal Fumes", true), + BLAZE("§fGabagoey", true), + + DEEP_TERROR("§4Deepterror", true), + + GREAT_SPOOK("§fGreat Spook I", inventoryItemName = "§fGreat Spook Potion"), ; } // TODO USE SH-REPO @@ -94,17 +101,16 @@ class NonGodPotEffectDisplay { } private fun update() { - val now = System.currentTimeMillis() if (effectDuration.values.removeIf { it.ended }) { //to fetch the real amount of active pots totalEffectsCount = 0 checkFooter = true } - display = drawDisplay(now) + display = drawDisplay() } - private fun drawDisplay(now: Long): MutableList<String> { + private fun drawDisplay(): MutableList<String> { val newDisplay = mutableListOf<String>() for ((effect, time) in effectDuration.sorted()) { if (time.ended) continue @@ -116,7 +122,7 @@ class NonGodPotEffectDisplay { val format = TimeUtils.formatDuration(remaining.inWholeMilliseconds, TimeUnit.HOUR) val color = colorForTime(remaining) - val displayName = effect.displayName + val displayName = effect.tabListName newDisplay.add("$displayName $color$format") } val diff = totalEffectsCount - effectDuration.size @@ -156,7 +162,7 @@ class NonGodPotEffectDisplay { for (stack in event.inventoryItems.values) { val name = stack.name ?: continue for (effect in NonGodPotEffect.entries) { - if (!name.contains(effect.displayName)) continue + if (!name.contains(effect.tabListName)) continue for (line in stack.getLore()) { if (line.contains("Remaining") && line != "§7Time Remaining: §aCompleted!" && @@ -193,7 +199,7 @@ class NonGodPotEffectDisplay { var effectsCount = 0 for (line in lines) { for (effect in NonGodPotEffect.entries) { - if (line.startsWith(effect.displayName)) { + if (line.startsWith(effect.tabListName)) { try { val duration = TimeUtils.getMillis(line.split("§f")[1]) effectDuration[effect] = Timer(duration.milliseconds) @@ -233,4 +239,4 @@ class NonGodPotEffectDisplay { private fun isEnabled() = LorenzUtils.inSkyBlock && config.nonGodPotEffectDisplay && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight -}
\ No newline at end of file +} |