diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-06-12 17:31:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 17:31:03 +0200 |
commit | 3d221e4be8c03f6ad480d33093923d778d9f1eb0 (patch) | |
tree | 852b4dd98ddacab933125a59ac6be1b2e243aa61 /src/main/java/at/hannibal2/skyhanni | |
parent | 2a465d20b139c93064bd2032e0932f150756d8c5 (diff) | |
download | skyhanni-3d221e4be8c03f6ad480d33093923d778d9f1eb0.tar.gz skyhanni-3d221e4be8c03f6ad480d33093923d778d9f1eb0.tar.bz2 skyhanni-3d221e4be8c03f6ad480d33093923d778d9f1eb0.zip |
Improvement: Add Carnival (Alpha) Stuff to Custom Scoreboard (#1995)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
4 files changed, 115 insertions, 6 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 31a3b31c8..9154f6a86 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 @@ -265,6 +265,7 @@ object CustomScoreboard { event.transform(50, "$displayPrefix.events.eventEntries") { element -> val array = element.asJsonArray array.add(JsonPrimitive(ScoreboardEvents.ANNIVERSARY.name)) + array.add(JsonPrimitive(ScoreboardEvents.CARNIVAL.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 e0cbaff28..996613a8a 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 @@ -142,6 +142,11 @@ enum class ScoreboardEvents( "§7Damage Soaked:\n" + "§e▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎§7▎▎▎▎▎" ), + CARNIVAL( + ::getCarnivalLines, + ::getCarnivalShowWhen, + "§7(All Carnival Lines)" + ), RIFT( ::getRiftLines, { IslandType.THE_RIFT.isInIsland() }, @@ -218,6 +223,7 @@ enum class ScoreboardEvents( MINING_EVENTS, DAMAGE, MAGMA_BOSS, + CARNIVAL, RIFT, ESSENCE, ACTIVE_TABLIST_EVENTS @@ -257,6 +263,7 @@ private fun getDungeonsLines() = listOf( SbPattern.keysPattern, SbPattern.timeElapsedPattern, SbPattern.clearedPattern, + SbPattern.emptyLinesPattern, // Forcing an empty line SbPattern.soloPattern, SbPattern.teammatesPattern, SbPattern.floor3GuardiansPattern @@ -395,7 +402,7 @@ private fun getActiveEventLine(): List<String> { // Some Active Events are better not shown from the tablist, // but from other locations like the scoreboard - val blockedEvents = listOf("Spooky Festival", "5th SkyBlock Anniversary") + val blockedEvents = listOf("Spooky Festival", "Carnival", "5th SkyBlock Anniversary") if (blockedEvents.contains(currentActiveEvent.removeColor())) return emptyList() val currentActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeEndsPattern.matches(it) } @@ -511,6 +518,24 @@ private fun getMagmaBossLines() = getSbLines().filter { line -> private fun getMagmaBossShowWhen(): Boolean = SbPattern.magmaChamberPattern.matches(HypixelData.skyBlockArea) +private fun getCarnivalLines() = listOf( + SbPattern.carnivalPattern, + SbPattern.carnivalTokensPattern, + SbPattern.emptyLinesPattern, // Forcing an empty line + SbPattern.carnivalTasksPattern, + SbPattern.timeLeftPattern, + SbPattern.carnivalCatchStreakPattern, + SbPattern.carnivalFruitsPattern, + SbPattern.carnivalAccuracyPattern, + SbPattern.carnivalKillsPattern, + SbPattern.carnivalScorePattern, +) + .mapNotNull { pattern -> + getSbLines().firstOrNull { pattern.matches(it) } + } + +private fun getCarnivalShowWhen(): Boolean = SbPattern.carnivalPattern.anyMatches(getSbLines()) + private fun getRiftLines() = getSbLines().filter { line -> RiftBloodEffigies.heartsPattern.matches(line) || SbPattern.riftHotdogTitlePattern.matches(line) 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 6b70cd683..81e8b2382 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 @@ -40,10 +40,11 @@ object ScoreboardPattern { "date", "^\\s*(Late |Early )?(Spring|Summer|Autumn|Winter) \\d{1,2}(st|nd|rd|th)?.*" ) - /* - * REGEX-TEST: §78:50am - * REGEX-TEST: §75:50am §b☽ - */ + + /** + * REGEX-TEST: §78:50am + * REGEX-TEST: §75:50am §b☽ + */ val timePattern by mainSb.pattern( "time", "^\\s*§7\\d{1,2}:\\d{2}(?:am|pm)\\s*(?<symbol>(§b☽|§e☀|§.⚡|§.☔))?.*$" @@ -72,6 +73,10 @@ object ScoreboardPattern { "profiletype", "^\\s*(§7♲ §7Ironman|§a☀ §aStranded|§.Ⓑ §.Bingo).*$" ) + val emptyLinesPattern by mainSb.pattern( + "emptylines", + "^\\s*$" + ) // multi use private val multiUseSb = scoreboardGroup.group("multiuse") @@ -93,7 +98,7 @@ object ScoreboardPattern { ) val timeLeftPattern by multiUseSb.pattern( "timeleft", - "(§.)*Time Left: (§.)*[\\w:,.]*$" + "(?:§.)*Time Left: (?:§.)*[\\w:,.\\s]+$" ) // dungeon scoreboard @@ -453,6 +458,76 @@ object ScoreboardPattern { "Clues: §.\\d+/\\d+" ) + private val carnivalSb = scoreboardGroup.group("carnival") + + /** + * REGEX-TEST: §eCarnival§f 85:33:57 + */ + val carnivalPattern by carnivalSb.pattern( + "carnival", + "§eCarnival§f (?:\\d+:?)*" + ) + + /** + * REGEX-TEST: §3§lCatch a Fish + * REGEX-TEST: §6§lFruit Diggin§6§lg + * REGEX-TEST: §c§lZombie Shoot§c§lout + */ + val carnivalTasksPattern by carnivalSb.pattern( + "tasks", + "§.§l(?:Catch a Fish|Fruit Diggin|Zombie Shoot)(?:§.§l(?:g|out))?" + ) + + /** + * REGEX-TEST: §fCarnival Tokens: §e129 + */ + val carnivalTokensPattern by carnivalSb.pattern( + "tokens", + "(?:§f)*Carnival Tokens: §e\\d+" + ) + + /** + * REGEX-TEST: §fFruits: §a2§7/§c10 + */ + val carnivalFruitsPattern by carnivalSb.pattern( + "fruits", + "(?:§f)?Fruits: §.\\d+§.\\/§.\\d+" + ) + + /** + * REGEX-TEST: §fScore: §e600 §6(+300) + * REGEX-TEST: §fScore: §e600 + */ + val carnivalScorePattern by carnivalSb.pattern( + "score", + "(?:§f)?Score: §.\\d+.*" + ) + + /** + * REGEX-TEST: §fCatch Streak: §a0 + */ + val carnivalCatchStreakPattern by carnivalSb.pattern( + "catchstreak", + "(?:§f)?Catch Streak: §.\\d+" + ) + + /** + * REGEX-TEST: §fAccuracy: §a81.82% + * REGEX-TEST: §fAccuracy: §a81% + */ + val carnivalAccuracyPattern by carnivalSb.pattern( + "accuracy", + "(?:§f)?Accuracy: §.\\d+(?:\\.\\d+)?%" + ) + + /** + * REGEX-TEST: §fKills: §a8 + */ + val carnivalKillsPattern by carnivalSb.pattern( + "kills", + "(?:§f)?Kills: §.\\d+" + ) + // Stats from the tablist private val tablistGroup = group.group("tablist") val gemsPattern by tablistGroup.pattern( 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 560b65980..005fdd5a7 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 @@ -122,6 +122,14 @@ object UnknownLinesHandler { SbPattern.riftHayEatenPattern, SbPattern.fossilDustPattern, SbPattern.cluesPattern, + SbPattern.carnivalPattern, + SbPattern.carnivalTasksPattern, + SbPattern.carnivalTokensPattern, + SbPattern.carnivalFruitsPattern, + SbPattern.carnivalScorePattern, + SbPattern.carnivalCatchStreakPattern, + SbPattern.carnivalAccuracyPattern, + SbPattern.carnivalKillsPattern, ) unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { line -> |