From fee966a6da7be441d54f76566fe8ba517fc9b4cb Mon Sep 17 00:00:00 2001 From: sayomaki Date: Sun, 7 Jul 2024 17:30:05 +0800 Subject: Backend: Move hoppity rabbit chat patterns to eggs manager (#2144) --- .../skyhanni/features/event/hoppity/HoppityEggsManager.kt | 6 ++++++ .../chocolatefactory/ChocolateFactoryBarnManager.kt | 13 ++----------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index 8a60516b3..37679bdbf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -70,6 +70,12 @@ object HoppityEggsManager { "rabbit.found.new", "§d§lNEW RABBIT! (?:((§6\\+(?.*) Chocolate §7and )?§6\\+(?.*)x Chocolate §7per second!)|(?.*))", ) + + val duplicateRabbitFound by ChocolateFactoryAPI.patternGroup.pattern( + "rabbit.duplicate", + "§7§lDUPLICATE RABBIT! §6\\+(?[\\d,]+) Chocolate" + ) + private val noEggsLeftPattern by ChocolateFactoryAPI.patternGroup.pattern( "egg.noneleft", "§cThere are no hidden Chocolate Rabbit Eggs nearby! Try again later!", diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt index 62a156ca8..82cd17339 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt @@ -23,15 +23,6 @@ object ChocolateFactoryBarnManager { private val hoppityConfig get() = HoppityEggsManager.config private val profileStorage get() = ChocolateFactoryAPI.profileStorage - private val newRabbitPattern by ChocolateFactoryAPI.patternGroup.pattern( - "rabbit.new", - "§d§lNEW RABBIT! §6\\+\\d+ Chocolate §7and §6\\+0.\\d+x Chocolate §7per second!" - ) - private val rabbitDuplicatePattern by ChocolateFactoryAPI.patternGroup.pattern( - "rabbit.duplicate", - "§7§lDUPLICATE RABBIT! §6\\+(?[\\d,]+) Chocolate" - ) - /** * REGEX-TEST: §c§lBARN FULL! §fOlivette §7got §ccrushed§7! §6+290,241 Chocolate */ @@ -47,14 +38,14 @@ object ChocolateFactoryBarnManager { fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - newRabbitPattern.matchMatcher(event.message) { + HoppityEggsManager.newRabbitFound.matchMatcher(event.message) { val profileStorage = profileStorage ?: return profileStorage.currentRabbits += 1 trySendBarnFullMessage() HoppityEggsManager.shareWaypointPrompt() } - rabbitDuplicatePattern.matchMatcher(event.message) { + HoppityEggsManager.duplicateRabbitFound.matchMatcher(event.message) { HoppityEggsManager.shareWaypointPrompt() val amount = group("amount").formatLong() if (config.showDuplicateTime && !hoppityConfig.compactChat) { -- cgit