gotta go fast

This commit is contained in:
tresabhi committed 2025-03-18 17:26:09 -05:00
1 parent 35894f39cf
commit 57d63ea1d7
9 files changed
+368 -668

No files matched your search

+30 -67
View File
@@ -5,9 +5,9 @@
// source: packages/core/src/protos/i18n.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = 'blitzkit';
export const protobufPackage = "blitzkit";
export interface I18n {
locales: { [key: string]: string };
@@ -18,27 +18,20 @@ export interface I18n_LocalesEntry {
value: string;
}
export function createBaseI18n(): I18n {
function createBaseI18n(): I18n {
return { locales: {} };
}
export const I18n: MessageFns<I18n> = {
encode(
message: I18n,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
encode(message: I18n, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.locales).forEach(([key, value]) => {
I18n_LocalesEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
I18n_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): I18n {
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 = createBaseI18n();
while (reader.pos < end) {
@@ -67,13 +60,10 @@ export const I18n: MessageFns<I18n> = {
fromJSON(object: any): I18n {
return {
locales: isObject(object.locales)
? Object.entries(object.locales).reduce<{ [key: string]: string }>(
(acc, [key, value]) => {
acc[key] = String(value);
return acc;
},
{},
)
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => {
acc[key] = String(value);
return acc;
}, {})
: {},
};
},
@@ -97,9 +87,7 @@ export const I18n: MessageFns<I18n> = {
},
fromPartial<I extends Exact<DeepPartial<I18n>, I>>(object: I): I18n {
const message = createBaseI18n();
message.locales = Object.entries(object.locales ?? {}).reduce<{
[key: string]: string;
}>((acc, [key, value]) => {
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.String(value);
}
@@ -110,14 +98,11 @@ export const I18n: MessageFns<I18n> = {
};
function createBaseI18n_LocalesEntry(): I18n_LocalesEntry {
return { key: '', value: '' };
return { key: "", value: "" };
}
export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
encode(
message: I18n_LocalesEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
encode(message: I18n_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
@@ -128,8 +113,7 @@ export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
},
decode(input: BinaryReader | Uint8Array, length?: number): I18n_LocalesEntry {
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 = createBaseI18n_LocalesEntry();
while (reader.pos < end) {
@@ -162,10 +146,8 @@ export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
fromJSON(object: any): I18n_LocalesEntry {
return {
key: globalThis.String(assertSet('I18n_LocalesEntry.key', object.key)),
value: globalThis.String(
assertSet('I18n_LocalesEntry.value', object.value),
),
key: globalThis.String(assertSet("I18n_LocalesEntry.key", object.key)),
value: globalThis.String(assertSet("I18n_LocalesEntry.value", object.value)),
};
},
@@ -180,51 +162,32 @@ export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
return obj;
},
create<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(
base?: I,
): I18n_LocalesEntry {
create<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(base?: I): I18n_LocalesEntry {
return I18n_LocalesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(
object: I,
): I18n_LocalesEntry {
fromPartial<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(object: I): I18n_LocalesEntry {
const message = createBaseI18n_LocalesEntry();
message.key = object.key ?? '';
message.value = object.value ?? '';
message.key = object.key ?? "";
message.value = object.value ?? "";
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
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>;
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;
};
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;
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
@@ -5,10 +5,10 @@
// source: packages/core/src/protos/legacy_game_definitions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { I18nString, createBaseI18nString } from './legacy_i18n';
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18nString } from "./legacy_i18n";
export const protobufPackage = 'blitzkit';
export const protobufPackage = "blitzkit";
export interface GameDefinitions {
version: string;
@@ -37,38 +37,28 @@ export interface GameModeRole {
}
function createBaseGameDefinitions(): GameDefinitions {
return { version: '', nations: [], gameModes: {}, roles: {} };
return { version: "", nations: [], gameModes: {}, roles: {} };
}
export const GameDefinitions: MessageFns<GameDefinitions> = {
encode(
message: GameDefinitions,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.version !== '') {
encode(message: GameDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.version !== "") {
writer.uint32(10).string(message.version);
}
for (const v of message.nations) {
writer.uint32(18).string(v!);
}
Object.entries(message.gameModes).forEach(([key, value]) => {
GameDefinitions_GameModesEntry.encode(
{ key: key as any, value },
writer.uint32(26).fork(),
).join();
GameDefinitions_GameModesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
});
Object.entries(message.roles).forEach(([key, value]) => {
GameDefinitions_RolesEntry.encode(
{ key: key as any, value },
writer.uint32(34).fork(),
).join();
GameDefinitions_RolesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions();
while (reader.pos < end) {
@@ -95,10 +85,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
break;
}
const entry3 = GameDefinitions_GameModesEntry.decode(
reader,
reader.uint32(),
);
const entry3 = GameDefinitions_GameModesEntry.decode(reader, reader.uint32());
if (entry3.value !== undefined) {
message.gameModes[entry3.key] = entry3.value;
}
@@ -109,10 +96,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
break;
}
const entry4 = GameDefinitions_RolesEntry.decode(
reader,
reader.uint32(),
);
const entry4 = GameDefinitions_RolesEntry.decode(reader, reader.uint32());
if (entry4.value !== undefined) {
message.roles[entry4.key] = entry4.value;
}
@@ -129,36 +113,26 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
fromJSON(object: any): GameDefinitions {
return {
version: globalThis.String(
assertSet('GameDefinitions.version', object.version),
),
nations: globalThis.Array.isArray(object?.nations)
? object.nations.map((e: any) => globalThis.String(e))
: [],
version: globalThis.String(assertSet("GameDefinitions.version", object.version)),
nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [],
gameModes: isObject(object.gameModes)
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>(
(acc, [key, value]) => {
acc[globalThis.Number(key)] = GameMode.fromJSON(value);
return acc;
},
{},
)
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = GameMode.fromJSON(value);
return acc;
}, {})
: {},
roles: isObject(object.roles)
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>(
(acc, [key, value]) => {
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
return acc;
},
{},
)
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: GameDefinitions): unknown {
const obj: any = {};
if (message.version !== '') {
if (message.version !== "") {
obj.version = message.version;
}
if (message.nations?.length) {
@@ -185,28 +159,23 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions>, I>>(
base?: I,
): GameDefinitions {
create<I extends Exact<DeepPartial<GameDefinitions>, I>>(base?: I): GameDefinitions {
return GameDefinitions.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(
object: I,
): GameDefinitions {
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(object: I): GameDefinitions {
const message = createBaseGameDefinitions();
message.version = object.version ?? '';
message.version = object.version ?? "";
message.nations = object.nations?.map((e) => e) || [];
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{
[key: number]: GameMode;
}>((acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = GameMode.fromPartial(value);
}
return acc;
}, {});
message.roles = Object.entries(object.roles ?? {}).reduce<{
[key: number]: GameModeRole;
}>((acc, [key, value]) => {
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ [key: number]: GameMode }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = GameMode.fromPartial(value);
}
return acc;
},
{},
);
message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = GameModeRole.fromPartial(value);
}
@@ -220,201 +189,166 @@ function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEn
return { key: 0, value: createBaseGameMode() };
}
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> =
{
encode(
message: GameDefinitions_GameModesEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
GameMode.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> = {
encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
GameMode.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): GameDefinitions_GameModesEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_GameModesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_GameModesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = GameMode.decode(reader, reader.uint32());
continue;
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = GameMode.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): GameDefinitions_GameModesEntry {
return {
key: globalThis.Number(
assertSet('GameDefinitions_GameModesEntry.key', object.key),
),
value: GameMode.fromJSON(
assertSet('GameDefinitions_GameModesEntry.value', object.value),
),
};
},
toJSON(message: GameDefinitions_GameModesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
if ((tag & 7) === 4 || tag === 0) {
break;
}
if (message.value !== undefined) {
obj.value = GameMode.toJSON(message.value);
}
return obj;
},
reader.skip(tag & 7);
}
return message;
},
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(
base?: I,
): GameDefinitions_GameModesEntry {
return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<
I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>,
>(object: I): GameDefinitions_GameModesEntry {
const message = createBaseGameDefinitions_GameModesEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? GameMode.fromPartial(object.value)
: undefined;
return message;
},
};
fromJSON(object: any): GameDefinitions_GameModesEntry {
return {
key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)),
value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)),
};
},
toJSON(message: GameDefinitions_GameModesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = GameMode.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(base?: I): GameDefinitions_GameModesEntry {
return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(
object: I,
): GameDefinitions_GameModesEntry {
const message = createBaseGameDefinitions_GameModesEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? GameMode.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry {
return { key: 0, value: createBaseGameModeRole() };
}
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> =
{
encode(
message: GameDefinitions_RolesEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
GameModeRole.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> = {
encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
GameModeRole.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): GameDefinitions_RolesEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_RolesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_RolesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = GameModeRole.decode(reader, reader.uint32());
continue;
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = GameModeRole.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): GameDefinitions_RolesEntry {
return {
key: globalThis.Number(
assertSet('GameDefinitions_RolesEntry.key', object.key),
),
value: GameModeRole.fromJSON(
assertSet('GameDefinitions_RolesEntry.value', object.value),
),
};
},
toJSON(message: GameDefinitions_RolesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
if ((tag & 7) === 4 || tag === 0) {
break;
}
if (message.value !== undefined) {
obj.value = GameModeRole.toJSON(message.value);
}
return obj;
},
reader.skip(tag & 7);
}
return message;
},
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(
base?: I,
): GameDefinitions_RolesEntry {
return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(
object: I,
): GameDefinitions_RolesEntry {
const message = createBaseGameDefinitions_RolesEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? GameModeRole.fromPartial(object.value)
: undefined;
return message;
},
};
fromJSON(object: any): GameDefinitions_RolesEntry {
return {
key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)),
value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)),
};
},
toJSON(message: GameDefinitions_RolesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = GameModeRole.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(base?: I): GameDefinitions_RolesEntry {
return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(object: I): GameDefinitions_RolesEntry {
const message = createBaseGameDefinitions_RolesEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? GameModeRole.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseGameMode(): GameMode {
return { name: createBaseI18nString() };
}
export const GameMode: MessageFns<GameMode> = {
encode(
message: GameMode,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
encode(message: GameMode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(10).fork()).join();
}
@@ -422,8 +356,7 @@ export const GameMode: MessageFns<GameMode> = {
},
decode(input: BinaryReader | Uint8Array, length?: number): GameMode {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameMode();
while (reader.pos < end) {
@@ -447,9 +380,7 @@ export const GameMode: MessageFns<GameMode> = {
},
fromJSON(object: any): GameMode {
return {
name: I18nString.fromJSON(assertSet('GameMode.name', object.name)),
};
return { name: I18nString.fromJSON(assertSet("GameMode.name", object.name)) };
},
toJSON(message: GameMode): unknown {
@@ -465,10 +396,9 @@ export const GameMode: MessageFns<GameMode> = {
},
fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode {
const message = createBaseGameMode();
message.name =
object.name !== undefined && object.name !== null
? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: createBaseI18nString();
return message;
},
};
@@ -478,10 +408,7 @@ function createBaseGameModeRole(): GameModeRole {
}
export const GameModeRole: MessageFns<GameModeRole> = {
encode(
message: GameModeRole,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
encode(message: GameModeRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
writer.uint32(10).fork();
for (const v of message.provisions) {
writer.uint32(v);
@@ -496,8 +423,7 @@ export const GameModeRole: MessageFns<GameModeRole> = {
},
decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameModeRole();
while (reader.pos < end) {
@@ -570,14 +496,10 @@ export const GameModeRole: MessageFns<GameModeRole> = {
return obj;
},
create<I extends Exact<DeepPartial<GameModeRole>, I>>(
base?: I,
): GameModeRole {
create<I extends Exact<DeepPartial<GameModeRole>, I>>(base?: I): GameModeRole {
return GameModeRole.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(
object: I,
): GameModeRole {
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(object: I): GameModeRole {
const message = createBaseGameModeRole();
message.provisions = object.provisions?.map((e) => e) || [];
message.consumables = object.consumables?.map((e) => e) || [];
@@ -585,36 +507,21 @@ export const GameModeRole: MessageFns<GameModeRole> = {
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
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>;
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;
};
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;
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
+33 -80
View File
@@ -5,9 +5,9 @@
// source: packages/core/src/protos/legacy_i18n.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = 'blitzkit';
export const protobufPackage = "blitzkit";
export interface I18nString {
locales: { [key: string]: string };
@@ -18,27 +18,20 @@ export interface I18nString_LocalesEntry {
value: string;
}
export function createBaseI18nString(): I18nString {
function createBaseI18nString(): I18nString {
return { locales: {} };
}
export const I18nString: MessageFns<I18nString> = {
encode(
message: I18nString,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
encode(message: I18nString, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.locales).forEach(([key, value]) => {
I18nString_LocalesEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
I18nString_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): I18nString {
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 = createBaseI18nString();
while (reader.pos < end) {
@@ -49,10 +42,7 @@ export const I18nString: MessageFns<I18nString> = {
break;
}
const entry1 = I18nString_LocalesEntry.decode(
reader,
reader.uint32(),
);
const entry1 = I18nString_LocalesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.locales[entry1.key] = entry1.value;
}
@@ -70,13 +60,10 @@ export const I18nString: MessageFns<I18nString> = {
fromJSON(object: any): I18nString {
return {
locales: isObject(object.locales)
? Object.entries(object.locales).reduce<{ [key: string]: string }>(
(acc, [key, value]) => {
acc[key] = String(value);
return acc;
},
{},
)
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => {
acc[key] = String(value);
return acc;
}, {})
: {},
};
},
@@ -98,13 +85,9 @@ export const I18nString: MessageFns<I18nString> = {
create<I extends Exact<DeepPartial<I18nString>, I>>(base?: I): I18nString {
return I18nString.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(
object: I,
): I18nString {
fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(object: I): I18nString {
const message = createBaseI18nString();
message.locales = Object.entries(object.locales ?? {}).reduce<{
[key: string]: string;
}>((acc, [key, value]) => {
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.String(value);
}
@@ -115,14 +98,11 @@ export const I18nString: MessageFns<I18nString> = {
};
function createBaseI18nString_LocalesEntry(): I18nString_LocalesEntry {
return { key: '', value: '' };
return { key: "", value: "" };
}
export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
encode(
message: I18nString_LocalesEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
encode(message: I18nString_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
@@ -132,12 +112,8 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): I18nString_LocalesEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
decode(input: BinaryReader | Uint8Array, length?: number): I18nString_LocalesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18nString_LocalesEntry();
while (reader.pos < end) {
@@ -170,12 +146,8 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
fromJSON(object: any): I18nString_LocalesEntry {
return {
key: globalThis.String(
assertSet('I18nString_LocalesEntry.key', object.key),
),
value: globalThis.String(
assertSet('I18nString_LocalesEntry.value', object.value),
),
key: globalThis.String(assertSet("I18nString_LocalesEntry.key", object.key)),
value: globalThis.String(assertSet("I18nString_LocalesEntry.value", object.value)),
};
},
@@ -190,51 +162,32 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
return obj;
},
create<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(
base?: I,
): I18nString_LocalesEntry {
create<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(base?: I): I18nString_LocalesEntry {
return I18nString_LocalesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(
object: I,
): I18nString_LocalesEntry {
fromPartial<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(object: I): I18nString_LocalesEntry {
const message = createBaseI18nString_LocalesEntry();
message.key = object.key ?? '';
message.value = object.value ?? '';
message.key = object.key ?? "";
message.value = object.value ?? "";
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
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>;
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;
};
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;
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
+27 -47
View File
@@ -5,10 +5,10 @@
// 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 } from "./i18n";
export const protobufPackage = 'blitzkit';
export const protobufPackage = "blitzkit";
export interface Tank {
id: string;
@@ -17,18 +17,15 @@ export interface Tank {
}
function createBaseTank(): Tank {
return { id: '', slug: '', name: createBaseI18n() };
return { id: "", slug: "", name: createBaseI18n() };
}
export const Tank: MessageFns<Tank> = {
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) {
@@ -38,8 +35,7 @@ export const Tank: MessageFns<Tank> = {
},
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) {
@@ -80,18 +76,18 @@ export const Tank: MessageFns<Tank> = {
fromJSON(object: any): Tank {
return {
id: globalThis.String(assertSet('Tank.id', object.id)),
slug: globalThis.String(assertSet('Tank.slug', object.slug)),
name: I18n.fromJSON(assertSet('Tank.name', object.name)),
id: globalThis.String(assertSet("Tank.id", object.id)),
slug: globalThis.String(assertSet("Tank.slug", object.slug)),
name: I18n.fromJSON(assertSet("Tank.name", object.name)),
};
},
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) {
@@ -105,43 +101,27 @@ export const Tank: MessageFns<Tank> = {
},
fromPartial<I extends Exact<DeepPartial<Tank>, 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.id = object.id ?? "";
message.slug = object.slug ?? "";
message.name = (object.name !== undefined && object.name !== null)
? I18n.fromPartial(object.name)
: createBaseI18n();
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
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>;
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;
};
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 isSet(value: any): boolean {
return value !== null && value !== undefined;
+5 -4
View File
@@ -1,12 +1,13 @@
syntax = "proto2";
import "packages/core/src/protos/tank.proto";
package blitzkit;
message Tanks {
repeated TankMeta tanks = 1;
repeated string tanks = 1;
}
message TankMeta {
required string id = 1;
required string slug = 2;
message TanksFull {
repeated Tank tanks = 1;
}
+28 -58
View File
@@ -6,16 +6,16 @@
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Tank } from "./tank";
export const protobufPackage = "blitzkit";
export interface Tanks {
tanks: TankMeta[];
tanks: string[];
}
export interface TankMeta {
id: string;
slug: string;
export interface TanksFull {
tanks: Tank[];
}
function createBaseTanks(): Tanks {
@@ -25,7 +25,7 @@ function createBaseTanks(): Tanks {
export const Tanks: MessageFns<Tanks> = {
encode(message: Tanks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.tanks) {
TankMeta.encode(v!, writer.uint32(10).fork()).join();
writer.uint32(10).string(v!);
}
return writer;
},
@@ -42,7 +42,7 @@ export const Tanks: MessageFns<Tanks> = {
break;
}
message.tanks.push(TankMeta.decode(reader, reader.uint32()));
message.tanks.push(reader.string());
continue;
}
}
@@ -55,13 +55,13 @@ export const Tanks: MessageFns<Tanks> = {
},
fromJSON(object: any): Tanks {
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => TankMeta.fromJSON(e)) : [] };
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => globalThis.String(e)) : [] };
},
toJSON(message: Tanks): unknown {
const obj: any = {};
if (message.tanks?.length) {
obj.tanks = message.tanks.map((e) => TankMeta.toJSON(e));
obj.tanks = message.tanks;
}
return obj;
},
@@ -71,30 +71,27 @@ export const Tanks: MessageFns<Tanks> = {
},
fromPartial<I extends Exact<DeepPartial<Tanks>, I>>(object: I): Tanks {
const message = createBaseTanks();
message.tanks = object.tanks?.map((e) => TankMeta.fromPartial(e)) || [];
message.tanks = object.tanks?.map((e) => e) || [];
return message;
},
};
function createBaseTankMeta(): TankMeta {
return { id: "", slug: "" };
function createBaseTanksFull(): TanksFull {
return { tanks: [] };
}
export const TankMeta: MessageFns<TankMeta> = {
encode(message: TankMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.slug !== "") {
writer.uint32(18).string(message.slug);
export const TanksFull: MessageFns<TanksFull> = {
encode(message: TanksFull, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.tanks) {
Tank.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankMeta {
decode(input: BinaryReader | Uint8Array, length?: number): TanksFull {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankMeta();
const message = createBaseTanksFull();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -103,15 +100,7 @@ export const TankMeta: MessageFns<TankMeta> = {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.slug = reader.string();
message.tanks.push(Tank.decode(reader, reader.uint32()));
continue;
}
}
@@ -123,31 +112,24 @@ export const TankMeta: MessageFns<TankMeta> = {
return message;
},
fromJSON(object: any): TankMeta {
return {
id: globalThis.String(assertSet("TankMeta.id", object.id)),
slug: globalThis.String(assertSet("TankMeta.slug", object.slug)),
};
fromJSON(object: any): TanksFull {
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] };
},
toJSON(message: TankMeta): unknown {
toJSON(message: TanksFull): unknown {
const obj: any = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.slug !== "") {
obj.slug = message.slug;
if (message.tanks?.length) {
obj.tanks = message.tanks.map((e) => Tank.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<TankMeta>, I>>(base?: I): TankMeta {
return TankMeta.fromPartial(base ?? ({} as any));
create<I extends Exact<DeepPartial<TanksFull>, I>>(base?: I): TanksFull {
return TanksFull.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankMeta>, I>>(object: I): TankMeta {
const message = createBaseTankMeta();
message.id = object.id ?? "";
message.slug = object.slug ?? "";
fromPartial<I extends Exact<DeepPartial<TanksFull>, I>>(object: I): TanksFull {
const message = createBaseTanksFull();
message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || [];
return message;
},
};
@@ -165,18 +147,6 @@ 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 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;
+16 -20
View File
@@ -84,7 +84,7 @@ namespace BlitzKit.CLI.Functions
async Task MangleNations()
{
var dirs = provider.RootDirectory.GetDirectory("Blitz/Content/Tanks").Directories;
List<Tank> tanksRaw = [];
TanksFull tanksFull = new();
foreach (var dir in dirs)
{
@@ -97,36 +97,36 @@ namespace BlitzKit.CLI.Functions
// continue;
var tank = await MangleTank(tankDir.Value);
tanksRaw.Add(tank);
tanksFull.Tanks.Add(tank);
}
}
DeduplicateSlugs(tanksRaw);
DeduplicateSlugs(tanksFull);
Tanks tanks = new();
foreach (var tank in tanksRaw)
foreach (var tank in tanksFull.Tanks)
{
TankMeta tankMeta = new() { Id = tank.Id, Slug = tank.Slug };
tanks.Tanks_.Add(tankMeta);
tanks.Tanks_.Add(tank.Id);
await assetUploader.Add(new($"tanks/{tank.Id}/meta.pb", tank.ToByteArray()));
}
await assetUploader.Add(new("definitions/tanks.pb", tanks.ToByteArray()));
await assetUploader.Add(new("definitions/tanks-full.pb", tanksFull.ToByteArray()));
}
void DeduplicateSlugs(List<Tank> tanks)
void DeduplicateSlugs(TanksFull tanksFull)
{
List<string> checkedSlugs = [];
Dictionary<string, List<Tank>> duplicates = [];
foreach (var tank in tanks)
foreach (var tank in tanksFull.Tanks)
{
if (checkedSlugs.Contains(tank.Slug))
continue;
checkedSlugs.Add(tank.Slug);
foreach (var otherTank in tanks)
foreach (var otherTank in tanksFull.Tanks)
{
if (otherTank.Slug.Equals(tank.Slug) && !otherTank.Id.Equals(tank.Id))
{
@@ -150,20 +150,14 @@ namespace BlitzKit.CLI.Functions
Console.WriteLine($"\t{tank.Id}");
}
if (duplicate.Value.Count != 2)
{
throw new Exception(
$"Found an unsupported {duplicate.Value.Count} duplicates for {duplicate.Key}"
);
}
if (duplicate.Value.Any(tank => tank.Id.EndsWith("TU")))
if (duplicate.Value.Count == 2 && duplicate.Value.Any(tank => tank.Id.EndsWith("TU")))
{
PrettyLog.Success("\tTutorial bot discrimination...");
var tutorialBot = duplicate.Value.First(tank => tank.Id.EndsWith("TU"));
tutorialBot.Slug += "-tu";
}
// if (duplicate.Value.All((tank)=>duplicate.Value.All((otherTank)=>otherTank.Id == tank.Id || otherTank.Nation != tank.Nation)))
else
{
PrettyLog.Success("\tNation discrimination...");
@@ -176,6 +170,10 @@ namespace BlitzKit.CLI.Functions
tank.Slug += $"-{slugNation}";
}
}
// else
// {
// throw new Exception("No applicable strategy found");
// }
foreach (var tank in duplicate.Value)
{
@@ -208,8 +206,6 @@ namespace BlitzKit.CLI.Functions
Slug = slug,
};
await assetUploader.Add(new($"tanks/{id}/meta.pb", tank.ToByteArray()));
return tank;
}
+7 -2
View File
@@ -13,6 +13,7 @@ namespace BlitzKit.CLI.Models
private static readonly int TIME_PER_BLOB = (int)Math.Pow(2, 4) * 10000;
private static readonly int TIME_BETWEEN_BLOBS = (int)(60 * 60 * 1000 / 5000 / 0.9);
private static readonly int MAX_TREE_SIZE = 7_000_000; // 7MB
private static readonly bool devMinimizeChecks = Env.GetBool("DEV_MINIMIZE_ASSET_CHECKS");
private readonly GitHubClient octokit = new(new ProductHeaderValue("MyAmazingApp"))
{
@@ -40,10 +41,14 @@ namespace BlitzKit.CLI.Models
);
changes.Add(change);
}
else if (devMinimizeChecks)
{
return;
}
else if (response.StatusCode == HttpStatusCode.OK)
{
int deltaSize = 0;
bool isDifferent = false;
int deltaSize;
bool isDifferent;
// hopefully they just give you the file size to delta from
if (response.Content.Headers.ContentLength.HasValue)
+35 -110
View File
@@ -25,13 +25,14 @@ namespace Blitzkit {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"CiRwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFua3MucHJvdG8SCGJsaXR6",
"a2l0IioKBVRhbmtzEiEKBXRhbmtzGAEgAygLMhIuYmxpdHpraXQuVGFua01l",
"dGEiJAoIVGFua01ldGESCgoCaWQYASACKAkSDAoEc2x1ZxgCIAIoCQ=="));
"a2l0GiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90byIWCgVU",
"YW5rcxINCgV0YW5rcxgBIAMoCSIqCglUYW5rc0Z1bGwSHQoFdGFua3MYASAD",
"KAsyDi5ibGl0emtpdC5UYW5r"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::FileDescriptor[] { global::Blitzkit.TankReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tanks), global::Blitzkit.Tanks.Parser, new[]{ "Tanks_" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.TankMeta), global::Blitzkit.TankMeta.Parser, new[]{ "Id", "Slug" }, null, null, null, null)
new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.TanksFull), global::Blitzkit.TanksFull.Parser, new[]{ "Tanks" }, null, null, null, null)
}));
}
#endregion
@@ -85,12 +86,12 @@ namespace Blitzkit {
/// <summary>Field number for the "tanks" field.</summary>
public const int Tanks_FieldNumber = 1;
private static readonly pb::FieldCodec<global::Blitzkit.TankMeta> _repeated_tanks_codec
= pb::FieldCodec.ForMessage(10, global::Blitzkit.TankMeta.Parser);
private readonly pbc::RepeatedField<global::Blitzkit.TankMeta> tanks_ = new pbc::RepeatedField<global::Blitzkit.TankMeta>();
private static readonly pb::FieldCodec<string> _repeated_tanks_codec
= pb::FieldCodec.ForString(10);
private readonly pbc::RepeatedField<string> tanks_ = new pbc::RepeatedField<string>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Blitzkit.TankMeta> Tanks_ {
public pbc::RepeatedField<string> Tanks_ {
get { return tanks_; }
}
@@ -226,16 +227,16 @@ namespace Blitzkit {
}
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class TankMeta : pb::IMessage<TankMeta>
public sealed partial class TanksFull : pb::IMessage<TanksFull>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TankMeta> _parser = new pb::MessageParser<TankMeta>(() => new TankMeta());
private static readonly pb::MessageParser<TanksFull> _parser = new pb::MessageParser<TanksFull>(() => new TanksFull());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<TankMeta> Parser { get { return _parser; } }
public static pb::MessageParser<TanksFull> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
@@ -251,7 +252,7 @@ namespace Blitzkit {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TankMeta() {
public TanksFull() {
OnConstruction();
}
@@ -259,87 +260,44 @@ namespace Blitzkit {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TankMeta(TankMeta other) : this() {
id_ = other.id_;
slug_ = other.slug_;
public TanksFull(TanksFull other) : this() {
tanks_ = other.tanks_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TankMeta Clone() {
return new TankMeta(this);
public TanksFull Clone() {
return new TanksFull(this);
}
/// <summary>Field number for the "id" field.</summary>
public const int IdFieldNumber = 1;
private readonly static string IdDefaultValue = "";
private string id_;
/// <summary>Field number for the "tanks" field.</summary>
public const int TanksFieldNumber = 1;
private static readonly pb::FieldCodec<global::Blitzkit.Tank> _repeated_tanks_codec
= pb::FieldCodec.ForMessage(10, global::Blitzkit.Tank.Parser);
private readonly pbc::RepeatedField<global::Blitzkit.Tank> tanks_ = new pbc::RepeatedField<global::Blitzkit.Tank>();
[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 "slug" field.</summary>
public const int SlugFieldNumber = 2;
private readonly static string SlugDefaultValue = "";
private string slug_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Slug {
get { return slug_ ?? SlugDefaultValue; }
set {
slug_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Gets whether the "slug" field is set</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool HasSlug {
get { return slug_ != null; }
}
/// <summary>Clears the value of the "slug" field</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void ClearSlug() {
slug_ = null;
public pbc::RepeatedField<global::Blitzkit.Tank> Tanks {
get { return tanks_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as TankMeta);
return Equals(other as TanksFull);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(TankMeta other) {
public bool Equals(TanksFull other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Id != other.Id) return false;
if (Slug != other.Slug) return false;
if(!tanks_.Equals(other.tanks_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -347,8 +305,7 @@ namespace Blitzkit {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (HasId) hash ^= Id.GetHashCode();
if (HasSlug) hash ^= Slug.GetHashCode();
hash ^= tanks_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@@ -367,14 +324,7 @@ namespace Blitzkit {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HasId) {
output.WriteRawTag(10);
output.WriteString(Id);
}
if (HasSlug) {
output.WriteRawTag(18);
output.WriteString(Slug);
}
tanks_.WriteTo(output, _repeated_tanks_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@@ -385,14 +335,7 @@ namespace Blitzkit {
[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);
}
if (HasSlug) {
output.WriteRawTag(18);
output.WriteString(Slug);
}
tanks_.WriteTo(ref output, _repeated_tanks_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@@ -403,12 +346,7 @@ namespace Blitzkit {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (HasId) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Id);
}
if (HasSlug) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Slug);
}
size += tanks_.CalculateSize(_repeated_tanks_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@@ -417,16 +355,11 @@ namespace Blitzkit {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(TankMeta other) {
public void MergeFrom(TanksFull other) {
if (other == null) {
return;
}
if (other.HasId) {
Id = other.Id;
}
if (other.HasSlug) {
Slug = other.Slug;
}
tanks_.Add(other.tanks_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@@ -447,11 +380,7 @@ namespace Blitzkit {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Id = input.ReadString();
break;
}
case 18: {
Slug = input.ReadString();
tanks_.AddEntriesFrom(input, _repeated_tanks_codec);
break;
}
}
@@ -474,11 +403,7 @@ namespace Blitzkit {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Id = input.ReadString();
break;
}
case 18: {
Slug = input.ReadString();
tanks_.AddEntriesFrom(ref input, _repeated_tanks_codec);
break;
}
}