aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-15 15:42:09 -0500
committermat <github@matdoes.dev>2022-05-15 15:42:09 -0500
commitd8e9f4478d55db515f144ca27881c4e26dd638d6 (patch)
tree793e90315f4eabe9d38a6ceee49aaf9573f17bb8 /src/cleaners
parent579a91df5ed186a4258b32b47a1a4853c0dea1e0 (diff)
downloadskyblock-api-d8e9f4478d55db515f144ca27881c4e26dd638d6.tar.gz
skyblock-api-d8e9f4478d55db515f144ca27881c4e26dd638d6.tar.bz2
skyblock-api-d8e9f4478d55db515f144ca27881c4e26dd638d6.zip
fix skills being able to show as undefined when skill api is off
Diffstat (limited to 'src/cleaners')
-rw-r--r--src/cleaners/skyblock/skills.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cleaners/skyblock/skills.ts b/src/cleaners/skyblock/skills.ts
index 8aeaffe..b70b2ea 100644
--- a/src/cleaners/skyblock/skills.ts
+++ b/src/cleaners/skyblock/skills.ts
@@ -148,7 +148,9 @@ export function levelForSkillXp(xp: number, maxLevel: number) {
return levelFromXpTable(xp, xpTable)
}
-function skillFromLevel(id: string, level: number): Skill {
+function skillFromLevel(id: string, level: number | undefined): Skill {
+ if (level === undefined)
+ level = 0
const maxLevel = skillsMaxLevel[id] ?? skillsDefaultMaxLevel
const xpTable = (maxLevel <= 25 ? skillXpTableEasier : skillXpTable).slice(0, maxLevel)
const xp = level > 0 ? xpTable[level - 1] ?? 0 : 0