diff options
author | David Cole <40234707+DavidArthurCole@users.noreply.github.com> | 2024-10-16 06:59:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-16 12:59:13 +0200 |
commit | d8a4d6c37f01364e1cd05b6176acec57f69c2ca2 (patch) | |
tree | 9b691de94c48a93c42fd9a2d7af90c8a72abd47f /src/main/java/at | |
parent | 707959f8e3ffacd1b51e615330346404a5033c80 (diff) | |
download | skyhanni-d8a4d6c37f01364e1cd05b6176acec57f69c2ca2.tar.gz skyhanni-d8a4d6c37f01364e1cd05b6176acec57f69c2ca2.tar.bz2 skyhanni-d8a4d6c37f01364e1cd05b6176acec57f69c2ca2.zip |
Fix: El Dorado HoppityAPI (#2742)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt | 18 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt index 5e1910d0d..8d3ac22c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactor import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.duplicateDoradoStrayPattern import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.duplicatePseudoStrayPattern +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker.formLoreToSingleLine import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -117,16 +118,19 @@ object HoppityAPI { duplicate = it.stack.getLore().any { line -> duplicatePseudoStrayPattern.matches(line) } attemptFireRabbitFound() } - "El Dorado" -> { - EggFoundEvent(STRAY, it.slotNumber).post() - lastName = "§6El Dorado" - lastMeal = STRAY - duplicate = it.stack.getLore().any { line -> duplicateDoradoStrayPattern.matches(line) } - attemptFireRabbitFound() - } else -> return@matchMatcher } } + ChocolateFactoryStrayTracker.strayDoradoPattern.matchMatcher(formLoreToSingleLine(it.stack.getLore())) { + // We don't need to do a handleStrayClicked here - the lore from El Dorado is already: + // §6§lGolden Rabbit §d§lCAUGHT! + // Which will trigger the above matcher. We only need to check name here to fire the found event for Dorado. + EggFoundEvent(STRAY, it.slotNumber).post() + lastName = "§6El Dorado" + lastMeal = STRAY + duplicate = it.stack.getLore().any { line -> duplicateDoradoStrayPattern.matches(line) } + attemptFireRabbitFound() + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt index 9c890aa56..80ed140e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt @@ -77,7 +77,7 @@ object ChocolateFactoryStrayTracker { * REGEX-TEST: §7You caught a stray §6§lGolden Rabbit§7! §7You caught §6El Dorado §7- quite the elusive rabbit! * REGEX-TEST: §7You caught a stray §6§lGolden Rabbit§7! §7You caught §6El Dorado§7! Since you §7already have captured him before, §7you gained §6+324,364,585 Chocolate§7. */ - private val strayDoradoPattern by ChocolateFactoryAPI.patternGroup.pattern( + val strayDoradoPattern by ChocolateFactoryAPI.patternGroup.pattern( "stray.dorado", ".*§6El Dorado(?:.*?§6\\+?(?<amount>[\\d,]+) Chocolate)?.*", ) @@ -147,7 +147,7 @@ object ChocolateFactoryStrayTracker { var goldenTypesCaught: MutableMap<String, Int> = mutableMapOf() } - private fun formLoreToSingleLine(lore: List<String>): String { + fun formLoreToSingleLine(lore: List<String>): String { val notEmptyLines = lore.filter { it.isNotEmpty() } return notEmptyLines.joinToString(" ") } |