diff --git a/packages/core/src/protos/tank_definitions.proto b/packages/core/src/protos/tank_definitions.proto index 043cd7bd4..52143cbee 100644 --- a/packages/core/src/protos/tank_definitions.proto +++ b/packages/core/src/protos/tank_definitions.proto @@ -162,6 +162,7 @@ message GunDefinitionBase { message AssaultRanges { repeated AssaultRange ranges = 1; + repeated ShellType types = 2; } message AssaultRange { diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index 8fcd2b37b..d0b39185a 100644 --- a/packages/core/src/protos/tank_definitions.ts +++ b/packages/core/src/protos/tank_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/tank_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { createBaseI18nString, I18nString } from "./i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString } from './i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export enum TankPriceType { CREDITS = 0, @@ -18,24 +18,28 @@ export enum TankPriceType { export function tankPriceTypeFromJSON(object: any): TankPriceType { switch (object) { case 0: - case "TANK_PRICE_TYPE_CREDITS": + case 'TANK_PRICE_TYPE_CREDITS': return TankPriceType.CREDITS; case 1: - case "TANK_PRICE_TYPE_GOLD": + case 'TANK_PRICE_TYPE_GOLD': return TankPriceType.GOLD; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankPriceType', + ); } } export function tankPriceTypeToJSON(object: TankPriceType): string { switch (object) { case TankPriceType.CREDITS: - return "TANK_PRICE_TYPE_CREDITS"; + return 'TANK_PRICE_TYPE_CREDITS'; case TankPriceType.GOLD: - return "TANK_PRICE_TYPE_GOLD"; + return 'TANK_PRICE_TYPE_GOLD'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankPriceType', + ); } } @@ -49,34 +53,38 @@ export enum ShellType { export function shellTypeFromJSON(object: any): ShellType { switch (object) { case 0: - case "SHELL_TYPE_AP": + case 'SHELL_TYPE_AP': return ShellType.AP; case 1: - case "SHELL_TYPE_APCR": + case 'SHELL_TYPE_APCR': return ShellType.APCR; case 2: - case "SHELL_TYPE_HEAT": + case 'SHELL_TYPE_HEAT': return ShellType.HEAT; case 3: - case "SHELL_TYPE_HE": + case 'SHELL_TYPE_HE': return ShellType.HE; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ShellType', + ); } } export function shellTypeToJSON(object: ShellType): string { switch (object) { case ShellType.AP: - return "SHELL_TYPE_AP"; + return 'SHELL_TYPE_AP'; case ShellType.APCR: - return "SHELL_TYPE_APCR"; + return 'SHELL_TYPE_APCR'; case ShellType.HEAT: - return "SHELL_TYPE_HEAT"; + return 'SHELL_TYPE_HEAT'; case ShellType.HE: - return "SHELL_TYPE_HE"; + return 'SHELL_TYPE_HE'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ShellType', + ); } } @@ -91,39 +99,43 @@ export enum ModuleType { export function moduleTypeFromJSON(object: any): ModuleType { switch (object) { case 0: - case "MODULE_TYPE_VEHICLE": + case 'MODULE_TYPE_VEHICLE': return ModuleType.VEHICLE; case 1: - case "MODULE_TYPE_ENGINE": + case 'MODULE_TYPE_ENGINE': return ModuleType.ENGINE; case 2: - case "MODULE_TYPE_TRACKS": + case 'MODULE_TYPE_TRACKS': return ModuleType.TRACKS; case 3: - case "MODULE_TYPE_TURRET": + case 'MODULE_TYPE_TURRET': return ModuleType.TURRET; case 4: - case "MODULE_TYPE_GUN": + case 'MODULE_TYPE_GUN': return ModuleType.GUN; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ModuleType', + ); } } export function moduleTypeToJSON(object: ModuleType): string { switch (object) { case ModuleType.VEHICLE: - return "MODULE_TYPE_VEHICLE"; + return 'MODULE_TYPE_VEHICLE'; case ModuleType.ENGINE: - return "MODULE_TYPE_ENGINE"; + return 'MODULE_TYPE_ENGINE'; case ModuleType.TRACKS: - return "MODULE_TYPE_TRACKS"; + return 'MODULE_TYPE_TRACKS'; case ModuleType.TURRET: - return "MODULE_TYPE_TURRET"; + return 'MODULE_TYPE_TURRET'; case ModuleType.GUN: - return "MODULE_TYPE_GUN"; + return 'MODULE_TYPE_GUN'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ModuleType', + ); } } @@ -137,34 +149,38 @@ export enum TankClass { export function tankClassFromJSON(object: any): TankClass { switch (object) { case 0: - case "TANK_CLASS_LIGHT": + case 'TANK_CLASS_LIGHT': return TankClass.LIGHT; case 1: - case "TANK_CLASS_MEDIUM": + case 'TANK_CLASS_MEDIUM': return TankClass.MEDIUM; case 2: - case "TANK_CLASS_HEAVY": + case 'TANK_CLASS_HEAVY': return TankClass.HEAVY; case 3: - case "TANK_CLASS_TANK_DESTROYER": + case 'TANK_CLASS_TANK_DESTROYER': return TankClass.TANK_DESTROYER; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankClass', + ); } } export function tankClassToJSON(object: TankClass): string { switch (object) { case TankClass.LIGHT: - return "TANK_CLASS_LIGHT"; + return 'TANK_CLASS_LIGHT'; case TankClass.MEDIUM: - return "TANK_CLASS_MEDIUM"; + return 'TANK_CLASS_MEDIUM'; case TankClass.HEAVY: - return "TANK_CLASS_HEAVY"; + return 'TANK_CLASS_HEAVY'; case TankClass.TANK_DESTROYER: - return "TANK_CLASS_TANK_DESTROYER"; + return 'TANK_CLASS_TANK_DESTROYER'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankClass', + ); } } @@ -177,29 +193,33 @@ export enum TankType { export function tankTypeFromJSON(object: any): TankType { switch (object) { case 0: - case "TANK_TYPE_RESEARCHABLE": + case 'TANK_TYPE_RESEARCHABLE': return TankType.RESEARCHABLE; case 1: - case "TANK_TYPE_PREMIUM": + case 'TANK_TYPE_PREMIUM': return TankType.PREMIUM; case 2: - case "TANK_TYPE_COLLECTOR": + case 'TANK_TYPE_COLLECTOR': return TankType.COLLECTOR; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankType', + ); } } export function tankTypeToJSON(object: TankType): string { switch (object) { case TankType.RESEARCHABLE: - return "TANK_TYPE_RESEARCHABLE"; + return 'TANK_TYPE_RESEARCHABLE'; case TankType.PREMIUM: - return "TANK_TYPE_PREMIUM"; + return 'TANK_TYPE_PREMIUM'; case TankType.COLLECTOR: - return "TANK_TYPE_COLLECTOR"; + return 'TANK_TYPE_COLLECTOR'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankType', + ); } } @@ -214,39 +234,43 @@ export enum CrewType { export function crewTypeFromJSON(object: any): CrewType { switch (object) { case 0: - case "CREW_TYPE_COMMANDER": + case 'CREW_TYPE_COMMANDER': return CrewType.COMMANDER; case 1: - case "CREW_TYPE_RADIOMAN": + case 'CREW_TYPE_RADIOMAN': return CrewType.RADIOMAN; case 2: - case "CREW_TYPE_GUNNER": + case 'CREW_TYPE_GUNNER': return CrewType.GUNNER; case 3: - case "CREW_TYPE_DRIVER": + case 'CREW_TYPE_DRIVER': return CrewType.DRIVER; case 4: - case "CREW_TYPE_LOADER": + case 'CREW_TYPE_LOADER': return CrewType.LOADER; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum CrewType', + ); } } export function crewTypeToJSON(object: CrewType): string { switch (object) { case CrewType.COMMANDER: - return "CREW_TYPE_COMMANDER"; + return 'CREW_TYPE_COMMANDER'; case CrewType.RADIOMAN: - return "CREW_TYPE_RADIOMAN"; + return 'CREW_TYPE_RADIOMAN'; case CrewType.GUNNER: - return "CREW_TYPE_GUNNER"; + return 'CREW_TYPE_GUNNER'; case CrewType.DRIVER: - return "CREW_TYPE_DRIVER"; + return 'CREW_TYPE_DRIVER'; case CrewType.LOADER: - return "CREW_TYPE_LOADER"; + return 'CREW_TYPE_LOADER'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum CrewType', + ); } } @@ -270,7 +294,7 @@ export interface TankDefinition { crew: Crew[]; health: number; nation: string; - name: I18nString | undefined; + name: I18nString; type: TankType; max_consumables: number; max_provisions: number; @@ -299,8 +323,8 @@ export interface TankDefinition_RolesEntry { export interface ResearchCost { research_cost_type?: - | { $case: "xp"; value: number } - | { $case: "seasonal_tokens"; value: ResearchCostSeasonalTokens } + | { $case: 'xp'; value: number } + | { $case: 'seasonal_tokens'; value: ResearchCostSeasonalTokens } | undefined; } @@ -355,15 +379,15 @@ export interface TurretDefinition { export interface GunDefinition { gun_type?: - | { $case: "regular"; value: GunDefinitionRegular } - | { $case: "auto_loader"; value: GunDefinitionAutoLoader } - | { $case: "auto_reloader"; value: GunDefinitionAutoReloader } + | { $case: 'regular'; value: GunDefinitionRegular } + | { $case: 'auto_loader'; value: GunDefinitionAutoLoader } + | { $case: 'auto_reloader'; value: GunDefinitionAutoReloader } | undefined; } export interface GunDefinitionRegular { - base: GunDefinitionBase | undefined; - extension: GunDefinitionRegularProperties | undefined; + base: GunDefinitionBase; + extension: GunDefinitionRegularProperties; } export interface GunDefinitionRegularProperties { @@ -371,8 +395,8 @@ export interface GunDefinitionRegularProperties { } export interface GunDefinitionAutoLoader { - base: GunDefinitionBase | undefined; - extension: GunDefinitionAutoLoaderProperties | undefined; + base: GunDefinitionBase; + extension: GunDefinitionAutoLoaderProperties; } export interface GunDefinitionAutoLoaderProperties { @@ -382,8 +406,8 @@ export interface GunDefinitionAutoLoaderProperties { } export interface GunDefinitionAutoReloader { - base: GunDefinitionBase | undefined; - extension: GunDefinitionAutoReloaderProperties | undefined; + base: GunDefinitionBase; + extension: GunDefinitionAutoReloaderProperties; } export interface GunDefinitionAutoReloaderProperties { @@ -428,7 +452,7 @@ export interface ShellDefinition { module_damage: number; caliber: number; icon: string; - penetration: ShellPenetration | undefined; + penetration: ShellPenetration; type: ShellType; normalization?: number | undefined; ricochet?: number | undefined; @@ -463,15 +487,22 @@ function createBaseTankDefinitions(): TankDefinitions { } export const TankDefinitions: MessageFns = { - encode(message: TankDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankDefinitions, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { Object.entries(message.tanks).forEach(([key, value]) => { - TankDefinitions_TanksEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + TankDefinitions_TanksEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork(), + ).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTankDefinitions(); while (reader.pos < end) { @@ -482,7 +513,10 @@ export const TankDefinitions: MessageFns = { break; } - const entry1 = TankDefinitions_TanksEntry.decode(reader, reader.uint32()); + const entry1 = TankDefinitions_TanksEntry.decode( + reader, + reader.uint32(), + ); if (entry1.value !== undefined) { message.tanks[entry1.key] = entry1.value; } @@ -500,10 +534,12 @@ export const TankDefinitions: MessageFns = { fromJSON(object: any): TankDefinitions { return { tanks: isObject(object.tanks) - ? Object.entries(object.tanks).reduce<{ [key: number]: TankDefinition }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = TankDefinition.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.tanks).reduce<{ + [key: number]: TankDefinition; + }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = TankDefinition.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -522,20 +558,23 @@ export const TankDefinitions: MessageFns = { return obj; }, - create, I>>(base?: I): TankDefinitions { + create, I>>( + base?: I, + ): TankDefinitions { return TankDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TankDefinitions { + fromPartial, I>>( + object: I, + ): TankDefinitions { const message = createBaseTankDefinitions(); - message.tanks = Object.entries(object.tanks ?? {}).reduce<{ [key: number]: TankDefinition }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = TankDefinition.fromPartial(value); - } - return acc; - }, - {}, - ); + message.tanks = Object.entries(object.tanks ?? {}).reduce<{ + [key: number]: TankDefinition; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = TankDefinition.fromPartial(value); + } + return acc; + }, {}); return message; }, }; @@ -544,84 +583,99 @@ function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry { return { key: 0, value: undefined }; } -export const TankDefinitions_TanksEntry: MessageFns = { - 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; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions_TanksEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let 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; - } - - message.key = reader.uint32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = TankDefinition.decode(reader, reader.uint32()); - continue; - } +export const TankDefinitions_TanksEntry: MessageFns = + { + encode( + message: TankDefinitions_TanksEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + TankDefinition.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinitions_TanksEntry { - return { - key: isSet(object.key) ? globalThis.Number(object.key) : 0, - value: isSet(object.value) ? TankDefinition.fromJSON(object.value) : undefined, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TankDefinitions_TanksEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - create, I>>(base?: I): TankDefinitions_TanksEntry { - return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, 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; - }, -}; + message.value = TankDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + 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>>( + base?: I, + ): TankDefinitions_TanksEntry { + return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, 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; + }, + }; function createBaseTankDefinition(): TankDefinition { return { id: 0, - slug: "", + slug: '', roles: {}, fixed_camouflage: false, camouflages: [], @@ -629,7 +683,7 @@ function createBaseTankDefinition(): TankDefinition { successors: [], crew: [], health: 0, - nation: "", + nation: '', name: undefined, type: 0, max_consumables: 0, @@ -648,21 +702,27 @@ function createBaseTankDefinition(): TankDefinition { camouflage_still: 0, camouflage_moving: 0, camouflage_onFire: 0, - equipment_preset: "", + equipment_preset: '', weight: 0, }; } export const TankDefinition: MessageFns = { - encode(message: TankDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } - if (message.slug !== "") { + if (message.slug !== '') { writer.uint32(18).string(message.slug); } Object.entries(message.roles).forEach(([key, value]) => { - TankDefinition_RolesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + TankDefinition_RolesEntry.encode( + { key: key as any, value }, + writer.uint32(26).fork(), + ).join(); }); if (message.fixed_camouflage !== false) { writer.uint32(40).bool(message.fixed_camouflage); @@ -688,7 +748,7 @@ export const TankDefinition: MessageFns = { if (message.health !== 0) { writer.uint32(80).uint32(message.health); } - if (message.nation !== "") { + if (message.nation !== '') { writer.uint32(90).string(message.nation); } if (message.name !== undefined) { @@ -728,7 +788,10 @@ export const TankDefinition: MessageFns = { TankPrice.encode(message.price, writer.uint32(186).fork()).join(); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(194).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(194).fork(), + ).join(); } if (message.speed_forwards !== 0) { writer.uint32(205).float(message.speed_forwards); @@ -745,7 +808,7 @@ export const TankDefinition: MessageFns = { if (message.camouflage_onFire !== 0) { writer.uint32(237).float(message.camouflage_onFire); } - if (message.equipment_preset !== "") { + if (message.equipment_preset !== '') { writer.uint32(242).string(message.equipment_preset); } if (message.weight !== 0) { @@ -755,7 +818,8 @@ export const TankDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTankDefinition(); while (reader.pos < end) { @@ -782,7 +846,10 @@ export const TankDefinition: MessageFns = { break; } - const entry3 = TankDefinition_RolesEntry.decode(reader, reader.uint32()); + const entry3 = TankDefinition_RolesEntry.decode( + reader, + reader.uint32(), + ); if (entry3.value !== undefined) { message.roles[entry3.key] = entry3.value; } @@ -943,7 +1010,9 @@ export const TankDefinition: MessageFns = { break; } - message.turrets.push(TurretDefinition.decode(reader, reader.uint32())); + message.turrets.push( + TurretDefinition.decode(reader, reader.uint32()), + ); continue; } case 21: { @@ -951,7 +1020,9 @@ export const TankDefinition: MessageFns = { break; } - message.engines.push(EngineDefinition.decode(reader, reader.uint32())); + message.engines.push( + EngineDefinition.decode(reader, reader.uint32()), + ); continue; } case 22: { @@ -1046,14 +1117,19 @@ export const TankDefinition: MessageFns = { fromJSON(object: any): TankDefinition { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, - slug: isSet(object.slug) ? globalThis.String(object.slug) : "", + slug: isSet(object.slug) ? globalThis.String(object.slug) : '', roles: isObject(object.roles) - ? Object.entries(object.roles).reduce<{ [key: number]: number }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = Number(value); - return acc; - }, {}) + ? Object.entries(object.roles).reduce<{ [key: number]: number }>( + (acc, [key, value]) => { + acc[globalThis.Number(key)] = Number(value); + return acc; + }, + {}, + ) : {}, - fixed_camouflage: isSet(object.fixed_camouflage) ? globalThis.Boolean(object.fixed_camouflage) : false, + fixed_camouflage: isSet(object.fixed_camouflage) + ? globalThis.Boolean(object.fixed_camouflage) + : false, camouflages: globalThis.Array.isArray(object?.camouflages) ? object.camouflages.map((e: any) => globalThis.Number(e)) : [], @@ -1063,17 +1139,27 @@ export const TankDefinition: MessageFns = { successors: globalThis.Array.isArray(object?.successors) ? object.successors.map((e: any) => globalThis.Number(e)) : [], - crew: globalThis.Array.isArray(object?.crew) ? object.crew.map((e: any) => Crew.fromJSON(e)) : [], + crew: globalThis.Array.isArray(object?.crew) + ? object.crew.map((e: any) => Crew.fromJSON(e)) + : [], health: isSet(object.health) ? globalThis.Number(object.health) : 0, - nation: isSet(object.nation) ? globalThis.String(object.nation) : "", + nation: isSet(object.nation) ? globalThis.String(object.nation) : '', name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, type: isSet(object.type) ? tankTypeFromJSON(object.type) : 0, - max_consumables: isSet(object.max_consumables) ? globalThis.Number(object.max_consumables) : 0, - max_provisions: isSet(object.max_provisions) ? globalThis.Number(object.max_provisions) : 0, + max_consumables: isSet(object.max_consumables) + ? globalThis.Number(object.max_consumables) + : 0, + max_provisions: isSet(object.max_provisions) + ? globalThis.Number(object.max_provisions) + : 0, tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, class: isSet(object.class) ? tankClassFromJSON(object.class) : 0, - testing: isSet(object.testing) ? globalThis.Boolean(object.testing) : false, - deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + testing: isSet(object.testing) + ? globalThis.Boolean(object.testing) + : false, + deprecated: isSet(object.deprecated) + ? globalThis.Boolean(object.deprecated) + : false, turrets: globalThis.Array.isArray(object?.turrets) ? object.turrets.map((e: any) => TurretDefinition.fromJSON(e)) : [], @@ -1084,13 +1170,27 @@ export const TankDefinition: MessageFns = { ? object.tracks.map((e: any) => TrackDefinition.fromJSON(e)) : [], price: isSet(object.price) ? TankPrice.fromJSON(object.price) : undefined, - 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_onFire: isSet(object.camouflage_onFire) ? globalThis.Number(object.camouflage_onFire) : 0, - equipment_preset: isSet(object.equipment_preset) ? globalThis.String(object.equipment_preset) : "", + 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_onFire: isSet(object.camouflage_onFire) + ? globalThis.Number(object.camouflage_onFire) + : 0, + equipment_preset: isSet(object.equipment_preset) + ? globalThis.String(object.equipment_preset) + : '', weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, }; }, @@ -1100,7 +1200,7 @@ export const TankDefinition: MessageFns = { if (message.id !== 0) { obj.id = Math.round(message.id); } - if (message.slug !== "") { + if (message.slug !== '') { obj.slug = message.slug; } if (message.roles) { @@ -1130,7 +1230,7 @@ export const TankDefinition: MessageFns = { if (message.health !== 0) { obj.health = Math.round(message.health); } - if (message.nation !== "") { + if (message.nation !== '') { obj.nation = message.nation; } if (message.name !== undefined) { @@ -1187,7 +1287,7 @@ export const TankDefinition: MessageFns = { if (message.camouflage_onFire !== 0) { obj.camouflage_onFire = message.camouflage_onFire; } - if (message.equipment_preset !== "") { + if (message.equipment_preset !== '') { obj.equipment_preset = message.equipment_preset; } if (message.weight !== 0) { @@ -1196,14 +1296,20 @@ export const TankDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): TankDefinition { + create, I>>( + base?: I, + ): TankDefinition { return TankDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TankDefinition { + fromPartial, I>>( + object: I, + ): TankDefinition { const message = createBaseTankDefinition(); message.id = object.id ?? 0; - message.slug = object.slug ?? ""; - message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: number }>((acc, [key, value]) => { + message.slug = object.slug ?? ''; + message.roles = Object.entries(object.roles ?? {}).reduce<{ + [key: number]: number; + }>((acc, [key, value]) => { if (value !== undefined) { acc[globalThis.Number(key)] = globalThis.Number(value); } @@ -1215,10 +1321,11 @@ export const TankDefinition: MessageFns = { message.successors = object.successors?.map((e) => e) || []; message.crew = object.crew?.map((e) => Crew.fromPartial(e)) || []; message.health = object.health ?? 0; - message.nation = object.nation ?? ""; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.nation = object.nation ?? ''; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.type = object.type ?? 0; message.max_consumables = object.max_consumables ?? 0; message.max_provisions = object.max_provisions ?? 0; @@ -1226,21 +1333,26 @@ export const TankDefinition: MessageFns = { message.class = object.class ?? 0; message.testing = object.testing ?? false; message.deprecated = object.deprecated ?? false; - 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; + 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; 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; message.camouflage_onFire = object.camouflage_onFire ?? 0; - message.equipment_preset = object.equipment_preset ?? ""; + message.equipment_preset = object.equipment_preset ?? ''; message.weight = object.weight ?? 0; return message; }, @@ -1250,97 +1362,116 @@ function createBaseTankDefinition_RolesEntry(): TankDefinition_RolesEntry { return { key: 0, value: 0 }; } -export const TankDefinition_RolesEntry: MessageFns = { - encode(message: TankDefinition_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== 0) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== 0) { - writer.uint32(16).uint32(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition_RolesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let 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: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.value = reader.uint32(); - continue; - } +export const TankDefinition_RolesEntry: MessageFns = + { + encode( + message: TankDefinition_RolesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== 0) { + writer.uint32(16).uint32(message.value); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinition_RolesEntry { - return { - key: isSet(object.key) ? globalThis.Number(object.key) : 0, - value: isSet(object.value) ? globalThis.Number(object.value) : 0, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TankDefinition_RolesEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let 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: { + if (tag !== 8) { + break; + } - toJSON(message: TankDefinition_RolesEntry): unknown { - const obj: any = {}; - if (message.key !== 0) { - obj.key = Math.round(message.key); - } - if (message.value !== 0) { - obj.value = Math.round(message.value); - } - return obj; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } - create, I>>(base?: I): TankDefinition_RolesEntry { - return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): TankDefinition_RolesEntry { - const message = createBaseTankDefinition_RolesEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? 0; - return message; - }, -}; + message.value = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankDefinition_RolesEntry { + return { + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? globalThis.Number(object.value) : 0, + }; + }, + + toJSON(message: TankDefinition_RolesEntry): unknown { + const obj: any = {}; + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): TankDefinition_RolesEntry { + return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TankDefinition_RolesEntry { + const message = createBaseTankDefinition_RolesEntry(); + message.key = object.key ?? 0; + message.value = object.value ?? 0; + return message; + }, + }; function createBaseResearchCost(): ResearchCost { return { research_cost_type: undefined }; } export const ResearchCost: MessageFns = { - encode(message: ResearchCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ResearchCost, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { switch (message.research_cost_type?.$case) { - case "xp": + case 'xp': writer.uint32(8).uint32(message.research_cost_type.value); break; - case "seasonal_tokens": - ResearchCostSeasonalTokens.encode(message.research_cost_type.value, writer.uint32(18).fork()).join(); + case 'seasonal_tokens': + ResearchCostSeasonalTokens.encode( + message.research_cost_type.value, + writer.uint32(18).fork(), + ).join(); break; } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ResearchCost { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResearchCost(); while (reader.pos < end) { @@ -1351,7 +1482,7 @@ export const ResearchCost: MessageFns = { break; } - message.research_cost_type = { $case: "xp", value: reader.uint32() }; + message.research_cost_type = { $case: 'xp', value: reader.uint32() }; continue; } case 2: { @@ -1360,7 +1491,7 @@ export const ResearchCost: MessageFns = { } message.research_cost_type = { - $case: "seasonal_tokens", + $case: 'seasonal_tokens', value: ResearchCostSeasonalTokens.decode(reader, reader.uint32()), }; continue; @@ -1377,44 +1508,60 @@ export const ResearchCost: MessageFns = { fromJSON(object: any): ResearchCost { return { research_cost_type: isSet(object.xp) - ? { $case: "xp", value: globalThis.Number(object.xp) } + ? { $case: 'xp', value: globalThis.Number(object.xp) } : isSet(object.seasonal_tokens) - ? { $case: "seasonal_tokens", value: ResearchCostSeasonalTokens.fromJSON(object.seasonal_tokens) } - : undefined, + ? { + $case: 'seasonal_tokens', + value: ResearchCostSeasonalTokens.fromJSON( + object.seasonal_tokens, + ), + } + : undefined, }; }, toJSON(message: ResearchCost): unknown { const obj: any = {}; - if (message.research_cost_type?.$case === "xp") { + if (message.research_cost_type?.$case === 'xp') { obj.xp = Math.round(message.research_cost_type.value); } - if (message.research_cost_type?.$case === "seasonal_tokens") { - obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON(message.research_cost_type.value); + if (message.research_cost_type?.$case === 'seasonal_tokens') { + obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON( + message.research_cost_type.value, + ); } return obj; }, - create, I>>(base?: I): ResearchCost { + create, I>>( + base?: I, + ): ResearchCost { return ResearchCost.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ResearchCost { + fromPartial, I>>( + object: I, + ): ResearchCost { const message = createBaseResearchCost(); if ( - object.research_cost_type?.$case === "xp" && - object.research_cost_type?.value !== undefined && - object.research_cost_type?.value !== null - ) { - message.research_cost_type = { $case: "xp", value: object.research_cost_type.value }; - } - if ( - object.research_cost_type?.$case === "seasonal_tokens" && + object.research_cost_type?.$case === 'xp' && 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), + $case: 'xp', + value: object.research_cost_type.value, + }; + } + if ( + object.research_cost_type?.$case === 'seasonal_tokens' && + 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, + ), }; } return message; @@ -1425,84 +1572,99 @@ function createBaseResearchCostSeasonalTokens(): ResearchCostSeasonalTokens { return { season: 0, tokens: 0 }; } -export const ResearchCostSeasonalTokens: MessageFns = { - 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; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ResearchCostSeasonalTokens { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let 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; - } - - message.season = reader.uint32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.tokens = reader.uint32(); - continue; - } +export const ResearchCostSeasonalTokens: MessageFns = + { + encode( + message: ResearchCostSeasonalTokens, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.season !== 0) { + writer.uint32(8).uint32(message.season); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.tokens !== 0) { + writer.uint32(16).uint32(message.tokens); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): ResearchCostSeasonalTokens { - return { - season: isSet(object.season) ? globalThis.Number(object.season) : 0, - tokens: isSet(object.tokens) ? globalThis.Number(object.tokens) : 0, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ResearchCostSeasonalTokens { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let 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; + } - 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; - }, + message.season = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } - create, I>>(base?: I): ResearchCostSeasonalTokens { - return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): ResearchCostSeasonalTokens { - const message = createBaseResearchCostSeasonalTokens(); - message.season = object.season ?? 0; - message.tokens = object.tokens ?? 0; - return message; - }, -}; + message.tokens = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + 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>>( + base?: I, + ): ResearchCostSeasonalTokens { + return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResearchCostSeasonalTokens { + const message = createBaseResearchCostSeasonalTokens(); + message.season = object.season ?? 0; + message.tokens = object.tokens ?? 0; + return message; + }, + }; function createBaseTankPrice(): TankPrice { return { type: 0, value: 0 }; } export const TankPrice: MessageFns = { - encode(message: TankPrice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankPrice, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } @@ -1513,7 +1675,8 @@ export const TankPrice: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TankPrice { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTankPrice(); while (reader.pos < end) { @@ -1565,7 +1728,9 @@ export const TankPrice: MessageFns = { create, I>>(base?: I): TankPrice { return TankPrice.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TankPrice { + fromPartial, I>>( + object: I, + ): TankPrice { const message = createBaseTankPrice(); message.type = object.type ?? 0; message.value = object.value ?? 0; @@ -1591,7 +1756,10 @@ function createBaseTrackDefinition(): TrackDefinition { } export const TrackDefinition: MessageFns = { - encode(message: TrackDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TrackDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -1608,7 +1776,10 @@ export const TrackDefinition: MessageFns = { writer.uint32(45).float(message.traverse_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(50).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(50).fork(), + ).join(); } if (message.dispersion_move !== 0) { writer.uint32(61).float(message.dispersion_move); @@ -1632,7 +1803,8 @@ export const TrackDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TrackDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTrackDefinition(); while (reader.pos < end) { @@ -1749,14 +1921,30 @@ export const TrackDefinition: MessageFns = { 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, - 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)) : [], + 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)) + : [], }; }, @@ -1801,21 +1989,27 @@ export const TrackDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): TrackDefinition { + create, I>>( + base?: I, + ): TrackDefinition { return TrackDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TrackDefinition { + fromPartial, I>>( + object: I, + ): TrackDefinition { const message = createBaseTrackDefinition(); message.id = object.id ?? 0; message.tier = object.tier ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.weight = object.weight ?? 0; message.traverse_speed = object.traverse_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.dispersion_move = object.dispersion_move ?? 0; message.dispersion_traverse = object.dispersion_traverse ?? 0; message.resistance_hard = object.resistance_hard ?? 0; @@ -1840,7 +2034,10 @@ function createBaseEngineDefinition(): EngineDefinition { } export const EngineDefinition: MessageFns = { - encode(message: EngineDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: EngineDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -1848,7 +2045,10 @@ export const EngineDefinition: MessageFns = { I18nString.encode(message.name, writer.uint32(18).fork()).join(); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(26).fork(), + ).join(); } if (message.tier !== 0) { writer.uint32(32).uint32(message.tier); @@ -1869,7 +2069,8 @@ export const EngineDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): EngineDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEngineDefinition(); while (reader.pos < end) { @@ -1952,12 +2153,18 @@ export const EngineDefinition: MessageFns = { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, - fire_chance: isSet(object.fire_chance) ? globalThis.Number(object.fire_chance) : 0, + fire_chance: isSet(object.fire_chance) + ? globalThis.Number(object.fire_chance) + : 0, power: isSet(object.power) ? globalThis.Number(object.power) : 0, weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1990,18 +2197,24 @@ export const EngineDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): EngineDefinition { + create, I>>( + base?: I, + ): EngineDefinition { return EngineDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): EngineDefinition { + fromPartial, I>>( + object: I, + ): EngineDefinition { const message = createBaseEngineDefinition(); message.id = object.id ?? 0; - 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; + 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; message.tier = object.tier ?? 0; message.fire_chance = object.fire_chance ?? 0; message.power = object.power ?? 0; @@ -2027,7 +2240,10 @@ function createBaseTurretDefinition(): TurretDefinition { } export const TurretDefinition: MessageFns = { - encode(message: TurretDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TurretDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -2041,7 +2257,10 @@ export const TurretDefinition: MessageFns = { writer.uint32(37).float(message.traverse_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(42).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(42).fork(), + ).join(); } if (message.name !== undefined) { I18nString.encode(message.name, writer.uint32(50).fork()).join(); @@ -2062,7 +2281,8 @@ export const TurretDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TurretDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTurretDefinition(); while (reader.pos < end) { @@ -2161,14 +2381,24 @@ export const TurretDefinition: MessageFns = { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, health: isSet(object.health) ? globalThis.Number(object.health) : 0, - 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, + 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, 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, - guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [], - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + guns: globalThis.Array.isArray(object?.guns) + ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) + : [], + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -2207,21 +2437,27 @@ export const TurretDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): TurretDefinition { + create, I>>( + base?: I, + ): TurretDefinition { return TurretDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TurretDefinition { + fromPartial, I>>( + object: I, + ): TurretDefinition { 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; - 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; + 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; message.tier = object.tier ?? 0; message.weight = object.weight ?? 0; message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || []; @@ -2235,23 +2471,36 @@ function createBaseGunDefinition(): GunDefinition { } export const GunDefinition: MessageFns = { - encode(message: GunDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { switch (message.gun_type?.$case) { - case "regular": - GunDefinitionRegular.encode(message.gun_type.value, writer.uint32(10).fork()).join(); + case 'regular': + GunDefinitionRegular.encode( + message.gun_type.value, + writer.uint32(10).fork(), + ).join(); break; - case "auto_loader": - GunDefinitionAutoLoader.encode(message.gun_type.value, writer.uint32(18).fork()).join(); + case 'auto_loader': + GunDefinitionAutoLoader.encode( + message.gun_type.value, + writer.uint32(18).fork(), + ).join(); break; - case "auto_reloader": - GunDefinitionAutoReloader.encode(message.gun_type.value, writer.uint32(26).fork()).join(); + case 'auto_reloader': + GunDefinitionAutoReloader.encode( + message.gun_type.value, + writer.uint32(26).fork(), + ).join(); break; } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GunDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinition(); while (reader.pos < end) { @@ -2262,7 +2511,10 @@ export const GunDefinition: MessageFns = { break; } - message.gun_type = { $case: "regular", value: GunDefinitionRegular.decode(reader, reader.uint32()) }; + message.gun_type = { + $case: 'regular', + value: GunDefinitionRegular.decode(reader, reader.uint32()), + }; continue; } case 2: { @@ -2270,7 +2522,10 @@ export const GunDefinition: MessageFns = { break; } - message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.decode(reader, reader.uint32()) }; + message.gun_type = { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.decode(reader, reader.uint32()), + }; continue; } case 3: { @@ -2279,7 +2534,7 @@ export const GunDefinition: MessageFns = { } message.gun_type = { - $case: "auto_reloader", + $case: 'auto_reloader', value: GunDefinitionAutoReloader.decode(reader, reader.uint32()), }; continue; @@ -2296,53 +2551,76 @@ export const GunDefinition: MessageFns = { fromJSON(object: any): GunDefinition { return { gun_type: isSet(object.regular) - ? { $case: "regular", value: GunDefinitionRegular.fromJSON(object.regular) } + ? { + $case: 'regular', + value: GunDefinitionRegular.fromJSON(object.regular), + } : isSet(object.auto_loader) - ? { $case: "auto_loader", value: GunDefinitionAutoLoader.fromJSON(object.auto_loader) } - : isSet(object.auto_reloader) - ? { $case: "auto_reloader", value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader) } - : undefined, + ? { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.fromJSON(object.auto_loader), + } + : isSet(object.auto_reloader) + ? { + $case: 'auto_reloader', + value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader), + } + : undefined, }; }, toJSON(message: GunDefinition): unknown { const obj: any = {}; - if (message.gun_type?.$case === "regular") { + if (message.gun_type?.$case === 'regular') { obj.regular = GunDefinitionRegular.toJSON(message.gun_type.value); } - if (message.gun_type?.$case === "auto_loader") { + if (message.gun_type?.$case === 'auto_loader') { obj.auto_loader = GunDefinitionAutoLoader.toJSON(message.gun_type.value); } - if (message.gun_type?.$case === "auto_reloader") { - obj.auto_reloader = GunDefinitionAutoReloader.toJSON(message.gun_type.value); + if (message.gun_type?.$case === 'auto_reloader') { + obj.auto_reloader = GunDefinitionAutoReloader.toJSON( + message.gun_type.value, + ); } return obj; }, - create, I>>(base?: I): GunDefinition { + create, I>>( + base?: I, + ): GunDefinition { return GunDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinition { + fromPartial, I>>( + object: I, + ): GunDefinition { const message = createBaseGunDefinition(); if ( - object.gun_type?.$case === "regular" && object.gun_type?.value !== undefined && object.gun_type?.value !== null - ) { - message.gun_type = { $case: "regular", value: GunDefinitionRegular.fromPartial(object.gun_type.value) }; - } - if ( - object.gun_type?.$case === "auto_loader" && - object.gun_type?.value !== undefined && - object.gun_type?.value !== null - ) { - message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value) }; - } - if ( - object.gun_type?.$case === "auto_reloader" && + object.gun_type?.$case === 'regular' && object.gun_type?.value !== undefined && object.gun_type?.value !== null ) { message.gun_type = { - $case: "auto_reloader", + $case: 'regular', + value: GunDefinitionRegular.fromPartial(object.gun_type.value), + }; + } + if ( + object.gun_type?.$case === 'auto_loader' && + object.gun_type?.value !== undefined && + object.gun_type?.value !== null + ) { + message.gun_type = { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value), + }; + } + if ( + object.gun_type?.$case === 'auto_reloader' && + object.gun_type?.value !== undefined && + object.gun_type?.value !== null + ) { + message.gun_type = { + $case: 'auto_reloader', value: GunDefinitionAutoReloader.fromPartial(object.gun_type.value), }; } @@ -2355,18 +2633,28 @@ function createBaseGunDefinitionRegular(): GunDefinitionRegular { } export const GunDefinitionRegular: MessageFns = { - encode(message: GunDefinitionRegular, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionRegular, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.base !== undefined) { GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } if (message.extension !== undefined) { - GunDefinitionRegularProperties.encode(message.extension, writer.uint32(18).fork()).join(); + GunDefinitionRegularProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegular { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionRegular { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionRegular(); while (reader.pos < end) { @@ -2385,7 +2673,10 @@ export const GunDefinitionRegular: MessageFns = { break; } - message.extension = GunDefinitionRegularProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionRegularProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2399,8 +2690,12 @@ export const GunDefinitionRegular: MessageFns = { fromJSON(object: any): GunDefinitionRegular { return { - base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, - extension: isSet(object.extension) ? GunDefinitionRegularProperties.fromJSON(object.extension) : undefined, + base: isSet(object.base) + ? GunDefinitionBase.fromJSON(object.base) + : undefined, + extension: isSet(object.extension) + ? GunDefinitionRegularProperties.fromJSON(object.extension) + : undefined, }; }, @@ -2415,17 +2710,23 @@ export const GunDefinitionRegular: MessageFns = { return obj; }, - create, I>>(base?: I): GunDefinitionRegular { + create, I>>( + base?: I, + ): GunDefinitionRegular { return GunDefinitionRegular.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinitionRegular { + fromPartial, I>>( + object: I, + ): GunDefinitionRegular { const message = createBaseGunDefinitionRegular(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : undefined; - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionRegularProperties.fromPartial(object.extension) - : undefined; + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : undefined; + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionRegularProperties.fromPartial(object.extension) + : undefined; return message; }, }; @@ -2434,79 +2735,101 @@ function createBaseGunDefinitionRegularProperties(): GunDefinitionRegularPropert return { reload: 0 }; } -export const GunDefinitionRegularProperties: MessageFns = { - encode(message: GunDefinitionRegularProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.reload !== 0) { - writer.uint32(13).float(message.reload); - } - return writer; - }, +export const GunDefinitionRegularProperties: MessageFns = + { + encode( + message: GunDefinitionRegularProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.reload !== 0) { + writer.uint32(13).float(message.reload); + } + return writer; + }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegularProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionRegularProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 13) { - break; + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionRegularProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionRegularProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.reload = reader.float(); + continue; } - - message.reload = reader.float(); - continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + return message; + }, + + fromJSON(object: any): GunDefinitionRegularProperties { + return { + reload: isSet(object.reload) ? globalThis.Number(object.reload) : 0, + }; + }, + + toJSON(message: GunDefinitionRegularProperties): unknown { + const obj: any = {}; + if (message.reload !== 0) { + obj.reload = message.reload; } - reader.skip(tag & 7); - } - return message; - }, + return obj; + }, - fromJSON(object: any): GunDefinitionRegularProperties { - return { reload: isSet(object.reload) ? globalThis.Number(object.reload) : 0 }; - }, - - toJSON(message: GunDefinitionRegularProperties): unknown { - const obj: any = {}; - if (message.reload !== 0) { - obj.reload = message.reload; - } - return obj; - }, - - create, I>>(base?: I): GunDefinitionRegularProperties { - return GunDefinitionRegularProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GunDefinitionRegularProperties { - const message = createBaseGunDefinitionRegularProperties(); - message.reload = object.reload ?? 0; - return message; - }, -}; + create, I>>( + base?: I, + ): GunDefinitionRegularProperties { + return GunDefinitionRegularProperties.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact, I>, + >(object: I): GunDefinitionRegularProperties { + const message = createBaseGunDefinitionRegularProperties(); + message.reload = object.reload ?? 0; + return message; + }, + }; function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader { return { base: undefined, extension: undefined }; } export const GunDefinitionAutoLoader: MessageFns = { - encode(message: GunDefinitionAutoLoader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionAutoLoader, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.base !== undefined) { GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } if (message.extension !== undefined) { - GunDefinitionAutoLoaderProperties.encode(message.extension, writer.uint32(18).fork()).join(); + GunDefinitionAutoLoaderProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoader { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoLoader { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionAutoLoader(); while (reader.pos < end) { @@ -2525,7 +2848,10 @@ export const GunDefinitionAutoLoader: MessageFns = { break; } - message.extension = GunDefinitionAutoLoaderProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionAutoLoaderProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2539,8 +2865,12 @@ export const GunDefinitionAutoLoader: MessageFns = { fromJSON(object: any): GunDefinitionAutoLoader { return { - base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, - extension: isSet(object.extension) ? GunDefinitionAutoLoaderProperties.fromJSON(object.extension) : undefined, + base: isSet(object.base) + ? GunDefinitionBase.fromJSON(object.base) + : undefined, + extension: isSet(object.extension) + ? GunDefinitionAutoLoaderProperties.fromJSON(object.extension) + : undefined, }; }, @@ -2550,22 +2880,30 @@ export const GunDefinitionAutoLoader: MessageFns = { obj.base = GunDefinitionBase.toJSON(message.base); } if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoLoaderProperties.toJSON(message.extension); + obj.extension = GunDefinitionAutoLoaderProperties.toJSON( + message.extension, + ); } return obj; }, - create, I>>(base?: I): GunDefinitionAutoLoader { + create, I>>( + base?: I, + ): GunDefinitionAutoLoader { return GunDefinitionAutoLoader.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinitionAutoLoader { + fromPartial, I>>( + object: I, + ): GunDefinitionAutoLoader { const message = createBaseGunDefinitionAutoLoader(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : undefined; - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) - : undefined; + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : undefined; + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) + : undefined; return message; }, }; @@ -2574,287 +2912,341 @@ function createBaseGunDefinitionAutoLoaderProperties(): GunDefinitionAutoLoaderP return { clip_reload: 0, intra_clip: 0, shell_count: 0 }; } -export const GunDefinitionAutoLoaderProperties: MessageFns = { - encode(message: GunDefinitionAutoLoaderProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - 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; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoaderProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoLoaderProperties(); - 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; - } +export const GunDefinitionAutoLoaderProperties: MessageFns = + { + encode( + message: GunDefinitionAutoLoaderProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.clip_reload !== 0) { + writer.uint32(13).float(message.clip_reload); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.intra_clip !== 0) { + writer.uint32(21).float(message.intra_clip); } - reader.skip(tag & 7); - } - return message; - }, + if (message.shell_count !== 0) { + writer.uint32(29).float(message.shell_count); + } + return writer; + }, - fromJSON(object: any): GunDefinitionAutoLoaderProperties { - return { - 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, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoLoaderProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoLoaderProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } - toJSON(message: GunDefinitionAutoLoaderProperties): unknown { - const obj: any = {}; - if (message.clip_reload !== 0) { - obj.clip_reload = message.clip_reload; - } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; - } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, + message.clip_reload = reader.float(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } - create, I>>( - base?: I, - ): GunDefinitionAutoLoaderProperties { - return GunDefinitionAutoLoaderProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GunDefinitionAutoLoaderProperties { - const message = createBaseGunDefinitionAutoLoaderProperties(); - message.clip_reload = object.clip_reload ?? 0; - message.intra_clip = object.intra_clip ?? 0; - message.shell_count = object.shell_count ?? 0; - return message; - }, -}; + 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): GunDefinitionAutoLoaderProperties { + return { + 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, + }; + }, + + toJSON(message: GunDefinitionAutoLoaderProperties): unknown { + const obj: any = {}; + if (message.clip_reload !== 0) { + obj.clip_reload = message.clip_reload; + } + if (message.intra_clip !== 0) { + obj.intra_clip = message.intra_clip; + } + if (message.shell_count !== 0) { + obj.shell_count = message.shell_count; + } + return obj; + }, + + create, I>>( + base?: I, + ): GunDefinitionAutoLoaderProperties { + return GunDefinitionAutoLoaderProperties.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact, I>, + >(object: I): GunDefinitionAutoLoaderProperties { + const message = createBaseGunDefinitionAutoLoaderProperties(); + message.clip_reload = object.clip_reload ?? 0; + message.intra_clip = object.intra_clip ?? 0; + message.shell_count = object.shell_count ?? 0; + return message; + }, + }; function createBaseGunDefinitionAutoReloader(): GunDefinitionAutoReloader { return { base: undefined, extension: undefined }; } -export const GunDefinitionAutoReloader: MessageFns = { - encode(message: GunDefinitionAutoReloader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.base !== undefined) { - GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); - } - if (message.extension !== undefined) { - GunDefinitionAutoReloaderProperties.encode(message.extension, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloader { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let 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 !== 10) { - break; - } - - message.base = GunDefinitionBase.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.extension = GunDefinitionAutoReloaderProperties.decode(reader, reader.uint32()); - continue; - } +export const GunDefinitionAutoReloader: MessageFns = + { + encode( + message: GunDefinitionAutoReloader, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.base !== undefined) { + GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.extension !== undefined) { + GunDefinitionAutoReloaderProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): GunDefinitionAutoReloader { - return { - base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, - extension: isSet(object.extension) ? GunDefinitionAutoReloaderProperties.fromJSON(object.extension) : undefined, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoReloader { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let 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 !== 10) { + break; + } - toJSON(message: GunDefinitionAutoReloader): unknown { - const obj: any = {}; - if (message.base !== undefined) { - obj.base = GunDefinitionBase.toJSON(message.base); - } - if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoReloaderProperties.toJSON(message.extension); - } - return obj; - }, + message.base = GunDefinitionBase.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - create, I>>(base?: I): GunDefinitionAutoReloader { - return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): GunDefinitionAutoReloader { - const message = createBaseGunDefinitionAutoReloader(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : undefined; - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) - : undefined; - return message; - }, -}; + message.extension = GunDefinitionAutoReloaderProperties.decode( + reader, + reader.uint32(), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GunDefinitionAutoReloader { + return { + base: isSet(object.base) + ? GunDefinitionBase.fromJSON(object.base) + : undefined, + extension: isSet(object.extension) + ? GunDefinitionAutoReloaderProperties.fromJSON(object.extension) + : undefined, + }; + }, + + toJSON(message: GunDefinitionAutoReloader): unknown { + const obj: any = {}; + if (message.base !== undefined) { + obj.base = GunDefinitionBase.toJSON(message.base); + } + if (message.extension !== undefined) { + obj.extension = GunDefinitionAutoReloaderProperties.toJSON( + message.extension, + ); + } + return obj; + }, + + create, I>>( + base?: I, + ): GunDefinitionAutoReloader { + return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GunDefinitionAutoReloader { + const message = createBaseGunDefinitionAutoReloader(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : undefined; + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) + : undefined; + return message; + }, + }; function createBaseGunDefinitionAutoReloaderProperties(): GunDefinitionAutoReloaderProperties { return { shell_reloads: [], intra_clip: 0, shell_count: 0 }; } -export const GunDefinitionAutoReloaderProperties: MessageFns = { - encode(message: GunDefinitionAutoReloaderProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.shell_reloads) { - writer.float(v); - } - writer.join(); - 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; - }, +export const GunDefinitionAutoReloaderProperties: MessageFns = + { + encode( + message: GunDefinitionAutoReloaderProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.shell_reloads) { + writer.float(v); + } + writer.join(); + 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; + }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloaderProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoReloaderProperties(); - 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) { + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoReloaderProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoReloaderProperties(); + 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) { + message.shell_reloads.push(reader.float()); + } + + continue; + } + + break; + } + 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; } - case 2: { - if (tag !== 21) { - break; - } - - message.intra_clip = reader.float(); - continue; - } - case 3: { - if (tag !== 29) { - break; - } - - message.shell_count = reader.float(); - continue; - } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + return message; + }, + + fromJSON(object: any): GunDefinitionAutoReloaderProperties { + return { + shell_reloads: globalThis.Array.isArray(object?.shell_reloads) + ? object.shell_reloads.map((e: any) => globalThis.Number(e)) + : [], + intra_clip: isSet(object.intra_clip) + ? globalThis.Number(object.intra_clip) + : 0, + shell_count: isSet(object.shell_count) + ? globalThis.Number(object.shell_count) + : 0, + }; + }, + + toJSON(message: GunDefinitionAutoReloaderProperties): unknown { + const obj: any = {}; + if (message.shell_reloads?.length) { + obj.shell_reloads = message.shell_reloads; } - reader.skip(tag & 7); - } - return message; - }, + if (message.intra_clip !== 0) { + obj.intra_clip = message.intra_clip; + } + if (message.shell_count !== 0) { + obj.shell_count = message.shell_count; + } + return obj; + }, - fromJSON(object: any): GunDefinitionAutoReloaderProperties { - return { - shell_reloads: globalThis.Array.isArray(object?.shell_reloads) - ? object.shell_reloads.map((e: any) => globalThis.Number(e)) - : [], - intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0, - shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0, - }; - }, - - toJSON(message: GunDefinitionAutoReloaderProperties): unknown { - const obj: any = {}; - if (message.shell_reloads?.length) { - obj.shell_reloads = message.shell_reloads; - } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; - } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, - - create, I>>( - base?: I, - ): GunDefinitionAutoReloaderProperties { - return GunDefinitionAutoReloaderProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GunDefinitionAutoReloaderProperties { - const message = createBaseGunDefinitionAutoReloaderProperties(); - 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; - }, -}; + create< + I extends Exact, I>, + >(base?: I): GunDefinitionAutoReloaderProperties { + return GunDefinitionAutoReloaderProperties.fromPartial( + base ?? ({} as any), + ); + }, + fromPartial< + I extends Exact, I>, + >(object: I): GunDefinitionAutoReloaderProperties { + const message = createBaseGunDefinitionAutoReloaderProperties(); + 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; + }, + }; function createBaseGunDefinitionBase(): GunDefinitionBase { return { @@ -2878,7 +3270,10 @@ function createBaseGunDefinitionBase(): GunDefinitionBase { } export const GunDefinitionBase: MessageFns = { - encode(message: GunDefinitionBase, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionBase, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -2886,7 +3281,10 @@ export const GunDefinitionBase: MessageFns = { writer.uint32(21).float(message.rotation_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(26).fork(), + ).join(); } if (message.weight !== 0) { writer.uint32(32).uint32(message.weight); @@ -2925,13 +3323,17 @@ export const GunDefinitionBase: MessageFns = { writer.uint32(120).uint32(message.shell_capacity); } if (message.assault_ranges !== undefined) { - AssaultRanges.encode(message.assault_ranges, writer.uint32(130).fork()).join(); + AssaultRanges.encode( + message.assault_ranges, + writer.uint32(130).fork(), + ).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionBase { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionBase(); while (reader.pos < end) { @@ -3062,7 +3464,10 @@ export const GunDefinitionBase: MessageFns = { break; } - message.assault_ranges = AssaultRanges.decode(reader, reader.uint32()); + message.assault_ranges = AssaultRanges.decode( + reader, + reader.uint32(), + ); continue; } } @@ -3077,23 +3482,43 @@ export const GunDefinitionBase: MessageFns = { fromJSON(object: any): GunDefinitionBase { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, - rotation_speed: isSet(object.rotation_speed) ? globalThis.Number(object.rotation_speed) : 0, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, + rotation_speed: isSet(object.rotation_speed) + ? globalThis.Number(object.rotation_speed) + : 0, + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, 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, shells: globalThis.Array.isArray(object?.shells) ? object.shells.map((e: any) => ShellDefinition.fromJSON(e)) : [], - camouflage_loss: isSet(object.camouflage_loss) ? globalThis.Number(object.camouflage_loss) : 0, + 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, + 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, }; }, @@ -3150,22 +3575,29 @@ export const GunDefinitionBase: MessageFns = { return obj; }, - create, I>>(base?: I): GunDefinitionBase { + create, I>>( + base?: I, + ): GunDefinitionBase { return GunDefinitionBase.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinitionBase { + fromPartial, I>>( + object: I, + ): GunDefinitionBase { const message = createBaseGunDefinitionBase(); message.id = object.id ?? 0; message.rotation_speed = object.rotation_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.weight = object.weight ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.tier = object.tier ?? 0; - message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; + message.shells = + object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; message.camouflage_loss = object.camouflage_loss ?? 0; message.aim_time = object.aim_time ?? 0; message.dispersion_base = object.dispersion_base ?? 0; @@ -3174,9 +3606,10 @@ export const GunDefinitionBase: MessageFns = { message.dispersion_damaged = object.dispersion_damaged ?? 0; message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || []; message.shell_capacity = object.shell_capacity ?? 0; - message.assault_ranges = (object.assault_ranges !== undefined && object.assault_ranges !== null) - ? AssaultRanges.fromPartial(object.assault_ranges) - : undefined; + message.assault_ranges = + object.assault_ranges !== undefined && object.assault_ranges !== null + ? AssaultRanges.fromPartial(object.assault_ranges) + : undefined; return message; }, }; @@ -3186,7 +3619,10 @@ function createBaseAssaultRanges(): AssaultRanges { } export const AssaultRanges: MessageFns = { - encode(message: AssaultRanges, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: AssaultRanges, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { for (const v of message.ranges) { AssaultRange.encode(v!, writer.uint32(10).fork()).join(); } @@ -3194,7 +3630,8 @@ export const AssaultRanges: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): AssaultRanges { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAssaultRanges(); while (reader.pos < end) { @@ -3219,7 +3656,9 @@ export const AssaultRanges: MessageFns = { fromJSON(object: any): AssaultRanges { return { - ranges: globalThis.Array.isArray(object?.ranges) ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) : [], + ranges: globalThis.Array.isArray(object?.ranges) + ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) + : [], }; }, @@ -3231,12 +3670,17 @@ export const AssaultRanges: MessageFns = { return obj; }, - create, I>>(base?: I): AssaultRanges { + create, I>>( + base?: I, + ): AssaultRanges { return AssaultRanges.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): AssaultRanges { + fromPartial, I>>( + object: I, + ): AssaultRanges { const message = createBaseAssaultRanges(); - message.ranges = object.ranges?.map((e) => AssaultRange.fromPartial(e)) || []; + message.ranges = + object.ranges?.map((e) => AssaultRange.fromPartial(e)) || []; return message; }, }; @@ -3246,7 +3690,10 @@ function createBaseAssaultRange(): AssaultRange { } export const AssaultRange: MessageFns = { - encode(message: AssaultRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: AssaultRange, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.distance !== 0) { writer.uint32(13).float(message.distance); } @@ -3257,7 +3704,8 @@ export const AssaultRange: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): AssaultRange { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAssaultRange(); while (reader.pos < end) { @@ -3306,10 +3754,14 @@ export const AssaultRange: MessageFns = { return obj; }, - create, I>>(base?: I): AssaultRange { + create, I>>( + base?: I, + ): AssaultRange { return AssaultRange.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): AssaultRange { + fromPartial, I>>( + object: I, + ): AssaultRange { const message = createBaseAssaultRange(); message.distance = object.distance ?? 0; message.factor = object.factor ?? 0; @@ -3325,7 +3777,7 @@ function createBaseShellDefinition(): ShellDefinition { armor_damage: 0, module_damage: 0, caliber: 0, - icon: "", + icon: '', penetration: undefined, type: 0, normalization: 0, @@ -3336,7 +3788,10 @@ function createBaseShellDefinition(): ShellDefinition { } export const ShellDefinition: MessageFns = { - encode(message: ShellDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ShellDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -3355,11 +3810,14 @@ export const ShellDefinition: MessageFns = { if (message.caliber !== 0) { writer.uint32(53).float(message.caliber); } - if (message.icon !== "") { + if (message.icon !== '') { writer.uint32(58).string(message.icon); } if (message.penetration !== undefined) { - ShellPenetration.encode(message.penetration, writer.uint32(66).fork()).join(); + ShellPenetration.encode( + message.penetration, + writer.uint32(66).fork(), + ).join(); } if (message.type !== 0) { writer.uint32(72).int32(message.type); @@ -3370,7 +3828,10 @@ export const ShellDefinition: MessageFns = { if (message.ricochet !== undefined && message.ricochet !== 0) { writer.uint32(93).float(message.ricochet); } - if (message.explosion_radius !== undefined && message.explosion_radius !== 0) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== 0 + ) { writer.uint32(101).float(message.explosion_radius); } if (message.range !== 0) { @@ -3380,7 +3841,8 @@ export const ShellDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): ShellDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseShellDefinition(); while (reader.pos < end) { @@ -3447,7 +3909,10 @@ export const ShellDefinition: MessageFns = { break; } - message.penetration = ShellPenetration.decode(reader, reader.uint32()); + message.penetration = ShellPenetration.decode( + reader, + reader.uint32(), + ); continue; } case 9: { @@ -3504,15 +3969,25 @@ export const ShellDefinition: MessageFns = { 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, - armor_damage: isSet(object.armor_damage) ? globalThis.Number(object.armor_damage) : 0, - module_damage: isSet(object.module_damage) ? globalThis.Number(object.module_damage) : 0, + armor_damage: isSet(object.armor_damage) + ? globalThis.Number(object.armor_damage) + : 0, + module_damage: isSet(object.module_damage) + ? globalThis.Number(object.module_damage) + : 0, caliber: isSet(object.caliber) ? globalThis.Number(object.caliber) : 0, - icon: isSet(object.icon) ? globalThis.String(object.icon) : "", - penetration: isSet(object.penetration) ? ShellPenetration.fromJSON(object.penetration) : undefined, + icon: isSet(object.icon) ? globalThis.String(object.icon) : '', + penetration: isSet(object.penetration) + ? ShellPenetration.fromJSON(object.penetration) + : undefined, type: isSet(object.type) ? shellTypeFromJSON(object.type) : 0, - normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : 0, + normalization: isSet(object.normalization) + ? globalThis.Number(object.normalization) + : 0, ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : 0, - explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : 0, + explosion_radius: isSet(object.explosion_radius) + ? globalThis.Number(object.explosion_radius) + : 0, range: isSet(object.range) ? globalThis.Number(object.range) : 0, }; }, @@ -3537,7 +4012,7 @@ export const ShellDefinition: MessageFns = { if (message.caliber !== 0) { obj.caliber = message.caliber; } - if (message.icon !== "") { + if (message.icon !== '') { obj.icon = message.icon; } if (message.penetration !== undefined) { @@ -3552,7 +4027,10 @@ export const ShellDefinition: MessageFns = { if (message.ricochet !== undefined && message.ricochet !== 0) { obj.ricochet = message.ricochet; } - if (message.explosion_radius !== undefined && message.explosion_radius !== 0) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== 0 + ) { obj.explosion_radius = message.explosion_radius; } if (message.range !== 0) { @@ -3561,23 +4039,29 @@ export const ShellDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): ShellDefinition { + create, I>>( + base?: I, + ): ShellDefinition { return ShellDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ShellDefinition { + fromPartial, I>>( + object: I, + ): ShellDefinition { const message = createBaseShellDefinition(); message.id = object.id ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.velocity = object.velocity ?? 0; message.armor_damage = object.armor_damage ?? 0; message.module_damage = object.module_damage ?? 0; message.caliber = object.caliber ?? 0; - message.icon = object.icon ?? ""; - message.penetration = (object.penetration !== undefined && object.penetration !== null) - ? ShellPenetration.fromPartial(object.penetration) - : undefined; + message.icon = object.icon ?? ''; + message.penetration = + object.penetration !== undefined && object.penetration !== null + ? ShellPenetration.fromPartial(object.penetration) + : undefined; message.type = object.type ?? 0; message.normalization = object.normalization ?? 0; message.ricochet = object.ricochet ?? 0; @@ -3592,7 +4076,10 @@ function createBaseShellPenetration(): ShellPenetration { } export const ShellPenetration: MessageFns = { - encode(message: ShellPenetration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ShellPenetration, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.near !== 0) { writer.uint32(13).float(message.near); } @@ -3603,7 +4090,8 @@ export const ShellPenetration: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): ShellPenetration { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseShellPenetration(); while (reader.pos < end) { @@ -3652,10 +4140,14 @@ export const ShellPenetration: MessageFns = { return obj; }, - create, I>>(base?: I): ShellPenetration { + create, I>>( + base?: I, + ): ShellPenetration { return ShellPenetration.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ShellPenetration { + fromPartial, I>>( + object: I, + ): ShellPenetration { const message = createBaseShellPenetration(); message.near = object.near ?? 0; message.far = object.far ?? 0; @@ -3668,7 +4160,10 @@ function createBaseUnlock(): Unlock { } export const Unlock: MessageFns = { - encode(message: Unlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: Unlock, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); } @@ -3682,7 +4177,8 @@ export const Unlock: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Unlock { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUnlock(); while (reader.pos < end) { @@ -3750,20 +4246,24 @@ export const Unlock: MessageFns = { const message = createBaseUnlock(); message.id = object.id ?? 0; message.type = object.type ?? 0; - message.cost = (object.cost !== undefined && object.cost !== null) - ? UnlockCost.fromPartial(object.cost) - : undefined; + message.cost = + object.cost !== undefined && object.cost !== null + ? UnlockCost.fromPartial(object.cost) + : undefined; return message; }, }; function createBaseUnlockCost(): UnlockCost { - return { type: "", value: 0 }; + return { type: '', value: 0 }; } export const UnlockCost: MessageFns = { - encode(message: UnlockCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.type !== "") { + encode( + message: UnlockCost, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== '') { writer.uint32(10).string(message.type); } if (message.value !== 0) { @@ -3773,7 +4273,8 @@ export const UnlockCost: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): UnlockCost { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUnlockCost(); while (reader.pos < end) { @@ -3806,14 +4307,14 @@ export const UnlockCost: MessageFns = { fromJSON(object: any): UnlockCost { return { - type: isSet(object.type) ? globalThis.String(object.type) : "", + type: isSet(object.type) ? globalThis.String(object.type) : '', value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, toJSON(message: UnlockCost): unknown { const obj: any = {}; - if (message.type !== "") { + if (message.type !== '') { obj.type = message.type; } if (message.value !== 0) { @@ -3825,9 +4326,11 @@ export const UnlockCost: MessageFns = { create, I>>(base?: I): UnlockCost { return UnlockCost.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UnlockCost { + fromPartial, I>>( + object: I, + ): UnlockCost { const message = createBaseUnlockCost(); - message.type = object.type ?? ""; + message.type = object.type ?? ''; message.value = object.value ?? 0; return message; }, @@ -3838,7 +4341,10 @@ function createBaseCrew(): Crew { } export const Crew: MessageFns = { - encode(message: Crew, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: Crew, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } @@ -3854,7 +4360,8 @@ export const Crew: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Crew { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCrew(); while (reader.pos < end) { @@ -3939,21 +4446,36 @@ export const Crew: MessageFns = { }, }; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; +export type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends { $case: string; value: unknown } + ? { $case: T['$case']; value?: DeepPartial } + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; function isObject(value: any): boolean { - return typeof value === "object" && value !== null; + return typeof value === 'object' && value !== null; } function isSet(value: any): boolean { diff --git a/packages/scripts/src/buildAssets/definitions.ts b/packages/scripts/src/buildAssets/definitions.ts index 94be82e5d..8498021e0 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -1250,7 +1250,7 @@ export async function definitions() { let assault_ranges: AssaultRanges | undefined; if (gun.extras?.trayShell) { - const kinds = gun.extras.trayShell.kinds + const types = gun.extras.trayShell.kinds .split(' ') .map((string) => { const trimmed = string.trim(); @@ -1270,6 +1270,7 @@ export async function definitions() { const sector = gun.extras.trayShell.sectors.sector; assault_ranges = { + types, ranges: sector.map((value) => ({ factor: value.factor, distance: value.distance, diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index a5f74676e..8e7f53658 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -118,6 +118,7 @@ export function InfoWithDelta({ tank, track: member.track, turret: member.turret, + assaultDistance: 0, }, { equipmentDefinitions, diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx index 060b03ef5..ceeb805a6 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx @@ -58,6 +58,7 @@ export function Characteristics() { applyReactiveArmor: false, applyDynamicArmor: false, applySpallLiner: false, + assaultDistance: 0, }, { tankModelDefinition, diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx index 15b6a60de..1fc2632ba 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx @@ -96,6 +96,7 @@ export function SceneProps() { stockTurret: tank.turrets[0], stockTrack: tank.tracks[0], track, + assaultDistance: 0, }, { equipmentDefinitions, provisionDefinitions, tankModelDefinition }, ); diff --git a/packages/website/src/core/blitzkit/tankCharacteristics.ts b/packages/website/src/core/blitzkit/tankCharacteristics.ts index a9410cb77..c332211ac 100644 --- a/packages/website/src/core/blitzkit/tankCharacteristics.ts +++ b/packages/website/src/core/blitzkit/tankCharacteristics.ts @@ -46,6 +46,7 @@ export function tankCharacteristics( applyReactiveArmor, applyDynamicArmor, applySpallLiner, + assaultDistance, }: { tank: TankDefinition; turret: TurretDefinition; @@ -65,6 +66,7 @@ export function tankCharacteristics( applyReactiveArmor: boolean; applyDynamicArmor: boolean; applySpallLiner: boolean; + assaultDistance: number; }, { tankModelDefinition, @@ -157,6 +159,13 @@ export function tankCharacteristics( [applyDynamicArmor, -0.1], [applySpallLiner && shell.type === ShellType.HE, -0.2], ); + const assaultDamageCoefficient = + gun.gun_type!.value.base.assault_ranges && + gun.gun_type!.value.base.assault_ranges.types.includes(shell.type) + ? (gun.gun_type!.value.base.assault_ranges.ranges.find( + ({ distance }) => distance >= assaultDistance, + )?.factor ?? 0) + : 1; const moduleDamageCoefficient = coefficient([hasTungsten, 0.15]); const reloadCoefficient = (coefficient([hasGunRammer, -0.05]) * @@ -326,10 +335,11 @@ export function tankCharacteristics( stockTurret.weight + stockGun.gun_type!.value.base.weight; const resolvedEnginePower = engine.power * enginePowerCoefficient; + const damageCoefficient = armorDamageCoefficient * assaultDamageCoefficient; const dpm = resolveDpm( gun, shell, - armorDamageCoefficient, + damageCoefficient, reloadCoefficient, intraClipCoefficient, ); @@ -352,7 +362,7 @@ export function tankCharacteristics( return current; }, null)!.index : undefined; - const damage = shell.armor_damage * armorDamageCoefficient; + const damage = shell.armor_damage * damageCoefficient; const dpmEffective = gun.gun_type!.$case === 'auto_reloader' ? gun.gun_type!.value.extension.shell_reloads[0] > diff --git a/packages/website/src/pages/[...locale]/compare/_index.tsx b/packages/website/src/pages/[...locale]/compare/_index.tsx index f39e322f0..f3a4773c6 100644 --- a/packages/website/src/pages/[...locale]/compare/_index.tsx +++ b/packages/website/src/pages/[...locale]/compare/_index.tsx @@ -85,6 +85,7 @@ function Content() { member.key !== thisMember.key && member.provisions.includes(101), ), + assaultDistance: 0, }, { equipmentDefinitions: equipmentDefinitions, diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro index 11f8567f1..5db83f641 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro @@ -60,6 +60,7 @@ const url = import.meta.env.SITE + Astro.url.pathname; const icon = asset(`icons/tanks/big/${id}.webp`); const turret = tank.turrets.at(-1)!; const gun = turret.guns.at(-1)!; +const shell = gun.gun_type!.value.base.shells[0]; const characteristics = tankCharacteristics( { tank, @@ -74,12 +75,13 @@ const characteristics = tankCharacteristics( turret, gun, provisions: createDefaultProvisions(tank, gun, provisionDefinitions), - shell: gun.gun_type!.value.base.shells[0], + shell, stockEngine: tank.engines[0], stockGun: tank.turrets[0].guns[0], stockTurret: tank.turrets[0], stockTrack: tank.tracks[0], track: tank.tracks.at(-1)!, + assaultDistance: 0, }, { equipmentDefinitions, provisionDefinitions, tankModelDefinition }, );