Added all table stats
This commit is contained in:
@@ -73,6 +73,25 @@ export function getDuelsModeStats(mode: Mode, stats: NonNullable<NonNullStats["D
|
|||||||
}
|
}
|
||||||
|
|
||||||
function duelsModeStats(index: typeof MODES[number]["id"], stats: NonNullable<NonNullStats["Duels"]>) {
|
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)
|
||||||
|
|
||||||
|
return [
|
||||||
|
kills,
|
||||||
|
deaths,
|
||||||
|
formatNumber(devide(kills, deaths)),
|
||||||
|
stats[`${index}_wins`],
|
||||||
|
stats[`${index}_losses`],
|
||||||
|
formatNumber(devide(stats[`${index}_wins`], stats[`${index}_losses`])),
|
||||||
|
stats[`current_winstreak_mode_${index}`] ?? "?",
|
||||||
|
stats[`best_winstreak_mode_${index}`] ?? "?",
|
||||||
|
formatNumber(devide(stats[`${index}_melee_hits`], stats[`${index}_melee_swings`])),
|
||||||
|
formatNumber(devide(stats[`${index}_bow_hits`], stats[`${index}_bow_shots`])),
|
||||||
|
formatNumber(stats[`${index}_goals`] as number)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
stats[`${index}_kills`],
|
stats[`${index}_kills`],
|
||||||
stats[`${index}_deaths`],
|
stats[`${index}_deaths`],
|
||||||
@@ -83,6 +102,7 @@ function duelsModeStats(index: typeof MODES[number]["id"], stats: NonNullable<No
|
|||||||
stats[`current_winstreak_mode_${index}`] ?? "?",
|
stats[`current_winstreak_mode_${index}`] ?? "?",
|
||||||
stats[`best_winstreak_mode_${index}`] ?? "?",
|
stats[`best_winstreak_mode_${index}`] ?? "?",
|
||||||
formatNumber(devide(stats[`${index}_melee_hits`], stats[`${index}_melee_swings`])),
|
formatNumber(devide(stats[`${index}_melee_hits`], stats[`${index}_melee_swings`])),
|
||||||
formatNumber(devide(stats[`${index}_bow_hits`], stats[`${index}_bow_shots`]))
|
formatNumber(devide(stats[`${index}_bow_hits`], stats[`${index}_bow_shots`])),
|
||||||
|
"?"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,9 @@ function duelsModeStats() {
|
|||||||
|
|
||||||
const stats = [
|
const stats = [
|
||||||
"kills",
|
"kills",
|
||||||
|
"bridge_kills",
|
||||||
"deaths",
|
"deaths",
|
||||||
|
"bridge_deaths",
|
||||||
"wins",
|
"wins",
|
||||||
"losses",
|
"losses",
|
||||||
"melee_swings",
|
"melee_swings",
|
||||||
@@ -219,8 +221,18 @@ function duelsModeStats() {
|
|||||||
|
|
||||||
for (const id of ids) {
|
for (const id of ids) {
|
||||||
for (const stat of stats) {
|
for (const stat of stats) {
|
||||||
if (id.startsWith("bridge_") && stat === "goals") {
|
if (id.startsWith("bridge_")) {
|
||||||
bridge.set(`${id}_${stat}`, z.number().default(0))
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +247,7 @@ function duelsModeStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Modes = typeof ids[number]
|
type Modes = typeof ids[number]
|
||||||
type Stats = Exclude<typeof stats[number], "current_winstreak_mode" | "best_winstreak_mode" | "goals">
|
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 = Extract<Modes, "bridge_duel" | "bridge_doubles" | "bridge_threes" | "bridge_four" | "bridge_2v2v2v2" | "bridge_3v3v3v3">
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user