diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-27 14:25:56 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-27 14:25:56 +0200 |
commit | 3a950dcbc451697ee4ef3eaa4b1df6195b865786 (patch) | |
tree | 8f31981970d2e8f94e5a02d9dcf3d0acc00135a6 | |
parent | 304aa419337697a4268e5cea0648a69547371b1b (diff) | |
download | skyhanni-3a950dcbc451697ee4ef3eaa4b1df6195b865786.tar.gz skyhanni-3a950dcbc451697ee4ef3eaa4b1df6195b865786.tar.bz2 skyhanni-3a950dcbc451697ee4ef3eaa4b1df6195b865786.zip |
Added support for overflow garden levels greater than 15. Players who already have garden level 15 may need to open the desk again to update.
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index 112ef5a1f..6c4abadb8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -16,7 +16,8 @@ import kotlin.math.roundToInt class GardenLevelDisplay { private val config get() = SkyHanniMod.feature.garden - private val overflowPattern = "(?:.*) §e(.*)§6\\/(?:.*)".toPattern() + private val expToNextLevelPattern = "(?:.*) §e(.*)§6\\/(?:.*)".toPattern() + private val overflowPattern = ".*§r §6(?<overflow>.*) XP".toPattern() private val namePattern = "Garden Level (.*)".toPattern() private var gardenExp get() = SkyHanniMod.feature.hidden.gardenExp @@ -53,16 +54,23 @@ class GardenLevelDisplay { val nameMatcher = namePattern.matcher(name) if (!nameMatcher.matches()) return val currentLevel = nameMatcher.group(1).romanToDecimalIfNeeded() - var overflow = 0 + var nextLevelExp = 0 for (line in item.getLore()) { - val matcher = overflowPattern.matcher(line) + var matcher = expToNextLevelPattern.matcher(line) if (matcher.matches()) { - overflow = matcher.group(1).replace(",", "").toDouble().roundToInt() + nextLevelExp = matcher.group(1).replace(",", "").toDouble().roundToInt() break } + matcher = overflowPattern.matcher(line) + if (matcher.matches()) { + val overflow = matcher.group("overflow").replace(",", "").toDouble().roundToInt() + gardenExp = overflow + update() + return + } } val expForLevel = getExpForLevel(currentLevel).toInt() - gardenExp = expForLevel + overflow + gardenExp = expForLevel + nextLevelExp update() } @@ -137,10 +145,37 @@ class GardenLevelDisplay { 2000, 2500, 3000, - 10000, - 10000, - 10000, - 10000, - 10000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, // level 15 + + // overflow levels till 40 for now, in 10k steps + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, ) }
\ No newline at end of file |