diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index 01fd44dae..fca4e554a 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 { I18nString, createBaseI18nString } from "./i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } 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', + ); } } @@ -261,6 +285,7 @@ export interface TankDefinitions_TanksEntry { export interface TankDefinition { id: number; + slug: string; roles: { [key: number]: number }; fixed_camouflage: boolean; camouflages: number[]; @@ -270,7 +295,6 @@ export interface TankDefinition { health: number; nation: string; name: I18nString; - name_full?: I18nString | undefined; 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,9 +379,9 @@ 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; } @@ -453,15 +477,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) { @@ -472,7 +503,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; } @@ -490,10 +524,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; + }, {}) : {}, }; }, @@ -512,20 +548,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; }, }; @@ -534,83 +573,101 @@ function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry { return { key: 0, value: createBaseTankDefinition() }; } -export const TankDefinitions_TanksEntry: MessageFns = { - encode(message: TankDefinitions_TanksEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== undefined) { - 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 !== undefined) { + 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: globalThis.Number(assertSet("TankDefinitions_TanksEntry.key", object.key)), - value: TankDefinition.fromJSON(assertSet("TankDefinitions_TanksEntry.value", object.value)), - }; - }, + 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 !== undefined) { - 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: globalThis.Number( + assertSet('TankDefinitions_TanksEntry.key', object.key), + ), + value: TankDefinition.fromJSON( + assertSet('TankDefinitions_TanksEntry.value', object.value), + ), + }; + }, + + toJSON(message: TankDefinitions_TanksEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + 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: '', roles: {}, fixed_camouflage: false, camouflages: [], @@ -618,9 +675,8 @@ function createBaseTankDefinition(): TankDefinition { successors: [], crew: [], health: 0, - nation: "", + nation: '', name: createBaseI18nString(), - name_full: undefined, type: 0, max_consumables: 0, max_provisions: 0, @@ -638,51 +694,57 @@ 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 !== '') { + writer.uint32(18).string(message.slug); + } Object.entries(message.roles).forEach(([key, value]) => { - TankDefinition_RolesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + TankDefinition_RolesEntry.encode( + { key: key as any, value }, + writer.uint32(26).fork(), + ).join(); }); if (message.fixed_camouflage !== false) { - writer.uint32(32).bool(message.fixed_camouflage); + writer.uint32(40).bool(message.fixed_camouflage); } - writer.uint32(42).fork(); + writer.uint32(50).fork(); for (const v of message.camouflages) { writer.int32(v); } writer.join(); - writer.uint32(50).fork(); + writer.uint32(58).fork(); for (const v of message.ancestors) { writer.int32(v); } writer.join(); - writer.uint32(58).fork(); + writer.uint32(66).fork(); for (const v of message.successors) { writer.int32(v); } writer.join(); for (const v of message.crew) { - Crew.encode(v!, writer.uint32(66).fork()).join(); + Crew.encode(v!, writer.uint32(74).fork()).join(); } if (message.health !== 0) { - writer.uint32(72).uint32(message.health); + writer.uint32(80).uint32(message.health); } - if (message.nation !== "") { - writer.uint32(82).string(message.nation); + if (message.nation !== '') { + writer.uint32(90).string(message.nation); } if (message.name !== undefined) { - I18nString.encode(message.name, writer.uint32(90).fork()).join(); - } - if (message.name_full !== undefined) { - I18nString.encode(message.name_full, writer.uint32(98).fork()).join(); + I18nString.encode(message.name, writer.uint32(98).fork()).join(); } if (message.type !== 0) { writer.uint32(104).int32(message.type); @@ -718,7 +780,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); @@ -735,7 +800,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) { @@ -745,7 +810,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) { @@ -764,28 +830,39 @@ export const TankDefinition: MessageFns = { break; } - const entry2 = TankDefinition_RolesEntry.decode(reader, reader.uint32()); - if (entry2.value !== undefined) { - message.roles[entry2.key] = entry2.value; + message.slug = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = TankDefinition_RolesEntry.decode( + reader, + reader.uint32(), + ); + if (entry3.value !== undefined) { + message.roles[entry3.key] = entry3.value; } continue; } - case 4: { - if (tag !== 32) { + case 5: { + if (tag !== 40) { break; } message.fixed_camouflage = reader.bool(); continue; } - case 5: { - if (tag === 40) { + case 6: { + if (tag === 48) { message.camouflages.push(reader.int32()); continue; } - if (tag === 42) { + if (tag === 50) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.camouflages.push(reader.int32()); @@ -796,14 +873,14 @@ export const TankDefinition: MessageFns = { break; } - case 6: { - if (tag === 48) { + case 7: { + if (tag === 56) { message.ancestors.push(reader.int32()); continue; } - if (tag === 50) { + if (tag === 58) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.ancestors.push(reader.int32()); @@ -814,14 +891,14 @@ export const TankDefinition: MessageFns = { break; } - case 7: { - if (tag === 56) { + case 8: { + if (tag === 64) { message.successors.push(reader.int32()); continue; } - if (tag === 58) { + if (tag === 66) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.successors.push(reader.int32()); @@ -832,36 +909,28 @@ export const TankDefinition: MessageFns = { break; } - case 8: { - if (tag !== 66) { + case 9: { + if (tag !== 74) { break; } message.crew.push(Crew.decode(reader, reader.uint32())); continue; } - case 9: { - if (tag !== 72) { + case 10: { + if (tag !== 80) { break; } message.health = reader.uint32(); continue; } - case 10: { - if (tag !== 82) { - break; - } - - message.nation = reader.string(); - continue; - } case 11: { if (tag !== 90) { break; } - message.name = I18nString.decode(reader, reader.uint32()); + message.nation = reader.string(); continue; } case 12: { @@ -869,7 +938,7 @@ export const TankDefinition: MessageFns = { break; } - message.name_full = I18nString.decode(reader, reader.uint32()); + message.name = I18nString.decode(reader, reader.uint32()); continue; } case 13: { @@ -933,7 +1002,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: { @@ -941,7 +1012,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: { @@ -1035,14 +1108,20 @@ export const TankDefinition: MessageFns = { fromJSON(object: any): TankDefinition { return { - id: globalThis.Number(assertSet("TankDefinition.id", object.id)), + id: globalThis.Number(assertSet('TankDefinition.id', object.id)), + slug: globalThis.String(assertSet('TankDefinition.slug', 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: globalThis.Boolean(assertSet("TankDefinition.fixed_camouflage", object.fixed_camouflage)), + fixed_camouflage: globalThis.Boolean( + assertSet('TankDefinition.fixed_camouflage', object.fixed_camouflage), + ), camouflages: globalThis.Array.isArray(object?.camouflages) ? object.camouflages.map((e: any) => globalThis.Number(e)) : [], @@ -1052,18 +1131,31 @@ 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)) : [], - health: globalThis.Number(assertSet("TankDefinition.health", object.health)), - nation: globalThis.String(assertSet("TankDefinition.nation", object.nation)), - name: I18nString.fromJSON(assertSet("TankDefinition.name", object.name)), - name_full: isSet(object.name_full) ? I18nString.fromJSON(object.name_full) : undefined, - type: tankTypeFromJSON(assertSet("TankDefinition.type", object.type)), - max_consumables: globalThis.Number(assertSet("TankDefinition.max_consumables", object.max_consumables)), - max_provisions: globalThis.Number(assertSet("TankDefinition.max_provisions", object.max_provisions)), - tier: globalThis.Number(assertSet("TankDefinition.tier", object.tier)), - class: tankClassFromJSON(assertSet("TankDefinition.class", object.class)), - testing: globalThis.Boolean(assertSet("TankDefinition.testing", object.testing)), - deprecated: globalThis.Boolean(assertSet("TankDefinition.deprecated", object.deprecated)), + crew: globalThis.Array.isArray(object?.crew) + ? object.crew.map((e: any) => Crew.fromJSON(e)) + : [], + health: globalThis.Number( + assertSet('TankDefinition.health', object.health), + ), + nation: globalThis.String( + assertSet('TankDefinition.nation', object.nation), + ), + name: I18nString.fromJSON(assertSet('TankDefinition.name', object.name)), + type: tankTypeFromJSON(assertSet('TankDefinition.type', object.type)), + max_consumables: globalThis.Number( + assertSet('TankDefinition.max_consumables', object.max_consumables), + ), + max_provisions: globalThis.Number( + assertSet('TankDefinition.max_provisions', object.max_provisions), + ), + tier: globalThis.Number(assertSet('TankDefinition.tier', object.tier)), + class: tankClassFromJSON(assertSet('TankDefinition.class', object.class)), + testing: globalThis.Boolean( + assertSet('TankDefinition.testing', object.testing), + ), + deprecated: globalThis.Boolean( + assertSet('TankDefinition.deprecated', object.deprecated), + ), turrets: globalThis.Array.isArray(object?.turrets) ? object.turrets.map((e: any) => TurretDefinition.fromJSON(e)) : [], @@ -1073,15 +1165,33 @@ export const TankDefinition: MessageFns = { tracks: globalThis.Array.isArray(object?.tracks) ? object.tracks.map((e: any) => TrackDefinition.fromJSON(e)) : [], - price: TankPrice.fromJSON(assertSet("TankDefinition.price", object.price)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - speed_forwards: globalThis.Number(assertSet("TankDefinition.speed_forwards", object.speed_forwards)), - speed_backwards: globalThis.Number(assertSet("TankDefinition.speed_backwards", object.speed_backwards)), - camouflage_still: globalThis.Number(assertSet("TankDefinition.camouflage_still", object.camouflage_still)), - camouflage_moving: globalThis.Number(assertSet("TankDefinition.camouflage_moving", object.camouflage_moving)), - camouflage_onFire: globalThis.Number(assertSet("TankDefinition.camouflage_onFire", object.camouflage_onFire)), - equipment_preset: globalThis.String(assertSet("TankDefinition.equipment_preset", object.equipment_preset)), - weight: globalThis.Number(assertSet("TankDefinition.weight", object.weight)), + price: TankPrice.fromJSON( + assertSet('TankDefinition.price', object.price), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + speed_forwards: globalThis.Number( + assertSet('TankDefinition.speed_forwards', object.speed_forwards), + ), + speed_backwards: globalThis.Number( + assertSet('TankDefinition.speed_backwards', object.speed_backwards), + ), + camouflage_still: globalThis.Number( + assertSet('TankDefinition.camouflage_still', object.camouflage_still), + ), + camouflage_moving: globalThis.Number( + assertSet('TankDefinition.camouflage_moving', object.camouflage_moving), + ), + camouflage_onFire: globalThis.Number( + assertSet('TankDefinition.camouflage_onFire', object.camouflage_onFire), + ), + equipment_preset: globalThis.String( + assertSet('TankDefinition.equipment_preset', object.equipment_preset), + ), + weight: globalThis.Number( + assertSet('TankDefinition.weight', object.weight), + ), }; }, @@ -1090,6 +1200,9 @@ export const TankDefinition: MessageFns = { if (message.id !== 0) { obj.id = Math.round(message.id); } + if (message.slug !== '') { + obj.slug = message.slug; + } if (message.roles) { const entries = Object.entries(message.roles); if (entries.length > 0) { @@ -1117,15 +1230,12 @@ 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) { obj.name = I18nString.toJSON(message.name); } - if (message.name_full !== undefined) { - obj.name_full = I18nString.toJSON(message.name_full); - } if (message.type !== 0) { obj.type = tankTypeToJSON(message.type); } @@ -1177,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) { @@ -1186,13 +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.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); } @@ -1204,13 +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) - : createBaseI18nString(); - message.name_full = (object.name_full !== undefined && object.name_full !== null) - ? I18nString.fromPartial(object.name_full) - : undefined; + message.nation = object.nation ?? ''; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); message.type = object.type ?? 0; message.max_consumables = object.max_consumables ?? 0; message.max_provisions = object.max_provisions ?? 0; @@ -1218,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) - : createBaseTankPrice(); - 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) + : createBaseTankPrice(); + 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; }, @@ -1242,97 +1362,120 @@ 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 !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - 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 !== undefined) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + writer.uint32(16).uint32(message.value); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinition_RolesEntry { - return { - key: globalThis.Number(assertSet("TankDefinition_RolesEntry.key", object.key)), - value: globalThis.Number(assertSet("TankDefinition_RolesEntry.value", object.value)), - }; - }, + 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 !== undefined) { - obj.key = Math.round(message.key); - } - if (message.value !== undefined) { - 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: globalThis.Number( + assertSet('TankDefinition_RolesEntry.key', object.key), + ), + value: globalThis.Number( + assertSet('TankDefinition_RolesEntry.value', object.value), + ), + }; + }, + + toJSON(message: TankDefinition_RolesEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + 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) { @@ -1343,7 +1486,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: { @@ -1352,7 +1495,7 @@ export const ResearchCost: MessageFns = { } message.research_cost_type = { - $case: "seasonal_tokens", + $case: 'seasonal_tokens', value: ResearchCostSeasonalTokens.decode(reader, reader.uint32()), }; continue; @@ -1369,44 +1512,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; @@ -1417,84 +1576,103 @@ 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: globalThis.Number(assertSet("ResearchCostSeasonalTokens.season", object.season)), - tokens: globalThis.Number(assertSet("ResearchCostSeasonalTokens.tokens", object.tokens)), - }; - }, + 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: globalThis.Number( + assertSet('ResearchCostSeasonalTokens.season', object.season), + ), + tokens: globalThis.Number( + assertSet('ResearchCostSeasonalTokens.tokens', object.tokens), + ), + }; + }, + + 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); } @@ -1505,7 +1683,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) { @@ -1538,8 +1717,8 @@ export const TankPrice: MessageFns = { fromJSON(object: any): TankPrice { return { - type: tankPriceTypeFromJSON(assertSet("TankPrice.type", object.type)), - value: globalThis.Number(assertSet("TankPrice.value", object.value)), + type: tankPriceTypeFromJSON(assertSet('TankPrice.type', object.type)), + value: globalThis.Number(assertSet('TankPrice.value', object.value)), }; }, @@ -1557,7 +1736,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; @@ -1583,7 +1764,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); } @@ -1600,7 +1784,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); @@ -1624,7 +1811,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) { @@ -1737,20 +1925,42 @@ export const TrackDefinition: MessageFns = { fromJSON(object: any): TrackDefinition { return { - id: globalThis.Number(assertSet("TrackDefinition.id", object.id)), - tier: globalThis.Number(assertSet("TrackDefinition.tier", object.tier)), - name: I18nString.fromJSON(assertSet("TrackDefinition.name", object.name)), - weight: globalThis.Number(assertSet("TrackDefinition.weight", object.weight)), - traverse_speed: globalThis.Number(assertSet("TrackDefinition.traverse_speed", object.traverse_speed)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - dispersion_move: globalThis.Number(assertSet("TrackDefinition.dispersion_move", object.dispersion_move)), - dispersion_traverse: globalThis.Number( - assertSet("TrackDefinition.dispersion_traverse", object.dispersion_traverse), + id: globalThis.Number(assertSet('TrackDefinition.id', object.id)), + tier: globalThis.Number(assertSet('TrackDefinition.tier', object.tier)), + name: I18nString.fromJSON(assertSet('TrackDefinition.name', object.name)), + weight: globalThis.Number( + assertSet('TrackDefinition.weight', object.weight), ), - resistance_hard: globalThis.Number(assertSet("TrackDefinition.resistance_hard", object.resistance_hard)), - resistance_medium: globalThis.Number(assertSet("TrackDefinition.resistance_medium", object.resistance_medium)), - resistance_soft: globalThis.Number(assertSet("TrackDefinition.resistance_soft", object.resistance_soft)), - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + traverse_speed: globalThis.Number( + assertSet('TrackDefinition.traverse_speed', object.traverse_speed), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + dispersion_move: globalThis.Number( + assertSet('TrackDefinition.dispersion_move', object.dispersion_move), + ), + dispersion_traverse: globalThis.Number( + assertSet( + 'TrackDefinition.dispersion_traverse', + object.dispersion_traverse, + ), + ), + resistance_hard: globalThis.Number( + assertSet('TrackDefinition.resistance_hard', object.resistance_hard), + ), + resistance_medium: globalThis.Number( + assertSet( + 'TrackDefinition.resistance_medium', + object.resistance_medium, + ), + ), + resistance_soft: globalThis.Number( + assertSet('TrackDefinition.resistance_soft', object.resistance_soft), + ), + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1795,21 +2005,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) - : createBaseI18nString(); + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); 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; @@ -1834,7 +2050,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); } @@ -1842,7 +2061,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); @@ -1863,7 +2085,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) { @@ -1944,14 +2167,26 @@ export const EngineDefinition: MessageFns = { fromJSON(object: any): EngineDefinition { return { - id: globalThis.Number(assertSet("EngineDefinition.id", object.id)), - name: I18nString.fromJSON(assertSet("EngineDefinition.name", object.name)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - tier: globalThis.Number(assertSet("EngineDefinition.tier", object.tier)), - fire_chance: globalThis.Number(assertSet("EngineDefinition.fire_chance", object.fire_chance)), - power: globalThis.Number(assertSet("EngineDefinition.power", object.power)), - weight: globalThis.Number(assertSet("EngineDefinition.weight", object.weight)), - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + id: globalThis.Number(assertSet('EngineDefinition.id', object.id)), + name: I18nString.fromJSON( + assertSet('EngineDefinition.name', object.name), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + tier: globalThis.Number(assertSet('EngineDefinition.tier', object.tier)), + fire_chance: globalThis.Number( + assertSet('EngineDefinition.fire_chance', object.fire_chance), + ), + power: globalThis.Number( + assertSet('EngineDefinition.power', object.power), + ), + weight: globalThis.Number( + assertSet('EngineDefinition.weight', object.weight), + ), + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1984,18 +2219,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) - : createBaseI18nString(); - 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) + : createBaseI18nString(); + 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; @@ -2021,7 +2262,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); } @@ -2035,7 +2279,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(); @@ -2056,7 +2303,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) { @@ -2153,16 +2401,32 @@ export const TurretDefinition: MessageFns = { fromJSON(object: any): TurretDefinition { return { - id: globalThis.Number(assertSet("TurretDefinition.id", object.id)), - health: globalThis.Number(assertSet("TurretDefinition.health", object.health)), - view_range: globalThis.Number(assertSet("TurretDefinition.view_range", object.view_range)), - traverse_speed: globalThis.Number(assertSet("TurretDefinition.traverse_speed", object.traverse_speed)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - name: I18nString.fromJSON(assertSet("TurretDefinition.name", object.name)), - tier: globalThis.Number(assertSet("TurretDefinition.tier", object.tier)), - weight: globalThis.Number(assertSet("TurretDefinition.weight", object.weight)), - 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)) : [], + id: globalThis.Number(assertSet('TurretDefinition.id', object.id)), + health: globalThis.Number( + assertSet('TurretDefinition.health', object.health), + ), + view_range: globalThis.Number( + assertSet('TurretDefinition.view_range', object.view_range), + ), + traverse_speed: globalThis.Number( + assertSet('TurretDefinition.traverse_speed', object.traverse_speed), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + name: I18nString.fromJSON( + assertSet('TurretDefinition.name', object.name), + ), + tier: globalThis.Number(assertSet('TurretDefinition.tier', object.tier)), + weight: globalThis.Number( + assertSet('TurretDefinition.weight', object.weight), + ), + 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)) + : [], }; }, @@ -2201,21 +2465,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) - : createBaseI18nString(); + 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) + : createBaseI18nString(); message.tier = object.tier ?? 0; message.weight = object.weight ?? 0; message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || []; @@ -2229,23 +2499,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) { @@ -2256,7 +2539,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: { @@ -2264,7 +2550,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: { @@ -2273,7 +2562,7 @@ export const GunDefinition: MessageFns = { } message.gun_type = { - $case: "auto_reloader", + $case: 'auto_reloader', value: GunDefinitionAutoReloader.decode(reader, reader.uint32()), }; continue; @@ -2290,53 +2579,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), }; } @@ -2345,22 +2657,35 @@ export const GunDefinition: MessageFns = { }; function createBaseGunDefinitionRegular(): GunDefinitionRegular { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionRegularProperties() }; + return { + base: createBaseGunDefinitionBase(), + extension: createBaseGunDefinitionRegularProperties(), + }; } 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) { @@ -2379,7 +2704,10 @@ export const GunDefinitionRegular: MessageFns = { break; } - message.extension = GunDefinitionRegularProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionRegularProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2393,8 +2721,12 @@ export const GunDefinitionRegular: MessageFns = { fromJSON(object: any): GunDefinitionRegular { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionRegular.base", object.base)), - extension: GunDefinitionRegularProperties.fromJSON(assertSet("GunDefinitionRegular.extension", object.extension)), + base: GunDefinitionBase.fromJSON( + assertSet('GunDefinitionRegular.base', object.base), + ), + extension: GunDefinitionRegularProperties.fromJSON( + assertSet('GunDefinitionRegular.extension', object.extension), + ), }; }, @@ -2409,17 +2741,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) - : createBaseGunDefinitionBase(); - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionRegularProperties.fromPartial(object.extension) - : createBaseGunDefinitionRegularProperties(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : createBaseGunDefinitionBase(); + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionRegularProperties.fromPartial(object.extension) + : createBaseGunDefinitionRegularProperties(); return message; }, }; @@ -2428,79 +2766,106 @@ 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: globalThis.Number( + assertSet('GunDefinitionRegularProperties.reload', object.reload), + ), + }; + }, + + 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: globalThis.Number(assertSet("GunDefinitionRegularProperties.reload", object.reload)) }; - }, - - 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: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoLoaderProperties() }; + return { + base: createBaseGunDefinitionBase(), + extension: createBaseGunDefinitionAutoLoaderProperties(), + }; } 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) { @@ -2519,7 +2884,10 @@ export const GunDefinitionAutoLoader: MessageFns = { break; } - message.extension = GunDefinitionAutoLoaderProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionAutoLoaderProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2533,9 +2901,11 @@ export const GunDefinitionAutoLoader: MessageFns = { fromJSON(object: any): GunDefinitionAutoLoader { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionAutoLoader.base", object.base)), + base: GunDefinitionBase.fromJSON( + assertSet('GunDefinitionAutoLoader.base', object.base), + ), extension: GunDefinitionAutoLoaderProperties.fromJSON( - assertSet("GunDefinitionAutoLoader.extension", object.extension), + assertSet('GunDefinitionAutoLoader.extension', object.extension), ), }; }, @@ -2546,22 +2916,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) - : createBaseGunDefinitionBase(); - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) - : createBaseGunDefinitionAutoLoaderProperties(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : createBaseGunDefinitionBase(); + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) + : createBaseGunDefinitionAutoLoaderProperties(); return message; }, }; @@ -2570,289 +2948,359 @@ 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: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.clip_reload", object.clip_reload)), - intra_clip: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.intra_clip", object.intra_clip)), - shell_count: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.shell_count", object.shell_count)), - }; - }, + 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: globalThis.Number( + assertSet( + 'GunDefinitionAutoLoaderProperties.clip_reload', + object.clip_reload, + ), + ), + intra_clip: globalThis.Number( + assertSet( + 'GunDefinitionAutoLoaderProperties.intra_clip', + object.intra_clip, + ), + ), + shell_count: globalThis.Number( + assertSet( + 'GunDefinitionAutoLoaderProperties.shell_count', + object.shell_count, + ), + ), + }; + }, + + 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: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoReloaderProperties() }; + return { + base: createBaseGunDefinitionBase(), + extension: createBaseGunDefinitionAutoReloaderProperties(), + }; } -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: GunDefinitionBase.fromJSON(assertSet("GunDefinitionAutoReloader.base", object.base)), - extension: GunDefinitionAutoReloaderProperties.fromJSON( - assertSet("GunDefinitionAutoReloader.extension", object.extension), - ), - }; - }, + 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) - : createBaseGunDefinitionBase(); - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) - : createBaseGunDefinitionAutoReloaderProperties(); - 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: GunDefinitionBase.fromJSON( + assertSet('GunDefinitionAutoReloader.base', object.base), + ), + extension: GunDefinitionAutoReloaderProperties.fromJSON( + assertSet('GunDefinitionAutoReloader.extension', object.extension), + ), + }; + }, + + 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) + : createBaseGunDefinitionBase(); + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) + : createBaseGunDefinitionAutoReloaderProperties(); + 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: globalThis.Number( + assertSet( + 'GunDefinitionAutoReloaderProperties.intra_clip', + object.intra_clip, + ), + ), + shell_count: globalThis.Number( + assertSet( + 'GunDefinitionAutoReloaderProperties.shell_count', + object.shell_count, + ), + ), + }; + }, + + 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: globalThis.Number(assertSet("GunDefinitionAutoReloaderProperties.intra_clip", object.intra_clip)), - shell_count: globalThis.Number(assertSet("GunDefinitionAutoReloaderProperties.shell_count", object.shell_count)), - }; - }, - - 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 { @@ -2875,7 +3323,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); } @@ -2883,7 +3334,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,7 +3379,8 @@ export const GunDefinitionBase: MessageFns = { }, 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,27 +3517,53 @@ export const GunDefinitionBase: MessageFns = { fromJSON(object: any): GunDefinitionBase { return { - id: globalThis.Number(assertSet("GunDefinitionBase.id", object.id)), - rotation_speed: globalThis.Number(assertSet("GunDefinitionBase.rotation_speed", object.rotation_speed)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - weight: globalThis.Number(assertSet("GunDefinitionBase.weight", object.weight)), - name: I18nString.fromJSON(assertSet("GunDefinitionBase.name", object.name)), - tier: globalThis.Number(assertSet("GunDefinitionBase.tier", object.tier)), + id: globalThis.Number(assertSet('GunDefinitionBase.id', object.id)), + rotation_speed: globalThis.Number( + assertSet('GunDefinitionBase.rotation_speed', object.rotation_speed), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + weight: globalThis.Number( + assertSet('GunDefinitionBase.weight', object.weight), + ), + name: I18nString.fromJSON( + assertSet('GunDefinitionBase.name', object.name), + ), + tier: globalThis.Number(assertSet('GunDefinitionBase.tier', object.tier)), shells: globalThis.Array.isArray(object?.shells) ? object.shells.map((e: any) => ShellDefinition.fromJSON(e)) : [], - camouflage_loss: globalThis.Number(assertSet("GunDefinitionBase.camouflage_loss", object.camouflage_loss)), - aim_time: globalThis.Number(assertSet("GunDefinitionBase.aim_time", object.aim_time)), - dispersion_base: globalThis.Number(assertSet("GunDefinitionBase.dispersion_base", object.dispersion_base)), + camouflage_loss: globalThis.Number( + assertSet('GunDefinitionBase.camouflage_loss', object.camouflage_loss), + ), + aim_time: globalThis.Number( + assertSet('GunDefinitionBase.aim_time', object.aim_time), + ), + dispersion_base: globalThis.Number( + assertSet('GunDefinitionBase.dispersion_base', object.dispersion_base), + ), dispersion_traverse: globalThis.Number( - assertSet("GunDefinitionBase.dispersion_traverse", object.dispersion_traverse), + assertSet( + 'GunDefinitionBase.dispersion_traverse', + object.dispersion_traverse, + ), + ), + dispersion_shot: globalThis.Number( + assertSet('GunDefinitionBase.dispersion_shot', object.dispersion_shot), ), - dispersion_shot: globalThis.Number(assertSet("GunDefinitionBase.dispersion_shot", object.dispersion_shot)), dispersion_damaged: globalThis.Number( - assertSet("GunDefinitionBase.dispersion_damaged", object.dispersion_damaged), + assertSet( + 'GunDefinitionBase.dispersion_damaged', + object.dispersion_damaged, + ), + ), + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], + shell_capacity: globalThis.Number( + assertSet('GunDefinitionBase.shell_capacity', object.shell_capacity), ), - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], - shell_capacity: globalThis.Number(assertSet("GunDefinitionBase.shell_capacity", object.shell_capacity)), }; }, @@ -3136,22 +3617,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) - : createBaseI18nString(); + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); 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; @@ -3172,7 +3660,7 @@ function createBaseShellDefinition(): ShellDefinition { armor_damage: 0, module_damage: 0, caliber: 0, - icon: "", + icon: '', penetration: createBaseShellPenetration(), type: 0, normalization: undefined, @@ -3183,7 +3671,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); } @@ -3202,22 +3693,31 @@ 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); } - if (message.normalization !== undefined && message.normalization !== undefined) { + if ( + message.normalization !== undefined && + message.normalization !== undefined + ) { writer.uint32(85).float(message.normalization); } if (message.ricochet !== undefined && message.ricochet !== undefined) { writer.uint32(93).float(message.ricochet); } - if (message.explosion_radius !== undefined && message.explosion_radius !== undefined) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== undefined + ) { writer.uint32(101).float(message.explosion_radius); } if (message.range !== 0) { @@ -3227,7 +3727,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) { @@ -3294,7 +3795,10 @@ export const ShellDefinition: MessageFns = { break; } - message.penetration = ShellPenetration.decode(reader, reader.uint32()); + message.penetration = ShellPenetration.decode( + reader, + reader.uint32(), + ); continue; } case 9: { @@ -3348,19 +3852,37 @@ export const ShellDefinition: MessageFns = { fromJSON(object: any): ShellDefinition { return { - id: globalThis.Number(assertSet("ShellDefinition.id", object.id)), - name: I18nString.fromJSON(assertSet("ShellDefinition.name", object.name)), - velocity: globalThis.Number(assertSet("ShellDefinition.velocity", object.velocity)), - armor_damage: globalThis.Number(assertSet("ShellDefinition.armor_damage", object.armor_damage)), - module_damage: globalThis.Number(assertSet("ShellDefinition.module_damage", object.module_damage)), - caliber: globalThis.Number(assertSet("ShellDefinition.caliber", object.caliber)), - icon: globalThis.String(assertSet("ShellDefinition.icon", object.icon)), - penetration: ShellPenetration.fromJSON(assertSet("ShellDefinition.penetration", object.penetration)), - type: shellTypeFromJSON(assertSet("ShellDefinition.type", object.type)), - normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : undefined, - ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : undefined, - explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : undefined, - range: globalThis.Number(assertSet("ShellDefinition.range", object.range)), + id: globalThis.Number(assertSet('ShellDefinition.id', object.id)), + name: I18nString.fromJSON(assertSet('ShellDefinition.name', object.name)), + velocity: globalThis.Number( + assertSet('ShellDefinition.velocity', object.velocity), + ), + armor_damage: globalThis.Number( + assertSet('ShellDefinition.armor_damage', object.armor_damage), + ), + module_damage: globalThis.Number( + assertSet('ShellDefinition.module_damage', object.module_damage), + ), + caliber: globalThis.Number( + assertSet('ShellDefinition.caliber', object.caliber), + ), + icon: globalThis.String(assertSet('ShellDefinition.icon', object.icon)), + penetration: ShellPenetration.fromJSON( + assertSet('ShellDefinition.penetration', object.penetration), + ), + type: shellTypeFromJSON(assertSet('ShellDefinition.type', object.type)), + normalization: isSet(object.normalization) + ? globalThis.Number(object.normalization) + : undefined, + ricochet: isSet(object.ricochet) + ? globalThis.Number(object.ricochet) + : undefined, + explosion_radius: isSet(object.explosion_radius) + ? globalThis.Number(object.explosion_radius) + : undefined, + range: globalThis.Number( + assertSet('ShellDefinition.range', object.range), + ), }; }, @@ -3384,7 +3906,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) { @@ -3393,13 +3915,19 @@ export const ShellDefinition: MessageFns = { if (message.type !== 0) { obj.type = shellTypeToJSON(message.type); } - if (message.normalization !== undefined && message.normalization !== undefined) { + if ( + message.normalization !== undefined && + message.normalization !== undefined + ) { obj.normalization = message.normalization; } if (message.ricochet !== undefined && message.ricochet !== undefined) { obj.ricochet = message.ricochet; } - if (message.explosion_radius !== undefined && message.explosion_radius !== undefined) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== undefined + ) { obj.explosion_radius = message.explosion_radius; } if (message.range !== 0) { @@ -3408,23 +3936,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) - : createBaseI18nString(); + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); 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) - : createBaseShellPenetration(); + message.icon = object.icon ?? ''; + message.penetration = + object.penetration !== undefined && object.penetration !== null + ? ShellPenetration.fromPartial(object.penetration) + : createBaseShellPenetration(); message.type = object.type ?? 0; message.normalization = object.normalization ?? undefined; message.ricochet = object.ricochet ?? undefined; @@ -3439,7 +3973,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); } @@ -3450,7 +3987,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) { @@ -3483,8 +4021,8 @@ export const ShellPenetration: MessageFns = { fromJSON(object: any): ShellPenetration { return { - near: globalThis.Number(assertSet("ShellPenetration.near", object.near)), - far: globalThis.Number(assertSet("ShellPenetration.far", object.far)), + near: globalThis.Number(assertSet('ShellPenetration.near', object.near)), + far: globalThis.Number(assertSet('ShellPenetration.far', object.far)), }; }, @@ -3499,10 +4037,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; @@ -3515,7 +4057,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); } @@ -3529,7 +4074,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) { @@ -3570,9 +4116,9 @@ export const Unlock: MessageFns = { fromJSON(object: any): Unlock { return { - id: globalThis.Number(assertSet("Unlock.id", object.id)), - type: moduleTypeFromJSON(assertSet("Unlock.type", object.type)), - cost: UnlockCost.fromJSON(assertSet("Unlock.cost", object.cost)), + id: globalThis.Number(assertSet('Unlock.id', object.id)), + type: moduleTypeFromJSON(assertSet('Unlock.type', object.type)), + cost: UnlockCost.fromJSON(assertSet('Unlock.cost', object.cost)), }; }, @@ -3597,20 +4143,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) - : createBaseUnlockCost(); + message.cost = + object.cost !== undefined && object.cost !== null + ? UnlockCost.fromPartial(object.cost) + : createBaseUnlockCost(); 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) { @@ -3620,7 +4170,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) { @@ -3653,14 +4204,14 @@ export const UnlockCost: MessageFns = { fromJSON(object: any): UnlockCost { return { - type: globalThis.String(assertSet("UnlockCost.type", object.type)), - value: globalThis.Number(assertSet("UnlockCost.value", object.value)), + type: globalThis.String(assertSet('UnlockCost.type', object.type)), + value: globalThis.Number(assertSet('UnlockCost.value', object.value)), }; }, toJSON(message: UnlockCost): unknown { const obj: any = {}; - if (message.type !== "") { + if (message.type !== '') { obj.type = message.type; } if (message.value !== 0) { @@ -3672,9 +4223,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; }, @@ -3685,7 +4238,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); } @@ -3701,7 +4257,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) { @@ -3752,8 +4309,8 @@ export const Crew: MessageFns = { fromJSON(object: any): Crew { return { - type: crewTypeFromJSON(assertSet("Crew.type", object.type)), - count: globalThis.Number(assertSet("Crew.count", object.count)), + type: crewTypeFromJSON(assertSet('Crew.type', object.type)), + count: globalThis.Number(assertSet('Crew.count', object.count)), substitute: globalThis.Array.isArray(object?.substitute) ? object.substitute.map((e: any) => crewTypeFromJSON(e)) : [], @@ -3786,21 +4343,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 5d6ff2439..0c5fe74a6 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -37,6 +37,7 @@ import { SUPPORTED_LOCALES, } from '@blitzkit/i18n'; import { readdir } from 'fs/promises'; +import { deburr } from 'lodash-es'; import { parse as parsePath } from 'path'; import { Vector3Tuple } from 'three'; import { parse as parseYaml } from 'yaml'; @@ -48,6 +49,23 @@ import { DATA } from './constants'; import { Avatar } from './skillIcons'; import { TankParameters } from './tankIcons'; +const nonAlphanumericRegex = /[^a-z0-9]/g; +const multipleDashesRegex = /--+/g; +const trailingDashRegex = /-$/g; +const leadingDashRegex = /^-/g; + +const nationSlugDiscriminators = { + china: 'cn', + european: 'eu', + france: 'fr', + germany: 'de', + japan: 'jp', + other: 'ot', + uk: 'gb', + usa: 'us', + ussr: 'ru', +}; + function parseResearchCost(raw: number | string) { if (typeof raw === 'number') { return { @@ -502,7 +520,7 @@ const blitzShellKindToBlitzkit: Record = { HIGH_EXPLOSIVE: ShellType.HE, HOLLOW_CHARGE: ShellType.HEAT, }; -export const botPattern = /^.+((tutorial_bot(\d+)?)|(TU(R?)))$/; +export const botPattern = /^.+((tutorial_bot(\d+)?)|(TU))$/; const blitzModuleTypeToBlitzkit: Record = { chassis: ModuleType.TRACKS, engine: ModuleType.ENGINE, @@ -703,6 +721,93 @@ export async function definitions() { }; }); + const slugRequesters = new Map(); + const idToNation: Record = {}; + + await Promise.all( + nations.map(async (nation) => { + const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml`, + ); + + for (const tankKey in tankList.root) { + if (botPattern.test(tankKey)) continue; + + const tank = tankList.root[tankKey]; + const tankId = toUniqueId(nation, tank.id); + const name = ( + (tank.shortUserString + ? getString(tank.shortUserString) + : undefined) ?? getString(tank.userString) + ).locales.en; + + let slug = deburr(name).toLowerCase(); + slug = slug.replaceAll(nonAlphanumericRegex, '-'); + slug = slug.replaceAll(multipleDashesRegex, '-'); + slug = slug.replaceAll(trailingDashRegex, ''); + slug = slug.replaceAll(leadingDashRegex, ''); + + idToNation[tankId] = nation; + + if (slugRequesters.has(slug)) { + slugRequesters.get(slug)!.push({ id: tankId, key: tankKey }); + } else { + slugRequesters.set(slug, [{ id: tankId, key: tankKey }]); + } + } + }), + ); + + const slugs = new Map(); + + slugRequesters.forEach((requesters, slug) => { + if (requesters.length === 1) { + slugs.set(requesters[0].id, slug); + return; + } + + console.warn( + `Multiple tanks share slug ${slug}: ${requesters.map(({ key }) => key).join(', ')}`, + ); + + if (requesters.length !== 2) { + throw new Error('Unresolvable number of duplicates :('); + } + + const nonCanonical = requesters.find(({ key }) => key.endsWith('TUR')); + + if (nonCanonical === undefined) { + console.log('Using nations to discriminate'); + // both are non-tutorial tanks, will have to discriminate using nation + + requesters.forEach(({ id, key }) => { + const nation = idToNation[id]; + const discriminator = + nationSlugDiscriminators[ + nation as keyof typeof nationSlugDiscriminators + ]; + + console.log(`Solution: ${key} -> ${slug}-${discriminator}`); + slugs.set(id, `${slug}-${discriminator}`); + }); + } else { + console.log('Using tutorial bot suffix to discriminate'); + + const canonical = requesters.find(({ key }) => !key.endsWith('TUR')); + + if (canonical === undefined) { + throw new Error( + 'Two tutorial bots share the same slug? The world is truly broken.', + ); + } + + console.log(`Solution: ${canonical.key} -> ${slug}`); + slugs.set(canonical.id, slug); + console.log(`Solution: ${nonCanonical.key} -> ${slug}-tur`); + slugs.set(nonCanonical.id, `${slug}-tur`); + } + }); + await Promise.all( nations.map(async (nation) => { const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( @@ -787,6 +892,7 @@ export async function definitions() { const hullArmor: Armor = { spaced: [], thickness: {} }; const equipment = tankDefinition.root.optDevicePreset; tankStringIdMap[`${nation}:${tankKey}`] = tankId; + const slug = slugs.get(tank.id)!; if (tank.sellPrice) { tankPrice = { @@ -903,7 +1009,7 @@ export async function definitions() { (tank.shortUserString ? getString(tank.shortUserString) : undefined) ?? getString(tank.userString), - name_full: getString(tank.userString), + slug, nation, type: tankTags.includes('collectible') ? TankType.COLLECTOR @@ -939,13 +1045,6 @@ export async function definitions() { }); } - if ( - tankDefinitions.tanks[tankId].name === - tankDefinitions.tanks[tankId].name_full - ) { - delete tankDefinitions.tanks[tankId].name_full; - } - modelDefinitions.models[tankId] = { armor: hullArmor, turret_origin: vector3TupleToBlitzkit(turretOrigin),