-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c994780
commit 2f295af
Showing
2 changed files
with
24 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
// misc. things that would be used in more than one thing. | ||
|
||
// see also: https://www.desmos.com/calculator/kcrt4evjgg | ||
exports.expNeededForLevel = level => 1024 * (level ** 1.3) + (256 *((level-1) / 8) ** 1.8) || 0; | ||
exports.expNeededForLevel = level => 1024 * (level ** 1.3) + (256 *((level-1) / 8) ** 1.8) || 0; | ||
|
||
exports.createExpBar = async function createExpBar(percentage, maxLength) { | ||
let output = ""; | ||
const fillCount = Math.floor(percentage / 100 * maxLength); | ||
|
||
for(let char = 0; char < maxLength; char++){ | ||
|
||
if (char === 0) { | ||
output += "["; | ||
} else if (char <= fillCount) { | ||
output += "|"; | ||
} else if (char === maxLength - 1) { | ||
output += "]"; | ||
} else { | ||
output += " "; | ||
} | ||
} | ||
|
||
return output; | ||
} |