diff options
author | martimavocado <39881008+martimavocado@users.noreply.github.com> | 2024-02-10 00:17:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-10 01:17:57 +0100 |
commit | 791f12f2ee1ad147ddb12abde5a74bd3b0f4bdce (patch) | |
tree | 8354f1c6277170d49418a7e36bdfb21b698dd0aa /src/main/java/at/hannibal2 | |
parent | fb7d2d3af38f5cee2b2029bc93c49943a1b7ae35 (diff) | |
download | skyhanni-791f12f2ee1ad147ddb12abde5a74bd3b0f4bdce.tar.gz skyhanni-791f12f2ee1ad147ddb12abde5a74bd3b0f4bdce.tar.bz2 skyhanni-791f12f2ee1ad147ddb12abde5a74bd3b0f4bdce.zip |
Fixed opening visitor Milestones menu not loading visitor amount for /ff. #988
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index d2eba9974..89cac9417 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -46,7 +46,7 @@ class CaptureFarmingGear { private val patternGroup = RepoPattern.group("garden.fortuneguide.capture") private val tierPattern by patternGroup.pattern( "uniquevisitors.tier", - "§7Progress to Tier (?<nextTier>\\d+):.*" + "§7Progress to Tier (?<nextTier>\\w+):.*" ) private val tierProgressPattern by patternGroup.pattern( "uniquevisitors.tierprogress", @@ -153,7 +153,7 @@ class CaptureFarmingGear { var tierProgress = -1 for (line in item.getLore()) { tierPattern.matchMatcher(line) { - tier = group("nextTier").toInt() - 1 + tier = group("nextTier").romanToDecimalIfNecessary() - 1 } tierProgressPattern.matchMatcher(line) { tierProgress = group("having").toInt() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 10c2eebfd..50bdd453b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.mixins.transformers.AccessorChatComponentText import at.hannibal2.skyhanni.utils.GuiRenderUtils.darkenColor import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiUtilRenderComponents import net.minecraft.util.ChatComponentText @@ -24,6 +25,10 @@ object StringUtils { private val whiteSpaceResetPattern = "^(?:\\s|§r)*|(?:\\s|§r)*$".toPattern() private val whiteSpacePattern = "^\\s*|\\s*$".toPattern() private val resetPattern = "(?i)§R".toPattern() + private val isRomanPattern by RepoPattern.pattern( + "utils.string.isroman", + "^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})" + ) fun String.trimWhiteSpaceAndResets(): String = whiteSpaceResetPattern.matcher(this).replaceAll("") fun String.trimWhiteSpace(): String = whiteSpacePattern.matcher(this).replaceAll("") @@ -290,4 +295,8 @@ object StringUtils { fun String.allLettersFirstUppercase() = split("_").joinToString(" ") { it.firstLetterUppercase() } fun String?.equalsIgnoreColor(string: String?) = this?.let { it.removeColor() == string?.removeColor() } ?: false + + fun String.isRoman(): Boolean { + return isRomanPattern.matches(this) + } } |