fix up remaining spacing issues

This commit is contained in:
downthecrop 2025-11-16 16:19:48 -08:00
parent 3392d61d9e
commit 5bb81c7bd3
39 changed files with 244 additions and 271 deletions

View file

@ -0,0 +1,31 @@
package KondoKit.util
/**
* Utility for mapping XP values to levels and vice versa.
*/
object XPTable {
private val xpForLevels: IntArray = IntArray(100)
init {
var points = 0.0
for (level in 1..99) {
points += Math.floor(level + 300.0 * Math.pow(2.0, level / 7.0))
xpForLevels[level] = Math.floor(points / 4).toInt()
}
}
fun getLevelForXp(xp: Int): Pair<Int, Int> {
for (i in 1..99) {
if (xp < xpForLevels[i]) {
return Pair(i - 1, xp - xpForLevels[i - 1])
}
}
return Pair(99, 0)
}
fun getXpRequiredForLevel(level: Int): Int {
if (level <= 0) return 0
if (level >= 99) return xpForLevels[99]
return xpForLevels[level]
}
}