Added all modes
This commit is contained in:
@@ -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>>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user