Updated ratios to use devide
This commit is contained in:
@@ -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 { getBWLevelForExp, getTotalExpForLevel } from "@/lib/hypixel/bedwars/level"
|
import { getBWLevelForExp, getTotalExpForLevel } from "@/lib/hypixel/bedwars/level"
|
||||||
import { 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"
|
||||||
import { BedwarsLevel, BedwarsProgress } from "./components"
|
import { BedwarsLevel, BedwarsProgress } from "./components"
|
||||||
@@ -13,10 +13,10 @@ import BedwarsStatTable from "./table"
|
|||||||
export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"] }) {
|
export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"] }) {
|
||||||
if (!stats) return null
|
if (!stats) return null
|
||||||
|
|
||||||
const kd = formatNumber(stats.kills_bedwars / stats.deaths_bedwars)
|
const kd = formatNumber(devide(stats.kills_bedwars, stats.deaths_bedwars))
|
||||||
const fkd = formatNumber(stats.final_kills_bedwars / stats.final_deaths_bedwars)
|
const fkd = formatNumber(devide(stats.final_kills_bedwars, stats.final_deaths_bedwars))
|
||||||
const wl = formatNumber(stats.wins_bedwars / stats.losses_bedwars)
|
const wl = formatNumber(devide(stats.wins_bedwars, stats.losses_bedwars))
|
||||||
const bbl = formatNumber(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 = getBWLevelForExp(stats.Experience)
|
||||||
|
|
||||||
const current = getTotalExpForLevel(level)
|
const current = getTotalExpForLevel(level)
|
||||||
|
|||||||
@@ -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 { getAllDivisions, getMostPlayed } from "@/lib/hypixel/duels/duels"
|
import { getAllDivisions, getMostPlayed } from "@/lib/hypixel/duels/duels"
|
||||||
import { 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"
|
||||||
import DuelsGeneralStats from "./stats"
|
import DuelsGeneralStats from "./stats"
|
||||||
@@ -12,8 +12,8 @@ import DuelsStatsTable from "./table"
|
|||||||
export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] }) {
|
export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] }) {
|
||||||
if (!stats) return null
|
if (!stats) return null
|
||||||
|
|
||||||
const wl = stats.wins / stats.losses
|
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||||
const kd = stats.kills / stats.deaths
|
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||||
const div = getAllDivisions(stats)
|
const div = getAllDivisions(stats)
|
||||||
const mostPlayed = getMostPlayed(stats)
|
const mostPlayed = getMostPlayed(stats)
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] })
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: <p>WL</p>,
|
title: <p>WL</p>,
|
||||||
stat: <p className="text-muted-foreground">{formatNumber(wl)}</p>
|
stat: <p className="text-muted-foreground">{wl}</p>
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { cn } from "@/lib/utils"
|
|||||||
import { BasicStat } from "../../_components/Stats"
|
import { BasicStat } from "../../_components/Stats"
|
||||||
|
|
||||||
export default function DuelsGeneralStats(
|
export default function DuelsGeneralStats(
|
||||||
{ statsChecked, div, kd, wl }: { statsChecked: NonNullStats["Duels"], div: Div | null, kd: number, wl: number }
|
{ statsChecked, div, kd, wl }: { statsChecked: NonNullStats["Duels"], div: Div | null, kd: string, wl: string }
|
||||||
) {
|
) {
|
||||||
const stats = statsChecked!
|
const stats = statsChecked!
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ export default function DuelsGeneralStats(
|
|||||||
</p>
|
</p>
|
||||||
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
|
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
|
||||||
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
|
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
|
||||||
<BasicStat title="Kill/Death Ratio: " value={formatNumber(kd)} />
|
<BasicStat title="Kill/Death Ratio: " value={kd} />
|
||||||
<p>
|
<p>
|
||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
@@ -46,7 +46,7 @@ export default function DuelsGeneralStats(
|
|||||||
</p>
|
</p>
|
||||||
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
|
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
|
||||||
<BasicStat title="Losses: " value={formatNumber(stats.losses)} />
|
<BasicStat title="Losses: " value={formatNumber(stats.losses)} />
|
||||||
<BasicStat title="Win/Loss Ratio: " value={formatNumber(wl)} />
|
<BasicStat title="Win/Loss Ratio: " value={wl} />
|
||||||
<p>
|
<p>
|
||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -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 { getProgress } from "@/lib/hypixel/general"
|
import { devide, getProgress } from "@/lib/hypixel/general"
|
||||||
import { getSkywarsLevel, getSkywarsXpForLevel } from "@/lib/hypixel/skywars/level"
|
import { getSkywarsLevel, getSkywarsXpForLevel } from "@/lib/hypixel/skywars/level"
|
||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
import CollapsedStats from "../../_components/CollapsedStats"
|
import CollapsedStats from "../../_components/CollapsedStats"
|
||||||
@@ -16,8 +16,8 @@ export default function SkyWarsStats(
|
|||||||
if (!stats) return null
|
if (!stats) return null
|
||||||
|
|
||||||
const level = getSkywarsLevel(stats.skywars_experience)
|
const level = getSkywarsLevel(stats.skywars_experience)
|
||||||
const kd = formatNumber(stats.kills / stats.deaths)
|
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||||
const wl = formatNumber(stats.wins / stats.losses)
|
const wl = formatNumber(devide(stats.wins, stats.losses))
|
||||||
|
|
||||||
const current = getSkywarsXpForLevel(Math.floor(level))
|
const current = getSkywarsXpForLevel(Math.floor(level))
|
||||||
const next = getSkywarsXpForLevel(Math.floor(level + 1))
|
const next = getSkywarsXpForLevel(Math.floor(level + 1))
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { formatNumber } from "@/lib/formatters"
|
import { formatNumber } from "@/lib/formatters"
|
||||||
|
import { devide } from "@/lib/hypixel/general"
|
||||||
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 { SkywarsPrestige } from "./components"
|
import { SkywarsPrestige } from "./components"
|
||||||
@@ -46,7 +47,7 @@ export default function SkyWarsGeneralStats({
|
|||||||
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
|
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
|
||||||
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
|
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
|
||||||
<BasicStat title="Assists: " value={formatNumber(stats.assists)} />
|
<BasicStat title="Assists: " value={formatNumber(stats.assists)} />
|
||||||
<BasicStat title="Kill/Death Ratio: " value={formatNumber(stats.kills / stats.deaths)} />
|
<BasicStat title="Kill/Death Ratio: " value={formatNumber(devide(stats.kills, stats.deaths))} />
|
||||||
<p>
|
<p>
|
||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
@@ -64,8 +65,8 @@ export default function SkyWarsGeneralStats({
|
|||||||
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
|
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
|
||||||
<BasicStat title="Lab Wins: " value={formatNumber(stats.wins_lab)} />
|
<BasicStat title="Lab Wins: " value={formatNumber(stats.wins_lab)} />
|
||||||
<BasicStat title="Losses: " value={formatNumber(stats.losses)} />
|
<BasicStat title="Losses: " value={formatNumber(stats.losses)} />
|
||||||
<BasicStat title="Win/Loss Ratio: " value={formatNumber(stats.wins / stats.losses)} />
|
<BasicStat title="Win/Loss Ratio: " value={formatNumber(devide(stats.wins, stats.losses))} />
|
||||||
<BasicStat title="Kill/Win Ratio: " value={formatNumber(stats.kills / stats.wins)} />
|
<BasicStat title="Kill/Win Ratio: " value={formatNumber(devide(stats.kills, stats.wins))} />
|
||||||
<p>
|
<p>
|
||||||
<br />
|
<br />
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user