This commit is contained in:
2025-09-08 20:58:46 +02:00
parent f5a5a989d3
commit 0ceda994ee
31 changed files with 111 additions and 98 deletions

View File

@@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/
import { Card, CardContent } from "@/components/ui/card" import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getBWLevelForExp, getTotalExpForLevel } from "@/lib/hypixel/bedwars/level" import { getBedwarsLevelForExp, getTotalBedwarsExpForLevel } from "@/lib/hypixel/bedwars/level"
import { devide, getProgress } from "@/lib/hypixel/general" import { devide, getProgress } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats" import CollapsedStats from "../../_components/CollapsedStats"
@@ -17,10 +17,10 @@ export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"]
const fkd = formatNumber(devide(stats.final_kills_bedwars, stats.final_deaths_bedwars)) const fkd = formatNumber(devide(stats.final_kills_bedwars, stats.final_deaths_bedwars))
const wl = formatNumber(devide(stats.wins_bedwars, stats.losses_bedwars)) const wl = formatNumber(devide(stats.wins_bedwars, stats.losses_bedwars))
const bbl = formatNumber(devide(stats.beds_broken_bedwars, stats.beds_lost_bedwars)) const bbl = formatNumber(devide(stats.beds_broken_bedwars, stats.beds_lost_bedwars))
const level = getBWLevelForExp(stats.Experience) const level = getBedwarsLevelForExp(stats.Experience)
const current = getTotalExpForLevel(level) const current = getTotalBedwarsExpForLevel(level)
const next = getTotalExpForLevel(level + 1) const next = getTotalBedwarsExpForLevel(level + 1)
const percent = getProgress(current, stats.Experience, next) const percent = getProgress(current, stats.Experience, next)
const xpProgress = stats.Experience - current const xpProgress = stats.Experience - current

View File

@@ -1,13 +1,13 @@
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getBedwarsStar, getPrestige } from "@/lib/hypixel/bedwars/bedwars" import { getBedwarsPrestige, getBedwarsStar } from "@/lib/hypixel/bedwars/bedwars"
import { getBWLevelForExp } from "@/lib/hypixel/bedwars/level" import { getBedwarsLevelForExp } from "@/lib/hypixel/bedwars/level"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { GenericProgress } from "../../_components/GenericProgress" import { GenericProgress } from "../../_components/GenericProgress"
import Multicolored from "../../_components/Multicolored" import Multicolored from "../../_components/Multicolored"
export function BedwarsLevel({ xp }: { xp: number }) { export function BedwarsLevel({ xp }: { xp: number }) {
const level = getBWLevelForExp(xp) const level = getBedwarsLevelForExp(xp)
const color = getPrestige(level).colormap const color = getBedwarsPrestige(level).colormap
const star = getBedwarsStar(level) const star = getBedwarsStar(level)
const val = `[${level}${star}]` const val = `[${level}${star}]`
@@ -30,7 +30,7 @@ export function BedwarsProgress({ level, percent, currentXp, ceilingXp }: { leve
} }
export function BedWarsPrestige({ level }: { level: number }) { export function BedWarsPrestige({ level }: { level: number }) {
const pres = getPrestige(level) const pres = getBedwarsPrestige(level)
const star = getBedwarsStar(level) const star = getBedwarsStar(level)
if (level >= 1000 && level < 1100) { if (level >= 1000 && level < 1100) {
return ( return (
@@ -69,7 +69,7 @@ function LevelNumber({ level, className }: { level: number, className?: string }
) )
} }
return <p className={cn(`text-mc-${getPrestige(level).color}`, className)}>{level}</p> return <p className={cn(`text-mc-${getBedwarsPrestige(level).color}`, className)}>{level}</p>
} }
function Progress({ level, percent, tooltipId, tooltipContent }: { level: number, percent: number, tooltipId: string, tooltipContent: string }) { function Progress({ level, percent, tooltipId, tooltipContent }: { level: number, percent: number, tooltipId: string, tooltipContent: string }) {
@@ -77,5 +77,12 @@ function Progress({ level, percent, tooltipId, tooltipContent }: { level: number
return <GenericProgress percent={percent} rainbow={true} tooltipId={tooltipId} tooltipContent={tooltipContent} /> return <GenericProgress percent={percent} rainbow={true} tooltipId={tooltipId} tooltipContent={tooltipContent} />
} }
return <GenericProgress percent={percent} className={`bg-mc-${getPrestige(level).color}`} tooltipId={tooltipId} tooltipContent={tooltipContent} /> return (
<GenericProgress
percent={percent}
className={`bg-mc-${getBedwarsPrestige(level).color}`}
tooltipId={tooltipId}
tooltipContent={tooltipContent}
/>
)
} }

View File

@@ -1,5 +1,5 @@
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getLatestRoom, getWalletMax } from "@/lib/hypixel/bedwars/bedwars" import { getBedwarsLatestRoom, getBedwarsWalletMax } from "@/lib/hypixel/bedwars/bedwars"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { BasicStat, Stat } from "../../_components/Stats" import { BasicStat, Stat } from "../../_components/Stats"
import { BedWarsPrestige } from "./components" import { BedWarsPrestige } from "./components"
@@ -55,7 +55,7 @@ export default function BedwarsGeneralStats(
{stats.slumber?.tickets === undefined ? "None" : formatNumber(stats.slumber.tickets)} {stats.slumber?.tickets === undefined ? "None" : formatNumber(stats.slumber.tickets)}
</span> </span>
<span className="text-muted-foreground"> <span className="text-muted-foreground">
{`/${formatNumber(getWalletMax(stats.slumber?.bag_type))}`} {`/${formatNumber(getBedwarsWalletMax(stats.slumber?.bag_type))}`}
</span> </span>
</Stat> </Stat>
<BasicStat <BasicStat
@@ -63,7 +63,7 @@ export default function BedwarsGeneralStats(
value={formatNumber(stats.slumber?.total_tickets_earned ?? 0)} value={formatNumber(stats.slumber?.total_tickets_earned ?? 0)}
className="text-mc-aqua" className="text-mc-aqua"
/> />
<BasicStat title="Doors Unlocked: " value={getLatestRoom(stats.slumber?.room) ?? "None"} /> <BasicStat title="Doors Unlocked: " value={getBedwarsLatestRoom(stats.slumber?.room) ?? "None"} />
<BasicStat title="XP Doublers: " value={formatNumber(stats.slumber?.doublers ?? 0)} className="text-mc-dark-aqua" /> <BasicStat title="XP Doublers: " value={formatNumber(stats.slumber?.doublers ?? 0)} className="text-mc-dark-aqua" />
<p> <p>
<br /> <br />

View File

@@ -1,11 +1,11 @@
import { getBuildBattleRank, getNextBuildBattleRank } from "@/lib/hypixel/build-battle/general" import { getBuildBattleRank, getBuildBattleRankNext } from "@/lib/hypixel/build-battle/general"
import { getProgress } from "@/lib/hypixel/general" import { getProgress } from "@/lib/hypixel/general"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { GenericProgress } from "../../_components/GenericProgress" import { GenericProgress } from "../../_components/GenericProgress"
export default function BuildBattleTitleProgress({ score }: { score: number }) { export default function BuildBattleTitleProgress({ score }: { score: number }) {
const current = getBuildBattleRank(score) const current = getBuildBattleRank(score)
const next = getNextBuildBattleRank(score) const next = getBuildBattleRankNext(score)
const percent = getProgress(0, score, next !== null ? next.value : 0) const percent = getProgress(0, score, next !== null ? next.value : 0)

View File

@@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/
import { Card, CardContent } from "@/components/ui/card" import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getScoreColor } from "@/lib/hypixel/copsandcrims/general" import { getCopsAndCrimsScoreColor } from "@/lib/hypixel/copsandcrims/general"
import { devide } from "@/lib/hypixel/general" import { devide } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats" import CollapsedStats from "../../_components/CollapsedStats"
@@ -18,7 +18,7 @@ export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["Cops
const wins = stats.game_wins + stats.game_wins_deathmatch + stats.game_wins_gungame const wins = stats.game_wins + stats.game_wins_deathmatch + stats.game_wins_gungame
const kd = formatNumber(devide(kills, deaths)) const kd = formatNumber(devide(kills, deaths))
const score = Math.floor(kills / 2 + (stats.bombs_planted + stats.bombs_defused) / 3 + wins + devide(kills, stats.shots_fired) * 200) const score = Math.floor(kills / 2 + (stats.bombs_planted + stats.bombs_defused) / 3 + wins + devide(kills, stats.shots_fired) * 200)
const scoreColor = getScoreColor(score) const scoreColor = getCopsAndCrimsScoreColor(score)
return ( return (
<AccordionItem value="cops-and-crims"> <AccordionItem value="cops-and-crims">

View File

@@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/
import { Card, CardContent } from "@/components/ui/card" import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getAllDivisions, getMostPlayed } from "@/lib/hypixel/duels/duels" import { getAllDuelsDivisions, getDuelsMostPlayed } from "@/lib/hypixel/duels/duels"
import { devide, romanize } from "@/lib/hypixel/general" import { devide, romanize } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats" import CollapsedStats from "../../_components/CollapsedStats"
@@ -14,8 +14,8 @@ export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] })
const wl = formatNumber(devide(stats.wins, stats.losses)) const wl = formatNumber(devide(stats.wins, stats.losses))
const kd = formatNumber(devide(stats.kills, stats.deaths)) const kd = formatNumber(devide(stats.kills, stats.deaths))
const div = getAllDivisions(stats) const div = getAllDuelsDivisions(stats)
const mostPlayed = getMostPlayed(stats) const mostPlayed = getDuelsMostPlayed(stats)
return ( return (
<AccordionItem value="duels"> <AccordionItem value="duels">

View File

@@ -1,6 +1,6 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getBestDuelsMode, getDevision, getDuelsModeStats, getMode } from "@/lib/hypixel/duels/duels" import { getBestDuelsMode, getDuelsDevision, getDuelsMode, getDuelsModeStats } from "@/lib/hypixel/duels/duels"
import { romanize } from "@/lib/hypixel/general" import { romanize } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
@@ -73,11 +73,11 @@ function DuelsTableHeader() {
) )
} }
function DuelsStat({ modeId, stats }: { modeId: Parameters<typeof getMode>[0], stats: NonNullable<NonNullStats["Duels"]> }) { function DuelsStat({ modeId, stats }: { modeId: Parameters<typeof getDuelsMode>[0], stats: NonNullable<NonNullStats["Duels"]> }) {
const modeStats = getDuelsModeStats(modeId, stats) const modeStats = getDuelsModeStats(modeId, stats)
const mode = getMode(modeId) const mode = getDuelsMode(modeId)
const bestMode = getBestDuelsMode(stats) === modeId const bestMode = getBestDuelsMode(stats) === modeId
const div = getDevision(mode.divId, stats) const div = getDuelsDevision(mode.divId, stats)
return ( return (
<TableRow> <TableRow>

View File

@@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general" import { devide } from "@/lib/hypixel/general"
import { getDifficultyColor, getMostPlayed } from "@/lib/hypixel/megawalls/general" import { getMegaWallsDifficultyColor, getMegawallsMostPlayed } from "@/lib/hypixel/megawalls/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import CollapsedStats from "../../_components/CollapsedStats" import CollapsedStats from "../../_components/CollapsedStats"
@@ -16,8 +16,8 @@ export default function MegaWallsStats({ stats }: { stats: NonNullStats["MegaWal
const kd = formatNumber(devide(stats.kills, stats.deaths)) const kd = formatNumber(devide(stats.kills, stats.deaths))
const fkd = formatNumber(devide(stats.final_kills, stats.final_deaths)) const fkd = formatNumber(devide(stats.final_kills, stats.final_deaths))
const wl = formatNumber(devide(stats.wins, stats.losses)) const wl = formatNumber(devide(stats.wins, stats.losses))
const mostPlayed = getMostPlayed(stats) const mostPlayed = getMegawallsMostPlayed(stats)
const difficultyColor = getDifficultyColor(mostPlayed !== null ? mostPlayed.difficulty : 1) const difficultyColor = getMegaWallsDifficultyColor(mostPlayed !== null ? mostPlayed.difficulty : 1)
return ( return (
<AccordionItem value="megawalls"> <AccordionItem value="megawalls">

View File

@@ -1,7 +1,13 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { romanize } from "@/lib/hypixel/general" import { romanize } from "@/lib/hypixel/general"
import { getAllClassStats, getDifficultyColor, getMegaWallsClass, getMegaWallsModeName, getMegaWallsModeStats } from "@/lib/hypixel/megawalls/general" import {
getAllMegawallsClassStats,
getMegaWallsClass,
getMegaWallsDifficultyColor,
getMegaWallsModeName,
getMegaWallsModeStats
} from "@/lib/hypixel/megawalls/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
export function MegaWallsModesTable({ stats }: { stats: NonNullable<NonNullStats["MegaWalls"]> }) { export function MegaWallsModesTable({ stats }: { stats: NonNullable<NonNullStats["MegaWalls"]> }) {
@@ -77,13 +83,13 @@ function MegaWallsTableHeader() {
} }
function MegaWallsClassStats({ stats }: { stats: NonNullable<NonNullStats["MegaWalls"]> }) { function MegaWallsClassStats({ stats }: { stats: NonNullable<NonNullStats["MegaWalls"]> }) {
const classStats = getAllClassStats(stats) const classStats = getAllMegawallsClassStats(stats)
return ( return (
<TableBody> <TableBody>
{classStats.map((c, i) => { {classStats.map((c, i) => {
const { id, val } = c const { id, val } = c
const klass = getMegaWallsClass(id) const klass = getMegaWallsClass(id)
const difColor = getDifficultyColor(klass.difficulty) const difColor = getMegaWallsDifficultyColor(klass.difficulty)
return ( return (
<TableRow key={i}> <TableRow key={i}>
<TableCell className={`text-mc-${difColor}`}>{klass.name}</TableCell> <TableCell className={`text-mc-${difColor}`}>{klass.name}</TableCell>

View File

@@ -1,13 +1,13 @@
import { formatNumber, formatSecondsToTime } from "@/lib/formatters" import { formatNumber, formatSecondsToTime } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general" import { devide } from "@/lib/hypixel/general"
import { getKnifeName } from "@/lib/hypixel/murder-mystery/general" import { getMurderMysteryKnifeName } from "@/lib/hypixel/murder-mystery/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { BasicStat } from "../../_components/Stats" import { BasicStat } from "../../_components/Stats"
export default function MurderMysteryGeneralStats({ stats }: { stats: NonNullable<NonNullStats["MurderMystery"]> }) { export default function MurderMysteryGeneralStats({ stats }: { stats: NonNullable<NonNullStats["MurderMystery"]> }) {
const kd = formatNumber(devide(stats.kills, stats.deaths)) const kd = formatNumber(devide(stats.kills, stats.deaths))
const wl = formatNumber(devide(stats.wins, stats.losses)) const wl = formatNumber(devide(stats.wins, stats.losses))
const weapon = getKnifeName(stats.active_knife_skin) const weapon = getMurderMysteryKnifeName(stats.active_knife_skin)
return ( return (
<div className="flex"> <div className="flex">

View File

@@ -1,6 +1,6 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getBestMurderMysteryMode, getModeTitle, getMurderMysteryModeStats } from "@/lib/hypixel/murder-mystery/general" import { getBestMurderMysteryMode, getMurderMysteryModeStats, getMurderMysteryModeTitle } from "@/lib/hypixel/murder-mystery/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
@@ -47,7 +47,7 @@ function MurderMysteryTableHeader() {
function MurderMysteryStat( function MurderMysteryStat(
{ modeId, stats }: { modeId: Parameters<typeof getMurderMysteryModeStats>[0], stats: NonNullable<NonNullStats["MurderMystery"]> } { modeId, stats }: { modeId: Parameters<typeof getMurderMysteryModeStats>[0], stats: NonNullable<NonNullStats["MurderMystery"]> }
) { ) {
const title = getModeTitle(modeId) const title = getMurderMysteryModeTitle(modeId)
const modeStats = getMurderMysteryModeStats(modeId, stats) const modeStats = getMurderMysteryModeStats(modeId, stats)
const bestMode = getBestMurderMysteryMode(stats) === modeId const bestMode = getBestMurderMysteryMode(stats) === modeId

View File

@@ -1,11 +1,11 @@
import { romanize } from "@/lib/hypixel/general" import { romanize } from "@/lib/hypixel/general"
import { getLevelColor, getPrestigeColor } from "@/lib/hypixel/pit/general" import { getPitLevelColor, getPitPrestigeColor } from "@/lib/hypixel/pit/general"
import { getPitLevel } from "@/lib/hypixel/pit/level" import { getPitLevel } from "@/lib/hypixel/pit/level"
export default function PitLevel({ xp, prestige }: { xp: number, prestige: number }) { export default function PitLevel({ xp, prestige }: { xp: number, prestige: number }) {
const level = getPitLevel(xp, prestige) const level = getPitLevel(xp, prestige)
const prestigeColor = getPrestigeColor(prestige) const prestigeColor = getPitPrestigeColor(prestige)
const levelColor = getLevelColor(level) const levelColor = getPitLevelColor(level)
return ( return (
<p> <p>
<span className={`text-mc-${prestigeColor}`}>[</span> <span className={`text-mc-${prestigeColor}`}>[</span>

View File

@@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general" import { devide } from "@/lib/hypixel/general"
import { getPrestige } from "@/lib/hypixel/pit/general" import { getPitPrestige } from "@/lib/hypixel/pit/general"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats" import CollapsedStats from "../../_components/CollapsedStats"
import PitLevel from "./level" import PitLevel from "./level"
@@ -14,7 +14,7 @@ export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) {
if (!stats) return null if (!stats) return null
const kd = formatNumber(devide(stats.kills, stats.deaths)) const kd = formatNumber(devide(stats.kills, stats.deaths))
const prestige = getPrestige(stats) const prestige = getPitPrestige(stats)
return ( return (
<AccordionItem value="pit"> <AccordionItem value="pit">

View File

@@ -1,12 +1,12 @@
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getProgress } from "@/lib/hypixel/general" import { getProgress } from "@/lib/hypixel/general"
import { getPrestigeColor, getXpForPrestige } from "@/lib/hypixel/pit/general" import { getPitPrestigeColor, getPitXpForPrestige } from "@/lib/hypixel/pit/general"
import { GenericProgress } from "../../_components/GenericProgress" import { GenericProgress } from "../../_components/GenericProgress"
export default function PitProgress({ prestige, xp }: { prestige: number, xp: number }) { export default function PitProgress({ prestige, xp }: { prestige: number, xp: number }) {
const presColor = getPrestigeColor(prestige) const presColor = getPitPrestigeColor(prestige)
const currentXp = getXpForPrestige(prestige) const currentXp = getPitXpForPrestige(prestige)
const nextXp = getXpForPrestige(prestige + 1) const nextXp = getPitXpForPrestige(prestige + 1)
const percent = getProgress(currentXp, xp, nextXp) const percent = getProgress(currentXp, xp, nextXp)
return ( return (

View File

@@ -1,15 +1,15 @@
import { formatNumber, formatSecondsToTime } from "@/lib/formatters" import { formatNumber, formatSecondsToTime } from "@/lib/formatters"
import { devide, romanize } from "@/lib/hypixel/general" import { devide, romanize } from "@/lib/hypixel/general"
import { getLevelColor, getPrestige, getPrestigeColor } from "@/lib/hypixel/pit/general" import { getPitLevelColor, getPitPrestige, getPitPrestigeColor } from "@/lib/hypixel/pit/general"
import { getPitLevel } from "@/lib/hypixel/pit/level" import { getPitLevel } from "@/lib/hypixel/pit/level"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { BasicStat } from "../../_components/Stats" import { BasicStat } from "../../_components/Stats"
export default function PitGeneralStats({ stats }: { stats: NonNullable<NonNullStats["Pit"]> }) { export default function PitGeneralStats({ stats }: { stats: NonNullable<NonNullStats["Pit"]> }) {
const prestige = getPrestige(stats) const prestige = getPitPrestige(stats)
const level = getPitLevel(stats.profile.xp, prestige) const level = getPitLevel(stats.profile.xp, prestige)
const pretigeColor = getPrestigeColor(prestige) const pretigeColor = getPitPrestigeColor(prestige)
const levelColor = getLevelColor(level) const levelColor = getPitLevelColor(level)
const kah = formatNumber(devide(stats.kills + stats.assists, stats.playtime_minutes / 60)) const kah = formatNumber(devide(stats.kills + stats.assists, stats.playtime_minutes / 60))
const gh = formatNumber(devide(stats.cash_earned, stats.playtime_minutes / 60)) const gh = formatNumber(devide(stats.cash_earned, stats.playtime_minutes / 60))
const xph = formatNumber(devide(stats.profile.xp, stats.playtime_minutes / 60)) const xph = formatNumber(devide(stats.profile.xp, stats.playtime_minutes / 60))

View File

@@ -1,7 +1,7 @@
"use client" "use client"
import { head } from "@/lib/hypixel/general" import { head } from "@/lib/hypixel/general"
import { getHeads } from "@/lib/hypixel/skywars/skywars" import { getSkywarsHeads } from "@/lib/hypixel/skywars/skywars"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import Image from "next/image" import Image from "next/image"
import Link from "next/link" import Link from "next/link"
@@ -73,7 +73,7 @@ export function HeadsBar({ heads, heads_total }: { heads: [string, number][], he
<> <>
<div className="flex overflow-hidden mt-2 mb-4 rounded-md"> <div className="flex overflow-hidden mt-2 mb-4 rounded-md">
{heads.map(([key, total]) => { {heads.map(([key, total]) => {
const head = getHeads(key) const head = getSkywarsHeads(key)
const percent = total / heads_total const percent = total / heads_total
if (percent === 0) return null if (percent === 0) return null

View File

@@ -1,6 +1,6 @@
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getSkywarsLevel } from "@/lib/hypixel/skywars/level" import { getSkywarsLevel } from "@/lib/hypixel/skywars/level"
import { getPrestige, getSkyWarsIcon } from "@/lib/hypixel/skywars/skywars" import { getSkyWarsIcon, getSkywarsPrestige } from "@/lib/hypixel/skywars/skywars"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { GenericProgress } from "../../_components/GenericProgress" import { GenericProgress } from "../../_components/GenericProgress"
import { HeadsBar, PresigeousHeads } from "./client" import { HeadsBar, PresigeousHeads } from "./client"
@@ -95,7 +95,7 @@ export function ShardProgress({ percent, shards }: { percent: number, shards: nu
export function SkywarsLevel({ xp, icon }: { xp: number, icon: string | undefined }) { export function SkywarsLevel({ xp, icon }: { xp: number, icon: string | undefined }) {
const level = getSkywarsLevel(xp) const level = getSkywarsLevel(xp)
const pres = getPrestige(Math.floor(level)) const pres = getSkywarsPrestige(Math.floor(level))
const swIcon = getSkyWarsIcon(icon) const swIcon = getSkyWarsIcon(icon)
const val = `${Math.floor(level)}${swIcon}` const val = `${Math.floor(level)}${swIcon}`
@@ -160,7 +160,7 @@ export function SkywarsProgress({ level, percent, currentXp, ceilingXp }: { leve
} }
function LevelNumber({ level, className }: { level: number, className?: string }) { function LevelNumber({ level, className }: { level: number, className?: string }) {
const pres = getPrestige(level) const pres = getSkywarsPrestige(level)
if (pres.name.startsWith("Mythic")) { if (pres.name.startsWith("Mythic")) {
return ( return (
<div <div
@@ -180,7 +180,7 @@ function LevelNumber({ level, className }: { level: number, className?: string }
} }
function Progress({ level, percent, tooltipId, tooltipContent }: { level: number, percent: number, tooltipId: string, tooltipContent: string }) { function Progress({ level, percent, tooltipId, tooltipContent }: { level: number, percent: number, tooltipId: string, tooltipContent: string }) {
const pres = getPrestige(level) const pres = getSkywarsPrestige(level)
if (pres.name.startsWith("Mythic")) { if (pres.name.startsWith("Mythic")) {
return <GenericProgress percent={percent} rainbow={true} tooltipId={tooltipId} tooltipContent={tooltipContent} /> return <GenericProgress percent={percent} rainbow={true} tooltipId={tooltipId} tooltipContent={tooltipContent} />
} }
@@ -197,7 +197,7 @@ function Progress({ level, percent, tooltipId, tooltipContent }: { level: number
export function SkywarsPrestige({ level, icon }: { level: number, icon?: string }) { export function SkywarsPrestige({ level, icon }: { level: number, icon?: string }) {
const swIcon = getSkyWarsIcon(icon) const swIcon = getSkyWarsIcon(icon)
const pres = getPrestige(level) const pres = getSkywarsPrestige(level)
const val = `${pres.name} ${swIcon}` const val = `${pres.name} ${swIcon}`
if (pres.name.startsWith("Mythic")) { if (pres.name.startsWith("Mythic")) {

View File

@@ -1,6 +1,6 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { _SkywarsStats, concatSkywarsStats, getBestMode, getSkywarsModeStats } from "@/lib/hypixel/skywars/skywars" import { _SkywarsStats, concatSkywarsStats, getBestSkywarsMode, getSkywarsModeStats } from "@/lib/hypixel/skywars/skywars"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
@@ -46,7 +46,7 @@ function SkywarsTableHeader() {
function Normal({ stats }: { stats: NonNullStats["SkyWars"] }) { function Normal({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("normal", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("normal", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "normal" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "normal"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
@@ -60,7 +60,7 @@ function Normal({ stats }: { stats: NonNullStats["SkyWars"] }) {
function Insane({ stats }: { stats: NonNullStats["SkyWars"] }) { function Insane({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("insane", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("insane", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "insane" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "insane"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
@@ -74,7 +74,7 @@ function Insane({ stats }: { stats: NonNullStats["SkyWars"] }) {
function TeamsNormal({ stats }: { stats: NonNullStats["SkyWars"] }) { function TeamsNormal({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("teams_normal", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("teams_normal", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "teams_normal" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "teams_normal"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
@@ -88,7 +88,7 @@ function TeamsNormal({ stats }: { stats: NonNullStats["SkyWars"] }) {
function TeamsInsane({ stats }: { stats: NonNullStats["SkyWars"] }) { function TeamsInsane({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("teams_insane", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("teams_insane", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "teams_insane" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "teams_insane"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
@@ -102,7 +102,7 @@ function TeamsInsane({ stats }: { stats: NonNullStats["SkyWars"] }) {
function Mega({ stats }: { stats: NonNullStats["SkyWars"] }) { function Mega({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("mega", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("mega", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "mega" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "mega"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
@@ -116,7 +116,7 @@ function Mega({ stats }: { stats: NonNullStats["SkyWars"] }) {
function MegaDoubles({ stats }: { stats: NonNullStats["SkyWars"] }) { function MegaDoubles({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("mega_doubles", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("mega_doubles", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "mega_doubles" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "mega_doubles"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
@@ -130,7 +130,7 @@ function MegaDoubles({ stats }: { stats: NonNullStats["SkyWars"] }) {
function Ranked({ stats }: { stats: NonNullStats["SkyWars"] }) { function Ranked({ stats }: { stats: NonNullStats["SkyWars"] }) {
const modeStats = getSkywarsModeStats("ranked", stats as _SkywarsStats) const modeStats = getSkywarsModeStats("ranked", stats as _SkywarsStats)
const isBest = getBestMode(stats as _SkywarsStats) === "ranked" const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "ranked"
return ( return (
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}> <TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>

View File

@@ -1,11 +1,11 @@
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { getProgress } from "@/lib/hypixel/general" import { getProgress } from "@/lib/hypixel/general"
import { getNextUhcStar, getUhcStar } from "@/lib/hypixel/uhc/level" import { getUhcStar, getUhcStarNext } from "@/lib/hypixel/uhc/level"
import { GenericProgress } from "../../_components/GenericProgress" import { GenericProgress } from "../../_components/GenericProgress"
export default function UHCProgress({ score }: { score: number }) { export default function UHCProgress({ score }: { score: number }) {
const current = getUhcStar(score) const current = getUhcStar(score)
const next = getNextUhcStar(score) const next = getUhcStarNext(score)
const percent = getProgress(0, score, next.value) const percent = getProgress(0, score, next.value)
return ( return (

View File

@@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { devide } from "@/lib/hypixel/general" import { devide } from "@/lib/hypixel/general"
import { getStatsCombined } from "@/lib/hypixel/uhc/general" import { getUHCStatsCombined } from "@/lib/hypixel/uhc/general"
import { getUhcStarValue } from "@/lib/hypixel/uhc/level" import { getUhcStarValue } from "@/lib/hypixel/uhc/level"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats" import CollapsedStats from "../../_components/CollapsedStats"
@@ -14,7 +14,7 @@ import UHCStatTable from "./table"
export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) { export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) {
if (!stats) return null if (!stats) return null
const combined = getStatsCombined(stats) const combined = getUHCStatsCombined(stats)
const kd = formatNumber(devide(combined.kills, combined.deaths)) const kd = formatNumber(devide(combined.kills, combined.deaths))
const star = getUhcStarValue(stats.score) const star = getUhcStarValue(stats.score)

View File

@@ -64,7 +64,7 @@ export function concatBedwarsStats(...stats: BedwarsModeStats[]) {
] ]
} }
export function getPrestige(level: number) { export function getBedwarsPrestige(level: number) {
const floored = floorLevel(level, 100) const floored = floorLevel(level, 100)
if (level > 5000) { if (level > 5000) {
@@ -98,7 +98,7 @@ export function getPrestige(level: number) {
} }
} }
export function getWalletMax(name?: string) { export function getBedwarsWalletMax(name?: string) {
if (!name) return 25 if (!name) return 25
const wallets = SLUMBER_WALLETS as Record<string, number> const wallets = SLUMBER_WALLETS as Record<string, number>
@@ -108,7 +108,7 @@ export function getWalletMax(name?: string) {
return wallets[name] return wallets[name]
} }
export function getLatestRoom(rooms?: Record<string, boolean>) { export function getBedwarsLatestRoom(rooms?: Record<string, boolean>) {
if (!rooms) return null if (!rooms) return null
let latestRoom = null let latestRoom = null

View File

@@ -15,7 +15,7 @@ function getBWLevel(level: number) {
return level % LEVELS_PER_PRESTIGE return level % LEVELS_PER_PRESTIGE
} }
function getBWExpForLevel(level: number) { function getBedwarsExpForLevel(level: number) {
if (level === 0) return 0 if (level === 0) return 0
const respectedLevel = getBWLevel(level) const respectedLevel = getBWLevel(level)
@@ -37,14 +37,14 @@ function getBWExpForLevel(level: number) {
} }
} }
export function getBWLevelForExp(exp: number) { export function getBedwarsLevelForExp(exp: number) {
const prestiges = Math.floor(exp / XP_PER_PRESTIGE) const prestiges = Math.floor(exp / XP_PER_PRESTIGE)
let level = prestiges * LEVELS_PER_PRESTIGE let level = prestiges * LEVELS_PER_PRESTIGE
let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE) let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE)
let expForEasyLevel let expForEasyLevel
for (let i = 1; i <= EASY_LEVELS; i += 1) { for (let i = 1; i <= EASY_LEVELS; i += 1) {
expForEasyLevel = getBWExpForLevel(i) expForEasyLevel = getBedwarsExpForLevel(i)
if (expWithoutPrestiges < expForEasyLevel) { if (expWithoutPrestiges < expForEasyLevel) {
break break
} }
@@ -54,7 +54,7 @@ export function getBWLevelForExp(exp: number) {
return level + Math.floor(expWithoutPrestiges / 5000) return level + Math.floor(expWithoutPrestiges / 5000)
} }
export function getTotalExpForLevel(level: number): number { export function getTotalBedwarsExpForLevel(level: number): number {
if (level === 0) return 0 if (level === 0) return 0
const prestiges = Math.floor(level / LEVELS_PER_PRESTIGE) const prestiges = Math.floor(level / LEVELS_PER_PRESTIGE)
@@ -62,7 +62,7 @@ export function getTotalExpForLevel(level: number): number {
const remainingLevels = level % LEVELS_PER_PRESTIGE const remainingLevels = level % LEVELS_PER_PRESTIGE
for (let i = 1; i <= remainingLevels; i += 1) { for (let i = 1; i <= remainingLevels; i += 1) {
totalExp += getBWExpForLevel(i) totalExp += getBedwarsExpForLevel(i)
} }
return totalExp return totalExp

View File

@@ -7,7 +7,7 @@ export function getBuildBattleRank(score: number) {
return STARS[0] return STARS[0]
} }
export function getNextBuildBattleRank(score: number) { export function getBuildBattleRankNext(score: number) {
const current = getBuildBattleRank(score) const current = getBuildBattleRank(score)
const next = STARS.indexOf(current) + 1 const next = STARS.indexOf(current) + 1

View File

@@ -6,7 +6,7 @@ export function getCopsAndCrimsModeName(modeId: typeof MODES[number]["id"]) {
return MODES.find(m => m.id === modeId)!.name return MODES.find(m => m.id === modeId)!.name
} }
export function getScoreColor(score: number) { export function getCopsAndCrimsScoreColor(score: number) {
for (const scoreThreshold of SCORE.slice().reverse()) { for (const scoreThreshold of SCORE.slice().reverse()) {
if (scoreThreshold.score <= score) return scoreThreshold.color if (scoreThreshold.score <= score) return scoreThreshold.color
} }

View File

@@ -11,7 +11,7 @@ export type Div = {
type Mode = typeof MODES[number]["id"] type Mode = typeof MODES[number]["id"]
type Devisions = typeof MODES[number]["divisionId"] type Devisions = typeof MODES[number]["divisionId"]
export function getMode(id: typeof MODES[number]["id"]) { export function getDuelsMode(id: typeof MODES[number]["id"]) {
const div = MODES.find(d => d.id === id) const div = MODES.find(d => d.id === id)
return { return {
@@ -20,7 +20,7 @@ export function getMode(id: typeof MODES[number]["id"]) {
} }
} }
export function getDevision(devison: Devisions, stats: NonNullable<NonNullStats["Duels"]>) { export function getDuelsDevision(devison: Devisions, stats: NonNullable<NonNullStats["Duels"]>) {
if (!devison) return null if (!devison) return null
for (const div of DIVISIONS.slice().reverse()) { for (const div of DIVISIONS.slice().reverse()) {
@@ -37,7 +37,7 @@ export function getDevision(devison: Devisions, stats: NonNullable<NonNullStats[
return null return null
} }
export function getAllDivisions(stats: NonNullable<NonNullStats["Duels"]>) { export function getAllDuelsDivisions(stats: NonNullable<NonNullStats["Duels"]>) {
for (const div of DIVISIONS.slice().reverse()) { for (const div of DIVISIONS.slice().reverse()) {
const index = `all_modes_${div.id}_title_prestige` as const const index = `all_modes_${div.id}_title_prestige` as const
const val = stats[index] const val = stats[index]
@@ -53,7 +53,7 @@ export function getAllDivisions(stats: NonNullable<NonNullStats["Duels"]>) {
return null return null
} }
export function getMostPlayed(stats: NonNullable<NonNullStats["Duels"]>) { export function getDuelsMostPlayed(stats: NonNullable<NonNullStats["Duels"]>) {
let mostPlayed: typeof MODES[number] | null = null let mostPlayed: typeof MODES[number] | null = null
let mostPlays = 0 let mostPlays = 0
for (const mode of MODES) { for (const mode of MODES) {

View File

@@ -2,7 +2,7 @@ import { CLASSES, DIFFICULTIES, MODES } from "@/data/hypixel/megawalls"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general" import { devide } from "../general"
export function getMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) { export function getMegawallsMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) {
let mostPlayedClass: typeof CLASSES[number] | null = null let mostPlayedClass: typeof CLASSES[number] | null = null
let maxPlays = 0 let maxPlays = 0
@@ -20,7 +20,7 @@ export function getMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) {
return mostPlayedClass return mostPlayedClass
} }
export function getDifficultyColor(val: 1 | 2 | 3 | 4) { export function getMegaWallsDifficultyColor(val: 1 | 2 | 3 | 4) {
return DIFFICULTIES[val] return DIFFICULTIES[val]
} }
@@ -32,17 +32,17 @@ export function getMegaWallsClass(classId: typeof CLASSES[number]["id"]) {
return CLASSES.find(c => c.id === classId)! return CLASSES.find(c => c.id === classId)!
} }
export function getAllClassStats(stats: NonNullable<NonNullStats["MegaWalls"]>) { export function getAllMegawallsClassStats(stats: NonNullable<NonNullStats["MegaWalls"]>) {
const statsArr: { id: typeof CLASSES[number]["id"], val: number[] }[] = [] const statsArr: { id: typeof CLASSES[number]["id"], val: number[] }[] = []
for (const klass of CLASSES) { for (const klass of CLASSES) {
statsArr.push({ id: klass.id, val: megaWalsClassStats(klass.id, stats) }) statsArr.push({ id: klass.id, val: getMegaWallsClassStats(klass.id, stats) })
} }
return statsArr return statsArr
} }
export function megaWalsClassStats(classId: typeof CLASSES[number]["id"], stats: NonNullable<NonNullStats["MegaWalls"]>) { export function getMegaWallsClassStats(classId: typeof CLASSES[number]["id"], stats: NonNullable<NonNullStats["MegaWalls"]>) {
return [ return [
stats[`${classId}_kills`], stats[`${classId}_kills`],
stats[`${classId}_deaths`], stats[`${classId}_deaths`],

View File

@@ -2,7 +2,7 @@ import { KNIFESKINS, MODES } from "@/data/hypixel/murder-mystery"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general" import { devide } from "../general"
export function getKnifeName(name?: string) { export function getMurderMysteryKnifeName(name?: string) {
if (!name) return KNIFESKINS.undefined if (!name) return KNIFESKINS.undefined
const skin = (KNIFESKINS as Record<string, string>)[name] const skin = (KNIFESKINS as Record<string, string>)[name]
@@ -12,7 +12,7 @@ export function getKnifeName(name?: string) {
return skin return skin
} }
export function getModeTitle(mode: Exclude<typeof MODES[number]["id"], ""> | "all_modes") { export function getMurderMysteryModeTitle(mode: Exclude<typeof MODES[number]["id"], ""> | "all_modes") {
if (mode === "all_modes") return MODES.find(m => m.id === "")!.name if (mode === "all_modes") return MODES.find(m => m.id === "")!.name
return MODES.find(m => m.id === mode)!.name return MODES.find(m => m.id === mode)!.name

View File

@@ -1,7 +1,7 @@
import { LEVELCOLORS, PRESTIGE_MULTIPLIERS, PRESTIGECOLORS } from "@/data/hypixel/pit" import { LEVELCOLORS, PRESTIGE_MULTIPLIERS, PRESTIGECOLORS } from "@/data/hypixel/pit"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
export function getLevelColor(level: number) { export function getPitLevelColor(level: number) {
for (const lvl of LEVELCOLORS.slice().reverse()) { for (const lvl of LEVELCOLORS.slice().reverse()) {
if (lvl.level <= level) return lvl.color if (lvl.level <= level) return lvl.color
} }
@@ -9,7 +9,7 @@ export function getLevelColor(level: number) {
return LEVELCOLORS.at(0)!.color return LEVELCOLORS.at(0)!.color
} }
export function getPrestigeColor(prestige: number) { export function getPitPrestigeColor(prestige: number) {
for (const pres of PRESTIGECOLORS.slice().reverse()) { for (const pres of PRESTIGECOLORS.slice().reverse()) {
if (pres.prestige <= prestige) return pres.color if (pres.prestige <= prestige) return pres.color
} }
@@ -17,11 +17,11 @@ export function getPrestigeColor(prestige: number) {
return PRESTIGECOLORS.at(0)!.color return PRESTIGECOLORS.at(0)!.color
} }
export function getXpForPrestige(prestige: number): number { export function getPitXpForPrestige(prestige: number): number {
if (prestige <= 0 || prestige > PRESTIGE_MULTIPLIERS.length) return 0 if (prestige <= 0 || prestige > PRESTIGE_MULTIPLIERS.length) return 0
return PRESTIGE_MULTIPLIERS[prestige - 1].SumXp return PRESTIGE_MULTIPLIERS[prestige - 1].SumXp
} }
export function getPrestige(stats: NonNullable<NonNullStats["Pit"]>) { export function getPitPrestige(stats: NonNullable<NonNullStats["Pit"]>) {
return stats.profile.prestiges === undefined ? 0 : stats.profile.prestiges.length return stats.profile.prestiges === undefined ? 0 : stats.profile.prestiges.length
} }

View File

@@ -2,7 +2,7 @@ import { HEADS, ICONS, PRESTIGES } from "@/data/hypixel/skywars"
import { formatNumber } from "@/lib/formatters" import { formatNumber } from "@/lib/formatters"
import { concatStatsArray, devide, floorLevel } from "../general" import { concatStatsArray, devide, floorLevel } from "../general"
export function getHeads(key: string) { export function getSkywarsHeads(key: string) {
const val = HEADS.find(v => v.id === key) const val = HEADS.find(v => v.id === key)
if (!val) return null if (!val) return null
@@ -32,7 +32,7 @@ export function concatSkywarsStats(...stats: SkywarsModeStats[]) {
] ]
} }
export function getPrestige(level: number) { export function getSkywarsPrestige(level: number) {
const floored = floorLevel(level, 10) const floored = floorLevel(level, 10)
if (level > PRESTIGES.at(-1)!.level) { if (level > PRESTIGES.at(-1)!.level) {
@@ -69,7 +69,7 @@ export type SkywarsModeStats = {
losses: number losses: number
} }
export function getBestMode(stats: _SkywarsStats): Mode | null { export function getBestSkywarsMode(stats: _SkywarsStats): Mode | null {
const { wins: normal } = getSkywarsModeStats("normal", stats, true) const { wins: normal } = getSkywarsModeStats("normal", stats, true)
const { wins: insane } = getSkywarsModeStats("insane", stats, true) const { wins: insane } = getSkywarsModeStats("insane", stats, true)
const { wins: teams_normal } = getSkywarsModeStats("teams_normal", stats, true) const { wins: teams_normal } = getSkywarsModeStats("teams_normal", stats, true)

View File

@@ -2,7 +2,7 @@ import { MODES } from "@/data/hypixel/uhc"
import { NonNullStats } from "@/lib/schema/player" import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general" import { devide } from "../general"
export function getStatsCombined(stats: NonNullable<NonNullStats["UHC"]>) { export function getUHCStatsCombined(stats: NonNullable<NonNullStats["UHC"]>) {
return { return {
wins: getUHCWins(stats), wins: getUHCWins(stats),
kills: getUHCKills(stats), kills: getUHCKills(stats),
@@ -17,7 +17,7 @@ export function getUHCModeName(modeId: typeof MODES[number]["id"]) {
export function getUHCModeStats(modeId: typeof MODES[number]["id"] | "all_modes", stats: NonNullable<NonNullStats["UHC"]>) { export function getUHCModeStats(modeId: typeof MODES[number]["id"] | "all_modes", stats: NonNullable<NonNullStats["UHC"]>) {
if (modeId === "all_modes") { if (modeId === "all_modes") {
const statsCombined = getStatsCombined(stats) const statsCombined = getUHCStatsCombined(stats)
return [ return [
statsCombined.kills, statsCombined.kills,
statsCombined.deaths, statsCombined.deaths,

View File

@@ -14,7 +14,7 @@ export function getUhcStar(score: number) {
return STARS.at(current - 1)! return STARS.at(current - 1)!
} }
export function getNextUhcStar(score: number) { export function getUhcStarNext(score: number) {
const current = getUhcStarValue(score) const current = getUhcStarValue(score)
if (current === 15) return STARS.at(-1)! if (current === 15) return STARS.at(-1)!