diff --git a/packages/schemas/src/player/gamemodes/pit/index.ts b/packages/schemas/src/player/gamemodes/pit/index.ts index b647ec65c..8e9d1804f 100644 --- a/packages/schemas/src/player/gamemodes/pit/index.ts +++ b/packages/schemas/src/player/gamemodes/pit/index.ts @@ -11,6 +11,7 @@ import { type ExtractGameModes, GameModes } from "#game"; import { Field } from "#metadata"; import { Progression } from "#progression"; import { + FINAL_PRESTIGE_XP, RenownUnlock, getBounty, getLevel, @@ -161,11 +162,13 @@ export class Pit { this.trueLevel = prestige * 120 + level; + const prestigeReq = getPrestigeReq(prestige); const lastPrestigeReq = getPrestigeReq(prestige - 1); + // XP past the final requirement would push the progress bar over 100% this.progression = new Progression( - this.exp - lastPrestigeReq, - Math.min(getPrestigeReq(prestige) - lastPrestigeReq, 11_787_293_080) + Math.min(this.exp, prestigeReq) - lastPrestigeReq, + Math.min(prestigeReq - lastPrestigeReq, FINAL_PRESTIGE_XP) ); this.levelFormatted = getLevelFormatted(level, prestige); diff --git a/packages/schemas/src/player/gamemodes/pit/util.ts b/packages/schemas/src/player/gamemodes/pit/util.ts index e7f5dc1d8..87f11190c 100644 --- a/packages/schemas/src/player/gamemodes/pit/util.ts +++ b/packages/schemas/src/player/gamemodes/pit/util.ts @@ -29,6 +29,9 @@ const PRESTIGE_XP_REQUIREMENTS = [ 11_787_293_080, ]; +export const FINAL_PRESTIGE_XP = + PRESTIGE_XP_REQUIREMENTS[PRESTIGE_XP_REQUIREMENTS.length - 1]; + const PRESTIGE_COLORS = [ "7", "9", @@ -70,13 +73,13 @@ export type Bounty = { }; export const getPrestige = (xp: number) => { - for (let i = 0; i <= 50; i++) { + for (let i = 0; i < PRESTIGE_XP_REQUIREMENTS.length; i++) { if (xp <= PRESTIGE_XP_REQUIREMENTS[i]) { return i; } } - return PRESTIGE_XP_REQUIREMENTS[1]; + return PRESTIGE_XP_REQUIREMENTS.length - 1; }; export const getPrestigeReq = (prestige: number) => @@ -86,7 +89,7 @@ export const getLevel = (pres: number, xp: number) => { let level = 120; if ( (4_042_276_727 <= xp && xp <= 5_192_293_080) || - (7_339_776_727 <= xp && xp <= 11_787_293_080) + (7_339_776_727 <= xp && xp <= FINAL_PRESTIGE_XP) ) return 120;