From c38dcee2c5f483ef5990ae9204355e1bc3c2bf74 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 28 Oct 2024 12:07:55 +0100 Subject: Make REI optional --- src/main/kotlin/repo/PetData.kt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/kotlin/repo/PetData.kt (limited to 'src/main/kotlin/repo/PetData.kt') diff --git a/src/main/kotlin/repo/PetData.kt b/src/main/kotlin/repo/PetData.kt new file mode 100644 index 0000000..2ce3402 --- /dev/null +++ b/src/main/kotlin/repo/PetData.kt @@ -0,0 +1,24 @@ +package moe.nea.firmament.repo + +import io.github.moulberry.repo.data.Rarity +import moe.nea.firmament.util.HypixelPetInfo + +// TODO: add in extra data like pet info, into this structure +data class PetData( + val rarity: Rarity, + val petId: String, + val exp: Double, + val isStub: Boolean = false, +) { + companion object { + fun fromHypixel(petInfo: HypixelPetInfo) = PetData( + petInfo.tier, petInfo.type, petInfo.exp, + ) + + fun forLevel(petId: String, rarity: Rarity, level: Int) = PetData( + rarity, petId, ExpLadders.getExpLadder(petId, rarity).getPetExpForLevel(level).toDouble() + ) + } + + val levelData by lazy { ExpLadders.getExpLadder(petId, rarity).getPetLevel(exp) } +} -- cgit