Added all modes

This commit is contained in:
2025-09-02 12:25:49 +02:00
parent c6147f1a5f
commit 16b200bc7d
4 changed files with 245 additions and 32 deletions

View File

@@ -8,9 +8,12 @@ export default function DuelsStatTable({ stats }: { stats: NonNullStats["Duels"]
<Table>
<DuelsTableHeader />
<TableBody>
<Bedwars1v1Stats stats={stats} />
<Bedwars1v1RushStats stats={stats} />
<UHC1v1Stats stats={stats} />
<UHC2v2Stats stats={stats} />
<UHC4v4Stats stats={stats} />
<UHCMeetupStats stats={stats} />
<OP1v1Stats stats={stats} />
<OP2v2Stats stats={stats} />
<SkyWars1v1Stats stats={stats} />
@@ -20,14 +23,22 @@ export default function DuelsStatTable({ stats }: { stats: NonNullStats["Duels"]
<MegaWalls1v1Stats stats={stats} />
<MegaWalls2v2Stats stats={stats} />
<Sumo1v1Stats stats={stats} />
<BowSpleef1v1Stats stats={stats} />
<ParkourFFAStats stats={stats} />
<Boxing1v1Stats stats={stats} />
<Classic1v1Stats stats={stats} />
<Classic2v2Stats stats={stats} />
<Potion1v1Stats stats={stats} />
<Combo1v1Stats stats={stats} />
<Quake1v1Stats stats={stats} />
<Spleef1v1Stats stats={stats} />
<Bridge1v1Stats stats={stats} />
<Bridge2v2Stats stats={stats} />
<Bridge3v3Stats stats={stats} />
<Bridge4v4Stats stats={stats} />
<Bridge2v2v2v2Stats stats={stats} />
<Bridge3v3v3v3Stats stats={stats} />
<DuelArenaStats stats={stats} />
</TableBody>
</Table>
)
@@ -61,6 +72,40 @@ function DuelsTableHeader() {
)
}
function Bedwars1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("bedwars_two_one_duels", stats)
const title = getModeTitle("bedwars_two_one_duels")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Bedwars1v1RushStats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("bedwars_two_one_duels_rush", stats)
const title = getModeTitle("bedwars_two_one_duels_rush")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function UHC1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
@@ -112,6 +157,23 @@ function UHC4v4Stats({ stats }: { stats: NonNullStats["Duels"] }) {
)
}
function UHCMeetupStats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("uhc_meetup", stats)
const title = getModeTitle("uhc_meetup")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function OP1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
@@ -265,6 +327,23 @@ function Sumo1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
)
}
function BowSpleef1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("bowspleef_duel", stats)
const title = getModeTitle("bowspleef_duel")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function ParkourFFAStats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
@@ -316,6 +395,57 @@ function Classic1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
)
}
function Classic2v2Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("classic_doubles", stats)
const title = getModeTitle("classic_doubles")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Potion1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("potion_duel", stats)
const title = getModeTitle("potion_duel")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Combo1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("combo_duel", stats)
const title = getModeTitle("combo_duel")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Bridge1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
@@ -350,6 +480,23 @@ function Bridge2v2Stats({ stats }: { stats: NonNullStats["Duels"] }) {
)
}
function Bridge3v3Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("bridge_threes", stats)
const title = getModeTitle("bridge_threes")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Bridge4v4Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
@@ -400,3 +547,54 @@ function Bridge3v3v3v3Stats({ stats }: { stats: NonNullStats["Duels"] }) {
</TableRow>
)
}
function DuelArenaStats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("duel_arena", stats)
const title = getModeTitle("duel_arena")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Quake1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("quake_duel", stats)
const title = getModeTitle("quake_duel")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}
function Spleef1v1Stats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
const modeStats = getDuelsModeStats("spleef_duel", stats)
const title = getModeTitle("spleef_duel")
return (
<TableRow>
<TableCell>{title}</TableCell>
<TableCell>I</TableCell>
{modeStats.map((v, i) => {
return <TableCell key={i}>{typeof v === "number" ? formatNumber(v) : v}</TableCell>
})}
</TableRow>
)
}

View File

@@ -27,9 +27,11 @@ export const MODES = [
{ id: "mw_doubles", divisionId: "mega_walls", name: "MegaWalls Doubles" },
{ id: "sumo_duel", divisionId: "sumo", name: "Sumo 1v1" },
{ id: "bowspleef_duel", divisionId: "tnt_games", name: "Bow Spleef 1v1" },
{ id: "spleef_duel", divisionId: "", name: "Spleef 1v1" },
{ id: "parkour_eight", divisionId: "parkour", name: "Parkour FFA" },
{ id: "boxing_duel", divisionId: "boxing", name: "Boxing 1v1" },
{ id: "classic_duel", divisionId: "classic", name: "Classic 1v1" },
{ id: "classic_doubles", divisionId: "classic", name: "Classic 2v2" },
{ id: "potion_duel", divisionId: "no_debuff", name: "NoDebuff 1v1" },
{ id: "combo_duel", divisionId: "combo", name: "Combo 1v1" },
{ id: "bridge_duel", divisionId: "bridge", name: "Bridge 1v1" },
@@ -38,6 +40,8 @@ export const MODES = [
{ id: "bridge_four", divisionId: "bridge", name: "Bridge 4v4" },
{ id: "bridge_2v2v2v2", divisionId: "bridge", name: "Bridge 2v2v2v2" },
{ id: "bridge_3v3v3v3", divisionId: "bridge", name: "Bridge 3v3v3v3" },
{ id: "capture_threes", divisionId: "bridge", name: "Bridge CTF 3v3" },
{ id: "duel_arena", divisionId: "", name: "Duel Arena" }
{ id: "duel_arena", divisionId: "", name: "Duel Arena" },
{ id: "quake_duel", divisionId: "quake", name: "Quakecraft 1v1" },
{ id: "bedwars_two_one_duels", divisionId: "bedwars", name: "Bedwars 1v1" },
{ id: "bedwars_two_one_duels_rush", divisionId: "bedwars", name: "Bedwars Rush 1v1" }
] as const

View File

@@ -74,8 +74,8 @@ export function getDuelsModeStats(mode: Mode, stats: NonNullable<NonNullStats["D
function duelsModeStats(index: typeof MODES[number]["id"], stats: NonNullable<NonNullStats["Duels"]>) {
if (index.startsWith("bridge_")) {
const kills = (stats[`${index}_kills`] === undefined ? 0 : stats[`${index}_kills`]) + (stats[`${index}_bridge_kills`] as number)
const deaths = (stats[`${index}_deaths`] === undefined ? 0 : stats[`${index}_deaths`]) + (stats[`${index}_bridge_deaths`] as number)
const kills = (stats[`${index}_kills`] as number) + (stats[`${index}_bridge_kills`] as number)
const deaths = (stats[`${index}_deaths`] as number) + (stats[`${index}_bridge_deaths`] as number)
return [
kills,

View File

@@ -183,26 +183,37 @@ function duelsModeStats() {
"mw_doubles",
"sumo_duel",
"bowspleef_duel",
"spleef_duel",
"parkour_eight",
"boxing_duel",
"classic_duel",
"classic_doubles",
"potion_duel",
"combo_duel",
"duel_arena",
"quake_duel",
"bedwars_two_one_duels",
"bedwars_two_one_duels_rush"
] as const
const bridgeIds = [
"bridge_duel",
"bridge_doubles",
"bridge_threes",
"bridge_four",
"bridge_2v2v2v2",
"bridge_3v3v3v3",
"capture_threes",
"duel_arena"
"bridge_3v3v3v3"
] as const
const bridgeStats = [
"bridge_kills",
"bridge_deaths",
"goals"
] as const
const stats = [
"kills",
"bridge_kills",
"deaths",
"bridge_deaths",
"wins",
"losses",
"melee_swings",
@@ -210,8 +221,7 @@ function duelsModeStats() {
"bow_shots",
"bow_hits",
"current_winstreak_mode",
"best_winstreak_mode",
"goals"
"best_winstreak_mode"
] as const
const entries = new Map<string, z.ZodDefault<z.ZodNumber>>()
@@ -221,21 +231,6 @@ function duelsModeStats() {
for (const id of ids) {
for (const stat of stats) {
if (id.startsWith("bridge_")) {
if (stat === "goals") {
bridge.set(`${id}_${stat}`, z.number().default(0))
}
if (stat === "bridge_kills") {
bridge.set(`${id}_${stat}`, z.number().default(0))
}
if (stat === "bridge_deaths") {
bridge.set(`${id}_${stat}`, z.number().default(0))
}
continue
}
if (stat === "current_winstreak_mode") {
ws.set(`${stat}_${id}`, z.number().optional())
} else if (stat === "best_winstreak_mode") {
@@ -246,15 +241,31 @@ function duelsModeStats() {
}
}
const combined = [...stats, ...bridgeStats]
for (const id of bridgeIds) {
for (const stat of combined) {
if (stat === "bridge_kills" || stat === "bridge_deaths" || stat === "goals") {
bridge.set(`${id}_${stat}`, z.number().default(0))
} else if (stat === "best_winstreak_mode") {
ws.set(`${stat}_${id}`, z.number().optional())
} else if (stat === "current_winstreak_mode") {
ws.set(`${stat}_${id}`, z.number().optional())
} else {
entries.set(`${id}_${stat}`, z.number().default(0))
}
}
}
type Modes = typeof ids[number]
type Stats = Exclude<typeof stats[number], "current_winstreak_mode" | "best_winstreak_mode" | "goals" | "bridge_kills" | "bridge_deaths">
type BridgeModes = Extract<Modes, "bridge_duel" | "bridge_doubles" | "bridge_threes" | "bridge_four" | "bridge_2v2v2v2" | "bridge_3v3v3v3">
type BridgeModes = typeof bridgeIds[number]
type Stats = Exclude<typeof stats[number], "current_winstreak_mode" | "best_winstreak_mode">
type BridgeStats = typeof bridgeStats[number]
return {
all: Object.fromEntries(entries) as Record<`${Modes}_${Stats}`, z.ZodDefault<z.ZodNumber>>,
ws: Object.fromEntries(ws) as Record<`current_winstreak_mode_${Modes}`, z.ZodOptional<z.ZodNumber>>,
bestWs: Object.fromEntries(bestWs) as Record<`best_winstreak_mode_${Modes}`, z.ZodOptional<z.ZodNumber>>,
bridge: Object.fromEntries(bridge) as Record<`${BridgeModes}_goals`, z.ZodDefault<z.ZodNumber>>
all: Object.fromEntries(entries) as Record<`${Modes | BridgeModes}_${Stats}`, z.ZodDefault<z.ZodNumber>>,
ws: Object.fromEntries(ws) as Record<`current_winstreak_mode_${Modes | BridgeModes}`, z.ZodOptional<z.ZodNumber>>,
bestWs: Object.fromEntries(bestWs) as Record<`best_winstreak_mode_${Modes | BridgeModes}`, z.ZodOptional<z.ZodNumber>>,
bridge: Object.fromEntries(bridge) as Record<`${BridgeModes}_${BridgeStats}`, z.ZodDefault<z.ZodNumber>>
}
}