Refactor
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <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 }) {
|
||||
@@ -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} className={`bg-mc-${getPrestige(level).color}`} tooltipId={tooltipId} tooltipContent={tooltipContent} />
|
||||
return (
|
||||
<GenericProgress
|
||||
percent={percent}
|
||||
className={`bg-mc-${getBedwarsPrestige(level).color}`}
|
||||
tooltipId={tooltipId}
|
||||
tooltipContent={tooltipContent}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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)}
|
||||
</span>
|
||||
<span className="text-muted-foreground">
|
||||
{`/${formatNumber(getWalletMax(stats.slumber?.bag_type))}`}
|
||||
{`/${formatNumber(getBedwarsWalletMax(stats.slumber?.bag_type))}`}
|
||||
</span>
|
||||
</Stat>
|
||||
<BasicStat
|
||||
@@ -63,7 +63,7 @@ export default function BedwarsGeneralStats(
|
||||
value={formatNumber(stats.slumber?.total_tickets_earned ?? 0)}
|
||||
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" />
|
||||
<p>
|
||||
<br />
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<AccordionItem value="cops-and-crims">
|
||||
|
||||
@@ -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 (
|
||||
<AccordionItem value="duels">
|
||||
|
||||
@@ -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<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 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 (
|
||||
<TableRow>
|
||||
|
||||
@@ -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 (
|
||||
<AccordionItem value="megawalls">
|
||||
|
||||
@@ -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<NonNullStats["MegaWalls"]> }) {
|
||||
@@ -77,13 +83,13 @@ function MegaWallsTableHeader() {
|
||||
}
|
||||
|
||||
function MegaWallsClassStats({ stats }: { stats: NonNullable<NonNullStats["MegaWalls"]> }) {
|
||||
const classStats = getAllClassStats(stats)
|
||||
const classStats = getAllMegawallsClassStats(stats)
|
||||
return (
|
||||
<TableBody>
|
||||
{classStats.map((c, i) => {
|
||||
const { id, val } = c
|
||||
const klass = getMegaWallsClass(id)
|
||||
const difColor = getDifficultyColor(klass.difficulty)
|
||||
const difColor = getMegaWallsDifficultyColor(klass.difficulty)
|
||||
return (
|
||||
<TableRow key={i}>
|
||||
<TableCell className={`text-mc-${difColor}`}>{klass.name}</TableCell>
|
||||
|
||||
@@ -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<NonNullStats["MurderMystery"]> }) {
|
||||
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 (
|
||||
<div className="flex">
|
||||
|
||||
@@ -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<typeof getMurderMysteryModeStats>[0], stats: NonNullable<NonNullStats["MurderMystery"]> }
|
||||
) {
|
||||
const title = getModeTitle(modeId)
|
||||
const title = getMurderMysteryModeTitle(modeId)
|
||||
const modeStats = getMurderMysteryModeStats(modeId, stats)
|
||||
const bestMode = getBestMurderMysteryMode(stats) === modeId
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<p>
|
||||
<span className={`text-mc-${prestigeColor}`}>[</span>
|
||||
|
||||
@@ -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 (
|
||||
<AccordionItem value="pit">
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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<NonNullStats["Pit"]> }) {
|
||||
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))
|
||||
|
||||
@@ -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
|
||||
<>
|
||||
<div className="flex overflow-hidden mt-2 mb-4 rounded-md">
|
||||
{heads.map(([key, total]) => {
|
||||
const head = getHeads(key)
|
||||
const head = getSkywarsHeads(key)
|
||||
const percent = total / heads_total
|
||||
|
||||
if (percent === 0) return null
|
||||
|
||||
@@ -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 (
|
||||
<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 }) {
|
||||
const pres = getPrestige(level)
|
||||
const pres = getSkywarsPrestige(level)
|
||||
if (pres.name.startsWith("Mythic")) {
|
||||
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 }) {
|
||||
const swIcon = getSkyWarsIcon(icon)
|
||||
const pres = getPrestige(level)
|
||||
const pres = getSkywarsPrestige(level)
|
||||
const val = `${pres.name} ${swIcon}`
|
||||
|
||||
if (pres.name.startsWith("Mythic")) {
|
||||
|
||||
@@ -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 (
|
||||
<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"] }) {
|
||||
const modeStats = getSkywarsModeStats("insane", stats as _SkywarsStats)
|
||||
const isBest = getBestMode(stats as _SkywarsStats) === "insane"
|
||||
const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "insane"
|
||||
|
||||
return (
|
||||
<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"] }) {
|
||||
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 (
|
||||
<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"] }) {
|
||||
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 (
|
||||
<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"] }) {
|
||||
const modeStats = getSkywarsModeStats("mega", stats as _SkywarsStats)
|
||||
const isBest = getBestMode(stats as _SkywarsStats) === "mega"
|
||||
const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "mega"
|
||||
|
||||
return (
|
||||
<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"] }) {
|
||||
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 (
|
||||
<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"] }) {
|
||||
const modeStats = getSkywarsModeStats("ranked", stats as _SkywarsStats)
|
||||
const isBest = getBestMode(stats as _SkywarsStats) === "ranked"
|
||||
const isBest = getBestSkywarsMode(stats as _SkywarsStats) === "ranked"
|
||||
|
||||
return (
|
||||
<TableRow className={cn(isBest ? "font-bold text-mc-light-purple" : undefined)}>
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user