Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Fix level calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
UCDFiddes committed Mar 27, 2024
1 parent 66387a3 commit 6133797
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hive-bedrock-data",
"version": "1.1.4",
"version": "1.1.5",
"description": "A repo to store and calculate data and type definitions from The Hive: Bedrock Edition server.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
5 changes: 2 additions & 3 deletions src/math/calculateLevelFromXP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function calculateLevelFromXP(
}

let level_increment = game_data.level_increment / 2; // The amount of xp that is added between each level
let level_cap = game_data.level_increment; // The level where the difficulty of each level dosen't increase
let level_cap = game_data.level_cap; // The level where the difficulty of each level dosen't increase

let level =
(level_increment +
Expand All @@ -52,8 +52,7 @@ export default function calculateLevelFromXP(
if (level < 1) return 1;
if (level > game_data.max_level) return game_data.max_level;

if (!level_cap || level_cap <= level_cap)
return Math.floor(level * 100) / 100; // Return if there is no level cap or the level dosen't reach the level cap
if (!level_cap || level <= level_cap) return Math.floor(level * 100) / 100; // Return if there is no level cap or the level dosen't reach the level cap

let level_with_cap =
level_cap +
Expand Down

0 comments on commit 6133797

Please sign in to comment.