aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt12
1 files changed, 7 insertions, 5 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 367ce5a55..db008f6b6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
@@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull
import at.hannibal2.skyhanni.utils.LorenzUtils.round
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -52,8 +53,8 @@ object FarmingFortuneDisplay {
"§7You have §6\\+(?<ff>\\d{1,3})☘ .*"
)
private val tooltipFortunePattern by patternGroup.pattern(
- "tooltip",
- "^§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?(?: §d\\(\\+(\\d+)\\))?\$"
+ "tooltip.new",
+ "^§7Farming Fortune: §a\\+(?<display>[\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(?<reforge>\\d+)\\))?(?: §d\\(\\+(?<gemstone>\\d+)\\))?\$"
)
private val armorAbilityPattern by patternGroup.pattern(
"armorability",
@@ -63,6 +64,7 @@ object FarmingFortuneDisplay {
"lotusability",
"§7Piece Bonus: §6+(?<bonus>.*)☘"
)
+
// todo make pattern work on Melon and Cropie armor
private val armorAbilityFortunePattern by patternGroup.pattern(
"armorabilityfortune",
@@ -345,9 +347,9 @@ object FarmingFortuneDisplay {
for (line in tool?.getLore()!!) {
tooltipFortunePattern.matchMatcher(line) {
- displayedFortune = group(1)!!.toDouble()
- reforgeFortune = group(2)?.toDouble() ?: 0.0
- gemstoneFortune = group(3)?.toDouble() ?: 0.0
+ displayedFortune = group("display")?.toDouble() ?: 0.0
+ reforgeFortune = groupOrNull("reforge")?.toDouble() ?: 0.0
+ gemstoneFortune = groupOrNull("gemstone")?.toDouble() ?: 0.0
} ?: continue
itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) {