Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: El Dorado HoppityAPI #2742

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)?.*",
)
Expand Down Expand Up @@ -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(" ")
}
Expand Down
Loading