diff --git a/packages/core/src/protos/i18n.ts b/packages/core/src/protos/i18n.ts index 56812cce5..27894724e 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; } -function createBaseI18n(): I18n { +export 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 70c5a4727..c7a7d6d59 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 } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } from './legacy_i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface CamouflageDefinitions { camouflages: { [key: number]: Camouflage }; @@ -31,15 +31,25 @@ 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) { @@ -50,7 +60,10 @@ 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; } @@ -68,10 +81,12 @@ 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; + }, {}) : {}, }; }, @@ -90,20 +105,23 @@ 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; }, }; @@ -112,90 +130,116 @@ 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = Camouflage.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + Camouflage.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry { - return { - key: globalThis.Number(assertSet("CamouflageDefinitions_CamouflagesEntry.key", object.key)), - value: Camouflage.fromJSON(assertSet("CamouflageDefinitions_CamouflagesEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (message.value !== undefined) { + obj.value = Camouflage.toJSON(message.value); + } + return obj; + }, + + 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; + }, + }; 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); } @@ -206,13 +250,17 @@ 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) { @@ -261,10 +309,14 @@ 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, }; }, @@ -288,37 +340,57 @@ 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 41352715c..2a7d4d4c2 100644 --- a/packages/core/src/protos/legacy_consumable_definitions.ts +++ b/packages/core/src/protos/legacy_consumable_definitions.ts @@ -5,34 +5,42 @@ // source: packages/core/src/protos/legacy_consumable_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { I18nString } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } 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', ); } } @@ -58,10 +66,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; } @@ -87,15 +95,25 @@ 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) { @@ -106,7 +124,10 @@ 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; } @@ -124,10 +145,12 @@ 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; + }, {}) : {}, }; }, @@ -146,20 +169,23 @@ 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; }, }; @@ -168,83 +194,101 @@ 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = Consumable.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + Consumable.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): ConsumableDefinitions_ConsumablesEntry { - return { - key: globalThis.Number(assertSet("ConsumableDefinitions_ConsumablesEntry.key", object.key)), - value: Consumable.fromJSON(assertSet("ConsumableDefinitions_ConsumablesEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (message.value !== undefined) { + obj.value = Consumable.toJSON(message.value); + } + return obj; + }, + + 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; + }, + }; function createBaseConsumable(): Consumable { return { @@ -259,7 +303,10 @@ 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); } @@ -285,7 +332,8 @@ 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) { @@ -336,7 +384,9 @@ export const Consumable: MessageFns = { break; } - message.include.push(ConsumableTankFilter.decode(reader, reader.uint32())); + message.include.push( + ConsumableTankFilter.decode(reader, reader.uint32()), + ); continue; } case 7: { @@ -344,7 +394,9 @@ export const Consumable: MessageFns = { break; } - message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32())); + message.exclude.push( + ConsumableTankFilter.decode(reader, reader.uint32()), + ); continue; } } @@ -358,11 +410,17 @@ 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)) : [], @@ -401,17 +459,22 @@ 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; }, }; @@ -421,26 +484,45 @@ 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) { @@ -451,7 +533,10 @@ 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: { @@ -459,7 +544,10 @@ 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: { @@ -468,7 +556,7 @@ export const ConsumableTankFilter: MessageFns = { } message.filter_type = { - $case: "categories", + $case: 'categories', value: ConsumableTankCategoryFilter.decode(reader, reader.uint32()), }; continue; @@ -478,7 +566,10 @@ 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; } } @@ -493,70 +584,98 @@ 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?.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?.$case === 'tiers' && object.filter_type?.value !== undefined && object.filter_type?.value !== null ) { message.filter_type = { - $case: "categories", - value: ConsumableTankCategoryFilter.fromPartial(object.filter_type.value), + $case: 'tiers', + value: ConsumableTankTierFilter.fromPartial(object.filter_type.value), }; } if ( - object.filter_type?.$case === "nations" && + object.filter_type?.$case === 'ids' && object.filter_type?.value !== undefined && object.filter_type?.value !== null ) { message.filter_type = { - $case: "nations", + $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', value: ConsumableTankNationFilter.fromPartial(object.filter_type.value), }; } @@ -569,7 +688,10 @@ 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); } @@ -579,8 +701,12 @@ 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) { @@ -613,8 +739,12 @@ 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), + ), }; }, @@ -629,10 +759,14 @@ 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; @@ -645,7 +779,10 @@ 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); @@ -654,8 +791,12 @@ 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) { @@ -689,7 +830,11 @@ 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 { @@ -700,10 +845,14 @@ 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; @@ -714,151 +863,196 @@ 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); - - continue; - } - - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { + 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; } - continue; - } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.categories.push(reader.int32() as any); + } + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { break; } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + 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), + ); } - reader.skip(tag & 7); - } - return message; - }, + return obj; + }, - 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; - }, -}; + 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; + 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; } - - message.nations.push(reader.string()); - continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + 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; } - reader.skip(tag & 7); - } - return message; - }, + return obj; + }, - fromJSON(object: any): ConsumableTankNationFilter { - return { - nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [], - }; - }, + 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; + }, + }; - toJSON(message: ConsumableTankNationFilter): unknown { - const obj: any = {}; - if (message.nations?.length) { - obj.nations = message.nations; - } - return obj; - }, +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; - 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; +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 18276dc7d..7710298fa 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 } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } from './legacy_i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface EquipmentDefinitions { presets: { [key: string]: EquipmentPreset }; @@ -44,18 +44,31 @@ 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) { @@ -66,7 +79,10 @@ 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; } @@ -77,7 +93,10 @@ 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; } @@ -95,16 +114,20 @@ 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; + }, {}) : {}, }; }, @@ -132,203 +155,236 @@ 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = EquipmentPreset.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + EquipmentPreset.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): EquipmentDefinitions_PresetsEntry { - return { - key: globalThis.String(assertSet("EquipmentDefinitions_PresetsEntry.key", object.key)), - value: EquipmentPreset.fromJSON(assertSet("EquipmentDefinitions_PresetsEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (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 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; + }, + }; 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = Equipment.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + Equipment.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry { - return { - key: globalThis.Number(assertSet("EquipmentDefinitions_EquipmentsEntry.key", object.key)), - value: Equipment.fromJSON(assertSet("EquipmentDefinitions_EquipmentsEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (message.value !== undefined) { + obj.value = Equipment.toJSON(message.value); + } + return obj; + }, + + 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; + }, + }; 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(); } @@ -339,7 +395,8 @@ 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) { @@ -372,8 +429,10 @@ 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), + ), }; }, @@ -391,14 +450,18 @@ 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; }, }; @@ -408,7 +471,10 @@ 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(); } @@ -416,7 +482,8 @@ 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) { @@ -441,7 +508,9 @@ 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)) + : [], }; }, @@ -453,12 +522,17 @@ 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; }, }; @@ -468,7 +542,10 @@ 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); } @@ -479,7 +556,8 @@ 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) { @@ -512,8 +590,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)), }; }, @@ -528,10 +606,14 @@ 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; @@ -539,21 +621,36 @@ 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 17b87dea1..2dfd0287c 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 } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } from './legacy_i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface GameDefinitions { version: string; @@ -37,28 +37,38 @@ 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) { @@ -85,7 +95,10 @@ 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; } @@ -96,7 +109,10 @@ 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; } @@ -113,26 +129,36 @@ 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) { @@ -159,23 +185,28 @@ 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); } @@ -189,166 +220,201 @@ 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = GameMode.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + GameMode.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): GameDefinitions_GameModesEntry { - return { - key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)), - value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (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 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; + }, + }; 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = GameModeRole.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + GameModeRole.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): GameDefinitions_RolesEntry { - return { - key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)), - value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (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(); } @@ -356,7 +422,8 @@ 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) { @@ -380,7 +447,9 @@ 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 { @@ -396,9 +465,10 @@ 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; }, }; @@ -408,7 +478,10 @@ 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); @@ -423,7 +496,8 @@ 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) { @@ -496,10 +570,14 @@ 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) || []; @@ -507,21 +585,36 @@ 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 1faf016f7..bc7203097 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; } -function createBaseI18nString(): I18nString { +export 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 c09dc4584..12f2b06d1 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 } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } from './legacy_i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface MapDefinitions { maps: { [key: number]: MapDefinition }; @@ -29,15 +29,22 @@ 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) { @@ -48,7 +55,10 @@ 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; } @@ -66,10 +76,13 @@ 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; + }, + {}, + ) : {}, }; }, @@ -88,12 +101,18 @@ 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); } @@ -108,7 +127,10 @@ 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); } @@ -118,8 +140,12 @@ 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) { @@ -152,8 +178,12 @@ 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), + ), }; }, @@ -168,15 +198,20 @@ 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; }, }; @@ -186,7 +221,10 @@ 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); } @@ -197,7 +235,8 @@ 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) { @@ -230,8 +269,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)), }; }, @@ -246,34 +285,54 @@ 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 0eb58ec25..85373ce2e 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 } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { ConsumableTankFilter } from './legacy_consumable_definitions'; +import { I18nString, createBaseI18nString } from './legacy_i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface ProvisionDefinitions { provisions: { [key: number]: Provision }; @@ -34,15 +34,25 @@ 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) { @@ -53,7 +63,10 @@ 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; } @@ -71,10 +84,12 @@ 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; + }, {}) : {}, }; }, @@ -93,20 +108,23 @@ 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; }, }; @@ -115,90 +133,115 @@ 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; - }, - - 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; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = Provision.decode(reader, reader.uint32()); - continue; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + Provision.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry { - return { - key: globalThis.Number(assertSet("ProvisionDefinitions_ProvisionsEntry.key", object.key)), - value: Provision.fromJSON(assertSet("ProvisionDefinitions_ProvisionsEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 (message.value !== undefined) { + obj.value = Provision.toJSON(message.value); + } + return obj; + }, + + 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; + }, + }; 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); } @@ -221,7 +264,8 @@ 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) { @@ -264,7 +308,9 @@ export const Provision: MessageFns = { break; } - message.include.push(ConsumableTankFilter.decode(reader, reader.uint32())); + message.include.push( + ConsumableTankFilter.decode(reader, reader.uint32()), + ); continue; } case 7: { @@ -272,7 +318,9 @@ export const Provision: MessageFns = { break; } - message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32())); + message.exclude.push( + ConsumableTankFilter.decode(reader, reader.uint32()), + ); continue; } } @@ -286,10 +334,12 @@ 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)) : [], @@ -325,35 +375,55 @@ 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 ff622dff0..7b87174b5 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 } from "./legacy_i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString, createBaseI18nString } from './legacy_i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export enum TankPriceType { CREDITS = 0, @@ -18,24 +18,28 @@ export enum TankPriceType { export function tankPriceTypeFromJSON(object: any): TankPriceType { switch (object) { case 0: - case "TANK_PRICE_TYPE_CREDITS": + case 'TANK_PRICE_TYPE_CREDITS': return TankPriceType.CREDITS; case 1: - case "TANK_PRICE_TYPE_GOLD": + case 'TANK_PRICE_TYPE_GOLD': return TankPriceType.GOLD; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankPriceType', + ); } } export function tankPriceTypeToJSON(object: TankPriceType): string { switch (object) { case TankPriceType.CREDITS: - return "TANK_PRICE_TYPE_CREDITS"; + return 'TANK_PRICE_TYPE_CREDITS'; case TankPriceType.GOLD: - return "TANK_PRICE_TYPE_GOLD"; + return 'TANK_PRICE_TYPE_GOLD'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankPriceType', + ); } } @@ -49,34 +53,38 @@ export enum ShellType { export function shellTypeFromJSON(object: any): ShellType { switch (object) { case 0: - case "SHELL_TYPE_AP": + case 'SHELL_TYPE_AP': return ShellType.AP; case 1: - case "SHELL_TYPE_APCR": + case 'SHELL_TYPE_APCR': return ShellType.APCR; case 2: - case "SHELL_TYPE_HEAT": + case 'SHELL_TYPE_HEAT': return ShellType.HEAT; case 3: - case "SHELL_TYPE_HE": + case 'SHELL_TYPE_HE': return ShellType.HE; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ShellType', + ); } } export function shellTypeToJSON(object: ShellType): string { switch (object) { case ShellType.AP: - return "SHELL_TYPE_AP"; + return 'SHELL_TYPE_AP'; case ShellType.APCR: - return "SHELL_TYPE_APCR"; + return 'SHELL_TYPE_APCR'; case ShellType.HEAT: - return "SHELL_TYPE_HEAT"; + return 'SHELL_TYPE_HEAT'; case ShellType.HE: - return "SHELL_TYPE_HE"; + return 'SHELL_TYPE_HE'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ShellType', + ); } } @@ -91,39 +99,43 @@ export enum ModuleType { export function moduleTypeFromJSON(object: any): ModuleType { switch (object) { case 0: - case "MODULE_TYPE_VEHICLE": + case 'MODULE_TYPE_VEHICLE': return ModuleType.VEHICLE; case 1: - case "MODULE_TYPE_ENGINE": + case 'MODULE_TYPE_ENGINE': return ModuleType.ENGINE; case 2: - case "MODULE_TYPE_TRACKS": + case 'MODULE_TYPE_TRACKS': return ModuleType.TRACKS; case 3: - case "MODULE_TYPE_TURRET": + case 'MODULE_TYPE_TURRET': return ModuleType.TURRET; case 4: - case "MODULE_TYPE_GUN": + case 'MODULE_TYPE_GUN': return ModuleType.GUN; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ModuleType', + ); } } export function moduleTypeToJSON(object: ModuleType): string { switch (object) { case ModuleType.VEHICLE: - return "MODULE_TYPE_VEHICLE"; + return 'MODULE_TYPE_VEHICLE'; case ModuleType.ENGINE: - return "MODULE_TYPE_ENGINE"; + return 'MODULE_TYPE_ENGINE'; case ModuleType.TRACKS: - return "MODULE_TYPE_TRACKS"; + return 'MODULE_TYPE_TRACKS'; case ModuleType.TURRET: - return "MODULE_TYPE_TURRET"; + return 'MODULE_TYPE_TURRET'; case ModuleType.GUN: - return "MODULE_TYPE_GUN"; + return 'MODULE_TYPE_GUN'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ModuleType', + ); } } @@ -137,34 +149,38 @@ export enum TankClass { export function tankClassFromJSON(object: any): TankClass { switch (object) { case 0: - case "TANK_CLASS_LIGHT": + case 'TANK_CLASS_LIGHT': return TankClass.LIGHT; case 1: - case "TANK_CLASS_MEDIUM": + case 'TANK_CLASS_MEDIUM': return TankClass.MEDIUM; case 2: - case "TANK_CLASS_HEAVY": + case 'TANK_CLASS_HEAVY': return TankClass.HEAVY; case 3: - case "TANK_CLASS_TANK_DESTROYER": + case 'TANK_CLASS_TANK_DESTROYER': return TankClass.TANK_DESTROYER; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankClass', + ); } } export function tankClassToJSON(object: TankClass): string { switch (object) { case TankClass.LIGHT: - return "TANK_CLASS_LIGHT"; + return 'TANK_CLASS_LIGHT'; case TankClass.MEDIUM: - return "TANK_CLASS_MEDIUM"; + return 'TANK_CLASS_MEDIUM'; case TankClass.HEAVY: - return "TANK_CLASS_HEAVY"; + return 'TANK_CLASS_HEAVY'; case TankClass.TANK_DESTROYER: - return "TANK_CLASS_TANK_DESTROYER"; + return 'TANK_CLASS_TANK_DESTROYER'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankClass', + ); } } @@ -177,29 +193,33 @@ export enum TankType { export function tankTypeFromJSON(object: any): TankType { switch (object) { case 0: - case "TANK_TYPE_RESEARCHABLE": + case 'TANK_TYPE_RESEARCHABLE': return TankType.RESEARCHABLE; case 1: - case "TANK_TYPE_PREMIUM": + case 'TANK_TYPE_PREMIUM': return TankType.PREMIUM; case 2: - case "TANK_TYPE_COLLECTOR": + case 'TANK_TYPE_COLLECTOR': return TankType.COLLECTOR; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankType', + ); } } export function tankTypeToJSON(object: TankType): string { switch (object) { case TankType.RESEARCHABLE: - return "TANK_TYPE_RESEARCHABLE"; + return 'TANK_TYPE_RESEARCHABLE'; case TankType.PREMIUM: - return "TANK_TYPE_PREMIUM"; + return 'TANK_TYPE_PREMIUM'; case TankType.COLLECTOR: - return "TANK_TYPE_COLLECTOR"; + return 'TANK_TYPE_COLLECTOR'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankType', + ); } } @@ -214,39 +234,43 @@ export enum CrewType { export function crewTypeFromJSON(object: any): CrewType { switch (object) { case 0: - case "CREW_TYPE_COMMANDER": + case 'CREW_TYPE_COMMANDER': return CrewType.COMMANDER; case 1: - case "CREW_TYPE_RADIOMAN": + case 'CREW_TYPE_RADIOMAN': return CrewType.RADIOMAN; case 2: - case "CREW_TYPE_GUNNER": + case 'CREW_TYPE_GUNNER': return CrewType.GUNNER; case 3: - case "CREW_TYPE_DRIVER": + case 'CREW_TYPE_DRIVER': return CrewType.DRIVER; case 4: - case "CREW_TYPE_LOADER": + case 'CREW_TYPE_LOADER': return CrewType.LOADER; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum CrewType', + ); } } export function crewTypeToJSON(object: CrewType): string { switch (object) { case CrewType.COMMANDER: - return "CREW_TYPE_COMMANDER"; + return 'CREW_TYPE_COMMANDER'; case CrewType.RADIOMAN: - return "CREW_TYPE_RADIOMAN"; + return 'CREW_TYPE_RADIOMAN'; case CrewType.GUNNER: - return "CREW_TYPE_GUNNER"; + return 'CREW_TYPE_GUNNER'; case CrewType.DRIVER: - return "CREW_TYPE_DRIVER"; + return 'CREW_TYPE_DRIVER'; case CrewType.LOADER: - return "CREW_TYPE_LOADER"; + return 'CREW_TYPE_LOADER'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum CrewType', + ); } } @@ -299,8 +323,8 @@ export interface TankDefinition_RolesEntry { export interface ResearchCost { research_cost_type?: - | { $case: "xp"; value: number } - | { $case: "seasonal_tokens"; value: ResearchCostSeasonalTokens } + | { $case: 'xp'; value: number } + | { $case: 'seasonal_tokens'; value: ResearchCostSeasonalTokens } | undefined; } @@ -355,9 +379,9 @@ export interface TurretDefinition { export interface GunDefinition { gun_type?: - | { $case: "regular"; value: GunDefinitionRegular } - | { $case: "auto_loader"; value: GunDefinitionAutoLoader } - | { $case: "auto_reloader"; value: GunDefinitionAutoReloader } + | { $case: 'regular'; value: GunDefinitionRegular } + | { $case: 'auto_loader'; value: GunDefinitionAutoLoader } + | { $case: 'auto_reloader'; value: GunDefinitionAutoReloader } | undefined; } @@ -453,15 +477,22 @@ function createBaseTankDefinitions(): TankDefinitions { } export const TankDefinitions: MessageFns = { - encode(message: TankDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankDefinitions, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { Object.entries(message.tanks).forEach(([key, value]) => { - TankDefinitions_TanksEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + TankDefinitions_TanksEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork(), + ).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTankDefinitions(); while (reader.pos < end) { @@ -472,7 +503,10 @@ export const TankDefinitions: MessageFns = { break; } - const entry1 = TankDefinitions_TanksEntry.decode(reader, reader.uint32()); + const entry1 = TankDefinitions_TanksEntry.decode( + reader, + reader.uint32(), + ); if (entry1.value !== undefined) { message.tanks[entry1.key] = entry1.value; } @@ -490,10 +524,12 @@ export const TankDefinitions: MessageFns = { fromJSON(object: any): TankDefinitions { return { tanks: isObject(object.tanks) - ? Object.entries(object.tanks).reduce<{ [key: number]: TankDefinition }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = TankDefinition.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.tanks).reduce<{ + [key: number]: TankDefinition; + }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = TankDefinition.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -512,20 +548,23 @@ export const TankDefinitions: MessageFns = { return obj; }, - create, I>>(base?: I): TankDefinitions { + create, I>>( + base?: I, + ): TankDefinitions { return TankDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TankDefinitions { + fromPartial, I>>( + object: I, + ): TankDefinitions { const message = createBaseTankDefinitions(); - message.tanks = Object.entries(object.tanks ?? {}).reduce<{ [key: number]: TankDefinition }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = TankDefinition.fromPartial(value); - } - return acc; - }, - {}, - ); + message.tanks = Object.entries(object.tanks ?? {}).reduce<{ + [key: number]: TankDefinition; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = TankDefinition.fromPartial(value); + } + return acc; + }, {}); return message; }, }; @@ -534,79 +573,96 @@ function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry { return { key: 0, value: createBaseTankDefinition() }; } -export const TankDefinitions_TanksEntry: MessageFns = { - encode(message: TankDefinitions_TanksEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - TankDefinition.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions_TanksEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTankDefinitions_TanksEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = TankDefinition.decode(reader, reader.uint32()); - continue; - } +export const TankDefinitions_TanksEntry: MessageFns = + { + encode( + message: TankDefinitions_TanksEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + TankDefinition.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinitions_TanksEntry { - return { - key: globalThis.Number(assertSet("TankDefinitions_TanksEntry.key", object.key)), - value: TankDefinition.fromJSON(assertSet("TankDefinitions_TanksEntry.value", object.value)), - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TankDefinitions_TanksEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTankDefinitions_TanksEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } - toJSON(message: TankDefinitions_TanksEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); - } - if (message.value !== undefined) { - obj.value = TankDefinition.toJSON(message.value); - } - return obj; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - create, I>>(base?: I): TankDefinitions_TanksEntry { - return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): TankDefinitions_TanksEntry { - const message = createBaseTankDefinitions_TanksEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TankDefinition.fromPartial(object.value) - : undefined; - return message; - }, -}; + message.value = TankDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankDefinitions_TanksEntry { + return { + key: globalThis.Number( + assertSet('TankDefinitions_TanksEntry.key', object.key), + ), + value: TankDefinition.fromJSON( + assertSet('TankDefinitions_TanksEntry.value', object.value), + ), + }; + }, + + toJSON(message: TankDefinitions_TanksEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = TankDefinition.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): TankDefinitions_TanksEntry { + return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TankDefinitions_TanksEntry { + const message = createBaseTankDefinitions_TanksEntry(); + message.key = object.key ?? 0; + message.value = + object.value !== undefined && object.value !== null + ? TankDefinition.fromPartial(object.value) + : undefined; + return message; + }, + }; function createBaseTankDefinition(): TankDefinition { return { @@ -618,7 +674,7 @@ function createBaseTankDefinition(): TankDefinition { successors: [], crew: [], health: 0, - nation: "", + nation: '', name: createBaseI18nString(), name_full: undefined, type: 0, @@ -638,18 +694,24 @@ 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); @@ -675,7 +737,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) { @@ -718,7 +780,10 @@ export const TankDefinition: MessageFns = { TankPrice.encode(message.price, writer.uint32(186).fork()).join(); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(194).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(194).fork(), + ).join(); } if (message.speed_forwards !== 0) { writer.uint32(205).float(message.speed_forwards); @@ -735,7 +800,7 @@ export const TankDefinition: MessageFns = { if (message.camouflage_onFire !== 0) { writer.uint32(237).float(message.camouflage_onFire); } - if (message.equipment_preset !== "") { + if (message.equipment_preset !== '') { writer.uint32(242).string(message.equipment_preset); } if (message.weight !== 0) { @@ -745,7 +810,8 @@ export const TankDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTankDefinition(); while (reader.pos < end) { @@ -764,7 +830,10 @@ 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; } @@ -933,7 +1002,9 @@ export const TankDefinition: MessageFns = { break; } - message.turrets.push(TurretDefinition.decode(reader, reader.uint32())); + message.turrets.push( + TurretDefinition.decode(reader, reader.uint32()), + ); continue; } case 21: { @@ -941,7 +1012,9 @@ export const TankDefinition: MessageFns = { break; } - message.engines.push(EngineDefinition.decode(reader, reader.uint32())); + message.engines.push( + EngineDefinition.decode(reader, reader.uint32()), + ); continue; } case 22: { @@ -1035,14 +1108,19 @@ 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)) : [], @@ -1052,18 +1130,34 @@ 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)) : [], @@ -1073,15 +1167,33 @@ export const TankDefinition: MessageFns = { tracks: globalThis.Array.isArray(object?.tracks) ? object.tracks.map((e: any) => TrackDefinition.fromJSON(e)) : [], - price: TankPrice.fromJSON(assertSet("TankDefinition.price", object.price)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - speed_forwards: globalThis.Number(assertSet("TankDefinition.speed_forwards", object.speed_forwards)), - speed_backwards: globalThis.Number(assertSet("TankDefinition.speed_backwards", object.speed_backwards)), - camouflage_still: globalThis.Number(assertSet("TankDefinition.camouflage_still", object.camouflage_still)), - camouflage_moving: globalThis.Number(assertSet("TankDefinition.camouflage_moving", object.camouflage_moving)), - camouflage_onFire: globalThis.Number(assertSet("TankDefinition.camouflage_onFire", object.camouflage_onFire)), - equipment_preset: globalThis.String(assertSet("TankDefinition.equipment_preset", object.equipment_preset)), - weight: globalThis.Number(assertSet("TankDefinition.weight", object.weight)), + price: TankPrice.fromJSON( + assertSet('TankDefinition.price', object.price), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + speed_forwards: globalThis.Number( + assertSet('TankDefinition.speed_forwards', object.speed_forwards), + ), + speed_backwards: globalThis.Number( + assertSet('TankDefinition.speed_backwards', object.speed_backwards), + ), + camouflage_still: globalThis.Number( + assertSet('TankDefinition.camouflage_still', object.camouflage_still), + ), + camouflage_moving: globalThis.Number( + assertSet('TankDefinition.camouflage_moving', object.camouflage_moving), + ), + camouflage_onFire: globalThis.Number( + assertSet('TankDefinition.camouflage_onFire', object.camouflage_onFire), + ), + equipment_preset: globalThis.String( + assertSet('TankDefinition.equipment_preset', object.equipment_preset), + ), + weight: globalThis.Number( + assertSet('TankDefinition.weight', object.weight), + ), }; }, @@ -1117,7 +1229,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) { @@ -1177,7 +1289,7 @@ export const TankDefinition: MessageFns = { if (message.camouflage_onFire !== 0) { obj.camouflage_onFire = message.camouflage_onFire; } - if (message.equipment_preset !== "") { + if (message.equipment_preset !== '') { obj.equipment_preset = message.equipment_preset; } if (message.weight !== 0) { @@ -1186,13 +1298,19 @@ 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); } @@ -1204,13 +1322,15 @@ 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; @@ -1218,21 +1338,26 @@ export const TankDefinition: MessageFns = { message.class = object.class ?? 0; message.testing = object.testing ?? false; message.deprecated = object.deprecated ?? false; - message.turrets = object.turrets?.map((e) => TurretDefinition.fromPartial(e)) || []; - message.engines = object.engines?.map((e) => EngineDefinition.fromPartial(e)) || []; - message.tracks = object.tracks?.map((e) => TrackDefinition.fromPartial(e)) || []; - message.price = (object.price !== undefined && object.price !== null) - ? TankPrice.fromPartial(object.price) - : createBaseTankPrice(); - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.turrets = + object.turrets?.map((e) => TurretDefinition.fromPartial(e)) || []; + message.engines = + object.engines?.map((e) => EngineDefinition.fromPartial(e)) || []; + message.tracks = + object.tracks?.map((e) => TrackDefinition.fromPartial(e)) || []; + message.price = + object.price !== undefined && object.price !== null + ? TankPrice.fromPartial(object.price) + : createBaseTankPrice(); + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.speed_forwards = object.speed_forwards ?? 0; message.speed_backwards = object.speed_backwards ?? 0; message.camouflage_still = object.camouflage_still ?? 0; message.camouflage_moving = object.camouflage_moving ?? 0; message.camouflage_onFire = object.camouflage_onFire ?? 0; - message.equipment_preset = object.equipment_preset ?? ""; + message.equipment_preset = object.equipment_preset ?? ''; message.weight = object.weight ?? 0; return message; }, @@ -1242,97 +1367,120 @@ function createBaseTankDefinition_RolesEntry(): TankDefinition_RolesEntry { return { key: 0, value: 0 }; } -export const TankDefinition_RolesEntry: MessageFns = { - encode(message: TankDefinition_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - writer.uint32(16).uint32(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition_RolesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTankDefinition_RolesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.value = reader.uint32(); - continue; - } +export const TankDefinition_RolesEntry: MessageFns = + { + encode( + message: TankDefinition_RolesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + writer.uint32(16).uint32(message.value); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinition_RolesEntry { - return { - key: globalThis.Number(assertSet("TankDefinition_RolesEntry.key", object.key)), - value: globalThis.Number(assertSet("TankDefinition_RolesEntry.value", object.value)), - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TankDefinition_RolesEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTankDefinition_RolesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } - toJSON(message: TankDefinition_RolesEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = Math.round(message.key); - } - if (message.value !== undefined) { - obj.value = Math.round(message.value); - } - return obj; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } - create, I>>(base?: I): TankDefinition_RolesEntry { - return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): TankDefinition_RolesEntry { - const message = createBaseTankDefinition_RolesEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? 0; - return message; - }, -}; + message.value = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankDefinition_RolesEntry { + return { + key: globalThis.Number( + assertSet('TankDefinition_RolesEntry.key', object.key), + ), + value: globalThis.Number( + assertSet('TankDefinition_RolesEntry.value', object.value), + ), + }; + }, + + toJSON(message: TankDefinition_RolesEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = Math.round(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): TankDefinition_RolesEntry { + return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): TankDefinition_RolesEntry { + const message = createBaseTankDefinition_RolesEntry(); + message.key = object.key ?? 0; + message.value = object.value ?? 0; + return message; + }, + }; function createBaseResearchCost(): ResearchCost { return { research_cost_type: undefined }; } export const ResearchCost: MessageFns = { - encode(message: ResearchCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ResearchCost, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { switch (message.research_cost_type?.$case) { - case "xp": + case 'xp': writer.uint32(8).uint32(message.research_cost_type.value); break; - case "seasonal_tokens": - ResearchCostSeasonalTokens.encode(message.research_cost_type.value, writer.uint32(18).fork()).join(); + case 'seasonal_tokens': + ResearchCostSeasonalTokens.encode( + message.research_cost_type.value, + writer.uint32(18).fork(), + ).join(); break; } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ResearchCost { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseResearchCost(); while (reader.pos < end) { @@ -1343,7 +1491,7 @@ export const ResearchCost: MessageFns = { break; } - message.research_cost_type = { $case: "xp", value: reader.uint32() }; + message.research_cost_type = { $case: 'xp', value: reader.uint32() }; continue; } case 2: { @@ -1352,7 +1500,7 @@ export const ResearchCost: MessageFns = { } message.research_cost_type = { - $case: "seasonal_tokens", + $case: 'seasonal_tokens', value: ResearchCostSeasonalTokens.decode(reader, reader.uint32()), }; continue; @@ -1369,44 +1517,60 @@ export const ResearchCost: MessageFns = { fromJSON(object: any): ResearchCost { return { research_cost_type: isSet(object.xp) - ? { $case: "xp", value: globalThis.Number(object.xp) } + ? { $case: 'xp', value: globalThis.Number(object.xp) } : isSet(object.seasonal_tokens) - ? { $case: "seasonal_tokens", value: ResearchCostSeasonalTokens.fromJSON(object.seasonal_tokens) } - : undefined, + ? { + $case: 'seasonal_tokens', + value: ResearchCostSeasonalTokens.fromJSON( + object.seasonal_tokens, + ), + } + : undefined, }; }, toJSON(message: ResearchCost): unknown { const obj: any = {}; - if (message.research_cost_type?.$case === "xp") { + if (message.research_cost_type?.$case === 'xp') { obj.xp = Math.round(message.research_cost_type.value); } - if (message.research_cost_type?.$case === "seasonal_tokens") { - obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON(message.research_cost_type.value); + if (message.research_cost_type?.$case === 'seasonal_tokens') { + obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON( + message.research_cost_type.value, + ); } return obj; }, - create, I>>(base?: I): ResearchCost { + create, I>>( + base?: I, + ): ResearchCost { return ResearchCost.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ResearchCost { + fromPartial, I>>( + object: I, + ): ResearchCost { const message = createBaseResearchCost(); if ( - object.research_cost_type?.$case === "xp" && - object.research_cost_type?.value !== undefined && - object.research_cost_type?.value !== null - ) { - message.research_cost_type = { $case: "xp", value: object.research_cost_type.value }; - } - if ( - object.research_cost_type?.$case === "seasonal_tokens" && + object.research_cost_type?.$case === 'xp' && object.research_cost_type?.value !== undefined && object.research_cost_type?.value !== null ) { message.research_cost_type = { - $case: "seasonal_tokens", - value: ResearchCostSeasonalTokens.fromPartial(object.research_cost_type.value), + $case: 'xp', + value: object.research_cost_type.value, + }; + } + if ( + object.research_cost_type?.$case === 'seasonal_tokens' && + object.research_cost_type?.value !== undefined && + object.research_cost_type?.value !== null + ) { + message.research_cost_type = { + $case: 'seasonal_tokens', + value: ResearchCostSeasonalTokens.fromPartial( + object.research_cost_type.value, + ), }; } return message; @@ -1417,84 +1581,103 @@ function createBaseResearchCostSeasonalTokens(): ResearchCostSeasonalTokens { return { season: 0, tokens: 0 }; } -export const ResearchCostSeasonalTokens: MessageFns = { - encode(message: ResearchCostSeasonalTokens, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.season !== 0) { - writer.uint32(8).uint32(message.season); - } - if (message.tokens !== 0) { - writer.uint32(16).uint32(message.tokens); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ResearchCostSeasonalTokens { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResearchCostSeasonalTokens(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.season = reader.uint32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.tokens = reader.uint32(); - continue; - } +export const ResearchCostSeasonalTokens: MessageFns = + { + encode( + message: ResearchCostSeasonalTokens, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.season !== 0) { + writer.uint32(8).uint32(message.season); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.tokens !== 0) { + writer.uint32(16).uint32(message.tokens); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): ResearchCostSeasonalTokens { - return { - season: globalThis.Number(assertSet("ResearchCostSeasonalTokens.season", object.season)), - tokens: globalThis.Number(assertSet("ResearchCostSeasonalTokens.tokens", object.tokens)), - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ResearchCostSeasonalTokens { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResearchCostSeasonalTokens(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } - toJSON(message: ResearchCostSeasonalTokens): unknown { - const obj: any = {}; - if (message.season !== 0) { - obj.season = Math.round(message.season); - } - if (message.tokens !== 0) { - obj.tokens = Math.round(message.tokens); - } - return obj; - }, + message.season = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } - create, I>>(base?: I): ResearchCostSeasonalTokens { - return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): ResearchCostSeasonalTokens { - const message = createBaseResearchCostSeasonalTokens(); - message.season = object.season ?? 0; - message.tokens = object.tokens ?? 0; - return message; - }, -}; + message.tokens = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResearchCostSeasonalTokens { + return { + season: globalThis.Number( + assertSet('ResearchCostSeasonalTokens.season', object.season), + ), + tokens: globalThis.Number( + assertSet('ResearchCostSeasonalTokens.tokens', object.tokens), + ), + }; + }, + + toJSON(message: ResearchCostSeasonalTokens): unknown { + const obj: any = {}; + if (message.season !== 0) { + obj.season = Math.round(message.season); + } + if (message.tokens !== 0) { + obj.tokens = Math.round(message.tokens); + } + return obj; + }, + + create, I>>( + base?: I, + ): ResearchCostSeasonalTokens { + return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ResearchCostSeasonalTokens { + const message = createBaseResearchCostSeasonalTokens(); + message.season = object.season ?? 0; + message.tokens = object.tokens ?? 0; + return message; + }, + }; function createBaseTankPrice(): TankPrice { return { type: 0, value: 0 }; } export const TankPrice: MessageFns = { - encode(message: TankPrice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankPrice, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } @@ -1505,7 +1688,8 @@ export const TankPrice: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TankPrice { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTankPrice(); while (reader.pos < end) { @@ -1538,8 +1722,8 @@ export const TankPrice: MessageFns = { fromJSON(object: any): TankPrice { return { - type: tankPriceTypeFromJSON(assertSet("TankPrice.type", object.type)), - value: globalThis.Number(assertSet("TankPrice.value", object.value)), + type: tankPriceTypeFromJSON(assertSet('TankPrice.type', object.type)), + value: globalThis.Number(assertSet('TankPrice.value', object.value)), }; }, @@ -1557,7 +1741,9 @@ export const TankPrice: MessageFns = { create, I>>(base?: I): TankPrice { return TankPrice.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TankPrice { + fromPartial, I>>( + object: I, + ): TankPrice { const message = createBaseTankPrice(); message.type = object.type ?? 0; message.value = object.value ?? 0; @@ -1583,7 +1769,10 @@ function createBaseTrackDefinition(): TrackDefinition { } export const TrackDefinition: MessageFns = { - encode(message: TrackDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TrackDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -1600,7 +1789,10 @@ export const TrackDefinition: MessageFns = { writer.uint32(45).float(message.traverse_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(50).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(50).fork(), + ).join(); } if (message.dispersion_move !== 0) { writer.uint32(61).float(message.dispersion_move); @@ -1624,7 +1816,8 @@ export const TrackDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TrackDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTrackDefinition(); while (reader.pos < end) { @@ -1737,20 +1930,42 @@ export const TrackDefinition: MessageFns = { fromJSON(object: any): TrackDefinition { return { - id: globalThis.Number(assertSet("TrackDefinition.id", object.id)), - tier: globalThis.Number(assertSet("TrackDefinition.tier", object.tier)), - name: I18nString.fromJSON(assertSet("TrackDefinition.name", object.name)), - weight: globalThis.Number(assertSet("TrackDefinition.weight", object.weight)), - traverse_speed: globalThis.Number(assertSet("TrackDefinition.traverse_speed", object.traverse_speed)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - dispersion_move: globalThis.Number(assertSet("TrackDefinition.dispersion_move", object.dispersion_move)), - dispersion_traverse: globalThis.Number( - assertSet("TrackDefinition.dispersion_traverse", object.dispersion_traverse), + id: globalThis.Number(assertSet('TrackDefinition.id', object.id)), + tier: globalThis.Number(assertSet('TrackDefinition.tier', object.tier)), + name: I18nString.fromJSON(assertSet('TrackDefinition.name', object.name)), + weight: globalThis.Number( + assertSet('TrackDefinition.weight', object.weight), ), - resistance_hard: globalThis.Number(assertSet("TrackDefinition.resistance_hard", object.resistance_hard)), - resistance_medium: globalThis.Number(assertSet("TrackDefinition.resistance_medium", object.resistance_medium)), - resistance_soft: globalThis.Number(assertSet("TrackDefinition.resistance_soft", object.resistance_soft)), - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + traverse_speed: globalThis.Number( + assertSet('TrackDefinition.traverse_speed', object.traverse_speed), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + dispersion_move: globalThis.Number( + assertSet('TrackDefinition.dispersion_move', object.dispersion_move), + ), + dispersion_traverse: globalThis.Number( + assertSet( + 'TrackDefinition.dispersion_traverse', + object.dispersion_traverse, + ), + ), + resistance_hard: globalThis.Number( + assertSet('TrackDefinition.resistance_hard', object.resistance_hard), + ), + resistance_medium: globalThis.Number( + assertSet( + 'TrackDefinition.resistance_medium', + object.resistance_medium, + ), + ), + resistance_soft: globalThis.Number( + assertSet('TrackDefinition.resistance_soft', object.resistance_soft), + ), + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1795,21 +2010,27 @@ export const TrackDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): TrackDefinition { + create, I>>( + base?: I, + ): TrackDefinition { return TrackDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TrackDefinition { + fromPartial, I>>( + object: I, + ): TrackDefinition { const message = createBaseTrackDefinition(); message.id = object.id ?? 0; message.tier = object.tier ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); message.weight = object.weight ?? 0; message.traverse_speed = object.traverse_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.dispersion_move = object.dispersion_move ?? 0; message.dispersion_traverse = object.dispersion_traverse ?? 0; message.resistance_hard = object.resistance_hard ?? 0; @@ -1834,7 +2055,10 @@ function createBaseEngineDefinition(): EngineDefinition { } export const EngineDefinition: MessageFns = { - encode(message: EngineDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: EngineDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -1842,7 +2066,10 @@ export const EngineDefinition: MessageFns = { I18nString.encode(message.name, writer.uint32(18).fork()).join(); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(26).fork(), + ).join(); } if (message.tier !== 0) { writer.uint32(32).uint32(message.tier); @@ -1863,7 +2090,8 @@ export const EngineDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): EngineDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseEngineDefinition(); while (reader.pos < end) { @@ -1944,14 +2172,26 @@ export const EngineDefinition: MessageFns = { fromJSON(object: any): EngineDefinition { return { - id: globalThis.Number(assertSet("EngineDefinition.id", object.id)), - name: I18nString.fromJSON(assertSet("EngineDefinition.name", object.name)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - tier: globalThis.Number(assertSet("EngineDefinition.tier", object.tier)), - fire_chance: globalThis.Number(assertSet("EngineDefinition.fire_chance", object.fire_chance)), - power: globalThis.Number(assertSet("EngineDefinition.power", object.power)), - weight: globalThis.Number(assertSet("EngineDefinition.weight", object.weight)), - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + id: globalThis.Number(assertSet('EngineDefinition.id', object.id)), + name: I18nString.fromJSON( + assertSet('EngineDefinition.name', object.name), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + tier: globalThis.Number(assertSet('EngineDefinition.tier', object.tier)), + fire_chance: globalThis.Number( + assertSet('EngineDefinition.fire_chance', object.fire_chance), + ), + power: globalThis.Number( + assertSet('EngineDefinition.power', object.power), + ), + weight: globalThis.Number( + assertSet('EngineDefinition.weight', object.weight), + ), + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1984,18 +2224,24 @@ export const EngineDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): EngineDefinition { + create, I>>( + base?: I, + ): EngineDefinition { return EngineDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): EngineDefinition { + fromPartial, I>>( + object: I, + ): EngineDefinition { const message = createBaseEngineDefinition(); message.id = object.id ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.tier = object.tier ?? 0; message.fire_chance = object.fire_chance ?? 0; message.power = object.power ?? 0; @@ -2021,7 +2267,10 @@ function createBaseTurretDefinition(): TurretDefinition { } export const TurretDefinition: MessageFns = { - encode(message: TurretDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TurretDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -2035,7 +2284,10 @@ export const TurretDefinition: MessageFns = { writer.uint32(37).float(message.traverse_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(42).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(42).fork(), + ).join(); } if (message.name !== undefined) { I18nString.encode(message.name, writer.uint32(50).fork()).join(); @@ -2056,7 +2308,8 @@ export const TurretDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): TurretDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTurretDefinition(); while (reader.pos < end) { @@ -2153,16 +2406,32 @@ export const TurretDefinition: MessageFns = { fromJSON(object: any): TurretDefinition { return { - id: globalThis.Number(assertSet("TurretDefinition.id", object.id)), - health: globalThis.Number(assertSet("TurretDefinition.health", object.health)), - view_range: globalThis.Number(assertSet("TurretDefinition.view_range", object.view_range)), - traverse_speed: globalThis.Number(assertSet("TurretDefinition.traverse_speed", object.traverse_speed)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - name: I18nString.fromJSON(assertSet("TurretDefinition.name", object.name)), - tier: globalThis.Number(assertSet("TurretDefinition.tier", object.tier)), - weight: globalThis.Number(assertSet("TurretDefinition.weight", object.weight)), - guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [], - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + id: globalThis.Number(assertSet('TurretDefinition.id', object.id)), + health: globalThis.Number( + assertSet('TurretDefinition.health', object.health), + ), + view_range: globalThis.Number( + assertSet('TurretDefinition.view_range', object.view_range), + ), + traverse_speed: globalThis.Number( + assertSet('TurretDefinition.traverse_speed', object.traverse_speed), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + name: I18nString.fromJSON( + assertSet('TurretDefinition.name', object.name), + ), + tier: globalThis.Number(assertSet('TurretDefinition.tier', object.tier)), + weight: globalThis.Number( + assertSet('TurretDefinition.weight', object.weight), + ), + guns: globalThis.Array.isArray(object?.guns) + ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) + : [], + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -2201,21 +2470,27 @@ export const TurretDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): TurretDefinition { + create, I>>( + base?: I, + ): TurretDefinition { return TurretDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TurretDefinition { + fromPartial, I>>( + object: I, + ): TurretDefinition { const message = createBaseTurretDefinition(); message.id = object.id ?? 0; message.health = object.health ?? 0; message.view_range = object.view_range ?? 0; message.traverse_speed = object.traverse_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); message.tier = object.tier ?? 0; message.weight = object.weight ?? 0; message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || []; @@ -2229,23 +2504,36 @@ function createBaseGunDefinition(): GunDefinition { } export const GunDefinition: MessageFns = { - encode(message: GunDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { switch (message.gun_type?.$case) { - case "regular": - GunDefinitionRegular.encode(message.gun_type.value, writer.uint32(10).fork()).join(); + case 'regular': + GunDefinitionRegular.encode( + message.gun_type.value, + writer.uint32(10).fork(), + ).join(); break; - case "auto_loader": - GunDefinitionAutoLoader.encode(message.gun_type.value, writer.uint32(18).fork()).join(); + case 'auto_loader': + GunDefinitionAutoLoader.encode( + message.gun_type.value, + writer.uint32(18).fork(), + ).join(); break; - case "auto_reloader": - GunDefinitionAutoReloader.encode(message.gun_type.value, writer.uint32(26).fork()).join(); + case 'auto_reloader': + GunDefinitionAutoReloader.encode( + message.gun_type.value, + writer.uint32(26).fork(), + ).join(); break; } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GunDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinition(); while (reader.pos < end) { @@ -2256,7 +2544,10 @@ export const GunDefinition: MessageFns = { break; } - message.gun_type = { $case: "regular", value: GunDefinitionRegular.decode(reader, reader.uint32()) }; + message.gun_type = { + $case: 'regular', + value: GunDefinitionRegular.decode(reader, reader.uint32()), + }; continue; } case 2: { @@ -2264,7 +2555,10 @@ export const GunDefinition: MessageFns = { break; } - message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.decode(reader, reader.uint32()) }; + message.gun_type = { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.decode(reader, reader.uint32()), + }; continue; } case 3: { @@ -2273,7 +2567,7 @@ export const GunDefinition: MessageFns = { } message.gun_type = { - $case: "auto_reloader", + $case: 'auto_reloader', value: GunDefinitionAutoReloader.decode(reader, reader.uint32()), }; continue; @@ -2290,53 +2584,76 @@ export const GunDefinition: MessageFns = { fromJSON(object: any): GunDefinition { return { gun_type: isSet(object.regular) - ? { $case: "regular", value: GunDefinitionRegular.fromJSON(object.regular) } + ? { + $case: 'regular', + value: GunDefinitionRegular.fromJSON(object.regular), + } : isSet(object.auto_loader) - ? { $case: "auto_loader", value: GunDefinitionAutoLoader.fromJSON(object.auto_loader) } - : isSet(object.auto_reloader) - ? { $case: "auto_reloader", value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader) } - : undefined, + ? { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.fromJSON(object.auto_loader), + } + : isSet(object.auto_reloader) + ? { + $case: 'auto_reloader', + value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader), + } + : undefined, }; }, toJSON(message: GunDefinition): unknown { const obj: any = {}; - if (message.gun_type?.$case === "regular") { + if (message.gun_type?.$case === 'regular') { obj.regular = GunDefinitionRegular.toJSON(message.gun_type.value); } - if (message.gun_type?.$case === "auto_loader") { + if (message.gun_type?.$case === 'auto_loader') { obj.auto_loader = GunDefinitionAutoLoader.toJSON(message.gun_type.value); } - if (message.gun_type?.$case === "auto_reloader") { - obj.auto_reloader = GunDefinitionAutoReloader.toJSON(message.gun_type.value); + if (message.gun_type?.$case === 'auto_reloader') { + obj.auto_reloader = GunDefinitionAutoReloader.toJSON( + message.gun_type.value, + ); } return obj; }, - create, I>>(base?: I): GunDefinition { + create, I>>( + base?: I, + ): GunDefinition { return GunDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinition { + fromPartial, I>>( + object: I, + ): GunDefinition { const message = createBaseGunDefinition(); if ( - object.gun_type?.$case === "regular" && object.gun_type?.value !== undefined && object.gun_type?.value !== null - ) { - message.gun_type = { $case: "regular", value: GunDefinitionRegular.fromPartial(object.gun_type.value) }; - } - if ( - object.gun_type?.$case === "auto_loader" && - object.gun_type?.value !== undefined && - object.gun_type?.value !== null - ) { - message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value) }; - } - if ( - object.gun_type?.$case === "auto_reloader" && + object.gun_type?.$case === 'regular' && object.gun_type?.value !== undefined && object.gun_type?.value !== null ) { message.gun_type = { - $case: "auto_reloader", + $case: 'regular', + value: GunDefinitionRegular.fromPartial(object.gun_type.value), + }; + } + if ( + object.gun_type?.$case === 'auto_loader' && + object.gun_type?.value !== undefined && + object.gun_type?.value !== null + ) { + message.gun_type = { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value), + }; + } + if ( + object.gun_type?.$case === 'auto_reloader' && + object.gun_type?.value !== undefined && + object.gun_type?.value !== null + ) { + message.gun_type = { + $case: 'auto_reloader', value: GunDefinitionAutoReloader.fromPartial(object.gun_type.value), }; } @@ -2345,22 +2662,35 @@ export const GunDefinition: MessageFns = { }; function createBaseGunDefinitionRegular(): GunDefinitionRegular { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionRegularProperties() }; + return { + base: createBaseGunDefinitionBase(), + extension: createBaseGunDefinitionRegularProperties(), + }; } export const GunDefinitionRegular: MessageFns = { - encode(message: GunDefinitionRegular, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionRegular, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.base !== undefined) { GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } if (message.extension !== undefined) { - GunDefinitionRegularProperties.encode(message.extension, writer.uint32(18).fork()).join(); + GunDefinitionRegularProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegular { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionRegular { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionRegular(); while (reader.pos < end) { @@ -2379,7 +2709,10 @@ export const GunDefinitionRegular: MessageFns = { break; } - message.extension = GunDefinitionRegularProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionRegularProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2393,8 +2726,12 @@ export const GunDefinitionRegular: MessageFns = { fromJSON(object: any): GunDefinitionRegular { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionRegular.base", object.base)), - extension: GunDefinitionRegularProperties.fromJSON(assertSet("GunDefinitionRegular.extension", object.extension)), + base: GunDefinitionBase.fromJSON( + assertSet('GunDefinitionRegular.base', object.base), + ), + extension: GunDefinitionRegularProperties.fromJSON( + assertSet('GunDefinitionRegular.extension', object.extension), + ), }; }, @@ -2409,17 +2746,23 @@ export const GunDefinitionRegular: MessageFns = { return obj; }, - create, I>>(base?: I): GunDefinitionRegular { + create, I>>( + base?: I, + ): GunDefinitionRegular { return GunDefinitionRegular.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinitionRegular { + fromPartial, I>>( + object: I, + ): GunDefinitionRegular { const message = createBaseGunDefinitionRegular(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : createBaseGunDefinitionBase(); - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionRegularProperties.fromPartial(object.extension) - : createBaseGunDefinitionRegularProperties(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : createBaseGunDefinitionBase(); + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionRegularProperties.fromPartial(object.extension) + : createBaseGunDefinitionRegularProperties(); return message; }, }; @@ -2428,79 +2771,106 @@ function createBaseGunDefinitionRegularProperties(): GunDefinitionRegularPropert return { reload: 0 }; } -export const GunDefinitionRegularProperties: MessageFns = { - encode(message: GunDefinitionRegularProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.reload !== 0) { - writer.uint32(13).float(message.reload); - } - return writer; - }, +export const GunDefinitionRegularProperties: MessageFns = + { + encode( + message: GunDefinitionRegularProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.reload !== 0) { + writer.uint32(13).float(message.reload); + } + return writer; + }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegularProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionRegularProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 13) { - break; + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionRegularProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionRegularProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.reload = reader.float(); + continue; } - - message.reload = reader.float(); - continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + return message; + }, + + fromJSON(object: any): GunDefinitionRegularProperties { + return { + reload: globalThis.Number( + assertSet('GunDefinitionRegularProperties.reload', object.reload), + ), + }; + }, + + toJSON(message: GunDefinitionRegularProperties): unknown { + const obj: any = {}; + if (message.reload !== 0) { + obj.reload = message.reload; } - reader.skip(tag & 7); - } - return message; - }, + return obj; + }, - fromJSON(object: any): GunDefinitionRegularProperties { - return { reload: globalThis.Number(assertSet("GunDefinitionRegularProperties.reload", object.reload)) }; - }, - - toJSON(message: GunDefinitionRegularProperties): unknown { - const obj: any = {}; - if (message.reload !== 0) { - obj.reload = message.reload; - } - return obj; - }, - - create, I>>(base?: I): GunDefinitionRegularProperties { - return GunDefinitionRegularProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GunDefinitionRegularProperties { - const message = createBaseGunDefinitionRegularProperties(); - message.reload = object.reload ?? 0; - return message; - }, -}; + create, I>>( + base?: I, + ): GunDefinitionRegularProperties { + return GunDefinitionRegularProperties.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact, I>, + >(object: I): GunDefinitionRegularProperties { + const message = createBaseGunDefinitionRegularProperties(); + message.reload = object.reload ?? 0; + return message; + }, + }; function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoLoaderProperties() }; + return { + base: createBaseGunDefinitionBase(), + extension: createBaseGunDefinitionAutoLoaderProperties(), + }; } export const GunDefinitionAutoLoader: MessageFns = { - encode(message: GunDefinitionAutoLoader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionAutoLoader, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.base !== undefined) { GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } if (message.extension !== undefined) { - GunDefinitionAutoLoaderProperties.encode(message.extension, writer.uint32(18).fork()).join(); + GunDefinitionAutoLoaderProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoader { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoLoader { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionAutoLoader(); while (reader.pos < end) { @@ -2519,7 +2889,10 @@ export const GunDefinitionAutoLoader: MessageFns = { break; } - message.extension = GunDefinitionAutoLoaderProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionAutoLoaderProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2533,9 +2906,11 @@ export const GunDefinitionAutoLoader: MessageFns = { fromJSON(object: any): GunDefinitionAutoLoader { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionAutoLoader.base", object.base)), + base: GunDefinitionBase.fromJSON( + assertSet('GunDefinitionAutoLoader.base', object.base), + ), extension: GunDefinitionAutoLoaderProperties.fromJSON( - assertSet("GunDefinitionAutoLoader.extension", object.extension), + assertSet('GunDefinitionAutoLoader.extension', object.extension), ), }; }, @@ -2546,22 +2921,30 @@ export const GunDefinitionAutoLoader: MessageFns = { obj.base = GunDefinitionBase.toJSON(message.base); } if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoLoaderProperties.toJSON(message.extension); + obj.extension = GunDefinitionAutoLoaderProperties.toJSON( + message.extension, + ); } return obj; }, - create, I>>(base?: I): GunDefinitionAutoLoader { + create, I>>( + base?: I, + ): GunDefinitionAutoLoader { return GunDefinitionAutoLoader.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinitionAutoLoader { + fromPartial, I>>( + object: I, + ): GunDefinitionAutoLoader { const message = createBaseGunDefinitionAutoLoader(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : createBaseGunDefinitionBase(); - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) - : createBaseGunDefinitionAutoLoaderProperties(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : createBaseGunDefinitionBase(); + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) + : createBaseGunDefinitionAutoLoaderProperties(); return message; }, }; @@ -2570,289 +2953,359 @@ function createBaseGunDefinitionAutoLoaderProperties(): GunDefinitionAutoLoaderP return { clip_reload: 0, intra_clip: 0, shell_count: 0 }; } -export const GunDefinitionAutoLoaderProperties: MessageFns = { - encode(message: GunDefinitionAutoLoaderProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.clip_reload !== 0) { - writer.uint32(13).float(message.clip_reload); - } - if (message.intra_clip !== 0) { - writer.uint32(21).float(message.intra_clip); - } - if (message.shell_count !== 0) { - writer.uint32(29).float(message.shell_count); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoaderProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoLoaderProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 13) { - break; - } - - message.clip_reload = reader.float(); - continue; - } - case 2: { - if (tag !== 21) { - break; - } - - message.intra_clip = reader.float(); - continue; - } - case 3: { - if (tag !== 29) { - break; - } - - message.shell_count = reader.float(); - continue; - } +export const GunDefinitionAutoLoaderProperties: MessageFns = + { + encode( + message: GunDefinitionAutoLoaderProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.clip_reload !== 0) { + writer.uint32(13).float(message.clip_reload); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.intra_clip !== 0) { + writer.uint32(21).float(message.intra_clip); } - reader.skip(tag & 7); - } - return message; - }, + if (message.shell_count !== 0) { + writer.uint32(29).float(message.shell_count); + } + return writer; + }, - fromJSON(object: any): GunDefinitionAutoLoaderProperties { - return { - clip_reload: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.clip_reload", object.clip_reload)), - intra_clip: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.intra_clip", object.intra_clip)), - shell_count: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.shell_count", object.shell_count)), - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoLoaderProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoLoaderProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } - toJSON(message: GunDefinitionAutoLoaderProperties): unknown { - const obj: any = {}; - if (message.clip_reload !== 0) { - obj.clip_reload = message.clip_reload; - } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; - } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, + message.clip_reload = reader.float(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } - create, I>>( - base?: I, - ): GunDefinitionAutoLoaderProperties { - return GunDefinitionAutoLoaderProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GunDefinitionAutoLoaderProperties { - const message = createBaseGunDefinitionAutoLoaderProperties(); - message.clip_reload = object.clip_reload ?? 0; - message.intra_clip = object.intra_clip ?? 0; - message.shell_count = object.shell_count ?? 0; - return message; - }, -}; + message.intra_clip = reader.float(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + + message.shell_count = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GunDefinitionAutoLoaderProperties { + return { + clip_reload: globalThis.Number( + assertSet( + 'GunDefinitionAutoLoaderProperties.clip_reload', + object.clip_reload, + ), + ), + intra_clip: globalThis.Number( + assertSet( + 'GunDefinitionAutoLoaderProperties.intra_clip', + object.intra_clip, + ), + ), + shell_count: globalThis.Number( + assertSet( + 'GunDefinitionAutoLoaderProperties.shell_count', + object.shell_count, + ), + ), + }; + }, + + toJSON(message: GunDefinitionAutoLoaderProperties): unknown { + const obj: any = {}; + if (message.clip_reload !== 0) { + obj.clip_reload = message.clip_reload; + } + if (message.intra_clip !== 0) { + obj.intra_clip = message.intra_clip; + } + if (message.shell_count !== 0) { + obj.shell_count = message.shell_count; + } + return obj; + }, + + create, I>>( + base?: I, + ): GunDefinitionAutoLoaderProperties { + return GunDefinitionAutoLoaderProperties.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact, I>, + >(object: I): GunDefinitionAutoLoaderProperties { + const message = createBaseGunDefinitionAutoLoaderProperties(); + message.clip_reload = object.clip_reload ?? 0; + message.intra_clip = object.intra_clip ?? 0; + message.shell_count = object.shell_count ?? 0; + return message; + }, + }; function createBaseGunDefinitionAutoReloader(): GunDefinitionAutoReloader { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoReloaderProperties() }; + return { + base: createBaseGunDefinitionBase(), + extension: createBaseGunDefinitionAutoReloaderProperties(), + }; } -export const GunDefinitionAutoReloader: MessageFns = { - encode(message: GunDefinitionAutoReloader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.base !== undefined) { - GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); - } - if (message.extension !== undefined) { - GunDefinitionAutoReloaderProperties.encode(message.extension, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloader { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoReloader(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.base = GunDefinitionBase.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.extension = GunDefinitionAutoReloaderProperties.decode(reader, reader.uint32()); - continue; - } +export const GunDefinitionAutoReloader: MessageFns = + { + encode( + message: GunDefinitionAutoReloader, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.base !== undefined) { + GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.extension !== undefined) { + GunDefinitionAutoReloaderProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): GunDefinitionAutoReloader { - return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionAutoReloader.base", object.base)), - extension: GunDefinitionAutoReloaderProperties.fromJSON( - assertSet("GunDefinitionAutoReloader.extension", object.extension), - ), - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoReloader { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoReloader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } - toJSON(message: GunDefinitionAutoReloader): unknown { - const obj: any = {}; - if (message.base !== undefined) { - obj.base = GunDefinitionBase.toJSON(message.base); - } - if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoReloaderProperties.toJSON(message.extension); - } - return obj; - }, + message.base = GunDefinitionBase.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - create, I>>(base?: I): GunDefinitionAutoReloader { - return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): GunDefinitionAutoReloader { - const message = createBaseGunDefinitionAutoReloader(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : createBaseGunDefinitionBase(); - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) - : createBaseGunDefinitionAutoReloaderProperties(); - return message; - }, -}; + message.extension = GunDefinitionAutoReloaderProperties.decode( + reader, + reader.uint32(), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GunDefinitionAutoReloader { + return { + base: GunDefinitionBase.fromJSON( + assertSet('GunDefinitionAutoReloader.base', object.base), + ), + extension: GunDefinitionAutoReloaderProperties.fromJSON( + assertSet('GunDefinitionAutoReloader.extension', object.extension), + ), + }; + }, + + toJSON(message: GunDefinitionAutoReloader): unknown { + const obj: any = {}; + if (message.base !== undefined) { + obj.base = GunDefinitionBase.toJSON(message.base); + } + if (message.extension !== undefined) { + obj.extension = GunDefinitionAutoReloaderProperties.toJSON( + message.extension, + ); + } + return obj; + }, + + create, I>>( + base?: I, + ): GunDefinitionAutoReloader { + return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GunDefinitionAutoReloader { + const message = createBaseGunDefinitionAutoReloader(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : createBaseGunDefinitionBase(); + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) + : createBaseGunDefinitionAutoReloaderProperties(); + return message; + }, + }; function createBaseGunDefinitionAutoReloaderProperties(): GunDefinitionAutoReloaderProperties { return { shell_reloads: [], intra_clip: 0, shell_count: 0 }; } -export const GunDefinitionAutoReloaderProperties: MessageFns = { - encode(message: GunDefinitionAutoReloaderProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.shell_reloads) { - writer.float(v); - } - writer.join(); - if (message.intra_clip !== 0) { - writer.uint32(21).float(message.intra_clip); - } - if (message.shell_count !== 0) { - writer.uint32(29).float(message.shell_count); - } - return writer; - }, +export const GunDefinitionAutoReloaderProperties: MessageFns = + { + encode( + message: GunDefinitionAutoReloaderProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.shell_reloads) { + writer.float(v); + } + writer.join(); + if (message.intra_clip !== 0) { + writer.uint32(21).float(message.intra_clip); + } + if (message.shell_count !== 0) { + writer.uint32(29).float(message.shell_count); + } + return writer; + }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloaderProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoReloaderProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag === 13) { - message.shell_reloads.push(reader.float()); - - continue; - } - - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoReloaderProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoReloaderProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 13) { message.shell_reloads.push(reader.float()); + + continue; } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.shell_reloads.push(reader.float()); + } + + continue; + } + + break; + } + case 2: { + if (tag !== 21) { + break; + } + + message.intra_clip = reader.float(); continue; } + case 3: { + if (tag !== 29) { + break; + } + message.shell_count = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { break; } - case 2: { - if (tag !== 21) { - break; - } - - message.intra_clip = reader.float(); - continue; - } - case 3: { - if (tag !== 29) { - break; - } - - message.shell_count = reader.float(); - continue; - } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + return message; + }, + + fromJSON(object: any): GunDefinitionAutoReloaderProperties { + return { + shell_reloads: globalThis.Array.isArray(object?.shell_reloads) + ? object.shell_reloads.map((e: any) => globalThis.Number(e)) + : [], + intra_clip: globalThis.Number( + assertSet( + 'GunDefinitionAutoReloaderProperties.intra_clip', + object.intra_clip, + ), + ), + shell_count: globalThis.Number( + assertSet( + 'GunDefinitionAutoReloaderProperties.shell_count', + object.shell_count, + ), + ), + }; + }, + + toJSON(message: GunDefinitionAutoReloaderProperties): unknown { + const obj: any = {}; + if (message.shell_reloads?.length) { + obj.shell_reloads = message.shell_reloads; } - reader.skip(tag & 7); - } - return message; - }, + if (message.intra_clip !== 0) { + obj.intra_clip = message.intra_clip; + } + if (message.shell_count !== 0) { + obj.shell_count = message.shell_count; + } + return obj; + }, - fromJSON(object: any): GunDefinitionAutoReloaderProperties { - return { - shell_reloads: globalThis.Array.isArray(object?.shell_reloads) - ? object.shell_reloads.map((e: any) => globalThis.Number(e)) - : [], - intra_clip: globalThis.Number(assertSet("GunDefinitionAutoReloaderProperties.intra_clip", object.intra_clip)), - shell_count: globalThis.Number(assertSet("GunDefinitionAutoReloaderProperties.shell_count", object.shell_count)), - }; - }, - - toJSON(message: GunDefinitionAutoReloaderProperties): unknown { - const obj: any = {}; - if (message.shell_reloads?.length) { - obj.shell_reloads = message.shell_reloads; - } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; - } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, - - create, I>>( - base?: I, - ): GunDefinitionAutoReloaderProperties { - return GunDefinitionAutoReloaderProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): GunDefinitionAutoReloaderProperties { - const message = createBaseGunDefinitionAutoReloaderProperties(); - message.shell_reloads = object.shell_reloads?.map((e) => e) || []; - message.intra_clip = object.intra_clip ?? 0; - message.shell_count = object.shell_count ?? 0; - return message; - }, -}; + create< + I extends Exact, I>, + >(base?: I): GunDefinitionAutoReloaderProperties { + return GunDefinitionAutoReloaderProperties.fromPartial( + base ?? ({} as any), + ); + }, + fromPartial< + I extends Exact, I>, + >(object: I): GunDefinitionAutoReloaderProperties { + const message = createBaseGunDefinitionAutoReloaderProperties(); + message.shell_reloads = object.shell_reloads?.map((e) => e) || []; + message.intra_clip = object.intra_clip ?? 0; + message.shell_count = object.shell_count ?? 0; + return message; + }, + }; function createBaseGunDefinitionBase(): GunDefinitionBase { return { @@ -2875,7 +3328,10 @@ function createBaseGunDefinitionBase(): GunDefinitionBase { } export const GunDefinitionBase: MessageFns = { - encode(message: GunDefinitionBase, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionBase, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -2883,7 +3339,10 @@ export const GunDefinitionBase: MessageFns = { writer.uint32(21).float(message.rotation_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(26).fork(), + ).join(); } if (message.weight !== 0) { writer.uint32(32).uint32(message.weight); @@ -2925,7 +3384,8 @@ export const GunDefinitionBase: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionBase { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionBase(); while (reader.pos < end) { @@ -3062,27 +3522,53 @@ export const GunDefinitionBase: MessageFns = { fromJSON(object: any): GunDefinitionBase { return { - id: globalThis.Number(assertSet("GunDefinitionBase.id", object.id)), - rotation_speed: globalThis.Number(assertSet("GunDefinitionBase.rotation_speed", object.rotation_speed)), - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - weight: globalThis.Number(assertSet("GunDefinitionBase.weight", object.weight)), - name: I18nString.fromJSON(assertSet("GunDefinitionBase.name", object.name)), - tier: globalThis.Number(assertSet("GunDefinitionBase.tier", object.tier)), + id: globalThis.Number(assertSet('GunDefinitionBase.id', object.id)), + rotation_speed: globalThis.Number( + assertSet('GunDefinitionBase.rotation_speed', object.rotation_speed), + ), + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + weight: globalThis.Number( + assertSet('GunDefinitionBase.weight', object.weight), + ), + name: I18nString.fromJSON( + assertSet('GunDefinitionBase.name', object.name), + ), + tier: globalThis.Number(assertSet('GunDefinitionBase.tier', object.tier)), shells: globalThis.Array.isArray(object?.shells) ? object.shells.map((e: any) => ShellDefinition.fromJSON(e)) : [], - camouflage_loss: globalThis.Number(assertSet("GunDefinitionBase.camouflage_loss", object.camouflage_loss)), - aim_time: globalThis.Number(assertSet("GunDefinitionBase.aim_time", object.aim_time)), - dispersion_base: globalThis.Number(assertSet("GunDefinitionBase.dispersion_base", object.dispersion_base)), + camouflage_loss: globalThis.Number( + assertSet('GunDefinitionBase.camouflage_loss', object.camouflage_loss), + ), + aim_time: globalThis.Number( + assertSet('GunDefinitionBase.aim_time', object.aim_time), + ), + dispersion_base: globalThis.Number( + assertSet('GunDefinitionBase.dispersion_base', object.dispersion_base), + ), dispersion_traverse: globalThis.Number( - assertSet("GunDefinitionBase.dispersion_traverse", object.dispersion_traverse), + assertSet( + 'GunDefinitionBase.dispersion_traverse', + object.dispersion_traverse, + ), + ), + dispersion_shot: globalThis.Number( + assertSet('GunDefinitionBase.dispersion_shot', object.dispersion_shot), ), - dispersion_shot: globalThis.Number(assertSet("GunDefinitionBase.dispersion_shot", object.dispersion_shot)), dispersion_damaged: globalThis.Number( - assertSet("GunDefinitionBase.dispersion_damaged", object.dispersion_damaged), + assertSet( + 'GunDefinitionBase.dispersion_damaged', + object.dispersion_damaged, + ), + ), + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], + shell_capacity: globalThis.Number( + assertSet('GunDefinitionBase.shell_capacity', object.shell_capacity), ), - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], - shell_capacity: globalThis.Number(assertSet("GunDefinitionBase.shell_capacity", object.shell_capacity)), }; }, @@ -3136,22 +3622,29 @@ export const GunDefinitionBase: MessageFns = { return obj; }, - create, I>>(base?: I): GunDefinitionBase { + create, I>>( + base?: I, + ): GunDefinitionBase { return GunDefinitionBase.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GunDefinitionBase { + fromPartial, I>>( + object: I, + ): GunDefinitionBase { const message = createBaseGunDefinitionBase(); message.id = object.id ?? 0; message.rotation_speed = object.rotation_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.weight = object.weight ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); message.tier = object.tier ?? 0; - message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; + message.shells = + object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; message.camouflage_loss = object.camouflage_loss ?? 0; message.aim_time = object.aim_time ?? 0; message.dispersion_base = object.dispersion_base ?? 0; @@ -3172,7 +3665,7 @@ function createBaseShellDefinition(): ShellDefinition { armor_damage: 0, module_damage: 0, caliber: 0, - icon: "", + icon: '', penetration: createBaseShellPenetration(), type: 0, normalization: undefined, @@ -3183,7 +3676,10 @@ function createBaseShellDefinition(): ShellDefinition { } export const ShellDefinition: MessageFns = { - encode(message: ShellDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ShellDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -3202,22 +3698,31 @@ export const ShellDefinition: MessageFns = { if (message.caliber !== 0) { writer.uint32(53).float(message.caliber); } - if (message.icon !== "") { + if (message.icon !== '') { writer.uint32(58).string(message.icon); } if (message.penetration !== undefined) { - ShellPenetration.encode(message.penetration, writer.uint32(66).fork()).join(); + ShellPenetration.encode( + message.penetration, + writer.uint32(66).fork(), + ).join(); } if (message.type !== 0) { writer.uint32(72).int32(message.type); } - if (message.normalization !== undefined && message.normalization !== undefined) { + if ( + message.normalization !== undefined && + message.normalization !== undefined + ) { writer.uint32(85).float(message.normalization); } if (message.ricochet !== undefined && message.ricochet !== undefined) { writer.uint32(93).float(message.ricochet); } - if (message.explosion_radius !== undefined && message.explosion_radius !== undefined) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== undefined + ) { writer.uint32(101).float(message.explosion_radius); } if (message.range !== 0) { @@ -3227,7 +3732,8 @@ export const ShellDefinition: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): ShellDefinition { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseShellDefinition(); while (reader.pos < end) { @@ -3294,7 +3800,10 @@ export const ShellDefinition: MessageFns = { break; } - message.penetration = ShellPenetration.decode(reader, reader.uint32()); + message.penetration = ShellPenetration.decode( + reader, + reader.uint32(), + ); continue; } case 9: { @@ -3348,19 +3857,37 @@ export const ShellDefinition: MessageFns = { fromJSON(object: any): ShellDefinition { return { - id: globalThis.Number(assertSet("ShellDefinition.id", object.id)), - name: I18nString.fromJSON(assertSet("ShellDefinition.name", object.name)), - velocity: globalThis.Number(assertSet("ShellDefinition.velocity", object.velocity)), - armor_damage: globalThis.Number(assertSet("ShellDefinition.armor_damage", object.armor_damage)), - module_damage: globalThis.Number(assertSet("ShellDefinition.module_damage", object.module_damage)), - caliber: globalThis.Number(assertSet("ShellDefinition.caliber", object.caliber)), - icon: globalThis.String(assertSet("ShellDefinition.icon", object.icon)), - penetration: ShellPenetration.fromJSON(assertSet("ShellDefinition.penetration", object.penetration)), - type: shellTypeFromJSON(assertSet("ShellDefinition.type", object.type)), - normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : undefined, - ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : undefined, - explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : undefined, - range: globalThis.Number(assertSet("ShellDefinition.range", object.range)), + id: globalThis.Number(assertSet('ShellDefinition.id', object.id)), + name: I18nString.fromJSON(assertSet('ShellDefinition.name', object.name)), + velocity: globalThis.Number( + assertSet('ShellDefinition.velocity', object.velocity), + ), + armor_damage: globalThis.Number( + assertSet('ShellDefinition.armor_damage', object.armor_damage), + ), + module_damage: globalThis.Number( + assertSet('ShellDefinition.module_damage', object.module_damage), + ), + caliber: globalThis.Number( + assertSet('ShellDefinition.caliber', object.caliber), + ), + icon: globalThis.String(assertSet('ShellDefinition.icon', object.icon)), + penetration: ShellPenetration.fromJSON( + assertSet('ShellDefinition.penetration', object.penetration), + ), + type: shellTypeFromJSON(assertSet('ShellDefinition.type', object.type)), + normalization: isSet(object.normalization) + ? globalThis.Number(object.normalization) + : undefined, + ricochet: isSet(object.ricochet) + ? globalThis.Number(object.ricochet) + : undefined, + explosion_radius: isSet(object.explosion_radius) + ? globalThis.Number(object.explosion_radius) + : undefined, + range: globalThis.Number( + assertSet('ShellDefinition.range', object.range), + ), }; }, @@ -3384,7 +3911,7 @@ export const ShellDefinition: MessageFns = { if (message.caliber !== 0) { obj.caliber = message.caliber; } - if (message.icon !== "") { + if (message.icon !== '') { obj.icon = message.icon; } if (message.penetration !== undefined) { @@ -3393,13 +3920,19 @@ export const ShellDefinition: MessageFns = { if (message.type !== 0) { obj.type = shellTypeToJSON(message.type); } - if (message.normalization !== undefined && message.normalization !== undefined) { + if ( + message.normalization !== undefined && + message.normalization !== undefined + ) { obj.normalization = message.normalization; } if (message.ricochet !== undefined && message.ricochet !== undefined) { obj.ricochet = message.ricochet; } - if (message.explosion_radius !== undefined && message.explosion_radius !== undefined) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== undefined + ) { obj.explosion_radius = message.explosion_radius; } if (message.range !== 0) { @@ -3408,23 +3941,29 @@ export const ShellDefinition: MessageFns = { return obj; }, - create, I>>(base?: I): ShellDefinition { + create, I>>( + base?: I, + ): ShellDefinition { return ShellDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ShellDefinition { + fromPartial, I>>( + object: I, + ): ShellDefinition { const message = createBaseShellDefinition(); message.id = object.id ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : createBaseI18nString(); message.velocity = object.velocity ?? 0; message.armor_damage = object.armor_damage ?? 0; message.module_damage = object.module_damage ?? 0; message.caliber = object.caliber ?? 0; - message.icon = object.icon ?? ""; - message.penetration = (object.penetration !== undefined && object.penetration !== null) - ? ShellPenetration.fromPartial(object.penetration) - : createBaseShellPenetration(); + message.icon = object.icon ?? ''; + message.penetration = + object.penetration !== undefined && object.penetration !== null + ? ShellPenetration.fromPartial(object.penetration) + : createBaseShellPenetration(); message.type = object.type ?? 0; message.normalization = object.normalization ?? undefined; message.ricochet = object.ricochet ?? undefined; @@ -3439,7 +3978,10 @@ function createBaseShellPenetration(): ShellPenetration { } export const ShellPenetration: MessageFns = { - encode(message: ShellPenetration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ShellPenetration, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.near !== 0) { writer.uint32(13).float(message.near); } @@ -3450,7 +3992,8 @@ export const ShellPenetration: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): ShellPenetration { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseShellPenetration(); while (reader.pos < end) { @@ -3483,8 +4026,8 @@ export const ShellPenetration: MessageFns = { fromJSON(object: any): ShellPenetration { return { - near: globalThis.Number(assertSet("ShellPenetration.near", object.near)), - far: globalThis.Number(assertSet("ShellPenetration.far", object.far)), + near: globalThis.Number(assertSet('ShellPenetration.near', object.near)), + far: globalThis.Number(assertSet('ShellPenetration.far', object.far)), }; }, @@ -3499,10 +4042,14 @@ export const ShellPenetration: MessageFns = { return obj; }, - create, I>>(base?: I): ShellPenetration { + create, I>>( + base?: I, + ): ShellPenetration { return ShellPenetration.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ShellPenetration { + fromPartial, I>>( + object: I, + ): ShellPenetration { const message = createBaseShellPenetration(); message.near = object.near ?? 0; message.far = object.far ?? 0; @@ -3515,7 +4062,10 @@ function createBaseUnlock(): Unlock { } export const Unlock: MessageFns = { - encode(message: Unlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: Unlock, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); } @@ -3529,7 +4079,8 @@ export const Unlock: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Unlock { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUnlock(); while (reader.pos < end) { @@ -3570,9 +4121,9 @@ export const Unlock: MessageFns = { fromJSON(object: any): Unlock { return { - id: globalThis.Number(assertSet("Unlock.id", object.id)), - type: moduleTypeFromJSON(assertSet("Unlock.type", object.type)), - cost: UnlockCost.fromJSON(assertSet("Unlock.cost", object.cost)), + id: globalThis.Number(assertSet('Unlock.id', object.id)), + type: moduleTypeFromJSON(assertSet('Unlock.type', object.type)), + cost: UnlockCost.fromJSON(assertSet('Unlock.cost', object.cost)), }; }, @@ -3597,20 +4148,24 @@ export const Unlock: MessageFns = { const message = createBaseUnlock(); message.id = object.id ?? 0; message.type = object.type ?? 0; - message.cost = (object.cost !== undefined && object.cost !== null) - ? UnlockCost.fromPartial(object.cost) - : createBaseUnlockCost(); + message.cost = + object.cost !== undefined && object.cost !== null + ? UnlockCost.fromPartial(object.cost) + : createBaseUnlockCost(); return message; }, }; function createBaseUnlockCost(): UnlockCost { - return { type: "", value: 0 }; + return { type: '', value: 0 }; } export const UnlockCost: MessageFns = { - encode(message: UnlockCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.type !== "") { + encode( + message: UnlockCost, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== '') { writer.uint32(10).string(message.type); } if (message.value !== 0) { @@ -3620,7 +4175,8 @@ export const UnlockCost: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): UnlockCost { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseUnlockCost(); while (reader.pos < end) { @@ -3653,14 +4209,14 @@ export const UnlockCost: MessageFns = { fromJSON(object: any): UnlockCost { return { - type: globalThis.String(assertSet("UnlockCost.type", object.type)), - value: globalThis.Number(assertSet("UnlockCost.value", object.value)), + type: globalThis.String(assertSet('UnlockCost.type', object.type)), + value: globalThis.Number(assertSet('UnlockCost.value', object.value)), }; }, toJSON(message: UnlockCost): unknown { const obj: any = {}; - if (message.type !== "") { + if (message.type !== '') { obj.type = message.type; } if (message.value !== 0) { @@ -3672,9 +4228,11 @@ export const UnlockCost: MessageFns = { create, I>>(base?: I): UnlockCost { return UnlockCost.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UnlockCost { + fromPartial, I>>( + object: I, + ): UnlockCost { const message = createBaseUnlockCost(); - message.type = object.type ?? ""; + message.type = object.type ?? ''; message.value = object.value ?? 0; return message; }, @@ -3685,7 +4243,10 @@ function createBaseCrew(): Crew { } export const Crew: MessageFns = { - encode(message: Crew, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: Crew, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } @@ -3701,7 +4262,8 @@ export const Crew: MessageFns = { }, decode(input: BinaryReader | Uint8Array, length?: number): Crew { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCrew(); while (reader.pos < end) { @@ -3752,8 +4314,8 @@ export const Crew: MessageFns = { fromJSON(object: any): Crew { return { - type: crewTypeFromJSON(assertSet("Crew.type", object.type)), - count: globalThis.Number(assertSet("Crew.count", object.count)), + type: crewTypeFromJSON(assertSet('Crew.type', object.type)), + count: globalThis.Number(assertSet('Crew.count', object.count)), substitute: globalThis.Array.isArray(object?.substitute) ? object.substitute.map((e: any) => crewTypeFromJSON(e)) : [], @@ -3786,21 +4348,36 @@ export const Crew: MessageFns = { }, }; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; -export type DeepPartial = T extends Builtin ? T - : T extends globalThis.Array ? globalThis.Array> - : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; +export type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends { $case: string; value: unknown } + ? { $case: T['$case']; value?: DeepPartial } + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { + [K in Exclude>]: never; + }; function isObject(value: any): boolean { - return typeof value === "object" && value !== null; + return typeof value === 'object' && value !== null; } function isSet(value: any): boolean { diff --git a/packages/core/src/protos/tank.ts b/packages/core/src/protos/tank.ts index b5581f4ba..8b93b6996 100644 --- a/packages/core/src/protos/tank.ts +++ b/packages/core/src/protos/tank.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/tank.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { I18n } from "./i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18n, createBaseI18n } from './i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface Tank { id: string; @@ -33,28 +33,35 @@ export interface PenetrationGroup_ArmorsEntry { } function createBaseTank(): Tank { - return { id: "", slug: "", name: createBaseI18n(), penetration_groups: {} }; + return { id: '', slug: '', name: createBaseI18n(), penetration_groups: {} }; } export const Tank: MessageFns = { - encode(message: Tank, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.id !== "") { + encode( + message: Tank, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.id !== '') { writer.uint32(10).string(message.id); } - if (message.slug !== "") { + if (message.slug !== '') { writer.uint32(18).string(message.slug); } 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(); + Tank_PenetrationGroupsEntry.encode( + { key: key as any, value }, + writer.uint32(34).fork(), + ).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Tank { - 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 = createBaseTank(); while (reader.pos < end) { @@ -89,7 +96,10 @@ export const Tank: MessageFns = { break; } - const entry4 = Tank_PenetrationGroupsEntry.decode(reader, reader.uint32()); + const entry4 = Tank_PenetrationGroupsEntry.decode( + reader, + reader.uint32(), + ); if (entry4.value !== undefined) { message.penetration_groups[entry4.key] = entry4.value; } @@ -106,24 +116,26 @@ export const Tank: MessageFns = { fromJSON(object: any): Tank { return { - id: globalThis.String(assertSet("Tank.id", object.id)), - slug: globalThis.String(assertSet("Tank.slug", object.slug)), - name: I18n.fromJSON(assertSet("Tank.name", object.name)), + 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; - }, {}) + ? Object.entries(object.penetration_groups).reduce<{ + [key: string]: PenetrationGroup; + }>((acc, [key, value]) => { + acc[key] = PenetrationGroup.fromJSON(value); + return acc; + }, {}) : {}, }; }, toJSON(message: Tank): unknown { const obj: any = {}; - if (message.id !== "") { + if (message.id !== '') { obj.id = message.id; } - if (message.slug !== "") { + if (message.slug !== '') { obj.slug = message.slug; } if (message.name !== undefined) { @@ -146,14 +158,15 @@ export const Tank: MessageFns = { }, fromPartial, I>>(object: I): Tank { const message = createBaseTank(); - message.id = object.id ?? ""; - message.slug = object.slug ?? ""; - 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]) => { + message.id = object.id ?? ''; + message.slug = object.slug ?? ''; + 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); } @@ -164,97 +177,121 @@ export const Tank: MessageFns = { }; function createBaseTank_PenetrationGroupsEntry(): Tank_PenetrationGroupsEntry { - return { key: "", value: createBasePenetrationGroup() }; + 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; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + PenetrationGroup.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): Tank_PenetrationGroupsEntry { - return { - key: globalThis.String(assertSet("Tank_PenetrationGroupsEntry.key", object.key)), - value: PenetrationGroup.fromJSON(assertSet("Tank_PenetrationGroupsEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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; - }, -}; + 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 { + 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(); + 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); + 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) { @@ -265,7 +302,10 @@ export const PenetrationGroup: MessageFns = { break; } - const entry1 = PenetrationGroup_ArmorsEntry.decode(reader, reader.uint32()); + const entry1 = PenetrationGroup_ArmorsEntry.decode( + reader, + reader.uint32(), + ); if (entry1.value !== undefined) { message.armors[entry1.key] = entry1.value; } @@ -283,10 +323,13 @@ export const PenetrationGroup: MessageFns = { 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; - }, {}) + ? Object.entries(object.armors).reduce<{ [key: string]: number }>( + (acc, [key, value]) => { + acc[key] = Number(value); + return acc; + }, + {}, + ) : {}, }; }, @@ -305,12 +348,18 @@ export const PenetrationGroup: MessageFns = { return obj; }, - create, I>>(base?: I): PenetrationGroup { + create, I>>( + base?: I, + ): PenetrationGroup { return PenetrationGroup.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PenetrationGroup { + fromPartial, I>>( + object: I, + ): PenetrationGroup { const message = createBasePenetrationGroup(); - message.armors = Object.entries(object.armors ?? {}).reduce<{ [key: string]: number }>((acc, [key, value]) => { + message.armors = Object.entries(object.armors ?? {}).reduce<{ + [key: string]: number; + }>((acc, [key, value]) => { if (value !== undefined) { acc[key] = globalThis.Number(value); } @@ -321,96 +370,127 @@ export const PenetrationGroup: MessageFns = { }; function createBasePenetrationGroup_ArmorsEntry(): PenetrationGroup_ArmorsEntry { - return { key: "", value: 0 }; + 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; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + writer.uint32(21).float(message.value); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): PenetrationGroup_ArmorsEntry { - return { - key: globalThis.String(assertSet("PenetrationGroup_ArmorsEntry.key", object.key)), - value: globalThis.Number(assertSet("PenetrationGroup_ArmorsEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } - 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; - }, -}; + message.value = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + fromJSON(object: any): PenetrationGroup_ArmorsEntry { + return { + key: globalThis.String( + assertSet('PenetrationGroup_ArmorsEntry.key', object.key), + ), + value: globalThis.Number( + assertSet('PenetrationGroup_ArmorsEntry.value', object.value), + ), + }; + }, -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; + 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; + }, + }; + +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 {