Updated copsandcrims
This commit is contained in:
@@ -1,7 +1,39 @@
|
||||
import { MODES, SCORE } from "@/data/hypixel/copsandcrims"
|
||||
import { GUNS, MODES, SCORE, UPGRADELEVELS, UPGRADES } from "@/data/hypixel/copsandcrims"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { devide } from "../general"
|
||||
|
||||
export function getCopsAndCrimsGunUgradeColor(num: number) {
|
||||
for (const upgradeLevel of UPGRADELEVELS.slice().reverse()) {
|
||||
if (upgradeLevel.level <= num) return upgradeLevel.color
|
||||
}
|
||||
|
||||
return UPGRADELEVELS.at(0)!.color
|
||||
}
|
||||
|
||||
export function getCopsAndCrimsUpgardeName(upgradeId: typeof UPGRADES[number]["id"]) {
|
||||
return UPGRADES.find(g => g.id === upgradeId)!.name
|
||||
}
|
||||
|
||||
export function getCopsAndCrimsGunName(gunId: typeof GUNS[number]["id"]) {
|
||||
return GUNS.find(g => g.id === gunId)!.name
|
||||
}
|
||||
|
||||
export function getCopsAndCrimsGunUgrade(gunId: typeof GUNS[number]["id"], stats: NonNullable<NonNullStats["CopsAndCrims"]>) {
|
||||
return UPGRADES.map(upgrade => {
|
||||
if (upgrade.id === "charge_bonus") return -1
|
||||
if (upgrade.id === "attack_delay") return -1
|
||||
|
||||
return { upgradeId: upgrade.id, value: stats[`${gunId}_${upgrade.id}`] }
|
||||
}).filter(v => typeof v !== "number")
|
||||
}
|
||||
|
||||
export function getCopsAndCrimsExtraUpgrade(stats: NonNullable<NonNullStats["CopsAndCrims"]>) {
|
||||
return {
|
||||
sniper: stats["sniper_charge_bonus"],
|
||||
knife: stats["knife_attack_delay"]
|
||||
}
|
||||
}
|
||||
|
||||
export function getCopsAndCrimsModeName(modeId: typeof MODES[number]["id"]) {
|
||||
return MODES.find(m => m.id === modeId)!.name
|
||||
}
|
||||
|
||||
@@ -660,6 +660,40 @@ export const megawallsStats = z.looseObject({
|
||||
...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<string, z.ZodDefault<z.ZodNumber>>()
|
||||
|
||||
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<z.ZodNumber>>
|
||||
}
|
||||
|
||||
export const copsAndCrimsStatsSchema = z.looseObject({
|
||||
kills: z.number().default(0),
|
||||
assists: z.number().default(0),
|
||||
@@ -684,5 +718,8 @@ export const copsAndCrimsStatsSchema = z.looseObject({
|
||||
shots_fired: z.number().default(0),
|
||||
coins: z.number().default(0),
|
||||
round_wins: z.number().default(0),
|
||||
headshot_kills: 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()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user