aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-06-02 17:30:25 -0500
committermat <github@matdoes.dev>2021-06-02 17:30:25 -0500
commitf939fa3ddc43df924743b997cdcb0dbde76bb04a (patch)
tree5f8cbd6df1a38608f56bba56f1b0ea11196009a3
parent51f07dc19cec7d125e74a97e78f104a9320960c0 (diff)
downloadskyblock-api-f939fa3ddc43df924743b997cdcb0dbde76bb04a.tar.gz
skyblock-api-f939fa3ddc43df924743b997cdcb0dbde76bb04a.tar.bz2
skyblock-api-f939fa3ddc43df924743b997cdcb0dbde76bb04a.zip
Fix max level
-rw-r--r--build/cleaners/skyblock/skills.js2
-rw-r--r--src/cleaners/skyblock/skills.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/build/cleaners/skyblock/skills.js b/build/cleaners/skyblock/skills.js
index 2dcb53f..124e8d9 100644
--- a/build/cleaners/skyblock/skills.js
+++ b/build/cleaners/skyblock/skills.js
@@ -114,7 +114,7 @@ const skillsDefaultMaxLevel = 50;
* @param easierLevel Whether it should use the alternate leveling xp table (used for cosmetic skills and dungeoneering)
*/
function levelForSkillXp(xp, maxLevel) {
- const xpTable = maxLevel <= 25 ? skillXpTableEasier : skillXpTable;
+ const xpTable = (maxLevel <= 25 ? skillXpTableEasier : skillXpTable).slice(0, maxLevel);
const skillLevel = [...xpTable].reverse().findIndex(levelXp => xp >= levelXp);
return skillLevel === -1 ? 0 : xpTable.length - skillLevel;
}
diff --git a/src/cleaners/skyblock/skills.ts b/src/cleaners/skyblock/skills.ts
index 40c1e3c..04f3002 100644
--- a/src/cleaners/skyblock/skills.ts
+++ b/src/cleaners/skyblock/skills.ts
@@ -130,7 +130,7 @@ const skillsDefaultMaxLevel: number = 50
* @param easierLevel Whether it should use the alternate leveling xp table (used for cosmetic skills and dungeoneering)
*/
export function levelForSkillXp(xp: number, maxLevel: number) {
- const xpTable = maxLevel <= 25 ? skillXpTableEasier : skillXpTable
+ const xpTable = (maxLevel <= 25 ? skillXpTableEasier : skillXpTable).slice(0, maxLevel)
const skillLevel = [...xpTable].reverse().findIndex(levelXp => xp >= levelXp)
return skillLevel === -1 ? 0 : xpTable.length - skillLevel
}