aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/repo/PetData.kt
blob: 2ce3402819160e4f5199baafaa6c9fba83f1c2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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) }
}