Improve Level Progression Formulas (#3368) hiserod

* improve level progression formulas

Changed level progression from an exponential curve to a cubic. This prevents higher level accounts from getting bunched up around levels 100 - 120 as well as making the progression through levels 1-99 a bit slower.

* fixed variable name in getXpForLevel()

* not flooring getlevel result

* removed one level from the function

Co-authored-by: Miodec <bartnikjack@gmail.com>
This commit is contained in:
Immanuel Hise 2022-08-04 10:38:15 -05:00 committed by GitHub
parent 9515ff9000
commit 65b837e08a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1181,11 +1181,27 @@ export async function getDiscordAvatarUrl(
}
export function getLevel(xp: number): number {
return Math.log(1 - ((1 - 1.0545) * xp) / 100) / Math.log(1.0545) + 1;
return (
Math.cbrt(
2.7891272155157822 * xp +
1.7320508075688772 *
Math.sqrt(2.5930768747769397 * xp ** 2 + 678618.09453225)
) /
1.458938803353093 -
86.87173353918234 /
Math.cbrt(
2.7891272155157822 * xp +
1.7320508075688772 *
Math.sqrt(2.5930768747769397 * xp ** 2 + 678618.09453225)
) +
0.0001
);
}
export function getXpForLevel(level: number): number {
return Math.round(100 * Math.pow(1.0545, level - 1));
return Math.ceil(
0.556689342404 * level ** 3 + 99.4433106576 * level - 0.0001
);
}
export async function promiseAnimation(