feat: separate armors

This commit is contained in:
tresabhi committed 2025-03-20 11:59:24 -05:00
1 parent 30b18f60be
commit e60bbc03d2
31 files changed
+1387 -690

No files matched your search

+2 -1
View File
@@ -14,4 +14,5 @@ export * from './legacy_skill_definitions.ts';
export * from './legacy_tank_definitions.ts'; export * from './legacy_tank_definitions.ts';
export * from './reviews.ts'; export * from './reviews.ts';
export * from './tank.ts'; export * from './tank.ts';
export * from './tanks.ts'; export * from './tanks.ts';
export * from './tank_armor.ts';
-8
View File
@@ -8,12 +8,4 @@ message Tank {
required string id = 1; required string id = 1;
required string slug = 2; required string slug = 2;
required I18n name = 3; required I18n name = 3;
// key can only ever be "chassis", "hull", "turret", or "gun"
map<string, PenetrationGroup> 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<string, float> armors = 1;
}
+27 -397
View File
@@ -5,63 +5,37 @@
// source: packages/core/src/protos/tank.proto // source: packages/core/src/protos/tank.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18n, createBaseI18n } from './i18n'; import { I18n, createBaseI18n } from "./i18n";
export const protobufPackage = 'blitzkit'; export const protobufPackage = "blitzkit";
export interface Tank { export interface Tank {
id: string; id: string;
slug: string; slug: string;
name: I18n; 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 { function createBaseTank(): Tank {
return { id: '', slug: '', name: createBaseI18n(), penetration_groups: {} }; return { id: "", slug: "", name: createBaseI18n() };
} }
export const Tank: MessageFns<Tank> = { export const Tank: MessageFns<Tank> = {
encode( encode(message: Tank, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
message: Tank, if (message.id !== "") {
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.id !== '') {
writer.uint32(10).string(message.id); writer.uint32(10).string(message.id);
} }
if (message.slug !== '') { if (message.slug !== "") {
writer.uint32(18).string(message.slug); writer.uint32(18).string(message.slug);
} }
if (message.name !== undefined) { if (message.name !== undefined) {
I18n.encode(message.name, writer.uint32(26).fork()).join(); 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; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): Tank { decode(input: BinaryReader | Uint8Array, length?: number): Tank {
const reader = const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTank(); const message = createBaseTank();
while (reader.pos < end) { while (reader.pos < end) {
@@ -91,20 +65,6 @@ export const Tank: MessageFns<Tank> = {
message.name = I18n.decode(reader, reader.uint32()); message.name = I18n.decode(reader, reader.uint32());
continue; 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) { if ((tag & 7) === 4 || tag === 0) {
break; break;
@@ -116,40 +76,23 @@ export const Tank: MessageFns<Tank> = {
fromJSON(object: any): Tank { fromJSON(object: any): Tank {
return { return {
id: globalThis.String(assertSet('Tank.id', object.id)), id: globalThis.String(assertSet("Tank.id", object.id)),
slug: globalThis.String(assertSet('Tank.slug', object.slug)), slug: globalThis.String(assertSet("Tank.slug", object.slug)),
name: I18n.fromJSON(assertSet('Tank.name', object.name)), 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;
}, {})
: {},
}; };
}, },
toJSON(message: Tank): unknown { toJSON(message: Tank): unknown {
const obj: any = {}; const obj: any = {};
if (message.id !== '') { if (message.id !== "") {
obj.id = message.id; obj.id = message.id;
} }
if (message.slug !== '') { if (message.slug !== "") {
obj.slug = message.slug; obj.slug = message.slug;
} }
if (message.name !== undefined) { if (message.name !== undefined) {
obj.name = I18n.toJSON(message.name); 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; return obj;
}, },
@@ -158,340 +101,27 @@ export const Tank: MessageFns<Tank> = {
}, },
fromPartial<I extends Exact<DeepPartial<Tank>, I>>(object: I): Tank { fromPartial<I extends Exact<DeepPartial<Tank>, I>>(object: I): Tank {
const message = createBaseTank(); const message = createBaseTank();
message.id = object.id ?? ''; message.id = object.id ?? "";
message.slug = object.slug ?? ''; message.slug = object.slug ?? "";
message.name = message.name = (object.name !== undefined && object.name !== null)
object.name !== undefined && object.name !== null ? I18n.fromPartial(object.name)
? I18n.fromPartial(object.name) : createBaseI18n();
: createBaseI18n();
message.penetration_groups = Object.entries(
object.penetration_groups ?? {},
).reduce<{ [key: string]: PenetrationGroup }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = PenetrationGroup.fromPartial(value);
}
return acc;
}, {});
return message; return message;
}, },
}; };
function createBaseTank_PenetrationGroupsEntry(): Tank_PenetrationGroupsEntry { type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
return { key: '', value: createBasePenetrationGroup() };
}
export const Tank_PenetrationGroupsEntry: MessageFns<Tank_PenetrationGroupsEntry> = export type DeepPartial<T> = T extends Builtin ? T
{ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
encode( : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
message: Tank_PenetrationGroupsEntry, : T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
writer: BinaryWriter = new BinaryWriter(), : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
): BinaryWriter { : Partial<T>;
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 extends Exact<DeepPartial<Tank_PenetrationGroupsEntry>, I>>(
base?: I,
): Tank_PenetrationGroupsEntry {
return Tank_PenetrationGroupsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Tank_PenetrationGroupsEntry>, 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<PenetrationGroup> = {
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 extends Exact<DeepPartial<PenetrationGroup>, I>>(
base?: I,
): PenetrationGroup {
return PenetrationGroup.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PenetrationGroup>, 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<PenetrationGroup_ArmorsEntry> =
{
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 extends Exact<DeepPartial<PenetrationGroup_ArmorsEntry>, I>>(
base?: I,
): PenetrationGroup_ArmorsEntry {
return PenetrationGroup_ArmorsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PenetrationGroup_ArmorsEntry>, 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> = T extends Builtin
? T
: T extends globalThis.Array<infer U>
? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never; type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin export type Exact<P, I extends P> = P extends Builtin ? P
? P : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean {
return typeof value === 'object' && value !== null;
}
function isSet(value: any): boolean { function isSet(value: any): boolean {
return value !== null && value !== undefined; return value !== null && value !== undefined;
+23
View File
@@ -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<string, PenetrationGroup> groups = 4;
}
message PenetrationGroup {
// keys are mostly "armor_xyz" where xyz is an integer but sometimes can be
// things like "commander", "rightTrack", etc.
map<string, ArmorPlate> 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;
}
+489
View File
@@ -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<TankArmor> = {
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 extends Exact<DeepPartial<TankArmor>, I>>(base?: I): TankArmor {
return TankArmor.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankArmor>, 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<TankArmor_GroupsEntry> = {
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 extends Exact<DeepPartial<TankArmor_GroupsEntry>, I>>(base?: I): TankArmor_GroupsEntry {
return TankArmor_GroupsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankArmor_GroupsEntry>, 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<PenetrationGroup> = {
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 extends Exact<DeepPartial<PenetrationGroup>, I>>(base?: I): PenetrationGroup {
return PenetrationGroup.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PenetrationGroup>, 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<PenetrationGroup_ArmorsEntry> = {
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 extends Exact<DeepPartial<PenetrationGroup_ArmorsEntry>, I>>(base?: I): PenetrationGroup_ArmorsEntry {
return PenetrationGroup_ArmorsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PenetrationGroup_ArmorsEntry>, 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<ArmorPlate> = {
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 extends Exact<DeepPartial<ArmorPlate>, I>>(base?: I): ArmorPlate {
return ArmorPlate.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ArmorPlate>, 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> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(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<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
@@ -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);
},
};
},
});
}
@@ -1,16 +1,13 @@
import { asset } from '@blitzkit/core'; import { Tank } from '@blitzkit/core';
import { OrbitControls } from '@react-three/drei'; import { OrbitControls } from '@react-three/drei';
import { Canvas, useLoader } from '@react-three/fiber'; import { Canvas } from '@react-three/fiber';
import { MeshBasicMaterial } from 'three'; import { ArmorGroup } from '../../../../components/ArmorGroup';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { randInt } from 'three/src/math/MathUtils.js';
import { jsxTree } from '../../../../core/blitzkit/jsxTree';
interface PageProps { interface PageProps {
id: string; tank: Tank;
} }
export function Page({ id }: PageProps) { export function Page({ tank }: PageProps) {
return ( return (
<Canvas <Canvas
style={{ style={{
@@ -19,29 +16,7 @@ export function Page({ id }: PageProps) {
}} }}
> >
<OrbitControls /> <OrbitControls />
<Model id={id} /> <ArmorGroup group="hull" tank={tank} />
</Canvas> </Canvas>
); );
} }
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)
},
}),
});
}
@@ -1,4 +1,5 @@
--- ---
import { fetchTank } from '@blitzkit/core';
import type { GetStaticPaths } from 'astro'; import type { GetStaticPaths } from 'astro';
import { awaitableTanksFull } from '../../../../core/awaitables/tanksFull'; import { awaitableTanksFull } from '../../../../core/awaitables/tanksFull';
import BaseLayout from '../../../../layouts/BaseLayout.astro'; import BaseLayout from '../../../../layouts/BaseLayout.astro';
@@ -20,8 +21,9 @@ export const getStaticPaths = (async () => {
}) satisfies GetStaticPaths; }) satisfies GetStaticPaths;
const { id } = Astro.props; const { id } = Astro.props;
const tank = await fetchTank(id);
--- ---
<BaseLayout> <BaseLayout>
<Page {id} client:load /> <Page {tank} client:load />
</BaseLayout> </BaseLayout>
+32 -25
View File
@@ -1,9 +1,11 @@
using System.Text.Json; using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Blitzkit; using Blitzkit;
using BlitzKit.CLI.Models; using BlitzKit.CLI.Models;
using BlitzKit.CLI.Quicktype.Locales; using BlitzKit.CLI.Quicktype.Locales;
using BlitzKit.CLI.Utils; using BlitzKit.CLI.Utils;
using CUE4Parse.MappingsProvider;
using CUE4Parse.UE4.Assets.Exports; using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Exports.Engine; using CUE4Parse.UE4.Assets.Exports.Engine;
using CUE4Parse.UE4.Assets.Exports.StaticMesh; using CUE4Parse.UE4.Assets.Exports.StaticMesh;
@@ -223,6 +225,7 @@ namespace BlitzKit.CLI.Functions
// await MangleHull(pda); // await MangleHull(pda);
// await MangleIcon(pda); // await MangleIcon(pda);
await MangleArmor(pda);
Tank tank = new() Tank tank = new()
{ {
@@ -231,48 +234,52 @@ namespace BlitzKit.CLI.Functions
Slug = slug, Slug = slug,
}; };
tank.PenetrationGroups.MergeFrom(MangleArmor(pda));
return tank; return tank;
} }
MapField<string, PenetrationGroup> MangleArmor(UObject pda) async Task MangleArmor(UObject pda)
{ {
var id = PropertyUtil.Get<FName>(pda, "TankId").Text; var id = PropertyUtil.Get<FName>(pda, "TankId").Text;
MapField<string, PenetrationGroup> groups = []; TankArmor tankArmor = new();
var attributes = PropertyUtil.Get<UObject>(pda, "DA_Attributes"); var attributes = PropertyUtil.Get<UObject>(pda, "DA_Attributes");
PropertyUtil.TryGet<UScriptMap>(attributes, "PenetrationGroups", out var penetrationGroups); PropertyUtil.TryGet<UScriptMap>(attributes, "PenetrationGroups", out var penetrationGroups);
if (penetrationGroups == null) if (penetrationGroups == null)
{ {
PrettyLog.Warn($"Penetration groups missing for {id}; returning empty list"); PrettyLog.Warn($"Penetration groups missing for {id}; creating empty list");
return groups;
} }
else
foreach (var group in penetrationGroups.Properties)
{ {
var rawName = ((FName)group.Key.GenericValue!).Text; foreach (var group in penetrationGroups.Properties)
var name = PenetrationGroupNameMap[rawName];
var armors = PropertyUtil.Get<UScriptMap>(
group.Value!.GetValue<FStructFallback>()!,
"PenetrationGroups"
);
PenetrationGroup penetrationGroup = new();
foreach (var armorProperty in armors.Properties)
{ {
var armorName = ((FName)armorProperty.Key.GenericValue!).Text; var rawName = ((FName)group.Key.GenericValue!).Text;
var armorThickness = PropertyUtil.Get<float>( var name = PenetrationGroupNameMap[rawName];
armorProperty.Value!.GetValue<FStructFallback>()!, var armors = PropertyUtil.Get<UScriptMap>(
"Armor" group.Value!.GetValue<FStructFallback>()!,
"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<FStructFallback>()!;
var thickness = PropertyUtil.Get<float>(armorProperties, "Armor");
var commonData = PropertyUtil.Get<FStructFallback>(armorProperties, "CommonData");
var rowName = PropertyUtil.Get<FName>(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) async Task MangleIcon(UObject pda)
+4 -227
View File
@@ -25,20 +25,13 @@ namespace Blitzkit {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"CiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90bxIIYmxpdHpr", "CiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90bxIIYmxpdHpr",
"aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvItcBCgRU", "aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvIj4KBFRh",
"YW5rEgoKAmlkGAEgAigJEgwKBHNsdWcYAiACKAkSHAoEbmFtZRgDIAIoCzIO", "bmsSCgoCaWQYASACKAkSDAoEc2x1ZxgCIAIoCRIcCgRuYW1lGAMgAigLMg4u",
"LmJsaXR6a2l0LkkxOG4SQQoScGVuZXRyYXRpb25fZ3JvdXBzGAQgAygLMiUu", "YmxpdHpraXQuSTE4bg=="));
"YmxpdHpraXQuVGFuay5QZW5ldHJhdGlvbkdyb3Vwc0VudHJ5GlQKFlBlbmV0",
"cmF0aW9uR3JvdXBzRW50cnkSCwoDa2V5GAEgASgJEikKBXZhbHVlGAIgASgL",
"MhouYmxpdHpraXQuUGVuZXRyYXRpb25Hcm91cDoCOAEieQoQUGVuZXRyYXRp",
"b25Hcm91cBI2CgZhcm1vcnMYASADKAsyJi5ibGl0emtpdC5QZW5ldHJhdGlv",
"bkdyb3VwLkFybW9yc0VudHJ5Gi0KC0FybW9yc0VudHJ5EgsKA2tleRgBIAEo",
"CRINCgV2YWx1ZRgCIAEoAjoCOAE="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Blitzkit.I18NReflection.Descriptor, }, new pbr::FileDescriptor[] { global::Blitzkit.I18NReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 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.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "Slug", "Name" }, null, null, null, null)
new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.PenetrationGroup), global::Blitzkit.PenetrationGroup.Parser, new[]{ "Armors" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, })
})); }));
} }
#endregion #endregion
@@ -83,7 +76,6 @@ namespace Blitzkit {
id_ = other.id_; id_ = other.id_;
slug_ = other.slug_; slug_ = other.slug_;
name_ = other.name_ != null ? other.name_.Clone() : null; name_ = other.name_ != null ? other.name_.Clone() : null;
penetrationGroups_ = other.penetrationGroups_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
@@ -157,20 +149,6 @@ namespace Blitzkit {
} }
} }
/// <summary>Field number for the "penetration_groups" field.</summary>
public const int PenetrationGroupsFieldNumber = 4;
private static readonly pbc::MapField<string, global::Blitzkit.PenetrationGroup>.Codec _map_penetrationGroups_codec
= new pbc::MapField<string, global::Blitzkit.PenetrationGroup>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.PenetrationGroup.Parser), 34);
private readonly pbc::MapField<string, global::Blitzkit.PenetrationGroup> penetrationGroups_ = new pbc::MapField<string, global::Blitzkit.PenetrationGroup>();
/// <summary>
/// key can only ever be "chassis", "hull", "turret", or "gun"
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, global::Blitzkit.PenetrationGroup> PenetrationGroups {
get { return penetrationGroups_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
@@ -189,7 +167,6 @@ namespace Blitzkit {
if (Id != other.Id) return false; if (Id != other.Id) return false;
if (Slug != other.Slug) return false; if (Slug != other.Slug) return false;
if (!object.Equals(Name, other.Name)) return false; if (!object.Equals(Name, other.Name)) return false;
if (!PenetrationGroups.Equals(other.PenetrationGroups)) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@@ -200,7 +177,6 @@ namespace Blitzkit {
if (HasId) hash ^= Id.GetHashCode(); if (HasId) hash ^= Id.GetHashCode();
if (HasSlug) hash ^= Slug.GetHashCode(); if (HasSlug) hash ^= Slug.GetHashCode();
if (name_ != null) hash ^= Name.GetHashCode(); if (name_ != null) hash ^= Name.GetHashCode();
hash ^= PenetrationGroups.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
@@ -231,7 +207,6 @@ namespace Blitzkit {
output.WriteRawTag(26); output.WriteRawTag(26);
output.WriteMessage(Name); output.WriteMessage(Name);
} }
penetrationGroups_.WriteTo(output, _map_penetrationGroups_codec);
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
@@ -254,7 +229,6 @@ namespace Blitzkit {
output.WriteRawTag(26); output.WriteRawTag(26);
output.WriteMessage(Name); output.WriteMessage(Name);
} }
penetrationGroups_.WriteTo(ref output, _map_penetrationGroups_codec);
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
@@ -274,7 +248,6 @@ namespace Blitzkit {
if (name_ != null) { if (name_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name); size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name);
} }
size += penetrationGroups_.CalculateSize(_map_penetrationGroups_codec);
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
@@ -299,7 +272,6 @@ namespace Blitzkit {
} }
Name.MergeFrom(other.Name); Name.MergeFrom(other.Name);
} }
penetrationGroups_.MergeFrom(other.penetrationGroups_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
@@ -334,10 +306,6 @@ namespace Blitzkit {
input.ReadMessage(Name); input.ReadMessage(Name);
break; break;
} }
case 34: {
penetrationGroups_.AddEntriesFrom(input, _map_penetrationGroups_codec);
break;
}
} }
} }
#endif #endif
@@ -372,197 +340,6 @@ namespace Blitzkit {
input.ReadMessage(Name); input.ReadMessage(Name);
break; 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<PenetrationGroup>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PenetrationGroup> _parser = new pb::MessageParser<PenetrationGroup>(() => new PenetrationGroup());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<PenetrationGroup> 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);
}
/// <summary>Field number for the "armors" field.</summary>
public const int ArmorsFieldNumber = 1;
private static readonly pbc::MapField<string, float>.Codec _map_armors_codec
= new pbc::MapField<string, float>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForFloat(21, 0F), 10);
private readonly pbc::MapField<string, float> armors_ = new pbc::MapField<string, float>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, float> 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;
}
} }
} }
} }
+759
View File
@@ -0,0 +1,759 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: packages/core/src/protos/tank_armor.proto
// </auto-generated>
#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 {
/// <summary>Holder for reflection information generated from packages/core/src/protos/tank_armor.proto</summary>
public static partial class TankArmorReflection {
#region Descriptor
/// <summary>File descriptor for packages/core/src/protos/tank_armor.proto</summary>
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<TankArmor>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TankArmor> _parser = new pb::MessageParser<TankArmor>(() => new TankArmor());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<TankArmor> 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);
}
/// <summary>Field number for the "id" field.</summary>
public const int IdFieldNumber = 1;
private readonly static string IdDefaultValue = "";
private string id_;
/// <summary>
/// tank id
/// </summary>
[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");
}
}
/// <summary>Gets whether the "id" field is set</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool HasId {
get { return id_ != null; }
}
/// <summary>Clears the value of the "id" field</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void ClearId() {
id_ = null;
}
/// <summary>Field number for the "groups" field.</summary>
public const int GroupsFieldNumber = 4;
private static readonly pbc::MapField<string, global::Blitzkit.PenetrationGroup>.Codec _map_groups_codec
= new pbc::MapField<string, global::Blitzkit.PenetrationGroup>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.PenetrationGroup.Parser), 34);
private readonly pbc::MapField<string, global::Blitzkit.PenetrationGroup> groups_ = new pbc::MapField<string, global::Blitzkit.PenetrationGroup>();
/// <summary>
/// key can only ever be "chassis", "hull", "turret", or "gun"
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, global::Blitzkit.PenetrationGroup> 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<PenetrationGroup>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PenetrationGroup> _parser = new pb::MessageParser<PenetrationGroup>(() => new PenetrationGroup());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<PenetrationGroup> 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);
}
/// <summary>Field number for the "armors" field.</summary>
public const int ArmorsFieldNumber = 1;
private static readonly pbc::MapField<string, global::Blitzkit.ArmorPlate>.Codec _map_armors_codec
= new pbc::MapField<string, global::Blitzkit.ArmorPlate>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Blitzkit.ArmorPlate.Parser), 10);
private readonly pbc::MapField<string, global::Blitzkit.ArmorPlate> armors_ = new pbc::MapField<string, global::Blitzkit.ArmorPlate>();
/// <summary>
/// keys are mostly "armor_xyz" where xyz is an integer but sometimes can be
/// things like "commander", "rightTrack", etc.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, global::Blitzkit.ArmorPlate> 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<ArmorPlate>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ArmorPlate> _parser = new pb::MessageParser<ArmorPlate>(() => new ArmorPlate());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<ArmorPlate> 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);
}
/// <summary>Field number for the "thickness" field.</summary>
public const int ThicknessFieldNumber = 1;
private readonly static float ThicknessDefaultValue = 0F;
private float thickness_;
/// <summary>
/// this is the thickness of the armor in millimeters
/// </summary>
[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;
}
}
/// <summary>Gets whether the "thickness" field is set</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool HasThickness {
get { return (_hasBits0 & 1) != 0; }
}
/// <summary>Clears the value of the "thickness" field</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void ClearThickness() {
_hasBits0 &= ~1;
}
/// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 2;
private readonly static string TypeDefaultValue = "";
private string type_;
/// <summary>
/// this can be stuff like ArmorScreen which is spaced armor, FuelTank, etc.
/// </summary>
[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");
}
}
/// <summary>Gets whether the "type" field is set</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool HasType {
get { return type_ != null; }
}
/// <summary>Clears the value of the "type" field</summary>
[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