Files
blitzkit/packages/core/src/protos/tank_definitions.ts
T

3966 lines
115 KiB
TypeScript
Raw Normal View History

2024-10-09 10:39:21 -05:00
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
2026-09-23 16:31:35 -05:00
// protoc-gen-ts_proto v2.7.7
// protoc v3.19.6
2026-03-31 13:35:47 -05:00
// source: tank_definitions.proto
2024-10-09 10:39:21 -05:00
/* eslint-disable */
2025-10-13 22:26:11 -05:00
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18nString } from "./i18n";
2024-10-09 10:39:21 -05:00
2025-10-13 22:26:11 -05:00
export const protobufPackage = "blitzkit";
2024-10-09 10:39:21 -05:00
export enum TankPriceType {
2026-03-31 13:35:47 -05:00
TANK_PRICE_TYPE_CREDITS = 0,
TANK_PRICE_TYPE_GOLD = 1,
2024-10-09 10:39:21 -05:00
}
export function tankPriceTypeFromJSON(object: any): TankPriceType {
switch (object) {
case 0:
2025-10-13 22:26:11 -05:00
case "TANK_PRICE_TYPE_CREDITS":
2026-03-31 13:35:47 -05:00
return TankPriceType.TANK_PRICE_TYPE_CREDITS;
2024-10-09 10:39:21 -05:00
case 1:
2025-10-13 22:26:11 -05:00
case "TANK_PRICE_TYPE_GOLD":
2026-03-31 13:35:47 -05:00
return TankPriceType.TANK_PRICE_TYPE_GOLD;
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType");
2024-10-09 10:39:21 -05:00
}
}
export function tankPriceTypeToJSON(object: TankPriceType): string {
switch (object) {
2026-03-31 13:35:47 -05:00
case TankPriceType.TANK_PRICE_TYPE_CREDITS:
2025-10-13 22:26:11 -05:00
return "TANK_PRICE_TYPE_CREDITS";
2026-03-31 13:35:47 -05:00
case TankPriceType.TANK_PRICE_TYPE_GOLD:
2025-10-13 22:26:11 -05:00
return "TANK_PRICE_TYPE_GOLD";
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType");
2024-10-09 10:39:21 -05:00
}
}
export enum ShellType {
2026-03-31 13:35:47 -05:00
SHELL_TYPE_AP = 0,
SHELL_TYPE_APCR = 1,
SHELL_TYPE_HEAT = 2,
SHELL_TYPE_HE = 3,
2024-10-09 10:39:21 -05:00
}
export function shellTypeFromJSON(object: any): ShellType {
switch (object) {
case 0:
2025-10-13 22:26:11 -05:00
case "SHELL_TYPE_AP":
2026-03-31 13:35:47 -05:00
return ShellType.SHELL_TYPE_AP;
2024-10-09 10:39:21 -05:00
case 1:
2025-10-13 22:26:11 -05:00
case "SHELL_TYPE_APCR":
2026-03-31 13:35:47 -05:00
return ShellType.SHELL_TYPE_APCR;
2024-10-09 10:39:21 -05:00
case 2:
2025-10-13 22:26:11 -05:00
case "SHELL_TYPE_HEAT":
2026-03-31 13:35:47 -05:00
return ShellType.SHELL_TYPE_HEAT;
2024-10-09 10:39:21 -05:00
case 3:
2025-10-13 22:26:11 -05:00
case "SHELL_TYPE_HE":
2026-03-31 13:35:47 -05:00
return ShellType.SHELL_TYPE_HE;
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType");
2024-10-09 10:39:21 -05:00
}
}
export function shellTypeToJSON(object: ShellType): string {
switch (object) {
2026-03-31 13:35:47 -05:00
case ShellType.SHELL_TYPE_AP:
2025-10-13 22:26:11 -05:00
return "SHELL_TYPE_AP";
2026-03-31 13:35:47 -05:00
case ShellType.SHELL_TYPE_APCR:
2025-10-13 22:26:11 -05:00
return "SHELL_TYPE_APCR";
2026-03-31 13:35:47 -05:00
case ShellType.SHELL_TYPE_HEAT:
2025-10-13 22:26:11 -05:00
return "SHELL_TYPE_HEAT";
2026-03-31 13:35:47 -05:00
case ShellType.SHELL_TYPE_HE:
2025-10-13 22:26:11 -05:00
return "SHELL_TYPE_HE";
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType");
2024-10-09 10:39:21 -05:00
}
}
export enum ModuleType {
2026-03-31 13:35:47 -05:00
MODULE_TYPE_VEHICLE = 0,
MODULE_TYPE_ENGINE = 1,
MODULE_TYPE_TRACKS = 2,
MODULE_TYPE_TURRET = 3,
MODULE_TYPE_GUN = 4,
2024-10-09 10:39:21 -05:00
}
export function moduleTypeFromJSON(object: any): ModuleType {
switch (object) {
case 0:
2025-10-13 22:26:11 -05:00
case "MODULE_TYPE_VEHICLE":
2026-03-31 13:35:47 -05:00
return ModuleType.MODULE_TYPE_VEHICLE;
2024-10-09 10:39:21 -05:00
case 1:
2025-10-13 22:26:11 -05:00
case "MODULE_TYPE_ENGINE":
2026-03-31 13:35:47 -05:00
return ModuleType.MODULE_TYPE_ENGINE;
2024-10-09 10:39:21 -05:00
case 2:
2025-10-13 22:26:11 -05:00
case "MODULE_TYPE_TRACKS":
2026-03-31 13:35:47 -05:00
return ModuleType.MODULE_TYPE_TRACKS;
2024-10-09 10:39:21 -05:00
case 3:
2025-10-13 22:26:11 -05:00
case "MODULE_TYPE_TURRET":
2026-03-31 13:35:47 -05:00
return ModuleType.MODULE_TYPE_TURRET;
2024-10-09 10:39:21 -05:00
case 4:
2025-10-13 22:26:11 -05:00
case "MODULE_TYPE_GUN":
2026-03-31 13:35:47 -05:00
return ModuleType.MODULE_TYPE_GUN;
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType");
2024-10-09 10:39:21 -05:00
}
}
export function moduleTypeToJSON(object: ModuleType): string {
switch (object) {
2026-03-31 13:35:47 -05:00
case ModuleType.MODULE_TYPE_VEHICLE:
2025-10-13 22:26:11 -05:00
return "MODULE_TYPE_VEHICLE";
2026-03-31 13:35:47 -05:00
case ModuleType.MODULE_TYPE_ENGINE:
2025-10-13 22:26:11 -05:00
return "MODULE_TYPE_ENGINE";
2026-03-31 13:35:47 -05:00
case ModuleType.MODULE_TYPE_TRACKS:
2025-10-13 22:26:11 -05:00
return "MODULE_TYPE_TRACKS";
2026-03-31 13:35:47 -05:00
case ModuleType.MODULE_TYPE_TURRET:
2025-10-13 22:26:11 -05:00
return "MODULE_TYPE_TURRET";
2026-03-31 13:35:47 -05:00
case ModuleType.MODULE_TYPE_GUN:
2025-10-13 22:26:11 -05:00
return "MODULE_TYPE_GUN";
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType");
2024-10-09 10:39:21 -05:00
}
}
export enum TankClass {
2026-03-31 13:35:47 -05:00
TANK_CLASS_LIGHT = 0,
TANK_CLASS_MEDIUM = 1,
TANK_CLASS_HEAVY = 2,
TANK_CLASS_TANK_DESTROYER = 3,
2024-10-09 10:39:21 -05:00
}
export function tankClassFromJSON(object: any): TankClass {
switch (object) {
case 0:
2025-10-13 22:26:11 -05:00
case "TANK_CLASS_LIGHT":
2026-03-31 13:35:47 -05:00
return TankClass.TANK_CLASS_LIGHT;
2024-10-09 10:39:21 -05:00
case 1:
2025-10-13 22:26:11 -05:00
case "TANK_CLASS_MEDIUM":
2026-03-31 13:35:47 -05:00
return TankClass.TANK_CLASS_MEDIUM;
2024-10-09 10:39:21 -05:00
case 2:
2025-10-13 22:26:11 -05:00
case "TANK_CLASS_HEAVY":
2026-03-31 13:35:47 -05:00
return TankClass.TANK_CLASS_HEAVY;
2024-10-09 10:39:21 -05:00
case 3:
2025-10-13 22:26:11 -05:00
case "TANK_CLASS_TANK_DESTROYER":
2026-03-31 13:35:47 -05:00
return TankClass.TANK_CLASS_TANK_DESTROYER;
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass");
2024-10-09 10:39:21 -05:00
}
}
export function tankClassToJSON(object: TankClass): string {
switch (object) {
2026-03-31 13:35:47 -05:00
case TankClass.TANK_CLASS_LIGHT:
2025-10-13 22:26:11 -05:00
return "TANK_CLASS_LIGHT";
2026-03-31 13:35:47 -05:00
case TankClass.TANK_CLASS_MEDIUM:
2025-10-13 22:26:11 -05:00
return "TANK_CLASS_MEDIUM";
2026-03-31 13:35:47 -05:00
case TankClass.TANK_CLASS_HEAVY:
2025-10-13 22:26:11 -05:00
return "TANK_CLASS_HEAVY";
2026-03-31 13:35:47 -05:00
case TankClass.TANK_CLASS_TANK_DESTROYER:
2025-10-13 22:26:11 -05:00
return "TANK_CLASS_TANK_DESTROYER";
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass");
2024-10-09 10:39:21 -05:00
}
}
export enum TankType {
2026-03-31 13:35:47 -05:00
TANK_TYPE_RESEARCHABLE = 0,
TANK_TYPE_PREMIUM = 1,
TANK_TYPE_COLLECTOR = 2,
2024-10-09 10:39:21 -05:00
}
export function tankTypeFromJSON(object: any): TankType {
switch (object) {
case 0:
2025-10-13 22:26:11 -05:00
case "TANK_TYPE_RESEARCHABLE":
2026-03-31 13:35:47 -05:00
return TankType.TANK_TYPE_RESEARCHABLE;
2024-10-09 10:39:21 -05:00
case 1:
2025-10-13 22:26:11 -05:00
case "TANK_TYPE_PREMIUM":
2026-03-31 13:35:47 -05:00
return TankType.TANK_TYPE_PREMIUM;
2024-10-09 10:39:21 -05:00
case 2:
2025-10-13 22:26:11 -05:00
case "TANK_TYPE_COLLECTOR":
2026-03-31 13:35:47 -05:00
return TankType.TANK_TYPE_COLLECTOR;
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType");
2024-10-09 10:39:21 -05:00
}
}
export function tankTypeToJSON(object: TankType): string {
switch (object) {
2026-03-31 13:35:47 -05:00
case TankType.TANK_TYPE_RESEARCHABLE:
2025-10-13 22:26:11 -05:00
return "TANK_TYPE_RESEARCHABLE";
2026-03-31 13:35:47 -05:00
case TankType.TANK_TYPE_PREMIUM:
2025-10-13 22:26:11 -05:00
return "TANK_TYPE_PREMIUM";
2026-03-31 13:35:47 -05:00
case TankType.TANK_TYPE_COLLECTOR:
2025-10-13 22:26:11 -05:00
return "TANK_TYPE_COLLECTOR";
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType");
2024-10-09 10:39:21 -05:00
}
}
export enum CrewType {
2026-03-31 13:35:47 -05:00
CREW_TYPE_COMMANDER = 0,
CREW_TYPE_RADIOMAN = 1,
CREW_TYPE_GUNNER = 2,
CREW_TYPE_DRIVER = 3,
CREW_TYPE_LOADER = 4,
2024-10-09 10:39:21 -05:00
}
export function crewTypeFromJSON(object: any): CrewType {
switch (object) {
case 0:
2025-10-13 22:26:11 -05:00
case "CREW_TYPE_COMMANDER":
2026-03-31 13:35:47 -05:00
return CrewType.CREW_TYPE_COMMANDER;
2024-10-09 10:39:21 -05:00
case 1:
2025-10-13 22:26:11 -05:00
case "CREW_TYPE_RADIOMAN":
2026-03-31 13:35:47 -05:00
return CrewType.CREW_TYPE_RADIOMAN;
2024-10-09 10:39:21 -05:00
case 2:
2025-10-13 22:26:11 -05:00
case "CREW_TYPE_GUNNER":
2026-03-31 13:35:47 -05:00
return CrewType.CREW_TYPE_GUNNER;
2024-10-09 10:39:21 -05:00
case 3:
2025-10-13 22:26:11 -05:00
case "CREW_TYPE_DRIVER":
2026-03-31 13:35:47 -05:00
return CrewType.CREW_TYPE_DRIVER;
2024-10-09 10:39:21 -05:00
case 4:
2025-10-13 22:26:11 -05:00
case "CREW_TYPE_LOADER":
2026-03-31 13:35:47 -05:00
return CrewType.CREW_TYPE_LOADER;
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType");
2024-10-09 10:39:21 -05:00
}
}
export function crewTypeToJSON(object: CrewType): string {
switch (object) {
2026-03-31 13:35:47 -05:00
case CrewType.CREW_TYPE_COMMANDER:
2025-10-13 22:26:11 -05:00
return "CREW_TYPE_COMMANDER";
2026-03-31 13:35:47 -05:00
case CrewType.CREW_TYPE_RADIOMAN:
2025-10-13 22:26:11 -05:00
return "CREW_TYPE_RADIOMAN";
2026-03-31 13:35:47 -05:00
case CrewType.CREW_TYPE_GUNNER:
2025-10-13 22:26:11 -05:00
return "CREW_TYPE_GUNNER";
2026-03-31 13:35:47 -05:00
case CrewType.CREW_TYPE_DRIVER:
2025-10-13 22:26:11 -05:00
return "CREW_TYPE_DRIVER";
2026-03-31 13:35:47 -05:00
case CrewType.CREW_TYPE_LOADER:
2025-10-13 22:26:11 -05:00
return "CREW_TYPE_LOADER";
2024-10-09 10:39:21 -05:00
default:
2026-03-31 13:35:47 -05:00
throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType");
2024-10-09 10:39:21 -05:00
}
}
export interface TankDefinitions {
tanks: { [key: number]: TankDefinition };
}
export interface TankDefinitions_TanksEntry {
key: number;
2026-03-31 13:35:47 -05:00
value: TankDefinition | undefined;
2024-10-09 10:39:21 -05:00
}
export interface TankDefinition {
id: number;
2025-05-16 19:14:56 -05:00
slug: string;
2026-09-23 16:31:35 -05:00
roles: { [key: string]: number };
2024-10-09 10:39:21 -05:00
fixed_camouflage: boolean;
camouflages: number[];
ancestors: number[];
successors: number[];
crew: Crew[];
health: number;
nation: string;
2026-03-31 13:35:47 -05:00
name: I18nString | undefined;
2024-10-09 10:39:21 -05:00
type: TankType;
max_consumables: number;
max_provisions: number;
2024-11-20 10:21:17 -06:00
tier: number;
2024-10-09 10:39:21 -05:00
class: TankClass;
testing: boolean;
deprecated: boolean;
turrets: TurretDefinition[];
engines: EngineDefinition[];
tracks: TrackDefinition[];
2026-03-31 13:35:47 -05:00
price: TankPrice | undefined;
research_cost?: ResearchCost | undefined;
2024-10-09 10:39:21 -05:00
speed_forwards: number;
speed_backwards: number;
camouflage_still: number;
camouflage_moving: number;
2026-03-31 13:35:47 -05:00
camouflage_on_fire: number;
2024-10-09 10:39:21 -05:00
equipment_preset: string;
weight: number;
2026-03-25 02:09:07 +01:00
dev_name: string;
2026-04-03 11:47:58 -05:00
equalizer?: Equalizer | undefined;
name_full?: I18nString | undefined;
2024-10-09 10:39:21 -05:00
}
export interface TankDefinition_RolesEntry {
2026-09-23 16:31:35 -05:00
key: string;
2024-10-09 10:39:21 -05:00
value: number;
}
2026-04-03 11:10:45 -05:00
export interface Equalizer {
health: number;
penetration: number;
module_health: number;
damage: number;
armor: number;
}
2024-10-09 10:39:21 -05:00
export interface ResearchCost {
research_cost_type?:
2025-10-13 22:26:11 -05:00
| { $case: "xp"; value: number }
2026-03-31 13:35:47 -05:00
| { $case: "seasonal_tokens"; value: ResearchCostSeasonalTokens }
| undefined;
2024-10-09 10:39:21 -05:00
}
export interface ResearchCostSeasonalTokens {
season: number;
tokens: number;
}
export interface TankPrice {
type: TankPriceType;
value: number;
}
export interface TrackDefinition {
id: number;
2024-11-20 10:21:17 -06:00
tier: number;
2026-03-31 13:35:47 -05:00
name: I18nString | undefined;
2024-10-09 10:39:21 -05:00
weight: number;
traverse_speed: number;
2026-03-31 13:35:47 -05:00
research_cost?: ResearchCost | undefined;
2024-10-09 10:39:21 -05:00
dispersion_move: number;
dispersion_traverse: number;
resistance_hard: number;
resistance_medium: number;
resistance_soft: number;
unlocks: Unlock[];
}
export interface EngineDefinition {
id: number;
2026-03-31 13:35:47 -05:00
name: I18nString | undefined;
research_cost?: ResearchCost | undefined;
2024-11-20 10:21:17 -06:00
tier: number;
2024-10-09 10:39:21 -05:00
fire_chance: number;
power: number;
weight: number;
unlocks: Unlock[];
}
export interface TurretDefinition {
id: number;
health: number;
view_range: number;
traverse_speed: number;
2026-03-31 13:35:47 -05:00
research_cost?: ResearchCost | undefined;
name: I18nString | undefined;
2024-11-20 10:21:17 -06:00
tier: number;
2024-10-09 10:39:21 -05:00
weight: number;
guns: GunDefinition[];
unlocks: Unlock[];
}
export interface GunDefinition {
gun_type?:
2025-10-13 22:26:11 -05:00
| { $case: "regular"; value: GunDefinitionRegular }
| { $case: "auto_loader"; value: GunDefinitionAutoLoader }
2026-03-31 13:35:47 -05:00
| { $case: "auto_reloader"; value: GunDefinitionAutoReloader }
| undefined;
2024-10-09 10:39:21 -05:00
id: number;
rotation_speed: number;
2026-03-31 13:35:47 -05:00
research_cost?: ResearchCost | undefined;
2024-10-09 10:39:21 -05:00
weight: number;
2026-03-31 13:35:47 -05:00
name: I18nString | undefined;
2024-11-20 10:21:17 -06:00
tier: number;
2024-10-09 10:39:21 -05:00
shells: ShellDefinition[];
camouflage_loss: number;
aim_time: number;
dispersion_base: number;
dispersion_traverse: number;
dispersion_shot: number;
dispersion_damaged: number;
unlocks: Unlock[];
2024-11-09 19:16:06 -06:00
shell_capacity: number;
2026-03-31 13:35:47 -05:00
assault_ranges?: AssaultRanges | undefined;
burst?: Burst | undefined;
2025-08-18 12:06:14 -05:00
}
export interface GunDefinitionRegular {
reload: number;
}
export interface GunDefinitionAutoLoader {
clip_reload: number;
intra_clip: number;
shell_count: number;
}
export interface Burst {
count: number;
interval: number;
}
export interface GunDefinitionAutoReloader {
shell_reloads: number[];
intra_clip: number;
shell_count: number;
2025-07-31 13:44:14 -05:00
}
export interface AssaultRanges {
ranges: AssaultRange[];
2025-07-31 14:12:14 -05:00
types: ShellType[];
2025-07-31 13:44:14 -05:00
}
export interface AssaultRange {
distance: number;
factor: number;
2024-10-09 10:39:21 -05:00
}
export interface ShellDefinition {
id: number;
2026-03-31 13:35:47 -05:00
name: I18nString | undefined;
2024-10-09 10:39:21 -05:00
velocity: number;
armor_damage: number;
module_damage: number;
caliber: number;
icon: string;
2026-03-31 13:35:47 -05:00
penetration: ShellPenetration | undefined;
2024-10-09 10:39:21 -05:00
type: ShellType;
2026-03-31 13:35:47 -05:00
normalization?: number | undefined;
ricochet?: number | undefined;
explosion_radius?: number | undefined;
2024-11-09 12:55:39 -06:00
range: number;
2024-10-09 10:39:21 -05:00
}
export interface ShellPenetration {
near: number;
far: number;
}
export interface Unlock {
id: number;
type: ModuleType;
2026-03-31 13:35:47 -05:00
cost: UnlockCost | undefined;
2024-10-09 10:39:21 -05:00
}
export interface UnlockCost {
type: string;
value: number;
}
export interface Crew {
type: CrewType;
count: number;
substitute: CrewType[];
}
2025-07-31 13:44:14 -05:00
function createBaseTankDefinitions(): TankDefinitions {
2024-10-09 10:39:21 -05:00
return { tanks: {} };
}
export const TankDefinitions: MessageFns<TankDefinitions> = {
2026-03-31 13:35:47 -05:00
encode(message: TankDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2026-09-23 16:31:35 -05:00
Object.entries(message.tanks).forEach(([key, value]) => {
2026-03-31 13:35:47 -05:00
TankDefinitions_TanksEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
2024-10-09 10:39:21 -05:00
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseTankDefinitions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
2026-03-31 13:35:47 -05:00
const entry1 = TankDefinitions_TanksEntry.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
if (entry1.value !== undefined) {
message.tanks[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankDefinitions {
return {
tanks: isObject(object.tanks)
2026-09-23 16:31:35 -05:00
? Object.entries(object.tanks).reduce<{ [key: number]: TankDefinition }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = TankDefinition.fromJSON(value);
return acc;
}, {})
2024-10-09 10:39:21 -05:00
: {},
};
},
toJSON(message: TankDefinitions): unknown {
const obj: any = {};
if (message.tanks) {
2026-09-23 16:31:35 -05:00
const entries = Object.entries(message.tanks);
2024-10-09 10:39:21 -05:00
if (entries.length > 0) {
obj.tanks = {};
entries.forEach(([k, v]) => {
obj.tanks[k] = TankDefinition.toJSON(v);
});
}
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<TankDefinitions>, I>>(base?: I): TankDefinitions {
2024-10-09 10:39:21 -05:00
return TankDefinitions.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<TankDefinitions>, I>>(object: I): TankDefinitions {
2024-10-09 10:39:21 -05:00
const message = createBaseTankDefinitions();
2026-09-23 16:31:35 -05:00
message.tanks = Object.entries(object.tanks ?? {}).reduce<{ [key: number]: TankDefinition }>(
(acc, [key, value]) => {
2026-03-31 13:35:47 -05:00
if (value !== undefined) {
acc[globalThis.Number(key)] = TankDefinition.fromPartial(value);
}
return acc;
},
{},
);
2024-10-09 10:39:21 -05:00
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry {
return { key: 0, value: undefined };
2024-10-09 10:39:21 -05:00
}
2026-03-31 13:35:47 -05:00
export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry> = {
encode(message: TankDefinitions_TanksEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== 0) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
TankDefinition.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
2025-05-16 19:14:56 -05:00
2026-03-31 13:35:47 -05:00
decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions_TanksEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankDefinitions_TanksEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
2025-07-31 14:07:21 -05:00
}
2025-05-21 13:24:02 -05:00
2026-03-31 13:35:47 -05:00
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
2025-07-31 14:07:21 -05:00
}
2026-03-31 13:35:47 -05:00
message.value = TankDefinition.decode(reader, reader.uint32());
continue;
2025-07-31 14:07:21 -05:00
}
}
2026-03-31 13:35:47 -05:00
if ((tag & 7) === 4 || tag === 0) {
break;
2025-07-31 14:07:21 -05:00
}
2026-03-31 13:35:47 -05:00
reader.skip(tag & 7);
}
return message;
},
2025-07-31 14:07:21 -05:00
2026-03-31 13:35:47 -05:00
fromJSON(object: any): TankDefinitions_TanksEntry {
return {
key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: isSet(object.value) ? TankDefinition.fromJSON(object.value) : undefined,
};
},
toJSON(message: TankDefinitions_TanksEntry): unknown {
const obj: any = {};
if (message.key !== 0) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = TankDefinition.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<TankDefinitions_TanksEntry>, I>>(base?: I): TankDefinitions_TanksEntry {
return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankDefinitions_TanksEntry>, I>>(object: I): TankDefinitions_TanksEntry {
const message = createBaseTankDefinitions_TanksEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? TankDefinition.fromPartial(object.value)
: undefined;
return message;
},
};
2025-05-21 13:24:02 -05:00
2025-07-31 13:44:14 -05:00
function createBaseTankDefinition(): TankDefinition {
2024-10-09 10:39:21 -05:00
return {
id: 0,
2025-10-13 22:26:11 -05:00
slug: "",
2024-10-09 10:39:21 -05:00
roles: {},
fixed_camouflage: false,
camouflages: [],
ancestors: [],
successors: [],
crew: [],
health: 0,
2025-10-13 22:26:11 -05:00
nation: "",
2025-07-31 13:44:14 -05:00
name: undefined,
2024-10-09 10:39:21 -05:00
type: 0,
max_consumables: 0,
max_provisions: 0,
tier: 0,
class: 0,
testing: false,
deprecated: false,
turrets: [],
engines: [],
tracks: [],
2025-07-31 13:44:14 -05:00
price: undefined,
2024-10-09 10:39:21 -05:00
research_cost: undefined,
speed_forwards: 0,
speed_backwards: 0,
camouflage_still: 0,
camouflage_moving: 0,
2026-03-31 13:35:47 -05:00
camouflage_on_fire: 0,
2025-10-13 22:26:11 -05:00
equipment_preset: "",
2024-10-09 10:39:21 -05:00
weight: 0,
2026-03-25 02:09:07 +01:00
dev_name: "",
2026-04-03 11:10:45 -05:00
equalizer: undefined,
name_full: undefined,
2024-10-09 10:39:21 -05:00
};
}
export const TankDefinition: MessageFns<TankDefinition> = {
2026-03-31 13:35:47 -05:00
encode(message: TankDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
2025-10-13 22:26:11 -05:00
if (message.slug !== "") {
2025-05-16 19:14:56 -05:00
writer.uint32(18).string(message.slug);
}
2026-09-23 16:31:35 -05:00
Object.entries(message.roles).forEach(([key, value]) => {
2026-03-31 13:35:47 -05:00
TankDefinition_RolesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
2024-10-09 10:39:21 -05:00
});
if (message.fixed_camouflage !== false) {
2025-05-16 19:14:56 -05:00
writer.uint32(40).bool(message.fixed_camouflage);
2024-10-09 10:39:21 -05:00
}
for (const v of message.camouflages) {
2026-03-31 13:35:47 -05:00
writer.uint32(48).int32(v!);
2024-10-09 10:39:21 -05:00
}
for (const v of message.ancestors) {
2026-03-31 13:35:47 -05:00
writer.uint32(56).int32(v!);
2024-10-09 10:39:21 -05:00
}
for (const v of message.successors) {
2026-03-31 13:35:47 -05:00
writer.uint32(64).int32(v!);
2024-10-09 10:39:21 -05:00
}
for (const v of message.crew) {
2025-05-16 19:14:56 -05:00
Crew.encode(v!, writer.uint32(74).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.health !== 0) {
2025-05-16 19:14:56 -05:00
writer.uint32(80).uint32(message.health);
2024-10-09 10:39:21 -05:00
}
2025-10-13 22:26:11 -05:00
if (message.nation !== "") {
2025-05-16 19:14:56 -05:00
writer.uint32(90).string(message.nation);
2024-10-09 10:39:21 -05:00
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
2025-05-16 19:14:56 -05:00
I18nString.encode(message.name, writer.uint32(98).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.type !== 0) {
writer.uint32(104).int32(message.type);
}
if (message.max_consumables !== 0) {
writer.uint32(112).uint32(message.max_consumables);
}
if (message.max_provisions !== 0) {
writer.uint32(120).uint32(message.max_provisions);
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
writer.uint32(128).uint32(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.class !== 0) {
writer.uint32(136).int32(message.class);
}
if (message.testing !== false) {
writer.uint32(144).bool(message.testing);
}
if (message.deprecated !== false) {
writer.uint32(152).bool(message.deprecated);
}
for (const v of message.turrets) {
TurretDefinition.encode(v!, writer.uint32(162).fork()).join();
}
for (const v of message.engines) {
EngineDefinition.encode(v!, writer.uint32(170).fork()).join();
}
for (const v of message.tracks) {
TrackDefinition.encode(v!, writer.uint32(178).fork()).join();
}
if (message.price !== undefined) {
TankPrice.encode(message.price, writer.uint32(186).fork()).join();
}
if (message.research_cost !== undefined) {
2026-03-31 13:35:47 -05:00
ResearchCost.encode(message.research_cost, writer.uint32(194).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.speed_forwards !== 0) {
writer.uint32(205).float(message.speed_forwards);
}
if (message.speed_backwards !== 0) {
writer.uint32(213).float(message.speed_backwards);
}
if (message.camouflage_still !== 0) {
writer.uint32(221).float(message.camouflage_still);
}
if (message.camouflage_moving !== 0) {
writer.uint32(229).float(message.camouflage_moving);
}
2026-03-31 13:35:47 -05:00
if (message.camouflage_on_fire !== 0) {
writer.uint32(237).float(message.camouflage_on_fire);
2024-10-09 10:39:21 -05:00
}
2025-10-13 22:26:11 -05:00
if (message.equipment_preset !== "") {
2024-10-09 10:39:21 -05:00
writer.uint32(242).string(message.equipment_preset);
}
if (message.weight !== 0) {
writer.uint32(248).uint32(message.weight);
}
2026-03-25 02:09:07 +01:00
if (message.dev_name !== "") {
writer.uint32(258).string(message.dev_name);
}
2026-04-03 11:10:45 -05:00
if (message.equalizer !== undefined) {
Equalizer.encode(message.equalizer, writer.uint32(266).fork()).join();
}
if (message.name_full !== undefined) {
I18nString.encode(message.name_full, writer.uint32(274).fork()).join();
}
2024-10-09 10:39:21 -05:00
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseTankDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
2025-05-16 19:14:56 -05:00
message.slug = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
2026-03-31 13:35:47 -05:00
const entry3 = TankDefinition_RolesEntry.decode(reader, reader.uint32());
2025-05-16 19:14:56 -05:00
if (entry3.value !== undefined) {
message.roles[entry3.key] = entry3.value;
2024-10-09 10:39:21 -05:00
}
continue;
}
2025-05-16 19:14:56 -05:00
case 5: {
if (tag !== 40) {
2024-10-09 10:39:21 -05:00
break;
}
message.fixed_camouflage = reader.bool();
continue;
}
2025-05-16 19:14:56 -05:00
case 6: {
if (tag === 48) {
2024-10-09 10:39:21 -05:00
message.camouflages.push(reader.int32());
continue;
}
2025-05-16 19:14:56 -05:00
if (tag === 50) {
2024-10-09 10:39:21 -05:00
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.camouflages.push(reader.int32());
}
continue;
}
break;
}
2025-05-16 19:14:56 -05:00
case 7: {
if (tag === 56) {
2024-10-09 10:39:21 -05:00
message.ancestors.push(reader.int32());
continue;
}
2025-05-16 19:14:56 -05:00
if (tag === 58) {
2024-10-09 10:39:21 -05:00
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.ancestors.push(reader.int32());
}
continue;
}
break;
}
2025-05-16 19:14:56 -05:00
case 8: {
if (tag === 64) {
2024-10-09 10:39:21 -05:00
message.successors.push(reader.int32());
continue;
}
2025-05-16 19:14:56 -05:00
if (tag === 66) {
2024-10-09 10:39:21 -05:00
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.successors.push(reader.int32());
}
continue;
}
break;
}
2025-05-16 19:14:56 -05:00
case 9: {
if (tag !== 74) {
2024-10-09 10:39:21 -05:00
break;
}
message.crew.push(Crew.decode(reader, reader.uint32()));
continue;
}
2025-05-16 19:14:56 -05:00
case 10: {
if (tag !== 80) {
2024-10-09 10:39:21 -05:00
break;
}
message.health = reader.uint32();
continue;
}
case 11: {
if (tag !== 90) {
break;
}
2025-05-16 19:14:56 -05:00
message.nation = reader.string();
2024-10-09 10:39:21 -05:00
continue;
}
case 12: {
if (tag !== 98) {
break;
}
2025-05-16 19:14:56 -05:00
message.name = I18nString.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
continue;
}
case 13: {
if (tag !== 104) {
break;
}
message.type = reader.int32() as any;
continue;
}
case 14: {
if (tag !== 112) {
break;
}
message.max_consumables = reader.uint32();
continue;
}
case 15: {
if (tag !== 120) {
break;
}
message.max_provisions = reader.uint32();
continue;
}
case 16: {
if (tag !== 128) {
break;
}
2024-11-20 10:21:17 -06:00
message.tier = reader.uint32();
2024-10-09 10:39:21 -05:00
continue;
}
case 17: {
if (tag !== 136) {
break;
}
message.class = reader.int32() as any;
continue;
}
case 18: {
if (tag !== 144) {
break;
}
message.testing = reader.bool();
continue;
}
case 19: {
if (tag !== 152) {
break;
}
message.deprecated = reader.bool();
continue;
}
case 20: {
if (tag !== 162) {
break;
}
2026-03-31 13:35:47 -05:00
message.turrets.push(TurretDefinition.decode(reader, reader.uint32()));
2024-10-09 10:39:21 -05:00
continue;
}
case 21: {
if (tag !== 170) {
break;
}
2026-03-31 13:35:47 -05:00
message.engines.push(EngineDefinition.decode(reader, reader.uint32()));
2024-10-09 10:39:21 -05:00
continue;
}
case 22: {
if (tag !== 178) {
break;
}
message.tracks.push(TrackDefinition.decode(reader, reader.uint32()));
continue;
}
case 23: {
if (tag !== 186) {
break;
}
message.price = TankPrice.decode(reader, reader.uint32());
continue;
}
case 24: {
if (tag !== 194) {
break;
}
message.research_cost = ResearchCost.decode(reader, reader.uint32());
continue;
}
case 25: {
if (tag !== 205) {
break;
}
message.speed_forwards = reader.float();
continue;
}
case 26: {
if (tag !== 213) {
break;
}
message.speed_backwards = reader.float();
continue;
}
case 27: {
if (tag !== 221) {
break;
}
message.camouflage_still = reader.float();
continue;
}
case 28: {
if (tag !== 229) {
break;
}
message.camouflage_moving = reader.float();
continue;
}
case 29: {
if (tag !== 237) {
break;
}
2026-03-31 13:35:47 -05:00
message.camouflage_on_fire = reader.float();
2024-10-09 10:39:21 -05:00
continue;
}
case 30: {
if (tag !== 242) {
break;
}
message.equipment_preset = reader.string();
continue;
}
case 31: {
if (tag !== 248) {
break;
}
message.weight = reader.uint32();
continue;
}
2026-03-25 02:09:07 +01:00
case 32: {
if (tag !== 258) {
break;
}
message.dev_name = reader.string();
continue;
}
2026-04-03 11:10:45 -05:00
case 33: {
if (tag !== 266) {
break;
}
message.equalizer = Equalizer.decode(reader, reader.uint32());
continue;
}
case 34: {
if (tag !== 274) {
break;
}
message.name_full = I18nString.decode(reader, reader.uint32());
continue;
}
2024-10-09 10:39:21 -05:00
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankDefinition {
return {
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
2025-10-13 22:26:11 -05:00
slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
2024-10-09 10:39:21 -05:00
roles: isObject(object.roles)
2026-09-23 16:31:35 -05:00
? Object.entries(object.roles).reduce<{ [key: string]: number }>((acc, [key, value]) => {
acc[key] = Number(value);
return acc;
}, {})
2024-10-09 10:39:21 -05:00
: {},
2026-09-23 16:31:35 -05:00
fixed_camouflage: isSet(object.fixed_camouflage) ? globalThis.Boolean(object.fixed_camouflage) : false,
2024-10-09 10:39:21 -05:00
camouflages: globalThis.Array.isArray(object?.camouflages)
? object.camouflages.map((e: any) => globalThis.Number(e))
: [],
ancestors: globalThis.Array.isArray(object?.ancestors)
? object.ancestors.map((e: any) => globalThis.Number(e))
: [],
successors: globalThis.Array.isArray(object?.successors)
? object.successors.map((e: any) => globalThis.Number(e))
: [],
2026-09-23 16:31:35 -05:00
crew: globalThis.Array.isArray(object?.crew) ? object.crew.map((e: any) => Crew.fromJSON(e)) : [],
2025-07-31 13:44:14 -05:00
health: isSet(object.health) ? globalThis.Number(object.health) : 0,
2025-10-13 22:26:11 -05:00
nation: isSet(object.nation) ? globalThis.String(object.nation) : "",
2025-07-31 13:44:14 -05:00
name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
type: isSet(object.type) ? tankTypeFromJSON(object.type) : 0,
2026-09-23 16:31:35 -05:00
max_consumables: isSet(object.max_consumables) ? globalThis.Number(object.max_consumables) : 0,
max_provisions: isSet(object.max_provisions) ? globalThis.Number(object.max_provisions) : 0,
2025-07-31 13:44:14 -05:00
tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0,
class: isSet(object.class) ? tankClassFromJSON(object.class) : 0,
2026-03-31 13:35:47 -05:00
testing: isSet(object.testing) ? globalThis.Boolean(object.testing) : false,
deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false,
2024-10-09 10:39:21 -05:00
turrets: globalThis.Array.isArray(object?.turrets)
? object.turrets.map((e: any) => TurretDefinition.fromJSON(e))
: [],
engines: globalThis.Array.isArray(object?.engines)
? object.engines.map((e: any) => EngineDefinition.fromJSON(e))
: [],
tracks: globalThis.Array.isArray(object?.tracks)
? object.tracks.map((e: any) => TrackDefinition.fromJSON(e))
: [],
2025-07-31 13:44:14 -05:00
price: isSet(object.price) ? TankPrice.fromJSON(object.price) : undefined,
2026-09-23 16:31:35 -05:00
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
speed_forwards: isSet(object.speed_forwards) ? globalThis.Number(object.speed_forwards) : 0,
speed_backwards: isSet(object.speed_backwards) ? globalThis.Number(object.speed_backwards) : 0,
camouflage_still: isSet(object.camouflage_still) ? globalThis.Number(object.camouflage_still) : 0,
camouflage_moving: isSet(object.camouflage_moving) ? globalThis.Number(object.camouflage_moving) : 0,
camouflage_on_fire: isSet(object.camouflage_on_fire) ? globalThis.Number(object.camouflage_on_fire) : 0,
equipment_preset: isSet(object.equipment_preset) ? globalThis.String(object.equipment_preset) : "",
2025-07-31 13:44:14 -05:00
weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0,
2026-09-23 16:31:35 -05:00
dev_name: isSet(object.dev_name) ? globalThis.String(object.dev_name) : "",
2026-04-03 11:10:45 -05:00
equalizer: isSet(object.equalizer) ? Equalizer.fromJSON(object.equalizer) : undefined,
name_full: isSet(object.name_full) ? I18nString.fromJSON(object.name_full) : undefined,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: TankDefinition): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
2025-10-13 22:26:11 -05:00
if (message.slug !== "") {
2025-05-16 19:14:56 -05:00
obj.slug = message.slug;
}
2024-10-09 10:39:21 -05:00
if (message.roles) {
2026-09-23 16:31:35 -05:00
const entries = Object.entries(message.roles);
2024-10-09 10:39:21 -05:00
if (entries.length > 0) {
obj.roles = {};
entries.forEach(([k, v]) => {
obj.roles[k] = Math.round(v);
});
}
}
if (message.fixed_camouflage !== false) {
2026-09-23 16:31:35 -05:00
obj.fixed_camouflage = message.fixed_camouflage;
2024-10-09 10:39:21 -05:00
}
if (message.camouflages?.length) {
obj.camouflages = message.camouflages.map((e) => Math.round(e));
}
if (message.ancestors?.length) {
obj.ancestors = message.ancestors.map((e) => Math.round(e));
}
if (message.successors?.length) {
obj.successors = message.successors.map((e) => Math.round(e));
}
if (message.crew?.length) {
obj.crew = message.crew.map((e) => Crew.toJSON(e));
}
if (message.health !== 0) {
obj.health = Math.round(message.health);
}
2025-10-13 22:26:11 -05:00
if (message.nation !== "") {
2024-10-09 10:39:21 -05:00
obj.nation = message.nation;
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
2024-10-09 10:39:21 -05:00
}
if (message.type !== 0) {
obj.type = tankTypeToJSON(message.type);
}
if (message.max_consumables !== 0) {
2026-09-23 16:31:35 -05:00
obj.max_consumables = Math.round(message.max_consumables);
2024-10-09 10:39:21 -05:00
}
if (message.max_provisions !== 0) {
2026-09-23 16:31:35 -05:00
obj.max_provisions = Math.round(message.max_provisions);
2024-10-09 10:39:21 -05:00
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
obj.tier = Math.round(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.class !== 0) {
obj.class = tankClassToJSON(message.class);
}
if (message.testing !== false) {
obj.testing = message.testing;
}
if (message.deprecated !== false) {
obj.deprecated = message.deprecated;
}
if (message.turrets?.length) {
obj.turrets = message.turrets.map((e) => TurretDefinition.toJSON(e));
}
if (message.engines?.length) {
obj.engines = message.engines.map((e) => EngineDefinition.toJSON(e));
}
if (message.tracks?.length) {
obj.tracks = message.tracks.map((e) => TrackDefinition.toJSON(e));
}
if (message.price !== undefined) {
obj.price = TankPrice.toJSON(message.price);
}
if (message.research_cost !== undefined) {
2026-09-23 16:31:35 -05:00
obj.research_cost = ResearchCost.toJSON(message.research_cost);
2024-10-09 10:39:21 -05:00
}
if (message.speed_forwards !== 0) {
2026-09-23 16:31:35 -05:00
obj.speed_forwards = message.speed_forwards;
2024-10-09 10:39:21 -05:00
}
if (message.speed_backwards !== 0) {
2026-09-23 16:31:35 -05:00
obj.speed_backwards = message.speed_backwards;
2024-10-09 10:39:21 -05:00
}
if (message.camouflage_still !== 0) {
2026-09-23 16:31:35 -05:00
obj.camouflage_still = message.camouflage_still;
2024-10-09 10:39:21 -05:00
}
if (message.camouflage_moving !== 0) {
2026-09-23 16:31:35 -05:00
obj.camouflage_moving = message.camouflage_moving;
2024-10-09 10:39:21 -05:00
}
2026-03-31 13:35:47 -05:00
if (message.camouflage_on_fire !== 0) {
2026-09-23 16:31:35 -05:00
obj.camouflage_on_fire = message.camouflage_on_fire;
2024-10-09 10:39:21 -05:00
}
2025-10-13 22:26:11 -05:00
if (message.equipment_preset !== "") {
2026-09-23 16:31:35 -05:00
obj.equipment_preset = message.equipment_preset;
2024-10-09 10:39:21 -05:00
}
if (message.weight !== 0) {
obj.weight = Math.round(message.weight);
}
2026-03-25 02:09:07 +01:00
if (message.dev_name !== "") {
2026-09-23 16:31:35 -05:00
obj.dev_name = message.dev_name;
2026-03-25 02:09:07 +01:00
}
2026-04-03 11:10:45 -05:00
if (message.equalizer !== undefined) {
obj.equalizer = Equalizer.toJSON(message.equalizer);
}
if (message.name_full !== undefined) {
obj.name_full = I18nString.toJSON(message.name_full);
}
2024-10-09 10:39:21 -05:00
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<TankDefinition>, I>>(base?: I): TankDefinition {
2024-10-09 10:39:21 -05:00
return TankDefinition.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<TankDefinition>, I>>(object: I): TankDefinition {
2024-10-09 10:39:21 -05:00
const message = createBaseTankDefinition();
message.id = object.id ?? 0;
2025-10-13 22:26:11 -05:00
message.slug = object.slug ?? "";
2026-09-23 16:31:35 -05:00
message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: string]: number }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.Number(value);
}
return acc;
}, {});
2024-10-09 10:39:21 -05:00
message.fixed_camouflage = object.fixed_camouflage ?? false;
message.camouflages = object.camouflages?.map((e) => e) || [];
message.ancestors = object.ancestors?.map((e) => e) || [];
message.successors = object.successors?.map((e) => e) || [];
message.crew = object.crew?.map((e) => Crew.fromPartial(e)) || [];
message.health = object.health ?? 0;
2025-10-13 22:26:11 -05:00
message.nation = object.nation ?? "";
2026-03-31 13:35:47 -05:00
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: undefined;
2024-10-09 10:39:21 -05:00
message.type = object.type ?? 0;
message.max_consumables = object.max_consumables ?? 0;
message.max_provisions = object.max_provisions ?? 0;
message.tier = object.tier ?? 0;
message.class = object.class ?? 0;
message.testing = object.testing ?? false;
message.deprecated = object.deprecated ?? false;
2026-03-31 13:35:47 -05:00
message.turrets = object.turrets?.map((e) => TurretDefinition.fromPartial(e)) || [];
message.engines = object.engines?.map((e) => EngineDefinition.fromPartial(e)) || [];
message.tracks = object.tracks?.map((e) => TrackDefinition.fromPartial(e)) || [];
message.price = (object.price !== undefined && object.price !== null)
? TankPrice.fromPartial(object.price)
: undefined;
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
? ResearchCost.fromPartial(object.research_cost)
: undefined;
2024-10-09 10:39:21 -05:00
message.speed_forwards = object.speed_forwards ?? 0;
message.speed_backwards = object.speed_backwards ?? 0;
message.camouflage_still = object.camouflage_still ?? 0;
message.camouflage_moving = object.camouflage_moving ?? 0;
2026-03-31 13:35:47 -05:00
message.camouflage_on_fire = object.camouflage_on_fire ?? 0;
2025-10-13 22:26:11 -05:00
message.equipment_preset = object.equipment_preset ?? "";
2024-10-09 10:39:21 -05:00
message.weight = object.weight ?? 0;
2026-03-25 02:09:07 +01:00
message.dev_name = object.dev_name ?? "";
2026-04-03 11:10:45 -05:00
message.equalizer = (object.equalizer !== undefined && object.equalizer !== null)
? Equalizer.fromPartial(object.equalizer)
: undefined;
message.name_full = (object.name_full !== undefined && object.name_full !== null)
? I18nString.fromPartial(object.name_full)
: undefined;
2024-10-09 10:39:21 -05:00
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseTankDefinition_RolesEntry(): TankDefinition_RolesEntry {
2026-09-23 16:31:35 -05:00
return { key: "", value: 0 };
2024-10-09 10:39:21 -05:00
}
2026-03-31 13:35:47 -05:00
export const TankDefinition_RolesEntry: MessageFns<TankDefinition_RolesEntry> = {
encode(message: TankDefinition_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2026-09-23 16:31:35 -05:00
if (message.key !== "") {
writer.uint32(10).string(message.key);
2026-03-31 13:35:47 -05:00
}
if (message.value !== 0) {
writer.uint32(16).uint32(message.value);
}
return writer;
},
2025-05-16 19:14:56 -05:00
2026-03-31 13:35:47 -05:00
decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition_RolesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankDefinition_RolesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
2026-09-23 16:31:35 -05:00
if (tag !== 10) {
2026-03-31 13:35:47 -05:00
break;
2025-07-31 14:07:21 -05:00
}
2025-05-21 13:24:02 -05:00
2026-09-23 16:31:35 -05:00
message.key = reader.string();
2026-03-31 13:35:47 -05:00
continue;
}
case 2: {
if (tag !== 16) {
break;
2025-07-31 14:07:21 -05:00
}
2026-03-31 13:35:47 -05:00
message.value = reader.uint32();
continue;
2025-07-31 14:07:21 -05:00
}
}
2026-03-31 13:35:47 -05:00
if ((tag & 7) === 4 || tag === 0) {
break;
2025-07-31 14:07:21 -05:00
}
2026-03-31 13:35:47 -05:00
reader.skip(tag & 7);
}
return message;
},
2025-07-31 14:07:21 -05:00
2026-03-31 13:35:47 -05:00
fromJSON(object: any): TankDefinition_RolesEntry {
return {
2026-09-23 16:31:35 -05:00
key: isSet(object.key) ? globalThis.String(object.key) : "",
2026-03-31 13:35:47 -05:00
value: isSet(object.value) ? globalThis.Number(object.value) : 0,
};
},
toJSON(message: TankDefinition_RolesEntry): unknown {
const obj: any = {};
2026-09-23 16:31:35 -05:00
if (message.key !== "") {
obj.key = message.key;
2026-03-31 13:35:47 -05:00
}
if (message.value !== 0) {
obj.value = Math.round(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<TankDefinition_RolesEntry>, I>>(base?: I): TankDefinition_RolesEntry {
return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankDefinition_RolesEntry>, I>>(object: I): TankDefinition_RolesEntry {
const message = createBaseTankDefinition_RolesEntry();
2026-09-23 16:31:35 -05:00
message.key = object.key ?? "";
2026-03-31 13:35:47 -05:00
message.value = object.value ?? 0;
return message;
},
};
2025-05-21 13:24:02 -05:00
2026-04-03 11:10:45 -05:00
function createBaseEqualizer(): Equalizer {
return { health: 0, penetration: 0, module_health: 0, damage: 0, armor: 0 };
}
export const Equalizer: MessageFns<Equalizer> = {
encode(message: Equalizer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.health !== 0) {
writer.uint32(13).float(message.health);
}
if (message.penetration !== 0) {
writer.uint32(21).float(message.penetration);
}
if (message.module_health !== 0) {
writer.uint32(29).float(message.module_health);
}
if (message.damage !== 0) {
writer.uint32(37).float(message.damage);
}
if (message.armor !== 0) {
writer.uint32(45).float(message.armor);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Equalizer {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEqualizer();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.health = reader.float();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.penetration = reader.float();
continue;
}
case 3: {
if (tag !== 29) {
break;
}
message.module_health = reader.float();
continue;
}
case 4: {
if (tag !== 37) {
break;
}
message.damage = reader.float();
continue;
}
case 5: {
if (tag !== 45) {
break;
}
message.armor = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Equalizer {
return {
health: isSet(object.health) ? globalThis.Number(object.health) : 0,
penetration: isSet(object.penetration) ? globalThis.Number(object.penetration) : 0,
2026-09-23 16:31:35 -05:00
module_health: isSet(object.module_health) ? globalThis.Number(object.module_health) : 0,
2026-04-03 11:10:45 -05:00
damage: isSet(object.damage) ? globalThis.Number(object.damage) : 0,
armor: isSet(object.armor) ? globalThis.Number(object.armor) : 0,
};
},
toJSON(message: Equalizer): unknown {
const obj: any = {};
if (message.health !== 0) {
obj.health = message.health;
}
if (message.penetration !== 0) {
obj.penetration = message.penetration;
}
if (message.module_health !== 0) {
2026-09-23 16:31:35 -05:00
obj.module_health = message.module_health;
2026-04-03 11:10:45 -05:00
}
if (message.damage !== 0) {
obj.damage = message.damage;
}
if (message.armor !== 0) {
obj.armor = message.armor;
}
return obj;
},
create<I extends Exact<DeepPartial<Equalizer>, I>>(base?: I): Equalizer {
return Equalizer.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Equalizer>, I>>(object: I): Equalizer {
const message = createBaseEqualizer();
message.health = object.health ?? 0;
message.penetration = object.penetration ?? 0;
message.module_health = object.module_health ?? 0;
message.damage = object.damage ?? 0;
message.armor = object.armor ?? 0;
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseResearchCost(): ResearchCost {
2024-10-09 10:39:21 -05:00
return { research_cost_type: undefined };
}
export const ResearchCost: MessageFns<ResearchCost> = {
2026-03-31 13:35:47 -05:00
encode(message: ResearchCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
switch (message.research_cost_type?.$case) {
2025-10-13 22:26:11 -05:00
case "xp":
2024-10-09 10:39:21 -05:00
writer.uint32(8).uint32(message.research_cost_type.value);
break;
2025-10-13 22:26:11 -05:00
case "seasonal_tokens":
2026-03-31 13:35:47 -05:00
ResearchCostSeasonalTokens.encode(message.research_cost_type.value, writer.uint32(18).fork()).join();
2024-10-09 10:39:21 -05:00
break;
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ResearchCost {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseResearchCost();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
2025-10-13 22:26:11 -05:00
message.research_cost_type = { $case: "xp", value: reader.uint32() };
2024-10-09 10:39:21 -05:00
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.research_cost_type = {
2025-10-13 22:26:11 -05:00
$case: "seasonal_tokens",
2024-10-09 10:39:21 -05:00
value: ResearchCostSeasonalTokens.decode(reader, reader.uint32()),
};
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ResearchCost {
return {
research_cost_type: isSet(object.xp)
2025-10-13 22:26:11 -05:00
? { $case: "xp", value: globalThis.Number(object.xp) }
2024-10-09 10:39:21 -05:00
: isSet(object.seasonal_tokens)
2026-03-31 13:35:47 -05:00
? { $case: "seasonal_tokens", value: ResearchCostSeasonalTokens.fromJSON(object.seasonal_tokens) }
: undefined,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: ResearchCost): unknown {
const obj: any = {};
2025-10-13 22:26:11 -05:00
if (message.research_cost_type?.$case === "xp") {
2024-10-09 10:39:21 -05:00
obj.xp = Math.round(message.research_cost_type.value);
2026-03-31 13:35:47 -05:00
} else if (message.research_cost_type?.$case === "seasonal_tokens") {
2026-09-23 16:31:35 -05:00
obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON(message.research_cost_type.value);
2024-10-09 10:39:21 -05:00
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<ResearchCost>, I>>(base?: I): ResearchCost {
2024-10-09 10:39:21 -05:00
return ResearchCost.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<ResearchCost>, I>>(object: I): ResearchCost {
2024-10-09 10:39:21 -05:00
const message = createBaseResearchCost();
2026-03-31 13:35:47 -05:00
switch (object.research_cost_type?.$case) {
case "xp": {
if (object.research_cost_type?.value !== undefined && object.research_cost_type?.value !== null) {
message.research_cost_type = { $case: "xp", value: object.research_cost_type.value };
}
break;
}
case "seasonal_tokens": {
if (object.research_cost_type?.value !== undefined && object.research_cost_type?.value !== null) {
message.research_cost_type = {
$case: "seasonal_tokens",
value: ResearchCostSeasonalTokens.fromPartial(object.research_cost_type.value),
};
}
break;
}
2024-10-09 10:39:21 -05:00
}
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseResearchCostSeasonalTokens(): ResearchCostSeasonalTokens {
2024-10-09 10:39:21 -05:00
return { season: 0, tokens: 0 };
}
2026-03-31 13:35:47 -05:00
export const ResearchCostSeasonalTokens: MessageFns<ResearchCostSeasonalTokens> = {
encode(message: ResearchCostSeasonalTokens, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.season !== 0) {
writer.uint32(8).uint32(message.season);
}
if (message.tokens !== 0) {
writer.uint32(16).uint32(message.tokens);
}
return writer;
},
2025-05-16 19:14:56 -05:00
2026-03-31 13:35:47 -05:00
decode(input: BinaryReader | Uint8Array, length?: number): ResearchCostSeasonalTokens {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResearchCostSeasonalTokens();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
2025-07-31 14:07:21 -05:00
}
2025-05-21 13:24:02 -05:00
2026-03-31 13:35:47 -05:00
message.season = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
2025-07-31 14:07:21 -05:00
}
2026-03-31 13:35:47 -05:00
message.tokens = reader.uint32();
continue;
2025-07-31 14:07:21 -05:00
}
}
2026-03-31 13:35:47 -05:00
if ((tag & 7) === 4 || tag === 0) {
break;
2025-07-31 14:07:21 -05:00
}
2026-03-31 13:35:47 -05:00
reader.skip(tag & 7);
}
return message;
},
2025-07-31 14:07:21 -05:00
2026-03-31 13:35:47 -05:00
fromJSON(object: any): ResearchCostSeasonalTokens {
return {
season: isSet(object.season) ? globalThis.Number(object.season) : 0,
tokens: isSet(object.tokens) ? globalThis.Number(object.tokens) : 0,
};
},
toJSON(message: ResearchCostSeasonalTokens): unknown {
const obj: any = {};
if (message.season !== 0) {
obj.season = Math.round(message.season);
}
if (message.tokens !== 0) {
obj.tokens = Math.round(message.tokens);
}
return obj;
},
create<I extends Exact<DeepPartial<ResearchCostSeasonalTokens>, I>>(base?: I): ResearchCostSeasonalTokens {
return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ResearchCostSeasonalTokens>, I>>(object: I): ResearchCostSeasonalTokens {
const message = createBaseResearchCostSeasonalTokens();
message.season = object.season ?? 0;
message.tokens = object.tokens ?? 0;
return message;
},
};
2025-05-21 13:24:02 -05:00
2025-07-31 13:44:14 -05:00
function createBaseTankPrice(): TankPrice {
2024-10-09 10:39:21 -05:00
return { type: 0, value: 0 };
}
export const TankPrice: MessageFns<TankPrice> = {
2026-03-31 13:35:47 -05:00
encode(message: TankPrice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.type !== 0) {
writer.uint32(8).int32(message.type);
}
if (message.value !== 0) {
writer.uint32(16).uint32(message.value);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankPrice {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseTankPrice();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.type = reader.int32() as any;
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.value = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankPrice {
return {
2025-07-31 13:44:14 -05:00
type: isSet(object.type) ? tankPriceTypeFromJSON(object.type) : 0,
value: isSet(object.value) ? globalThis.Number(object.value) : 0,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: TankPrice): unknown {
const obj: any = {};
if (message.type !== 0) {
obj.type = tankPriceTypeToJSON(message.type);
}
if (message.value !== 0) {
obj.value = Math.round(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<TankPrice>, I>>(base?: I): TankPrice {
return TankPrice.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<TankPrice>, I>>(object: I): TankPrice {
2024-10-09 10:39:21 -05:00
const message = createBaseTankPrice();
message.type = object.type ?? 0;
message.value = object.value ?? 0;
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseTrackDefinition(): TrackDefinition {
2024-10-09 10:39:21 -05:00
return {
id: 0,
tier: 0,
2025-07-31 13:44:14 -05:00
name: undefined,
2024-10-09 10:39:21 -05:00
weight: 0,
traverse_speed: 0,
research_cost: undefined,
dispersion_move: 0,
dispersion_traverse: 0,
resistance_hard: 0,
resistance_medium: 0,
resistance_soft: 0,
unlocks: [],
};
}
export const TrackDefinition: MessageFns<TrackDefinition> = {
2026-03-31 13:35:47 -05:00
encode(message: TrackDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
writer.uint32(16).uint32(message.tier);
2024-10-09 10:39:21 -05:00
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(26).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.weight !== 0) {
writer.uint32(32).uint32(message.weight);
}
if (message.traverse_speed !== 0) {
writer.uint32(45).float(message.traverse_speed);
}
if (message.research_cost !== undefined) {
2026-03-31 13:35:47 -05:00
ResearchCost.encode(message.research_cost, writer.uint32(50).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_move !== 0) {
writer.uint32(61).float(message.dispersion_move);
}
if (message.dispersion_traverse !== 0) {
writer.uint32(69).float(message.dispersion_traverse);
}
if (message.resistance_hard !== 0) {
writer.uint32(77).float(message.resistance_hard);
}
if (message.resistance_medium !== 0) {
writer.uint32(85).float(message.resistance_medium);
}
if (message.resistance_soft !== 0) {
writer.uint32(93).float(message.resistance_soft);
}
for (const v of message.unlocks) {
Unlock.encode(v!, writer.uint32(98).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TrackDefinition {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseTrackDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
2024-11-20 10:21:17 -06:00
message.tier = reader.uint32();
2024-10-09 10:39:21 -05:00
continue;
}
case 3: {
if (tag !== 26) {
break;
}
2025-01-14 14:38:41 -06:00
message.name = I18nString.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.weight = reader.uint32();
continue;
}
case 5: {
if (tag !== 45) {
break;
}
message.traverse_speed = reader.float();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.research_cost = ResearchCost.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 61) {
break;
}
message.dispersion_move = reader.float();
continue;
}
case 8: {
if (tag !== 69) {
break;
}
message.dispersion_traverse = reader.float();
continue;
}
case 9: {
if (tag !== 77) {
break;
}
message.resistance_hard = reader.float();
continue;
}
case 10: {
if (tag !== 85) {
break;
}
message.resistance_medium = reader.float();
continue;
}
case 11: {
if (tag !== 93) {
break;
}
message.resistance_soft = reader.float();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.unlocks.push(Unlock.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TrackDefinition {
return {
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0,
name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0,
2026-09-23 16:31:35 -05:00
traverse_speed: isSet(object.traverse_speed) ? globalThis.Number(object.traverse_speed) : 0,
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
dispersion_move: isSet(object.dispersion_move) ? globalThis.Number(object.dispersion_move) : 0,
dispersion_traverse: isSet(object.dispersion_traverse) ? globalThis.Number(object.dispersion_traverse) : 0,
resistance_hard: isSet(object.resistance_hard) ? globalThis.Number(object.resistance_hard) : 0,
resistance_medium: isSet(object.resistance_medium) ? globalThis.Number(object.resistance_medium) : 0,
resistance_soft: isSet(object.resistance_soft) ? globalThis.Number(object.resistance_soft) : 0,
unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [],
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: TrackDefinition): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
obj.tier = Math.round(message.tier);
2024-10-09 10:39:21 -05:00
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
2024-10-09 10:39:21 -05:00
}
if (message.weight !== 0) {
obj.weight = Math.round(message.weight);
}
if (message.traverse_speed !== 0) {
2026-09-23 16:31:35 -05:00
obj.traverse_speed = message.traverse_speed;
2024-10-09 10:39:21 -05:00
}
if (message.research_cost !== undefined) {
2026-09-23 16:31:35 -05:00
obj.research_cost = ResearchCost.toJSON(message.research_cost);
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_move !== 0) {
2026-09-23 16:31:35 -05:00
obj.dispersion_move = message.dispersion_move;
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_traverse !== 0) {
2026-09-23 16:31:35 -05:00
obj.dispersion_traverse = message.dispersion_traverse;
2024-10-09 10:39:21 -05:00
}
if (message.resistance_hard !== 0) {
2026-09-23 16:31:35 -05:00
obj.resistance_hard = message.resistance_hard;
2024-10-09 10:39:21 -05:00
}
if (message.resistance_medium !== 0) {
2026-09-23 16:31:35 -05:00
obj.resistance_medium = message.resistance_medium;
2024-10-09 10:39:21 -05:00
}
if (message.resistance_soft !== 0) {
2026-09-23 16:31:35 -05:00
obj.resistance_soft = message.resistance_soft;
2024-10-09 10:39:21 -05:00
}
if (message.unlocks?.length) {
obj.unlocks = message.unlocks.map((e) => Unlock.toJSON(e));
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<TrackDefinition>, I>>(base?: I): TrackDefinition {
2024-10-09 10:39:21 -05:00
return TrackDefinition.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<TrackDefinition>, I>>(object: I): TrackDefinition {
2024-10-09 10:39:21 -05:00
const message = createBaseTrackDefinition();
message.id = object.id ?? 0;
message.tier = object.tier ?? 0;
2026-03-31 13:35:47 -05:00
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: undefined;
2024-10-09 10:39:21 -05:00
message.weight = object.weight ?? 0;
message.traverse_speed = object.traverse_speed ?? 0;
2026-03-31 13:35:47 -05:00
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
? ResearchCost.fromPartial(object.research_cost)
: undefined;
2024-10-09 10:39:21 -05:00
message.dispersion_move = object.dispersion_move ?? 0;
message.dispersion_traverse = object.dispersion_traverse ?? 0;
message.resistance_hard = object.resistance_hard ?? 0;
message.resistance_medium = object.resistance_medium ?? 0;
message.resistance_soft = object.resistance_soft ?? 0;
message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || [];
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseEngineDefinition(): EngineDefinition {
2025-01-14 14:38:41 -06:00
return {
id: 0,
2025-07-31 13:44:14 -05:00
name: undefined,
2025-01-14 14:38:41 -06:00
research_cost: undefined,
tier: 0,
fire_chance: 0,
power: 0,
weight: 0,
unlocks: [],
};
2024-10-09 10:39:21 -05:00
}
export const EngineDefinition: MessageFns<EngineDefinition> = {
2026-03-31 13:35:47 -05:00
encode(message: EngineDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(18).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.research_cost !== undefined) {
2026-03-31 13:35:47 -05:00
ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
writer.uint32(32).uint32(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.fire_chance !== 0) {
writer.uint32(45).float(message.fire_chance);
}
if (message.power !== 0) {
writer.uint32(48).uint32(message.power);
}
if (message.weight !== 0) {
writer.uint32(56).uint32(message.weight);
}
for (const v of message.unlocks) {
Unlock.encode(v!, writer.uint32(66).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EngineDefinition {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseEngineDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
2025-01-14 14:38:41 -06:00
message.name = I18nString.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.research_cost = ResearchCost.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 32) {
break;
}
2024-11-20 10:21:17 -06:00
message.tier = reader.uint32();
2024-10-09 10:39:21 -05:00
continue;
}
case 5: {
if (tag !== 45) {
break;
}
message.fire_chance = reader.float();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.power = reader.uint32();
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.weight = reader.uint32();
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.unlocks.push(Unlock.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EngineDefinition {
return {
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
2026-09-23 16:31:35 -05:00
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
2025-07-31 13:44:14 -05:00
tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0,
2026-09-23 16:31:35 -05:00
fire_chance: isSet(object.fire_chance) ? globalThis.Number(object.fire_chance) : 0,
2025-07-31 13:44:14 -05:00
power: isSet(object.power) ? globalThis.Number(object.power) : 0,
weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0,
2026-03-31 13:35:47 -05:00
unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [],
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: EngineDefinition): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
2024-10-09 10:39:21 -05:00
}
if (message.research_cost !== undefined) {
2026-09-23 16:31:35 -05:00
obj.research_cost = ResearchCost.toJSON(message.research_cost);
2024-10-09 10:39:21 -05:00
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
obj.tier = Math.round(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.fire_chance !== 0) {
2026-09-23 16:31:35 -05:00
obj.fire_chance = message.fire_chance;
2024-10-09 10:39:21 -05:00
}
if (message.power !== 0) {
obj.power = Math.round(message.power);
}
if (message.weight !== 0) {
obj.weight = Math.round(message.weight);
}
if (message.unlocks?.length) {
obj.unlocks = message.unlocks.map((e) => Unlock.toJSON(e));
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<EngineDefinition>, I>>(base?: I): EngineDefinition {
2024-10-09 10:39:21 -05:00
return EngineDefinition.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<EngineDefinition>, I>>(object: I): EngineDefinition {
2024-10-09 10:39:21 -05:00
const message = createBaseEngineDefinition();
message.id = object.id ?? 0;
2026-03-31 13:35:47 -05:00
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: undefined;
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
? ResearchCost.fromPartial(object.research_cost)
: undefined;
2024-10-09 10:39:21 -05:00
message.tier = object.tier ?? 0;
message.fire_chance = object.fire_chance ?? 0;
message.power = object.power ?? 0;
message.weight = object.weight ?? 0;
message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || [];
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseTurretDefinition(): TurretDefinition {
2024-10-09 10:39:21 -05:00
return {
id: 0,
health: 0,
view_range: 0,
traverse_speed: 0,
research_cost: undefined,
2025-07-31 13:44:14 -05:00
name: undefined,
2024-10-09 10:39:21 -05:00
tier: 0,
weight: 0,
guns: [],
unlocks: [],
};
}
export const TurretDefinition: MessageFns<TurretDefinition> = {
2026-03-31 13:35:47 -05:00
encode(message: TurretDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
if (message.health !== 0) {
writer.uint32(16).uint32(message.health);
}
if (message.view_range !== 0) {
writer.uint32(24).uint32(message.view_range);
}
if (message.traverse_speed !== 0) {
writer.uint32(37).float(message.traverse_speed);
}
if (message.research_cost !== undefined) {
2026-03-31 13:35:47 -05:00
ResearchCost.encode(message.research_cost, writer.uint32(42).fork()).join();
2024-10-09 10:39:21 -05:00
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(50).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
writer.uint32(56).uint32(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.weight !== 0) {
writer.uint32(64).uint32(message.weight);
}
for (const v of message.guns) {
GunDefinition.encode(v!, writer.uint32(74).fork()).join();
}
for (const v of message.unlocks) {
Unlock.encode(v!, writer.uint32(82).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TurretDefinition {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseTurretDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.health = reader.uint32();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.view_range = reader.uint32();
continue;
}
case 4: {
if (tag !== 37) {
break;
}
message.traverse_speed = reader.float();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.research_cost = ResearchCost.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
2025-01-14 14:38:41 -06:00
message.name = I18nString.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
continue;
}
case 7: {
if (tag !== 56) {
break;
}
2024-11-20 10:21:17 -06:00
message.tier = reader.uint32();
2024-10-09 10:39:21 -05:00
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.weight = reader.uint32();
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.guns.push(GunDefinition.decode(reader, reader.uint32()));
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.unlocks.push(Unlock.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TurretDefinition {
return {
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
health: isSet(object.health) ? globalThis.Number(object.health) : 0,
2026-09-23 16:31:35 -05:00
view_range: isSet(object.view_range) ? globalThis.Number(object.view_range) : 0,
traverse_speed: isSet(object.traverse_speed) ? globalThis.Number(object.traverse_speed) : 0,
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
2025-07-31 13:44:14 -05:00
name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0,
weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0,
2026-09-23 16:31:35 -05:00
guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [],
2026-03-31 13:35:47 -05:00
unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [],
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: TurretDefinition): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.health !== 0) {
obj.health = Math.round(message.health);
}
if (message.view_range !== 0) {
2026-09-23 16:31:35 -05:00
obj.view_range = Math.round(message.view_range);
2024-10-09 10:39:21 -05:00
}
if (message.traverse_speed !== 0) {
2026-09-23 16:31:35 -05:00
obj.traverse_speed = message.traverse_speed;
2024-10-09 10:39:21 -05:00
}
if (message.research_cost !== undefined) {
2026-09-23 16:31:35 -05:00
obj.research_cost = ResearchCost.toJSON(message.research_cost);
2024-10-09 10:39:21 -05:00
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
2024-10-09 10:39:21 -05:00
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
obj.tier = Math.round(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.weight !== 0) {
obj.weight = Math.round(message.weight);
}
if (message.guns?.length) {
obj.guns = message.guns.map((e) => GunDefinition.toJSON(e));
}
if (message.unlocks?.length) {
obj.unlocks = message.unlocks.map((e) => Unlock.toJSON(e));
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<TurretDefinition>, I>>(base?: I): TurretDefinition {
2024-10-09 10:39:21 -05:00
return TurretDefinition.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<TurretDefinition>, I>>(object: I): TurretDefinition {
2024-10-09 10:39:21 -05:00
const message = createBaseTurretDefinition();
message.id = object.id ?? 0;
message.health = object.health ?? 0;
message.view_range = object.view_range ?? 0;
message.traverse_speed = object.traverse_speed ?? 0;
2026-03-31 13:35:47 -05:00
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
? ResearchCost.fromPartial(object.research_cost)
: undefined;
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: undefined;
2024-10-09 10:39:21 -05:00
message.tier = object.tier ?? 0;
message.weight = object.weight ?? 0;
message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || [];
message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || [];
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseGunDefinition(): GunDefinition {
2025-08-18 12:06:14 -05:00
return {
gun_type: undefined,
id: 0,
rotation_speed: 0,
research_cost: undefined,
weight: 0,
name: undefined,
tier: 0,
shells: [],
camouflage_loss: 0,
aim_time: 0,
dispersion_base: 0,
dispersion_traverse: 0,
dispersion_shot: 0,
dispersion_damaged: 0,
unlocks: [],
shell_capacity: 0,
assault_ranges: undefined,
burst: undefined,
};
2024-10-09 10:39:21 -05:00
}
export const GunDefinition: MessageFns<GunDefinition> = {
2026-03-31 13:35:47 -05:00
encode(message: GunDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
switch (message.gun_type?.$case) {
2025-10-13 22:26:11 -05:00
case "regular":
2026-03-31 13:35:47 -05:00
GunDefinitionRegular.encode(message.gun_type.value, writer.uint32(10).fork()).join();
2024-10-09 10:39:21 -05:00
break;
2025-10-13 22:26:11 -05:00
case "auto_loader":
2026-03-31 13:35:47 -05:00
GunDefinitionAutoLoader.encode(message.gun_type.value, writer.uint32(18).fork()).join();
2024-10-09 10:39:21 -05:00
break;
2025-10-13 22:26:11 -05:00
case "auto_reloader":
2026-03-31 13:35:47 -05:00
GunDefinitionAutoReloader.encode(message.gun_type.value, writer.uint32(26).fork()).join();
2024-10-09 10:39:21 -05:00
break;
}
2025-08-18 12:06:14 -05:00
if (message.id !== 0) {
writer.uint32(32).uint32(message.id);
}
if (message.rotation_speed !== 0) {
writer.uint32(45).float(message.rotation_speed);
}
if (message.research_cost !== undefined) {
2026-03-31 13:35:47 -05:00
ResearchCost.encode(message.research_cost, writer.uint32(50).fork()).join();
2025-08-18 12:06:14 -05:00
}
if (message.weight !== 0) {
writer.uint32(56).uint32(message.weight);
}
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(66).fork()).join();
}
if (message.tier !== 0) {
writer.uint32(72).uint32(message.tier);
}
for (const v of message.shells) {
ShellDefinition.encode(v!, writer.uint32(82).fork()).join();
}
if (message.camouflage_loss !== 0) {
writer.uint32(93).float(message.camouflage_loss);
}
if (message.aim_time !== 0) {
writer.uint32(101).float(message.aim_time);
}
if (message.dispersion_base !== 0) {
writer.uint32(109).float(message.dispersion_base);
}
if (message.dispersion_traverse !== 0) {
writer.uint32(117).float(message.dispersion_traverse);
}
if (message.dispersion_shot !== 0) {
writer.uint32(125).float(message.dispersion_shot);
}
if (message.dispersion_damaged !== 0) {
writer.uint32(133).float(message.dispersion_damaged);
}
for (const v of message.unlocks) {
Unlock.encode(v!, writer.uint32(138).fork()).join();
}
if (message.shell_capacity !== 0) {
writer.uint32(144).uint32(message.shell_capacity);
}
if (message.assault_ranges !== undefined) {
2026-03-31 13:35:47 -05:00
AssaultRanges.encode(message.assault_ranges, writer.uint32(154).fork()).join();
2025-08-18 12:06:14 -05:00
}
if (message.burst !== undefined) {
Burst.encode(message.burst, writer.uint32(162).fork()).join();
}
2024-10-09 10:39:21 -05:00
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GunDefinition {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseGunDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
2026-03-31 13:35:47 -05:00
message.gun_type = { $case: "regular", value: GunDefinitionRegular.decode(reader, reader.uint32()) };
2024-10-09 10:39:21 -05:00
continue;
}
case 2: {
if (tag !== 18) {
break;
}
2026-03-31 13:35:47 -05:00
message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.decode(reader, reader.uint32()) };
2024-10-09 10:39:21 -05:00
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.gun_type = {
2025-10-13 22:26:11 -05:00
$case: "auto_reloader",
2024-10-09 10:39:21 -05:00
value: GunDefinitionAutoReloader.decode(reader, reader.uint32()),
};
continue;
}
2025-08-18 12:06:14 -05:00
case 4: {
if (tag !== 32) {
break;
}
message.id = reader.uint32();
continue;
}
case 5: {
if (tag !== 45) {
break;
}
message.rotation_speed = reader.float();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.research_cost = ResearchCost.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.weight = reader.uint32();
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.name = I18nString.decode(reader, reader.uint32());
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.tier = reader.uint32();
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.shells.push(ShellDefinition.decode(reader, reader.uint32()));
continue;
}
case 11: {
if (tag !== 93) {
break;
}
message.camouflage_loss = reader.float();
continue;
}
case 12: {
if (tag !== 101) {
break;
}
message.aim_time = reader.float();
continue;
}
case 13: {
if (tag !== 109) {
break;
}
message.dispersion_base = reader.float();
continue;
}
case 14: {
if (tag !== 117) {
break;
}
message.dispersion_traverse = reader.float();
continue;
}
case 15: {
if (tag !== 125) {
break;
}
message.dispersion_shot = reader.float();
continue;
}
case 16: {
if (tag !== 133) {
break;
}
message.dispersion_damaged = reader.float();
continue;
}
case 17: {
if (tag !== 138) {
break;
}
message.unlocks.push(Unlock.decode(reader, reader.uint32()));
continue;
}
case 18: {
if (tag !== 144) {
break;
}
message.shell_capacity = reader.uint32();
continue;
}
case 19: {
if (tag !== 154) {
break;
}
2026-03-31 13:35:47 -05:00
message.assault_ranges = AssaultRanges.decode(reader, reader.uint32());
2025-08-18 12:06:14 -05:00
continue;
}
case 20: {
if (tag !== 162) {
break;
}
message.burst = Burst.decode(reader, reader.uint32());
continue;
}
2024-10-09 10:39:21 -05:00
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): GunDefinition {
return {
gun_type: isSet(object.regular)
2026-03-31 13:35:47 -05:00
? { $case: "regular", value: GunDefinitionRegular.fromJSON(object.regular) }
2024-10-09 10:39:21 -05:00
: isSet(object.auto_loader)
2026-03-31 13:35:47 -05:00
? { $case: "auto_loader", value: GunDefinitionAutoLoader.fromJSON(object.auto_loader) }
: isSet(object.auto_reloader)
? { $case: "auto_reloader", value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader) }
: undefined,
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
2026-09-23 16:31:35 -05:00
rotation_speed: isSet(object.rotation_speed) ? globalThis.Number(object.rotation_speed) : 0,
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
2025-07-31 13:44:14 -05:00
weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0,
name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0,
2024-10-09 10:39:21 -05:00
shells: globalThis.Array.isArray(object?.shells)
? object.shells.map((e: any) => ShellDefinition.fromJSON(e))
: [],
2026-09-23 16:31:35 -05:00
camouflage_loss: isSet(object.camouflage_loss) ? globalThis.Number(object.camouflage_loss) : 0,
aim_time: isSet(object.aim_time) ? globalThis.Number(object.aim_time) : 0,
dispersion_base: isSet(object.dispersion_base) ? globalThis.Number(object.dispersion_base) : 0,
dispersion_traverse: isSet(object.dispersion_traverse) ? globalThis.Number(object.dispersion_traverse) : 0,
dispersion_shot: isSet(object.dispersion_shot) ? globalThis.Number(object.dispersion_shot) : 0,
dispersion_damaged: isSet(object.dispersion_damaged) ? globalThis.Number(object.dispersion_damaged) : 0,
unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [],
shell_capacity: isSet(object.shell_capacity) ? globalThis.Number(object.shell_capacity) : 0,
assault_ranges: isSet(object.assault_ranges) ? AssaultRanges.fromJSON(object.assault_ranges) : undefined,
2025-08-18 12:06:14 -05:00
burst: isSet(object.burst) ? Burst.fromJSON(object.burst) : undefined,
2024-10-09 10:39:21 -05:00
};
},
2025-08-18 12:06:14 -05:00
toJSON(message: GunDefinition): unknown {
2024-10-09 10:39:21 -05:00
const obj: any = {};
2025-10-13 22:26:11 -05:00
if (message.gun_type?.$case === "regular") {
2025-08-18 12:06:14 -05:00
obj.regular = GunDefinitionRegular.toJSON(message.gun_type.value);
2026-03-31 13:35:47 -05:00
} else if (message.gun_type?.$case === "auto_loader") {
2026-09-23 16:31:35 -05:00
obj.auto_loader = GunDefinitionAutoLoader.toJSON(message.gun_type.value);
2026-03-31 13:35:47 -05:00
} else if (message.gun_type?.$case === "auto_reloader") {
2026-09-23 16:31:35 -05:00
obj.auto_reloader = GunDefinitionAutoReloader.toJSON(message.gun_type.value);
2025-08-18 12:06:14 -05:00
}
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.rotation_speed !== 0) {
2026-09-23 16:31:35 -05:00
obj.rotation_speed = message.rotation_speed;
2024-10-09 10:39:21 -05:00
}
if (message.research_cost !== undefined) {
2026-09-23 16:31:35 -05:00
obj.research_cost = ResearchCost.toJSON(message.research_cost);
2024-10-09 10:39:21 -05:00
}
if (message.weight !== 0) {
obj.weight = Math.round(message.weight);
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
2024-10-09 10:39:21 -05:00
}
if (message.tier !== 0) {
2024-11-20 10:21:17 -06:00
obj.tier = Math.round(message.tier);
2024-10-09 10:39:21 -05:00
}
if (message.shells?.length) {
obj.shells = message.shells.map((e) => ShellDefinition.toJSON(e));
}
if (message.camouflage_loss !== 0) {
2026-09-23 16:31:35 -05:00
obj.camouflage_loss = message.camouflage_loss;
2024-10-09 10:39:21 -05:00
}
if (message.aim_time !== 0) {
2026-09-23 16:31:35 -05:00
obj.aim_time = message.aim_time;
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_base !== 0) {
2026-09-23 16:31:35 -05:00
obj.dispersion_base = message.dispersion_base;
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_traverse !== 0) {
2026-09-23 16:31:35 -05:00
obj.dispersion_traverse = message.dispersion_traverse;
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_shot !== 0) {
2026-09-23 16:31:35 -05:00
obj.dispersion_shot = message.dispersion_shot;
2024-10-09 10:39:21 -05:00
}
if (message.dispersion_damaged !== 0) {
2026-09-23 16:31:35 -05:00
obj.dispersion_damaged = message.dispersion_damaged;
2024-10-09 10:39:21 -05:00
}
if (message.unlocks?.length) {
obj.unlocks = message.unlocks.map((e) => Unlock.toJSON(e));
}
2024-11-09 19:16:06 -06:00
if (message.shell_capacity !== 0) {
2026-09-23 16:31:35 -05:00
obj.shell_capacity = Math.round(message.shell_capacity);
2024-11-09 19:16:06 -06:00
}
2025-07-31 13:44:14 -05:00
if (message.assault_ranges !== undefined) {
2026-09-23 16:31:35 -05:00
obj.assault_ranges = AssaultRanges.toJSON(message.assault_ranges);
2025-07-31 13:44:14 -05:00
}
2025-08-18 12:06:14 -05:00
if (message.burst !== undefined) {
obj.burst = Burst.toJSON(message.burst);
}
2024-10-09 10:39:21 -05:00
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<GunDefinition>, I>>(base?: I): GunDefinition {
2025-08-18 12:06:14 -05:00
return GunDefinition.fromPartial(base ?? ({} as any));
2024-10-09 10:39:21 -05:00
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<GunDefinition>, I>>(object: I): GunDefinition {
2025-08-18 12:06:14 -05:00
const message = createBaseGunDefinition();
2026-03-31 13:35:47 -05:00
switch (object.gun_type?.$case) {
case "regular": {
if (object.gun_type?.value !== undefined && object.gun_type?.value !== null) {
message.gun_type = { $case: "regular", value: GunDefinitionRegular.fromPartial(object.gun_type.value) };
}
break;
}
case "auto_loader": {
if (object.gun_type?.value !== undefined && object.gun_type?.value !== null) {
message.gun_type = {
$case: "auto_loader",
value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value),
};
}
break;
}
case "auto_reloader": {
if (object.gun_type?.value !== undefined && object.gun_type?.value !== null) {
message.gun_type = {
$case: "auto_reloader",
value: GunDefinitionAutoReloader.fromPartial(object.gun_type.value),
};
}
break;
}
2025-08-18 12:06:14 -05:00
}
2024-10-09 10:39:21 -05:00
message.id = object.id ?? 0;
message.rotation_speed = object.rotation_speed ?? 0;
2026-03-31 13:35:47 -05:00
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
? ResearchCost.fromPartial(object.research_cost)
: undefined;
2024-10-09 10:39:21 -05:00
message.weight = object.weight ?? 0;
2026-03-31 13:35:47 -05:00
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: undefined;
2024-10-09 10:39:21 -05:00
message.tier = object.tier ?? 0;
2026-03-31 13:35:47 -05:00
message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || [];
2024-10-09 10:39:21 -05:00
message.camouflage_loss = object.camouflage_loss ?? 0;
message.aim_time = object.aim_time ?? 0;
message.dispersion_base = object.dispersion_base ?? 0;
message.dispersion_traverse = object.dispersion_traverse ?? 0;
message.dispersion_shot = object.dispersion_shot ?? 0;
message.dispersion_damaged = object.dispersion_damaged ?? 0;
message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || [];
2024-11-09 19:16:06 -06:00
message.shell_capacity = object.shell_capacity ?? 0;
2026-03-31 13:35:47 -05:00
message.assault_ranges = (object.assault_ranges !== undefined && object.assault_ranges !== null)
? AssaultRanges.fromPartial(object.assault_ranges)
: undefined;
message.burst = (object.burst !== undefined && object.burst !== null) ? Burst.fromPartial(object.burst) : undefined;
2024-10-09 10:39:21 -05:00
return message;
},
};
2025-08-18 12:06:14 -05:00
function createBaseGunDefinitionRegular(): GunDefinitionRegular {
return { reload: 0 };
}
export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = {
2026-03-31 13:35:47 -05:00
encode(message: GunDefinitionRegular, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025-08-18 12:06:14 -05:00
if (message.reload !== 0) {
writer.uint32(13).float(message.reload);
}
return writer;
},
2026-03-31 13:35:47 -05:00
decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegular {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2025-08-18 12:06:14 -05:00
const message = createBaseGunDefinitionRegular();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.reload = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): GunDefinitionRegular {
2026-03-31 13:35:47 -05:00
return { reload: isSet(object.reload) ? globalThis.Number(object.reload) : 0 };
2025-08-18 12:06:14 -05:00
},
toJSON(message: GunDefinitionRegular): unknown {
const obj: any = {};
if (message.reload !== 0) {
obj.reload = message.reload;
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<GunDefinitionRegular>, I>>(base?: I): GunDefinitionRegular {
2025-08-18 12:06:14 -05:00
return GunDefinitionRegular.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<GunDefinitionRegular>, I>>(object: I): GunDefinitionRegular {
2025-08-18 12:06:14 -05:00
const message = createBaseGunDefinitionRegular();
message.reload = object.reload ?? 0;
return message;
},
};
function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader {
2025-08-21 20:22:12 -05:00
return { clip_reload: 0, intra_clip: 0, shell_count: 0 };
2025-08-18 12:06:14 -05:00
}
export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = {
2026-03-31 13:35:47 -05:00
encode(message: GunDefinitionAutoLoader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025-08-18 12:06:14 -05:00
if (message.clip_reload !== 0) {
writer.uint32(13).float(message.clip_reload);
}
if (message.intra_clip !== 0) {
writer.uint32(21).float(message.intra_clip);
}
if (message.shell_count !== 0) {
writer.uint32(29).float(message.shell_count);
}
return writer;
},
2026-03-31 13:35:47 -05:00
decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoader {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2025-08-18 12:06:14 -05:00
const message = createBaseGunDefinitionAutoLoader();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.clip_reload = reader.float();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.intra_clip = reader.float();
continue;
}
case 3: {
if (tag !== 29) {
break;
}
message.shell_count = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): GunDefinitionAutoLoader {
return {
2026-09-23 16:31:35 -05:00
clip_reload: isSet(object.clip_reload) ? globalThis.Number(object.clip_reload) : 0,
intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0,
shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0,
2025-08-18 12:06:14 -05:00
};
},
toJSON(message: GunDefinitionAutoLoader): unknown {
const obj: any = {};
if (message.clip_reload !== 0) {
2026-09-23 16:31:35 -05:00
obj.clip_reload = message.clip_reload;
2025-08-18 12:06:14 -05:00
}
if (message.intra_clip !== 0) {
2026-09-23 16:31:35 -05:00
obj.intra_clip = message.intra_clip;
2025-08-18 12:06:14 -05:00
}
if (message.shell_count !== 0) {
2026-09-23 16:31:35 -05:00
obj.shell_count = message.shell_count;
2025-08-18 12:06:14 -05:00
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<GunDefinitionAutoLoader>, I>>(base?: I): GunDefinitionAutoLoader {
2025-08-18 12:06:14 -05:00
return GunDefinitionAutoLoader.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoLoader>, I>>(object: I): GunDefinitionAutoLoader {
2025-08-18 12:06:14 -05:00
const message = createBaseGunDefinitionAutoLoader();
message.clip_reload = object.clip_reload ?? 0;
message.intra_clip = object.intra_clip ?? 0;
message.shell_count = object.shell_count ?? 0;
return message;
},
};
function createBaseBurst(): Burst {
return { count: 0, interval: 0 };
}
export const Burst: MessageFns<Burst> = {
2026-03-31 13:35:47 -05:00
encode(message: Burst, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025-08-18 12:06:14 -05:00
if (message.count !== 0) {
writer.uint32(8).uint32(message.count);
}
if (message.interval !== 0) {
writer.uint32(21).float(message.interval);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Burst {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2025-08-18 12:06:14 -05:00
const message = createBaseBurst();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.count = reader.uint32();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.interval = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Burst {
return {
count: isSet(object.count) ? globalThis.Number(object.count) : 0,
interval: isSet(object.interval) ? globalThis.Number(object.interval) : 0,
};
},
toJSON(message: Burst): unknown {
const obj: any = {};
if (message.count !== 0) {
obj.count = Math.round(message.count);
}
if (message.interval !== 0) {
obj.interval = message.interval;
}
return obj;
},
create<I extends Exact<DeepPartial<Burst>, I>>(base?: I): Burst {
return Burst.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Burst>, I>>(object: I): Burst {
const message = createBaseBurst();
message.count = object.count ?? 0;
message.interval = object.interval ?? 0;
return message;
},
};
function createBaseGunDefinitionAutoReloader(): GunDefinitionAutoReloader {
return { shell_reloads: [], intra_clip: 0, shell_count: 0 };
}
2026-03-31 13:35:47 -05:00
export const GunDefinitionAutoReloader: MessageFns<GunDefinitionAutoReloader> = {
encode(message: GunDefinitionAutoReloader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.shell_reloads) {
writer.uint32(13).float(v!);
}
if (message.intra_clip !== 0) {
writer.uint32(21).float(message.intra_clip);
}
if (message.shell_count !== 0) {
writer.uint32(29).float(message.shell_count);
}
return writer;
},
2025-08-18 12:06:14 -05:00
2026-03-31 13:35:47 -05:00
decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloader {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGunDefinitionAutoReloader();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag === 13) {
message.shell_reloads.push(reader.float());
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
2025-08-18 12:06:14 -05:00
message.shell_reloads.push(reader.float());
}
continue;
}
break;
}
2026-03-31 13:35:47 -05:00
case 2: {
if (tag !== 21) {
break;
}
2025-08-18 12:06:14 -05:00
2026-03-31 13:35:47 -05:00
message.intra_clip = reader.float();
continue;
}
case 3: {
if (tag !== 29) {
break;
}
2025-08-18 12:06:14 -05:00
2026-03-31 13:35:47 -05:00
message.shell_count = reader.float();
continue;
}
2025-08-18 12:06:14 -05:00
}
2026-03-31 13:35:47 -05:00
if ((tag & 7) === 4 || tag === 0) {
break;
2025-08-18 12:06:14 -05:00
}
2026-03-31 13:35:47 -05:00
reader.skip(tag & 7);
}
return message;
},
2025-08-18 12:06:14 -05:00
2026-03-31 13:35:47 -05:00
fromJSON(object: any): GunDefinitionAutoReloader {
return {
2026-09-23 16:31:35 -05:00
shell_reloads: globalThis.Array.isArray(object?.shell_reloads)
2026-03-31 13:35:47 -05:00
? object.shell_reloads.map((e: any) => globalThis.Number(e))
: [],
2026-09-23 16:31:35 -05:00
intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0,
shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0,
2026-03-31 13:35:47 -05:00
};
},
toJSON(message: GunDefinitionAutoReloader): unknown {
const obj: any = {};
if (message.shell_reloads?.length) {
2026-09-23 16:31:35 -05:00
obj.shell_reloads = message.shell_reloads;
2026-03-31 13:35:47 -05:00
}
if (message.intra_clip !== 0) {
2026-09-23 16:31:35 -05:00
obj.intra_clip = message.intra_clip;
2026-03-31 13:35:47 -05:00
}
if (message.shell_count !== 0) {
2026-09-23 16:31:35 -05:00
obj.shell_count = message.shell_count;
2026-03-31 13:35:47 -05:00
}
return obj;
},
create<I extends Exact<DeepPartial<GunDefinitionAutoReloader>, I>>(base?: I): GunDefinitionAutoReloader {
return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoReloader>, I>>(object: I): GunDefinitionAutoReloader {
const message = createBaseGunDefinitionAutoReloader();
message.shell_reloads = object.shell_reloads?.map((e) => e) || [];
message.intra_clip = object.intra_clip ?? 0;
message.shell_count = object.shell_count ?? 0;
return message;
},
};
2025-08-18 12:06:14 -05:00
2025-07-31 13:44:14 -05:00
function createBaseAssaultRanges(): AssaultRanges {
2025-07-31 14:12:14 -05:00
return { ranges: [], types: [] };
2025-07-31 13:44:14 -05:00
}
export const AssaultRanges: MessageFns<AssaultRanges> = {
2026-03-31 13:35:47 -05:00
encode(message: AssaultRanges, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025-07-31 13:44:14 -05:00
for (const v of message.ranges) {
AssaultRange.encode(v!, writer.uint32(10).fork()).join();
}
2025-07-31 14:12:14 -05:00
for (const v of message.types) {
2026-03-31 13:35:47 -05:00
writer.uint32(16).int32(v!);
2025-07-31 14:12:14 -05:00
}
2025-07-31 13:44:14 -05:00
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): AssaultRanges {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2025-07-31 13:44:14 -05:00
const message = createBaseAssaultRanges();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.ranges.push(AssaultRange.decode(reader, reader.uint32()));
continue;
}
2025-07-31 14:12:14 -05:00
case 2: {
if (tag === 16) {
message.types.push(reader.int32() as any);
continue;
}
if (tag === 18) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.types.push(reader.int32() as any);
}
continue;
}
break;
}
2025-07-31 13:44:14 -05:00
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): AssaultRanges {
return {
2026-03-31 13:35:47 -05:00
ranges: globalThis.Array.isArray(object?.ranges) ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) : [],
types: globalThis.Array.isArray(object?.types) ? object.types.map((e: any) => shellTypeFromJSON(e)) : [],
2025-07-31 13:44:14 -05:00
};
},
toJSON(message: AssaultRanges): unknown {
const obj: any = {};
if (message.ranges?.length) {
obj.ranges = message.ranges.map((e) => AssaultRange.toJSON(e));
}
2025-07-31 14:12:14 -05:00
if (message.types?.length) {
obj.types = message.types.map((e) => shellTypeToJSON(e));
}
2025-07-31 13:44:14 -05:00
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<AssaultRanges>, I>>(base?: I): AssaultRanges {
2025-07-31 13:44:14 -05:00
return AssaultRanges.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<AssaultRanges>, I>>(object: I): AssaultRanges {
2025-07-31 13:44:14 -05:00
const message = createBaseAssaultRanges();
2026-03-31 13:35:47 -05:00
message.ranges = object.ranges?.map((e) => AssaultRange.fromPartial(e)) || [];
2025-07-31 14:12:14 -05:00
message.types = object.types?.map((e) => e) || [];
2025-07-31 13:44:14 -05:00
return message;
},
};
function createBaseAssaultRange(): AssaultRange {
return { distance: 0, factor: 0 };
}
export const AssaultRange: MessageFns<AssaultRange> = {
2026-03-31 13:35:47 -05:00
encode(message: AssaultRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025-07-31 13:44:14 -05:00
if (message.distance !== 0) {
writer.uint32(13).float(message.distance);
}
if (message.factor !== 0) {
writer.uint32(21).float(message.factor);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): AssaultRange {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2025-07-31 13:44:14 -05:00
const message = createBaseAssaultRange();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.distance = reader.float();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.factor = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): AssaultRange {
return {
distance: isSet(object.distance) ? globalThis.Number(object.distance) : 0,
factor: isSet(object.factor) ? globalThis.Number(object.factor) : 0,
};
},
toJSON(message: AssaultRange): unknown {
const obj: any = {};
if (message.distance !== 0) {
obj.distance = message.distance;
}
if (message.factor !== 0) {
obj.factor = message.factor;
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<AssaultRange>, I>>(base?: I): AssaultRange {
2025-07-31 13:44:14 -05:00
return AssaultRange.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<AssaultRange>, I>>(object: I): AssaultRange {
2025-07-31 13:44:14 -05:00
const message = createBaseAssaultRange();
message.distance = object.distance ?? 0;
message.factor = object.factor ?? 0;
return message;
},
};
function createBaseShellDefinition(): ShellDefinition {
2024-10-09 10:39:21 -05:00
return {
id: 0,
2025-07-31 13:44:14 -05:00
name: undefined,
2024-10-09 10:39:21 -05:00
velocity: 0,
armor_damage: 0,
module_damage: 0,
caliber: 0,
2025-10-13 22:26:11 -05:00
icon: "",
2025-07-31 13:44:14 -05:00
penetration: undefined,
2024-10-09 10:39:21 -05:00
type: 0,
2025-07-31 13:44:14 -05:00
normalization: 0,
ricochet: 0,
explosion_radius: 0,
2024-11-09 12:55:39 -06:00
range: 0,
2024-10-09 10:39:21 -05:00
};
}
export const ShellDefinition: MessageFns<ShellDefinition> = {
2026-03-31 13:35:47 -05:00
encode(message: ShellDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(18).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.velocity !== 0) {
writer.uint32(24).uint32(message.velocity);
}
if (message.armor_damage !== 0) {
writer.uint32(32).uint32(message.armor_damage);
}
if (message.module_damage !== 0) {
writer.uint32(40).uint32(message.module_damage);
}
if (message.caliber !== 0) {
writer.uint32(53).float(message.caliber);
}
2025-10-13 22:26:11 -05:00
if (message.icon !== "") {
2024-10-09 10:39:21 -05:00
writer.uint32(58).string(message.icon);
}
if (message.penetration !== undefined) {
2026-03-31 13:35:47 -05:00
ShellPenetration.encode(message.penetration, writer.uint32(66).fork()).join();
2024-10-09 10:39:21 -05:00
}
if (message.type !== 0) {
writer.uint32(72).int32(message.type);
}
2025-07-31 13:44:14 -05:00
if (message.normalization !== undefined && message.normalization !== 0) {
2024-10-09 10:39:21 -05:00
writer.uint32(85).float(message.normalization);
}
2025-07-31 13:44:14 -05:00
if (message.ricochet !== undefined && message.ricochet !== 0) {
2024-10-09 10:39:21 -05:00
writer.uint32(93).float(message.ricochet);
}
2026-03-31 13:35:47 -05:00
if (message.explosion_radius !== undefined && message.explosion_radius !== 0) {
2024-10-09 10:39:21 -05:00
writer.uint32(101).float(message.explosion_radius);
}
2024-11-09 12:55:39 -06:00
if (message.range !== 0) {
writer.uint32(104).uint32(message.range);
}
2024-10-09 10:39:21 -05:00
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ShellDefinition {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseShellDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
2025-01-14 14:38:41 -06:00
message.name = I18nString.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.velocity = reader.uint32();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.armor_damage = reader.uint32();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.module_damage = reader.uint32();
continue;
}
case 6: {
if (tag !== 53) {
break;
}
message.caliber = reader.float();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.icon = reader.string();
continue;
}
case 8: {
if (tag !== 66) {
break;
}
2026-03-31 13:35:47 -05:00
message.penetration = ShellPenetration.decode(reader, reader.uint32());
2024-10-09 10:39:21 -05:00
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.type = reader.int32() as any;
continue;
}
case 10: {
if (tag !== 85) {
break;
}
message.normalization = reader.float();
continue;
}
case 11: {
if (tag !== 93) {
break;
}
message.ricochet = reader.float();
continue;
}
case 12: {
if (tag !== 101) {
break;
}
message.explosion_radius = reader.float();
continue;
}
2024-11-09 12:55:39 -06:00
case 13: {
if (tag !== 104) {
break;
}
message.range = reader.uint32();
continue;
}
2024-10-09 10:39:21 -05:00
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ShellDefinition {
return {
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
velocity: isSet(object.velocity) ? globalThis.Number(object.velocity) : 0,
2026-09-23 16:31:35 -05:00
armor_damage: isSet(object.armor_damage) ? globalThis.Number(object.armor_damage) : 0,
module_damage: isSet(object.module_damage) ? globalThis.Number(object.module_damage) : 0,
2025-07-31 13:44:14 -05:00
caliber: isSet(object.caliber) ? globalThis.Number(object.caliber) : 0,
2025-10-13 22:26:11 -05:00
icon: isSet(object.icon) ? globalThis.String(object.icon) : "",
2026-03-31 13:35:47 -05:00
penetration: isSet(object.penetration) ? ShellPenetration.fromJSON(object.penetration) : undefined,
2025-07-31 13:44:14 -05:00
type: isSet(object.type) ? shellTypeFromJSON(object.type) : 0,
2026-03-31 13:35:47 -05:00
normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : 0,
2025-07-31 13:44:14 -05:00
ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : 0,
2026-09-23 16:31:35 -05:00
explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : 0,
2025-07-31 13:44:14 -05:00
range: isSet(object.range) ? globalThis.Number(object.range) : 0,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: ShellDefinition): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
2025-01-14 14:38:41 -06:00
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
2024-10-09 10:39:21 -05:00
}
if (message.velocity !== 0) {
obj.velocity = Math.round(message.velocity);
}
if (message.armor_damage !== 0) {
2026-09-23 16:31:35 -05:00
obj.armor_damage = Math.round(message.armor_damage);
2024-10-09 10:39:21 -05:00
}
if (message.module_damage !== 0) {
2026-09-23 16:31:35 -05:00
obj.module_damage = Math.round(message.module_damage);
2024-10-09 10:39:21 -05:00
}
if (message.caliber !== 0) {
obj.caliber = message.caliber;
}
2025-10-13 22:26:11 -05:00
if (message.icon !== "") {
2024-10-09 10:39:21 -05:00
obj.icon = message.icon;
}
if (message.penetration !== undefined) {
obj.penetration = ShellPenetration.toJSON(message.penetration);
}
if (message.type !== 0) {
obj.type = shellTypeToJSON(message.type);
}
2025-07-31 13:44:14 -05:00
if (message.normalization !== undefined && message.normalization !== 0) {
2024-10-09 10:39:21 -05:00
obj.normalization = message.normalization;
}
2025-07-31 13:44:14 -05:00
if (message.ricochet !== undefined && message.ricochet !== 0) {
2024-10-09 10:39:21 -05:00
obj.ricochet = message.ricochet;
}
2026-03-31 13:35:47 -05:00
if (message.explosion_radius !== undefined && message.explosion_radius !== 0) {
2026-09-23 16:31:35 -05:00
obj.explosion_radius = message.explosion_radius;
2024-10-09 10:39:21 -05:00
}
2024-11-09 12:55:39 -06:00
if (message.range !== 0) {
obj.range = Math.round(message.range);
}
2024-10-09 10:39:21 -05:00
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<ShellDefinition>, I>>(base?: I): ShellDefinition {
2024-10-09 10:39:21 -05:00
return ShellDefinition.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<ShellDefinition>, I>>(object: I): ShellDefinition {
2024-10-09 10:39:21 -05:00
const message = createBaseShellDefinition();
message.id = object.id ?? 0;
2026-03-31 13:35:47 -05:00
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: undefined;
2024-10-09 10:39:21 -05:00
message.velocity = object.velocity ?? 0;
message.armor_damage = object.armor_damage ?? 0;
message.module_damage = object.module_damage ?? 0;
message.caliber = object.caliber ?? 0;
2025-10-13 22:26:11 -05:00
message.icon = object.icon ?? "";
2026-03-31 13:35:47 -05:00
message.penetration = (object.penetration !== undefined && object.penetration !== null)
? ShellPenetration.fromPartial(object.penetration)
: undefined;
2024-10-09 10:39:21 -05:00
message.type = object.type ?? 0;
2025-07-31 13:44:14 -05:00
message.normalization = object.normalization ?? 0;
message.ricochet = object.ricochet ?? 0;
message.explosion_radius = object.explosion_radius ?? 0;
2024-11-09 12:55:39 -06:00
message.range = object.range ?? 0;
2024-10-09 10:39:21 -05:00
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseShellPenetration(): ShellPenetration {
2024-10-09 10:39:21 -05:00
return { near: 0, far: 0 };
}
export const ShellPenetration: MessageFns<ShellPenetration> = {
2026-03-31 13:35:47 -05:00
encode(message: ShellPenetration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.near !== 0) {
writer.uint32(13).float(message.near);
}
if (message.far !== 0) {
writer.uint32(21).float(message.far);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ShellPenetration {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseShellPenetration();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.near = reader.float();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.far = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ShellPenetration {
return {
2025-07-31 13:44:14 -05:00
near: isSet(object.near) ? globalThis.Number(object.near) : 0,
far: isSet(object.far) ? globalThis.Number(object.far) : 0,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: ShellPenetration): unknown {
const obj: any = {};
if (message.near !== 0) {
obj.near = message.near;
}
if (message.far !== 0) {
obj.far = message.far;
}
return obj;
},
2026-03-31 13:35:47 -05:00
create<I extends Exact<DeepPartial<ShellPenetration>, I>>(base?: I): ShellPenetration {
2024-10-09 10:39:21 -05:00
return ShellPenetration.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<ShellPenetration>, I>>(object: I): ShellPenetration {
2024-10-09 10:39:21 -05:00
const message = createBaseShellPenetration();
message.near = object.near ?? 0;
message.far = object.far ?? 0;
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseUnlock(): Unlock {
return { id: 0, type: 0, cost: undefined };
2024-10-09 10:39:21 -05:00
}
export const Unlock: MessageFns<Unlock> = {
2026-03-31 13:35:47 -05:00
encode(message: Unlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.type !== 0) {
writer.uint32(16).int32(message.type);
}
if (message.cost !== undefined) {
UnlockCost.encode(message.cost, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Unlock {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseUnlock();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.type = reader.int32() as any;
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.cost = UnlockCost.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Unlock {
return {
2025-07-31 13:44:14 -05:00
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
type: isSet(object.type) ? moduleTypeFromJSON(object.type) : 0,
cost: isSet(object.cost) ? UnlockCost.fromJSON(object.cost) : undefined,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: Unlock): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.type !== 0) {
obj.type = moduleTypeToJSON(message.type);
}
if (message.cost !== undefined) {
obj.cost = UnlockCost.toJSON(message.cost);
}
return obj;
},
create<I extends Exact<DeepPartial<Unlock>, I>>(base?: I): Unlock {
return Unlock.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Unlock>, I>>(object: I): Unlock {
const message = createBaseUnlock();
message.id = object.id ?? 0;
message.type = object.type ?? 0;
2026-03-31 13:35:47 -05:00
message.cost = (object.cost !== undefined && object.cost !== null)
? UnlockCost.fromPartial(object.cost)
: undefined;
2024-10-09 10:39:21 -05:00
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseUnlockCost(): UnlockCost {
2025-10-13 22:26:11 -05:00
return { type: "", value: 0 };
2024-10-09 10:39:21 -05:00
}
export const UnlockCost: MessageFns<UnlockCost> = {
2026-03-31 13:35:47 -05:00
encode(message: UnlockCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025-10-13 22:26:11 -05:00
if (message.type !== "") {
2024-10-09 10:39:21 -05:00
writer.uint32(10).string(message.type);
}
if (message.value !== 0) {
writer.uint32(16).int32(message.value);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): UnlockCost {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseUnlockCost();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.type = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.value = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): UnlockCost {
return {
2025-10-13 22:26:11 -05:00
type: isSet(object.type) ? globalThis.String(object.type) : "",
2025-07-31 13:44:14 -05:00
value: isSet(object.value) ? globalThis.Number(object.value) : 0,
2024-10-09 10:39:21 -05:00
};
},
toJSON(message: UnlockCost): unknown {
const obj: any = {};
2025-10-13 22:26:11 -05:00
if (message.type !== "") {
2024-10-09 10:39:21 -05:00
obj.type = message.type;
}
if (message.value !== 0) {
obj.value = Math.round(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<UnlockCost>, I>>(base?: I): UnlockCost {
return UnlockCost.fromPartial(base ?? ({} as any));
},
2026-03-31 13:35:47 -05:00
fromPartial<I extends Exact<DeepPartial<UnlockCost>, I>>(object: I): UnlockCost {
2024-10-09 10:39:21 -05:00
const message = createBaseUnlockCost();
2025-10-13 22:26:11 -05:00
message.type = object.type ?? "";
2024-10-09 10:39:21 -05:00
message.value = object.value ?? 0;
return message;
},
};
2025-07-31 13:44:14 -05:00
function createBaseCrew(): Crew {
2024-10-09 10:39:21 -05:00
return { type: 0, count: 0, substitute: [] };
}
export const Crew: MessageFns<Crew> = {
2026-03-31 13:35:47 -05:00
encode(message: Crew, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2024-10-09 10:39:21 -05:00
if (message.type !== 0) {
writer.uint32(8).int32(message.type);
}
if (message.count !== 0) {
writer.uint32(16).uint32(message.count);
}
for (const v of message.substitute) {
2026-03-31 13:35:47 -05:00
writer.uint32(24).int32(v!);
2024-10-09 10:39:21 -05:00
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Crew {
2026-03-31 13:35:47 -05:00
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
2024-10-09 10:39:21 -05:00
const message = createBaseCrew();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.type = reader.int32() as any;
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.count = reader.uint32();
continue;
}
case 3: {
if (tag === 24) {
message.substitute.push(reader.int32() as any);
continue;
}
if (tag === 26) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.substitute.push(reader.int32() as any);
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Crew {
return {
2025-07-31 13:44:14 -05:00
type: isSet(object.type) ? crewTypeFromJSON(object.type) : 0,
count: isSet(object.count) ? globalThis.Number(object.count) : 0,
2024-10-09 10:39:21 -05:00
substitute: globalThis.Array.isArray(object?.substitute)
? object.substitute.map((e: any) => crewTypeFromJSON(e))
: [],
};
},
toJSON(message: Crew): unknown {
const obj: any = {};
if (message.type !== 0) {
obj.type = crewTypeToJSON(message.type);
}
if (message.count !== 0) {
obj.count = Math.round(message.count);
}
if (message.substitute?.length) {
obj.substitute = message.substitute.map((e) => crewTypeToJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<Crew>, I>>(base?: I): Crew {
return Crew.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Crew>, I>>(object: I): Crew {
const message = createBaseCrew();
message.type = object.type ?? 0;
message.count = object.count ?? 0;
message.substitute = object.substitute?.map((e) => e) || [];
return message;
},
};
2026-03-31 13:35:47 -05:00
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
2024-10-09 10:39:21 -05:00
2026-03-31 13:35:47 -05:00
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
2024-10-09 10:39:21 -05:00
type KeysOfUnion<T> = T extends T ? keyof T : never;
2026-03-31 13:35:47 -05:00
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
2024-10-09 10:39:21 -05:00
function isObject(value: any): boolean {
2025-10-13 22:26:11 -05:00
return typeof value === "object" && value !== null;
2024-10-09 10:39:21 -05:00
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}