aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-06-13 18:27:06 +0200
committerGitHub <noreply@github.com>2024-06-13 18:27:06 +0200
commited9a2aa7fafaf0d987d34f8eea529a206d535747 (patch)
tree23de2c85c76c6667947e2d64757eb4c431f7e977 /src/main/java/at
parent17d8e4898a3897cd6b3110ed4b8035e3d9285029 (diff)
downloadskyhanni-ed9a2aa7fafaf0d987d34f8eea529a206d535747.tar.gz
skyhanni-ed9a2aa7fafaf0d987d34f8eea529a206d535747.tar.bz2
skyhanni-ed9a2aa7fafaf0d987d34f8eea529a206d535747.zip
Future Fix: CustomeScoreboard UnkownLinesHandler auto adds patterns from the repo (#2068)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt235
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt57
2 files changed, 156 insertions, 136 deletions
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 81e8b2382..984e91750 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
@@ -1,44 +1,51 @@
package at.hannibal2.skyhanni.features.gui.customscoreboard
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object ScoreboardPattern {
- val group = RepoPattern.group("features.gui.customscoreboard")
+ private val group = RepoPattern.group("features.gui.customscoreboard")
// Stats from the scoreboard
- private val scoreboardGroup = group.group("scoreboard")
+ private val scoreboardGroup by group.exclusiveGroup("scoreboard")
+
+ @SubscribeEvent
+ fun onRepositoryReload(event: RepositoryReloadEvent) {
+ UnknownLinesHandler.remoteOnlyPatterns = scoreboardGroup.getUnusedPatterns().toTypedArray()
+ }
// main scoreboard
private val mainSb = scoreboardGroup.group("main")
val motesPattern by mainSb.pattern(
"motes",
- "^(§.)*Motes: (§.)*(?<motes>[\\d,]+).*$"
+ "^(§.)*Motes: (§.)*(?<motes>[\\d,]+).*$",
)
val heatPattern by mainSb.pattern(
"heat",
- "^Heat: (?<heat>.*)$"
+ "^Heat: (?<heat>.*)$",
) // this line is weird (either text or number), ill leave it as is; it even has different colors?
val coldPattern by mainSb.pattern(
"cold",
- "^(?:§.)*Cold: §.(?<cold>-?\\d+)❄$"
+ "^(?:§.)*Cold: §.(?<cold>-?\\d+)❄$",
)
val copperPattern by mainSb.pattern(
"copper",
- "^(§.)*Copper: (§.)*(?<copper>[\\d,]+).*$"
+ "^(§.)*Copper: (§.)*(?<copper>[\\d,]+).*$",
)
val locationPattern by mainSb.pattern(
"location",
- "^\\s*(?<location>(§7⏣|§5ф) .*)$"
+ "^\\s*(?<location>(§7⏣|§5ф) .*)$",
)
val lobbyCodePattern by mainSb.pattern(
"lobbycode",
- "^\\s*§.((\\d{2}/\\d{2}/\\d{2})|Server closing: [\\d:]+) §8(?<code>.*)\$"
+ "^\\s*§.((\\d{2}/\\d{2}/\\d{2})|Server closing: [\\d:]+) §8(?<code>.*)\$",
)
val datePattern by mainSb.pattern(
"date",
- "^\\s*(Late |Early )?(Spring|Summer|Autumn|Winter) \\d{1,2}(st|nd|rd|th)?.*"
+ "^\\s*(Late |Early )?(Spring|Summer|Autumn|Winter) \\d{1,2}(st|nd|rd|th)?.*",
)
/**
@@ -47,135 +54,135 @@ object ScoreboardPattern {
*/
val timePattern by mainSb.pattern(
"time",
- "^\\s*§7\\d{1,2}:\\d{2}(?:am|pm)\\s*(?<symbol>(§b☽|§e☀|§.⚡|§.☔))?.*$"
+ "^\\s*§7\\d{1,2}:\\d{2}(?:am|pm)\\s*(?<symbol>(§b☽|§e☀|§.⚡|§.☔))?.*$",
)
val footerPattern by mainSb.pattern(
"footer",
- "§e(www|alpha).hypixel.net\$"
+ "§e(www|alpha).hypixel.net\$",
)
val yearVotesPattern by mainSb.pattern(
"yearvotes",
- "(?<yearvotes>^§6Year \\d+ Votes\$)"
+ "(?<yearvotes>^§6Year \\d+ Votes\$)",
)
val votesPattern by mainSb.pattern(
"votes",
- "(?<votes>§[caebd]\\|+(§f)?\\|+ §(.+)$)"
+ "(?<votes>§[caebd]\\|+(§f)?\\|+ §(.+)$)",
)
val waitingForVotePattern by mainSb.pattern(
"waitingforvote",
- "(§7Waiting for|§7your vote\\.\\.\\.)$"
+ "(§7Waiting for|§7your vote\\.\\.\\.)$",
)
val northstarsPattern by mainSb.pattern(
"northstars",
- "North Stars: §d(?<northstars>[\\w,]+).*$"
+ "North Stars: §d(?<northstars>[\\w,]+).*$",
)
val profileTypePattern by mainSb.pattern(
"profiletype",
- "^\\s*(§7♲ §7Ironman|§a☀ §aStranded|§.Ⓑ §.Bingo).*$"
+ "^\\s*(§7♲ §7Ironman|§a☀ §aStranded|§.Ⓑ §.Bingo).*$",
)
val emptyLinesPattern by mainSb.pattern(
"emptylines",
- "^\\s*$"
+ "^\\s*$",
)
// multi use
private val multiUseSb = scoreboardGroup.group("multiuse")
val autoClosingPattern by multiUseSb.pattern(
"autoclosing",
- "(§.)*Auto-closing in: §c(\\d{1,2}:)?\\d{1,2}$"
+ "(§.)*Auto-closing in: §c(\\d{1,2}:)?\\d{1,2}$",
)
val startingInPattern by multiUseSb.pattern(
"startingin",
- "(§.)*Starting in: §.(\\d{1,2}:)?\\d{1,2}$"
+ "(§.)*Starting in: §.(\\d{1,2}:)?\\d{1,2}$",
)
val timeElapsedPattern by multiUseSb.pattern(
"timeelapsed",
- "(§.)*Time Elapsed: (§.)*(?<time>(\\w+[ydhms] ?)+)$"
+ "(§.)*Time Elapsed: (§.)*(?<time>(\\w+[ydhms] ?)+)$",
)
val instanceShutdownPattern by multiUseSb.pattern(
"instanceshutdown",
- "(§.)*Instance Shutdown In: (§.)*(?<time>(\\w+[ydhms] ?)+)$"
+ "(§.)*Instance Shutdown In: (§.)*(?<time>(\\w+[ydhms] ?)+)$",
)
val timeLeftPattern by multiUseSb.pattern(
"timeleft",
- "(?:§.)*Time Left: (?:§.)*[\\w:,.\\s]+$"
+ "(?:§.)*Time Left: (?:§.)*[\\w:,.\\s]+$",
)
// dungeon scoreboard
private val dungeonSb = scoreboardGroup.group("dungeon")
val m7dragonsPattern by dungeonSb.pattern(
"m7dragons",
- "^(§cNo Alive Dragons|§8- (?:§.)+[\\w\\s]+Dragon§a [\\w,.]+§.❤)$"
+ "^(§cNo Alive Dragons|§8- (?:§.)+[\\w\\s]+Dragon§a [\\w,.]+§.❤)$",
)
val keysPattern by dungeonSb.pattern(
"keys",
- "Keys: §.■ §.[✗✓] §.■ §a.x$"
+ "Keys: §.■ §.[✗✓] §.■ §a.x$",
)
val clearedPattern by dungeonSb.pattern(
"cleared",
- "(§.)*Cleared: (§.)*(?<percent>[\\w,.]+)% (§.)*\\((§.)*(?<score>[\\w,.]+)(§.)*\\)$"
+ "(§.)*Cleared: (§.)*(?<percent>[\\w,.]+)% (§.)*\\((§.)*(?<score>[\\w,.]+)(§.)*\\)$",
)
val soloPattern by dungeonSb.pattern(
"solo",
- "§3§lSolo$"
+ "§3§lSolo$",
)
val teammatesPattern by dungeonSb.pattern(
"teammates",
- "(§.)*(?<classAbbv>\\[\\w]) (§.)*(?<username>[a-zA-Z0-9_]{2,16}) ((§.)*(?<classLevel>\\[Lvl?(?<level>[\\w,.]+)?]?)|(§.)*(?<health>[\\w,.]+)(§.)*.?)$"
+ "(§.)*(?<classAbbv>\\[\\w]) (§.)*(?<username>[a-zA-Z0-9_]{2,16}) ((§.)*(?<classLevel>\\[Lvl?(?<level>[\\w,.]+)?]?)|(§.)*(?<health>[\\w,.]+)(§.)*.?)$",
)
val floor3GuardiansPattern by dungeonSb.pattern(
"floor3guardians",
- "§. - §.(?:Healthy|Reinforced|Laser|Chaos)§a [\\w,.]*(?:§c❤)?"
+ "§. - §.(?:Healthy|Reinforced|Laser|Chaos)§a [\\w,.]*(?:§c❤)?",
)
// kuudra
private val kuudraSb = scoreboardGroup.group("kuudra")
val wavePattern by kuudraSb.pattern(
"wave",
- "^(§.)*Wave: (§.)*\\d+(§.)*( §.- §.\\d+:\\d+)?$"
+ "^(§.)*Wave: (§.)*\\d+(§.)*( §.- §.\\d+:\\d+)?$",
)
val tokensPattern by kuudraSb.pattern(
"tokens",
- "^(§.)*Tokens: §.[\\w,]+$"
+ "^(§.)*Tokens: §.[\\w,]+$",
)
val submergesPattern by kuudraSb.pattern(
"submerges",
- "^(§.)*Submerges In: (§.)*[\\w,?:]+$"
+ "^(§.)*Submerges In: (§.)*[\\w,?:]+$",
)
// farming
private val farmingSb = scoreboardGroup.group("farming")
val medalsPattern by farmingSb.pattern(
"medals",
- "§[6fc]§l(GOLD|SILVER|BRONZE) §fmedals: §[6fc]\\d+$"
+ "§[6fc]§l(GOLD|SILVER|BRONZE) §fmedals: §[6fc]\\d+$",
)
val lockedPattern by farmingSb.pattern(
"locked",
- "^\\s*§cLocked$"
+ "^\\s*§cLocked$",
)
val cleanUpPattern by farmingSb.pattern(
"cleanup",
- "^\\s*(§.)*Cleanup(§.)*: (§.)*[\\d,.]*%?$"
+ "^\\s*(§.)*Cleanup(§.)*: (§.)*[\\d,.]*%?$",
)
val pastingPattern by farmingSb.pattern(
"pasting",
- "^\\s*§f(Barn )?Pasting§7: (§.)*[\\d,.]+%?$"
+ "^\\s*§f(Barn )?Pasting§7: (§.)*[\\d,.]+%?$",
)
val peltsPattern by farmingSb.pattern(
"pelts",
- "^(§.)*Pelts: (§.)*([\\d,]+).*$"
+ "^(§.)*Pelts: (§.)*([\\d,]+).*$",
)
val mobLocationPattern by farmingSb.pattern(
"moblocation",
- "^(§.)*Tracker Mob Location:"
+ "^(§.)*Tracker Mob Location:",
)
val jacobsContestPattern by farmingSb.pattern(
"jacobscontest",
- "^§eJacob's Contest$"
+ "^§eJacob's Contest$",
)
val plotPattern by farmingSb.pattern(
"plot",
- "\\s*§aPlot §7-.*"
+ "\\s*§aPlot §7-.*",
)
// mining
@@ -191,7 +198,7 @@ object ScoreboardPattern {
*/
val powderPattern by miningSb.pattern(
"powder",
- "(?:§.)*᠅ (?:§.)(?<type>Gemstone|Mithril|Glacite)(?: Powder)?(?:§.)*:? (?:§.)*(?<amount>[\\d,.]*)"
+ "(?:§.)*᠅ (?:§.)(?<type>Gemstone|Mithril|Glacite)(?: Powder)?(?:§.)*:? (?:§.)*(?<amount>[\\d,.]*)",
)
/**
@@ -201,167 +208,167 @@ object ScoreboardPattern {
*/
val powderGreedyPattern by miningSb.pattern(
"powdergreedy",
- "(?:§.)*᠅ (?:§.)(?<type>Gemstone|Mithril|Glacite)(?: Powder)?.*$"
+ "(?:§.)*᠅ (?:§.)(?<type>Gemstone|Mithril|Glacite)(?: Powder)?.*$",
)
val windCompassPattern by miningSb.pattern(
"windcompass",
- "§9Wind Compass$"
+ "§9Wind Compass$",
)
val windCompassArrowPattern by miningSb.pattern(
"windcompassarrow",
- "( )*((§[a-zA-Z0-9]|[⋖⋗≈])+)( )*((§[a-zA-Z0-9]|[⋖⋗≈])+)?( )*"
+ "( )*((§[a-zA-Z0-9]|[⋖⋗≈])+)( )*((§[a-zA-Z0-9]|[⋖⋗≈])+)?( )*",
)
val miningEventPattern by miningSb.pattern(
"miningevent",
- "^Event: §.§L.*$"
+ "^Event: §.§L.*$",
)
val miningEventZonePattern by miningSb.pattern(
"miningeventzone",
- "^Zone: §.*$"
+ "^Zone: §.*$",
)
val raffleUselessPattern by miningSb.pattern(
"raffleuseless",
- "^(Find tickets on the|ground and bring them|to the raffle box)$"
+ "^(Find tickets on the|ground and bring them|to the raffle box)$",
)
val raffleTicketsPattern by miningSb.pattern(
"raffletickets",
- "^Tickets: §a\\d+ §7\\(\\d{1,3}\\.\\d%\\)$"
+ "^Tickets: §a\\d+ §7\\(\\d{1,3}\\.\\d%\\)$",
)
val rafflePoolPattern by miningSb.pattern(
"rafflepool",
- "^Pool: §6\\d+§8/500$"
+ "^Pool: §6\\d+§8/500$",
)
val mithrilUselessPattern by miningSb.pattern(
"mithriluseless",
- "^§7Give Tasty Mithril to Don!$"
+ "^§7Give Tasty Mithril to Don!$",
)
val mithrilRemainingPattern by miningSb.pattern(
"mithrilremaining",
- "^Remaining: §a(\\d+ Tasty Mithril|FULL)$"
+ "^Remaining: §a(\\d+ Tasty Mithril|FULL)$",
)
val mithrilYourMithrilPattern by miningSb.pattern(
"mithrilyourmithril",
- "^Your Tasty Mithril: §c\\d+.*$"
+ "^Your Tasty Mithril: §c\\d+.*$",
)
val nearbyPlayersPattern by miningSb.pattern(
"nearbyplayers",
- "^Nearby Players: §.(\\d+|N/A)$"
+ "^Nearby Players: §.(\\d+|N/A)$",
)
val uselessGoblinPattern by miningSb.pattern(
"uselessgoblin",
- "^§7Kill goblins!$"
+ "^§7Kill goblins!$",
)
val remainingGoblinPattern by miningSb.pattern(
- "remaininggoblin", "^Remaining: §a\\d+ goblins$"
+ "remaininggoblin", "^Remaining: §a\\d+ goblins$",
)
val yourGoblinKillsPattern by miningSb.pattern(
- "yourgoblin", "^Your kills: §c\\d+ ☠( §a\\(\\+\\d+\\))?$"
+ "yourgoblin", "^Your kills: §c\\d+ ☠( §a\\(\\+\\d+\\))?$",
)
val mineshaftNotStartedPattern by miningSb.pattern(
"mineshaft.notstarted",
- "(?:§.)*Not started.*"
+ "(?:§.)*Not started.*",
)
val fortunateFreezingBonusPattern by miningSb.pattern(
"fortunatefreezing.bonus",
- "Event Bonus: §6\\+\\d+☘"
+ "Event Bonus: §6\\+\\d+☘",
)
val fossilDustPattern by miningSb.pattern(
"fossildust",
- "Fossil Dust: §f[\\d.,]+.*"
+ "Fossil Dust: §f[\\d.,]+.*",
)
// combat
private val combatSb = scoreboardGroup.group("combat")
val magmaChamberPattern by combatSb.pattern(
"magmachamber",
- "^Magma Chamber$"
+ "^Magma Chamber$",
)
val magmaBossPattern by combatSb.pattern(
"magmaboss",
- "^§7Boss: §[c6e]\\d{1,3}%$"
+ "^§7Boss: §[c6e]\\d{1,3}%$",
)
val damageSoakedPattern by combatSb.pattern(
"damagesoaked",
- "^§7Damage Soaked:"
+ "^§7Damage Soaked:",
)
val killMagmasPattern by combatSb.pattern(
"killmagmas",
- "^§6Kill the Magmas:$"
+ "^§6Kill the Magmas:$",
)
val killMagmasDamagedSoakedBarPattern by combatSb.pattern(
"killmagmasbar",
- "^((§.)*▎+)+.*$"
+ "^((§.)*▎+)+.*$",
)
val reformingPattern by combatSb.pattern(
"magmareforming",
- "^§cThe boss is (?:re)?forming!$"
+ "^§cThe boss is (?:re)?forming!$",
)
val bossHealthPattern by combatSb.pattern(
"magmabosshealth",
- "^§7Boss Health:$"
+ "^§7Boss Health:$",
)
val bossHealthBarPattern by combatSb.pattern(
"magmabosshealthbar",
- "^§.(\\d{1,2}(\\.\\d)?M|\\d{1,3}k)§f/§a10M§c❤$"
+ "^§.(\\d{1,2}(\\.\\d)?M|\\d{1,3}k)§f/§a10M§c❤$",
)
val broodmotherPattern by combatSb.pattern(
"broodmother",
- "^§4Broodmother§7: §[e64](Slain|Dormant|Soon|Awakening|Imminent|Alive!)$"
+ "^§4Broodmother§7: §[e64](Slain|Dormant|Soon|Awakening|Imminent|Alive!)$",
)
val bossHPPattern by combatSb.pattern(
"bosshp",
- "^(Protector|Dragon) HP: §a(,?\\d{1,3})* §c❤$"
+ "^(Protector|Dragon) HP: §a(,?\\d{1,3})* §c❤$",
)
val bossDamagePattern by combatSb.pattern(
"bossdamage",
- "^Your Damage: §c(,?\\d{1,3}(\\.\\d)?)*$"
+ "^Your Damage: §c(,?\\d{1,3}(\\.\\d)?)*$",
)
val slayerQuestPattern by combatSb.pattern(
"slayerquest",
- "^Slayer Quest$"
+ "^Slayer Quest$",
)
// misc
private val miscSb = scoreboardGroup.group("misc")
val essencePattern by miscSb.pattern(
"essence",
- "^\\s*.*Essence: §.(?<essence>-?\\d+(:?,\\d{3})*(?:\\.\\d+)?)$"
+ "^\\s*.*Essence: §.(?<essence>-?\\d+(:?,\\d{3})*(?:\\.\\d+)?)$",
)
val redstonePattern by miscSb.pattern(
"redstone",
- "\\s*(§.)*⚡ §cRedstone: (§.)*\\d{1,3}%$"
+ "\\s*(§.)*⚡ §cRedstone: (§.)*\\d{1,3}%$",
)
val visitingPattern by miscSb.pattern(
"visiting",
- "^\\s*§a✌ §7\\(§.\\d+(§.)?/\\d+(§.)?\\)$"
+ "^\\s*§a✌ §7\\(§.\\d+(§.)?/\\d+(§.)?\\)$",
)
val flightDurationPattern by miscSb.pattern(
"flightduration",
- "^\\s*Flight Duration: §a(:?\\d{1,3})*$"
+ "^\\s*Flight Duration: §a(:?\\d{1,3})*$",
)
val dojoChallengePattern by miscSb.pattern(
"dojochallenge",
- "^(§.)*Challenge: (§.)*(?<challenge>[\\w ]+)$"
+ "^(§.)*Challenge: (§.)*(?<challenge>[\\w ]+)$",
)
val dojoDifficultyPattern by miscSb.pattern(
"dojodifficulty",
- "^(§.)*Difficulty: (§.)*(?<difficulty>[\\w ]+)$"
+ "^(§.)*Difficulty: (§.)*(?<difficulty>[\\w ]+)$",
)
val dojoPointsPattern by miscSb.pattern(
"dojopoints",
- "^(§.)*Points: (§.)*[\\w.]+ ?(§7\\(§.*§7\\))?\$"
+ "^(§.)*Points: (§.)*[\\w.]+ ?(§7\\(§.*§7\\))?\$",
)
val dojoTimePattern by miscSb.pattern(
"dojotime",
- "^(§.)*Time: (§.)*[\\w.]+( §7\\(§.*§7\\))?$"
+ "^(§.)*Time: (§.)*[\\w.]+( §7\\(§.*§7\\))?$",
)
val objectivePattern by miscSb.pattern(
"objective",
- "^(§.)*(Objective|Quest).*"
+ "^(§.)*(Objective|Quest).*",
)
val queuePattern by miscSb.pattern(
"queued",
- "Queued:.*"
+ "Queued:.*",
)
val queuePositionPattern by miscSb.pattern(
"queueposition",
@@ -379,83 +386,83 @@ object ScoreboardPattern {
// this thirdObjectiveLinePattern includes all those weird objective lines that go into a third scoreboard line
val thirdObjectiveLinePattern by miscSb.pattern(
"thirdobjectiveline",
- "(\\s*§.\\(§.\\w+§./§.\\w+§.\\)|§f Mages.*|§f Barbarians.*|§edefeat Kuudra|§eand stun him)"
+ "(\\s*§.\\(§.\\w+§./§.\\w+§.\\)|§f Mages.*|§f Barbarians.*|§edefeat Kuudra|§eand stun him)",
)
// collection of lines that just randomly exist and I have no clue how on earth to effectively remove them
val wtfAreThoseLinesPattern by miscSb.pattern(
"wtfarethoselines",
- "^(§eMine \\d+ .*|§eKill 100 Automatons|§eFind a Jungle Key|§eFind the \\d+ Missing Pieces?|§eTalk to the Goblin King)$"
+ "^(§eMine \\d+ .*|§eKill 100 Automatons|§eFind a Jungle Key|§eFind the \\d+ Missing Pieces?|§eTalk to the Goblin King)$",
)
val darkAuctionCurrentItemPattern by miscSb.pattern(
"darkauction.currentitem",
- "^Current Item:$"
+ "^Current Item:$",
)
// events
private val eventsSb = scoreboardGroup.group("events")
val travelingZooPattern by eventsSb.pattern(
"travelingzoo",
- "§aTraveling Zoo§f \\d{0,2}:\\d{2}$"
+ "§aTraveling Zoo§f \\d{0,2}:\\d{2}$",
)
val newYearPattern by eventsSb.pattern(
"newyear",
- "§dNew Year Event!§f \\d{0,2}?:?\\d{2}$"
+ "§dNew Year Event!§f \\d{0,2}?:?\\d{2}$",
)
val spookyPattern by eventsSb.pattern(
"spooky",
- "§6Spooky Festival§f \\d{0,2}?:?\\d{2}$"
+ "§6Spooky Festival§f \\d{0,2}?:?\\d{2}$",
)
val winterEventStartPattern by eventsSb.pattern(
"wintereventstart",
- "(§.)*Event Start: §.\\d+:\\d+$"
+ "(§.)*Event Start: §.\\d+:\\d+$",
)
val winterNextWavePattern by eventsSb.pattern(
"wintereventnextwave",
- "(§.)*Next Wave: (§.)*(\\d+:\\d+|Soon!)$"
+ "(§.)*Next Wave: (§.)*(\\d+:\\d+|Soon!)$",
)
val winterWavePattern by eventsSb.pattern(
"wintereventwave",
- "(§.)*Wave \\d+$"
+ "(§.)*Wave \\d+$",
)
val winterMagmaLeftPattern by eventsSb.pattern(
"wintereventmagmaleft",
- "(§.)*Magma Cubes Left: §.\\d+$"
+ "(§.)*Magma Cubes Left: §.\\d+$",
)
val winterTotalDmgPattern by eventsSb.pattern(
"wintereventtotaldmg",
- "(§.)*Your Total Damage: §.\\d+.*$"
+ "(§.)*Your Total Damage: §.\\d+.*$",
)
val winterCubeDmgPattern by eventsSb.pattern(
"wintereventcubedmg",
- "(§.)*Your Cube Damage: §.\\d+$"
+ "(§.)*Your Cube Damage: §.\\d+$",
)
// rift
private val riftSb = scoreboardGroup.group("rift")
val riftDimensionPattern by riftSb.pattern(
"dimension",
- "^\\s*§fRift Dimension$"
+ "^\\s*§fRift Dimension$",
)
val riftHotdogTitlePattern by riftSb.pattern(
"hotdogtitle",
- "^§6Hot Dog Contest$"
+ "^§6Hot Dog Contest$",
)
val riftHotdogEatenPattern by riftSb.pattern(
"hotdogeaten",
- "^Eaten: §.\\d+\\/\\d+$"
+ "^Eaten: §.\\d+\\/\\d+$",
)
val riftAveikxPattern by riftSb.pattern(
"aveikx",
- "Time spent sitting|with Ävaeìkx: .*"
+ "Time spent sitting|with Ävaeìkx: .*",
)
val riftHayEatenPattern by riftSb.pattern(
"hayeaten",
- "^Hay Eaten: §.[\\d,.]+/[\\d,.]+\$"
+ "^Hay Eaten: §.[\\d,.]+/[\\d,.]+\$",
)
val cluesPattern by riftSb.pattern(
"clues",
- "Clues: §.\\d+/\\d+"
+ "Clues: §.\\d+/\\d+",
)
private val carnivalSb = scoreboardGroup.group("carnival")
@@ -465,7 +472,7 @@ object ScoreboardPattern {
*/
val carnivalPattern by carnivalSb.pattern(
"carnival",
- "§eCarnival§f (?:\\d+:?)*"
+ "§eCarnival§f (?:\\d+:?)*",
)
/**
@@ -475,7 +482,7 @@ object ScoreboardPattern {
*/
val carnivalTasksPattern by carnivalSb.pattern(
"tasks",
- "§.§l(?:Catch a Fish|Fruit Diggin|Zombie Shoot)(?:§.§l(?:g|out))?"
+ "§.§l(?:Catch a Fish|Fruit Diggin|Zombie Shoot)(?:§.§l(?:g|out))?",
)
/**
@@ -483,7 +490,7 @@ object ScoreboardPattern {
*/
val carnivalTokensPattern by carnivalSb.pattern(
"tokens",
- "(?:§f)*Carnival Tokens: §e\\d+"
+ "(?:§f)*Carnival Tokens: §e\\d+",
)
/**
@@ -491,7 +498,7 @@ object ScoreboardPattern {
*/
val carnivalFruitsPattern by carnivalSb.pattern(
"fruits",
- "(?:§f)?Fruits: §.\\d+§.\\/§.\\d+"
+ "(?:§f)?Fruits: §.\\d+§.\\/§.\\d+",
)
/**
@@ -500,7 +507,7 @@ object ScoreboardPattern {
*/
val carnivalScorePattern by carnivalSb.pattern(
"score",
- "(?:§f)?Score: §.\\d+.*"
+ "(?:§f)?Score: §.\\d+.*",
)
/**
@@ -508,7 +515,7 @@ object ScoreboardPattern {
*/
val carnivalCatchStreakPattern by carnivalSb.pattern(
"catchstreak",
- "(?:§f)?Catch Streak: §.\\d+"
+ "(?:§f)?Catch Streak: §.\\d+",
)
/**
@@ -517,7 +524,7 @@ object ScoreboardPattern {
*/
val carnivalAccuracyPattern by carnivalSb.pattern(
"accuracy",
- "(?:§f)?Accuracy: §.\\d+(?:\\.\\d+)?%"
+ "(?:§f)?Accuracy: §.\\d+(?:\\.\\d+)?%",
)
/**
@@ -525,41 +532,41 @@ object ScoreboardPattern {
*/
val carnivalKillsPattern by carnivalSb.pattern(
"kills",
- "(?:§f)?Kills: §.\\d+"
+ "(?:§f)?Kills: §.\\d+",
)
// Stats from the tablist
private val tablistGroup = group.group("tablist")
val gemsPattern by tablistGroup.pattern(
"gems",
- "^\\s*Gems: §a(?<gems>\\d*,?(\\.\\d+)?[a-zA-Z]?)$"
+ "^\\s*Gems: §a(?<gems>\\d*,?(\\.\\d+)?[a-zA-Z]?)$",
)
val bankPattern by tablistGroup.pattern(
"bank",
- "^\\s*Bank: §6(?<bank>[\\w.,]+(?:§7 \\/ §6(?<coop>[\\w.,]+))?)$"
+ "^\\s*Bank: §6(?<bank>[\\w.,]+(?:§7 \\/ §6(?<coop>[\\w.,]+))?)$",
)
val mithrilPowderPattern by tablistGroup.pattern(
"mithrilpowder",
- "^\\s*Mithril(?: Powder)?: (?:§.)+(?<mithrilpowder>[\\d,\\.]+)$"
+ "^\\s*Mithril(?: Powder)?: (?:§.)+(?<mithrilpowder>[\\d,\\.]+)$",
)
val gemstonePowderPattern by tablistGroup.pattern(
"gemstonepowder",
- "^\\s*Gemstone(?: Powder)?: (?:§.)+(?<gemstonepowder>[\\d,\\.]+)$"
+ "^\\s*Gemstone(?: Powder)?: (?:§.)+(?<gemstonepowder>[\\d,\\.]+)$",
)
val glacitePowderPattern by tablistGroup.pattern(
"glacitepowder",
- "^\\s*Glacite(?: Powder)?: (?:§.)+(?<glacitepowder>[\\d,\\.]+)$"
+ "^\\s*Glacite(?: Powder)?: (?:§.)+(?<glacitepowder>[\\d,\\.]+)$",
)
val eventNamePattern by tablistGroup.pattern(
"event",
- "^\\s*§e§lEvent: §r(?<name>§.*)$"
+ "^\\s*§e§lEvent: §r(?<name>§.*)$",
)
val eventTimeEndsPattern by tablistGroup.pattern(
"eventtime",
- "^\\s+Ends In: §r§e(?<time>.*)$"
+ "^\\s+Ends In: §r§e(?<time>.*)$",
)
val eventTimeStartsPattern by tablistGroup.pattern(
"eventtimestarts",
- "^\\s+Starts In: §r§e(?<time>.*)$"
+ "^\\s+Starts In: §r§e(?<time>.*)$",
)
}
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 005fdd5a7..9b82f9b6f 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
@@ -9,9 +9,13 @@ import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeResets
+import java.util.regex.Pattern
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern
object UnknownLinesHandler {
+
+ internal lateinit var remoteOnlyPatterns: Array<Pattern>
+
fun handleUnknownLines() {
val sidebarLines = ScoreboardData.sidebarLinesFormatted
@@ -20,9 +24,9 @@ object UnknownLinesHandler {
.filter { it.isNotBlank() }
.filter { it.trim().length > 3 }
- /*
+ /**
* Remove known lines with patterns
- */
+ **/
val patternsToExclude = listOf(
PurseAPI.coinsPattern,
SbPattern.motesPattern,
@@ -130,57 +134,66 @@ object UnknownLinesHandler {
SbPattern.carnivalCatchStreakPattern,
SbPattern.carnivalAccuracyPattern,
SbPattern.carnivalKillsPattern,
+ *remoteOnlyPatterns,
)
unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { line ->
patternsToExclude.any { pattern -> pattern.matches(line) }
}
- /*
+ /**
* remove known text
- */
+ **/
// remove objectives
- val objectiveLine =
- sidebarLines.firstOrNull { SbPattern.objectivePattern.matches(it) }
- ?: "Objective"
+ val objectiveLine = sidebarLines.firstOrNull { SbPattern.objectivePattern.matches(it) }
+ ?: "Objective"
unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(objectiveLine) != it }
// TODO create function
unconfirmedUnknownLines = unconfirmedUnknownLines.filter {
- sidebarLines.nextAfter(objectiveLine, 2) != it
- && !SbPattern.thirdObjectiveLinePattern.matches(it)
+ sidebarLines.nextAfter(objectiveLine, 2) != it &&
+ !SbPattern.thirdObjectiveLinePattern.matches(it)
}
// Remove jacobs contest
for (i in 1..3)
unconfirmedUnknownLines = unconfirmedUnknownLines.filter {
- sidebarLines.nextAfter(sidebarLines.firstOrNull { line ->
- SbPattern.jacobsContestPattern.matches(line)
- } ?: "§eJacob's Contest", i) != it
+ sidebarLines.nextAfter(
+ sidebarLines.firstOrNull { line ->
+ SbPattern.jacobsContestPattern.matches(line)
+ } ?: "§eJacob's Contest",
+ i,
+ ) != it
}
// Remove slayer
for (i in 1..2)
unconfirmedUnknownLines = unconfirmedUnknownLines.filter {
- sidebarLines.nextAfter(sidebarLines.firstOrNull { line ->
- SbPattern.slayerQuestPattern.matches(line)
- } ?: "Slayer Quest", i) != it
+ sidebarLines.nextAfter(
+ sidebarLines.firstOrNull { line ->
+ SbPattern.slayerQuestPattern.matches(line)
+ } ?: "Slayer Quest",
+ i,
+ ) != it
}
// remove trapper mob location
unconfirmedUnknownLines = unconfirmedUnknownLines.filter {
- sidebarLines.nextAfter(sidebarLines.firstOrNull { line ->
- SbPattern.mobLocationPattern.matches(line)
- } ?: "Tracker Mob Location:") != it
+ sidebarLines.nextAfter(
+ sidebarLines.firstOrNull { line ->
+ SbPattern.mobLocationPattern.matches(line)
+ } ?: "Tracker Mob Location:",
+ ) != it
}
// da
unconfirmedUnknownLines = unconfirmedUnknownLines.filter {
- sidebarLines.nextAfter(sidebarLines.firstOrNull { line ->
- SbPattern.darkAuctionCurrentItemPattern.matches(line)
- } ?: "Current Item:") != it
+ sidebarLines.nextAfter(
+ sidebarLines.firstOrNull { line ->
+ SbPattern.darkAuctionCurrentItemPattern.matches(line)
+ } ?: "Current Item:",
+ ) != it
}
-
/*
* Handle broken scoreboard lines
*/