tr]:last:border-b-0",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
+ return (
+
+ )
+}
+
+function TableHead({ className, ...props }: React.ComponentProps<"th">) {
+ return (
+ [role=checkbox]]:translate-y-[2px]",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function TableCell({ className, ...props }: React.ComponentProps<"td">) {
+ return (
+ | [role=checkbox]]:translate-y-[2px]",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function TableCaption({
+ className,
+ ...props
+}: React.ComponentProps<"caption">) {
+ return (
+
+ )
+}
+
+export {
+ Table,
+ TableHeader,
+ TableBody,
+ TableFooter,
+ TableHead,
+ TableRow,
+ TableCell,
+ TableCaption,
+}
diff --git a/src/lib/hypixel/api/player.ts b/src/lib/hypixel/api/player.ts
index 36b5abf..590c9b3 100644
--- a/src/lib/hypixel/api/player.ts
+++ b/src/lib/hypixel/api/player.ts
@@ -18,4 +18,3 @@ export async function getPlayer(uuid: string) {
return data.player
}
-
diff --git a/src/lib/hypixel/bedwars.ts b/src/lib/hypixel/bedwars.ts
index 5adda71..8e31242 100644
--- a/src/lib/hypixel/bedwars.ts
+++ b/src/lib/hypixel/bedwars.ts
@@ -60,3 +60,36 @@ export function getLatestRoom(rooms?: Record) {
return latestRoom
}
+
+export type _BedwarsStats = Record & { [key: `${string}_winstreak`]: number | undefined }
+
+export function getBedwarsModeStats(mode: "solo" | "doubles" | "3s" | "4s", stats: _BedwarsStats) {
+ switch (mode) {
+ case "solo":
+ return bedwarsModeStats("eight_one", stats)
+ case "doubles":
+ return bedwarsModeStats("eight_two", stats)
+ case "3s":
+ return bedwarsModeStats("four_three", stats)
+ case "4s":
+ return bedwarsModeStats("four_four", stats)
+ }
+}
+
+function bedwarsModeStats(prefix: string, stats: _BedwarsStats) {
+ return [
+ stats[`${prefix}_kills_bedwars`],
+ stats[`${prefix}_deaths_bedwars`],
+ (stats[`${prefix}_kills_bedwars`] / stats[`${prefix}_deaths_bedwars`]).toFixed(2),
+ stats[`${prefix}_final_kills_bedwars`],
+ stats[`${prefix}_final_deaths_bedwars`],
+ (stats[`${prefix}_final_kills_bedwars`] / stats[`${prefix}_final_deaths_bedwars`]).toFixed(2),
+ stats[`${prefix}_wins_bedwars`],
+ stats[`${prefix}_losses_bedwars`],
+ (stats[`${prefix}_wins_bedwars`] / stats[`${prefix}_losses_bedwars`]).toFixed(2),
+ stats[`${prefix}_winstreak`] ?? "?",
+ stats[`${prefix}_beds_broken_bedwars`],
+ stats[`${prefix}_beds_lost_bedwars`],
+ (stats[`${prefix}_beds_broken_bedwars`] / stats[`${prefix}_beds_lost_bedwars`]).toFixed(2)
+ ]
+}
diff --git a/src/lib/hypixel/validatePlayer.ts b/src/lib/hypixel/validatePlayer.ts
index 91b70cd..766cd3c 100644
--- a/src/lib/hypixel/validatePlayer.ts
+++ b/src/lib/hypixel/validatePlayer.ts
@@ -9,7 +9,7 @@ export async function validatePlayer(ign: string) {
if (!uuid) {
return {
error: true,
- message: "Player not found",
+ message: "Player not found"
}
}
@@ -18,12 +18,13 @@ export async function validatePlayer(ign: string) {
if (!player) {
return {
error: true,
- message: "Player never logged on to Hypixel",
+ message: "Player never logged on to Hypixel"
}
}
return {
error: false,
- message: "Player found",
+ message: "Player found"
}
-}
\ No newline at end of file
+}
+
diff --git a/src/lib/schema/player.ts b/src/lib/schema/player.ts
index 02ad2c3..25fa969 100644
--- a/src/lib/schema/player.ts
+++ b/src/lib/schema/player.ts
@@ -36,7 +36,43 @@ export const playerSchema = z.looseObject({
total_tickets_earned: z.number(),
doublers: z.number(),
room: z.record(z.string(), z.boolean())
- }).optional()
+ }).optional(),
+ eight_one_winstreak: z.number().optional(),
+ eight_one_kills_bedwars: z.number().default(0),
+ eight_one_deaths_bedwars: z.number().default(0),
+ eight_one_final_kills_bedwars: z.number().default(0),
+ eight_one_final_deaths_bedwars: z.number().default(0),
+ eight_one_wins_bedwars: z.number().default(0),
+ eight_one_losses_bedwars: z.number().default(0),
+ eight_one_beds_broken_bedwars: z.number().default(0),
+ eight_one_beds_lost_bedwars: z.number().default(0),
+ eight_two_winstreak: z.number().optional(),
+ eight_two_kills_bedwars: z.number().default(0),
+ eight_two_deaths_bedwars: z.number().default(0),
+ eight_two_final_kills_bedwars: z.number().default(0),
+ eight_two_final_deaths_bedwars: z.number().default(0),
+ eight_two_wins_bedwars: z.number().default(0),
+ eight_two_losses_bedwars: z.number().default(0),
+ eight_two_beds_broken_bedwars: z.number().default(0),
+ eight_two_beds_lost_bedwars: z.number().default(0),
+ four_three_winstreak: z.number().optional(),
+ four_three_kills_bedwars: z.number().default(0),
+ four_three_deaths_bedwars: z.number().default(0),
+ four_three_final_kills_bedwars: z.number().default(0),
+ four_three_final_deaths_bedwars: z.number().default(0),
+ four_three_wins_bedwars: z.number().default(0),
+ four_three_losses_bedwars: z.number().default(0),
+ four_three_beds_broken_bedwars: z.number().default(0),
+ four_three_beds_lost_bedwars: z.number().default(0),
+ four_four_winstreak: z.number().optional(),
+ four_four_kills_bedwars: z.number().default(0),
+ four_four_deaths_bedwars: z.number().default(0),
+ four_four_final_kills_bedwars: z.number().default(0),
+ four_four_final_deaths_bedwars: z.number().default(0),
+ four_four_wins_bedwars: z.number().default(0),
+ four_four_losses_bedwars: z.number().default(0),
+ four_four_beds_broken_bedwars: z.number().default(0),
+ four_four_beds_lost_bedwars: z.number().default(0)
}).optional()
}),
quests: z.record(
diff --git a/đ b/đ
deleted file mode 100644
index 2e497e3..0000000
--- a/đ
+++ /dev/null
@@ -1,50 +0,0 @@
-import { PRESTIGE_ICONS, PRESTIGES, SLUMBER_WALLETS } from "@/data/hypixel/bedwars"
-import { floorLevel } from "./formatters"
-
-export function getBedwarsStar(level: number) {
- if (level < 1100) {
- return PRESTIGE_ICONS[0].symbol
- }
-
- if (level > 1100 && level < 2100) {
- return PRESTIGE_ICONS[1].symbol
- }
-
- if (level > 2100 && level < 3100) {
- return PRESTIGE_ICONS[2].symbol
- }
-
- return PRESTIGE_ICONS[3].symbol
-}
-
-export function getTextColor(level: number) {
- const floored = floorLevel(level, 100)
-
- if (level > 5000) {
- return PRESTIGES[PRESTIGES.length - 1].color
- }
-
- return PRESTIGES.find(l => l.level === floored)!.color
-}
-
-export function getPrestigeName(level: number) {
- const floored = floorLevel(level, 100)
-
- if (level > 5000) {
- return PRESTIGES[PRESTIGES.length - 1].name
- }
-
- return PRESTIGES.find(p => p.level === floored)!.name
-}
-
-export function getWalletMax(name?: string) {
- if (!name) return 25
-
- const wallets = SLUMBER_WALLETS as Record
-
- if (!wallets[name]) return 25
-
- return wallets[name]
-}
-
-export function getLatesRoom(rooms: Record)
diff --git a/ž b/ž
deleted file mode 100644
index 91a5c7f..0000000
--- a/ž
+++ /dev/null
@@ -1,52 +0,0 @@
-import { PRESTIGE_ICONS, PRESTIGES, SLUMBER_WALLETS } from "@/data/hypixel/bedwars"
-import { floorLevel } from "./formatters"
-
-export function getBedwarsStar(level: number) {
- if (level < 1100) {
- return PRESTIGE_ICONS[0].symbol
- }
-
- if (level > 1100 && level < 2100) {
- return PRESTIGE_ICONS[1].symbol
- }
-
- if (level > 2100 && level < 3100) {
- return PRESTIGE_ICONS[2].symbol
- }
-
- return PRESTIGE_ICONS[3].symbol
-}
-
-export function getTextColor(level: number) {
- const floored = floorLevel(level, 100)
-
- if (level > 5000) {
- return PRESTIGES[PRESTIGES.length - 1].color
- }
-
- return PRESTIGES.find(l => l.level === floored)!.color
-}
-
-export function getPrestigeName(level: number) {
- const floored = floorLevel(level, 100)
-
- if (level > 5000) {
- return PRESTIGES[PRESTIGES.length - 1].name
- }
-
- return PRESTIGES.find(p => p.level === floored)!.name
-}
-
-export function getWalletMax(name?: string) {
- if (!name) return 25
-
- const wallets = SLUMBER_WALLETS as Record
-
- if (!wallets[name]) return 25
-
- return wallets[name]
-}
-
-export function getLatesRoom(rooms?: Record) {
- if (!rooms) return null
-}
|