From d8e9f4478d55db515f144ca27881c4e26dd638d6 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 15 May 2022 15:42:09 -0500 Subject: fix skills being able to show as undefined when skill api is off --- src/cleaners/skyblock/skills.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cleaners/skyblock/skills.ts') 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 -- cgit