(2) some implementation

This commit is contained in:
tresabhi committed 2026-08-01 13:53:00 -05:00
1 parent b0611d7d72
commit f7180f0e1a
3 files changed
+258 -227

No files matched your search

@@ -4,40 +4,18 @@ import {
Consumable,
ConsumableDefinitions,
ConsumableTankCategoryFilterCategory,
CrewType,
EquipmentDefinitions,
EquipmentSlot,
MapDefinitions,
ModelDefinitions,
Provision,
ProvisionDefinitions,
ResearchCost,
ShellType,
SkillDefinitions,
TankClass,
TankDefinitions,
Vector3,
} from "@blitzkit/core";
import type { Vector3Tuple } from "three";
function parseResearchCost(raw: number | string) {
if (typeof raw === "number") {
return {
research_cost_type: { $case: "xp", value: raw },
} satisfies ResearchCost;
} else {
return {
research_cost_type: {
$case: "seasonal_tokens",
value: {
season: Number(/prx_season_(\d+):\d+/.exec(raw)![1]),
tokens: Number(/prx_season_\d+:(\d+)/.exec(raw)![1]),
},
},
} satisfies ResearchCost;
}
}
type BlitzTankFilterDefinitionCategory = "clip";
const blitzTankFilterDefinitionCategoryToBlitzkit: Record<
BlitzTankFilterDefinitionCategory,
@@ -48,18 +26,11 @@ const blitzTankFilterDefinitionCategoryToBlitzkit: Record<
function vector3TupleToBlitzkit(tuple: Vector3Tuple) {
return { x: tuple[0], y: tuple[1], z: tuple[2] } satisfies Vector3;
}
const blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = {
lightTank: TankClass.TANK_CLASS_LIGHT,
"AT-SPG": TankClass.TANK_CLASS_TANK_DESTROYER,
heavyTank: TankClass.TANK_CLASS_HEAVY,
mediumTank: TankClass.TANK_CLASS_MEDIUM,
};
export interface BlitzStrings {
[key: string]: string;
}
export interface ConsumablesCommon {
[key: string]: {
id: number;
@@ -116,13 +87,6 @@ type CombatRolesYaml = Record<
}
>;
const blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = {
ARMOR_PIERCING: ShellType.SHELL_TYPE_AP,
ARMOR_PIERCING_CR: ShellType.SHELL_TYPE_APCR,
HIGH_EXPLOSIVE: ShellType.SHELL_TYPE_HE,
HOLLOW_CHARGE: ShellType.SHELL_TYPE_HEAT,
};
export async function definitions() {
Object.values(tankDefinitions.tanks).forEach((tank) => {
tank.research_cost = tankXps.get(tank.id);