mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-06 00:03:50 +01:00
1 parent
ff56f1441e
commit
76dc9f0742
4 files changed
+36
-9
No files matched your search
@@ -0,0 +1,163 @@
|
||||
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: "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: "nation",
|
||||
render({ output }) {
|
||||
return Nation[output as Nation];
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "class",
|
||||
render({ output }) {
|
||||
return TankClass[output as TankClass];
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
render({ output }) {
|
||||
return TankType[output as TankType];
|
||||
},
|
||||
},
|
||||
{ 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" },
|
||||
],
|
||||
},
|
||||
];
|
||||
Reference in new issue
Block a user