Files
blitzkit/packages/website-ue/src/core/tankopedia/characteristicsOrder.tsx
T
2026-04-29 15:17:59 -05:00

164 lines
3.8 KiB
TypeScript

import type { Strings } from "@blitzkit/i18n";
import {
Nation,
TankClass,
TankType,
} from "@protos/game/proto/legacy/blitz_static_tank_component";
import type { ReactNode } from "react";
import { VintageIcon } from "../../icons/Vintage";
import {
GunType,
type CharacteristicName,
type CharacteristicOutput,
} from "./characteristics";
export enum BetterDirection {
Higher,
Lower,
}
export interface CharacteristicRenderConfig {
name: CharacteristicName;
decimals?: number;
units?: string;
strings?: string;
render?: (data: {
output: CharacteristicOutput;
strings: Strings;
gameStrings: Record<string, string>;
}) => ReactNode;
}
type CharacteristicsOrder = {
group: string;
order: (
| CharacteristicRenderConfig
| {
toy: string;
}
)[];
}[];
export const characteristicsOrder: CharacteristicsOrder = [
{
group: "meta",
order: [
{
name: "name",
strings: "TankEntity",
render({ output, gameStrings }) {
return gameStrings[output as string];
},
},
{
name: "class",
render({ output, strings }) {
return strings.classes.full[output as TankClass];
},
},
{
name: "type",
render({ output, strings }) {
return strings.types[output as TankType];
},
},
{
name: "nation",
render({ output, strings }) {
return strings.nations[output as Nation];
},
},
{
name: "tier",
render({ output, strings }) {
const [, name] = (output as string).split(".");
if (name == "vintage") {
return <VintageIcon />;
}
return strings.tiers[name as keyof typeof strings.tiers];
},
},
{ name: "compensation" },
{ name: "id" },
{ name: "slug" },
],
},
{
group: "firepower",
order: [
{
name: "gun_type",
render({ output }) {
return GunType[output as GunType];
},
},
{ name: "dpm", decimals: 0, units: "hp_min" },
{ name: "reload", decimals: 2, units: "s" },
{ name: "reloads", decimals: 2, units: "s" },
{ name: "damage", units: "hp" },
{ name: "module_damage", units: "hp" },
{ name: "penetration", units: "mm" },
{ name: "clip_size" },
{ name: "intra_clip", decimals: 2, units: "s" },
{ toy: "reload" },
{ name: "caliber", units: "mm" },
{ name: "normalization", units: "deg" },
{ name: "ricochet", units: "deg" },
{ toy: "ricochet" },
{ name: "shell_velocity", units: "m_s" },
{ name: "shell_range", units: "m" },
{ name: "shell_capacity" },
{ name: "aim_time", decimals: 1, units: "s" },
{ toy: "aim_time" },
{ name: "dispersion", decimals: 3, units: "m" },
{ name: "gun_depression", decimals: 0, units: "deg" },
{ name: "gun_elevation", decimals: 0, units: "deg" },
{ toy: "flexibility" },
],
},
{
group: "maneuverability",
order: [
{ name: "speed_forward", units: "km_h" },
{ name: "speed_backward", units: "km_h" },
{ name: "engine_power", units: "bhp" },
{ name: "weight", decimals: 1, units: "t" },
{ name: "terrain_coefficient" },
{ name: "power_to_weight", decimals: 1, units: "bhp_t" },
{ name: "hull_traverse_speed", units: "deg_s" },
{ name: "turret_traverse_speed", units: "deg_s" },
{ toy: "traverse" },
],
},
{
group: "survivability",
order: [
{ name: "health", units: "hp" },
{ name: "fire_chance", units: "%" },
{ name: "view_range", units: "m" },
{ toy: "view_range" },
{ name: "camouflage", decimals: 0, units: "%" },
{ name: "height", units: "m" },
{ name: "length", units: "m" },
{ name: "volume", units: "m" },
],
},
];