From f9dad248e60cb7c34caf2cf82ba0ad0a59e07f5a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 27 Dec 2022 18:49:28 +0100 Subject: Add two more chat filter categories: Powder Mining and Winter Gifts --- .../hannibal2/skyhanni/config/features/Chat.java | 32 ++++++++-- .../hannibal2/skyhanni/features/chat/ChatFilter.kt | 73 +++++++++++++++++++--- .../features/dungeon/DungeonBossMessages.kt | 3 +- .../skyhanni/features/dungeon/DungeonCopilot.kt | 6 +- 4 files changed, 96 insertions(+), 18 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java index c7af12866..029731f96 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java @@ -20,25 +20,49 @@ public class Chat { @ConfigOption(name = "Hypixel Hub", desc = "Block messages outside SkyBlock in the Hypixel lobby: player joins, loot boxes, prototype lobby messages, radiating generosity and Hypixel tournaments.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) - public boolean hypixelHub = false; + public boolean hypixelHub = true; @Expose @ConfigOption(name = "Empty", desc = "Hide all the empty messages from the chat.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) - public boolean empty = false; + public boolean empty = true; @Expose @ConfigOption(name = "Warping", desc = "Block 'sending request to join ..' and 'warping ..' messages.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) - public boolean warping = false; + public boolean warping = true; @Expose @ConfigOption(name = "Welcome", desc = "Hide the 'welcome to skyblock' message.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) - public boolean welcome = false; + public boolean welcome = true; + + @Expose + @ConfigOption(name = "Guild Exp", desc = "Hide Guild Exp messages.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean guildExp = true; + + @Expose + @ConfigOption(name = "Friend Join Left", desc = "Hide friend join/left messages.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean friendJoinLeft = false; + + @Expose + @ConfigOption(name = "Winter Gifts", desc = "Hide useless winter gift messages.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean winterGift = true; + + @Expose + @ConfigOption(name = "Powder Mining", desc = "Hide messages while opening chests in crystal hollows.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean powderMining = true; //TODO remove @Expose 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 742625fb7..963095215 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -24,7 +24,9 @@ class ChatFilter { empty(message) && SkyHanniMod.feature.chat.empty -> "empty" warping(message) && SkyHanniMod.feature.chat.warping -> "warping" welcome(message) && SkyHanniMod.feature.chat.welcome -> "welcome" - guild(message) && SkyHanniMod.feature.chat.others -> "guild" + isGuildExp(message) && SkyHanniMod.feature.chat.guildExp -> "guild_exp" + friendJoin(message) && SkyHanniMod.feature.chat.friendJoinLeft -> "friend_join" + killCombo(message) && SkyHanniMod.feature.chat.others -> "kill_combo" bazaarAndAHMiniMessages(message) && SkyHanniMod.feature.chat.others -> "bz_ah_minis" watchdogAnnouncement(message) && SkyHanniMod.feature.chat.others -> "watchdog" @@ -36,9 +38,11 @@ class ChatFilter { money(message) && SkyHanniMod.feature.chat.others -> "money" winterIsland(message) && SkyHanniMod.feature.chat.others -> "winter_island" uselessWarning(message) && SkyHanniMod.feature.chat.others -> "useless_warning" - friendJoin(message) && SkyHanniMod.feature.chat.others -> "friend_join" annoyingSpam(message) && SkyHanniMod.feature.chat.others -> "annoying_spam" + isWinterGift(message) && SkyHanniMod.feature.chat.winterGift -> "winter_gift" + isPowderMining(message) && SkyHanniMod.feature.chat.powderMining -> "powder_mining" + else -> "" } @@ -142,7 +146,6 @@ class ChatFilter { } private fun party(message: String): Boolean { - if (message == "§9§m-----------------------------") return true if (message == "§9§m-----------------------------------------------------") return true return false @@ -278,13 +281,10 @@ class ChatFilter { else -> false } - private fun guild(message: String): Boolean = when { - message.matchRegex("§2Guild > (.*) §r§e(joined|left).") -> true - message.matchRegex("§aYou earned §r§2\\d+ GEXP §r§afrom playing SkyBlock!") -> true - message.matchRegex("§aYou earned §r§2(\\d|,)+ GEXP §r§a\\+ §r§[e5](\\d|,)+ Event EXP §r§afrom playing SkyBlock!") -> true - message == "§b§m-----------------------------------------------------" -> true - else -> false - } + private fun isGuildExp(message: String) = + // §aYou earned §r§22 GEXP §r§afrom playing SkyBlock! + // §aYou earned §r§22 GEXP §r§a+ §r§c210 Event EXP §r§afrom playing SkyBlock! + message.matchRegex("§aYou earned §r§2.* GEXP (§r§a\\+ §r§.* Event EXP )?§r§afrom playing SkyBlock!") private fun welcome(message: String): Boolean = message == "§eWelcome to §r§aHypixel SkyBlock§r§e!" @@ -319,4 +319,57 @@ class ChatFilter { else -> false } + + private fun isWinterGift(message: String): Boolean = when { + //winter gifts useless + message.matchRegex("§f§lCOMMON! §r§3.* XP §r§egift with §r.*§r§e!") -> true + message.matchRegex("(§f§lCOMMON|§9§lRARE)! §r.* XP Boost .* Potion §r.*§r§e!") -> true + message.matchRegex("(§f§lCOMMON|§9§lRARE)! §r§6.* coins §r§egift with §r.*§r§e!") -> true + + //enchanted book + message.matchRegex("§9§lRARE! §r§9Scavenger IV §r§egift with §r.*§r§e!") -> true + message.matchRegex("§9§lRARE! §r§9Looting IV §r§egift with §r.*§r§e!") -> true + message.matchRegex("§9§lRARE! §r§9Luck VI §r§egift with §r.*§r§e!") -> true + + message.matchRegex("§e§lSWEET! §r§f(Grinch|Santa|Gingerbread Man) Minion Skin §r§egift with §r.*§r§e!") -> true + message.matchRegex("§9§lRARE! §r§f◆ Ice Rune §r§egift with §r.*§r§e!") -> true + + //furniture + message.matchRegex("§e§lSWEET! §r§fTall Holiday Tree §r§egift with §r.*§r§e!") -> true + message.matchRegex("§e§lSWEET! §r§fNutcracker §r§egift with §r.*§r§e!") -> true + message.matchRegex("§e§lSWEET! §r§fPresent Stack §r§egift with §r.*§r§e!") -> true + + message.matchRegex("§e§lSWEET! §r§9(Winter|Battle) Disc §r§egift with §r.*§r§e!") -> true + + //winter gifts a bit useful + message.matchRegex("§e§lSWEET! §r§9Winter Sack §r§egift with §r.*§r§e!") -> true + message.matchRegex("§e§lSWEET! §r§5Snow Suit .* §r§egift with §r.*§r§e!") -> true + + //winter gifts not your gifts + message.matchRegex("§cThis gift is for §r.*§r§c, sorry!") -> true + + else -> false + } + + private fun isPowderMining(message: String) = when { + message.matchRegex("§cYou need a stronger tool to mine (Amethyst|Ruby|Jade|Amber|Sapphire) Gemstone Block§r§c.") -> true + + message.matchRegex("§aYou received §r§f\\d* §r§f[❤❈☘⸕✎] §r§fRough (Ruby|Amethyst|Jade|Amber|Sapphire) Gemstone§r§a\\.") -> true + message.matchRegex("§aYou received §r§f\\d §r§a[❤❈☘⸕✎] §r§aFlawed (Ruby|Amethyst|Jade|Amber|Sapphire) Gemstone§r§a\\.") -> true + + + message == "§aYou uncovered a treasure chest!" -> true + message == "§aYou received §r§f1 §r§aWishing Compass§r§a." -> true + message == "§aYou received §r§f1 §r§9Ascension Rope§r§a." -> true + + //Jungle + message.matchRegex("§aYou received §r§f\\d* §r§aSludge Juice§r§a\\.") -> true + message == "§aYou received §r§f1 §r§aOil Barrel§r§a." -> true + + //Useful, maybe in another chat + message.matchRegex("§aYou received §r§b\\+\\d{1,3} §r§a(Mithril|Gemstone) Powder") -> true + message == "§6You have successfully picked the lock on this chest!" -> true + + else -> false + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt index 1ffd0fc70..e8636ed7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossMessages.kt @@ -24,7 +24,8 @@ class DungeonBossMessages { when { message.matchRegex("§([cd4])\\[BOSS] (.*)") -> { when { - message.contains(" The Watcher§r§f: ") -> return true + message.contains(" The Watcher§r§f: ") -> + message != "§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass." message.contains(" Bonzo§r§f: ") -> return true message.contains(" Scarf§r§f:") -> return true message.contains("Professor§r§f") -> return true diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index b4620ece4..ef19d53ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -18,7 +18,7 @@ class DungeonCopilot { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inDungeons) return + if (!isEnabled()) return val message = event.message @@ -71,6 +71,7 @@ class DungeonCopilot { } if (message == "§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass.") { + event.blockedReason = "dungeon copilot" changeNextStep("Enter Boss Room") } } @@ -127,8 +128,7 @@ class DungeonCopilot { @SubscribeEvent fun renderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.copilotEnabled) return + if (!isEnabled()) return SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep) } -- cgit