diff options
author | nea <nea@nea.moe> | 2023-01-14 21:10:37 +0100 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-01-14 21:10:37 +0100 |
commit | 14f2c9d48a31327a13791dc734813bb2fdb0926e (patch) | |
tree | 2b608ad4f082aa0d8bedafad98dc7657cdae26c9 /src/main/kotlin | |
parent | 84bdb5acf6517fa6ccb4d1ec9cf5eacd40cbc1c1 (diff) | |
parent | c20f610853702c0208d301865c015ea8ef973fd4 (diff) | |
download | NotEnoughUpdates-14f2c9d48a31327a13791dc734813bb2fdb0926e.tar.gz NotEnoughUpdates-14f2c9d48a31327a13791dc734813bb2fdb0926e.tar.bz2 NotEnoughUpdates-14f2c9d48a31327a13791dc734813bb2fdb0926e.zip |
Merge remote-tracking branch 'origin/master' into museumthing
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt | 24 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt index c4b64969..e6dc0abc 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt @@ -161,4 +161,6 @@ data class KatRecipe( override fun getBackground(): ResourceLocation { return ResourceLocation("notenoughupdates:textures/gui/katting_tall.png") } + + override fun shouldUseForCraftCost() = false } 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 e7d29642..200aa3fa 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt @@ -91,21 +91,29 @@ object PetLeveling { } } + val stubExpLadder by lazy { + Utils.showOutdatedRepoNotification() + ExpLadder(listOf(1, 1)) + } + internal fun getPetLevelingForPet0(petIdWithoutRarity: String, rarity: Rarity): ExpLadder { - val petConstants = this.petConstants ?: Constants.PETS - var levels = petConstants["pet_levels"].asJsonArray.map { it.asLong }.toMutableList() - val customLeveling = petConstants["custom_pet_leveling"].asJsonObject[petIdWithoutRarity] - val offset = petConstants["pet_rarity_offset"].asJsonObject[rarity.name].asInt + 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) + 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 } } + val customLevels by lazy { customLeveling["pet_levels"]?.asJsonArray?.map { it.asLong } } when (customLeveling["type"]?.asInt ?: 0) { - 1 -> levels.addAll(customLevels) - 2 -> levels = customLevels.toMutableList() + 1 -> levels.addAll(customLevels ?: return stubExpLadder) + 2 -> levels = customLevels?.toMutableList() ?: return stubExpLadder } maxLevel = customLeveling["max_level"]?.asInt ?: maxLevel + rarityOffsets = customLeveling["rarity_offset"]?.asJsonObject ?: rarityOffsets } - return ExpLadder(levels.drop(offset).take(maxLevel)) + val offset = rarityOffsets?.get(rarity.name)?.asInt ?: return stubExpLadder + + return ExpLadder(levels.drop(offset).take(maxLevel - 1)) } } |