diff options
author | HiZe <super@hize.be> | 2024-07-15 16:52:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-15 16:52:52 +0200 |
commit | 6f32006525865f5344972953c1f621fbfaadaea7 (patch) | |
tree | 534578b8e05f75e5e990590aa2e794116580c762 /src | |
parent | 7720607824c8683cbd54c6072bcc2e9cf4eff604 (diff) | |
download | skyhanni-6f32006525865f5344972953c1f621fbfaadaea7.tar.gz skyhanni-6f32006525865f5344972953c1f621fbfaadaea7.tar.bz2 skyhanni-6f32006525865f5344972953c1f621fbfaadaea7.zip |
Fix: Powder Tracker Pattern. (#2207)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt | 158 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt | 20 |
2 files changed, 111 insertions, 67 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt index 0781391eb..8c0fbca57 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt @@ -4,154 +4,212 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern enum class PowderChestReward(val displayName: String, pattern: String) { - MITHRIL_POWDER("§aMithril Powder", "§aYou received §r§b[+](?<amount>.*) §r§aMithril Powder."), - GEMSTONE_POWDER("§dGemstone Powder", "§aYou received §r§b[+](?<amount>.*) §r§aGemstone Powder."), + MITHRIL_POWDER( + "§aMithril Powder", + ".*§2Mithril Powder(?: §r§8x(?<amount>.*))?", + ), + GEMSTONE_POWDER( + "§dGemstone Powder", + ".*§dGemstone Powder(?: §r§8x(?<amount>.*))?", + ), ROUGH_RUBY_GEMSTONE( "§fRough Ruby Gemstone", - "§aYou received §r§f(?<amount>.*) §r§f❤ Rough Ruby Gemstone§r§a." + ".*§f❤ Rough Ruby Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWED_RUBY_GEMSTONE( "§aFlawed Sapphire Gemstone", - "§aYou received §r§f(?<amount>.*) §r§a❤ Flawed Ruby Gemstone§r§a." + ".*§a❤ Flawed Ruby Gemstone(?: §r§8x(?<amount>.*))?", ), FINE_RUBY_GEMSTONE( "§9Fine Ruby Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9❤ Fine Ruby Gemstone§r§a." + ".*§9❤ Fine Ruby Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWLESS_RUBY_GEMSTONE( "§5Flawless Ruby Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9❤ Flawless Ruby Gemstone§r§a." + ".*§5❤ Flawless Ruby Gemstone(?: §r§8x(?<amount>.*))?", ), ROUGH_SAPPHIRE_GEMSTONE( "§fRough Sapphire Gemstone", - "§aYou received §r§f(?<amount>.*) §r§f✎ Rough Sapphire Gemstone§r§a." + ".*§f✎ Rough Sapphire Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWED_SAPPHIRE_GEMSTONE( "§aFlawed Sapphire Gemstone", - "§aYou received §r§f(?<amount>.*) §r§a✎ Flawed Sapphire Gemstone§r§a." + ".*§a✎ Flawed Sapphire Gemstone(?: §r§8x(?<amount>.*))?", ), FINE_SAPPHIRE_GEMSTONE( "§9Fine Sapphire Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9✎ Fine Sapphire Gemstone§r§a." + ".*§9✎ Fine Sapphire Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWLESS_SAPPHIRE_GEMSTONE( "§5Flawless Sapphire Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9✎ Flawless Sapphire Gemstone§r§a." + ".*§5✎ Flawless Sapphire Gemstone(?: §r§8x(?<amount>.*))?", ), ROUGH_AMBER_GEMSTONE( "§fRough Amber Gemstone", - "§aYou received §r§f(?<amount>.*) §r§f⸕ Rough Amber Gemstone§r§a." + ".*§f⸕ Rough Amber Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWED_AMBER_GEMSTONE( "§aFlawed Amber Gemstone", - "§aYou received §r§f(?<amount>.*) §r§a⸕ Flawed Amber Gemstone§r§a." + ".*§a⸕ Flawed Amber Gemstone(?: §r§8x(?<amount>.*))?", ), FINE_AMBER_GEMSTONE( "§9Fine Amber Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9⸕ Fine Amber Gemstone§r§a." + ".*§9⸕ Fine Amber Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWLESS_AMBER_GEMSTONE( "§5Flawless Amber Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9⸕ Flawless Amber Gemstone§r§a." + ".*§5⸕ Flawless Amber Gemstone(?: §r§8x(?<amount>.*))?", ), ROUGH_AMETHYST_GEMSTONE( "§fRough Amethyst Gemstone", - "§aYou received §r§f(?<amount>.*) §r§f❈ Rough Amethyst Gemstone§r§a." + ".*§f❈ Rough Amethyst Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWED_AMETHYST_GEMSTONE( "§aFlawed Amethyst Gemstone", - "§aYou received §r§f(?<amount>.*) §r§a❈ Flawed Amethyst Gemstone§r§a." + ".*§a❈ Flawed Amethyst Gemstone(?: §r§8x(?<amount>.*))?", ), FINE_AMETHYST_GEMSTONE( "§9Fine Amethyst Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9❈ Fine Amethyst Gemstone§r§a." + ".*§9❈ Fine Amethyst Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWLESS_AMETHYST_GEMSTONE( "§5Flawless Amethyst Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9❈ Flawless Amethyst Gemstone§r§a." + ".*§5❈ Flawless Amethyst Gemstone(?: §r§8x(?<amount>.*))?", ), ROUGH_JADE_GEMSTONE( "§fRough Jade Gemstone", - "§aYou received §r§f(?<amount>.*) §r§f☘ Rough Jade Gemstone§r§a." + ".*§f☘ Rough Jade Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWED_JADE_GEMSTONE( "§aFlawed Jade Gemstone", - "§aYou received §r§f(?<amount>.*) §r§a☘ Flawed Jade Gemstone§r§a." + ".*§a☘ Flawed Jade Gemstone(?: §r§8x(?<amount>.*))?", ), FINE_JADE_GEMSTONE( "§9Fine Jade Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9☘ Fine Jade Gemstone§r§a." + ".*§9☘ Fine Jade Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWLESS_JADE_GEMSTONE( "§5Flawless Jade Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9☘ §r§5Flawless Jade Gemstone§r§a." + ".*§5☘ Flawless Jade Gemstone(?: §r§8x(?<amount>.*))?", ), ROUGH_TOPAZ_GEMSTONE( "§fRough Topaz Gemstone", - "§aYou received §r§f(?<amount>.*) §r§f✧ Rough Topaz Gemstone§r§a." + ".*§f✧ Rough Topaz Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWED_TOPAZ_GEMSTONE( "§aFlawed Topaz Gemstone", - "§aYou received §r§f(?<amount>.*) §r§a✧ Flawed Topaz Gemstone§r§a." + ".*§a✧ Flawed Topaz Gemstone(?: §r§8x(?<amount>.*))?", ), FINE_TOPAZ_GEMSTONE( "§9Fine Topaz Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9✧ Fine Topaz Gemstone§r§a." + ".*§9✧ Fine Topaz Gemstone(?: §r§8x(?<amount>.*))?", ), FLAWLESS_TOPAZ_GEMSTONE( "§5Flawless Topaz Gemstone", - "§aYou received §r§f(?<amount>.*) §r§9✧ Flawless Topaz Gemstone§r§a." + ".*§5✧ Flawless Topaz Gemstone(?: §r§8x(?<amount>.*))?", ), - FTX_3070("§9FTX 3070", "§aYou received §r§f(?<amount>.*) §r§9FTX 3070§r§a."), + FTX_3070( + "§9FTX 3070", + ".*§9FTX 3070(?: §r§8x(?<amount>.*))?", + ), ELECTRON_TRANSIMTTER( "§9Electron Transmitter", - "§aYou received §r§f(?<amount>.*) §r§9Electron Transmitter§r§a." + ".*§9Electron Transmitter(?: §r§8x(?<amount>.*))?", ), ROBOTRON_REFLECTOR( "§9Robotron Reflector", - "§aYou received §r§f(?<amount>.*) §r§9Robotron Reflector§r§a." + ".*§9Robotron Reflector(?: §r§8x(?<amount>.*))?", + ), + SUPERLITE_MOTOR( + "§9Superlite Motor", + ".*§9Superlite Motor(?: §r§8x(?<amount>.*))?", + ), + CONTROL_SWITCH( + "§9Control Switch", + ".*§9Control Switch(?: §r§8x(?<amount>.*))?", + ), + SYNTHETIC_HEART( + "§9Synthetic Heart", + ".*§9Synthetic Heart(?: §r§8x(?<amount>.*))?", ), - SUPERLITE_MOTOR("§9Superlite Motor", "§aYou received §r§f(?<amount>.*) §r§9Superlite Motor§r§a."), - CONTROL_SWITCH("§9Control Switch", "§aYou received §r§f(?<amount>.*) §r§9Control Switch§r§a."), - SYNTHETIC_HEART("§9Synthetic Heart", "§aYou received §r§f(?<amount>.*) §r§9Synthetic Heart§r§a."), - GOBLIN_EGG("§9Goblin Egg", "§aYou received §r§f(?<amount>.*) §r§9Goblin Egg§r§a."), + GOBLIN_EGG( + "§9Goblin Egg", + ".*§9Goblin Egg(?: §r§8x(?<amount>.*))?", + ), GREEN_GOBLIN_EGG( "§aGreen Goblin Egg", - "§aYou received §r§f(?<amount>.*) §r§a§r§aGreen Goblin Egg§r§a." + ".*§a§r§aGreen Goblin Egg(?: §r§8x(?<amount>.*))?", + ), + RED_GOBLIN_EGG( + "§cRed Goblin Egg", + ".*§9§r§cRed Goblin Egg(?: §r§8x(?<amount>.*))?", ), - RED_GOBLIN_EGG("§cRed Goblin Egg", "§aYou received §r§f(?<amount>.*) §r§9§r§cRed Goblin Egg§r§a."), YELLOW_GOBLIN_EGG( "§eYellow Goblin Egg", - "§aYou received §r§f(?<amount>.*) §r§9§r§eYellow Goblin Egg§r§a." + ".*§9§r§eYellow Goblin Egg(?: §r§8x(?<amount>.*))?", + ), + BLUE_GOBLIN_EGG( + "§3Blue Goblin Egg", + ".*§9§r§3Blue Goblin Egg(?: §r§8x(?<amount>.*))?", ), - BLUE_GOBLIN_EGG("§3Blue Goblin Egg", "§aYou received §r§f(?<amount>.*) §r§9§r§3Blue Goblin Egg§r§a."), - - WISHING_COMPASS("§aWishing Compass", "§aYou received §r§f(?<amount>.*) §r§aWishing Compass§r§a."), - SLUDGE_JUICE("§aSludge Juice", "§aYou received §r§f(?<amount>.*) §r§aSludge Juice§r§a."), - ASCENSION_ROPE("§9Ascension Rope", "§aYou received §r§f(?<amount>.*) §r§9Ascension Rope§r§a."), - TREASURITE("§5Treasurite", "§aYou received §r§f(?<amount>.*) §r§5Treasurite§r§a."), - JUNGLE_HEART("§6Jungle Heart", "§aYou received §r§f(?<amount>.*) §r§6Jungle Heart§r§a."), - PICKONIMBUS_2000("§5Pickonimbus 2000", "§aYou received §r§f(?<amount>.*) §r§5Pickonimbus 2000§r§a."), - YOGGIE("§aYoggie", "§aYou received §r§f(?<amount>.*) §r§aYoggie§r§a."), - PREHISTORIC_EGG("§fPrehistoric Egg", "§aYou received §r§f(?<amount>.*) §r§fPrehistoric Egg§r§a."), - OIL_BARREL("§aOil Barrel", "§aYou received §r§f(?<amount>.*) §r§aOil Barrel§r§a."), + WISHING_COMPASS( + "§aWishing Compass", + ".*§aWishing Compass(?: §r§8x(?<amount>.*))?", + ), + SLUDGE_JUICE( + "§aSludge Juice", ".*§aSludge Juice(?: §r§8x(?<amount>.*))?", + ), + ASCENSION_ROPE( + "§9Ascension Rope", + ".*§9Ascension Rope(?: §r§8x(?<amount>.*))?", + ), + TREASURITE( + "§5Treasurite", + ".*§5Treasurite(?: §r§8x(?<amount>.*))?", + ), + JUNGLE_HEART( + "§6Jungle Heart", + ".*§6Jungle Heart(?: §r§8x(?<amount>.*))?", + ), + PICKONIMBUS_2000( + "§5Pickonimbus 2000", + ".*§5Pickonimbus 2000(?: §r§8x(?<amount>.*))?", + ), + YOGGIE( + "§aYoggie", + ".*§aYoggie(?: §r§8x(?<amount>.*))?", + ), + PREHISTORIC_EGG( + "§fPrehistoric Egg", + ".*§fPrehistoric Egg(?: §r§8x(?<amount>.*))?", + ), + OIL_BARREL( + "§aOil Barrel", + ".*§aOil Barrel(?: §r§8x(?<amount>.*))?", + ), - DIAMOND_ESSENCE("§bDiamond Essence", "§aYou received §r§b[+](?<amount>.*) Diamond Essence§r§a."), - GOLD_ESSENCE("§6Gold Essence", "§aYou received §r§6[+](?<amount>.*) Gold Essence§r§a."), + DIAMOND_ESSENCE( + "§bDiamond Essence", + ".*§dDiamond Essence(?: §r§8x(?<amount>.*))?", + ), + GOLD_ESSENCE( + "§6Gold Essence", + ".*§dGold Essence(?: §r§8x(?<amount>.*))?", + ), ; val chatPattern by RepoPattern.pattern( "mining.powder.tracker.reward." + this.patternName(), - pattern + pattern, ) private fun patternName() = name.lowercase().replace("_", "") diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index cd148db11..d283c4f2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry import at.hannibal2.skyhanni.data.BossbarData -import at.hannibal2.skyhanni.data.HotmData import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -19,6 +18,7 @@ import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatLong +import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -38,11 +38,7 @@ object PowderTracker { private val patternGroup = RepoPattern.group("mining.powder.tracker") private val pickedPattern by patternGroup.pattern( "picked", - "§6You have successfully picked the lock on this chest!", - ) - private val uncoveredPattern by patternGroup.pattern( - "uncovered", - "§aYou uncovered a treasure chest!", + " §r§6§lCHEST LOCKPICKED ", ) private val powderStartedPattern by patternGroup.pattern( "powder.started", @@ -145,16 +141,6 @@ object PowderTracker { if (!isEnabled()) return val msg = event.message - if (HotmData.GREAT_EXPLORER.let { it.enabled && it.isMaxLevel }) { - uncoveredPattern.matchMatcher(msg) { - tracker.modify { - it.totalChestPicked += 1 - } - isGrinding = true - lastChestPicked = SimpleTimeMark.now() - } - } - pickedPattern.matchMatcher(msg) { tracker.modify { it.totalChestPicked += 1 @@ -176,7 +162,7 @@ object PowderTracker { reward.chatPattern.matchMatcher(msg) { tracker.modify { val count = it.rewards[reward] ?: 0 - var amount = group("amount").formatLong() + var amount = groupOrNull("amount")?.formatLong() ?: 1 if ((reward == PowderChestReward.MITHRIL_POWDER || reward == PowderChestReward.GEMSTONE_POWDER) && doublePowder) { amount *= 2 } |