From e60bbc03d22f36d2fcb304da7884ad4d4a262a48 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Thu, 20 Mar 2025 11:59:24 -0500 Subject: [PATCH] feat: separate armors --- packages/core/src/protos/index.ts | 3 +- packages/core/src/protos/tank.proto | 8 - packages/core/src/protos/tank.ts | 424 +--------- packages/core/src/protos/tank_armor.proto | 23 + packages/core/src/protos/tank_armor.ts | 489 +++++++++++ .../tools/compare/_index.tsx | 0 .../tools/compare/index.astro | 0 .../tools/embed/[embed]/_index.tsx | 0 .../tools/embed/[embed]/host/_index.tsx | 0 .../tools/embed/[embed]/host/index.astro | 0 .../tools/embed/[embed]/index.astro | 0 .../tools/embed/_index.tsx | 0 .../tools/embed/index.astro | 0 .../tools/gallery/_index.tsx | 0 .../tools/gallery/index.astro | 0 .../tools/performance/_index.tsx | 0 .../tools/performance/index.astro | 0 .../tools/session/_index.tsx | 0 .../tools/session/index.astro | 0 .../tools/tankopedia/[id]/_index.tsx | 0 .../tools/tankopedia/[id]/index.astro | 0 .../tools/tankopedia/_index.tsx | 0 .../tools/tankopedia/index.astro | 0 .../tools/tier-list/_index.tsx | 0 .../tools/tier-list/index.astro | 0 .../website/src/components/ArmorGroup.tsx | 42 + .../pages/[...locale]/tanks/[slug]/_index.tsx | 37 +- .../[...locale]/tanks/[slug]/index.astro | 4 +- src/BlitzKit.CLI/Functions/Mangler.cs | 57 +- src/BlitzKit.CLI/Protos/Tank.cs | 231 +----- src/BlitzKit.CLI/Protos/TankArmor.cs | 759 ++++++++++++++++++ 31 files changed, 1387 insertions(+), 690 deletions(-) create mode 100644 packages/core/src/protos/tank_armor.proto create mode 100644 packages/core/src/protos/tank_armor.ts rename packages/{website/src/pages/[...locale] => preforged}/tools/compare/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/compare/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/embed/[embed]/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/embed/[embed]/host/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/embed/[embed]/host/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/embed/[embed]/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/embed/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/embed/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/gallery/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/gallery/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/performance/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/performance/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/session/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/session/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/tankopedia/[id]/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/tankopedia/[id]/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/tankopedia/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/tankopedia/index.astro (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/tier-list/_index.tsx (100%) rename packages/{website/src/pages/[...locale] => preforged}/tools/tier-list/index.astro (100%) create mode 100644 packages/website/src/components/ArmorGroup.tsx create mode 100644 src/BlitzKit.CLI/Protos/TankArmor.cs diff --git a/packages/core/src/protos/index.ts b/packages/core/src/protos/index.ts index e1c0cba22..213ccc9ac 100644 --- a/packages/core/src/protos/index.ts +++ b/packages/core/src/protos/index.ts @@ -14,4 +14,5 @@ export * from './legacy_skill_definitions.ts'; export * from './legacy_tank_definitions.ts'; export * from './reviews.ts'; export * from './tank.ts'; -export * from './tanks.ts'; \ No newline at end of file +export * from './tanks.ts'; +export * from './tank_armor.ts'; \ No newline at end of file diff --git a/packages/core/src/protos/tank.proto b/packages/core/src/protos/tank.proto index f777cbacf..bf3d14f18 100644 --- a/packages/core/src/protos/tank.proto +++ b/packages/core/src/protos/tank.proto @@ -8,12 +8,4 @@ message Tank { required string id = 1; required string slug = 2; required I18n name = 3; - // key can only ever be "chassis", "hull", "turret", or "gun" - map penetration_groups = 4; } - -message PenetrationGroup { - // keys are mostly "armor_xyz" where xyz is an integer but sometimes can be - // things like "commander", "rightTrack", etc. - map armors = 1; -} \ No newline at end of file diff --git a/packages/core/src/protos/tank.ts b/packages/core/src/protos/tank.ts index 8b93b6996..ff3b06502 100644 --- a/packages/core/src/protos/tank.ts +++ b/packages/core/src/protos/tank.ts @@ -5,63 +5,37 @@ // source: packages/core/src/protos/tank.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; -import { I18n, createBaseI18n } 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; slug: string; name: I18n; - /** key can only ever be "chassis", "hull", "turret", or "gun" */ - penetration_groups: { [key: string]: PenetrationGroup }; -} - -export interface Tank_PenetrationGroupsEntry { - key: string; - value: PenetrationGroup | undefined; -} - -export interface PenetrationGroup { - armors: { [key: string]: number }; -} - -export interface PenetrationGroup_ArmorsEntry { - key: string; - value: number; } function createBaseTank(): Tank { - return { id: '', slug: '', name: createBaseI18n(), penetration_groups: {} }; + return { id: "", slug: "", name: createBaseI18n() }; } 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(); - }); 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) { @@ -91,20 +65,6 @@ export const Tank: MessageFns = { message.name = I18n.decode(reader, reader.uint32()); continue; } - case 4: { - if (tag !== 34) { - break; - } - - const entry4 = Tank_PenetrationGroupsEntry.decode( - reader, - reader.uint32(), - ); - if (entry4.value !== undefined) { - message.penetration_groups[entry4.key] = entry4.value; - } - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -116,40 +76,23 @@ 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)), - 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; - }, {}) - : {}, + id: globalThis.String(assertSet("Tank.id", object.id)), + slug: globalThis.String(assertSet("Tank.slug", object.slug)), + name: I18n.fromJSON(assertSet("Tank.name", object.name)), }; }, 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) { obj.name = I18n.toJSON(message.name); } - if (message.penetration_groups) { - const entries = Object.entries(message.penetration_groups); - if (entries.length > 0) { - obj.penetration_groups = {}; - entries.forEach(([k, v]) => { - obj.penetration_groups[k] = PenetrationGroup.toJSON(v); - }); - } - } return obj; }, @@ -158,340 +101,27 @@ 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]) => { - if (value !== undefined) { - acc[key] = PenetrationGroup.fromPartial(value); - } - return acc; - }, {}); + message.id = object.id ?? ""; + message.slug = object.slug ?? ""; + message.name = (object.name !== undefined && object.name !== null) + ? I18n.fromPartial(object.name) + : createBaseI18n(); return message; }, }; -function createBaseTank_PenetrationGroupsEntry(): Tank_PenetrationGroupsEntry { - return { key: '', value: createBasePenetrationGroup() }; -} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export const Tank_PenetrationGroupsEntry: MessageFns = - { - encode( - message: Tank_PenetrationGroupsEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - PenetrationGroup.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): Tank_PenetrationGroupsEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTank_PenetrationGroupsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.value = PenetrationGroup.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): Tank_PenetrationGroupsEntry { - return { - key: globalThis.String( - assertSet('Tank_PenetrationGroupsEntry.key', object.key), - ), - value: PenetrationGroup.fromJSON( - assertSet('Tank_PenetrationGroupsEntry.value', object.value), - ), - }; - }, - - toJSON(message: Tank_PenetrationGroupsEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = message.key; - } - if (message.value !== undefined) { - obj.value = PenetrationGroup.toJSON(message.value); - } - return obj; - }, - - create, I>>( - base?: I, - ): Tank_PenetrationGroupsEntry { - return Tank_PenetrationGroupsEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): Tank_PenetrationGroupsEntry { - const message = createBaseTank_PenetrationGroupsEntry(); - message.key = object.key ?? ''; - message.value = - object.value !== undefined && object.value !== null - ? PenetrationGroup.fromPartial(object.value) - : undefined; - return message; - }, - }; - -function createBasePenetrationGroup(): PenetrationGroup { - return { armors: {} }; -} - -export const PenetrationGroup: MessageFns = { - encode( - message: PenetrationGroup, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - Object.entries(message.armors).forEach(([key, value]) => { - PenetrationGroup_ArmorsEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).join(); - }); - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): PenetrationGroup { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePenetrationGroup(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - const entry1 = PenetrationGroup_ArmorsEntry.decode( - reader, - reader.uint32(), - ); - if (entry1.value !== undefined) { - message.armors[entry1.key] = entry1.value; - } - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): PenetrationGroup { - return { - armors: isObject(object.armors) - ? Object.entries(object.armors).reduce<{ [key: string]: number }>( - (acc, [key, value]) => { - acc[key] = Number(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: PenetrationGroup): unknown { - const obj: any = {}; - if (message.armors) { - const entries = Object.entries(message.armors); - if (entries.length > 0) { - obj.armors = {}; - entries.forEach(([k, v]) => { - obj.armors[k] = v; - }); - } - } - return obj; - }, - - create, I>>( - base?: I, - ): PenetrationGroup { - return PenetrationGroup.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): PenetrationGroup { - const message = createBasePenetrationGroup(); - message.armors = Object.entries(object.armors ?? {}).reduce<{ - [key: string]: number; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.Number(value); - } - return acc; - }, {}); - return message; - }, -}; - -function createBasePenetrationGroup_ArmorsEntry(): PenetrationGroup_ArmorsEntry { - return { key: '', value: 0 }; -} - -export const PenetrationGroup_ArmorsEntry: MessageFns = - { - encode( - message: PenetrationGroup_ArmorsEntry, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.key !== undefined) { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - writer.uint32(21).float(message.value); - } - return writer; - }, - - decode( - input: BinaryReader | Uint8Array, - length?: number, - ): PenetrationGroup_ArmorsEntry { - const reader = - input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePenetrationGroup_ArmorsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.key = reader.string(); - continue; - } - case 2: { - if (tag !== 21) { - break; - } - - message.value = reader.float(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): PenetrationGroup_ArmorsEntry { - return { - key: globalThis.String( - assertSet('PenetrationGroup_ArmorsEntry.key', object.key), - ), - value: globalThis.Number( - assertSet('PenetrationGroup_ArmorsEntry.value', object.value), - ), - }; - }, - - toJSON(message: PenetrationGroup_ArmorsEntry): unknown { - const obj: any = {}; - if (message.key !== undefined) { - obj.key = message.key; - } - if (message.value !== undefined) { - obj.value = message.value; - } - return obj; - }, - - create, I>>( - base?: I, - ): PenetrationGroup_ArmorsEntry { - return PenetrationGroup_ArmorsEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): PenetrationGroup_ArmorsEntry { - const message = createBasePenetrationGroup_ArmorsEntry(); - message.key = object.key ?? ''; - message.value = object.value ?? 0; - return message; - }, - }; - -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; - }; - -function isObject(value: any): boolean { - return typeof value === 'object' && value !== null; -} +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; function isSet(value: any): boolean { return value !== null && value !== undefined; diff --git a/packages/core/src/protos/tank_armor.proto b/packages/core/src/protos/tank_armor.proto new file mode 100644 index 000000000..0e86aa512 --- /dev/null +++ b/packages/core/src/protos/tank_armor.proto @@ -0,0 +1,23 @@ +syntax = "proto2"; + +package blitzkit; + +message TankArmor { + // tank id + required string id = 1; + // key can only ever be "chassis", "hull", "turret", or "gun" + map groups = 4; +} + +message PenetrationGroup { + // keys are mostly "armor_xyz" where xyz is an integer but sometimes can be + // things like "commander", "rightTrack", etc. + map armors = 1; +} + +message ArmorPlate { + // this is the thickness of the armor in millimeters + required float thickness = 1; + // this can be stuff like ArmorScreen which is spaced armor, FuelTank, etc. + required string type = 2; +} diff --git a/packages/core/src/protos/tank_armor.ts b/packages/core/src/protos/tank_armor.ts new file mode 100644 index 000000000..9f1aab428 --- /dev/null +++ b/packages/core/src/protos/tank_armor.ts @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.2 +// protoc v5.28.2 +// source: packages/core/src/protos/tank_armor.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "blitzkit"; + +export interface TankArmor { + /** tank id */ + id: string; + /** key can only ever be "chassis", "hull", "turret", or "gun" */ + groups: { [key: string]: PenetrationGroup }; +} + +export interface TankArmor_GroupsEntry { + key: string; + value: PenetrationGroup | undefined; +} + +export interface PenetrationGroup { + /** + * keys are mostly "armor_xyz" where xyz is an integer but sometimes can be + * things like "commander", "rightTrack", etc. + */ + armors: { [key: string]: ArmorPlate }; +} + +export interface PenetrationGroup_ArmorsEntry { + key: string; + value: ArmorPlate | undefined; +} + +export interface ArmorPlate { + /** this is the thickness of the armor in millimeters */ + thickness: number; + /** this can be stuff like ArmorScreen which is spaced armor, FuelTank, etc. */ + type: string; +} + +function createBaseTankArmor(): TankArmor { + return { id: "", groups: {} }; +} + +export const TankArmor: MessageFns = { + encode(message: TankArmor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + Object.entries(message.groups).forEach(([key, value]) => { + TankArmor_GroupsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TankArmor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTankArmor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = TankArmor_GroupsEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.groups[entry4.key] = entry4.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankArmor { + return { + id: globalThis.String(assertSet("TankArmor.id", object.id)), + groups: isObject(object.groups) + ? Object.entries(object.groups).reduce<{ [key: string]: PenetrationGroup }>((acc, [key, value]) => { + acc[key] = PenetrationGroup.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: TankArmor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.groups) { + const entries = Object.entries(message.groups); + if (entries.length > 0) { + obj.groups = {}; + entries.forEach(([k, v]) => { + obj.groups[k] = PenetrationGroup.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): TankArmor { + return TankArmor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TankArmor { + const message = createBaseTankArmor(); + message.id = object.id ?? ""; + message.groups = Object.entries(object.groups ?? {}).reduce<{ [key: string]: PenetrationGroup }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = PenetrationGroup.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseTankArmor_GroupsEntry(): TankArmor_GroupsEntry { + return { key: "", value: createBasePenetrationGroup() }; +} + +export const TankArmor_GroupsEntry: MessageFns = { + encode(message: TankArmor_GroupsEntry, 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): TankArmor_GroupsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTankArmor_GroupsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = PenetrationGroup.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankArmor_GroupsEntry { + return { + key: globalThis.String(assertSet("TankArmor_GroupsEntry.key", object.key)), + value: PenetrationGroup.fromJSON(assertSet("TankArmor_GroupsEntry.value", object.value)), + }; + }, + + toJSON(message: TankArmor_GroupsEntry): 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): TankArmor_GroupsEntry { + return TankArmor_GroupsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TankArmor_GroupsEntry { + const message = createBaseTankArmor_GroupsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? PenetrationGroup.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBasePenetrationGroup(): PenetrationGroup { + return { armors: {} }; +} + +export const PenetrationGroup: MessageFns = { + encode(message: PenetrationGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.armors).forEach(([key, value]) => { + PenetrationGroup_ArmorsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PenetrationGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePenetrationGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + const entry1 = PenetrationGroup_ArmorsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.armors[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PenetrationGroup { + return { + armors: isObject(object.armors) + ? Object.entries(object.armors).reduce<{ [key: string]: ArmorPlate }>((acc, [key, value]) => { + acc[key] = ArmorPlate.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: PenetrationGroup): unknown { + const obj: any = {}; + if (message.armors) { + const entries = Object.entries(message.armors); + if (entries.length > 0) { + obj.armors = {}; + entries.forEach(([k, v]) => { + obj.armors[k] = ArmorPlate.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): PenetrationGroup { + return PenetrationGroup.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PenetrationGroup { + const message = createBasePenetrationGroup(); + message.armors = Object.entries(object.armors ?? {}).reduce<{ [key: string]: ArmorPlate }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ArmorPlate.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBasePenetrationGroup_ArmorsEntry(): PenetrationGroup_ArmorsEntry { + return { key: "", value: createBaseArmorPlate() }; +} + +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) { + ArmorPlate.encode(message.value, writer.uint32(18).fork()).join(); + } + 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 !== 18) { + break; + } + + message.value = ArmorPlate.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PenetrationGroup_ArmorsEntry { + return { + key: globalThis.String(assertSet("PenetrationGroup_ArmorsEntry.key", object.key)), + value: ArmorPlate.fromJSON(assertSet("PenetrationGroup_ArmorsEntry.value", object.value)), + }; + }, + + toJSON(message: PenetrationGroup_ArmorsEntry): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ArmorPlate.toJSON(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 !== undefined && object.value !== null) + ? ArmorPlate.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseArmorPlate(): ArmorPlate { + return { thickness: 0, type: "" }; +} + +export const ArmorPlate: MessageFns = { + encode(message: ArmorPlate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.thickness !== 0) { + writer.uint32(13).float(message.thickness); + } + if (message.type !== "") { + writer.uint32(18).string(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ArmorPlate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseArmorPlate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.thickness = reader.float(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.type = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ArmorPlate { + return { + thickness: globalThis.Number(assertSet("ArmorPlate.thickness", object.thickness)), + type: globalThis.String(assertSet("ArmorPlate.type", object.type)), + }; + }, + + toJSON(message: ArmorPlate): unknown { + const obj: any = {}; + if (message.thickness !== 0) { + obj.thickness = message.thickness; + } + if (message.type !== "") { + obj.type = message.type; + } + return obj; + }, + + create, I>>(base?: I): ArmorPlate { + return ArmorPlate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ArmorPlate { + const message = createBaseArmorPlate(); + message.thickness = object.thickness ?? 0; + message.type = object.type ?? ""; + 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 }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +function assertSet(field: string, value: T | undefined): T { + if (!isSet(value)) { + throw new TypeError(`Required field ${field} is not set`); + } + + return value as T; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/packages/website/src/pages/[...locale]/tools/compare/_index.tsx b/packages/preforged/tools/compare/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/compare/_index.tsx rename to packages/preforged/tools/compare/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/compare/index.astro b/packages/preforged/tools/compare/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/compare/index.astro rename to packages/preforged/tools/compare/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/embed/[embed]/_index.tsx b/packages/preforged/tools/embed/[embed]/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/embed/[embed]/_index.tsx rename to packages/preforged/tools/embed/[embed]/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/embed/[embed]/host/_index.tsx b/packages/preforged/tools/embed/[embed]/host/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/embed/[embed]/host/_index.tsx rename to packages/preforged/tools/embed/[embed]/host/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/embed/[embed]/host/index.astro b/packages/preforged/tools/embed/[embed]/host/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/embed/[embed]/host/index.astro rename to packages/preforged/tools/embed/[embed]/host/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/embed/[embed]/index.astro b/packages/preforged/tools/embed/[embed]/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/embed/[embed]/index.astro rename to packages/preforged/tools/embed/[embed]/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/embed/_index.tsx b/packages/preforged/tools/embed/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/embed/_index.tsx rename to packages/preforged/tools/embed/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/embed/index.astro b/packages/preforged/tools/embed/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/embed/index.astro rename to packages/preforged/tools/embed/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/gallery/_index.tsx b/packages/preforged/tools/gallery/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/gallery/_index.tsx rename to packages/preforged/tools/gallery/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/gallery/index.astro b/packages/preforged/tools/gallery/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/gallery/index.astro rename to packages/preforged/tools/gallery/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/performance/_index.tsx b/packages/preforged/tools/performance/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/performance/_index.tsx rename to packages/preforged/tools/performance/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/performance/index.astro b/packages/preforged/tools/performance/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/performance/index.astro rename to packages/preforged/tools/performance/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/session/_index.tsx b/packages/preforged/tools/session/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/session/_index.tsx rename to packages/preforged/tools/session/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/session/index.astro b/packages/preforged/tools/session/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/session/index.astro rename to packages/preforged/tools/session/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/tankopedia/[id]/_index.tsx b/packages/preforged/tools/tankopedia/[id]/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/tankopedia/[id]/_index.tsx rename to packages/preforged/tools/tankopedia/[id]/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/tankopedia/[id]/index.astro b/packages/preforged/tools/tankopedia/[id]/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/tankopedia/[id]/index.astro rename to packages/preforged/tools/tankopedia/[id]/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/tankopedia/_index.tsx b/packages/preforged/tools/tankopedia/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/tankopedia/_index.tsx rename to packages/preforged/tools/tankopedia/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/tankopedia/index.astro b/packages/preforged/tools/tankopedia/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/tankopedia/index.astro rename to packages/preforged/tools/tankopedia/index.astro diff --git a/packages/website/src/pages/[...locale]/tools/tier-list/_index.tsx b/packages/preforged/tools/tier-list/_index.tsx similarity index 100% rename from packages/website/src/pages/[...locale]/tools/tier-list/_index.tsx rename to packages/preforged/tools/tier-list/_index.tsx diff --git a/packages/website/src/pages/[...locale]/tools/tier-list/index.astro b/packages/preforged/tools/tier-list/index.astro similarity index 100% rename from packages/website/src/pages/[...locale]/tools/tier-list/index.astro rename to packages/preforged/tools/tier-list/index.astro diff --git a/packages/website/src/components/ArmorGroup.tsx b/packages/website/src/components/ArmorGroup.tsx new file mode 100644 index 000000000..cdc417343 --- /dev/null +++ b/packages/website/src/components/ArmorGroup.tsx @@ -0,0 +1,42 @@ +import { asset, type Tank } from '@blitzkit/core'; +import { useLoader } from '@react-three/fiber'; +import { Material, MeshBasicMaterial } from 'three'; +import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; +import { randInt } from 'three/src/math/MathUtils.js'; +import { jsxTree } from '../core/blitzkit/jsxTree'; + +interface ArmorGroupProps { + tank: Tank; + group: string; +} + +export function ArmorGroup({ tank, group }: ArmorGroupProps) { + const gltf = useLoader( + GLTFLoader, + asset(`/tanks/${tank.id}/collision/hull.glb`), + ); + + return jsxTree(gltf.scene, { + mesh: (mesh) => { + return { + material: new MeshBasicMaterial({ + color: `rgb(${randInt(0, 255)}, ${randInt(0, 255)}, ${randInt( + 0, + 255, + )})`, + }), + onClick: (event) => { + if (!(mesh.material instanceof Material)) return; + + event.stopPropagation(); + + const armorName = mesh.material.name; + const penetrationGroup = tank.penetration_groups[group]; + const thickness = penetrationGroup.armors[armorName]; + + console.log(tank.id, armorName, penetrationGroup, thickness); + }, + }; + }, + }); +} diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx b/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx index 2f3b972e7..f529f0766 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/_index.tsx @@ -1,16 +1,13 @@ -import { asset } from '@blitzkit/core'; +import { Tank } from '@blitzkit/core'; import { OrbitControls } from '@react-three/drei'; -import { Canvas, useLoader } from '@react-three/fiber'; -import { MeshBasicMaterial } from 'three'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { randInt } from 'three/src/math/MathUtils.js'; -import { jsxTree } from '../../../../core/blitzkit/jsxTree'; +import { Canvas } from '@react-three/fiber'; +import { ArmorGroup } from '../../../../components/ArmorGroup'; interface PageProps { - id: string; + tank: Tank; } -export function Page({ id }: PageProps) { +export function Page({ tank }: PageProps) { return ( - + ); } - -function Model({ id }: { id: string }) { - const gltf = useLoader(GLTFLoader, asset(`/tanks/${id}/collision/hull.glb`)); - - console.log(gltf); - - return jsxTree(gltf.scene, { - mesh: (mesh) => ({ - material: new MeshBasicMaterial({ - color: `rgb(${randInt(0, 255)}, ${randInt(0, 255)}, ${randInt( - 0, - 255, - )})`, - }), - onClick: (event) => { - if (!(mesh.material instanceof MeshBasicMaterial)) return; - event.stopPropagation(); - console.log(mesh.material.name) - }, - }), - }); -} diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro index 0b9a5c0d4..17d2f0150 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro @@ -1,4 +1,5 @@ --- +import { fetchTank } from '@blitzkit/core'; import type { GetStaticPaths } from 'astro'; import { awaitableTanksFull } from '../../../../core/awaitables/tanksFull'; import BaseLayout from '../../../../layouts/BaseLayout.astro'; @@ -20,8 +21,9 @@ export const getStaticPaths = (async () => { }) satisfies GetStaticPaths; const { id } = Astro.props; +const tank = await fetchTank(id); --- - + diff --git a/src/BlitzKit.CLI/Functions/Mangler.cs b/src/BlitzKit.CLI/Functions/Mangler.cs index 3624eac66..133478331 100644 --- a/src/BlitzKit.CLI/Functions/Mangler.cs +++ b/src/BlitzKit.CLI/Functions/Mangler.cs @@ -1,9 +1,11 @@ using System.Text.Json; using System.Text.RegularExpressions; +using System.Threading.Tasks; using Blitzkit; using BlitzKit.CLI.Models; using BlitzKit.CLI.Quicktype.Locales; using BlitzKit.CLI.Utils; +using CUE4Parse.MappingsProvider; using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports.Engine; using CUE4Parse.UE4.Assets.Exports.StaticMesh; @@ -223,6 +225,7 @@ namespace BlitzKit.CLI.Functions // await MangleHull(pda); // await MangleIcon(pda); + await MangleArmor(pda); Tank tank = new() { @@ -231,48 +234,52 @@ namespace BlitzKit.CLI.Functions Slug = slug, }; - tank.PenetrationGroups.MergeFrom(MangleArmor(pda)); - return tank; } - MapField MangleArmor(UObject pda) + async Task MangleArmor(UObject pda) { var id = PropertyUtil.Get(pda, "TankId").Text; - MapField groups = []; + TankArmor tankArmor = new(); var attributes = PropertyUtil.Get(pda, "DA_Attributes"); PropertyUtil.TryGet(attributes, "PenetrationGroups", out var penetrationGroups); if (penetrationGroups == null) { - PrettyLog.Warn($"Penetration groups missing for {id}; returning empty list"); - return groups; + PrettyLog.Warn($"Penetration groups missing for {id}; creating empty list"); } - - foreach (var group in penetrationGroups.Properties) + else { - var rawName = ((FName)group.Key.GenericValue!).Text; - var name = PenetrationGroupNameMap[rawName]; - var armors = PropertyUtil.Get( - group.Value!.GetValue()!, - "PenetrationGroups" - ); - PenetrationGroup penetrationGroup = new(); - - foreach (var armorProperty in armors.Properties) + foreach (var group in penetrationGroups.Properties) { - var armorName = ((FName)armorProperty.Key.GenericValue!).Text; - var armorThickness = PropertyUtil.Get( - armorProperty.Value!.GetValue()!, - "Armor" + var rawName = ((FName)group.Key.GenericValue!).Text; + var name = PenetrationGroupNameMap[rawName]; + var armors = PropertyUtil.Get( + group.Value!.GetValue()!, + "PenetrationGroups" ); - penetrationGroup.Armors[armorName] = armorThickness; - } + PenetrationGroup penetrationGroup = new(); - groups[name] = penetrationGroup; + foreach (var armorProperty in armors.Properties) + { + var armorName = ((FName)armorProperty.Key.GenericValue!).Text; + var armorProperties = armorProperty.Value!.GetValue()!; + var thickness = PropertyUtil.Get(armorProperties, "Armor"); + var commonData = PropertyUtil.Get(armorProperties, "CommonData"); + var rowName = PropertyUtil.Get(commonData, "RowName"); + + penetrationGroup.Armors[armorName] = new() + { + Thickness = thickness, + Type = rowName.Text, + }; + } + + tankArmor.Groups[name] = penetrationGroup; + } } - return groups; + await assetUploader.Add(new($"tanks/{id}/armor.pb", tankArmor.ToByteArray())); } async Task MangleIcon(UObject pda) diff --git a/src/BlitzKit.CLI/Protos/Tank.cs b/src/BlitzKit.CLI/Protos/Tank.cs index d28b79d3a..320f68f76 100644 --- a/src/BlitzKit.CLI/Protos/Tank.cs +++ b/src/BlitzKit.CLI/Protos/Tank.cs @@ -25,20 +25,13 @@ namespace Blitzkit { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90bxIIYmxpdHpr", - "aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvItcBCgRU", - "YW5rEgoKAmlkGAEgAigJEgwKBHNsdWcYAiACKAkSHAoEbmFtZRgDIAIoCzIO", - "LmJsaXR6a2l0LkkxOG4SQQoScGVuZXRyYXRpb25fZ3JvdXBzGAQgAygLMiUu", - "YmxpdHpraXQuVGFuay5QZW5ldHJhdGlvbkdyb3Vwc0VudHJ5GlQKFlBlbmV0", - "cmF0aW9uR3JvdXBzRW50cnkSCwoDa2V5GAEgASgJEikKBXZhbHVlGAIgASgL", - "MhouYmxpdHpraXQuUGVuZXRyYXRpb25Hcm91cDoCOAEieQoQUGVuZXRyYXRp", - "b25Hcm91cBI2CgZhcm1vcnMYASADKAsyJi5ibGl0emtpdC5QZW5ldHJhdGlv", - "bkdyb3VwLkFybW9yc0VudHJ5Gi0KC0FybW9yc0VudHJ5EgsKA2tleRgBIAEo", - "CRINCgV2YWx1ZRgCIAEoAjoCOAE=")); + "aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvIj4KBFRh", + "bmsSCgoCaWQYASACKAkSDAoEc2x1ZxgCIAIoCRIcCgRuYW1lGAMgAigLMg4u", + "YmxpdHpraXQuSTE4bg==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Blitzkit.I18NReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "Slug", "Name", "PenetrationGroups" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.PenetrationGroup), global::Blitzkit.PenetrationGroup.Parser, new[]{ "Armors" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }) + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "Slug", "Name" }, null, null, null, null) })); } #endregion @@ -83,7 +76,6 @@ namespace Blitzkit { id_ = other.id_; slug_ = other.slug_; name_ = other.name_ != null ? other.name_.Clone() : null; - penetrationGroups_ = other.penetrationGroups_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -157,20 +149,6 @@ namespace Blitzkit { } } - /// Field number for the "penetration_groups" field. - public const int PenetrationGroupsFieldNumber = 4; - private static readonly pbc::MapField.Codec _map_penetrationGroups_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.PenetrationGroup.Parser), 34); - private readonly pbc::MapField penetrationGroups_ = new pbc::MapField(); - /// - /// key can only ever be "chassis", "hull", "turret", or "gun" - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::MapField PenetrationGroups { - get { return penetrationGroups_; } - } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -189,7 +167,6 @@ namespace Blitzkit { if (Id != other.Id) return false; if (Slug != other.Slug) return false; if (!object.Equals(Name, other.Name)) return false; - if (!PenetrationGroups.Equals(other.PenetrationGroups)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -200,7 +177,6 @@ namespace Blitzkit { if (HasId) hash ^= Id.GetHashCode(); if (HasSlug) hash ^= Slug.GetHashCode(); if (name_ != null) hash ^= Name.GetHashCode(); - hash ^= PenetrationGroups.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -231,7 +207,6 @@ namespace Blitzkit { output.WriteRawTag(26); output.WriteMessage(Name); } - penetrationGroups_.WriteTo(output, _map_penetrationGroups_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -254,7 +229,6 @@ namespace Blitzkit { output.WriteRawTag(26); output.WriteMessage(Name); } - penetrationGroups_.WriteTo(ref output, _map_penetrationGroups_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -274,7 +248,6 @@ namespace Blitzkit { if (name_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name); } - size += penetrationGroups_.CalculateSize(_map_penetrationGroups_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -299,7 +272,6 @@ namespace Blitzkit { } Name.MergeFrom(other.Name); } - penetrationGroups_.MergeFrom(other.penetrationGroups_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -334,10 +306,6 @@ namespace Blitzkit { input.ReadMessage(Name); break; } - case 34: { - penetrationGroups_.AddEntriesFrom(input, _map_penetrationGroups_codec); - break; - } } } #endif @@ -372,197 +340,6 @@ namespace Blitzkit { input.ReadMessage(Name); break; } - case 34: { - penetrationGroups_.AddEntriesFrom(ref input, _map_penetrationGroups_codec); - break; - } - } - } - } - #endif - - } - - [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] - public sealed partial class PenetrationGroup : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PenetrationGroup()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Blitzkit.TankReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PenetrationGroup() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PenetrationGroup(PenetrationGroup other) : this() { - armors_ = other.armors_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PenetrationGroup Clone() { - return new PenetrationGroup(this); - } - - /// Field number for the "armors" field. - public const int ArmorsFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_armors_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForFloat(21, 0F), 10); - private readonly pbc::MapField armors_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::MapField Armors { - get { return armors_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PenetrationGroup); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PenetrationGroup other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Armors.Equals(other.Armors)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - hash ^= Armors.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - armors_.WriteTo(output, _map_armors_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - armors_.WriteTo(ref output, _map_armors_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - size += armors_.CalculateSize(_map_armors_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PenetrationGroup other) { - if (other == null) { - return; - } - armors_.MergeFrom(other.armors_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - if ((tag & 7) == 4) { - // Abort on any end group tag. - return; - } - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - armors_.AddEntriesFrom(input, _map_armors_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - if ((tag & 7) == 4) { - // Abort on any end group tag. - return; - } - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - armors_.AddEntriesFrom(ref input, _map_armors_codec); - break; - } } } } diff --git a/src/BlitzKit.CLI/Protos/TankArmor.cs b/src/BlitzKit.CLI/Protos/TankArmor.cs new file mode 100644 index 000000000..3f85fa07f --- /dev/null +++ b/src/BlitzKit.CLI/Protos/TankArmor.cs @@ -0,0 +1,759 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: packages/core/src/protos/tank_armor.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Blitzkit { + + /// Holder for reflection information generated from packages/core/src/protos/tank_armor.proto + public static partial class TankArmorReflection { + + #region Descriptor + /// File descriptor for packages/core/src/protos/tank_armor.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static TankArmorReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CilwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFua19hcm1vci5wcm90bxII", + "YmxpdHpraXQikwEKCVRhbmtBcm1vchIKCgJpZBgBIAIoCRIvCgZncm91cHMY", + "BCADKAsyHy5ibGl0emtpdC5UYW5rQXJtb3IuR3JvdXBzRW50cnkaSQoLR3Jv", + "dXBzRW50cnkSCwoDa2V5GAEgASgJEikKBXZhbHVlGAIgASgLMhouYmxpdHpr", + "aXQuUGVuZXRyYXRpb25Hcm91cDoCOAEijwEKEFBlbmV0cmF0aW9uR3JvdXAS", + "NgoGYXJtb3JzGAEgAygLMiYuYmxpdHpraXQuUGVuZXRyYXRpb25Hcm91cC5B", + "cm1vcnNFbnRyeRpDCgtBcm1vcnNFbnRyeRILCgNrZXkYASABKAkSIwoFdmFs", + "dWUYAiABKAsyFC5ibGl0emtpdC5Bcm1vclBsYXRlOgI4ASItCgpBcm1vclBs", + "YXRlEhEKCXRoaWNrbmVzcxgBIAIoAhIMCgR0eXBlGAIgAigJ")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.TankArmor), global::Blitzkit.TankArmor.Parser, new[]{ "Id", "Groups" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.PenetrationGroup), global::Blitzkit.PenetrationGroup.Parser, new[]{ "Armors" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.ArmorPlate), global::Blitzkit.ArmorPlate.Parser, new[]{ "Thickness", "Type" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TankArmor : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TankArmor()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Blitzkit.TankArmorReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TankArmor() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TankArmor(TankArmor other) : this() { + id_ = other.id_; + groups_ = other.groups_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TankArmor Clone() { + return new TankArmor(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private readonly static string IdDefaultValue = ""; + + private string id_; + /// + /// tank id + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Id { + get { return id_ ?? IdDefaultValue; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// Gets whether the "id" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasId { + get { return id_ != null; } + } + /// Clears the value of the "id" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearId() { + id_ = null; + } + + /// Field number for the "groups" field. + public const int GroupsFieldNumber = 4; + private static readonly pbc::MapField.Codec _map_groups_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.PenetrationGroup.Parser), 34); + private readonly pbc::MapField groups_ = new pbc::MapField(); + /// + /// key can only ever be "chassis", "hull", "turret", or "gun" + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField Groups { + get { return groups_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TankArmor); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TankArmor other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!Groups.Equals(other.Groups)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HasId) hash ^= Id.GetHashCode(); + hash ^= Groups.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HasId) { + output.WriteRawTag(10); + output.WriteString(Id); + } + groups_.WriteTo(output, _map_groups_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HasId) { + output.WriteRawTag(10); + output.WriteString(Id); + } + groups_.WriteTo(ref output, _map_groups_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HasId) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + size += groups_.CalculateSize(_map_groups_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TankArmor other) { + if (other == null) { + return; + } + if (other.HasId) { + Id = other.Id; + } + groups_.MergeFrom(other.groups_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 34: { + groups_.AddEntriesFrom(input, _map_groups_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 34: { + groups_.AddEntriesFrom(ref input, _map_groups_codec); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class PenetrationGroup : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PenetrationGroup()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Blitzkit.TankArmorReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PenetrationGroup() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PenetrationGroup(PenetrationGroup other) : this() { + armors_ = other.armors_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PenetrationGroup Clone() { + return new PenetrationGroup(this); + } + + /// Field number for the "armors" field. + public const int ArmorsFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_armors_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.ArmorPlate.Parser), 10); + private readonly pbc::MapField armors_ = new pbc::MapField(); + /// + /// keys are mostly "armor_xyz" where xyz is an integer but sometimes can be + /// things like "commander", "rightTrack", etc. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField Armors { + get { return armors_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PenetrationGroup); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PenetrationGroup other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Armors.Equals(other.Armors)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= Armors.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + armors_.WriteTo(output, _map_armors_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + armors_.WriteTo(ref output, _map_armors_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += armors_.CalculateSize(_map_armors_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PenetrationGroup other) { + if (other == null) { + return; + } + armors_.MergeFrom(other.armors_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + armors_.AddEntriesFrom(input, _map_armors_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + armors_.AddEntriesFrom(ref input, _map_armors_codec); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class ArmorPlate : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ArmorPlate()); + private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Blitzkit.TankArmorReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ArmorPlate() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ArmorPlate(ArmorPlate other) : this() { + _hasBits0 = other._hasBits0; + thickness_ = other.thickness_; + type_ = other.type_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ArmorPlate Clone() { + return new ArmorPlate(this); + } + + /// Field number for the "thickness" field. + public const int ThicknessFieldNumber = 1; + private readonly static float ThicknessDefaultValue = 0F; + + private float thickness_; + /// + /// this is the thickness of the armor in millimeters + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float Thickness { + get { if ((_hasBits0 & 1) != 0) { return thickness_; } else { return ThicknessDefaultValue; } } + set { + _hasBits0 |= 1; + thickness_ = value; + } + } + /// Gets whether the "thickness" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasThickness { + get { return (_hasBits0 & 1) != 0; } + } + /// Clears the value of the "thickness" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearThickness() { + _hasBits0 &= ~1; + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 2; + private readonly static string TypeDefaultValue = ""; + + private string type_; + /// + /// this can be stuff like ArmorScreen which is spaced armor, FuelTank, etc. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Type { + get { return type_ ?? TypeDefaultValue; } + set { + type_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// Gets whether the "type" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasType { + get { return type_ != null; } + } + /// Clears the value of the "type" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearType() { + type_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ArmorPlate); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ArmorPlate other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Thickness, other.Thickness)) return false; + if (Type != other.Type) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (HasThickness) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Thickness); + if (HasType) hash ^= Type.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (HasThickness) { + output.WriteRawTag(13); + output.WriteFloat(Thickness); + } + if (HasType) { + output.WriteRawTag(18); + output.WriteString(Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HasThickness) { + output.WriteRawTag(13); + output.WriteFloat(Thickness); + } + if (HasType) { + output.WriteRawTag(18); + output.WriteString(Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (HasThickness) { + size += 1 + 4; + } + if (HasType) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Type); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ArmorPlate other) { + if (other == null) { + return; + } + if (other.HasThickness) { + Thickness = other.Thickness; + } + if (other.HasType) { + Type = other.Type; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 13: { + Thickness = input.ReadFloat(); + break; + } + case 18: { + Type = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 13: { + Thickness = input.ReadFloat(); + break; + } + case 18: { + Type = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code