From bac32409649d3b443de06a3e6b039ee3143880b6 Mon Sep 17 00:00:00 2001 From: Cody <36463298+ugcodrr@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:39:38 -0400 Subject: [PATCH 1/3] fix(pit): stay at prestige 50 when xp passes the final requirement --- .../schemas/src/player/gamemodes/pit/index.ts | 21 +++++++++++++-- .../schemas/src/player/gamemodes/pit/util.ts | 27 +++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/packages/schemas/src/player/gamemodes/pit/index.ts b/packages/schemas/src/player/gamemodes/pit/index.ts index b647ec65c..508c358b0 100644 --- a/packages/schemas/src/player/gamemodes/pit/index.ts +++ b/packages/schemas/src/player/gamemodes/pit/index.ts @@ -161,11 +161,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, 11_787_293_080) ); this.levelFormatted = getLevelFormatted(level, prestige); @@ -203,3 +205,18 @@ export class Pit { this.vampireHealing = data.vampire_healed_hp; } } + +if (import.meta.vitest) { + const { suite, it, expect } = import.meta.vitest; + + suite("Pit", () => { + it("keeps level and progression at the max prestige for xp past the final requirement", () => { + const pit = new Pit({ xp: 20_000_000_000 }, {}); + + expect(pit.trueLevel).toBe(50 * 120 + 120); + expect(pit.levelFormatted).toBe(getLevelFormatted(120, 50)); + expect(pit.nextLevelFormatted).toBe(getLevelFormatted(120, 50)); + expect(pit.progression.percent).toBe(1); + }); + }); +} diff --git a/packages/schemas/src/player/gamemodes/pit/util.ts b/packages/schemas/src/player/gamemodes/pit/util.ts index e7f5dc1d8..af74c6475 100644 --- a/packages/schemas/src/player/gamemodes/pit/util.ts +++ b/packages/schemas/src/player/gamemodes/pit/util.ts @@ -70,13 +70,14 @@ 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]; + // XP past the final requirement still belongs to the max prestige + return PRESTIGE_XP_REQUIREMENTS.length - 1; }; export const getPrestigeReq = (prestige: number) => @@ -136,3 +137,25 @@ export function getRenownShopCost(renownUnlocks: RenownUnlock[]) { return cost; } + +if (import.meta.vitest) { + const { suite, it, expect } = import.meta.vitest; + + suite("getPrestige", () => { + it("finds the prestige whose requirement covers the xp", () => { + expect(getPrestige(0)).toBe(0); + expect(getPrestige(65_950)).toBe(0); + expect(getPrestige(65_951)).toBe(1); + expect(getPrestige(11_787_293_080)).toBe(50); + }); + + it("stays at the max prestige for xp past the final requirement", () => { + const xp = 20_000_000_000; + const prestige = getPrestige(xp); + + expect(prestige).toBe(50); + expect(getPrestigeReq(prestige)).toBe(11_787_293_080); + expect(getLevel(prestige, xp)).toBe(120); + }); + }); +} From 07f66c40e6032041e3a062103c021fa8b90697c1 Mon Sep 17 00:00:00 2001 From: Cody <36463298+ugcodrr@users.noreply.github.com> Date: Mon, 19 Oct 2026 18:35:06 -0400 Subject: [PATCH 2/3] chore(pit): trim comments and tests --- .../schemas/src/player/gamemodes/pit/index.ts | 15 ------------ .../schemas/src/player/gamemodes/pit/util.ts | 23 ------------------- 2 files changed, 38 deletions(-) diff --git a/packages/schemas/src/player/gamemodes/pit/index.ts b/packages/schemas/src/player/gamemodes/pit/index.ts index 508c358b0..62cba7969 100644 --- a/packages/schemas/src/player/gamemodes/pit/index.ts +++ b/packages/schemas/src/player/gamemodes/pit/index.ts @@ -205,18 +205,3 @@ export class Pit { this.vampireHealing = data.vampire_healed_hp; } } - -if (import.meta.vitest) { - const { suite, it, expect } = import.meta.vitest; - - suite("Pit", () => { - it("keeps level and progression at the max prestige for xp past the final requirement", () => { - const pit = new Pit({ xp: 20_000_000_000 }, {}); - - expect(pit.trueLevel).toBe(50 * 120 + 120); - expect(pit.levelFormatted).toBe(getLevelFormatted(120, 50)); - expect(pit.nextLevelFormatted).toBe(getLevelFormatted(120, 50)); - expect(pit.progression.percent).toBe(1); - }); - }); -} diff --git a/packages/schemas/src/player/gamemodes/pit/util.ts b/packages/schemas/src/player/gamemodes/pit/util.ts index af74c6475..e48a0d4c7 100644 --- a/packages/schemas/src/player/gamemodes/pit/util.ts +++ b/packages/schemas/src/player/gamemodes/pit/util.ts @@ -76,7 +76,6 @@ export const getPrestige = (xp: number) => { } } - // XP past the final requirement still belongs to the max prestige return PRESTIGE_XP_REQUIREMENTS.length - 1; }; @@ -137,25 +136,3 @@ export function getRenownShopCost(renownUnlocks: RenownUnlock[]) { return cost; } - -if (import.meta.vitest) { - const { suite, it, expect } = import.meta.vitest; - - suite("getPrestige", () => { - it("finds the prestige whose requirement covers the xp", () => { - expect(getPrestige(0)).toBe(0); - expect(getPrestige(65_950)).toBe(0); - expect(getPrestige(65_951)).toBe(1); - expect(getPrestige(11_787_293_080)).toBe(50); - }); - - it("stays at the max prestige for xp past the final requirement", () => { - const xp = 20_000_000_000; - const prestige = getPrestige(xp); - - expect(prestige).toBe(50); - expect(getPrestigeReq(prestige)).toBe(11_787_293_080); - expect(getLevel(prestige, xp)).toBe(120); - }); - }); -} From b0e9808f6cfb151208e7cc3177f8f11102d0437c Mon Sep 17 00:00:00 2001 From: Cody <36463298+ugcodrr@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:33:32 -0400 Subject: [PATCH 3/3] refactor(pit): take the final prestige xp from PRESTIGE_XP_REQUIREMENTS --- packages/schemas/src/player/gamemodes/pit/index.ts | 3 ++- packages/schemas/src/player/gamemodes/pit/util.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/schemas/src/player/gamemodes/pit/index.ts b/packages/schemas/src/player/gamemodes/pit/index.ts index 62cba7969..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, @@ -167,7 +168,7 @@ export class Pit { // XP past the final requirement would push the progress bar over 100% this.progression = new Progression( Math.min(this.exp, prestigeReq) - lastPrestigeReq, - Math.min(prestigeReq - lastPrestigeReq, 11_787_293_080) + 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 e48a0d4c7..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", @@ -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;