From a203261378cbaab9761f64544ff0a8ecb5194657 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:21:30 +0200 Subject: Improvement: Added More Mining v3 content to Custom Scoreboard (#1420) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/config/ConfigUpdaterMigrator.kt | 2 +- .../gui/customscoreboard/CustomScoreboard.kt | 7 +++++++ .../gui/customscoreboard/ScoreboardEvents.kt | 15 +++++++++++++++ .../gui/customscoreboard/ScoreboardPattern.kt | 20 ++++++++++++-------- .../gui/customscoreboard/UnknownLinesHandler.kt | 3 +++ 5 files changed, 38 insertions(+), 9 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index 75569686c..51bf33dbb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -11,7 +11,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 36 + const val CONFIG_VERSION = 37 fun JsonElement.at(chain: List, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null 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 37e2a2098..e775c74fd 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 @@ -176,6 +176,7 @@ class CustomScoreboard { val prefix = "gui.customScoreboard" val displayConfigPrefix = "$prefix.displayConfig" 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 @@ -203,5 +204,11 @@ class CustomScoreboard { event.move(31, "$displayConfigPrefix.eventsConfig", "$displayPrefix.events") event.move(31, "$prefix.mayorConfig", "$displayPrefix.mayor") event.move(31, "$prefix.partyConfig", "$displayPrefix.party") + + event.transform(37, "$displayPrefix.events.eventEntries") { element -> + val array = element.asJsonArray + array.add(JsonPrimitive(ScoreboardEvents.QUEUE.name)) + array + } } } 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 6e21e7610..57d95665f 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 @@ -154,6 +154,12 @@ enum class ScoreboardEvents( ::getEffigiesShowWhen, "Effigies: §c⧯§c⧯⧯§7⧯§c⧯§c⧯" ), + QUEUE( + ::getQueueLines, + ::getQueueShowWhen, + "Queued: Glacite Mineshafts\n" + + "Position: §b#45 §fSince: §a00:00" + ), ACTIVE_TABLIST_EVENTS( ::getActiveEventLine, ::getActiveEventShowWhen, @@ -538,6 +544,15 @@ private fun getEffigiesShowWhen(): Boolean { return RiftBloodEffigies.heartsPattern.anyMatches(getSbLines()) } +private fun getQueueLines(): List { + return listOf(getSbLines().first { SbPattern.queuePattern.matches(it) }) + + (getSbLines().first { SbPattern.queuePositionPattern.matches(it) }) +} + +private fun getQueueShowWhen(): Boolean { + return SbPattern.queuePattern.anyMatches(getSbLines()) +} + private fun getRedstoneLines(): List { return listOf(getSbLines().first { SbPattern.redstonePattern.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 34a5d9f45..faeebb721 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 @@ -227,6 +227,10 @@ object ScoreboardPattern { val yourGoblinKillsPattern by miningSb.pattern( "yourgoblin", "^Your kills: §c\\d+ ☠( §a\\(\\+\\d+\\))?$" ) + val mineshaftNotStartedPattern by miningSb.pattern( + "mineshaft.notstarted", + "(?:§.)*Not started.*" + ) // combat private val combatSb = scoreboardGroup.group("combat") @@ -321,6 +325,14 @@ object ScoreboardPattern { "objective", "^(§.)*(Objective|Quest).*" ) + val queuePattern by miscSb.pattern( + "queued", + "Queued:.*" + ) + val queuePositionPattern by miscSb.pattern( + "queueposition", + "Position: (?:§.)*#\\d+ (?:§.)*Since: (?:§.)*.*" + ) // this thirdObjectiveLinePattern includes all those weird objective lines that go into a third scoreboard line val thirdObjectiveLinePattern by miscSb.pattern( @@ -423,12 +435,4 @@ object ScoreboardPattern { "eventtime", "^\\s+Ends In: §r§e(?