From 8605fc5777ec8c1529bda317a31dec96eddf8f18 Mon Sep 17 00:00:00 2001 From: Owen <64725743+Ownwn@users.noreply.github.com> Date: Sat, 15 Jun 2024 20:43:24 +1200 Subject: [PATCH] BetterMap-style dungeon score estimate --- .../gg/skytils/skytilsmod/core/Config.kt | 19 ++- .../impl/dungeons/ScoreCalculation.kt | 114 +++++++++++------- .../resources/assets/skytils/lang/en_US.lang | 3 +- 3 files changed, 86 insertions(+), 50 deletions(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt index f7bd0699b..f27b58e99 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt @@ -449,14 +449,25 @@ object Config : Vigilant( var showScoreCalculation = false @Property( - type = PropertyType.SWITCH, name = "Minimized Dungeon Score Estimate", - description = "Only shows the dungeon score.", + type = PropertyType.SELECTOR, name = "Dungeon Score Estimate Style", + description = "Change the style of the Score Estimate", category = "Dungeons", subcategory = "Score Calculation", - i18nName = "skytils.config.dungeons.score_calculation.minimized_dungeon_score_estimate", + options = ["Standard", "Minimized", "Bettermap"], + i18nName = "skytils.config.dungeons.score_calculation.dungeon_score_estimate_style", i18nCategory = "skytils.config.dungeons", i18nSubcategory = "skytils.config.dungeons.score_calculation" ) - var minimizedScoreCalculation = false + var scoreCalculationStyle = 0 + + @Property( + type = PropertyType.SWITCH, name = "Hide Score Estimate In Boss", + description = "Hides the score estimate when in a dungeon boss room", + category = "Dungeons", subcategory = "Score Calculation", + i18nName = "skytils.config.dungeons.score_calculation.hide_score_estimate_in_boss", + i18nCategory = "skytils.config.dungeons", + i18nSubcategory = "skytils.config.dungeons.score_calculation" + ) + var hideScoreEstimateBoss = false @Property( type = PropertyType.SWITCH, name = "Score Calculation Party Assist", diff --git a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ScoreCalculation.kt b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ScoreCalculation.kt index 05c26e09e..4a857aa9b 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ScoreCalculation.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ScoreCalculation.kt @@ -260,48 +260,62 @@ object ScoreCalculation { Utils.checkThreadAndQueue { ScoreCalculationElement.text.clear() if (!Utils.inDungeons) return@checkThreadAndQueue - if (Skytils.config.minimizedScoreCalculation) { - val color = when { - score < 270 -> 'c' - score < 300 -> 'e' - else -> 'a' - } - ScoreCalculationElement.text.add("§eScore: §$color$score §7($rank§7)") - } else { - ScoreCalculationElement.text.add("§9Dungeon Status") - ScoreCalculationElement.text.add("§f• §eDeaths:§c ${deaths.get()} ${if (firstDeathHadSpirit.get()) "§7(§6Spirit§7)" else ""}") - ScoreCalculationElement.text.add("§f• §eMissing Puzzles:§c ${missingPuzzles.get()}") - ScoreCalculationElement.text.add("§f• §eFailed Puzzles:§c ${failedPuzzles.get()}") - if (foundSecrets.get() > 0) ScoreCalculationElement.text.add( - "§f• §eSecrets: ${if (foundSecrets.get() >= totalSecretsNeeded.get()) "§a" else "§c"}${foundSecrets.get()}§7/§a${totalSecretsNeeded.get()} " + - if (floorReq.get().secretPercentage != 1.0) "§7(§6Total: ${totalSecrets.get()}§7)" else "" - ) - ScoreCalculationElement.text.add("§f• §eCrypts:§a ${crypts.get()}") - if (dungeonFloorNumber?.let { it >= 6 } == true) { - ScoreCalculationElement.text.add("§f• §eMimic:§l${if (mimicKilled.get()) "§a ✔" else "§c ✘"}") + + when (Skytils.config.scoreCalculationStyle) { + 2 -> { // bm style + val scoreColor = when { + totalScore.get() < 270 -> "§c" + totalScore.get() < 300 -> "§e" + else -> "§a" + } + + val cryptColor = if (crypts.get() >= 5) "§a" else "§c" + + ScoreCalculationElement.text.add("$scoreColor${totalScore.get()} $cryptColor${crypts.get()}c ${if (mimicKilled.get()) "§a✔" else "§c✘"}") } - ScoreCalculationElement.text.add("") - ScoreCalculationElement.text.add("§6Score") - if (DungeonFeatures.dungeonFloor == "E") - ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(14, 70)}") - else - ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(20, 100)}") - ScoreCalculationElement.text.add( - "§f• §eExplore Score:§a ${discoveryScore.get()} §7(§e${ - roomClearScore.get().toInt() - } §7+ §6${secretScore.get().toInt()}§7)" - ) - ScoreCalculationElement.text.add("§f• §eSpeed Score:§a ${speedScore.get()}") - - if (DungeonFeatures.dungeonFloor == "E") { - ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${(bonusScore.get() * 0.7).toInt()}") - ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+7§7)" else "") - } else { - ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${bonusScore.get()}") - ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+10§7)" else "") + 1 -> { // minimized style + val color = when { + score < 270 -> 'c' + score < 300 -> 'e' + else -> 'a' + } + ScoreCalculationElement.text.add("§eScore: §$color$score §7($rank§7)") } - ScoreCalculationElement.text.add("§f• §eRank: $rank") + else -> { // standard style + ScoreCalculationElement.text.add("§9Dungeon Status") + ScoreCalculationElement.text.add("§f• §eDeaths:§c ${deaths.get()} ${if (firstDeathHadSpirit.get()) "§7(§6Spirit§7)" else ""}") + ScoreCalculationElement.text.add("§f• §eMissing Puzzles:§c ${missingPuzzles.get()}") + ScoreCalculationElement.text.add("§f• §eFailed Puzzles:§c ${failedPuzzles.get()}") + if (foundSecrets.get() > 0) ScoreCalculationElement.text.add( + "§f• §eSecrets: ${if (foundSecrets.get() >= totalSecretsNeeded.get()) "§a" else "§c"}${foundSecrets.get()}§7/§a${totalSecretsNeeded.get()} " + + if (floorReq.get().secretPercentage != 1.0) "§7(§6Total: ${totalSecrets.get()}§7)" else "" + ) + ScoreCalculationElement.text.add("§f• §eCrypts:§a ${crypts.get()}") + if (dungeonFloorNumber?.let { it >= 6 } == true) { + ScoreCalculationElement.text.add("§f• §eMimic:§l${if (mimicKilled.get()) "§a ✔" else "§c ✘"}") + } + ScoreCalculationElement.text.add("") + ScoreCalculationElement.text.add("§6Score") + if (DungeonFeatures.dungeonFloor == "E") + ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(14, 70)}") + else + ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(20, 100)}") + ScoreCalculationElement.text.add( + "§f• §eExplore Score:§a ${discoveryScore.get()} §7(§e${ + roomClearScore.get().toInt() + } §7+ §6${secretScore.get().toInt()}§7)" + ) + ScoreCalculationElement.text.add("§f• §eSpeed Score:§a ${speedScore.get()}") + if (DungeonFeatures.dungeonFloor == "E") { + ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${(bonusScore.get() * 0.7).toInt()}") + ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+7§7)" else "") + } else { + ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${bonusScore.get()}") + ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+10§7)" else "") + } + ScoreCalculationElement.text.add("§f• §eRank: $rank") + } } } } @@ -533,16 +547,18 @@ object ScoreCalculation { class ScoreCalculationElement : GuiElement("Dungeon Score Estimate", x = 200, y = 100) { override fun render() { if (toggled && Utils.inDungeons) { + if (Skytils.config.hideScoreEstimateBoss && DungeonTimer.bossEntryTime != -1L) return // don't render in boss (config) RenderUtil.drawAllInList(this, text) } } override fun demoRender() { - if (Skytils.config.minimizedScoreCalculation) { - RenderUtil.drawAllInList(this, demoMin) - } else { - RenderUtil.drawAllInList(this, demoText) + val scoreStyle = when (Skytils.config.scoreCalculationStyle) { + 2 -> demoBM + 1 -> demoMin + else -> demoText } + RenderUtil.drawAllInList(this, scoreStyle) } companion object { @@ -564,13 +580,21 @@ object ScoreCalculation { "§f• §eRank: §6§lS+" ) private val demoMin = listOf("§eScore: §e300 §7(§6§lS+§7)") + private val demoBM = listOf("§a301 §c4c §a✔") val text = ArrayList() } override val height: Int - get() = if (Skytils.config.minimizedScoreCalculation) ScreenRenderer.fontRenderer.FONT_HEIGHT else ScreenRenderer.fontRenderer.FONT_HEIGHT * demoText.size + get() = ScreenRenderer.fontRenderer.FONT_HEIGHT * when (Skytils.config.scoreCalculationStyle) { + 0 -> demoText.size + else -> 1 // if demo is more than 1 line multiply by its size, otherwise multiply by 1 + } override val width: Int - get() = demoText.maxOf { ScreenRenderer.fontRenderer.getStringWidth(it) } + get() = (when (Skytils.config.scoreCalculationStyle) { + 2 -> demoBM + 1 -> demoMin + else -> demoText + }).maxOf { ScreenRenderer.fontRenderer.getStringWidth(it) } override val toggled: Boolean get() = Skytils.config.showScoreCalculation diff --git a/src/main/resources/assets/skytils/lang/en_US.lang b/src/main/resources/assets/skytils/lang/en_US.lang index a992c140c..a99b616b0 100644 --- a/src/main/resources/assets/skytils/lang/en_US.lang +++ b/src/main/resources/assets/skytils/lang/en_US.lang @@ -35,7 +35,8 @@ skytils.config.dungeons.miscellaneous.red_screen_fix=Red Screen Fix skytils.config.dungeons.miscellaneous.show_decimal_seconds_on_timers=Show Decimal Seconds on Timers skytils.config.dungeons.miscellaneous.sadan_phase_timer=Sadan Phase Timer skytils.config.dungeons.score_calculation.show_dungeon_score_estimate=Show Dungeon Score Estimate -skytils.config.dungeons.score_calculation.minimized_dungeon_score_estimate=Minimized Dungeon Score Estimate +skytils.config.dungeons.score_calculation.dungeon_score_estimate_style=Dungeon Score Estimate Style +skytils.config.dungeons.score_calculation.hide_score_estimate_in_boss=Hide Score Estimate In Boss skytils.config.dungeons.score_calculation.score_calculation_party_assist=Score Calculation Party Assist skytils.config.dungeons.score_calculation.receive_score_calculation_party_assist=Receive Score Calculation Party Assist skytils.config.dungeons.score_calculation.allow_mimic_dead_from_other_mods=Allow Mimic Dead! from other Mods