diff --git a/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx b/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx index a37de2c..6451745 100644 --- a/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx +++ b/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx @@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ import { Card, CardContent } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" 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 { NonNullStats } from "@/lib/schema/player" 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 wl = formatNumber(devide(stats.wins_bedwars, stats.losses_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 next = getTotalExpForLevel(level + 1) + const current = getTotalBedwarsExpForLevel(level) + const next = getTotalBedwarsExpForLevel(level + 1) const percent = getProgress(current, stats.Experience, next) const xpProgress = stats.Experience - current diff --git a/src/app/(stats)/player/[ign]/_stats/bedwars/components.tsx b/src/app/(stats)/player/[ign]/_stats/bedwars/components.tsx index 8e4350f..4673ed3 100644 --- a/src/app/(stats)/player/[ign]/_stats/bedwars/components.tsx +++ b/src/app/(stats)/player/[ign]/_stats/bedwars/components.tsx @@ -1,13 +1,13 @@ import { formatNumber } from "@/lib/formatters" -import { getBedwarsStar, getPrestige } from "@/lib/hypixel/bedwars/bedwars" -import { getBWLevelForExp } from "@/lib/hypixel/bedwars/level" +import { getBedwarsPrestige, getBedwarsStar } from "@/lib/hypixel/bedwars/bedwars" +import { getBedwarsLevelForExp } from "@/lib/hypixel/bedwars/level" import { cn } from "@/lib/utils" import { GenericProgress } from "../../_components/GenericProgress" import Multicolored from "../../_components/Multicolored" export function BedwarsLevel({ xp }: { xp: number }) { - const level = getBWLevelForExp(xp) - const color = getPrestige(level).colormap + const level = getBedwarsLevelForExp(xp) + const color = getBedwarsPrestige(level).colormap const star = getBedwarsStar(level) const val = `[${level}${star}]` @@ -30,7 +30,7 @@ export function BedwarsProgress({ level, percent, currentXp, ceilingXp }: { leve } export function BedWarsPrestige({ level }: { level: number }) { - const pres = getPrestige(level) + const pres = getBedwarsPrestige(level) const star = getBedwarsStar(level) if (level >= 1000 && level < 1100) { return ( @@ -69,7 +69,7 @@ function LevelNumber({ level, className }: { level: number, className?: string } ) } - return

{level}

+ return

{level}

} 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 } - return + return ( + + ) } diff --git a/src/app/(stats)/player/[ign]/_stats/bedwars/stats.tsx b/src/app/(stats)/player/[ign]/_stats/bedwars/stats.tsx index 3fd1cf5..0cee1b9 100644 --- a/src/app/(stats)/player/[ign]/_stats/bedwars/stats.tsx +++ b/src/app/(stats)/player/[ign]/_stats/bedwars/stats.tsx @@ -1,5 +1,5 @@ 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 { BasicStat, Stat } from "../../_components/Stats" import { BedWarsPrestige } from "./components" @@ -55,7 +55,7 @@ export default function BedwarsGeneralStats( {stats.slumber?.tickets === undefined ? "None" : formatNumber(stats.slumber.tickets)} - {`/${formatNumber(getWalletMax(stats.slumber?.bag_type))}`} + {`/${formatNumber(getBedwarsWalletMax(stats.slumber?.bag_type))}`} - +


diff --git a/src/app/(stats)/player/[ign]/_stats/build-battle/progress.tsx b/src/app/(stats)/player/[ign]/_stats/build-battle/progress.tsx index 645a32d..04f9cf8 100644 --- a/src/app/(stats)/player/[ign]/_stats/build-battle/progress.tsx +++ b/src/app/(stats)/player/[ign]/_stats/build-battle/progress.tsx @@ -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 { cn } from "@/lib/utils" import { GenericProgress } from "../../_components/GenericProgress" export default function BuildBattleTitleProgress({ score }: { score: number }) { const current = getBuildBattleRank(score) - const next = getNextBuildBattleRank(score) + const next = getBuildBattleRankNext(score) const percent = getProgress(0, score, next !== null ? next.value : 0) diff --git a/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx b/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx index 3125208..afbc121 100644 --- a/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx +++ b/src/app/(stats)/player/[ign]/_stats/copsandcrims/copsandcrims.tsx @@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ import { Card, CardContent } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" 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 { NonNullStats } from "@/lib/schema/player" 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 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 scoreColor = getScoreColor(score) + const scoreColor = getCopsAndCrimsScoreColor(score) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx b/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx index 0780b0a..06796d6 100644 --- a/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx +++ b/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx @@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ import { Card, CardContent } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" 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 { NonNullStats } from "@/lib/schema/player" 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 kd = formatNumber(devide(stats.kills, stats.deaths)) - const div = getAllDivisions(stats) - const mostPlayed = getMostPlayed(stats) + const div = getAllDuelsDivisions(stats) + const mostPlayed = getDuelsMostPlayed(stats) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/duels/table.tsx b/src/app/(stats)/player/[ign]/_stats/duels/table.tsx index 7f917c2..0566dfb 100644 --- a/src/app/(stats)/player/[ign]/_stats/duels/table.tsx +++ b/src/app/(stats)/player/[ign]/_stats/duels/table.tsx @@ -1,6 +1,6 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" 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 { NonNullStats } from "@/lib/schema/player" @@ -73,11 +73,11 @@ function DuelsTableHeader() { ) } -function DuelsStat({ modeId, stats }: { modeId: Parameters[0], stats: NonNullable }) { +function DuelsStat({ modeId, stats }: { modeId: Parameters[0], stats: NonNullable }) { const modeStats = getDuelsModeStats(modeId, stats) - const mode = getMode(modeId) + const mode = getDuelsMode(modeId) const bestMode = getBestDuelsMode(stats) === modeId - const div = getDevision(mode.divId, stats) + const div = getDuelsDevision(mode.divId, stats) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx b/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx index 7f7d269..5f337f5 100644 --- a/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx +++ b/src/app/(stats)/player/[ign]/_stats/megawalls/megawalls.tsx @@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" 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 { cn } from "@/lib/utils" 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 fkd = formatNumber(devide(stats.final_kills, stats.final_deaths)) const wl = formatNumber(devide(stats.wins, stats.losses)) - const mostPlayed = getMostPlayed(stats) - const difficultyColor = getDifficultyColor(mostPlayed !== null ? mostPlayed.difficulty : 1) + const mostPlayed = getMegawallsMostPlayed(stats) + const difficultyColor = getMegaWallsDifficultyColor(mostPlayed !== null ? mostPlayed.difficulty : 1) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/megawalls/table.tsx b/src/app/(stats)/player/[ign]/_stats/megawalls/table.tsx index 71a50d3..a4023a2 100644 --- a/src/app/(stats)/player/[ign]/_stats/megawalls/table.tsx +++ b/src/app/(stats)/player/[ign]/_stats/megawalls/table.tsx @@ -1,7 +1,13 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { formatNumber } from "@/lib/formatters" 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" export function MegaWallsModesTable({ stats }: { stats: NonNullable }) { @@ -77,13 +83,13 @@ function MegaWallsTableHeader() { } function MegaWallsClassStats({ stats }: { stats: NonNullable }) { - const classStats = getAllClassStats(stats) + const classStats = getAllMegawallsClassStats(stats) return ( {classStats.map((c, i) => { const { id, val } = c const klass = getMegaWallsClass(id) - const difColor = getDifficultyColor(klass.difficulty) + const difColor = getMegaWallsDifficultyColor(klass.difficulty) return ( {klass.name} diff --git a/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx b/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx index ed90c01..d8da9dc 100644 --- a/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx +++ b/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx @@ -1,13 +1,13 @@ import { formatNumber, formatSecondsToTime } from "@/lib/formatters" 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 { BasicStat } from "../../_components/Stats" export default function MurderMysteryGeneralStats({ stats }: { stats: NonNullable }) { const kd = formatNumber(devide(stats.kills, stats.deaths)) const wl = formatNumber(devide(stats.wins, stats.losses)) - const weapon = getKnifeName(stats.active_knife_skin) + const weapon = getMurderMysteryKnifeName(stats.active_knife_skin) return (

diff --git a/src/app/(stats)/player/[ign]/_stats/murder-mystery/table.tsx b/src/app/(stats)/player/[ign]/_stats/murder-mystery/table.tsx index c246dc2..7d2f38e 100644 --- a/src/app/(stats)/player/[ign]/_stats/murder-mystery/table.tsx +++ b/src/app/(stats)/player/[ign]/_stats/murder-mystery/table.tsx @@ -1,6 +1,6 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" 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 { cn } from "@/lib/utils" @@ -47,7 +47,7 @@ function MurderMysteryTableHeader() { function MurderMysteryStat( { modeId, stats }: { modeId: Parameters[0], stats: NonNullable } ) { - const title = getModeTitle(modeId) + const title = getMurderMysteryModeTitle(modeId) const modeStats = getMurderMysteryModeStats(modeId, stats) const bestMode = getBestMurderMysteryMode(stats) === modeId diff --git a/src/app/(stats)/player/[ign]/_stats/pit/level.tsx b/src/app/(stats)/player/[ign]/_stats/pit/level.tsx index 122a552..9ff0d4b 100644 --- a/src/app/(stats)/player/[ign]/_stats/pit/level.tsx +++ b/src/app/(stats)/player/[ign]/_stats/pit/level.tsx @@ -1,11 +1,11 @@ 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" export default function PitLevel({ xp, prestige }: { xp: number, prestige: number }) { const level = getPitLevel(xp, prestige) - const prestigeColor = getPrestigeColor(prestige) - const levelColor = getLevelColor(level) + const prestigeColor = getPitPrestigeColor(prestige) + const levelColor = getPitLevelColor(level) return (

[ diff --git a/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx b/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx index 565aa29..a7abe33 100644 --- a/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx +++ b/src/app/(stats)/player/[ign]/_stats/pit/pit.tsx @@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" 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 CollapsedStats from "../../_components/CollapsedStats" import PitLevel from "./level" @@ -14,7 +14,7 @@ export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) { if (!stats) return null const kd = formatNumber(devide(stats.kills, stats.deaths)) - const prestige = getPrestige(stats) + const prestige = getPitPrestige(stats) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx b/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx index d0396be..5ba4994 100644 --- a/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx +++ b/src/app/(stats)/player/[ign]/_stats/pit/progress.tsx @@ -1,12 +1,12 @@ import { formatNumber } from "@/lib/formatters" 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" export default function PitProgress({ prestige, xp }: { prestige: number, xp: number }) { - const presColor = getPrestigeColor(prestige) - const currentXp = getXpForPrestige(prestige) - const nextXp = getXpForPrestige(prestige + 1) + const presColor = getPitPrestigeColor(prestige) + const currentXp = getPitXpForPrestige(prestige) + const nextXp = getPitXpForPrestige(prestige + 1) const percent = getProgress(currentXp, xp, nextXp) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/pit/stats.tsx b/src/app/(stats)/player/[ign]/_stats/pit/stats.tsx index 8c14a38..3749992 100644 --- a/src/app/(stats)/player/[ign]/_stats/pit/stats.tsx +++ b/src/app/(stats)/player/[ign]/_stats/pit/stats.tsx @@ -1,15 +1,15 @@ import { formatNumber, formatSecondsToTime } from "@/lib/formatters" 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 { NonNullStats } from "@/lib/schema/player" import { BasicStat } from "../../_components/Stats" export default function PitGeneralStats({ stats }: { stats: NonNullable }) { - const prestige = getPrestige(stats) + const prestige = getPitPrestige(stats) const level = getPitLevel(stats.profile.xp, prestige) - const pretigeColor = getPrestigeColor(prestige) - const levelColor = getLevelColor(level) + const pretigeColor = getPitPrestigeColor(prestige) + const levelColor = getPitLevelColor(level) const kah = formatNumber(devide(stats.kills + stats.assists, 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)) diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx index 888864d..264e0af 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx @@ -1,7 +1,7 @@ "use client" 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 Image from "next/image" import Link from "next/link" @@ -73,7 +73,7 @@ export function HeadsBar({ heads, heads_total }: { heads: [string, number][], he <>

{heads.map(([key, total]) => { - const head = getHeads(key) + const head = getSkywarsHeads(key) const percent = total / heads_total if (percent === 0) return null diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx index 263a473..ae20cee 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx @@ -1,6 +1,6 @@ import { formatNumber } from "@/lib/formatters" 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 { GenericProgress } from "../../_components/GenericProgress" 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 }) { const level = getSkywarsLevel(xp) - const pres = getPrestige(Math.floor(level)) + const pres = getSkywarsPrestige(Math.floor(level)) const swIcon = getSkyWarsIcon(icon) 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 }) { - const pres = getPrestige(level) + const pres = getSkywarsPrestige(level) if (pres.name.startsWith("Mythic")) { return (
} @@ -197,7 +197,7 @@ function Progress({ level, percent, tooltipId, tooltipContent }: { level: number export function SkywarsPrestige({ level, icon }: { level: number, icon?: string }) { const swIcon = getSkyWarsIcon(icon) - const pres = getPrestige(level) + const pres = getSkywarsPrestige(level) const val = `${pres.name} ${swIcon}` if (pres.name.startsWith("Mythic")) { diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/table.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/table.tsx index d45b8fd..fef7d4b 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/table.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/table.tsx @@ -1,6 +1,6 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" 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 { cn } from "@/lib/utils" @@ -46,7 +46,7 @@ function SkywarsTableHeader() { function Normal({ stats }: { stats: NonNullStats["SkyWars"] }) { const modeStats = getSkywarsModeStats("normal", stats as _SkywarsStats) - const isBest = getBestMode(stats as _SkywarsStats) === "normal" + const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "normal" return ( @@ -60,7 +60,7 @@ function Normal({ stats }: { stats: NonNullStats["SkyWars"] }) { function Insane({ stats }: { stats: NonNullStats["SkyWars"] }) { const modeStats = getSkywarsModeStats("insane", stats as _SkywarsStats) - const isBest = getBestMode(stats as _SkywarsStats) === "insane" + const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "insane" return ( @@ -74,7 +74,7 @@ function Insane({ stats }: { stats: NonNullStats["SkyWars"] }) { function TeamsNormal({ stats }: { stats: NonNullStats["SkyWars"] }) { 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 ( @@ -88,7 +88,7 @@ function TeamsNormal({ stats }: { stats: NonNullStats["SkyWars"] }) { function TeamsInsane({ stats }: { stats: NonNullStats["SkyWars"] }) { 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 ( @@ -102,7 +102,7 @@ function TeamsInsane({ stats }: { stats: NonNullStats["SkyWars"] }) { function Mega({ stats }: { stats: NonNullStats["SkyWars"] }) { const modeStats = getSkywarsModeStats("mega", stats as _SkywarsStats) - const isBest = getBestMode(stats as _SkywarsStats) === "mega" + const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "mega" return ( @@ -116,7 +116,7 @@ function Mega({ stats }: { stats: NonNullStats["SkyWars"] }) { function MegaDoubles({ stats }: { stats: NonNullStats["SkyWars"] }) { 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 ( @@ -130,7 +130,7 @@ function MegaDoubles({ stats }: { stats: NonNullStats["SkyWars"] }) { function Ranked({ stats }: { stats: NonNullStats["SkyWars"] }) { const modeStats = getSkywarsModeStats("ranked", stats as _SkywarsStats) - const isBest = getBestMode(stats as _SkywarsStats) === "ranked" + const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "ranked" return ( diff --git a/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx b/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx index ae14e74..84e1d09 100644 --- a/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx +++ b/src/app/(stats)/player/[ign]/_stats/uhc/progress.tsx @@ -1,11 +1,11 @@ import { formatNumber } from "@/lib/formatters" 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" export default function UHCProgress({ score }: { score: number }) { const current = getUhcStar(score) - const next = getNextUhcStar(score) + const next = getUhcStarNext(score) const percent = getProgress(0, score, next.value) return ( diff --git a/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx b/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx index e15751d..63b7266 100644 --- a/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx +++ b/src/app/(stats)/player/[ign]/_stats/uhc/uhc.tsx @@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" import { formatNumber } from "@/lib/formatters" 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 { NonNullStats } from "@/lib/schema/player" import CollapsedStats from "../../_components/CollapsedStats" @@ -14,7 +14,7 @@ import UHCStatTable from "./table" export default function UHCStats({ stats }: { stats: NonNullStats["UHC"] }) { if (!stats) return null - const combined = getStatsCombined(stats) + const combined = getUHCStatsCombined(stats) const kd = formatNumber(devide(combined.kills, combined.deaths)) const star = getUhcStarValue(stats.score) diff --git a/src/lib/hypixel/bedwars/bedwars.ts b/src/lib/hypixel/bedwars/bedwars.ts index fd2fa4b..be53ec2 100644 --- a/src/lib/hypixel/bedwars/bedwars.ts +++ b/src/lib/hypixel/bedwars/bedwars.ts @@ -64,7 +64,7 @@ export function concatBedwarsStats(...stats: BedwarsModeStats[]) { ] } -export function getPrestige(level: number) { +export function getBedwarsPrestige(level: number) { const floored = floorLevel(level, 100) 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 const wallets = SLUMBER_WALLETS as Record @@ -108,7 +108,7 @@ export function getWalletMax(name?: string) { return wallets[name] } -export function getLatestRoom(rooms?: Record) { +export function getBedwarsLatestRoom(rooms?: Record) { if (!rooms) return null let latestRoom = null diff --git a/src/lib/hypixel/bedwars/level.ts b/src/lib/hypixel/bedwars/level.ts index 615b1d0..33b48f1 100644 --- a/src/lib/hypixel/bedwars/level.ts +++ b/src/lib/hypixel/bedwars/level.ts @@ -15,7 +15,7 @@ function getBWLevel(level: number) { return level % LEVELS_PER_PRESTIGE } -function getBWExpForLevel(level: number) { +function getBedwarsExpForLevel(level: number) { if (level === 0) return 0 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) let level = prestiges * LEVELS_PER_PRESTIGE let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE) let expForEasyLevel for (let i = 1; i <= EASY_LEVELS; i += 1) { - expForEasyLevel = getBWExpForLevel(i) + expForEasyLevel = getBedwarsExpForLevel(i) if (expWithoutPrestiges < expForEasyLevel) { break } @@ -54,7 +54,7 @@ export function getBWLevelForExp(exp: number) { return level + Math.floor(expWithoutPrestiges / 5000) } -export function getTotalExpForLevel(level: number): number { +export function getTotalBedwarsExpForLevel(level: number): number { if (level === 0) return 0 const prestiges = Math.floor(level / LEVELS_PER_PRESTIGE) @@ -62,7 +62,7 @@ export function getTotalExpForLevel(level: number): number { const remainingLevels = level % LEVELS_PER_PRESTIGE for (let i = 1; i <= remainingLevels; i += 1) { - totalExp += getBWExpForLevel(i) + totalExp += getBedwarsExpForLevel(i) } return totalExp diff --git a/src/lib/hypixel/build-battle/general.ts b/src/lib/hypixel/build-battle/general.ts index 797504d..de64e84 100644 --- a/src/lib/hypixel/build-battle/general.ts +++ b/src/lib/hypixel/build-battle/general.ts @@ -7,7 +7,7 @@ export function getBuildBattleRank(score: number) { return STARS[0] } -export function getNextBuildBattleRank(score: number) { +export function getBuildBattleRankNext(score: number) { const current = getBuildBattleRank(score) const next = STARS.indexOf(current) + 1 diff --git a/src/lib/hypixel/copsandcrims/general.ts b/src/lib/hypixel/copsandcrims/general.ts index 4d1cd1c..42c2693 100644 --- a/src/lib/hypixel/copsandcrims/general.ts +++ b/src/lib/hypixel/copsandcrims/general.ts @@ -6,7 +6,7 @@ export function getCopsAndCrimsModeName(modeId: typeof MODES[number]["id"]) { 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()) { if (scoreThreshold.score <= score) return scoreThreshold.color } diff --git a/src/lib/hypixel/duels/duels.ts b/src/lib/hypixel/duels/duels.ts index f0d745a..956a1be 100644 --- a/src/lib/hypixel/duels/duels.ts +++ b/src/lib/hypixel/duels/duels.ts @@ -11,7 +11,7 @@ export type Div = { type Mode = typeof MODES[number]["id"] 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) return { @@ -20,7 +20,7 @@ export function getMode(id: typeof MODES[number]["id"]) { } } -export function getDevision(devison: Devisions, stats: NonNullable) { +export function getDuelsDevision(devison: Devisions, stats: NonNullable) { if (!devison) return null for (const div of DIVISIONS.slice().reverse()) { @@ -37,7 +37,7 @@ export function getDevision(devison: Devisions, stats: NonNullable) { +export function getAllDuelsDivisions(stats: NonNullable) { for (const div of DIVISIONS.slice().reverse()) { const index = `all_modes_${div.id}_title_prestige` as const const val = stats[index] @@ -53,7 +53,7 @@ export function getAllDivisions(stats: NonNullable) { return null } -export function getMostPlayed(stats: NonNullable) { +export function getDuelsMostPlayed(stats: NonNullable) { let mostPlayed: typeof MODES[number] | null = null let mostPlays = 0 for (const mode of MODES) { diff --git a/src/lib/hypixel/megawalls/general.ts b/src/lib/hypixel/megawalls/general.ts index 100cbff..8b039a7 100644 --- a/src/lib/hypixel/megawalls/general.ts +++ b/src/lib/hypixel/megawalls/general.ts @@ -2,7 +2,7 @@ import { CLASSES, DIFFICULTIES, MODES } from "@/data/hypixel/megawalls" import { NonNullStats } from "@/lib/schema/player" import { devide } from "../general" -export function getMostPlayed(stats: NonNullable) { +export function getMegawallsMostPlayed(stats: NonNullable) { let mostPlayedClass: typeof CLASSES[number] | null = null let maxPlays = 0 @@ -20,7 +20,7 @@ export function getMostPlayed(stats: NonNullable) { return mostPlayedClass } -export function getDifficultyColor(val: 1 | 2 | 3 | 4) { +export function getMegaWallsDifficultyColor(val: 1 | 2 | 3 | 4) { return DIFFICULTIES[val] } @@ -32,17 +32,17 @@ export function getMegaWallsClass(classId: typeof CLASSES[number]["id"]) { return CLASSES.find(c => c.id === classId)! } -export function getAllClassStats(stats: NonNullable) { +export function getAllMegawallsClassStats(stats: NonNullable) { const statsArr: { id: typeof CLASSES[number]["id"], val: number[] }[] = [] 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 } -export function megaWalsClassStats(classId: typeof CLASSES[number]["id"], stats: NonNullable) { +export function getMegaWallsClassStats(classId: typeof CLASSES[number]["id"], stats: NonNullable) { return [ stats[`${classId}_kills`], stats[`${classId}_deaths`], diff --git a/src/lib/hypixel/murder-mystery/general.ts b/src/lib/hypixel/murder-mystery/general.ts index 71b1b9b..588f074 100644 --- a/src/lib/hypixel/murder-mystery/general.ts +++ b/src/lib/hypixel/murder-mystery/general.ts @@ -2,7 +2,7 @@ import { KNIFESKINS, MODES } from "@/data/hypixel/murder-mystery" import { NonNullStats } from "@/lib/schema/player" import { devide } from "../general" -export function getKnifeName(name?: string) { +export function getMurderMysteryKnifeName(name?: string) { if (!name) return KNIFESKINS.undefined const skin = (KNIFESKINS as Record)[name] @@ -12,7 +12,7 @@ export function getKnifeName(name?: string) { return skin } -export function getModeTitle(mode: Exclude | "all_modes") { +export function getMurderMysteryModeTitle(mode: Exclude | "all_modes") { if (mode === "all_modes") return MODES.find(m => m.id === "")!.name return MODES.find(m => m.id === mode)!.name diff --git a/src/lib/hypixel/pit/general.ts b/src/lib/hypixel/pit/general.ts index 0495273..7f6ac77 100644 --- a/src/lib/hypixel/pit/general.ts +++ b/src/lib/hypixel/pit/general.ts @@ -1,7 +1,7 @@ import { LEVELCOLORS, PRESTIGE_MULTIPLIERS, PRESTIGECOLORS } from "@/data/hypixel/pit" import { NonNullStats } from "@/lib/schema/player" -export function getLevelColor(level: number) { +export function getPitLevelColor(level: number) { for (const lvl of LEVELCOLORS.slice().reverse()) { if (lvl.level <= level) return lvl.color } @@ -9,7 +9,7 @@ export function getLevelColor(level: number) { return LEVELCOLORS.at(0)!.color } -export function getPrestigeColor(prestige: number) { +export function getPitPrestigeColor(prestige: number) { for (const pres of PRESTIGECOLORS.slice().reverse()) { if (pres.prestige <= prestige) return pres.color } @@ -17,11 +17,11 @@ export function getPrestigeColor(prestige: number) { 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 return PRESTIGE_MULTIPLIERS[prestige - 1].SumXp } -export function getPrestige(stats: NonNullable) { +export function getPitPrestige(stats: NonNullable) { return stats.profile.prestiges === undefined ? 0 : stats.profile.prestiges.length } diff --git a/src/lib/hypixel/skywars/skywars.ts b/src/lib/hypixel/skywars/skywars.ts index 6390d25..b64909f 100644 --- a/src/lib/hypixel/skywars/skywars.ts +++ b/src/lib/hypixel/skywars/skywars.ts @@ -2,7 +2,7 @@ import { HEADS, ICONS, PRESTIGES } from "@/data/hypixel/skywars" import { formatNumber } from "@/lib/formatters" import { concatStatsArray, devide, floorLevel } from "../general" -export function getHeads(key: string) { +export function getSkywarsHeads(key: string) { const val = HEADS.find(v => v.id === key) 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) if (level > PRESTIGES.at(-1)!.level) { @@ -69,7 +69,7 @@ export type SkywarsModeStats = { 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: insane } = getSkywarsModeStats("insane", stats, true) const { wins: teams_normal } = getSkywarsModeStats("teams_normal", stats, true) diff --git a/src/lib/hypixel/uhc/general.ts b/src/lib/hypixel/uhc/general.ts index d145096..d4b5443 100644 --- a/src/lib/hypixel/uhc/general.ts +++ b/src/lib/hypixel/uhc/general.ts @@ -2,7 +2,7 @@ import { MODES } from "@/data/hypixel/uhc" import { NonNullStats } from "@/lib/schema/player" import { devide } from "../general" -export function getStatsCombined(stats: NonNullable) { +export function getUHCStatsCombined(stats: NonNullable) { return { wins: getUHCWins(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) { if (modeId === "all_modes") { - const statsCombined = getStatsCombined(stats) + const statsCombined = getUHCStatsCombined(stats) return [ statsCombined.kills, statsCombined.deaths, diff --git a/src/lib/hypixel/uhc/level.ts b/src/lib/hypixel/uhc/level.ts index 9bc1e78..31ce2b4 100644 --- a/src/lib/hypixel/uhc/level.ts +++ b/src/lib/hypixel/uhc/level.ts @@ -14,7 +14,7 @@ export function getUhcStar(score: number) { return STARS.at(current - 1)! } -export function getNextUhcStar(score: number) { +export function getUhcStarNext(score: number) { const current = getUhcStarValue(score) if (current === 15) return STARS.at(-1)!