From 28a63b43b097cb132bddef9a6727cb960905f9ae Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 17 Sep 2025 23:01:22 +0200 Subject: [PATCH] Refactor schema --- src/lib/schema/player.ts | 30 +- src/lib/schema/stats.ts | 1093 ------------------------ src/lib/schema/stats/arcade.ts | 170 ++++ src/lib/schema/stats/bedwars.ts | 86 ++ src/lib/schema/stats/blitz.ts | 90 ++ src/lib/schema/stats/build-battle.ts | 20 + src/lib/schema/stats/copsandcrims.ts | 65 ++ src/lib/schema/stats/duels.ts | 165 ++++ src/lib/schema/stats/megawalls.ts | 107 +++ src/lib/schema/stats/murder-mystery.ts | 56 ++ src/lib/schema/stats/pit.ts | 57 ++ src/lib/schema/stats/skywars.ts | 85 ++ src/lib/schema/stats/speeduhc.ts | 45 + src/lib/schema/stats/tnt-games.ts | 51 ++ src/lib/schema/stats/uhc.ts | 42 + src/lib/schema/stats/woolgames.ts | 67 ++ 16 files changed, 1120 insertions(+), 1109 deletions(-) delete mode 100644 src/lib/schema/stats.ts create mode 100644 src/lib/schema/stats/arcade.ts create mode 100644 src/lib/schema/stats/bedwars.ts create mode 100644 src/lib/schema/stats/blitz.ts create mode 100644 src/lib/schema/stats/build-battle.ts create mode 100644 src/lib/schema/stats/copsandcrims.ts create mode 100644 src/lib/schema/stats/duels.ts create mode 100644 src/lib/schema/stats/megawalls.ts create mode 100644 src/lib/schema/stats/murder-mystery.ts create mode 100644 src/lib/schema/stats/pit.ts create mode 100644 src/lib/schema/stats/skywars.ts create mode 100644 src/lib/schema/stats/speeduhc.ts create mode 100644 src/lib/schema/stats/tnt-games.ts create mode 100644 src/lib/schema/stats/uhc.ts create mode 100644 src/lib/schema/stats/woolgames.ts diff --git a/src/lib/schema/player.ts b/src/lib/schema/player.ts index 9896c1f..76963dc 100644 --- a/src/lib/schema/player.ts +++ b/src/lib/schema/player.ts @@ -1,20 +1,18 @@ import z from "zod" -import { - arcadeStatsSchema, - bedwarsStatsSchema, - blitzStatsSchema, - buildBattleStatsSchema, - copsAndCrimsStatsSchema, - duelsStatsSchema, - megawallsStats, - murderMysteryStatsSchema, - pitStats, - skywarsStatsSchema, - speedUhcStatsSchema, - tntGamesStatsSchema, - uhcSchema, - woolGamesStatsSchema -} from "./stats" +import { arcadeStatsSchema } from "./stats/arcade" +import { bedwarsStatsSchema } from "./stats/bedwars" +import { blitzStatsSchema } from "./stats/blitz" +import { buildBattleStatsSchema } from "./stats/build-battle" +import { copsAndCrimsStatsSchema } from "./stats/copsandcrims" +import { duelsStatsSchema } from "./stats/duels" +import { megawallsStats } from "./stats/megawalls" +import { murderMysteryStatsSchema } from "./stats/murder-mystery" +import { pitStats } from "./stats/pit" +import { skywarsStatsSchema } from "./stats/skywars" +import { speedUhcStatsSchema } from "./stats/speeduhc" +import { tntGamesStatsSchema } from "./stats/tnt-games" +import { uhcSchema } from "./stats/uhc" +import { woolGamesStatsSchema } from "./stats/woolgames" export const playerSchema = z.looseObject({ player: z.looseObject({ diff --git a/src/lib/schema/stats.ts b/src/lib/schema/stats.ts deleted file mode 100644 index 4eefe2f..0000000 --- a/src/lib/schema/stats.ts +++ /dev/null @@ -1,1093 +0,0 @@ -import z from "zod" - -function bedwarsModeStats() { - const ids = [ - "eight_one", - "eight_two", - "four_three", - "four_four", - "two_four", - "eight_two_rush", - "four_four_rush", - "eight_two_ultimate", - "four_four_ultimate", - "eight_two_lucky", - "four_four_lucky", - "eight_two_voidless", - "four_four_voidless", - "eight_two_armed", - "four_four_armed", - "four_four_swap", - "four_four_underworld", - "castle" - ] as const - - const stats = [ - "winstreak", - "kills_bedwars", - "deaths_bedwars", - "final_kills_bedwars", - "final_deaths_bedwars", - "wins_bedwars", - "losses_bedwars", - "beds_broken_bedwars", - "beds_lost_bedwars" - ] as const - - const entries = new Map>() - const winstreak = new Map>() - - for (const id of ids) { - for (const stat of stats) { - if (stat === "winstreak") { - winstreak.set(`${id}_${stat}`, z.number().optional()) - } else { - entries.set(`${id}_${stat}`, z.number().default(0)) - } - } - } - - type Modes = typeof ids[number] - type Stats = Exclude - - return { - all: Object.fromEntries(entries) as Record<`${Modes}_${Stats}`, z.ZodDefault>, - winstreak: Object.fromEntries(winstreak) as Record<`${Modes}_winstreak`, z.ZodOptional> - } -} - -export const bedwarsStatsSchema = z.object({ - Experience: z.number().default(0), - coins: z.number().default(0), - winstreak: z.number().optional(), - kills_bedwars: z.number().default(0), - deaths_bedwars: z.number().default(0), - final_kills_bedwars: z.number().default(0), - final_deaths_bedwars: z.number().default(0), - wins_bedwars: z.number().default(0), - losses_bedwars: z.number().default(0), - beds_broken_bedwars: z.number().default(0), - beds_lost_bedwars: z.number().default(0), - total_challenges_completed: z.number().default(0), - iron_resources_collected_bedwars: z.number().default(0), - gold_resources_collected_bedwars: z.number().default(0), - diamond_resources_collected_bedwars: z.number().default(0), - emerald_resources_collected_bedwars: z.number().default(0), - _items_purchased_bedwars: z.number().default(0), - slumber: z.object({ - tickets: z.number().default(0), - bag_type: z.string().optional(), - total_tickets_earned: z.number().default(0), - doublers: z.number().default(0), - room: z.record(z.string(), z.boolean()).optional() - }).optional(), - ...bedwarsModeStats().all, - ...bedwarsModeStats().winstreak -}) - -function skywarsModeStats() { - const ids = [ - "solo_normal", - "solo_insane", - "team_normal", - "team_insane", - "mega", - "mega_doubles", - "ranked_normal" - ] as const - - const stats = [ - "kills", - "deaths", - "wins", - "losses" - ] as const - - const entries = new Map>() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> -} - -export const skywarsStatsSchema = z.object({ - skywars_experience: z.number().default(0), - selected_prestige_icon: z.string().optional(), - kills: z.number().default(0), - deaths: z.number().default(0), - assists: z.number().default(0), - wins: z.number().default(0), - losses: z.number().default(0), - cosmetic_tokens: z.number().default(0), - coins: z.number().default(0), - blocks_placed: z.number().default(0), - blocks_broken: z.number().default(0), - chests_opened: z.number().default(0), - arrows_hit: z.number().default(0), - arrows_shot: z.number().default(0), - melee_kills: z.number().default(0), - void_kills: z.number().default(0), - bow_kills: z.number().default(0), - mobs_kills: z.number().default(0), - enderpearls_thrown: z.number().default(0), - egg_thrown: z.number().default(0), - wins_lab: z.number().default(0), - heads: z.number().default(0), - angel_of_death_level: z.number().default(0), - angels_offering: z.number().default(0), - souls_gathered: z.number().default(0), - souls: z.number().default(0), - paid_souls: z.number().default(0), - soul_well: z.number().default(0), - packages: z.array(z.string()), - shard: z.number().default(0), - opals: z.number().default(0), - heads_eww: z.number().default(0), - heads_yucky: z.number().default(0), - heads_meh: z.number().default(0), - heads_decent: z.number().default(0), - heads_salty: z.number().default(0), - heads_tasty: z.number().default(0), - heads_succulent: z.number().default(0), - heads_sweet: z.number().default(0), - heads_divine: z.number().default(0), - heads_heavenly: z.number().default(0), - heads_ethereal: z.number().default(0), - heads_indescribable: z.number().default(0), - head_collection: z.object({ - prestigious: z.array(z.object({ - username: z.string().nullable().default(null), - timestamp: z.number(), - mode: z.string(), - sacrifice: z.string() - })) - }).optional(), - ...skywarsModeStats() -}) - -function duelsModeStats() { - const ids = [ - "uhc_duel", - "uhc_doubles", - "uhc_four", - "uhc_meetup", - "op_duel", - "op_doubles", - "sw_duel", - "sw_doubles", - "bow_duel", - "blitz_duel", - "mw_duel", - "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" - ] as const - - const bridgeStats = [ - "bridge_kills", - "bridge_deaths", - "goals" - ] as const - - const stats = [ - "kills", - "deaths", - "wins", - "losses", - "melee_swings", - "melee_hits", - "bow_shots", - "bow_hits", - "current_winstreak_mode", - "best_winstreak_mode" - ] as const - - const entries = new Map>() - const ws = new Map>() - const bestWs = new Map>() - const bridge = new Map>() - - for (const id of ids) { - for (const stat of stats) { - if (stat === "current_winstreak_mode") { - ws.set(`${stat}_${id}`, z.number().optional()) - } else if (stat === "best_winstreak_mode") { - bestWs.set(`${stat}_${id}`, z.number().optional()) - } else { - entries.set(`${id}_${stat}`, z.number().default(0)) - } - } - } - - 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 BridgeModes = typeof bridgeIds[number] - type Stats = Exclude - type BridgeStats = typeof bridgeStats[number] - - return { - all: Object.fromEntries(entries) as Record<`${Modes | BridgeModes}_${Stats}`, z.ZodDefault>, - ws: Object.fromEntries(ws) as Record<`current_winstreak_mode_${Modes | BridgeModes}`, z.ZodOptional>, - bestWs: Object.fromEntries(bestWs) as Record<`best_winstreak_mode_${Modes | BridgeModes}`, z.ZodOptional>, - bridge: Object.fromEntries(bridge) as Record<`${BridgeModes}_${BridgeStats}`, z.ZodDefault> - } -} - -function devisionTitles() { - const devisions = [ - "all_modes", - "uhc", - "op", - "skywars", - "bow", - "blitz", - "mega_walls", - "sumo", - "tnt_games", - "parkour", - "boxing", - "classic", - "no_debuff", - "combo", - "bridge" - ] as const - - const titles = [ - "rookie", - "iron", - "gold", - "diamond", - "master", - "legend", - "grandmaster", - "godlike", - "celestial", - "divine", - "ascended" - ] as const - const entries = new Map>() - - for (const div of devisions) { - for (const title of titles) { - entries.set(`${div}_${title}_title_prestige`, z.number().default(-1)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof devisions[number]}_${typeof titles[number]}_title_prestige`, z.ZodDefault> -} - -export const duelsStatsSchema = z.object({ - wins: z.number().default(0), - losses: z.number().default(0), - coins: z.number().default(0), - kills: z.number().default(0), - deaths: z.number().default(0), - melee_swings: z.number().default(0), - melee_hits: z.number().default(0), - bow_shots: z.number().default(0), - bow_hits: z.number().default(0), - current_winstreak: z.number().optional(), - best_overall_winstreak: z.number().optional(), - ...devisionTitles(), - ...duelsModeStats().all, - ...duelsModeStats().ws, - ...duelsModeStats().bestWs, - ...duelsModeStats().bridge -}) - -function murderMysteryModeStats() { - const ids = [ - "MURDER_CLASSIC", - "MURDER_ASSASSINS", - "MURDER_DOUBLE_UP", - "MURDER_HARDCORE", - "MURDER_SHOWDOWN" - ] as const - - const stats = [ - "kills", - "bow_kills", - "knife_kills", - "thrown_knife_kills", - "wins", - "games", - "coins_pickedup" - ] as const - - const entries = new Map>() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> -} - -export const murderMysteryStatsSchema = z.object({ - kills: z.number().default(0), - deaths: z.number().default(0), - wins: z.number().default(0), - losses: z.number().default(0), - coins: z.number().default(0), - games: z.number().default(0), - bow_kills: z.number().default(0), - knife_kills: z.number().default(0), - coins_pickedup: z.number().default(0), - kills_as_murderer: z.number().default(0), - thrown_knife_kills: z.number().default(0), - active_knife_skin: z.string().optional(), - quickest_detective_win_time_seconds: z.number().default(0), - quickest_murderer_win_time_seconds: z.number().default(0), - kills_as_infected_MURDER_INFECTION: z.number().default(0), - kills_as_survivor_MURDER_INFECTION: z.number().default(0), - kills_MURDER_INFECTION: z.number().default(0), - wins_MURDER_INFECTION: z.number().default(0), - games_MURDER_INFECTION: z.number().default(0), - total_time_survived_seconds_MURDER_INFECTION: z.number().default(0), - coins_pickedup_MURDER_INFECTION: z.number().default(0), - ...murderMysteryModeStats() -}) - -export const buildBattleStatsSchema = z.object({ - wins: z.number().default(0), - score: z.number().default(0), - coins: z.number().default(0), - games_played: z.number().default(0), - correct_guesses: z.number().default(0), - super_votes: z.number().default(0), - wins_solo_normal: z.number().default(0), - wins_teams_normal: z.number().default(0), - wins_guess_the_build: z.number().default(0), - wins_solo_pro: z.number().default(0), - wins_speed_builders: z.number().default(0), - wins_solo_normal_latest: z.number().default(0), - wins_teams_normal_latest: z.number().default(0), - wins_guess_the_build_latest: z.number().default(0), - wins_solo_pro_latest: z.number().default(0), - wins_speed_builders_latest: z.number().default(0) -}) - -function uhcModesStats() { - const ids = [ - "solo", - "red_vs_blue", - "no_diamonds", - "vanilla_doubles", - "brawl", - "solo_brawl", - "duo_brawl" - ] as const - - const stats = [ - "wins", - "kills", - "deaths", - "heads_eaten" - ] as const - - const entries = new Map>() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> -} - -export const uhcSchema = z.object({ - kills: z.number().default(0), - deaths: z.number().default(0), - wins: z.number().default(0), - heads_eaten: z.number().default(0), - score: z.number().default(0), - coins: z.number().default(0), - ultimates_crafted: z.number().default(0), - ultimates_crafted_solo: z.number().default(0), - ...uhcModesStats() -}) - -export const pitStats = z.object({ - pit_stats_ptl: z.object({ - kills: z.number().default(0), - deaths: z.number().default(0), - cash_earned: z.number().default(0), - playtime_minutes: z.number().default(0), - assists: z.number().default(0), - max_streak: z.number().default(0), - damage_dealt: z.number().default(0), - damage_received: z.number().default(0), - melee_damage_dealt: z.number().default(0), - melee_damage_received: z.number().default(0), - bow_damage_dealt: z.number().default(0), - bow_damage_received: z.number().default(0), - sword_hits: z.number().default(0), - left_clicks: z.number().default(0), - arrow_hits: z.number().default(0), - arrows_fired: z.number().default(0), - contracts_completed: z.number().default(0), - jumped_into_pit: z.number().default(0), - launched_by_launchers: z.number().default(0), - gapple_eaten: z.number().default(0), - ghead_eaten: z.number().default(0), - soups_drank: z.number().default(0), - rage_potatoes_eaten: z.number().default(0), - fishing_rod_launched: z.number().default(0), - lava_bucket_emptied: z.number().default(0), - diamond_items_purchased: z.number().default(0), - blocks_placed: z.number().default(0), - blocks_broken: z.number().default(0), - enchanted_tier1: z.number().default(0), - enchanted_tier2: z.number().default(0), - enchanted_tier3: z.number().default(0), - dark_pants_crated: z.number().default(0), - wheat_farmed: z.number().default(0), - fished_anything: z.number().default(0), - fishes_fished: z.number().default(0), - king_quest_completion: z.number().default(0), - sewer_treasures_found: z.number().default(0) - }), - profile: z.object({ - prestiges: z.array(z.object({ - index: z.number(), - xp_on_prestige: z.number(), - timestamp: z.number() - })).optional(), - xp: z.number().default(0), - cash: z.number().default(0), - renown: z.number().default(0) - }) -}).transform(({ profile, pit_stats_ptl, ...rest }) => ({ - profile, - ...pit_stats_ptl, - ...rest -})) - -function tntGamesModeStats() { - const ids = [ - "ancient", - "blood", - "fire", - "hydro", - "ice", - "kinetic", - "storm", - "toxic", - "wither" - ] as const - - const stats = [ - "kills", - "deaths", - "assists", - "explode", - "regen" - ] as const - - const entries = new Map>() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`new_${id}wizard_${stat}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`new_${typeof ids[number]}wizard_${typeof stats[number]}`, z.ZodDefault> -} - -export const tntGamesStatsSchema = z.object({ - wins: z.number().default(0), - coins: z.number().default(0), - kills_tntag: z.number().default(0), - wins_tntag: z.number().default(0), - wins_tntrun: z.number().default(0), - record_tntrun: z.number().default(0), - kills_pvprun: z.number().default(0), - wins_pvprun: z.number().default(0), - record_pvprun: z.number().default(0), - wins_bowspleef: z.number().default(0), - deaths_bowspleef: z.number().default(0), - wins_capture: z.number().default(0), - kills_capture: z.number().default(0), - deaths_capture: z.number().default(0), - ...tntGamesModeStats() -}) - -function megawallsClassStats() { - const ids = [ - "angel", - "arcanist", - "assassin", - "automaton", - "blaze", - "cow", - "creeper", - "dragon", - "dreadlord", - "enderman", - "golem", - "herobrine", - "hunter", - "moleman", - "phoenix", - "pigman", - "pirate", - "renegade", - "shaman", - "shark", - "sheep", - "skeleton", - "snowman", - "spider", - "squid", - "werewolf", - "zombie" - ] as const - - const stats = [ - "kills", - "deaths", - "final_kills", - "final_deaths", - "wins", - "losses" - ] as const - - const entries = new Map>() - const classes = new Map< - string, - z.ZodOptional, enderchest_rows: z.ZodDefault }>> - >() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`${id}_${stat}`, z.number().default(0)) - } - classes.set(id, z.object({ prestige: z.number().default(0), enderchest_rows: z.number().default(0) }).optional()) - } - - return { - classStats: Object.fromEntries(entries) as Record<`${typeof ids[number]}_${typeof stats[number]}`, z.ZodDefault>, - classOther: Object.fromEntries(classes) as Record< - `${typeof ids[number]}`, - z.ZodOptional, enderchest_rows: z.ZodDefault }>> - > - } -} - -function megawallsModeStats() { - const ids = [ - "standard", - "face_off", - "gvg" - ] as const - - const stats = [ - "kills", - "deaths", - "wins", - "losses" - ] as const - - const entries = new Map>() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> -} - -export const megawallsStats = z.object({ - kills: z.number().default(0), - assists: z.number().default(0), - deaths: z.number().default(0), - wins: z.number().default(0), - wins_practice: z.number().default(0), - losses: z.number().default(0), - losses_practice: z.number().default(0), - final_kills: z.number().default(0), - final_assists: z.number().default(0), - final_deaths: z.number().default(0), - coins: z.number().default(0), - wither_damage: z.number().default(0), - witherDamage: z.number().default(0), - classes: z.object(megawallsClassStats().classOther).optional(), - ...megawallsClassStats().classStats, - ...megawallsModeStats() -}) - -function copsAndCrimsGunUpgrades() { - const ids = [ - "knife", - "pistol", - "handgun", - "magnum", - "sniper", - "bullpup", - "smg", - "rifle", - "carbine", - "scoped_rifle", - "shotgun", - "auto_shotgun" - ] as const - - const upgrades = [ - "damage_increase", - "recoil_reduction", - "reload_speed_reduction", - "cost_reduction" - ] as const - - const entries = new Map>() - - for (const id of ids) { - for (const upgrade of upgrades) { - entries.set(`${id}_${upgrade}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof ids[number]}_${typeof upgrades[number]}`, z.ZodDefault> -} - -export const copsAndCrimsStatsSchema = z.object({ - kills: z.number().default(0), - assists: z.number().default(0), - deaths: z.number().default(0), - game_wins: z.number().default(0), - cop_kills: z.number().default(0), - criminal_kills: z.number().default(0), - kills_deathmatch: z.number().default(0), - assists_deathmatch: z.number().default(0), - deaths_deathmatch: z.number().default(0), - game_wins_deathmatch: z.number().default(0), - cop_kills_deathmatch: z.number().default(0), - criminal_kills_deathmatch: z.number().default(0), - kills_gungame: z.number().default(0), - assists_gungame: z.number().default(0), - deaths_gungame: z.number().default(0), - game_wins_gungame: z.number().default(0), - cop_kills_gungame: z.number().default(0), - criminal_kills_gungame: z.number().default(0), - bombs_planted: z.number().default(0), - bombs_defused: z.number().default(0), - shots_fired: z.number().default(0), - coins: z.number().default(0), - round_wins: z.number().default(0), - headshot_kills: z.number().default(0), - knife_attack_delay: z.number().default(0), - sniper_charge_bonus: z.number().default(0), - ...copsAndCrimsGunUpgrades() -}) - -const woolGamesClassStats = z.object({ - kills: z.number().default(0), - assists: z.number().default(0), - deaths: z.number().default(0), - wool_placed: z.number().default(0), - blocks_broken: z.number().default(0), - powerups_gotten: z.number().default(0) -}) - -export const woolGamesStatsSchema = z.object({ - wool_wars_prestige_icon: z.string().optional(), - playtime: z.number().default(0), - coins: z.number().default(0), - progression: z.object({ - experience: z.number().default(0), - available_layers: z.number().default(0) - }).optional(), - capture_the_wool: z.object({ - stats: z.object({ - kills: z.number().default(0), - assits: z.number().default(0), - deaths: z.number().default(0), - participated_wins: z.number().default(0), - participated_losses: z.number().default(0), - fastest_win: z.number().default(0), - longest_game: z.number().default(0), - wools_stolen: z.number().default(0), - wools_captured: z.number().default(0), - fastest_wool_capture: z.number().default(0), - gold_earned: z.number().default(0), - gold_spent: z.number().default(0) - }).optional() - }).optional(), - sheep_wars: z.object({ - stats: z.object({ - kills: z.number().default(0), - deaths: z.number().default(0), - wins: z.number().default(0), - losses: z.number().default(0), - sheep_thrown: z.number().default(0), - damage_dealt: z.number().default(0) - }).optional() - }).optional(), - wool_wars: z.object({ - selected_class: z.string().optional(), - stats: z.object({ - kills: z.number().default(0), - assits: z.number().default(0), - deaths: z.number().default(0), - wins: z.number().default(0), - losses: z.number().default(0), - wool_placed: z.number().default(0), - blocks_broken: z.number().default(0), - powerups_gotten: z.number().default(0), - classes: z.object({ - tank: woolGamesClassStats.optional(), - archer: woolGamesClassStats.optional(), - swordsman: woolGamesClassStats.optional(), - engineer: woolGamesClassStats.optional(), - golem: woolGamesClassStats.optional(), - assault: woolGamesClassStats.optional() - }).default({}) - }).optional() - }).optional() -}) - -function blitzKitPlayedStats() { - const ids = [ - "arachnologist", - "archer", - "armorer", - "astronaut", - "baker", - "blaze", - "creepertamer", - "diver", - "donkeytamer", - "farmer", - "fisherman", - "florist", - "golem", - "guardian", - "horsetamer", - "hunter", - "hype train", - "jockey", - "knight", - "meatmaster", - "milkman", - "necromancer", - "paladin", - "phoenix", - "pigman", - "ranger", - "reaper", - "reddragon", - "rogue", - "scout", - "shadow knight", - "shark", - "slimeyslime", - "snowman", - "speleologist", - "tim", - "toxicologist", - "troll", - "viking", - "warlock", - "warrior", - "wolftamer" - ] as const - - const stats = [ - "wins", - "wins_teams", - "time_played", - "exp", - "kills", - "games_played" - ] as const - - const entries = new Map>() - const kits = new Map>() - const prestiges = new Map>() - - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - kits.set(`${id}`, z.number().default(-1)) - prestiges.set(`p${id}`, z.number().default(0)) - } - } - - return { - stats: Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault>, - kits: Object.fromEntries(kits) as Record<`${typeof ids[number]}`, z.ZodDefault>, - prestiges: Object.fromEntries(prestiges) as Record<`p${typeof ids[number]}`, z.ZodDefault> - } -} - -export const blitzStatsSchema = z.object({ - kills: z.number().default(0), - deaths: z.number().default(0), - kills_solo_normal: z.number().default(0), - kills_teams_normal: z.number().default(0), - wins_solo_normal: z.number().default(0), - wins_teams_normal: z.number().default(0), - coins: z.number().default(0), - damage: z.number().default(0), - damage_taken: z.number().default(0), - ...blitzKitPlayedStats().stats, - ...blitzKitPlayedStats().kits, - ...blitzKitPlayedStats().prestiges -}) - -function arcadeModeWins() { - const ids = [ - "wins_dayone", - "wins_oneinthequiver", - "wins_dragonwars2", - "wins_easter_simulator", - "wins_ender", - "wins_farm_hunt", - "wins_soccer", - "sw_game_wins", - "wins_grinch_simulator_v2", - "wins_halloween_simulator", - "seeker_wins_hide_and_seek", - "hider_wins_hide_and_seek", - "wins_hole_in_the_wall", - "wins_simon_says", - "wins_party", - "wins_party_2", - "wins_party_3", - "wins_draw_their_thing", - "wins_scuba_simulator", - "wins_throw_out", - "wins_mini_walls", - "wins_zombies" - ] as const - - const entries = new Map>() - for (const id of ids) { - entries.set(`${id}`, z.number().default(0)) - } - return Object.fromEntries(entries) as Record<`${typeof ids[number]}`, z.ZodDefault> -} - -function arcadeZombiesModeStats() { - const ids = [ - "deadend", - "badblood", - "alienarcadium" - ] as const - - const stats = [ - "times_knocked_down_zombies", - "players_revived_zombies", - "doors_opened_zombies", - "windows_repaired_zombies", - "zombie_kills_zombies", - "deaths_zombies", - "best_round_zombies", - "wins_zombies" - ] as const - - const entries = new Map>() - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> -} - -function arcadeZombiesTypeStats() { - const ids = [ - "basic", - "blaze", - "empowered", - "ender", - "endermite", - "fire", - "guardian", - "magma", - "magma_cube", - "pig_zombie", - "skelefish", - "tnt_baby", - "tnt", - "inferno", - "broodmother", - "king_slime", - "wither", - "herobrine", - "mega_blob", - "mega_magma", - "world_ender" - ] as const - - const entries = new Map>() - for (const id of ids) { - entries.set(`${id}_zombie_kills_zombies`, z.number().default(0)) - } - - return Object.fromEntries(entries) as Record<`${typeof ids[number]}_zombie_kills_zombies`, z.ZodDefault> -} - -export const arcadeStatsSchema = z.object({ - miniwalls_activeKit: z.string().optional(), - wither_kills_mini_walls: z.number().default(0), - kills_mini_walls: z.number().default(0), - final_kills_mini_walls: z.number().default(0), - deaths_mini_walls: z.number().default(0), - arrows_hit_mini_walls: z.number().default(0), - arrows_shot_mini_walls: z.number().default(0), - total_rounds_survived_zombies: z.number().default(0), - best_round_zombies: z.number().default(0), - zombie_kills_zombies: z.number().default(0), - bullets_hit_zombies: z.number().default(0), - bullets_shot_zombies: z.number().default(0), - headshots_zombies: z.number().default(0), - players_revived_zombies: z.number().default(0), - times_knocked_down_zombies: z.number().default(0), - doors_opened_zombies: z.number().default(0), - windows_repaired_zombies: z.number().default(0), - kills_dayone: z.number().default(0), - headshots_dayone: z.number().default(0), - melee_weapon: z.string().optional(), - kills_oneinthequiver: z.number().default(0), - deaths_oneinthequiver: z.number().default(0), - max_wave: z.number().default(0), - kills_dragonwars2: z.number().default(0), - eggs_found_easter_simulator: z.number().default(0), - poop_collected: z.number().default(0), - goals_soccer: z.number().default(0), - kicks_soccer: z.number().default(0), - powerkicks_soccer: z.number().default(0), - coins: z.number().default(0), - sw_kills: z.number().default(0), - sw_empire_kills: z.number().default(0), - sw_rebel_kills: z.number().default(0), - sw_deaths: z.number().default(0), - sw_shots_fired: z.number().default(0), - gifts_grinch_simulator_v2: z.number().default(0), - candy_found_halloween_simulator: z.number().default(0), - hitw_record_q: z.number().default(0), - hitw_record_f: z.number().default(0), - rounds_simon_says: z.number().default(0), - delivered_santa_simulator: z.number().default(0), - spotted_santa_simulator: z.number().default(0), - items_found_scuba_simulator: z.number().default(0), - total_points_scuba_simulator: z.number().default(0), - kills_throw_out: z.number().default(0), - deaths_throw_out: z.number().default(0), - pixel_party: z.object({ - wins: z.number().default(0), - games_played: z.number().default(0), - rounds_completed: z.number().default(0), - highest_round: z.number().default(0), - power_ups_collected: z.number().default(0), - wins_normal: z.number().default(0), - games_played_normal: z.number().default(0), - rounds_completed_normal: z.number().default(0), - power_ups_collected_normal: z.number().default(0), - wins_hyper: z.number().default(0), - games_played_hyper: z.number().default(0), - rounds_completed_hyper: z.number().default(0), - power_ups_collected_hyper: z.number().default(0) - }).optional(), - dropper: z.object({ - wins: z.number().default(0), - flawless_games: z.number().default(0), - games_finished: z.number().default(0), - maps_completed: z.number().default(0), - fastest_game: z.number().default(0), - fails: z.number().default(0) - }).optional(), - ...arcadeModeWins(), - ...arcadeZombiesModeStats(), - ...arcadeZombiesTypeStats() -}) - -function speedUhcModeModeMasteryStats() { - const ids = [ - "mastery_wild_specialist", - "mastery_sniper", - "mastery_berserk", - "mastery_fortune", - "mastery_master_baker", - "mastery_invigorate", - "mastery_huntsman", - "mastery_vampirism", - "mastery_guardian", - "solo_normal", - "solo_insane", - "team_normal", - "team_insane" - ] as const - - const stats = [ - "kills", - "deaths", - "wins", - "losses" - ] as const - - const entries = new Map>() - for (const id of ids) { - for (const stat of stats) { - entries.set(`${stat}_${id}`, z.number().default(0)) - } - } - - return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> -} - -export const speedUhcStatsSchema = z.object({ - kills: z.number().default(0), - deaths: z.number().default(0), - wins: z.number().default(0), - losses: z.number().default(0), - score: z.number().default(0), - coins: z.number().default(0), - ...speedUhcModeModeMasteryStats() -}) diff --git a/src/lib/schema/stats/arcade.ts b/src/lib/schema/stats/arcade.ts new file mode 100644 index 0000000..e826884 --- /dev/null +++ b/src/lib/schema/stats/arcade.ts @@ -0,0 +1,170 @@ +import z from "zod" + +function arcadeModeWins() { + const ids = [ + "wins_dayone", + "wins_oneinthequiver", + "wins_dragonwars2", + "wins_easter_simulator", + "wins_ender", + "wins_farm_hunt", + "wins_soccer", + "sw_game_wins", + "wins_grinch_simulator_v2", + "wins_halloween_simulator", + "seeker_wins_hide_and_seek", + "hider_wins_hide_and_seek", + "wins_hole_in_the_wall", + "wins_simon_says", + "wins_party", + "wins_party_2", + "wins_party_3", + "wins_draw_their_thing", + "wins_scuba_simulator", + "wins_throw_out", + "wins_mini_walls", + "wins_zombies" + ] as const + + const entries = new Map>() + for (const id of ids) { + entries.set(`${id}`, z.number().default(0)) + } + return Object.fromEntries(entries) as Record<`${typeof ids[number]}`, z.ZodDefault> +} + +function arcadeZombiesModeStats() { + const ids = [ + "deadend", + "badblood", + "alienarcadium" + ] as const + + const stats = [ + "times_knocked_down_zombies", + "players_revived_zombies", + "doors_opened_zombies", + "windows_repaired_zombies", + "zombie_kills_zombies", + "deaths_zombies", + "best_round_zombies", + "wins_zombies" + ] as const + + const entries = new Map>() + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> +} + +function arcadeZombiesTypeStats() { + const ids = [ + "basic", + "blaze", + "empowered", + "ender", + "endermite", + "fire", + "guardian", + "magma", + "magma_cube", + "pig_zombie", + "skelefish", + "tnt_baby", + "tnt", + "inferno", + "broodmother", + "king_slime", + "wither", + "herobrine", + "mega_blob", + "mega_magma", + "world_ender" + ] as const + + const entries = new Map>() + for (const id of ids) { + entries.set(`${id}_zombie_kills_zombies`, z.number().default(0)) + } + + return Object.fromEntries(entries) as Record<`${typeof ids[number]}_zombie_kills_zombies`, z.ZodDefault> +} + +export const arcadeStatsSchema = z.object({ + miniwalls_activeKit: z.string().optional(), + wither_kills_mini_walls: z.number().default(0), + kills_mini_walls: z.number().default(0), + final_kills_mini_walls: z.number().default(0), + deaths_mini_walls: z.number().default(0), + arrows_hit_mini_walls: z.number().default(0), + arrows_shot_mini_walls: z.number().default(0), + total_rounds_survived_zombies: z.number().default(0), + best_round_zombies: z.number().default(0), + zombie_kills_zombies: z.number().default(0), + bullets_hit_zombies: z.number().default(0), + bullets_shot_zombies: z.number().default(0), + headshots_zombies: z.number().default(0), + players_revived_zombies: z.number().default(0), + times_knocked_down_zombies: z.number().default(0), + doors_opened_zombies: z.number().default(0), + windows_repaired_zombies: z.number().default(0), + kills_dayone: z.number().default(0), + headshots_dayone: z.number().default(0), + melee_weapon: z.string().optional(), + kills_oneinthequiver: z.number().default(0), + deaths_oneinthequiver: z.number().default(0), + max_wave: z.number().default(0), + kills_dragonwars2: z.number().default(0), + eggs_found_easter_simulator: z.number().default(0), + poop_collected: z.number().default(0), + goals_soccer: z.number().default(0), + kicks_soccer: z.number().default(0), + powerkicks_soccer: z.number().default(0), + coins: z.number().default(0), + sw_kills: z.number().default(0), + sw_empire_kills: z.number().default(0), + sw_rebel_kills: z.number().default(0), + sw_deaths: z.number().default(0), + sw_shots_fired: z.number().default(0), + gifts_grinch_simulator_v2: z.number().default(0), + candy_found_halloween_simulator: z.number().default(0), + hitw_record_q: z.number().default(0), + hitw_record_f: z.number().default(0), + rounds_simon_says: z.number().default(0), + delivered_santa_simulator: z.number().default(0), + spotted_santa_simulator: z.number().default(0), + items_found_scuba_simulator: z.number().default(0), + total_points_scuba_simulator: z.number().default(0), + kills_throw_out: z.number().default(0), + deaths_throw_out: z.number().default(0), + pixel_party: z.object({ + wins: z.number().default(0), + games_played: z.number().default(0), + rounds_completed: z.number().default(0), + highest_round: z.number().default(0), + power_ups_collected: z.number().default(0), + wins_normal: z.number().default(0), + games_played_normal: z.number().default(0), + rounds_completed_normal: z.number().default(0), + power_ups_collected_normal: z.number().default(0), + wins_hyper: z.number().default(0), + games_played_hyper: z.number().default(0), + rounds_completed_hyper: z.number().default(0), + power_ups_collected_hyper: z.number().default(0) + }).optional(), + dropper: z.object({ + wins: z.number().default(0), + flawless_games: z.number().default(0), + games_finished: z.number().default(0), + maps_completed: z.number().default(0), + fastest_game: z.number().default(0), + fails: z.number().default(0) + }).optional(), + ...arcadeModeWins(), + ...arcadeZombiesModeStats(), + ...arcadeZombiesTypeStats() +}) diff --git a/src/lib/schema/stats/bedwars.ts b/src/lib/schema/stats/bedwars.ts new file mode 100644 index 0000000..4d0fba3 --- /dev/null +++ b/src/lib/schema/stats/bedwars.ts @@ -0,0 +1,86 @@ +import z from "zod" + +function bedwarsModeStats() { + const ids = [ + "eight_one", + "eight_two", + "four_three", + "four_four", + "two_four", + "eight_two_rush", + "four_four_rush", + "eight_two_ultimate", + "four_four_ultimate", + "eight_two_lucky", + "four_four_lucky", + "eight_two_voidless", + "four_four_voidless", + "eight_two_armed", + "four_four_armed", + "four_four_swap", + "four_four_underworld", + "castle" + ] as const + + const stats = [ + "winstreak", + "kills_bedwars", + "deaths_bedwars", + "final_kills_bedwars", + "final_deaths_bedwars", + "wins_bedwars", + "losses_bedwars", + "beds_broken_bedwars", + "beds_lost_bedwars" + ] as const + + const entries = new Map>() + const winstreak = new Map>() + + for (const id of ids) { + for (const stat of stats) { + if (stat === "winstreak") { + winstreak.set(`${id}_${stat}`, z.number().optional()) + } else { + entries.set(`${id}_${stat}`, z.number().default(0)) + } + } + } + + type Modes = typeof ids[number] + type Stats = Exclude + + return { + all: Object.fromEntries(entries) as Record<`${Modes}_${Stats}`, z.ZodDefault>, + winstreak: Object.fromEntries(winstreak) as Record<`${Modes}_winstreak`, z.ZodOptional> + } +} + +export const bedwarsStatsSchema = z.object({ + Experience: z.number().default(0), + coins: z.number().default(0), + winstreak: z.number().optional(), + kills_bedwars: z.number().default(0), + deaths_bedwars: z.number().default(0), + final_kills_bedwars: z.number().default(0), + final_deaths_bedwars: z.number().default(0), + wins_bedwars: z.number().default(0), + losses_bedwars: z.number().default(0), + beds_broken_bedwars: z.number().default(0), + beds_lost_bedwars: z.number().default(0), + total_challenges_completed: z.number().default(0), + iron_resources_collected_bedwars: z.number().default(0), + gold_resources_collected_bedwars: z.number().default(0), + diamond_resources_collected_bedwars: z.number().default(0), + emerald_resources_collected_bedwars: z.number().default(0), + _items_purchased_bedwars: z.number().default(0), + slumber: z.object({ + tickets: z.number().default(0), + bag_type: z.string().optional(), + total_tickets_earned: z.number().default(0), + doublers: z.number().default(0), + room: z.record(z.string(), z.boolean()).optional() + }).optional(), + ...bedwarsModeStats().all, + ...bedwarsModeStats().winstreak +}) diff --git a/src/lib/schema/stats/blitz.ts b/src/lib/schema/stats/blitz.ts new file mode 100644 index 0000000..aa1f3f9 --- /dev/null +++ b/src/lib/schema/stats/blitz.ts @@ -0,0 +1,90 @@ +import z from "zod" + +function blitzKitPlayedStats() { + const ids = [ + "arachnologist", + "archer", + "armorer", + "astronaut", + "baker", + "blaze", + "creepertamer", + "diver", + "donkeytamer", + "farmer", + "fisherman", + "florist", + "golem", + "guardian", + "horsetamer", + "hunter", + "hype train", + "jockey", + "knight", + "meatmaster", + "milkman", + "necromancer", + "paladin", + "phoenix", + "pigman", + "ranger", + "reaper", + "reddragon", + "rogue", + "scout", + "shadow knight", + "shark", + "slimeyslime", + "snowman", + "speleologist", + "tim", + "toxicologist", + "troll", + "viking", + "warlock", + "warrior", + "wolftamer" + ] as const + + const stats = [ + "wins", + "wins_teams", + "time_played", + "exp", + "kills", + "games_played" + ] as const + + const entries = new Map>() + const kits = new Map>() + const prestiges = new Map>() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + kits.set(`${id}`, z.number().default(-1)) + prestiges.set(`p${id}`, z.number().default(0)) + } + } + + return { + stats: Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault>, + kits: Object.fromEntries(kits) as Record<`${typeof ids[number]}`, z.ZodDefault>, + prestiges: Object.fromEntries(prestiges) as Record<`p${typeof ids[number]}`, z.ZodDefault> + } +} + +export const blitzStatsSchema = z.object({ + kills: z.number().default(0), + deaths: z.number().default(0), + kills_solo_normal: z.number().default(0), + kills_teams_normal: z.number().default(0), + wins_solo_normal: z.number().default(0), + wins_teams_normal: z.number().default(0), + coins: z.number().default(0), + damage: z.number().default(0), + damage_taken: z.number().default(0), + ...blitzKitPlayedStats().stats, + ...blitzKitPlayedStats().kits, + ...blitzKitPlayedStats().prestiges +}) diff --git a/src/lib/schema/stats/build-battle.ts b/src/lib/schema/stats/build-battle.ts new file mode 100644 index 0000000..6e793e1 --- /dev/null +++ b/src/lib/schema/stats/build-battle.ts @@ -0,0 +1,20 @@ +import z from "zod" + +export const buildBattleStatsSchema = z.object({ + wins: z.number().default(0), + score: z.number().default(0), + coins: z.number().default(0), + games_played: z.number().default(0), + correct_guesses: z.number().default(0), + super_votes: z.number().default(0), + wins_solo_normal: z.number().default(0), + wins_teams_normal: z.number().default(0), + wins_guess_the_build: z.number().default(0), + wins_solo_pro: z.number().default(0), + wins_speed_builders: z.number().default(0), + wins_solo_normal_latest: z.number().default(0), + wins_teams_normal_latest: z.number().default(0), + wins_guess_the_build_latest: z.number().default(0), + wins_solo_pro_latest: z.number().default(0), + wins_speed_builders_latest: z.number().default(0) +}) diff --git a/src/lib/schema/stats/copsandcrims.ts b/src/lib/schema/stats/copsandcrims.ts new file mode 100644 index 0000000..abb6480 --- /dev/null +++ b/src/lib/schema/stats/copsandcrims.ts @@ -0,0 +1,65 @@ +import z from "zod" + +function copsAndCrimsGunUpgrades() { + const ids = [ + "knife", + "pistol", + "handgun", + "magnum", + "sniper", + "bullpup", + "smg", + "rifle", + "carbine", + "scoped_rifle", + "shotgun", + "auto_shotgun" + ] as const + + const upgrades = [ + "damage_increase", + "recoil_reduction", + "reload_speed_reduction", + "cost_reduction" + ] as const + + const entries = new Map>() + + for (const id of ids) { + for (const upgrade of upgrades) { + entries.set(`${id}_${upgrade}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof ids[number]}_${typeof upgrades[number]}`, z.ZodDefault> +} + +export const copsAndCrimsStatsSchema = z.object({ + kills: z.number().default(0), + assists: z.number().default(0), + deaths: z.number().default(0), + game_wins: z.number().default(0), + cop_kills: z.number().default(0), + criminal_kills: z.number().default(0), + kills_deathmatch: z.number().default(0), + assists_deathmatch: z.number().default(0), + deaths_deathmatch: z.number().default(0), + game_wins_deathmatch: z.number().default(0), + cop_kills_deathmatch: z.number().default(0), + criminal_kills_deathmatch: z.number().default(0), + kills_gungame: z.number().default(0), + assists_gungame: z.number().default(0), + deaths_gungame: z.number().default(0), + game_wins_gungame: z.number().default(0), + cop_kills_gungame: z.number().default(0), + criminal_kills_gungame: z.number().default(0), + bombs_planted: z.number().default(0), + bombs_defused: z.number().default(0), + shots_fired: z.number().default(0), + coins: z.number().default(0), + round_wins: z.number().default(0), + headshot_kills: z.number().default(0), + knife_attack_delay: z.number().default(0), + sniper_charge_bonus: z.number().default(0), + ...copsAndCrimsGunUpgrades() +}) diff --git a/src/lib/schema/stats/duels.ts b/src/lib/schema/stats/duels.ts new file mode 100644 index 0000000..22d9643 --- /dev/null +++ b/src/lib/schema/stats/duels.ts @@ -0,0 +1,165 @@ +import z from "zod" + +function duelsModeStats() { + const ids = [ + "uhc_duel", + "uhc_doubles", + "uhc_four", + "uhc_meetup", + "op_duel", + "op_doubles", + "sw_duel", + "sw_doubles", + "bow_duel", + "blitz_duel", + "mw_duel", + "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" + ] as const + + const bridgeStats = [ + "bridge_kills", + "bridge_deaths", + "goals" + ] as const + + const stats = [ + "kills", + "deaths", + "wins", + "losses", + "melee_swings", + "melee_hits", + "bow_shots", + "bow_hits", + "current_winstreak_mode", + "best_winstreak_mode" + ] as const + + const entries = new Map>() + const ws = new Map>() + const bestWs = new Map>() + const bridge = new Map>() + + for (const id of ids) { + for (const stat of stats) { + if (stat === "current_winstreak_mode") { + ws.set(`${stat}_${id}`, z.number().optional()) + } else if (stat === "best_winstreak_mode") { + bestWs.set(`${stat}_${id}`, z.number().optional()) + } else { + entries.set(`${id}_${stat}`, z.number().default(0)) + } + } + } + + 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 BridgeModes = typeof bridgeIds[number] + type Stats = Exclude + type BridgeStats = typeof bridgeStats[number] + + return { + all: Object.fromEntries(entries) as Record<`${Modes | BridgeModes}_${Stats}`, z.ZodDefault>, + ws: Object.fromEntries(ws) as Record<`current_winstreak_mode_${Modes | BridgeModes}`, z.ZodOptional>, + bestWs: Object.fromEntries(bestWs) as Record<`best_winstreak_mode_${Modes | BridgeModes}`, z.ZodOptional>, + bridge: Object.fromEntries(bridge) as Record<`${BridgeModes}_${BridgeStats}`, z.ZodDefault> + } +} + +function devisionTitles() { + const devisions = [ + "all_modes", + "uhc", + "op", + "skywars", + "bow", + "blitz", + "mega_walls", + "sumo", + "tnt_games", + "parkour", + "boxing", + "classic", + "no_debuff", + "combo", + "bridge" + ] as const + + const titles = [ + "rookie", + "iron", + "gold", + "diamond", + "master", + "legend", + "grandmaster", + "godlike", + "celestial", + "divine", + "ascended" + ] as const + const entries = new Map>() + + for (const div of devisions) { + for (const title of titles) { + entries.set(`${div}_${title}_title_prestige`, z.number().default(-1)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof devisions[number]}_${typeof titles[number]}_title_prestige`, z.ZodDefault> +} + +export const duelsStatsSchema = z.object({ + wins: z.number().default(0), + losses: z.number().default(0), + coins: z.number().default(0), + kills: z.number().default(0), + deaths: z.number().default(0), + melee_swings: z.number().default(0), + melee_hits: z.number().default(0), + bow_shots: z.number().default(0), + bow_hits: z.number().default(0), + current_winstreak: z.number().optional(), + best_overall_winstreak: z.number().optional(), + ...devisionTitles(), + ...duelsModeStats().all, + ...duelsModeStats().ws, + ...duelsModeStats().bestWs, + ...duelsModeStats().bridge +}) diff --git a/src/lib/schema/stats/megawalls.ts b/src/lib/schema/stats/megawalls.ts new file mode 100644 index 0000000..55dc43e --- /dev/null +++ b/src/lib/schema/stats/megawalls.ts @@ -0,0 +1,107 @@ +import z from "zod" + +function megawallsClassStats() { + const ids = [ + "angel", + "arcanist", + "assassin", + "automaton", + "blaze", + "cow", + "creeper", + "dragon", + "dreadlord", + "enderman", + "golem", + "herobrine", + "hunter", + "moleman", + "phoenix", + "pigman", + "pirate", + "renegade", + "shaman", + "shark", + "sheep", + "skeleton", + "snowman", + "spider", + "squid", + "werewolf", + "zombie" + ] as const + + const stats = [ + "kills", + "deaths", + "final_kills", + "final_deaths", + "wins", + "losses" + ] as const + + const entries = new Map>() + const classes = new Map< + string, + z.ZodOptional, enderchest_rows: z.ZodDefault }>> + >() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`${id}_${stat}`, z.number().default(0)) + } + classes.set(id, z.object({ prestige: z.number().default(0), enderchest_rows: z.number().default(0) }).optional()) + } + + return { + classStats: Object.fromEntries(entries) as Record<`${typeof ids[number]}_${typeof stats[number]}`, z.ZodDefault>, + classOther: Object.fromEntries(classes) as Record< + `${typeof ids[number]}`, + z.ZodOptional, enderchest_rows: z.ZodDefault }>> + > + } +} + +function megawallsModeStats() { + const ids = [ + "standard", + "face_off", + "gvg" + ] as const + + const stats = [ + "kills", + "deaths", + "wins", + "losses" + ] as const + + const entries = new Map>() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> +} + +export const megawallsStats = z.object({ + kills: z.number().default(0), + assists: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0), + wins_practice: z.number().default(0), + losses: z.number().default(0), + losses_practice: z.number().default(0), + final_kills: z.number().default(0), + final_assists: z.number().default(0), + final_deaths: z.number().default(0), + coins: z.number().default(0), + wither_damage: z.number().default(0), + witherDamage: z.number().default(0), + classes: z.object(megawallsClassStats().classOther).optional(), + ...megawallsClassStats().classStats, + ...megawallsModeStats() +}) diff --git a/src/lib/schema/stats/murder-mystery.ts b/src/lib/schema/stats/murder-mystery.ts new file mode 100644 index 0000000..8471076 --- /dev/null +++ b/src/lib/schema/stats/murder-mystery.ts @@ -0,0 +1,56 @@ +import z from "zod" + +function murderMysteryModeStats() { + const ids = [ + "MURDER_CLASSIC", + "MURDER_ASSASSINS", + "MURDER_DOUBLE_UP", + "MURDER_HARDCORE", + "MURDER_SHOWDOWN" + ] as const + + const stats = [ + "kills", + "bow_kills", + "knife_kills", + "thrown_knife_kills", + "wins", + "games", + "coins_pickedup" + ] as const + + const entries = new Map>() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> +} + +export const murderMysteryStatsSchema = z.object({ + kills: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0), + losses: z.number().default(0), + coins: z.number().default(0), + games: z.number().default(0), + bow_kills: z.number().default(0), + knife_kills: z.number().default(0), + coins_pickedup: z.number().default(0), + kills_as_murderer: z.number().default(0), + thrown_knife_kills: z.number().default(0), + active_knife_skin: z.string().optional(), + quickest_detective_win_time_seconds: z.number().default(0), + quickest_murderer_win_time_seconds: z.number().default(0), + kills_as_infected_MURDER_INFECTION: z.number().default(0), + kills_as_survivor_MURDER_INFECTION: z.number().default(0), + kills_MURDER_INFECTION: z.number().default(0), + wins_MURDER_INFECTION: z.number().default(0), + games_MURDER_INFECTION: z.number().default(0), + total_time_survived_seconds_MURDER_INFECTION: z.number().default(0), + coins_pickedup_MURDER_INFECTION: z.number().default(0), + ...murderMysteryModeStats() +}) diff --git a/src/lib/schema/stats/pit.ts b/src/lib/schema/stats/pit.ts new file mode 100644 index 0000000..12d392f --- /dev/null +++ b/src/lib/schema/stats/pit.ts @@ -0,0 +1,57 @@ +import z from "zod" + +export const pitStats = z.object({ + pit_stats_ptl: z.object({ + kills: z.number().default(0), + deaths: z.number().default(0), + cash_earned: z.number().default(0), + playtime_minutes: z.number().default(0), + assists: z.number().default(0), + max_streak: z.number().default(0), + damage_dealt: z.number().default(0), + damage_received: z.number().default(0), + melee_damage_dealt: z.number().default(0), + melee_damage_received: z.number().default(0), + bow_damage_dealt: z.number().default(0), + bow_damage_received: z.number().default(0), + sword_hits: z.number().default(0), + left_clicks: z.number().default(0), + arrow_hits: z.number().default(0), + arrows_fired: z.number().default(0), + contracts_completed: z.number().default(0), + jumped_into_pit: z.number().default(0), + launched_by_launchers: z.number().default(0), + gapple_eaten: z.number().default(0), + ghead_eaten: z.number().default(0), + soups_drank: z.number().default(0), + rage_potatoes_eaten: z.number().default(0), + fishing_rod_launched: z.number().default(0), + lava_bucket_emptied: z.number().default(0), + diamond_items_purchased: z.number().default(0), + blocks_placed: z.number().default(0), + blocks_broken: z.number().default(0), + enchanted_tier1: z.number().default(0), + enchanted_tier2: z.number().default(0), + enchanted_tier3: z.number().default(0), + dark_pants_crated: z.number().default(0), + wheat_farmed: z.number().default(0), + fished_anything: z.number().default(0), + fishes_fished: z.number().default(0), + king_quest_completion: z.number().default(0), + sewer_treasures_found: z.number().default(0) + }), + profile: z.object({ + prestiges: z.array(z.object({ + index: z.number(), + xp_on_prestige: z.number(), + timestamp: z.number() + })).optional(), + xp: z.number().default(0), + cash: z.number().default(0), + renown: z.number().default(0) + }) +}).transform(({ profile, pit_stats_ptl, ...rest }) => ({ + profile, + ...pit_stats_ptl, + ...rest +})) diff --git a/src/lib/schema/stats/skywars.ts b/src/lib/schema/stats/skywars.ts new file mode 100644 index 0000000..9eecd31 --- /dev/null +++ b/src/lib/schema/stats/skywars.ts @@ -0,0 +1,85 @@ +import z from "zod" + +function skywarsModeStats() { + const ids = [ + "solo_normal", + "solo_insane", + "team_normal", + "team_insane", + "mega", + "mega_doubles", + "ranked_normal" + ] as const + + const stats = [ + "kills", + "deaths", + "wins", + "losses" + ] as const + + const entries = new Map>() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> +} + +export const skywarsStatsSchema = z.object({ + skywars_experience: z.number().default(0), + selected_prestige_icon: z.string().optional(), + kills: z.number().default(0), + deaths: z.number().default(0), + assists: z.number().default(0), + wins: z.number().default(0), + losses: z.number().default(0), + cosmetic_tokens: z.number().default(0), + coins: z.number().default(0), + blocks_placed: z.number().default(0), + blocks_broken: z.number().default(0), + chests_opened: z.number().default(0), + arrows_hit: z.number().default(0), + arrows_shot: z.number().default(0), + melee_kills: z.number().default(0), + void_kills: z.number().default(0), + bow_kills: z.number().default(0), + mobs_kills: z.number().default(0), + enderpearls_thrown: z.number().default(0), + egg_thrown: z.number().default(0), + wins_lab: z.number().default(0), + heads: z.number().default(0), + angel_of_death_level: z.number().default(0), + angels_offering: z.number().default(0), + souls_gathered: z.number().default(0), + souls: z.number().default(0), + paid_souls: z.number().default(0), + soul_well: z.number().default(0), + packages: z.array(z.string()), + shard: z.number().default(0), + opals: z.number().default(0), + heads_eww: z.number().default(0), + heads_yucky: z.number().default(0), + heads_meh: z.number().default(0), + heads_decent: z.number().default(0), + heads_salty: z.number().default(0), + heads_tasty: z.number().default(0), + heads_succulent: z.number().default(0), + heads_sweet: z.number().default(0), + heads_divine: z.number().default(0), + heads_heavenly: z.number().default(0), + heads_ethereal: z.number().default(0), + heads_indescribable: z.number().default(0), + head_collection: z.object({ + prestigious: z.array(z.object({ + username: z.string().nullable().default(null), + timestamp: z.number(), + mode: z.string(), + sacrifice: z.string() + })) + }).optional(), + ...skywarsModeStats() +}) diff --git a/src/lib/schema/stats/speeduhc.ts b/src/lib/schema/stats/speeduhc.ts new file mode 100644 index 0000000..730bc73 --- /dev/null +++ b/src/lib/schema/stats/speeduhc.ts @@ -0,0 +1,45 @@ +import z from "zod" + +function speedUhcModeModeMasteryStats() { + const ids = [ + "mastery_wild_specialist", + "mastery_sniper", + "mastery_berserk", + "mastery_fortune", + "mastery_master_baker", + "mastery_invigorate", + "mastery_huntsman", + "mastery_vampirism", + "mastery_guardian", + "solo_normal", + "solo_insane", + "team_normal", + "team_insane" + ] as const + + const stats = [ + "kills", + "deaths", + "wins", + "losses" + ] as const + + const entries = new Map>() + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> +} + +export const speedUhcStatsSchema = z.object({ + kills: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0), + losses: z.number().default(0), + score: z.number().default(0), + coins: z.number().default(0), + ...speedUhcModeModeMasteryStats() +}) diff --git a/src/lib/schema/stats/tnt-games.ts b/src/lib/schema/stats/tnt-games.ts new file mode 100644 index 0000000..af151fd --- /dev/null +++ b/src/lib/schema/stats/tnt-games.ts @@ -0,0 +1,51 @@ +import z from "zod" + +function tntGamesModeStats() { + const ids = [ + "ancient", + "blood", + "fire", + "hydro", + "ice", + "kinetic", + "storm", + "toxic", + "wither" + ] as const + + const stats = [ + "kills", + "deaths", + "assists", + "explode", + "regen" + ] as const + + const entries = new Map>() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`new_${id}wizard_${stat}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`new_${typeof ids[number]}wizard_${typeof stats[number]}`, z.ZodDefault> +} + +export const tntGamesStatsSchema = z.object({ + wins: z.number().default(0), + coins: z.number().default(0), + kills_tntag: z.number().default(0), + wins_tntag: z.number().default(0), + wins_tntrun: z.number().default(0), + record_tntrun: z.number().default(0), + kills_pvprun: z.number().default(0), + wins_pvprun: z.number().default(0), + record_pvprun: z.number().default(0), + wins_bowspleef: z.number().default(0), + deaths_bowspleef: z.number().default(0), + wins_capture: z.number().default(0), + kills_capture: z.number().default(0), + deaths_capture: z.number().default(0), + ...tntGamesModeStats() +}) diff --git a/src/lib/schema/stats/uhc.ts b/src/lib/schema/stats/uhc.ts new file mode 100644 index 0000000..cda0e89 --- /dev/null +++ b/src/lib/schema/stats/uhc.ts @@ -0,0 +1,42 @@ +import z from "zod" + +function uhcModesStats() { + const ids = [ + "solo", + "red_vs_blue", + "no_diamonds", + "vanilla_doubles", + "brawl", + "solo_brawl", + "duo_brawl" + ] as const + + const stats = [ + "wins", + "kills", + "deaths", + "heads_eaten" + ] as const + + const entries = new Map>() + + for (const id of ids) { + for (const stat of stats) { + entries.set(`${stat}_${id}`, z.number().default(0)) + } + } + + return Object.fromEntries(entries) as Record<`${typeof stats[number]}_${typeof ids[number]}`, z.ZodDefault> +} + +export const uhcSchema = z.object({ + kills: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0), + heads_eaten: z.number().default(0), + score: z.number().default(0), + coins: z.number().default(0), + ultimates_crafted: z.number().default(0), + ultimates_crafted_solo: z.number().default(0), + ...uhcModesStats() +}) diff --git a/src/lib/schema/stats/woolgames.ts b/src/lib/schema/stats/woolgames.ts new file mode 100644 index 0000000..c1fabab --- /dev/null +++ b/src/lib/schema/stats/woolgames.ts @@ -0,0 +1,67 @@ +import z from "zod" + +const woolGamesClassStats = z.object({ + kills: z.number().default(0), + assists: z.number().default(0), + deaths: z.number().default(0), + wool_placed: z.number().default(0), + blocks_broken: z.number().default(0), + powerups_gotten: z.number().default(0) +}) + +export const woolGamesStatsSchema = z.object({ + wool_wars_prestige_icon: z.string().optional(), + playtime: z.number().default(0), + coins: z.number().default(0), + progression: z.object({ + experience: z.number().default(0), + available_layers: z.number().default(0) + }).optional(), + capture_the_wool: z.object({ + stats: z.object({ + kills: z.number().default(0), + assits: z.number().default(0), + deaths: z.number().default(0), + participated_wins: z.number().default(0), + participated_losses: z.number().default(0), + fastest_win: z.number().default(0), + longest_game: z.number().default(0), + wools_stolen: z.number().default(0), + wools_captured: z.number().default(0), + fastest_wool_capture: z.number().default(0), + gold_earned: z.number().default(0), + gold_spent: z.number().default(0) + }).optional() + }).optional(), + sheep_wars: z.object({ + stats: z.object({ + kills: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0), + losses: z.number().default(0), + sheep_thrown: z.number().default(0), + damage_dealt: z.number().default(0) + }).optional() + }).optional(), + wool_wars: z.object({ + selected_class: z.string().optional(), + stats: z.object({ + kills: z.number().default(0), + assits: z.number().default(0), + deaths: z.number().default(0), + wins: z.number().default(0), + losses: z.number().default(0), + wool_placed: z.number().default(0), + blocks_broken: z.number().default(0), + powerups_gotten: z.number().default(0), + classes: z.object({ + tank: woolGamesClassStats.optional(), + archer: woolGamesClassStats.optional(), + swordsman: woolGamesClassStats.optional(), + engineer: woolGamesClassStats.optional(), + golem: woolGamesClassStats.optional(), + assault: woolGamesClassStats.optional() + }).default({}) + }).optional() + }).optional() +})