aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
index 56f84d54..200aa3fa 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
@@ -100,7 +100,7 @@ object PetLeveling {
val petConstants = this.petConstants ?: Constants.PETS ?: return stubExpLadder
var levels = petConstants["pet_levels"]?.asJsonArray?.map { it.asLong }?.toMutableList() ?: return stubExpLadder
val customLeveling = petConstants["custom_pet_leveling"]?.asJsonObject?.get(petIdWithoutRarity)
- val offset = petConstants["pet_rarity_offset"]?.asJsonObject?.get(rarity.name)?.asInt ?: return stubExpLadder
+ var rarityOffsets = petConstants["pet_rarity_offset"]?.asJsonObject
var maxLevel = 100
if (customLeveling is JsonObject) {
val customLevels by lazy { customLeveling["pet_levels"]?.asJsonArray?.map { it.asLong } }
@@ -109,7 +109,10 @@ object PetLeveling {
2 -> levels = customLevels?.toMutableList() ?: return stubExpLadder
}
maxLevel = customLeveling["max_level"]?.asInt ?: maxLevel
+ rarityOffsets = customLeveling["rarity_offset"]?.asJsonObject ?: rarityOffsets
}
+ val offset = rarityOffsets?.get(rarity.name)?.asInt ?: return stubExpLadder
+
return ExpLadder(levels.drop(offset).take(maxLevel - 1))
}