diff options
author | David Cole <40234707+DavidArthurCole@users.noreply.github.com> | 2024-07-31 17:48:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-31 23:48:13 +0200 |
commit | bbe686f866f418641f6d9c27e9e5a6f7ba8f1b24 (patch) | |
tree | 982e196469533f569d2d9c2bfc43098a725c1431 /src/main/java/at | |
parent | e6a9cc5ec82c495c4ce038e944f05bd4a8ff91db (diff) | |
download | skyhanni-bbe686f866f418641f6d9c27e9e5a6f7ba8f1b24.tar.gz skyhanni-bbe686f866f418641f6d9c27e9e5a6f7ba8f1b24.tar.bz2 skyhanni-bbe686f866f418641f6d9c27e9e5a6f7ba8f1b24.zip |
Fix: Flawless Gemstones in Powder Filter (#2281)
Diffstat (limited to 'src/main/java/at')
4 files changed, 24 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index d42dfbbbf..f274d44f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 52 + const val CONFIG_VERSION = 53 fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/PowderMiningGemstoneFilterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/PowderMiningGemstoneFilterConfig.java index 2b4936af1..3a44738ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/PowderMiningGemstoneFilterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/PowderMiningGemstoneFilterConfig.java @@ -15,38 +15,39 @@ public class PowderMiningGemstoneFilterConfig { @Expose @ConfigOption(name = "Ruby", desc = "Hide Ruby gemstones under a certain quality.") @ConfigEditorDropdown - public GemstoneFilterEntry rubyGemstones = GemstoneFilterEntry.FINE_ONLY; + public GemstoneFilterEntry rubyGemstones = GemstoneFilterEntry.FINE_UP; @Expose @ConfigOption(name = "Sapphire", desc = "Hide Sapphire gemstones under a certain quality.") @ConfigEditorDropdown - public GemstoneFilterEntry sapphireGemstones = GemstoneFilterEntry.FINE_ONLY; + public GemstoneFilterEntry sapphireGemstones = GemstoneFilterEntry.FINE_UP; @Expose @ConfigOption(name = "Amber", desc = "Hide Amber gemstones under a certain quality.") @ConfigEditorDropdown - public GemstoneFilterEntry amberGemstones = GemstoneFilterEntry.FINE_ONLY; + public GemstoneFilterEntry amberGemstones = GemstoneFilterEntry.FINE_UP; @Expose @ConfigOption(name = "Amethyst", desc = "Hide Amethyst gemstones under a certain quality.") @ConfigEditorDropdown - public GemstoneFilterEntry amethystGemstones = GemstoneFilterEntry.FINE_ONLY; + public GemstoneFilterEntry amethystGemstones = GemstoneFilterEntry.FINE_UP; @Expose @ConfigOption(name = "Jade", desc = "Hide Jade gemstones under a certain quality.") @ConfigEditorDropdown - public GemstoneFilterEntry jadeGemstones = GemstoneFilterEntry.FINE_ONLY; + public GemstoneFilterEntry jadeGemstones = GemstoneFilterEntry.FINE_UP; @Expose @ConfigOption(name = "Topaz", desc = "Hide Topaz gemstones under a certain quality.") @ConfigEditorDropdown - public GemstoneFilterEntry topazGemstones = GemstoneFilterEntry.FINE_ONLY; + public GemstoneFilterEntry topazGemstones = GemstoneFilterEntry.FINE_UP; public enum GemstoneFilterEntry { SHOW_ALL("Show All"), HIDE_ALL("Hide all"), FLAWED_UP("Show §aFlawed §7or higher"), - FINE_ONLY("Show §9Fine §7only"); + FINE_UP("Show §9Fine §7or higher"), + FLAWLESS_ONLY("Show §5Flawless §7only"); private final String str; diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 3f2897aae..e4e411d4c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -576,5 +576,12 @@ object ChatFilter { event.move(3, "chat.profileJoin", "chat.filterType.profileJoin") event.move(3, "chat.others", "chat.filterType.others") event.move(52, "chat.filterType.powderMining", "chat.filterType.powderMiningFilter.enabled") + event.transform(53, "chat.filterType.powderMiningFilter.gemstoneFilterConfig") { element -> + element.asJsonObject.apply { + entrySet().forEach { (key, value) -> + if (value.asString == "FINE_ONLY") addProperty(key, "FINE_UP") + } + } + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt index 63d6dc11d..32ce17b8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt @@ -236,10 +236,11 @@ object PowderMiningChatFilter { * REGEX-TEST: §r§f❈ Rough Amethyst Gemstone §r§8x24 * REGEX-TEST: §r§a❈ Flawed Amethyst Gemstone §r§8x4 * REGEX-TEST: §r§9⸕ Fine Amber Gemstone + * REGEX-TEST: §r§5⸕ Flawless Amber Gemstone */ private val gemstonePattern by patternGroup.pattern( "reward.gemstone", - "§r§[fa9][❤❈☘⸕✎✧] (?<tier>Rough|Flawed|Fine) (?<gem>Ruby|Amethyst|Jade|Amber|Sapphire|Topaz) Gemstone( §r§8x(?<amount>[\\d,]+))?", + "§r§[fa9][❤❈☘⸕✎✧] (?<tier>Rough|Flawed|Fine|Flawless) (?<gem>Ruby|Amethyst|Jade|Amber|Sapphire|Topaz) Gemstone( §r§8x(?<amount>[\\d,]+))?", ) fun block(message: String): String? { @@ -326,8 +327,7 @@ object PowderMiningChatFilter { if (config.goblinEggs == PowderMiningFilterConfig.GoblinEggFilterEntry.SHOW_ALL) return "no_filter" if (config.goblinEggs == PowderMiningFilterConfig.GoblinEggFilterEntry.HIDE_ALL) return "powder_mining_goblin_eggs" - val colorStr = groupOrNull("color")?.lowercase() - return when (colorStr) { + return when (val colorStr = groupOrNull("color")?.lowercase()) { //'Colorless', base goblin eggs will never be shown in this code path null -> "powder_mining_goblin_eggs" "green" -> if (config.goblinEggs > PowderMiningFilterConfig.GoblinEggFilterEntry.GREEN_UP) { @@ -382,9 +382,12 @@ object PowderMiningChatFilter { "flawed" -> if (gemSpecificFilterEntry > GemstoneFilterEntry.FLAWED_UP) { "powder_mining_gemstones" } else "no_filter" - // FINE_ONLY enum not explicitly used in comparison, as the only + "fine" -> if (gemSpecificFilterEntry > GemstoneFilterEntry.FINE_UP) { + "powder_mining_gemstones" + } else "no_filter" + // FLAWLESS_ONLY enum not explicitly used in comparison, as the only // case that will block it is HIDE_ALL, which is covered above - "fine" -> "no_filter" + "flawless" -> "no_filter" // This should not be reachable else -> "no_filter" } |