From e911f36ea34397b22f484ce3616dc946c369368f Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Wed, 23 Sep 2026 10:22:57 -0500 Subject: [PATCH] createTankStatus --- packages/i18n/strings/en.json | 320 +----------------- .../components/TankopediaLoadout/index.tsx | 4 + packages/website/src/stores/tankopedia.ts | 29 +- .../website/src/tankopedia/createTankState.ts | 7 +- .../src/tankopedia/createTankStatus.ts | 25 ++ packages/website/src/tankopedia/tankState.ts | 43 +++ 6 files changed, 85 insertions(+), 343 deletions(-) create mode 100644 packages/website/src/tankopedia/createTankStatus.ts create mode 100644 packages/website/src/tankopedia/tankState.ts diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index 8462663b9..e2215e0f9 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -1,4 +1,10 @@ { + "tanks": { + "loadout": { + "dynamics": "Dynamics" + } + }, + "home": { "tanks": "Tanks", "players": "Players", @@ -424,320 +430,6 @@ "tier": "Tier {tier}" }, - "tanks": { - "search": "Search a stat...", - - "name": "Tankopedia", - "description": "Blitz tank encyclopedia", - "seo_description": "Statistics, armor, and more for all tanks in World of Tanks Blitz", - "tank_seo_title": "{name} - Tier {tier} {nationality} {class} | {website} Tankopedia | World of Tanks Blitz (WoTB)", - "tank_seo_description": "{name} armor, statistics, equipment, provisions, and more. {dpm} DPM, {alpha}hp alpha, {penetration}mm penetration, {speed}kph top speed, {health}hp health.", - - "visualizers": { - "reload": { - "skip": "Skip" - }, - - "assault": { - "title": "Assault shells" - }, - - "rotator": { - "hull": "Hull", - "turret": "Turret", - "hard": "Hard", - "medium": "Medium", - "soft": "Soft", - "effective": "Effective" - }, - - "ricochet": { - "angle": "Angle", - "normalization": "Normalization", - "effective_angle": "Effective angle", - "armor": "Armor", - "no_ricochet": "Explosive shells don't ricochet" - }, - - "view_range": { - "camo": "Camo", - "ghost_factory": "Ghost Factory", - "dead_rail": "Dead Rail" - }, - - "flexibility": { - "yaw": "Yaw", - "pitch": "Pitch", - "min": "Min", - "max": "Max" - } - }, - - "sandbox": { - "poses": { - "hull_down": "Hull down", - "face_hug": "Face hug", - "default": "Default" - }, - - "settings": { - "armor": "Armor", - "green_penetration": "Green penetration", - "hide_model_under_armor": "Hide model under armor", - "opaque": "Opaque", - "dev_wireframe": "DEV: wireframe" - }, - - "screenshot": { - "download": "Download", - "copy": "Copy" - }, - - "model": { - "name": "Model" - }, - "dynamic": { - "name": "Dynamic armor", - - "custom_shell": { - "type": "Type", - "caliber": "Caliber", - "penetration": "Penetration", - "normalization": "Normalization", - "ricochet": "Ricochet", - "explosion_radius": "Explosion radius", - "exit": "Exit", - "reset": "Reset" - }, - - "advanced": "Advanced highlighting", - - "shot_card": { - "element": { - "primary": "Primary", - "spaced": "Spaced", - "external": "External", - "gap": "Gap", - "gun": "Gun", - "track": "Tracks" - }, - "status": { - "penetration": "{damage}hp penetration", - "blocked": "Blocked", - "ricochet": "Ricochet", - "splash": "{damage}hp splash" - }, - "stats": { - "thickness_and_angle": "{thickness}mm {angle}°", - "nominal": "{thickness}mm nominal", - "ricochet_loss": "{loss}% penetration" - } - } - }, - "static": { - "name": "Static armor", - "primary": "Primary", - "spaced": "Spaced", - "external": "External", - "edit": { - "label": "Edit", - "reset": "Reset" - } - } - }, - - "meta": { - "back": "Back", - "compare": "Compare", - "swap": { - "button": "Swap", - "title": "Swap tanks" - }, - "vanilla": "Vanilla", - "opentest": "OpenTest", - "full_name": "Full name", - "nation": "Nation", - "class": "Class", - "tier": "Tier", - "type": "Type", - "dev_id": "DEV: ID", - "dev_name": "DEV: NAME", - "purchase": "Purchase price", - "restoration": "Restoration price", - "sale": "Sale price", - "research": "Research XP" - }, - - "tech_tree": { - "title": "Tech tree", - "battle": "1 battle", - "battles": "{count} battles", - "route": "Route {index} of {count}" - }, - - "game_modes": { - "title": "Game mode abilities" - }, - - "review": { - "title": "Review videos", - "join": "Apply to {name} YouTuber program" - }, - - "configuration": { - "title": "Configuration", - - "equalizer": { - "title": "Equalizer", - "equalize": "Equalize", - "beta": "Beta" - }, - "modules": { - "title": "Modules", - "stock": "Stock", - "upgrade": "Upgrade" - }, - "equipment": { - "title": "Equipment", - "clear": "Clear" - }, - "provisions": { - "title": "Provisions", - "clear": "Clear" - }, - "consumables": { - "title": "Consumables", - "clear": "Clear", - "info": "Yellow consumables do not affect the statistics." - }, - "skills": { - "title": "Crew skills", - "clear": "Clear", - "maximize": "Maximize", - "info": "Yellow skills only apply under special circumstances. Hold Space to quickly toggle between level 0 and 7." - }, - "miscellaneous": { - "title": "Miscellaneous" - } - }, - - "characteristics": { - "title": "Characteristics", - "compare": { - "label": "Compare", - "class": "{tier} {class}", - "tier": "All tier {tier}", - "all": "All tanks" - }, - "values": { - "shell_index": "Shell {index}", - "at_distance": "At {distance}m", - "at_distance_slider_label": "Distance", - "dispersion_at_distance": "Dispersion at {distance}m", - "gun_flexibility": "Gun flexibility", - "speed": "Speed", - "terrain_coefficients": "Terrain coefficients", - "raw_terrain_coefficients": "Raw terrain coefficients", - "power_to_weight_ratio": "Power to weight ratio", - "hull_traverse_speed": "Hull traverse speed", - "camouflage": "Camouflage", - "reload": "Reload", - "crewCount": "Crew count", - "shellNormalization": "Normalization", - "shellRicochet": "Ricochet", - "dpm": "DPM", - "dpmEffective": "Effective at 60s", - "shells": "Shells", - "mostOptimalShellIndex": "Most optimal shell", - "shellReloads": "Reloads", - "shellReload": "Reload", - "intraClip": "Intra-clip", - "caliber": "Caliber", - "penetration": "Penetration", - "damage": "Damage", - "damageWithoutAssault": "Damage without assault shells", - "clipDamage": "Clipping potential", - "moduleDamage": "Module damage", - "explosionRadius": "Explosion radius", - "shellVelocity": "Shell velocity", - "aimTime": "Aim time", - "dispersion": "Dispersion still", - "dispersionMoving": "Moving", - "dispersionHullTraversing": "Hull traversing", - "dispersionTurretTraversing": "Turret traversing", - "dispersionShooting": "Shooting", - "dispersionGunDamaged": "Gun damaged", - "gunDepression": "Depression", - "gunElevation": "Elevation", - "gunFrontalDepression": "Frontal depression", - "gunFrontalElevation": "Frontal elevation", - "gunRearDepression": "Rear depression", - "gunRearElevation": "Rear elevation", - "azimuthLeft": "Azimuth left", - "azimuthRight": "Azimuth right", - "speedForwards": "Speed forwards", - "speedBackwards": "Backwards", - "hardTerrainCoefficient": "Terrain coefficient hard", - "hardTerrainCoefficientRaw": "Raw terrain coefficient hard", - "mediumTerrainCoefficient": "Medium", - "mediumTerrainCoefficientRaw": "Medium", - "softTerrainCoefficient": "Soft", - "softTerrainCoefficientRaw": "Soft", - "enginePower": "Engine power", - "powerToWeightRatioHardTerrain": "Power to weight ratio hard", - "powerToWeightRatioMediumTerrain": "Medium", - "powerToWeightRatioSoftTerrain": "Soft", - "weight": "Weight", - "turretTraverseSpeed": "Turret traverse speed", - "gunTraverseSpeed": "Gun traverse speed", - "hullTraverseHardTerrain": "Hull traverse hard", - "hullTraverseMediumTerrain": "Medium", - "hullTraverseSoftTerrain": "Soft", - "health": "Health", - "fireChance": "Fire chance", - "viewRange": "View range", - "camouflageStill": "Camouflage still", - "camouflageMoving": "Moving", - "camouflageShootingStill": "Still", - "camouflageShootingMoving": "Moving", - "camouflageCaughtOnFire": "Caught on fire", - "width": "Width", - "height": "Height", - "length": "Length", - "volume": "Volume", - "shellRange": "Shell range", - "shellCapacity": "Shell capacity", - "gunType": "Gun type", - "penetrationAt250m": "Penetration at 250m", - "burstShells": "Burst shell count", - "burstInterShell": "Burst inter-shell" - } - }, - - "firepower": { - "title": "Firepower" - }, - - "crew": { - "title": "Crew training", - "info": "represents the other roles a crew member can take.", - "count": "Crew count", - "commander": "Commander", - "gunner": "Gunner", - "driver": "Driver", - "radioman": "Radioman", - "loader": "Loader" - }, - - "maneuverability": { - "title": "Maneuverability" - }, - - "survivability": { - "title": "Survivability" - } - }, - "compare": { "name": "Compare", "description": "Compare tank statistics", diff --git a/packages/website/src/components/TankopediaLoadout/index.tsx b/packages/website/src/components/TankopediaLoadout/index.tsx index a5797daf9..dd80e2516 100644 --- a/packages/website/src/components/TankopediaLoadout/index.tsx +++ b/packages/website/src/components/TankopediaLoadout/index.tsx @@ -1,8 +1,12 @@ +import { TrashIcon } from "@radix-ui/react-icons"; import { useProtagonist } from "../../hooks/useProtagonist"; import { useStrings } from "../../hooks/useStrings"; import { Tankopedia } from "../../stores/tankopedia"; import { hasUpgrades } from "../../tankopedia/hasUpgrades"; import type { ComputedCharacteristics } from "../../types/characteristics"; +import { Heading } from "../Heading"; +import { IconButton } from "../IconButton"; +import styles from "./index.module.css"; interface TankopediaLoadoutProps { characteristics: ComputedCharacteristics; diff --git a/packages/website/src/stores/tankopedia.ts b/packages/website/src/stores/tankopedia.ts index 556c1c0a6..9e1cc9e4f 100644 --- a/packages/website/src/stores/tankopedia.ts +++ b/packages/website/src/stores/tankopedia.ts @@ -2,7 +2,6 @@ import { createDefaultSkills, ShellDefinition, TankDefinition, - type ModelDefinition, } from "@blitzkit/core"; import type { Vector3 } from "three"; import { Varuna } from "varuna"; @@ -10,10 +9,8 @@ import { api } from "../blitzkit/api"; import type { ArmorType } from "../components/Armor/components/SpacedArmorScene"; import type { ExternalModuleVariant } from "../components/Armor/components/SpacedArmorSceneComponent"; import type { XP_MULTIPLIERS } from "../components/Tankopedia/TechTreeSection"; -import { - createTankState, - type EquipmentMatrix, -} from "../tankopedia/createTankState"; +import { createTankState } from "../tankopedia/createTankState"; +import type { TankState } from "../tankopedia/tankState"; import { TankopediaDisplay } from "./tankopediaPersistent/constants"; export interface ShotLayerBase { @@ -81,28 +78,6 @@ export enum TankopediaRelativeAgainst { All, } -export interface TankState { - tank: number; - - engine: number; - turret: number; - gun: number; - shell: number; - track: number; - - assault_distance: number; - speed: number; - - model: ModelDefinition; - - equipment_matrix: EquipmentMatrix; - - consumables: number[]; - provisions: number[]; - camouflage: boolean; - cooldown_booster: number; -} - interface Tankopedia { disturbed: boolean; revealed: boolean; diff --git a/packages/website/src/tankopedia/createTankState.ts b/packages/website/src/tankopedia/createTankState.ts index c2929484b..d69c3129f 100644 --- a/packages/website/src/tankopedia/createTankState.ts +++ b/packages/website/src/tankopedia/createTankState.ts @@ -1,6 +1,7 @@ import { createDefaultProvisions, type TankDefinition } from "@blitzkit/core"; import { api } from "../blitzkit/api"; -import type { TankState } from "../stores/tankopedia"; +import { createTankStatus } from "./createTankStatus"; +import type { TankState } from "./tankState"; export type EquipmentMatrix = [ [number, number, number], @@ -24,7 +25,6 @@ export function createTankState(tank: TankDefinition) { return { tank: tank.id, - model: models.models[turret.id], engine: tank.engines.at(-1)!.id, turret: turret.id, @@ -36,6 +36,9 @@ export function createTankState(tank: TankDefinition) { speed: 0, equipment_matrix: genericDefaultEquipmentMatrix, + status: createTankStatus(), + + model: models.models[turret.id], consumables: [], provisions: createDefaultProvisions(tank, gun, provisions, scripts), diff --git a/packages/website/src/tankopedia/createTankStatus.ts b/packages/website/src/tankopedia/createTankStatus.ts new file mode 100644 index 000000000..adced898c --- /dev/null +++ b/packages/website/src/tankopedia/createTankStatus.ts @@ -0,0 +1,25 @@ +import type { TankState } from "./tankState"; + +export function createTankStatus() { + const status = { + commander_dead: false, + gunner_dead: false, + driver_dead: false, + loader_dead: false, + + fuel_tank_damaged: false, + engine_damaged: false, + chassis_damaged: false, + viewport_damaged: false, + ammo_bay_damaged: false, + gun_damaged: false, + turret_damaged: false, + + caught_on_fire: false, + shooting: false, + turret_traversing: false, + hull_traversing: false, + } satisfies TankState["status"]; + + return status; +} diff --git a/packages/website/src/tankopedia/tankState.ts b/packages/website/src/tankopedia/tankState.ts new file mode 100644 index 000000000..43cc4cb0b --- /dev/null +++ b/packages/website/src/tankopedia/tankState.ts @@ -0,0 +1,43 @@ +import type { ModelDefinition } from "@blitzkit/core"; +import type { EquipmentMatrix } from "./createTankState"; + +export interface TankState { + tank: number; + + engine: number; + turret: number; + gun: number; + shell: number; + track: number; + + assault_distance: number; + speed: number; + + equipment_matrix: EquipmentMatrix; + status: Record; + + model: ModelDefinition; + + consumables: number[]; + provisions: number[]; + camouflage: boolean; + cooldown_booster: number; +} + +export const vehicleStatusKeys = [ + ["commander_dead", "gunner_dead", "driver_dead", "loader_dead"], + + [ + "fuel_tank_damaged", + "engine_damaged", + "chassis_damaged", + "viewport_damaged", + "ammo_bay_damaged", + "gun_damaged", + "turret_damaged", + ], + + ["caught_on_fire", "shooting", "turret_traversing", "hull_traversing"], +] as const; + +export type VehicleStatusKey = (typeof vehicleStatusKeys)[number][number];