diff --git a/packages/core/src/protos/i18n.ts b/packages/core/src/protos/i18n.ts index 27894724e..56812cce5 100644 --- a/packages/core/src/protos/i18n.ts +++ b/packages/core/src/protos/i18n.ts @@ -18,7 +18,7 @@ export interface I18n_LocalesEntry { value: string; } -export function createBaseI18n(): I18n { +function createBaseI18n(): I18n { return { locales: {} }; } diff --git a/packages/core/src/protos/legacy_camouflage_definitions.ts b/packages/core/src/protos/legacy_camouflage_definitions.ts index c7a7d6d59..70c5a4727 100644 --- a/packages/core/src/protos/legacy_camouflage_definitions.ts +++ b/packages/core/src/protos/legacy_camouflage_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/legacy_camouflage_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export interface CamouflageDefinitions { camouflages: { [key: number]: Camouflage }; @@ -31,25 +31,15 @@ function createBaseCamouflageDefinitions(): CamouflageDefinitions { } export const CamouflageDefinitions: MessageFns = { - encode( - message: CamouflageDefinitions, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: CamouflageDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { Object.entries(message.camouflages).forEach(([key, value]) => { - CamouflageDefinitions_CamouflagesEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).join(); + CamouflageDefinitions_CamouflagesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): CamouflageDefinitions { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): CamouflageDefinitions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCamouflageDefinitions(); while (reader.pos < end) { @@ -60,10 +50,7 @@ export const CamouflageDefinitions: MessageFns = { break; } - const entry1 = CamouflageDefinitions_CamouflagesEntry.decode( - reader, - reader.uint32(), - ); + const entry1 = CamouflageDefinitions_CamouflagesEntry.decode(reader, reader.uint32()); if (entry1.value !== undefined) { message.camouflages[entry1.key] = entry1.value; } @@ -81,12 +68,10 @@ export const CamouflageDefinitions: MessageFns = { fromJSON(object: any): CamouflageDefinitions { return { camouflages: isObject(object.camouflages) - ? Object.entries(object.camouflages).reduce<{ - [key: number]: Camouflage; - }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = Camouflage.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.camouflages).reduce<{ [key: number]: Camouflage }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = Camouflage.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -105,23 +90,20 @@ export const CamouflageDefinitions: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): CamouflageDefinitions { + create, I>>(base?: I): CamouflageDefinitions { return CamouflageDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): CamouflageDefinitions { + fromPartial, I>>(object: I): CamouflageDefinitions { const message = createBaseCamouflageDefinitions(); - message.camouflages = Object.entries(object.camouflages ?? {}).reduce<{ - [key: number]: Camouflage; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = Camouflage.fromPartial(value); - } - return acc; - }, {}); + message.camouflages = Object.entries(object.camouflages ?? {}).reduce<{ [key: number]: Camouflage }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = Camouflage.fromPartial(value); + } + return acc; + }, + {}, + ); return message; }, }; @@ -130,116 +112,90 @@ function createBaseCamouflageDefinitions_CamouflagesEntry(): CamouflageDefinitio return { key: 0, value: createBaseCamouflage() }; } -export const CamouflageDefinitions_CamouflagesEntry: MessageFns = - { - encode( - message: CamouflageDefinitions_CamouflagesEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - Camouflage.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const CamouflageDefinitions_CamouflagesEntry: MessageFns = { + encode(message: CamouflageDefinitions_CamouflagesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); + } + if (message.value !== undefined) { + Camouflage.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): CamouflageDefinitions_CamouflagesEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCamouflageDefinitions_CamouflagesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): CamouflageDefinitions_CamouflagesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCamouflageDefinitions_CamouflagesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = Camouflage.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = Camouflage.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry { - return { - key: globalThis.Number( - assertSet('CamouflageDefinitions_CamouflagesEntry.key', object.key), - ), - value: Camouflage.fromJSON( - assertSet( - 'CamouflageDefinitions_CamouflagesEntry.value', - object.value, - ), - ), - }; - }, - - toJSON(message: CamouflageDefinitions_CamouflagesEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = Camouflage.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create< - I extends Exact, I>, - >(base?: I): CamouflageDefinitions_CamouflagesEntry { - return CamouflageDefinitions_CamouflagesEntry.fromPartial( - base ?? ({} as any), - ); - }, - fromPartial< - I extends Exact, I>, - >(object: I): CamouflageDefinitions_CamouflagesEntry { - const message = createBaseCamouflageDefinitions_CamouflagesEntry(); - message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? Camouflage.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry { + return { + key: globalThis.Number(assertSet("CamouflageDefinitions_CamouflagesEntry.key", object.key)), + value: Camouflage.fromJSON(assertSet("CamouflageDefinitions_CamouflagesEntry.value", object.value)), + }; + }, + + toJSON(message: CamouflageDefinitions_CamouflagesEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = Camouflage.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): CamouflageDefinitions_CamouflagesEntry { + return CamouflageDefinitions_CamouflagesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): CamouflageDefinitions_CamouflagesEntry { + const message = createBaseCamouflageDefinitions_CamouflagesEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? Camouflage.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseCamouflage(): Camouflage { - return { - id: 0, - name: createBaseI18nString(), - tank_name: undefined, - tank_name_full: undefined, - }; + return { id: 0, name: createBaseI18nString(), tank_name: undefined, tank_name_full: undefined }; } export const Camouflage: MessageFns = { - encode( - message: Camouflage, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: Camouflage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -250,17 +206,13 @@ export const Camouflage: MessageFns = { I18nString.encode(message.tank_name, writer.uint32(26).fork()).join(); } if (message.tank_name_full !== undefined) { - I18nString.encode( - message.tank_name_full, - writer.uint32(34).fork(), - ).join(); + I18nString.encode(message.tank_name_full, writer.uint32(34).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Camouflage { - 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 = createBaseCamouflage(); while (reader.pos < end) { @@ -309,14 +261,10 @@ export const Camouflage: MessageFns = { fromJSON(object: any): Camouflage { return { - id: globalThis.Number(assertSet('Camouflage.id', object.id)), - name: I18nString.fromJSON(assertSet('Camouflage.name', object.name)), - tank_name: isSet(object.tank_name) - ? I18nString.fromJSON(object.tank_name) - : undefined, - tank_name_full: isSet(object.tank_name_full) - ? I18nString.fromJSON(object.tank_name_full) - : undefined, + id: globalThis.Number(assertSet("Camouflage.id", object.id)), + name: I18nString.fromJSON(assertSet("Camouflage.name", object.name)), + tank_name: isSet(object.tank_name) ? I18nString.fromJSON(object.tank_name) : undefined, + tank_name_full: isSet(object.tank_name_full) ? I18nString.fromJSON(object.tank_name_full) : undefined, }; }, @@ -340,57 +288,37 @@ export const Camouflage: MessageFns = { create, I>>(base?: I): Camouflage { return Camouflage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): Camouflage { + fromPartial, I>>(object: I): Camouflage { const message = createBaseCamouflage(); message.id = object.id ?? 0; - message.name = - object.name !== undefined && object.name !== null - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); - message.tank_name = - object.tank_name !== undefined && object.tank_name !== null - ? I18nString.fromPartial(object.tank_name) - : undefined; - message.tank_name_full = - object.tank_name_full !== undefined && object.tank_name_full !== null - ? I18nString.fromPartial(object.tank_name_full) - : undefined; + message.name = (object.name !== undefined && object.name !== null) + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); + message.tank_name = (object.tank_name !== undefined && object.tank_name !== null) + ? I18nString.fromPartial(object.tank_name) + : undefined; + message.tank_name_full = (object.tank_name_full !== undefined && object.tank_name_full !== null) + ? I18nString.fromPartial(object.tank_name_full) + : undefined; return message; }, }; -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/core/src/protos/legacy_consumable_definitions.ts b/packages/core/src/protos/legacy_consumable_definitions.ts index 2a7d4d4c2..41352715c 100644 --- a/packages/core/src/protos/legacy_consumable_definitions.ts +++ b/packages/core/src/protos/legacy_consumable_definitions.ts @@ -5,42 +5,34 @@ // source: packages/core/src/protos/legacy_consumable_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export enum ConsumableTankCategoryFilterCategory { CLIP = 0, } -export function consumableTankCategoryFilterCategoryFromJSON( - object: any, -): ConsumableTankCategoryFilterCategory { +export function consumableTankCategoryFilterCategoryFromJSON(object: any): ConsumableTankCategoryFilterCategory { switch (object) { case 0: - case 'CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP': + case "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP": return ConsumableTankCategoryFilterCategory.CLIP; default: throw new globalThis.Error( - 'Unrecognized enum value ' + - object + - ' for enum ConsumableTankCategoryFilterCategory', + "Unrecognized enum value " + object + " for enum ConsumableTankCategoryFilterCategory", ); } } -export function consumableTankCategoryFilterCategoryToJSON( - object: ConsumableTankCategoryFilterCategory, -): string { +export function consumableTankCategoryFilterCategoryToJSON(object: ConsumableTankCategoryFilterCategory): string { switch (object) { case ConsumableTankCategoryFilterCategory.CLIP: - return 'CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP'; + return "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP"; default: throw new globalThis.Error( - 'Unrecognized enum value ' + - object + - ' for enum ConsumableTankCategoryFilterCategory', + "Unrecognized enum value " + object + " for enum ConsumableTankCategoryFilterCategory", ); } } @@ -66,10 +58,10 @@ export interface Consumable { export interface ConsumableTankFilter { filter_type?: - | { $case: 'tiers'; value: ConsumableTankTierFilter } - | { $case: 'ids'; value: ConsumableTankIdsFilter } - | { $case: 'categories'; value: ConsumableTankCategoryFilter } - | { $case: 'nations'; value: ConsumableTankNationFilter } + | { $case: "tiers"; value: ConsumableTankTierFilter } + | { $case: "ids"; value: ConsumableTankIdsFilter } + | { $case: "categories"; value: ConsumableTankCategoryFilter } + | { $case: "nations"; value: ConsumableTankNationFilter } | undefined; } @@ -95,25 +87,15 @@ function createBaseConsumableDefinitions(): ConsumableDefinitions { } export const ConsumableDefinitions: MessageFns = { - encode( - message: ConsumableDefinitions, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: ConsumableDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { Object.entries(message.consumables).forEach(([key, value]) => { - ConsumableDefinitions_ConsumablesEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).join(); + ConsumableDefinitions_ConsumablesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableDefinitions { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsumableDefinitions(); while (reader.pos < end) { @@ -124,10 +106,7 @@ export const ConsumableDefinitions: MessageFns = { break; } - const entry1 = ConsumableDefinitions_ConsumablesEntry.decode( - reader, - reader.uint32(), - ); + const entry1 = ConsumableDefinitions_ConsumablesEntry.decode(reader, reader.uint32()); if (entry1.value !== undefined) { message.consumables[entry1.key] = entry1.value; } @@ -145,12 +124,10 @@ export const ConsumableDefinitions: MessageFns = { fromJSON(object: any): ConsumableDefinitions { return { consumables: isObject(object.consumables) - ? Object.entries(object.consumables).reduce<{ - [key: number]: Consumable; - }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = Consumable.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.consumables).reduce<{ [key: number]: Consumable }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = Consumable.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -169,23 +146,20 @@ export const ConsumableDefinitions: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): ConsumableDefinitions { + create, I>>(base?: I): ConsumableDefinitions { return ConsumableDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): ConsumableDefinitions { + fromPartial, I>>(object: I): ConsumableDefinitions { const message = createBaseConsumableDefinitions(); - message.consumables = Object.entries(object.consumables ?? {}).reduce<{ - [key: number]: Consumable; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = Consumable.fromPartial(value); - } - return acc; - }, {}); + message.consumables = Object.entries(object.consumables ?? {}).reduce<{ [key: number]: Consumable }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = Consumable.fromPartial(value); + } + return acc; + }, + {}, + ); return message; }, }; @@ -194,101 +168,83 @@ function createBaseConsumableDefinitions_ConsumablesEntry(): ConsumableDefinitio return { key: 0, value: createBaseConsumable() }; } -export const ConsumableDefinitions_ConsumablesEntry: MessageFns = - { - encode( - message: ConsumableDefinitions_ConsumablesEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - Consumable.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const ConsumableDefinitions_ConsumablesEntry: MessageFns = { + encode(message: ConsumableDefinitions_ConsumablesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); + } + if (message.value !== undefined) { + Consumable.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableDefinitions_ConsumablesEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseConsumableDefinitions_ConsumablesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions_ConsumablesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumableDefinitions_ConsumablesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = Consumable.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = Consumable.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): ConsumableDefinitions_ConsumablesEntry { - return { - key: globalThis.Number( - assertSet('ConsumableDefinitions_ConsumablesEntry.key', object.key), - ), - value: Consumable.fromJSON( - assertSet( - 'ConsumableDefinitions_ConsumablesEntry.value', - object.value, - ), - ), - }; - }, - - toJSON(message: ConsumableDefinitions_ConsumablesEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = Consumable.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create< - I extends Exact, I>, - >(base?: I): ConsumableDefinitions_ConsumablesEntry { - return ConsumableDefinitions_ConsumablesEntry.fromPartial( - base ?? ({} as any), - ); - }, - fromPartial< - I extends Exact, I>, - >(object: I): ConsumableDefinitions_ConsumablesEntry { - const message = createBaseConsumableDefinitions_ConsumablesEntry(); - message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? Consumable.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): ConsumableDefinitions_ConsumablesEntry { + return { + key: globalThis.Number(assertSet("ConsumableDefinitions_ConsumablesEntry.key", object.key)), + value: Consumable.fromJSON(assertSet("ConsumableDefinitions_ConsumablesEntry.value", object.value)), + }; + }, + + toJSON(message: ConsumableDefinitions_ConsumablesEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = Consumable.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ConsumableDefinitions_ConsumablesEntry { + return ConsumableDefinitions_ConsumablesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ConsumableDefinitions_ConsumablesEntry { + const message = createBaseConsumableDefinitions_ConsumablesEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? Consumable.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseConsumable(): Consumable { return { @@ -303,10 +259,7 @@ function createBaseConsumable(): Consumable { } export const Consumable: MessageFns = { - encode( - message: Consumable, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: Consumable, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -332,8 +285,7 @@ export const Consumable: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Consumable { - 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 = createBaseConsumable(); while (reader.pos < end) { @@ -384,9 +336,7 @@ export const Consumable: MessageFns = { break; } - message.include.push( - ConsumableTankFilter.decode(reader, reader.uint32()), - ); + message.include.push(ConsumableTankFilter.decode(reader, reader.uint32())); continue; } case 7: { @@ -394,9 +344,7 @@ export const Consumable: MessageFns = { break; } - message.exclude.push( - ConsumableTankFilter.decode(reader, reader.uint32()), - ); + message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32())); continue; } } @@ -410,17 +358,11 @@ export const Consumable: MessageFns = { fromJSON(object: any): Consumable { return { - id: globalThis.Number(assertSet('Consumable.id', object.id)), - name: I18nString.fromJSON(assertSet('Consumable.name', object.name)), - cooldown: globalThis.Number( - assertSet('Consumable.cooldown', object.cooldown), - ), - duration: isSet(object.duration) - ? globalThis.Number(object.duration) - : undefined, - game_mode_exclusive: globalThis.Boolean( - assertSet('Consumable.game_mode_exclusive', object.game_mode_exclusive), - ), + id: globalThis.Number(assertSet("Consumable.id", object.id)), + name: I18nString.fromJSON(assertSet("Consumable.name", object.name)), + cooldown: globalThis.Number(assertSet("Consumable.cooldown", object.cooldown)), + duration: isSet(object.duration) ? globalThis.Number(object.duration) : undefined, + game_mode_exclusive: globalThis.Boolean(assertSet("Consumable.game_mode_exclusive", object.game_mode_exclusive)), include: globalThis.Array.isArray(object?.include) ? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e)) : [], @@ -459,22 +401,17 @@ export const Consumable: MessageFns = { create, I>>(base?: I): Consumable { return Consumable.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): Consumable { + fromPartial, I>>(object: I): Consumable { const message = createBaseConsumable(); 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.cooldown = object.cooldown ?? 0; message.duration = object.duration ?? undefined; message.game_mode_exclusive = object.game_mode_exclusive ?? false; - message.include = - object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; - message.exclude = - object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; + message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; + message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; return message; }, }; @@ -484,45 +421,26 @@ function createBaseConsumableTankFilter(): ConsumableTankFilter { } export const ConsumableTankFilter: MessageFns = { - encode( - message: ConsumableTankFilter, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: ConsumableTankFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { switch (message.filter_type?.$case) { - case 'tiers': - ConsumableTankTierFilter.encode( - message.filter_type.value, - writer.uint32(10).fork(), - ).join(); + case "tiers": + ConsumableTankTierFilter.encode(message.filter_type.value, writer.uint32(10).fork()).join(); break; - case 'ids': - ConsumableTankIdsFilter.encode( - message.filter_type.value, - writer.uint32(18).fork(), - ).join(); + case "ids": + ConsumableTankIdsFilter.encode(message.filter_type.value, writer.uint32(18).fork()).join(); break; - case 'categories': - ConsumableTankCategoryFilter.encode( - message.filter_type.value, - writer.uint32(26).fork(), - ).join(); + case "categories": + ConsumableTankCategoryFilter.encode(message.filter_type.value, writer.uint32(26).fork()).join(); break; - case 'nations': - ConsumableTankNationFilter.encode( - message.filter_type.value, - writer.uint32(34).fork(), - ).join(); + case "nations": + ConsumableTankNationFilter.encode(message.filter_type.value, writer.uint32(34).fork()).join(); break; } return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableTankFilter { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsumableTankFilter(); while (reader.pos < end) { @@ -533,10 +451,7 @@ export const ConsumableTankFilter: MessageFns = { break; } - message.filter_type = { - $case: 'tiers', - value: ConsumableTankTierFilter.decode(reader, reader.uint32()), - }; + message.filter_type = { $case: "tiers", value: ConsumableTankTierFilter.decode(reader, reader.uint32()) }; continue; } case 2: { @@ -544,10 +459,7 @@ export const ConsumableTankFilter: MessageFns = { break; } - message.filter_type = { - $case: 'ids', - value: ConsumableTankIdsFilter.decode(reader, reader.uint32()), - }; + message.filter_type = { $case: "ids", value: ConsumableTankIdsFilter.decode(reader, reader.uint32()) }; continue; } case 3: { @@ -556,7 +468,7 @@ export const ConsumableTankFilter: MessageFns = { } message.filter_type = { - $case: 'categories', + $case: "categories", value: ConsumableTankCategoryFilter.decode(reader, reader.uint32()), }; continue; @@ -566,10 +478,7 @@ export const ConsumableTankFilter: MessageFns = { break; } - message.filter_type = { - $case: 'nations', - value: ConsumableTankNationFilter.decode(reader, reader.uint32()), - }; + message.filter_type = { $case: "nations", value: ConsumableTankNationFilter.decode(reader, reader.uint32()) }; continue; } } @@ -584,98 +493,70 @@ export const ConsumableTankFilter: MessageFns = { fromJSON(object: any): ConsumableTankFilter { return { filter_type: isSet(object.tiers) - ? { - $case: 'tiers', - value: ConsumableTankTierFilter.fromJSON(object.tiers), - } + ? { $case: "tiers", value: ConsumableTankTierFilter.fromJSON(object.tiers) } : isSet(object.ids) - ? { - $case: 'ids', - value: ConsumableTankIdsFilter.fromJSON(object.ids), - } - : isSet(object.categories) - ? { - $case: 'categories', - value: ConsumableTankCategoryFilter.fromJSON(object.categories), - } - : isSet(object.nations) - ? { - $case: 'nations', - value: ConsumableTankNationFilter.fromJSON(object.nations), - } - : undefined, + ? { $case: "ids", value: ConsumableTankIdsFilter.fromJSON(object.ids) } + : isSet(object.categories) + ? { $case: "categories", value: ConsumableTankCategoryFilter.fromJSON(object.categories) } + : isSet(object.nations) + ? { $case: "nations", value: ConsumableTankNationFilter.fromJSON(object.nations) } + : undefined, }; }, toJSON(message: ConsumableTankFilter): unknown { const obj: any = {}; - if (message.filter_type?.$case === 'tiers') { + if (message.filter_type?.$case === "tiers") { obj.tiers = ConsumableTankTierFilter.toJSON(message.filter_type.value); } - if (message.filter_type?.$case === 'ids') { + if (message.filter_type?.$case === "ids") { obj.ids = ConsumableTankIdsFilter.toJSON(message.filter_type.value); } - if (message.filter_type?.$case === 'categories') { - obj.categories = ConsumableTankCategoryFilter.toJSON( - message.filter_type.value, - ); + if (message.filter_type?.$case === "categories") { + obj.categories = ConsumableTankCategoryFilter.toJSON(message.filter_type.value); } - if (message.filter_type?.$case === 'nations') { - obj.nations = ConsumableTankNationFilter.toJSON( - message.filter_type.value, - ); + if (message.filter_type?.$case === "nations") { + obj.nations = ConsumableTankNationFilter.toJSON(message.filter_type.value); } return obj; }, - create, I>>( - base?: I, - ): ConsumableTankFilter { + create, I>>(base?: I): ConsumableTankFilter { return ConsumableTankFilter.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): ConsumableTankFilter { + fromPartial, I>>(object: I): ConsumableTankFilter { const message = createBaseConsumableTankFilter(); if ( - object.filter_type?.$case === 'tiers' && + object.filter_type?.$case === "tiers" && + object.filter_type?.value !== undefined && + object.filter_type?.value !== null + ) { + message.filter_type = { $case: "tiers", value: ConsumableTankTierFilter.fromPartial(object.filter_type.value) }; + } + if ( + object.filter_type?.$case === "ids" && + object.filter_type?.value !== undefined && + object.filter_type?.value !== null + ) { + message.filter_type = { $case: "ids", value: ConsumableTankIdsFilter.fromPartial(object.filter_type.value) }; + } + if ( + object.filter_type?.$case === "categories" && object.filter_type?.value !== undefined && object.filter_type?.value !== null ) { message.filter_type = { - $case: 'tiers', - value: ConsumableTankTierFilter.fromPartial(object.filter_type.value), + $case: "categories", + value: ConsumableTankCategoryFilter.fromPartial(object.filter_type.value), }; } if ( - object.filter_type?.$case === 'ids' && + object.filter_type?.$case === "nations" && object.filter_type?.value !== undefined && object.filter_type?.value !== null ) { message.filter_type = { - $case: 'ids', - value: ConsumableTankIdsFilter.fromPartial(object.filter_type.value), - }; - } - if ( - object.filter_type?.$case === 'categories' && - object.filter_type?.value !== undefined && - object.filter_type?.value !== null - ) { - message.filter_type = { - $case: 'categories', - value: ConsumableTankCategoryFilter.fromPartial( - object.filter_type.value, - ), - }; - } - if ( - object.filter_type?.$case === 'nations' && - object.filter_type?.value !== undefined && - object.filter_type?.value !== null - ) { - message.filter_type = { - $case: 'nations', + $case: "nations", value: ConsumableTankNationFilter.fromPartial(object.filter_type.value), }; } @@ -688,10 +569,7 @@ function createBaseConsumableTankTierFilter(): ConsumableTankTierFilter { } export const ConsumableTankTierFilter: MessageFns = { - encode( - message: ConsumableTankTierFilter, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: ConsumableTankTierFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.min !== 0) { writer.uint32(8).uint32(message.min); } @@ -701,12 +579,8 @@ export const ConsumableTankTierFilter: MessageFns = { return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableTankTierFilter { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankTierFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsumableTankTierFilter(); while (reader.pos < end) { @@ -739,12 +613,8 @@ export const ConsumableTankTierFilter: MessageFns = { fromJSON(object: any): ConsumableTankTierFilter { return { - min: globalThis.Number( - assertSet('ConsumableTankTierFilter.min', object.min), - ), - max: globalThis.Number( - assertSet('ConsumableTankTierFilter.max', object.max), - ), + min: globalThis.Number(assertSet("ConsumableTankTierFilter.min", object.min)), + max: globalThis.Number(assertSet("ConsumableTankTierFilter.max", object.max)), }; }, @@ -759,14 +629,10 @@ export const ConsumableTankTierFilter: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): ConsumableTankTierFilter { + create, I>>(base?: I): ConsumableTankTierFilter { return ConsumableTankTierFilter.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): ConsumableTankTierFilter { + fromPartial, I>>(object: I): ConsumableTankTierFilter { const message = createBaseConsumableTankTierFilter(); message.min = object.min ?? 0; message.max = object.max ?? 0; @@ -779,10 +645,7 @@ function createBaseConsumableTankIdsFilter(): ConsumableTankIdsFilter { } export const ConsumableTankIdsFilter: MessageFns = { - encode( - message: ConsumableTankIdsFilter, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: ConsumableTankIdsFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.ids) { writer.uint32(v); @@ -791,12 +654,8 @@ export const ConsumableTankIdsFilter: MessageFns = { return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableTankIdsFilter { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankIdsFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConsumableTankIdsFilter(); while (reader.pos < end) { @@ -830,11 +689,7 @@ export const ConsumableTankIdsFilter: MessageFns = { }, fromJSON(object: any): ConsumableTankIdsFilter { - return { - ids: globalThis.Array.isArray(object?.ids) - ? object.ids.map((e: any) => globalThis.Number(e)) - : [], - }; + return { ids: globalThis.Array.isArray(object?.ids) ? object.ids.map((e: any) => globalThis.Number(e)) : [] }; }, toJSON(message: ConsumableTankIdsFilter): unknown { @@ -845,14 +700,10 @@ export const ConsumableTankIdsFilter: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): ConsumableTankIdsFilter { + create, I>>(base?: I): ConsumableTankIdsFilter { return ConsumableTankIdsFilter.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): ConsumableTankIdsFilter { + fromPartial, I>>(object: I): ConsumableTankIdsFilter { const message = createBaseConsumableTankIdsFilter(); message.ids = object.ids?.map((e) => e) || []; return message; @@ -863,196 +714,151 @@ function createBaseConsumableTankCategoryFilter(): ConsumableTankCategoryFilter return { categories: [] }; } -export const ConsumableTankCategoryFilter: MessageFns = - { - encode( - message: ConsumableTankCategoryFilter, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.categories) { - writer.int32(v); - } - writer.join(); - return writer; - }, +export const ConsumableTankCategoryFilter: MessageFns = { + encode(message: ConsumableTankCategoryFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.categories) { + writer.int32(v); + } + writer.join(); + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableTankCategoryFilter { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseConsumableTankCategoryFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag === 8) { - message.categories.push(reader.int32() as any); + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankCategoryFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumableTankCategoryFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.categories.push(reader.int32() as any); - continue; - } - - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.categories.push(reader.int32() as any); - } - - continue; - } - - break; + continue; } - } - if ((tag & 7) === 4 || tag === 0) { + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.categories.push(reader.int32() as any); + } + + continue; + } + break; } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): ConsumableTankCategoryFilter { - return { - categories: globalThis.Array.isArray(object?.categories) - ? object.categories.map((e: any) => - consumableTankCategoryFilterCategoryFromJSON(e), - ) - : [], - }; - }, - - toJSON(message: ConsumableTankCategoryFilter): unknown { - const obj: any = {}; - if (message.categories?.length) { - obj.categories = message.categories.map((e) => - consumableTankCategoryFilterCategoryToJSON(e), - ); + if ((tag & 7) === 4 || tag === 0) { + break; } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create, I>>( - base?: I, - ): ConsumableTankCategoryFilter { - return ConsumableTankCategoryFilter.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): ConsumableTankCategoryFilter { - const message = createBaseConsumableTankCategoryFilter(); - message.categories = object.categories?.map((e) => e) || []; - return message; - }, - }; + fromJSON(object: any): ConsumableTankCategoryFilter { + return { + categories: globalThis.Array.isArray(object?.categories) + ? object.categories.map((e: any) => consumableTankCategoryFilterCategoryFromJSON(e)) + : [], + }; + }, + + toJSON(message: ConsumableTankCategoryFilter): unknown { + const obj: any = {}; + if (message.categories?.length) { + obj.categories = message.categories.map((e) => consumableTankCategoryFilterCategoryToJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ConsumableTankCategoryFilter { + return ConsumableTankCategoryFilter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConsumableTankCategoryFilter { + const message = createBaseConsumableTankCategoryFilter(); + message.categories = object.categories?.map((e) => e) || []; + return message; + }, +}; function createBaseConsumableTankNationFilter(): ConsumableTankNationFilter { return { nations: [] }; } -export const ConsumableTankNationFilter: MessageFns = - { - encode( - message: ConsumableTankNationFilter, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - for (const v of message.nations) { - writer.uint32(10).string(v!); - } - return writer; - }, +export const ConsumableTankNationFilter: MessageFns = { + encode(message: ConsumableTankNationFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nations) { + writer.uint32(10).string(v!); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ConsumableTankNationFilter { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseConsumableTankNationFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.nations.push(reader.string()); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankNationFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumableTankNationFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; } + + message.nations.push(reader.string()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): ConsumableTankNationFilter { - return { - nations: globalThis.Array.isArray(object?.nations) - ? object.nations.map((e: any) => globalThis.String(e)) - : [], - }; - }, - - toJSON(message: ConsumableTankNationFilter): unknown { - const obj: any = {}; - if (message.nations?.length) { - obj.nations = message.nations; + if ((tag & 7) === 4 || tag === 0) { + break; } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create, I>>( - base?: I, - ): ConsumableTankNationFilter { - return ConsumableTankNationFilter.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): ConsumableTankNationFilter { - const message = createBaseConsumableTankNationFilter(); - message.nations = object.nations?.map((e) => e) || []; - return message; - }, - }; + fromJSON(object: any): ConsumableTankNationFilter { + return { + nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [], + }; + }, -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined; + toJSON(message: ConsumableTankNationFilter): unknown { + const obj: any = {}; + if (message.nations?.length) { + obj.nations = message.nations; + } + return obj; + }, -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; + create, I>>(base?: I): ConsumableTankNationFilter { + return ConsumableTankNationFilter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConsumableTankNationFilter { + const message = createBaseConsumableTankNationFilter(); + message.nations = object.nations?.map((e) => e) || []; + return message; + }, +}; + +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; 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/core/src/protos/legacy_equipment_definitions.ts b/packages/core/src/protos/legacy_equipment_definitions.ts index 7710298fa..18276dc7d 100644 --- a/packages/core/src/protos/legacy_equipment_definitions.ts +++ b/packages/core/src/protos/legacy_equipment_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/legacy_equipment_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export interface EquipmentDefinitions { presets: { [key: string]: EquipmentPreset }; @@ -44,31 +44,18 @@ function createBaseEquipmentDefinitions(): EquipmentDefinitions { } export const EquipmentDefinitions: MessageFns = { - encode( - message: EquipmentDefinitions, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: EquipmentDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { Object.entries(message.presets).forEach(([key, value]) => { - EquipmentDefinitions_PresetsEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).join(); + EquipmentDefinitions_PresetsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); Object.entries(message.equipments).forEach(([key, value]) => { - EquipmentDefinitions_EquipmentsEntry.encode( - { key: key as any, value }, - writer.uint32(18).fork(), - ).join(); + EquipmentDefinitions_EquipmentsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); }); return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): EquipmentDefinitions { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEquipmentDefinitions(); while (reader.pos < end) { @@ -79,10 +66,7 @@ export const EquipmentDefinitions: MessageFns = { break; } - const entry1 = EquipmentDefinitions_PresetsEntry.decode( - reader, - reader.uint32(), - ); + const entry1 = EquipmentDefinitions_PresetsEntry.decode(reader, reader.uint32()); if (entry1.value !== undefined) { message.presets[entry1.key] = entry1.value; } @@ -93,10 +77,7 @@ export const EquipmentDefinitions: MessageFns = { break; } - const entry2 = EquipmentDefinitions_EquipmentsEntry.decode( - reader, - reader.uint32(), - ); + const entry2 = EquipmentDefinitions_EquipmentsEntry.decode(reader, reader.uint32()); if (entry2.value !== undefined) { message.equipments[entry2.key] = entry2.value; } @@ -114,20 +95,16 @@ export const EquipmentDefinitions: MessageFns = { fromJSON(object: any): EquipmentDefinitions { return { presets: isObject(object.presets) - ? Object.entries(object.presets).reduce<{ - [key: string]: EquipmentPreset; - }>((acc, [key, value]) => { - acc[key] = EquipmentPreset.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.presets).reduce<{ [key: string]: EquipmentPreset }>((acc, [key, value]) => { + acc[key] = EquipmentPreset.fromJSON(value); + return acc; + }, {}) : {}, equipments: isObject(object.equipments) - ? Object.entries(object.equipments).reduce<{ - [key: number]: Equipment; - }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = Equipment.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.equipments).reduce<{ [key: number]: Equipment }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = Equipment.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -155,236 +132,203 @@ export const EquipmentDefinitions: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): EquipmentDefinitions { + create, I>>(base?: I): EquipmentDefinitions { return EquipmentDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): EquipmentDefinitions { + fromPartial, I>>(object: I): EquipmentDefinitions { const message = createBaseEquipmentDefinitions(); - message.presets = Object.entries(object.presets ?? {}).reduce<{ - [key: string]: EquipmentPreset; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = EquipmentPreset.fromPartial(value); - } - return acc; - }, {}); - message.equipments = Object.entries(object.equipments ?? {}).reduce<{ - [key: number]: Equipment; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = Equipment.fromPartial(value); - } - return acc; - }, {}); + message.presets = Object.entries(object.presets ?? {}).reduce<{ [key: string]: EquipmentPreset }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = EquipmentPreset.fromPartial(value); + } + return acc; + }, + {}, + ); + message.equipments = Object.entries(object.equipments ?? {}).reduce<{ [key: number]: Equipment }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = Equipment.fromPartial(value); + } + return acc; + }, + {}, + ); return message; }, }; function createBaseEquipmentDefinitions_PresetsEntry(): EquipmentDefinitions_PresetsEntry { - return { key: '', value: createBaseEquipmentPreset() }; + return { key: "", value: createBaseEquipmentPreset() }; } -export const EquipmentDefinitions_PresetsEntry: MessageFns = - { - encode( - message: EquipmentDefinitions_PresetsEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - EquipmentPreset.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const EquipmentDefinitions_PresetsEntry: MessageFns = { + encode(message: EquipmentDefinitions_PresetsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + EquipmentPreset.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): EquipmentDefinitions_PresetsEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEquipmentDefinitions_PresetsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_PresetsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEquipmentDefinitions_PresetsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = EquipmentPreset.decode(reader, reader.uint32()); - continue; + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = EquipmentPreset.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): EquipmentDefinitions_PresetsEntry { - return { - key: globalThis.String( - assertSet('EquipmentDefinitions_PresetsEntry.key', object.key), - ), - value: EquipmentPreset.fromJSON( - assertSet('EquipmentDefinitions_PresetsEntry.value', object.value), - ), - }; - }, - - toJSON(message: EquipmentDefinitions_PresetsEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = message.key; + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = EquipmentPreset.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create, I>>( - base?: I, - ): EquipmentDefinitions_PresetsEntry { - return EquipmentDefinitions_PresetsEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial< - I extends Exact, I>, - >(object: I): EquipmentDefinitions_PresetsEntry { - const message = createBaseEquipmentDefinitions_PresetsEntry(); - message.key = object.key ?? ''; - message.value = - object.value !== undefined && object.value !== null - ? EquipmentPreset.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): EquipmentDefinitions_PresetsEntry { + return { + key: globalThis.String(assertSet("EquipmentDefinitions_PresetsEntry.key", object.key)), + value: EquipmentPreset.fromJSON(assertSet("EquipmentDefinitions_PresetsEntry.value", object.value)), + }; + }, + + toJSON(message: EquipmentDefinitions_PresetsEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = EquipmentPreset.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): EquipmentDefinitions_PresetsEntry { + return EquipmentDefinitions_PresetsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): EquipmentDefinitions_PresetsEntry { + const message = createBaseEquipmentDefinitions_PresetsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? EquipmentPreset.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseEquipmentDefinitions_EquipmentsEntry(): EquipmentDefinitions_EquipmentsEntry { return { key: 0, value: createBaseEquipment() }; } -export const EquipmentDefinitions_EquipmentsEntry: MessageFns = - { - encode( - message: EquipmentDefinitions_EquipmentsEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - Equipment.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const EquipmentDefinitions_EquipmentsEntry: MessageFns = { + encode(message: EquipmentDefinitions_EquipmentsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); + } + if (message.value !== undefined) { + Equipment.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): EquipmentDefinitions_EquipmentsEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEquipmentDefinitions_EquipmentsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_EquipmentsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEquipmentDefinitions_EquipmentsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = Equipment.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = Equipment.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry { - return { - key: globalThis.Number( - assertSet('EquipmentDefinitions_EquipmentsEntry.key', object.key), - ), - value: Equipment.fromJSON( - assertSet('EquipmentDefinitions_EquipmentsEntry.value', object.value), - ), - }; - }, - - toJSON(message: EquipmentDefinitions_EquipmentsEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = Equipment.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create< - I extends Exact, I>, - >(base?: I): EquipmentDefinitions_EquipmentsEntry { - return EquipmentDefinitions_EquipmentsEntry.fromPartial( - base ?? ({} as any), - ); - }, - fromPartial< - I extends Exact, I>, - >(object: I): EquipmentDefinitions_EquipmentsEntry { - const message = createBaseEquipmentDefinitions_EquipmentsEntry(); - message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? Equipment.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry { + return { + key: globalThis.Number(assertSet("EquipmentDefinitions_EquipmentsEntry.key", object.key)), + value: Equipment.fromJSON(assertSet("EquipmentDefinitions_EquipmentsEntry.value", object.value)), + }; + }, + + toJSON(message: EquipmentDefinitions_EquipmentsEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = Equipment.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): EquipmentDefinitions_EquipmentsEntry { + return EquipmentDefinitions_EquipmentsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): EquipmentDefinitions_EquipmentsEntry { + const message = createBaseEquipmentDefinitions_EquipmentsEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? Equipment.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseEquipment(): Equipment { return { name: createBaseI18nString(), description: createBaseI18nString() }; } export const Equipment: MessageFns = { - encode( - message: Equipment, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: Equipment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== undefined) { I18nString.encode(message.name, writer.uint32(10).fork()).join(); } @@ -395,8 +339,7 @@ export const Equipment: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Equipment { - 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 = createBaseEquipment(); while (reader.pos < end) { @@ -429,10 +372,8 @@ export const Equipment: MessageFns = { fromJSON(object: any): Equipment { return { - name: I18nString.fromJSON(assertSet('Equipment.name', object.name)), - description: I18nString.fromJSON( - assertSet('Equipment.description', object.description), - ), + name: I18nString.fromJSON(assertSet("Equipment.name", object.name)), + description: I18nString.fromJSON(assertSet("Equipment.description", object.description)), }; }, @@ -450,18 +391,14 @@ export const Equipment: MessageFns = { create, I>>(base?: I): Equipment { return Equipment.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): Equipment { + fromPartial, I>>(object: I): Equipment { const message = createBaseEquipment(); - message.name = - object.name !== undefined && object.name !== null - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); - message.description = - object.description !== undefined && object.description !== null - ? I18nString.fromPartial(object.description) - : createBaseI18nString(); + message.name = (object.name !== undefined && object.name !== null) + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); + message.description = (object.description !== undefined && object.description !== null) + ? I18nString.fromPartial(object.description) + : createBaseI18nString(); return message; }, }; @@ -471,10 +408,7 @@ function createBaseEquipmentPreset(): EquipmentPreset { } export const EquipmentPreset: MessageFns = { - encode( - message: EquipmentPreset, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: EquipmentPreset, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.slots) { EquipmentSlot.encode(v!, writer.uint32(10).fork()).join(); } @@ -482,8 +416,7 @@ export const EquipmentPreset: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): EquipmentPreset { - 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 = createBaseEquipmentPreset(); while (reader.pos < end) { @@ -508,9 +441,7 @@ export const EquipmentPreset: MessageFns = { fromJSON(object: any): EquipmentPreset { return { - slots: globalThis.Array.isArray(object?.slots) - ? object.slots.map((e: any) => EquipmentSlot.fromJSON(e)) - : [], + slots: globalThis.Array.isArray(object?.slots) ? object.slots.map((e: any) => EquipmentSlot.fromJSON(e)) : [], }; }, @@ -522,17 +453,12 @@ export const EquipmentPreset: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): EquipmentPreset { + create, I>>(base?: I): EquipmentPreset { return EquipmentPreset.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): EquipmentPreset { + fromPartial, I>>(object: I): EquipmentPreset { const message = createBaseEquipmentPreset(); - message.slots = - object.slots?.map((e) => EquipmentSlot.fromPartial(e)) || []; + message.slots = object.slots?.map((e) => EquipmentSlot.fromPartial(e)) || []; return message; }, }; @@ -542,10 +468,7 @@ function createBaseEquipmentSlot(): EquipmentSlot { } export const EquipmentSlot: MessageFns = { - encode( - message: EquipmentSlot, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: EquipmentSlot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.left !== 0) { writer.uint32(8).uint32(message.left); } @@ -556,8 +479,7 @@ export const EquipmentSlot: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): EquipmentSlot { - 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 = createBaseEquipmentSlot(); while (reader.pos < end) { @@ -590,8 +512,8 @@ export const EquipmentSlot: MessageFns = { fromJSON(object: any): EquipmentSlot { return { - left: globalThis.Number(assertSet('EquipmentSlot.left', object.left)), - right: globalThis.Number(assertSet('EquipmentSlot.right', object.right)), + left: globalThis.Number(assertSet("EquipmentSlot.left", object.left)), + right: globalThis.Number(assertSet("EquipmentSlot.right", object.right)), }; }, @@ -606,14 +528,10 @@ export const EquipmentSlot: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): EquipmentSlot { + create, I>>(base?: I): EquipmentSlot { return EquipmentSlot.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): EquipmentSlot { + fromPartial, I>>(object: I): EquipmentSlot { const message = createBaseEquipmentSlot(); message.left = object.left ?? 0; message.right = object.right ?? 0; @@ -621,36 +539,21 @@ export const EquipmentSlot: 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/core/src/protos/legacy_game_definitions.ts b/packages/core/src/protos/legacy_game_definitions.ts index 2dfd0287c..17b87dea1 100644 --- a/packages/core/src/protos/legacy_game_definitions.ts +++ b/packages/core/src/protos/legacy_game_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/legacy_game_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export interface GameDefinitions { version: string; @@ -37,38 +37,28 @@ export interface GameModeRole { } function createBaseGameDefinitions(): GameDefinitions { - return { version: '', nations: [], gameModes: {}, roles: {} }; + return { version: "", nations: [], gameModes: {}, roles: {} }; } export const GameDefinitions: MessageFns = { - encode( - message: GameDefinitions, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.version !== '') { + encode(message: GameDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { writer.uint32(10).string(message.version); } for (const v of message.nations) { writer.uint32(18).string(v!); } Object.entries(message.gameModes).forEach(([key, value]) => { - GameDefinitions_GameModesEntry.encode( - { key: key as any, value }, - writer.uint32(26).fork(), - ).join(); + GameDefinitions_GameModesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); }); Object.entries(message.roles).forEach(([key, value]) => { - GameDefinitions_RolesEntry.encode( - { key: key as any, value }, - writer.uint32(34).fork(), - ).join(); + GameDefinitions_RolesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions { - 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 = createBaseGameDefinitions(); while (reader.pos < end) { @@ -95,10 +85,7 @@ export const GameDefinitions: MessageFns = { break; } - const entry3 = GameDefinitions_GameModesEntry.decode( - reader, - reader.uint32(), - ); + const entry3 = GameDefinitions_GameModesEntry.decode(reader, reader.uint32()); if (entry3.value !== undefined) { message.gameModes[entry3.key] = entry3.value; } @@ -109,10 +96,7 @@ export const GameDefinitions: MessageFns = { break; } - const entry4 = GameDefinitions_RolesEntry.decode( - reader, - reader.uint32(), - ); + const entry4 = GameDefinitions_RolesEntry.decode(reader, reader.uint32()); if (entry4.value !== undefined) { message.roles[entry4.key] = entry4.value; } @@ -129,36 +113,26 @@ export const GameDefinitions: MessageFns = { fromJSON(object: any): GameDefinitions { return { - version: globalThis.String( - assertSet('GameDefinitions.version', object.version), - ), - nations: globalThis.Array.isArray(object?.nations) - ? object.nations.map((e: any) => globalThis.String(e)) - : [], + version: globalThis.String(assertSet("GameDefinitions.version", object.version)), + nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [], gameModes: isObject(object.gameModes) - ? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>( - (acc, [key, value]) => { - acc[globalThis.Number(key)] = GameMode.fromJSON(value); - return acc; - }, - {}, - ) + ? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = GameMode.fromJSON(value); + return acc; + }, {}) : {}, roles: isObject(object.roles) - ? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>( - (acc, [key, value]) => { - acc[globalThis.Number(key)] = GameModeRole.fromJSON(value); - return acc; - }, - {}, - ) + ? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = GameModeRole.fromJSON(value); + return acc; + }, {}) : {}, }; }, toJSON(message: GameDefinitions): unknown { const obj: any = {}; - if (message.version !== '') { + if (message.version !== "") { obj.version = message.version; } if (message.nations?.length) { @@ -185,28 +159,23 @@ export const GameDefinitions: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): GameDefinitions { + create, I>>(base?: I): GameDefinitions { return GameDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): GameDefinitions { + fromPartial, I>>(object: I): GameDefinitions { const message = createBaseGameDefinitions(); - message.version = object.version ?? ''; + message.version = object.version ?? ""; message.nations = object.nations?.map((e) => e) || []; - message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ - [key: number]: GameMode; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = GameMode.fromPartial(value); - } - return acc; - }, {}); - message.roles = Object.entries(object.roles ?? {}).reduce<{ - [key: number]: GameModeRole; - }>((acc, [key, value]) => { + message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ [key: number]: GameMode }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = GameMode.fromPartial(value); + } + return acc; + }, + {}, + ); + message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => { if (value !== undefined) { acc[globalThis.Number(key)] = GameModeRole.fromPartial(value); } @@ -220,201 +189,166 @@ function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEn return { key: 0, value: createBaseGameMode() }; } -export const GameDefinitions_GameModesEntry: MessageFns = - { - encode( - message: GameDefinitions_GameModesEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - GameMode.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const GameDefinitions_GameModesEntry: MessageFns = { + encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); + } + if (message.value !== undefined) { + GameMode.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): GameDefinitions_GameModesEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGameDefinitions_GameModesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGameDefinitions_GameModesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = GameMode.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = GameMode.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): GameDefinitions_GameModesEntry { - return { - key: globalThis.Number( - assertSet('GameDefinitions_GameModesEntry.key', object.key), - ), - value: GameMode.fromJSON( - assertSet('GameDefinitions_GameModesEntry.value', object.value), - ), - }; - }, - - toJSON(message: GameDefinitions_GameModesEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = GameMode.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create, I>>( - base?: I, - ): GameDefinitions_GameModesEntry { - return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial< - I extends Exact, I>, - >(object: I): GameDefinitions_GameModesEntry { - const message = createBaseGameDefinitions_GameModesEntry(); - message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? GameMode.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): GameDefinitions_GameModesEntry { + return { + key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)), + value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)), + }; + }, + + toJSON(message: GameDefinitions_GameModesEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = GameMode.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): GameDefinitions_GameModesEntry { + return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GameDefinitions_GameModesEntry { + const message = createBaseGameDefinitions_GameModesEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? GameMode.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry { return { key: 0, value: createBaseGameModeRole() }; } -export const GameDefinitions_RolesEntry: MessageFns = - { - encode( - message: GameDefinitions_RolesEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - GameModeRole.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const GameDefinitions_RolesEntry: MessageFns = { + encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); + } + if (message.value !== undefined) { + GameModeRole.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): GameDefinitions_RolesEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGameDefinitions_RolesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGameDefinitions_RolesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = GameModeRole.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = GameModeRole.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): GameDefinitions_RolesEntry { - return { - key: globalThis.Number( - assertSet('GameDefinitions_RolesEntry.key', object.key), - ), - value: GameModeRole.fromJSON( - assertSet('GameDefinitions_RolesEntry.value', object.value), - ), - }; - }, - - toJSON(message: GameDefinitions_RolesEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = GameModeRole.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create, I>>( - base?: I, - ): GameDefinitions_RolesEntry { - return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GameDefinitions_RolesEntry { - const message = createBaseGameDefinitions_RolesEntry(); - message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? GameModeRole.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): GameDefinitions_RolesEntry { + return { + key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)), + value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)), + }; + }, + + toJSON(message: GameDefinitions_RolesEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = GameModeRole.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): GameDefinitions_RolesEntry { + return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GameDefinitions_RolesEntry { + const message = createBaseGameDefinitions_RolesEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? GameModeRole.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseGameMode(): GameMode { return { name: createBaseI18nString() }; } export const GameMode: MessageFns = { - encode( - message: GameMode, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: GameMode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== undefined) { I18nString.encode(message.name, writer.uint32(10).fork()).join(); } @@ -422,8 +356,7 @@ export const GameMode: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): GameMode { - 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 = createBaseGameMode(); while (reader.pos < end) { @@ -447,9 +380,7 @@ export const GameMode: MessageFns = { }, fromJSON(object: any): GameMode { - return { - name: I18nString.fromJSON(assertSet('GameMode.name', object.name)), - }; + return { name: I18nString.fromJSON(assertSet("GameMode.name", object.name)) }; }, toJSON(message: GameMode): unknown { @@ -465,10 +396,9 @@ export const GameMode: MessageFns = { }, fromPartial, I>>(object: I): GameMode { const message = createBaseGameMode(); - 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(); return message; }, }; @@ -478,10 +408,7 @@ function createBaseGameModeRole(): GameModeRole { } export const GameModeRole: MessageFns = { - encode( - message: GameModeRole, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: GameModeRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { writer.uint32(10).fork(); for (const v of message.provisions) { writer.uint32(v); @@ -496,8 +423,7 @@ export const GameModeRole: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole { - 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 = createBaseGameModeRole(); while (reader.pos < end) { @@ -570,14 +496,10 @@ export const GameModeRole: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): GameModeRole { + create, I>>(base?: I): GameModeRole { return GameModeRole.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): GameModeRole { + fromPartial, I>>(object: I): GameModeRole { const message = createBaseGameModeRole(); message.provisions = object.provisions?.map((e) => e) || []; message.consumables = object.consumables?.map((e) => e) || []; @@ -585,36 +507,21 @@ export const GameModeRole: 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/core/src/protos/legacy_i18n.ts b/packages/core/src/protos/legacy_i18n.ts index bc7203097..1faf016f7 100644 --- a/packages/core/src/protos/legacy_i18n.ts +++ b/packages/core/src/protos/legacy_i18n.ts @@ -18,7 +18,7 @@ export interface I18nString_LocalesEntry { value: string; } -export function createBaseI18nString(): I18nString { +function createBaseI18nString(): I18nString { return { locales: {} }; } diff --git a/packages/core/src/protos/legacy_map_definitions.ts b/packages/core/src/protos/legacy_map_definitions.ts index 12f2b06d1..c09dc4584 100644 --- a/packages/core/src/protos/legacy_map_definitions.ts +++ b/packages/core/src/protos/legacy_map_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/legacy_map_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export interface MapDefinitions { maps: { [key: number]: MapDefinition }; @@ -29,22 +29,15 @@ function createBaseMapDefinitions(): MapDefinitions { } export const MapDefinitions: MessageFns = { - encode( - message: MapDefinitions, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: MapDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { Object.entries(message.maps).forEach(([key, value]) => { - MapDefinitions_MapsEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).join(); + MapDefinitions_MapsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions { - 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 = createBaseMapDefinitions(); while (reader.pos < end) { @@ -55,10 +48,7 @@ export const MapDefinitions: MessageFns = { break; } - const entry1 = MapDefinitions_MapsEntry.decode( - reader, - reader.uint32(), - ); + const entry1 = MapDefinitions_MapsEntry.decode(reader, reader.uint32()); if (entry1.value !== undefined) { message.maps[entry1.key] = entry1.value; } @@ -76,13 +66,10 @@ export const MapDefinitions: MessageFns = { fromJSON(object: any): MapDefinitions { return { maps: isObject(object.maps) - ? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>( - (acc, [key, value]) => { - acc[globalThis.Number(key)] = MapDefinition.fromJSON(value); - return acc; - }, - {}, - ) + ? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = MapDefinition.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -101,18 +88,12 @@ export const MapDefinitions: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): MapDefinitions { + create, I>>(base?: I): MapDefinitions { return MapDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): MapDefinitions { + fromPartial, I>>(object: I): MapDefinitions { const message = createBaseMapDefinitions(); - message.maps = Object.entries(object.maps ?? {}).reduce<{ - [key: number]: MapDefinition; - }>((acc, [key, value]) => { + message.maps = Object.entries(object.maps ?? {}).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => { if (value !== undefined) { acc[globalThis.Number(key)] = MapDefinition.fromPartial(value); } @@ -127,10 +108,7 @@ function createBaseMapDefinitions_MapsEntry(): MapDefinitions_MapsEntry { } export const MapDefinitions_MapsEntry: MessageFns = { - encode( - message: MapDefinitions_MapsEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: MapDefinitions_MapsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.key !== undefined) { writer.uint32(8).int32(message.key); } @@ -140,12 +118,8 @@ export const MapDefinitions_MapsEntry: MessageFns = { return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): MapDefinitions_MapsEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions_MapsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMapDefinitions_MapsEntry(); while (reader.pos < end) { @@ -178,12 +152,8 @@ export const MapDefinitions_MapsEntry: MessageFns = { fromJSON(object: any): MapDefinitions_MapsEntry { return { - key: globalThis.Number( - assertSet('MapDefinitions_MapsEntry.key', object.key), - ), - value: MapDefinition.fromJSON( - assertSet('MapDefinitions_MapsEntry.value', object.value), - ), + key: globalThis.Number(assertSet("MapDefinitions_MapsEntry.key", object.key)), + value: MapDefinition.fromJSON(assertSet("MapDefinitions_MapsEntry.value", object.value)), }; }, @@ -198,20 +168,15 @@ export const MapDefinitions_MapsEntry: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): MapDefinitions_MapsEntry { + create, I>>(base?: I): MapDefinitions_MapsEntry { return MapDefinitions_MapsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): MapDefinitions_MapsEntry { + fromPartial, I>>(object: I): MapDefinitions_MapsEntry { const message = createBaseMapDefinitions_MapsEntry(); message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? MapDefinition.fromPartial(object.value) - : undefined; + message.value = (object.value !== undefined && object.value !== null) + ? MapDefinition.fromPartial(object.value) + : undefined; return message; }, }; @@ -221,10 +186,7 @@ function createBaseMapDefinition(): MapDefinition { } export const MapDefinition: MessageFns = { - encode( - message: MapDefinition, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: MapDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -235,8 +197,7 @@ export const MapDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): MapDefinition { - 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 = createBaseMapDefinition(); while (reader.pos < end) { @@ -269,8 +230,8 @@ export const MapDefinition: MessageFns = { fromJSON(object: any): MapDefinition { return { - id: globalThis.Number(assertSet('MapDefinition.id', object.id)), - name: I18nString.fromJSON(assertSet('MapDefinition.name', object.name)), + id: globalThis.Number(assertSet("MapDefinition.id", object.id)), + name: I18nString.fromJSON(assertSet("MapDefinition.name", object.name)), }; }, @@ -285,54 +246,34 @@ export const MapDefinition: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): MapDefinition { + create, I>>(base?: I): MapDefinition { return MapDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): MapDefinition { + fromPartial, I>>(object: I): MapDefinition { const message = createBaseMapDefinition(); 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(); return message; }, }; -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/core/src/protos/legacy_provision_definitions.ts b/packages/core/src/protos/legacy_provision_definitions.ts index 85373ce2e..0eb58ec25 100644 --- a/packages/core/src/protos/legacy_provision_definitions.ts +++ b/packages/core/src/protos/legacy_provision_definitions.ts @@ -5,11 +5,11 @@ // source: packages/core/src/protos/legacy_provision_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { ConsumableTankFilter } from './legacy_consumable_definitions'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { ConsumableTankFilter } from "./legacy_consumable_definitions"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export interface ProvisionDefinitions { provisions: { [key: number]: Provision }; @@ -34,25 +34,15 @@ function createBaseProvisionDefinitions(): ProvisionDefinitions { } export const ProvisionDefinitions: MessageFns = { - encode( - message: ProvisionDefinitions, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: ProvisionDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { Object.entries(message.provisions).forEach(([key, value]) => { - ProvisionDefinitions_ProvisionsEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).join(); + ProvisionDefinitions_ProvisionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); return writer; }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ProvisionDefinitions { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseProvisionDefinitions(); while (reader.pos < end) { @@ -63,10 +53,7 @@ export const ProvisionDefinitions: MessageFns = { break; } - const entry1 = ProvisionDefinitions_ProvisionsEntry.decode( - reader, - reader.uint32(), - ); + const entry1 = ProvisionDefinitions_ProvisionsEntry.decode(reader, reader.uint32()); if (entry1.value !== undefined) { message.provisions[entry1.key] = entry1.value; } @@ -84,12 +71,10 @@ export const ProvisionDefinitions: MessageFns = { fromJSON(object: any): ProvisionDefinitions { return { provisions: isObject(object.provisions) - ? Object.entries(object.provisions).reduce<{ - [key: number]: Provision; - }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = Provision.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.provisions).reduce<{ [key: number]: Provision }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = Provision.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -108,23 +93,20 @@ export const ProvisionDefinitions: MessageFns = { return obj; }, - create, I>>( - base?: I, - ): ProvisionDefinitions { + create, I>>(base?: I): ProvisionDefinitions { return ProvisionDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): ProvisionDefinitions { + fromPartial, I>>(object: I): ProvisionDefinitions { const message = createBaseProvisionDefinitions(); - message.provisions = Object.entries(object.provisions ?? {}).reduce<{ - [key: number]: Provision; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = Provision.fromPartial(value); - } - return acc; - }, {}); + message.provisions = Object.entries(object.provisions ?? {}).reduce<{ [key: number]: Provision }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = Provision.fromPartial(value); + } + return acc; + }, + {}, + ); return message; }, }; @@ -133,115 +115,90 @@ function createBaseProvisionDefinitions_ProvisionsEntry(): ProvisionDefinitions_ return { key: 0, value: createBaseProvision() }; } -export const ProvisionDefinitions_ProvisionsEntry: MessageFns = - { - encode( - message: ProvisionDefinitions_ProvisionsEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - Provision.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, +export const ProvisionDefinitions_ProvisionsEntry: MessageFns = { + encode(message: ProvisionDefinitions_ProvisionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); + } + if (message.value !== undefined) { + Provision.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): ProvisionDefinitions_ProvisionsEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProvisionDefinitions_ProvisionsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; + decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions_ProvisionsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProvisionDefinitions_ProvisionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; } - case 2: { - if (tag !== 18) { - break; - } - message.value = Provision.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + message.value = Provision.decode(reader, reader.uint32()); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry { - return { - key: globalThis.Number( - assertSet('ProvisionDefinitions_ProvisionsEntry.key', object.key), - ), - value: Provision.fromJSON( - assertSet('ProvisionDefinitions_ProvisionsEntry.value', object.value), - ), - }; - }, - - toJSON(message: ProvisionDefinitions_ProvisionsEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = Provision.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - create< - I extends Exact, I>, - >(base?: I): ProvisionDefinitions_ProvisionsEntry { - return ProvisionDefinitions_ProvisionsEntry.fromPartial( - base ?? ({} as any), - ); - }, - fromPartial< - I extends Exact, I>, - >(object: I): ProvisionDefinitions_ProvisionsEntry { - const message = createBaseProvisionDefinitions_ProvisionsEntry(); - message.key = object.key ?? 0; - message.value = - object.value !== undefined && object.value !== null - ? Provision.fromPartial(object.value) - : undefined; - return message; - }, - }; + fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry { + return { + key: globalThis.Number(assertSet("ProvisionDefinitions_ProvisionsEntry.key", object.key)), + value: Provision.fromJSON(assertSet("ProvisionDefinitions_ProvisionsEntry.value", object.value)), + }; + }, + + toJSON(message: ProvisionDefinitions_ProvisionsEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = Provision.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): ProvisionDefinitions_ProvisionsEntry { + return ProvisionDefinitions_ProvisionsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ProvisionDefinitions_ProvisionsEntry { + const message = createBaseProvisionDefinitions_ProvisionsEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? Provision.fromPartial(object.value) + : undefined; + return message; + }, +}; function createBaseProvision(): Provision { - return { - id: 0, - name: createBaseI18nString(), - crew: undefined, - game_mode_exclusive: false, - include: [], - exclude: [], - }; + return { id: 0, name: createBaseI18nString(), crew: undefined, game_mode_exclusive: false, include: [], exclude: [] }; } export const Provision: MessageFns = { - encode( - message: Provision, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { + encode(message: Provision, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -264,8 +221,7 @@ export const Provision: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Provision { - 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 = createBaseProvision(); while (reader.pos < end) { @@ -308,9 +264,7 @@ export const Provision: MessageFns = { break; } - message.include.push( - ConsumableTankFilter.decode(reader, reader.uint32()), - ); + message.include.push(ConsumableTankFilter.decode(reader, reader.uint32())); continue; } case 7: { @@ -318,9 +272,7 @@ export const Provision: MessageFns = { break; } - message.exclude.push( - ConsumableTankFilter.decode(reader, reader.uint32()), - ); + message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32())); continue; } } @@ -334,12 +286,10 @@ export const Provision: MessageFns = { fromJSON(object: any): Provision { return { - id: globalThis.Number(assertSet('Provision.id', object.id)), - name: I18nString.fromJSON(assertSet('Provision.name', object.name)), + id: globalThis.Number(assertSet("Provision.id", object.id)), + name: I18nString.fromJSON(assertSet("Provision.name", object.name)), crew: isSet(object.crew) ? globalThis.Number(object.crew) : undefined, - game_mode_exclusive: globalThis.Boolean( - assertSet('Provision.game_mode_exclusive', object.game_mode_exclusive), - ), + game_mode_exclusive: globalThis.Boolean(assertSet("Provision.game_mode_exclusive", object.game_mode_exclusive)), include: globalThis.Array.isArray(object?.include) ? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e)) : [], @@ -375,55 +325,35 @@ export const Provision: MessageFns = { create, I>>(base?: I): Provision { return Provision.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( - object: I, - ): Provision { + fromPartial, I>>(object: I): Provision { const message = createBaseProvision(); 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.crew = object.crew ?? undefined; message.game_mode_exclusive = object.game_mode_exclusive ?? false; - message.include = - object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; - message.exclude = - object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; + message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; + message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; return message; }, }; -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/core/src/protos/legacy_tank_definitions.ts b/packages/core/src/protos/legacy_tank_definitions.ts index 7b87174b5..ff622dff0 100644 --- a/packages/core/src/protos/legacy_tank_definitions.ts +++ b/packages/core/src/protos/legacy_tank_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/legacy_tank_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18nString, createBaseI18nString } from './legacy_i18n'; +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { I18nString } from "./legacy_i18n"; -export const protobufPackage = 'blitzkit'; +export const protobufPackage = "blitzkit"; export enum TankPriceType { CREDITS = 0, @@ -18,28 +18,24 @@ 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"); } } @@ -53,38 +49,34 @@ 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"); } } @@ -99,43 +91,39 @@ 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"); } } @@ -149,38 +137,34 @@ 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"); } } @@ -193,33 +177,29 @@ 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"); } } @@ -234,43 +214,39 @@ 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"); } } @@ -323,8 +299,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; } @@ -379,9 +355,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; } @@ -477,22 +453,15 @@ 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) { @@ -503,10 +472,7 @@ 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; } @@ -524,12 +490,10 @@ 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; + }, {}) : {}, }; }, @@ -548,23 +512,20 @@ 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; }, }; @@ -573,96 +534,79 @@ 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; - }, +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; + 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; } - case 2: { - if (tag !== 18) { - break; - } - message.value = TankDefinition.decode(reader, reader.uint32()); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + 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 ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = TankDefinition.toJSON(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - 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; - }, - }; + 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 { @@ -674,7 +618,7 @@ function createBaseTankDefinition(): TankDefinition { successors: [], crew: [], health: 0, - nation: '', + nation: "", name: createBaseI18nString(), name_full: undefined, type: 0, @@ -694,24 +638,18 @@ 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); } 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(18).fork()).join(); }); if (message.fixed_camouflage !== false) { writer.uint32(32).bool(message.fixed_camouflage); @@ -737,7 +675,7 @@ export const TankDefinition: MessageFns = { if (message.health !== 0) { writer.uint32(72).uint32(message.health); } - if (message.nation !== '') { + if (message.nation !== "") { writer.uint32(82).string(message.nation); } if (message.name !== undefined) { @@ -780,10 +718,7 @@ 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); @@ -800,7 +735,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) { @@ -810,8 +745,7 @@ 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) { @@ -830,10 +764,7 @@ export const TankDefinition: MessageFns = { break; } - const entry2 = TankDefinition_RolesEntry.decode( - reader, - reader.uint32(), - ); + const entry2 = TankDefinition_RolesEntry.decode(reader, reader.uint32()); if (entry2.value !== undefined) { message.roles[entry2.key] = entry2.value; } @@ -1002,9 +933,7 @@ export const TankDefinition: MessageFns = { break; } - message.turrets.push( - TurretDefinition.decode(reader, reader.uint32()), - ); + message.turrets.push(TurretDefinition.decode(reader, reader.uint32())); continue; } case 21: { @@ -1012,9 +941,7 @@ export const TankDefinition: MessageFns = { break; } - message.engines.push( - EngineDefinition.decode(reader, reader.uint32()), - ); + message.engines.push(EngineDefinition.decode(reader, reader.uint32())); continue; } case 22: { @@ -1108,19 +1035,14 @@ 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)), 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)) : [], @@ -1130,34 +1052,18 @@ 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)), + 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)), turrets: globalThis.Array.isArray(object?.turrets) ? object.turrets.map((e: any) => TurretDefinition.fromJSON(e)) : [], @@ -1167,33 +1073,15 @@ 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)), }; }, @@ -1229,7 +1117,7 @@ export const TankDefinition: MessageFns = { if (message.health !== 0) { obj.health = Math.round(message.health); } - if (message.nation !== '') { + if (message.nation !== "") { obj.nation = message.nation; } if (message.name !== undefined) { @@ -1289,7 +1177,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) { @@ -1298,19 +1186,13 @@ 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.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: number }>((acc, [key, value]) => { if (value !== undefined) { acc[globalThis.Number(key)] = globalThis.Number(value); } @@ -1322,15 +1204,13 @@ 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.name_full = (object.name_full !== undefined && object.name_full !== null) + ? I18nString.fromPartial(object.name_full) + : undefined; message.type = object.type ?? 0; message.max_consumables = object.max_consumables ?? 0; message.max_provisions = object.max_provisions ?? 0; @@ -1338,26 +1218,21 @@ 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; }, @@ -1367,120 +1242,97 @@ 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; - }, +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; + 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; } - case 2: { - if (tag !== 16) { - break; - } - message.value = reader.uint32(); - continue; + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; } + + message.value = reader.uint32(); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); } - return message; - }, - - fromJSON(object: any): 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 ((tag & 7) === 4 || tag === 0) { + break; } - if (message.value !== undefined) { - obj.value = Math.round(message.value); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - 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; - }, - }; + 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) { @@ -1491,7 +1343,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: { @@ -1500,7 +1352,7 @@ export const ResearchCost: MessageFns = { } message.research_cost_type = { - $case: 'seasonal_tokens', + $case: "seasonal_tokens", value: ResearchCostSeasonalTokens.decode(reader, reader.uint32()), }; continue; @@ -1517,60 +1369,44 @@ 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?.$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, - }; + 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 === "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, - ), + $case: "seasonal_tokens", + value: ResearchCostSeasonalTokens.fromPartial(object.research_cost_type.value), }; } return message; @@ -1581,103 +1417,84 @@ 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; - }, +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; + 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; } - case 2: { - if (tag !== 16) { - break; - } - message.tokens = reader.uint32(); - continue; + message.season = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; } + + 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 ((tag & 7) === 4 || tag === 0) { + break; } - if (message.tokens !== 0) { - obj.tokens = Math.round(message.tokens); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - 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; - }, - }; + 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); } @@ -1688,8 +1505,7 @@ 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) { @@ -1722,8 +1538,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)), }; }, @@ -1741,9 +1557,7 @@ 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; @@ -1769,10 +1583,7 @@ 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); } @@ -1789,10 +1600,7 @@ 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); @@ -1816,8 +1624,7 @@ 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) { @@ -1930,42 +1737,20 @@ 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), - ), + 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, - ), + 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)) - : [], + 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)) : [], }; }, @@ -2010,27 +1795,21 @@ 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; @@ -2055,10 +1834,7 @@ 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); } @@ -2066,10 +1842,7 @@ 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); @@ -2090,8 +1863,7 @@ 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) { @@ -2172,26 +1944,14 @@ 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)) : [], }; }, @@ -2224,24 +1984,18 @@ 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; @@ -2267,10 +2021,7 @@ 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); } @@ -2284,10 +2035,7 @@ 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(); @@ -2308,8 +2056,7 @@ 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) { @@ -2406,32 +2153,16 @@ 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)) : [], }; }, @@ -2470,27 +2201,21 @@ 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)) || []; @@ -2504,36 +2229,23 @@ 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) { @@ -2544,10 +2256,7 @@ 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: { @@ -2555,10 +2264,7 @@ 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: { @@ -2567,7 +2273,7 @@ export const GunDefinition: MessageFns = { } message.gun_type = { - $case: 'auto_reloader', + $case: "auto_reloader", value: GunDefinitionAutoReloader.decode(reader, reader.uint32()), }; continue; @@ -2584,76 +2290,53 @@ 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 + 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), - }; + message.gun_type = { $case: "regular", value: GunDefinitionRegular.fromPartial(object.gun_type.value) }; } if ( - object.gun_type?.$case === 'auto_loader' && + 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), - }; + message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value) }; } if ( - object.gun_type?.$case === 'auto_reloader' && + object.gun_type?.$case === "auto_reloader" && object.gun_type?.value !== undefined && object.gun_type?.value !== null ) { message.gun_type = { - $case: 'auto_reloader', + $case: "auto_reloader", value: GunDefinitionAutoReloader.fromPartial(object.gun_type.value), }; } @@ -2662,35 +2345,22 @@ 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) { @@ -2709,10 +2379,7 @@ export const GunDefinitionRegular: MessageFns = { break; } - message.extension = GunDefinitionRegularProperties.decode( - reader, - reader.uint32(), - ); + message.extension = GunDefinitionRegularProperties.decode(reader, reader.uint32()); continue; } } @@ -2726,12 +2393,8 @@ 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)), }; }, @@ -2746,23 +2409,17 @@ 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; }, }; @@ -2771,106 +2428,79 @@ 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; - }, - - 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; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - 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; - } - return obj; - }, - - 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(), - }; -} - -export const GunDefinitionAutoLoader: MessageFns = { - 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(); +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, - ): GunDefinitionAutoLoader { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); + 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; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + 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; + } + 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; + }, +}; + +function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader { + return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoLoaderProperties() }; +} + +export const GunDefinitionAutoLoader: MessageFns = { + 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(); + } + return writer; + }, + + 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) { @@ -2889,10 +2519,7 @@ export const GunDefinitionAutoLoader: MessageFns = { break; } - message.extension = GunDefinitionAutoLoaderProperties.decode( - reader, - reader.uint32(), - ); + message.extension = GunDefinitionAutoLoaderProperties.decode(reader, reader.uint32()); continue; } } @@ -2906,11 +2533,9 @@ 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), ), }; }, @@ -2921,30 +2546,22 @@ 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; }, }; @@ -2953,359 +2570,289 @@ 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; - }, +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; + 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; } - case 2: { - if (tag !== 21) { - break; - } - message.intra_clip = reader.float(); - continue; - } - case 3: { - if (tag !== 29) { - break; - } - - message.shell_count = reader.float(); - continue; - } + message.clip_reload = reader.float(); + continue; } - if ((tag & 7) === 4 || tag === 0) { - break; + case 2: { + if (tag !== 21) { + break; + } + + message.intra_clip = reader.float(); + continue; } - reader.skip(tag & 7); - } - return message; - }, + case 3: { + if (tag !== 29) { + break; + } - 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, - ), - ), - }; - }, + message.shell_count = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, - 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; - }, + 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)), + }; + }, - 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; - }, - }; + 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>>( + 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; - }, +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; + 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; } - case 2: { - if (tag !== 18) { - break; - } - message.extension = GunDefinitionAutoReloaderProperties.decode( - reader, - reader.uint32(), - ); - continue; + message.base = GunDefinitionBase.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; } + + 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 ((tag & 7) === 4 || tag === 0) { + break; } - if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoReloaderProperties.toJSON( - message.extension, - ); - } - return obj; - }, + reader.skip(tag & 7); + } + return message; + }, - 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; - }, - }; + 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) { + 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; } - 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; } - reader.skip(tag & 7); - } - return message; - }, + case 2: { + if (tag !== 21) { + break; + } - 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, - ), - ), - }; - }, + message.intra_clip = reader.float(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } - toJSON(message: GunDefinitionAutoReloaderProperties): unknown { - const obj: any = {}; - if (message.shell_reloads?.length) { - obj.shell_reloads = message.shell_reloads; + message.shell_count = reader.float(); + continue; + } } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; + if ((tag & 7) === 4 || tag === 0) { + break; } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, + reader.skip(tag & 7); + } + 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; - }, - }; + 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; + }, +}; function createBaseGunDefinitionBase(): GunDefinitionBase { return { @@ -3328,10 +2875,7 @@ 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); } @@ -3339,10 +2883,7 @@ 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); @@ -3384,8 +2925,7 @@ 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) { @@ -3522,53 +3062,27 @@ 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, - ), - ), - dispersion_shot: globalThis.Number( - assertSet('GunDefinitionBase.dispersion_shot', object.dispersion_shot), + assertSet("GunDefinitionBase.dispersion_traverse", object.dispersion_traverse), ), + dispersion_shot: globalThis.Number(assertSet("GunDefinitionBase.dispersion_shot", object.dispersion_shot)), dispersion_damaged: globalThis.Number( - 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), + 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)), }; }, @@ -3622,29 +3136,22 @@ 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; @@ -3665,7 +3172,7 @@ function createBaseShellDefinition(): ShellDefinition { armor_damage: 0, module_damage: 0, caliber: 0, - icon: '', + icon: "", penetration: createBaseShellPenetration(), type: 0, normalization: undefined, @@ -3676,10 +3183,7 @@ 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); } @@ -3698,31 +3202,22 @@ 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) { @@ -3732,8 +3227,7 @@ 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) { @@ -3800,10 +3294,7 @@ export const ShellDefinition: MessageFns = { break; } - message.penetration = ShellPenetration.decode( - reader, - reader.uint32(), - ); + message.penetration = ShellPenetration.decode(reader, reader.uint32()); continue; } case 9: { @@ -3857,37 +3348,19 @@ 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)), }; }, @@ -3911,7 +3384,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) { @@ -3920,19 +3393,13 @@ 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) { @@ -3941,29 +3408,23 @@ 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; @@ -3978,10 +3439,7 @@ 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); } @@ -3992,8 +3450,7 @@ 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) { @@ -4026,8 +3483,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)), }; }, @@ -4042,14 +3499,10 @@ 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; @@ -4062,10 +3515,7 @@ 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); } @@ -4079,8 +3529,7 @@ 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) { @@ -4121,9 +3570,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)), }; }, @@ -4148,24 +3597,20 @@ 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) { @@ -4175,8 +3620,7 @@ 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) { @@ -4209,14 +3653,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) { @@ -4228,11 +3672,9 @@ 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; }, @@ -4243,10 +3685,7 @@ 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); } @@ -4262,8 +3701,7 @@ 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) { @@ -4314,8 +3752,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)) : [], @@ -4348,36 +3786,21 @@ 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/core/src/protos/tank.proto b/packages/core/src/protos/tank.proto index ff5bb62d5..f777cbacf 100644 --- a/packages/core/src/protos/tank.proto +++ b/packages/core/src/protos/tank.proto @@ -8,4 +8,12 @@ message Tank { required string id = 1; required string slug = 2; required I18n name = 3; + // key can only ever be "chassis", "hull", "turret", or "gun" + map penetration_groups = 4; +} + +message PenetrationGroup { + // keys are mostly "armor_xyz" where xyz is an integer but sometimes can be + // things like "commander", "rightTrack", etc. + map armors = 1; } \ No newline at end of file diff --git a/packages/core/src/protos/tank.ts b/packages/core/src/protos/tank.ts index ff3b06502..b5581f4ba 100644 --- a/packages/core/src/protos/tank.ts +++ b/packages/core/src/protos/tank.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { I18n, createBaseI18n } from "./i18n"; +import { I18n } from "./i18n"; export const protobufPackage = "blitzkit"; @@ -14,10 +14,26 @@ export interface Tank { id: string; slug: string; name: I18n; + /** key can only ever be "chassis", "hull", "turret", or "gun" */ + penetration_groups: { [key: string]: PenetrationGroup }; +} + +export interface Tank_PenetrationGroupsEntry { + key: string; + value: PenetrationGroup | undefined; +} + +export interface PenetrationGroup { + armors: { [key: string]: number }; +} + +export interface PenetrationGroup_ArmorsEntry { + key: string; + value: number; } function createBaseTank(): Tank { - return { id: "", slug: "", name: createBaseI18n() }; + return { id: "", slug: "", name: createBaseI18n(), penetration_groups: {} }; } export const Tank: MessageFns = { @@ -31,6 +47,9 @@ export const Tank: MessageFns = { if (message.name !== undefined) { I18n.encode(message.name, writer.uint32(26).fork()).join(); } + Object.entries(message.penetration_groups).forEach(([key, value]) => { + Tank_PenetrationGroupsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); return writer; }, @@ -65,6 +84,17 @@ export const Tank: MessageFns = { message.name = I18n.decode(reader, reader.uint32()); continue; } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = Tank_PenetrationGroupsEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.penetration_groups[entry4.key] = entry4.value; + } + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -79,6 +109,12 @@ export const Tank: MessageFns = { id: globalThis.String(assertSet("Tank.id", object.id)), slug: globalThis.String(assertSet("Tank.slug", object.slug)), name: I18n.fromJSON(assertSet("Tank.name", object.name)), + penetration_groups: isObject(object.penetration_groups) + ? Object.entries(object.penetration_groups).reduce<{ [key: string]: PenetrationGroup }>((acc, [key, value]) => { + acc[key] = PenetrationGroup.fromJSON(value); + return acc; + }, {}) + : {}, }; }, @@ -93,6 +129,15 @@ export const Tank: MessageFns = { if (message.name !== undefined) { obj.name = I18n.toJSON(message.name); } + if (message.penetration_groups) { + const entries = Object.entries(message.penetration_groups); + if (entries.length > 0) { + obj.penetration_groups = {}; + entries.forEach(([k, v]) => { + obj.penetration_groups[k] = PenetrationGroup.toJSON(v); + }); + } + } return obj; }, @@ -106,6 +151,247 @@ export const Tank: MessageFns = { message.name = (object.name !== undefined && object.name !== null) ? I18n.fromPartial(object.name) : createBaseI18n(); + message.penetration_groups = Object.entries(object.penetration_groups ?? {}).reduce< + { [key: string]: PenetrationGroup } + >((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = PenetrationGroup.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseTank_PenetrationGroupsEntry(): Tank_PenetrationGroupsEntry { + return { key: "", value: createBasePenetrationGroup() }; +} + +export const Tank_PenetrationGroupsEntry: MessageFns = { + encode(message: Tank_PenetrationGroupsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + PenetrationGroup.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tank_PenetrationGroupsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTank_PenetrationGroupsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = PenetrationGroup.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tank_PenetrationGroupsEntry { + return { + key: globalThis.String(assertSet("Tank_PenetrationGroupsEntry.key", object.key)), + value: PenetrationGroup.fromJSON(assertSet("Tank_PenetrationGroupsEntry.value", object.value)), + }; + }, + + toJSON(message: Tank_PenetrationGroupsEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = PenetrationGroup.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Tank_PenetrationGroupsEntry { + return Tank_PenetrationGroupsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tank_PenetrationGroupsEntry { + const message = createBaseTank_PenetrationGroupsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? PenetrationGroup.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBasePenetrationGroup(): PenetrationGroup { + return { armors: {} }; +} + +export const PenetrationGroup: MessageFns = { + encode(message: PenetrationGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.armors).forEach(([key, value]) => { + PenetrationGroup_ArmorsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PenetrationGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePenetrationGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = PenetrationGroup_ArmorsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.armors[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PenetrationGroup { + return { + armors: isObject(object.armors) + ? Object.entries(object.armors).reduce<{ [key: string]: number }>((acc, [key, value]) => { + acc[key] = Number(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: PenetrationGroup): unknown { + const obj: any = {}; + if (message.armors) { + const entries = Object.entries(message.armors); + if (entries.length > 0) { + obj.armors = {}; + entries.forEach(([k, v]) => { + obj.armors[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): PenetrationGroup { + return PenetrationGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PenetrationGroup { + const message = createBasePenetrationGroup(); + message.armors = Object.entries(object.armors ?? {}).reduce<{ [key: string]: number }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.Number(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBasePenetrationGroup_ArmorsEntry(): PenetrationGroup_ArmorsEntry { + return { key: "", value: 0 }; +} + +export const PenetrationGroup_ArmorsEntry: MessageFns = { + encode(message: PenetrationGroup_ArmorsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + writer.uint32(21).float(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PenetrationGroup_ArmorsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePenetrationGroup_ArmorsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + + message.value = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PenetrationGroup_ArmorsEntry { + return { + key: globalThis.String(assertSet("PenetrationGroup_ArmorsEntry.key", object.key)), + value: globalThis.Number(assertSet("PenetrationGroup_ArmorsEntry.value", object.value)), + }; + }, + + toJSON(message: PenetrationGroup_ArmorsEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): PenetrationGroup_ArmorsEntry { + return PenetrationGroup_ArmorsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PenetrationGroup_ArmorsEntry { + const message = createBasePenetrationGroup_ArmorsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? 0; return message; }, }; @@ -123,6 +409,10 @@ 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 }; +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx b/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx index a953ae8c9..2f3b972e7 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx @@ -27,14 +27,21 @@ export function Page({ id }: PageProps) { function Model({ id }: { id: string }) { const gltf = useLoader(GLTFLoader, asset(`/tanks/${id}/collision/hull.glb`)); + console.log(gltf); + return jsxTree(gltf.scene, { - mesh: () => ({ + mesh: (mesh) => ({ material: new MeshBasicMaterial({ color: `rgb(${randInt(0, 255)}, ${randInt(0, 255)}, ${randInt( 0, 255, )})`, }), + onClick: (event) => { + if (!(mesh.material instanceof MeshBasicMaterial)) return; + event.stopPropagation(); + console.log(mesh.material.name) + }, }), }); } diff --git a/src/BlitzKit.CLI/Functions/Mangler.cs b/src/BlitzKit.CLI/Functions/Mangler.cs index 2b65e9a58..3624eac66 100644 --- a/src/BlitzKit.CLI/Functions/Mangler.cs +++ b/src/BlitzKit.CLI/Functions/Mangler.cs @@ -9,15 +9,40 @@ using CUE4Parse.UE4.Assets.Exports.Engine; using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Assets.Objects; +using CUE4Parse.UE4.Assets.Objects.Properties; using CUE4Parse.UE4.Objects.UObject; using CUE4Parse.Utils; using Google.Protobuf; +using Google.Protobuf.Collections; +using Org.BouncyCastle.Asn1.Misc; using YamlDotNet.Serialization; namespace BlitzKit.CLI.Functions { - public class Mangler(string[] args) + public partial class Mangler(string[] args) { + static readonly string PenetrationGroupNameMapPrefix = + "EMintSDKProtoData_BlitzStaticTankUpgradeSingleStage_PenetrationGroupUpgrade_TankPart"; + static readonly Dictionary PenetrationGroupNameMap = new Dictionary< + string, + string + > + { + { $"{PenetrationGroupNameMapPrefix}::TANK_PART_CHASSIS", "chassis" }, + { $"{PenetrationGroupNameMapPrefix}::TANK_PART_HULL", "hull" }, + { $"{PenetrationGroupNameMapPrefix}::TANK_PART_TURRET", "turret" }, + { $"{PenetrationGroupNameMapPrefix}::TANK_PART_GUN", "gun" }, + }; + + [GeneratedRegex("[^a-z0-9]")] + private static partial Regex NonAlphanumericRegex(); + + [GeneratedRegex("--+")] + private static partial Regex MultipleDashesRegex(); + + [GeneratedRegex("-$")] + private static partial Regex TrailingDashRegex(); + readonly BlitzProvider provider = new(args.Contains("--depot")); Locales? locales; readonly Dictionary> strings = []; @@ -192,9 +217,9 @@ namespace BlitzKit.CLI.Functions var id = PropertyUtil.Get(pda, "TankId").Text; var name = GetString($"TankEntity__{id.ToLowerInvariant()}__Short_Name"); var slug = Diacritics.Remove(name.Locales["en"]).ToLower(); - slug = Regex.Replace(slug, "[^a-z0-9]", "-"); - slug = Regex.Replace(slug, "--+", "-"); - slug = Regex.Replace(slug, "-$", ""); + slug = NonAlphanumericRegex().Replace(slug, "-"); + slug = MultipleDashesRegex().Replace(slug, "-"); + slug = TrailingDashRegex().Replace(slug, ""); // await MangleHull(pda); // await MangleIcon(pda); @@ -206,9 +231,50 @@ namespace BlitzKit.CLI.Functions Slug = slug, }; + tank.PenetrationGroups.MergeFrom(MangleArmor(pda)); + return tank; } + MapField MangleArmor(UObject pda) + { + var id = PropertyUtil.Get(pda, "TankId").Text; + MapField groups = []; + var attributes = PropertyUtil.Get(pda, "DA_Attributes"); + PropertyUtil.TryGet(attributes, "PenetrationGroups", out var penetrationGroups); + + if (penetrationGroups == null) + { + PrettyLog.Warn($"Penetration groups missing for {id}; returning empty list"); + return groups; + } + + foreach (var group in penetrationGroups.Properties) + { + var rawName = ((FName)group.Key.GenericValue!).Text; + var name = PenetrationGroupNameMap[rawName]; + var armors = PropertyUtil.Get( + group.Value!.GetValue()!, + "PenetrationGroups" + ); + PenetrationGroup penetrationGroup = new(); + + foreach (var armorProperty in armors.Properties) + { + var armorName = ((FName)armorProperty.Key.GenericValue!).Text; + var armorThickness = PropertyUtil.Get( + armorProperty.Value!.GetValue()!, + "Armor" + ); + penetrationGroup.Armors[armorName] = armorThickness; + } + + groups[name] = penetrationGroup; + } + + return groups; + } + async Task MangleIcon(UObject pda) { var id = PropertyUtil.Get(pda, "TankId").Text; diff --git a/src/BlitzKit.CLI/Protos/Tank.cs b/src/BlitzKit.CLI/Protos/Tank.cs index 320f68f76..d28b79d3a 100644 --- a/src/BlitzKit.CLI/Protos/Tank.cs +++ b/src/BlitzKit.CLI/Protos/Tank.cs @@ -25,13 +25,20 @@ namespace Blitzkit { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90bxIIYmxpdHpr", - "aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvIj4KBFRh", - "bmsSCgoCaWQYASACKAkSDAoEc2x1ZxgCIAIoCRIcCgRuYW1lGAMgAigLMg4u", - "YmxpdHpraXQuSTE4bg==")); + "aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvItcBCgRU", + "YW5rEgoKAmlkGAEgAigJEgwKBHNsdWcYAiACKAkSHAoEbmFtZRgDIAIoCzIO", + "LmJsaXR6a2l0LkkxOG4SQQoScGVuZXRyYXRpb25fZ3JvdXBzGAQgAygLMiUu", + "YmxpdHpraXQuVGFuay5QZW5ldHJhdGlvbkdyb3Vwc0VudHJ5GlQKFlBlbmV0", + "cmF0aW9uR3JvdXBzRW50cnkSCwoDa2V5GAEgASgJEikKBXZhbHVlGAIgASgL", + "MhouYmxpdHpraXQuUGVuZXRyYXRpb25Hcm91cDoCOAEieQoQUGVuZXRyYXRp", + "b25Hcm91cBI2CgZhcm1vcnMYASADKAsyJi5ibGl0emtpdC5QZW5ldHJhdGlv", + "bkdyb3VwLkFybW9yc0VudHJ5Gi0KC0FybW9yc0VudHJ5EgsKA2tleRgBIAEo", + "CRINCgV2YWx1ZRgCIAEoAjoCOAE=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Blitzkit.I18NReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "Slug", "Name" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "Slug", "Name", "PenetrationGroups" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.PenetrationGroup), global::Blitzkit.PenetrationGroup.Parser, new[]{ "Armors" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }) })); } #endregion @@ -76,6 +83,7 @@ namespace Blitzkit { id_ = other.id_; slug_ = other.slug_; name_ = other.name_ != null ? other.name_.Clone() : null; + penetrationGroups_ = other.penetrationGroups_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -149,6 +157,20 @@ namespace Blitzkit { } } + /// Field number for the "penetration_groups" field. + public const int PenetrationGroupsFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_penetrationGroups_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.PenetrationGroup.Parser), 34); + private readonly pbc::MapField penetrationGroups_ = new pbc::MapField(); + /// + /// key can only ever be "chassis", "hull", "turret", or "gun" + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField PenetrationGroups { + get { return penetrationGroups_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -167,6 +189,7 @@ namespace Blitzkit { if (Id != other.Id) return false; if (Slug != other.Slug) return false; if (!object.Equals(Name, other.Name)) return false; + if (!PenetrationGroups.Equals(other.PenetrationGroups)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -177,6 +200,7 @@ namespace Blitzkit { if (HasId) hash ^= Id.GetHashCode(); if (HasSlug) hash ^= Slug.GetHashCode(); if (name_ != null) hash ^= Name.GetHashCode(); + hash ^= PenetrationGroups.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -207,6 +231,7 @@ namespace Blitzkit { output.WriteRawTag(26); output.WriteMessage(Name); } + penetrationGroups_.WriteTo(output, _map_penetrationGroups_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -229,6 +254,7 @@ namespace Blitzkit { output.WriteRawTag(26); output.WriteMessage(Name); } + penetrationGroups_.WriteTo(ref output, _map_penetrationGroups_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -248,6 +274,7 @@ namespace Blitzkit { if (name_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name); } + size += penetrationGroups_.CalculateSize(_map_penetrationGroups_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -272,6 +299,7 @@ namespace Blitzkit { } Name.MergeFrom(other.Name); } + penetrationGroups_.MergeFrom(other.penetrationGroups_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -306,6 +334,10 @@ namespace Blitzkit { input.ReadMessage(Name); break; } + case 34: { + penetrationGroups_.AddEntriesFrom(input, _map_penetrationGroups_codec); + break; + } } } #endif @@ -340,6 +372,197 @@ namespace Blitzkit { input.ReadMessage(Name); break; } + case 34: { + penetrationGroups_.AddEntriesFrom(ref input, _map_penetrationGroups_codec); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class PenetrationGroup : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PenetrationGroup()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Blitzkit.TankReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PenetrationGroup() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PenetrationGroup(PenetrationGroup other) : this() { + armors_ = other.armors_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PenetrationGroup Clone() { + return new PenetrationGroup(this); + } + + /// Field number for the "armors" field. + public const int ArmorsFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_armors_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForFloat(21, 0F), 10); + private readonly pbc::MapField armors_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField Armors { + get { return armors_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PenetrationGroup); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PenetrationGroup other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Armors.Equals(other.Armors)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= Armors.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + armors_.WriteTo(output, _map_armors_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + armors_.WriteTo(ref output, _map_armors_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += armors_.CalculateSize(_map_armors_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PenetrationGroup other) { + if (other == null) { + return; + } + armors_.MergeFrom(other.armors_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + armors_.AddEntriesFrom(input, _map_armors_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + armors_.AddEntriesFrom(ref input, _map_armors_codec); + break; + } } } }