diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-03-17 18:23:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-17 18:23:46 +0100 |
commit | f72cf9906a49736948a353fceb135e49b3f041b5 (patch) | |
tree | 012116f3b0594b01ac95b2a8c863fa4c39c14502 /src/main/java/at/hannibal2/skyhanni/features/gui | |
parent | ccf598ce287b3f179e65827c3a4caa05b75d3beb (diff) | |
download | skyhanni-f72cf9906a49736948a353fceb135e49b3f041b5.tar.gz skyhanni-f72cf9906a49736948a353fceb135e49b3f041b5.tar.bz2 skyhanni-f72cf9906a49736948a353fceb135e49b3f041b5.zip |
Feature: Thaumaturgy Tuning in Custom Scoreboard (#1201)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 0b9d7b1be..d0524fd4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -28,6 +28,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.inDungeons import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.percentageColor import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment +import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.TabListData @@ -42,7 +43,7 @@ internal var amountOfUnknownLines = 0 enum class ScoreboardElement( private val displayPair: Supplier<List<ScoreboardElementType>>, val showWhen: () -> Boolean, - private val configLine: String + private val configLine: String, ) { TITLE( ::getTitleDisplayPair, @@ -138,6 +139,11 @@ enum class ScoreboardElement( ::getPowerShowWhen, "Power: §aSighted §7(§61.263§7)" ), + TUNING( + ::getTuningDisplayPair, + ::getPowerShowWhen, + "Tuning: §c❁34§7, §e⚔20§7, and §9☣7" + ), COOKIE( ::getCookieDisplayPair, ::getCookieShowWhen, @@ -234,7 +240,6 @@ enum class ScoreboardElement( } } - private fun getTitleDisplayPair() = if (displayConfig.titleAndFooter.useHypixelTitleAnimation) { listOf(ScoreboardData.objectiveTitle to displayConfig.titleAndFooter.alignTitleAndFooter) } else { @@ -428,7 +433,6 @@ private fun getDateDisplayPair() = SkyBlockTime.now().formatted(yearElement = false, hoursAndMinutesElement = false) to HorizontalAlignment.LEFT ) - private fun getTimeDisplayPair(): List<ScoreboardElementType> { var symbol = getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.timePattern, "symbol") if (symbol == "0") symbol = "" @@ -462,6 +466,48 @@ private fun getPowerDisplayPair() = listOf( ?: "§cOpen \"Your Bags\"!") to HorizontalAlignment.LEFT ) +private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> { + val tunings = MaxwellAPI.tunings ?: return listOf("§cTalk to \"Maxwell\"!" to HorizontalAlignment.LEFT) + if (tunings.isEmpty()) return listOf("§cNo Maxwell Tunings :(" to HorizontalAlignment.LEFT) + + val title = StringUtils.pluralize(tunings.size, "Tuning", "Tunings") + return if (displayConfig.compactTuning) { + val tuning = tunings + .take(3) + .joinToString("§7, ") { tuning -> + with(tuning) { + if (displayConfig.displayNumbersFirst) { + "$color$value$icon" + } else { + "$color$icon$value" + } + } + + } + listOf( + if (displayConfig.displayNumbersFirst) { + "$tuning §f$title" + } else { + "$title: $tuning" + } to HorizontalAlignment.LEFT + ) + } else { + val tuning = tunings + .take(displayConfig.tuningAmount.coerceAtLeast(1)) + .map { tuning -> + with(tuning) { + " §7- §f" + if (displayConfig.displayNumbersFirst) { + "$color$value $icon $name" + } else { + "$name: $color$value$icon" + } + } + + }.toTypedArray() + listOf("$title:", *tuning).map { it to HorizontalAlignment.LEFT } + } +} + private fun getPowerShowWhen() = !inAnyIsland(IslandType.THE_RIFT) private fun getCookieDisplayPair(): List<ScoreboardElementType> { @@ -491,7 +537,8 @@ private fun getCookieShowWhen(): Boolean { } private fun getObjectiveDisplayPair() = buildList { - val objective = ScoreboardData.sidebarLinesFormatted.first { ScoreboardPattern.objectivePattern.matches(it) } + val objective = + ScoreboardData.sidebarLinesFormatted.first { ScoreboardPattern.objectivePattern.matches(it) } add(objective to HorizontalAlignment.LEFT) add((ScoreboardData.sidebarLinesFormatted.nextAfter(objective) ?: "<hidden>") to HorizontalAlignment.LEFT) @@ -508,7 +555,6 @@ private fun getObjectiveShowWhen(): Boolean = !inAnyIsland(IslandType.KUUDRA_ARENA) && ScoreboardData.sidebarLinesFormatted.none { ScoreboardPattern.objectivePattern.matches(it) } - private fun getSlayerDisplayPair(): List<ScoreboardElementType> = listOf( (if (SlayerAPI.hasActiveSlayerQuest()) "Slayer Quest" else "<hidden>") to HorizontalAlignment.LEFT, (" §7- §e${SlayerAPI.latestSlayerCategory.trim()}" to HorizontalAlignment.LEFT), |