diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-05-18 11:49:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-18 11:49:53 +0200 |
commit | c5327be0059d50333f43d78a5ebebba35db4de60 (patch) | |
tree | 113d16d28d63ba4bd29e544a4dfc9a01eb8172be /src/main/java/at/hannibal2/skyhanni/features | |
parent | f8a612dd9f6f8fac1887c5fcaa765291c036693b (diff) | |
download | skyhanni-c5327be0059d50333f43d78a5ebebba35db4de60.tar.gz skyhanni-c5327be0059d50333f43d78a5ebebba35db4de60.tar.bz2 skyhanni-c5327be0059d50333f43d78a5ebebba35db4de60.zip |
Fix: FF ioobe (#1823)
Co-authored-by: Luna <luna@alexia.lol>
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt | 12 |
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")) { |