aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-16 01:06:12 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-16 01:06:12 +0100
commitebfbe5d586c40663f58540cd7a0d428633c7298f (patch)
treeb469a5fb6ef5dce6f3365e26685a62a707b923b9 /src/main/java/at/hannibal2
parent8c979df9d3be195d406ec000a36f2def6ccd9c50 (diff)
downloadskyhanni-ebfbe5d586c40663f58540cd7a0d428633c7298f.tar.gz
skyhanni-ebfbe5d586c40663f58540cd7a0d428633c7298f.tar.bz2
skyhanni-ebfbe5d586c40663f58540cd7a0d428633c7298f.zip
Fixed /ff not detecting collection analyst fortune.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
index 952786e32..1baa9398e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
@@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
@@ -155,7 +156,7 @@ class FarmingFortuneDisplay {
CropAccessoryData.cropAccessory?.getFortune(it)
}
- private val collectionPattern = "§7You have §6\\+([\\d]{1,3})☘ Farming Fortune".toRegex()
+ private val collectionPattern = "§7You have §6\\+(?<ff>\\d{1,3})☘ .* Fortune§7.".toPattern()
private val tooltipFortunePattern =
"^§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?$".toRegex()
private val armorAbilityPattern = "Tiered Bonus: .* [(](?<pieces>.*)/4[)]".toPattern()
@@ -186,14 +187,8 @@ class FarmingFortuneDisplay {
}
fun getCollectionFortune(tool: ItemStack?): Double {
- val lore = tool?.getLore() ?: return 0.0
- var hasCollectionAbility = false
- return lore.firstNotNullOfOrNull {
- if (hasCollectionAbility || it == "§6Collection Analysis") {
- hasCollectionAbility = true
- collectionPattern.matchEntire(it)?.groups?.get(1)?.value?.toDoubleOrNull()
- } else null
- } ?: 0.0
+ val string = tool?.getLore()?.nextAfter("§6Collection Analysis", 3) ?: return 0.0
+ return collectionPattern.matchMatcher(string) { group("ff").toDoubleOrNull() } ?: 0.0
}
fun getCounterFortune(tool: ItemStack?): Double {