aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-10-01 14:00:20 -0400
committerGitHub <noreply@github.com>2024-10-01 20:00:20 +0200
commit22dfa1ec9977a9440a23f7f7efbf79da81b79e6b (patch)
treef0b35001ccc1e2e36a3851c42acba42cd97b1197 /src
parent0135920e7bd317211514d75f6436463507654866 (diff)
downloadskyhanni-22dfa1ec9977a9440a23f7f7efbf79da81b79e6b.tar.gz
skyhanni-22dfa1ec9977a9440a23f7f7efbf79da81b79e6b.tar.bz2
skyhanni-22dfa1ec9977a9440a23f7f7efbf79da81b79e6b.zip
Fix: Strays Wrongly Counting as Unique (#2627)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStrayTracker.kt17
2 files changed, 22 insertions, 0 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 09c0dedf9..0a144aa2f 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
@@ -14,6 +14,8 @@ import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.eggFoundP
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.getEggType
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI
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.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
@@ -24,6 +26,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher
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.SkyBlockItemModifierUtils.getMinecraftId
import at.hannibal2.skyhanni.utils.SkyblockSeason
import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -108,12 +111,14 @@ object HoppityAPI {
EggFoundEvent(STRAY, it.slotNumber).post()
lastName = "§9Fish the Rabbit"
lastMeal = STRAY
+ 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
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 52a3c5f1b..1aa9d068b 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
@@ -100,6 +100,7 @@ object ChocolateFactoryStrayTracker {
"§7You caught a stray §6§lGolden Rabbit§7! §7You gained §6\\+5 Chocolate §7until the §7end of the SkyBlock year!",
)
+ // TODO: Fix this pattern so it doesn't only match duplicates.
/**
* REGEX-TEST: §7You caught a stray §9Fish the Rabbit§7! §7You have already found §9Fish the §9Rabbit§7, so you received §655,935,257 §6Chocolate§7!
*/
@@ -108,6 +109,22 @@ object ChocolateFactoryStrayTracker {
"§7You caught a stray (?<color>§.)Fish the Rabbit§7! §7You have already found (?:§.)?Fish the (?:§.)?Rabbit§7, so you received §6(?<amount>[\\d,]*) (?:§6)?Chocolate§7!",
)
+ /**
+ * REGEX-TEST: §7You have already found §9Fish the
+ */
+ val duplicatePseudoStrayPattern by ChocolateFactoryAPI.patternGroup.pattern(
+ "stray.pseudoduplicate",
+ "(?:§.)*You have already found.*",
+ )
+
+ /**
+ * REGEX-TEST: §7already have captured him before
+ */
+ val duplicateDoradoStrayPattern by ChocolateFactoryAPI.patternGroup.pattern(
+ "stray.doradoduplicate",
+ "(?:§.)*already have captured him before.*",
+ )
+
private val tracker = SkyHanniTracker("Stray Tracker", { Data() }, { it.chocolateFactory.strayTracker })
{ drawDisplay(it) }