aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-09-03 03:52:51 -0400
committerGitHub <noreply@github.com>2024-09-03 09:52:51 +0200
commitc6fd094ab8023588fd9369fe8e959b223d2ec312 (patch)
tree6f531dcd2fb7f6834e4af8bf3a7c1eee89bc63cd /src/main
parentf5099a2b6d29099433e66781a8b26ab11e1902c8 (diff)
downloadskyhanni-c6fd094ab8023588fd9369fe8e959b223d2ec312.tar.gz
skyhanni-c6fd094ab8023588fd9369fe8e959b223d2ec312.tar.bz2
skyhanni-c6fd094ab8023588fd9369fe8e959b223d2ec312.zip
Fix: El Dorado and Stray Rabbit Horde patterns (#2450)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt49
1 files changed, 17 insertions, 32 deletions
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 e8ad465cd..89b8355be 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
@@ -17,8 +17,10 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzRarity
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
+import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
+import at.hannibal2.skyhanni.utils.StringUtils.removeResets
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
@@ -64,26 +66,21 @@ object ChocolateFactoryStrayTracker {
/**
* REGEX-TEST: §7You caught a stray §6§lGolden Rabbit§7! §7You caught a glimpse of §6El Dorado§7, §7but he escaped and left behind §7§6313,780 Chocolate§7!
- */
- private val goldenStrayDoradoEscape by ChocolateFactoryAPI.patternGroup.pattern(
- "stray.goldendoradoescape",
- "§7You caught a stray §6§lGolden Rabbit§7! §7You caught a glimpse of §6El Dorado§7, §7but he escaped and left behind §7§6\\+(?<amount>[\\d,]*) Chocolate§7!",
- )
-
- /**
* 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 goldenStrayDoradoCaught by ChocolateFactoryAPI.patternGroup.pattern(
- "stray.goldendoradocaught",
- "§7You caught a stray §6§lGolden Rabbit§7! §7You caught §6El Dorado §7- quite the elusive rabbit!",
+ private val strayDoradoPattern by ChocolateFactoryAPI.patternGroup.pattern(
+ "stray.dorado",
+ ".*§6El Dorado(?:.*?§6\\+?(?<amount>[\\d,]+) Chocolate)?.*",
)
/**
- * 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.
+ * REGEX-TEST: §7A hoard of §aStray Rabbits §7has appeared!
+ * REGEX-TEST: §r§7A hoard of §r§aStray Rabbits §r§7has appeared!
*/
- private val goldenStrayDoradoDuplicate by ChocolateFactoryAPI.patternGroup.pattern(
- "stray.goldendoradoduplicate",
- "§7You caught a stray §6§lGolden Rabbit§7! §7You caught §6El Dorado§7! Since you §7already have captured him before, §7you gained §6\\+(?<amount>[\\d,]*) Chocolate§7.",
+ private val strayHoardPattern by ChocolateFactoryAPI.patternGroup.pattern(
+ "stray.hoard",
+ ".*(?:§r)?§7A hoard of (?:§r)?§aStray Rabbits (?:§r)?§7has.*",
)
/**
@@ -248,28 +245,16 @@ object ChocolateFactoryStrayTracker {
}
// Golden Strays, hoard/stampede
- if (loreLine == "§7You caught a stray §6§lGolden Rabbit§7! §7A hoard of §aStray Rabbits §7has appeared!") {
+ strayHoardPattern.matchMatcher(loreLine.removeResets()) {
incrementGoldenType("stampede")
}
- // Golden Strays, El Dorado "glimpse" - 1/3 before capture
- goldenStrayDoradoEscape.matchMatcher(loreLine) {
- incrementRarity("legendary", group("amount").formatLong())
- incrementGoldenType("dorado")
- }
-
- // Golden Strays, El Dorado caught - 3/3
- if (goldenStrayDoradoCaught.matches(loreLine)) {
- incrementRarity("legendary")
- tracker.modify { t -> t.goldenTypesCaught["dorado"] = 3 }
- }
-
- // Golden Strays, El Dorado (duplicate catch)
- goldenStrayDoradoDuplicate.matchMatcher(loreLine) {
- incrementRarity("legendary", group("amount").formatLong())
- tracker.modify { t ->
- t.goldenTypesCaught["dorado"] = t.goldenTypesCaught["dorado"]?.plus(1) ?: 4
+ // El Dorado - all catches
+ strayDoradoPattern.matchMatcher(loreLine) {
+ groupOrNull("amount")?.let { amount ->
+ incrementRarity("legendary", amount.formatLong())
}
+ incrementGoldenType("dorado")
}
}
}