diff --git a/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx b/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx index 096748f..347c075 100644 --- a/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx +++ b/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx @@ -7,6 +7,7 @@ import { getLevelColor, getPrestige, getPrestigeColor } from "@/lib/hypixel/pit/ import { getPitLevel } from "@/lib/hypixel/pit/level" import { NonNullStats } from "@/lib/schema/player" import CollapsedStats from "../../_components/CollapsedStats" +import PitProgress from "./progress" import PitGeneralStats from "./stats" export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) { @@ -52,6 +53,8 @@ export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) { + + diff --git a/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx b/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx new file mode 100644 index 0000000..441b9f6 --- /dev/null +++ b/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx @@ -0,0 +1,19 @@ +import { formatNumber } from "@/lib/formatters" +import { getProgress } from "@/lib/hypixel/general" +import { getPrestigeColor, getXpForPrestige } from "@/lib/hypixel/pit/general" +import GenericProgress from "../../_components/GenericProgress" +export default function PitProgress({ prestige, xp }: { prestige: number, xp: number }) { + const presColor = getPrestigeColor(prestige) + const currentXp = getXpForPrestige(prestige) + const nextXp = getXpForPrestige(prestige + 1) + const percent = getProgress(currentXp, xp, nextXp) + + return ( + + ) +} diff --git a/src/lib/hypixel/pit/general.ts b/src/lib/hypixel/pit/general.ts index 293e039..0495273 100644 --- a/src/lib/hypixel/pit/general.ts +++ b/src/lib/hypixel/pit/general.ts @@ -1,4 +1,4 @@ -import { LEVELCOLORS, PRESTIGECOLORS } from "@/data/hypixel/pit" +import { LEVELCOLORS, PRESTIGE_MULTIPLIERS, PRESTIGECOLORS } from "@/data/hypixel/pit" import { NonNullStats } from "@/lib/schema/player" export function getLevelColor(level: number) { @@ -17,6 +17,11 @@ export function getPrestigeColor(prestige: number) { return PRESTIGECOLORS.at(0)!.color } +export function getXpForPrestige(prestige: number): number { + if (prestige <= 0 || prestige > PRESTIGE_MULTIPLIERS.length) return 0 + return PRESTIGE_MULTIPLIERS[prestige - 1].SumXp +} + export function getPrestige(stats: NonNullable) { return stats.profile.prestiges === undefined ? 0 : stats.profile.prestiges.length }