diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-18 18:55:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 18:55:10 +0200 |
commit | b1a5396e46a5c3fd6bbabdcaac106255731a200e (patch) | |
tree | 11c2d6a069678edf8349dbcd81b0d1e11b1cb18b /src/main/java | |
parent | 4f8e42a134e4a2fad3cf93aa5747e7a0f0b6898e (diff) | |
download | skyhanni-b1a5396e46a5c3fd6bbabdcaac106255731a200e.tar.gz skyhanni-b1a5396e46a5c3fd6bbabdcaac106255731a200e.tar.bz2 skyhanni-b1a5396e46a5c3fd6bbabdcaac106255731a200e.zip |
Fix: Fixed Custom Scoreboard missing Ävaeìkx sitting time (#1480)
Diffstat (limited to 'src/main/java')
4 files changed, 43 insertions, 32 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index e775c74fd..d71bdda6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -31,6 +31,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAlignedWidth import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.TabListData +import com.google.gson.JsonArray import com.google.gson.JsonPrimitive import net.minecraftforge.client.GuiIngameForge import net.minecraftforge.client.event.RenderGameOverlayEvent @@ -178,11 +179,6 @@ class CustomScoreboard { val displayPrefix = "$prefix.display" event.move(28, "$prefix.displayConfig.showAllActiveEvents", "$prefix.displayConfig.eventsConfig.showAllActiveEvents") - event.transform(30, "$prefix.displayConfig.eventsConfig.eventEntries") { element -> - val array = element.asJsonArray - array.add(JsonPrimitive(ScoreboardEvents.HOT_DOG_CONTEST.name)) - array - } event.move(31, "$displayConfigPrefix.arrowAmountDisplay", "$displayPrefix.arrow.amountDisplay") event.move(31, "$displayConfigPrefix.colorArrowAmount", "$displayPrefix.arrow.colorArrowAmount") @@ -210,5 +206,24 @@ class CustomScoreboard { array.add(JsonPrimitive(ScoreboardEvents.QUEUE.name)) array } + event.transform(39, "$displayPrefix.events.eventEntries") { element -> + val jsonArray = element.asJsonArray + val newArray = JsonArray() + + for (jsonElement in jsonArray) { + val stringValue = jsonElement.asString + if (stringValue !in listOf("HOT_DOG_CONTEST", "EFFIGIES")) { + newArray.add(jsonElement) + } + } + + if (jsonArray.any { it.asString in listOf("HOT_DOG_CONTEST", "EFFIGIES") }) { + newArray.add(JsonPrimitive(ScoreboardEvents.RIFT.name)) + } + + newArray + } + + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt index f30ac50ba..f4bb793e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt @@ -139,22 +139,16 @@ enum class ScoreboardEvents( "§7Damage Soaked:\n" + "§e▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎§7▎▎▎▎▎" ), - HOT_DOG_CONTEST( - ::getHotDogLines, - ::getHotDogShowWhen, - "§6Hot Dog Contest\n" + - "Eaten: §c0/50" + RIFT( + ::getRiftLines, + { IslandType.THE_RIFT.isInIsland() }, + "§7(All Rift Lines)" ), ESSENCE( ::getEssenceLines, ::getEssenceShowWhen, "Dragon Essence: §d1,285" ), - EFFIGIES( - ::getEffigiesLines, - ::getEffigiesShowWhen, - "Effigies: §c⧯§c⧯⧯§7⧯§c⧯§c⧯" - ), QUEUE( ::getQueueLines, ::getQueueShowWhen, @@ -215,9 +209,8 @@ enum class ScoreboardEvents( MINING_EVENTS, DAMAGE, MAGMA_BOSS, - HOT_DOG_CONTEST, + RIFT, ESSENCE, - EFFIGIES, ACTIVE_TABLIST_EVENTS ) } @@ -525,14 +518,20 @@ private fun getMagmaBossShowWhen(): Boolean { return SbPattern.magmaChamberPattern.matches(HypixelData.skyBlockArea) } -private fun getHotDogLines(): List<String> { - return listOf(getSbLines().first { SbPattern.riftHotdogTitlePattern.matches(it) }) + - (getSbLines().first { SbPattern.timeLeftPattern.matches(it) }) + - (getSbLines().first { SbPattern.riftHotdogEatenPattern.matches(it) }) -} +private fun getRiftLines() = buildList { + if (SbPattern.riftHotdogTitlePattern.anyMatches(getSbLines())) { + add(getSbLines().first { SbPattern.riftHotdogTitlePattern.matches(it) }) + add(getSbLines().first { SbPattern.timeLeftPattern.matches(it) }) + add(getSbLines().first { SbPattern.riftHotdogEatenPattern.matches(it) }) + } + + if (RiftBloodEffigies.heartsPattern.anyMatches(getSbLines())) { + add(getSbLines().first { RiftBloodEffigies.heartsPattern.matches(it) }) + } -private fun getHotDogShowWhen(): Boolean { - return SbPattern.riftHotdogTitlePattern.anyMatches(getSbLines()) + if (SbPattern.riftAveikxPattern.anyMatches(getSbLines())) { + addAll(getSbLines().filter { SbPattern.riftAveikxPattern.matches(it) }) + } } private fun getEssenceLines(): List<String> { @@ -543,14 +542,6 @@ private fun getEssenceShowWhen(): Boolean { return SbPattern.essencePattern.anyMatches(getSbLines()) } -private fun getEffigiesLines(): List<String> { - return listOf(getSbLines().first { RiftBloodEffigies.heartsPattern.matches(it) }) -} - -private fun getEffigiesShowWhen(): Boolean { - return RiftBloodEffigies.heartsPattern.anyMatches(getSbLines()) -} - private fun getQueueLines(): List<String> { return listOf(getSbLines().first { SbPattern.queuePattern.matches(it) }) + (getSbLines().first { SbPattern.queuePositionPattern.matches(it) }) diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt index 1f872d339..234d0d95a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt @@ -407,6 +407,10 @@ object ScoreboardPattern { "hotdogeaten", "^Eaten: §.\\d+\\/\\d+$" ) + val riftAveikxPattern by riftSb.pattern( + "aveikx", + "Time spent sitting|with Ävaeìkx: .*" + ) // Stats from the tablist diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index e810b680e..954cb2860 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -117,6 +117,7 @@ object UnknownLinesHandler { SbPattern.queuePattern, SbPattern.queuePositionPattern, SbPattern.fortunateFreezingBonusPattern, + SbPattern.riftAveikxPattern, ) unknownLines = unknownLines.filterNot { line -> |