mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: start of localized proto strings
This commit is contained in:
1 parent
7900c61a9b
commit
d8459d373c
42 files changed
+550
-360
No files matched your search
@@ -1,2 +0,0 @@
|
|||||||
export * from './strings';
|
|
||||||
export * from './translator';
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
export type TranslationTree = { [key: string]: TranslationNode };
|
|
||||||
|
|
||||||
export type TranslationNode = string | TranslationTree;
|
|
||||||
|
|
||||||
type NestedKeys<Type> = Type extends object
|
|
||||||
? {
|
|
||||||
[Key in keyof Type]: Key extends string
|
|
||||||
? Type[Key] extends object
|
|
||||||
? '$' extends keyof Type[Key]
|
|
||||||
? `${Key}` | `${Key}.${NestedKeys<Type[Key]>}`
|
|
||||||
: `${Key}.${NestedKeys<Type[Key]>}`
|
|
||||||
: Key
|
|
||||||
: never;
|
|
||||||
}[keyof Type]
|
|
||||||
: never;
|
|
||||||
|
|
||||||
export class Translator<
|
|
||||||
Locale extends string,
|
|
||||||
DefaultLocale extends Locale,
|
|
||||||
Strings extends TranslationTree,
|
|
||||||
Path extends NestedKeys<Strings>,
|
|
||||||
> {
|
|
||||||
private readonly defaultStrings: Map<string, string>;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private strings: Record<Locale, Strings>,
|
|
||||||
private defaultLocale: DefaultLocale,
|
|
||||||
) {
|
|
||||||
this.defaultStrings = this.flatten(strings[defaultLocale]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private flatten(strings: TranslationTree) {
|
|
||||||
const translations = new Map<string, string>();
|
|
||||||
|
|
||||||
function traverse(parent: string, tree: Record<string, TranslationNode>) {
|
|
||||||
for (const key in tree) {
|
|
||||||
const path = `${parent}${key}`;
|
|
||||||
|
|
||||||
if (typeof tree[key] === 'string') {
|
|
||||||
translations.set(path, tree[key]);
|
|
||||||
} else {
|
|
||||||
traverse(`${path}.`, tree[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
traverse('', strings);
|
|
||||||
|
|
||||||
return translations;
|
|
||||||
}
|
|
||||||
|
|
||||||
locale(locale: Locale) {
|
|
||||||
if (this.strings[locale] === undefined) {
|
|
||||||
throw new TypeError(`Locale "${locale}" is not defined`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const strings = this.strings[locale];
|
|
||||||
const defaultStrings = this.defaultStrings;
|
|
||||||
const defaultLocale = this.defaultLocale;
|
|
||||||
|
|
||||||
const translations = this.flatten(strings);
|
|
||||||
|
|
||||||
function translate(path: Path, literals?: string[]) {
|
|
||||||
let translation = translations.get(path) ?? translations.get(`${path}.$`);
|
|
||||||
|
|
||||||
if (translation === undefined) {
|
|
||||||
translation =
|
|
||||||
defaultStrings.get(path) ?? defaultStrings.get(`${path}.$`);
|
|
||||||
|
|
||||||
if (translation === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
`Undefined translation for "${path}" in locale "${locale}"; no fallback found in "${defaultLocale}"`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
`Undefined translation for "${path}" in locale "${locale}"; falling back to "${defaultLocale}"`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
literals?.forEach((literal, index) => {
|
|
||||||
translation = translation!.replaceAll(`%s${index + 1}`, literal);
|
|
||||||
});
|
|
||||||
|
|
||||||
return translation;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { translate, t: translate };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
export * from './blitz';
|
export * from './blitz';
|
||||||
export * from './blitzkit';
|
export * from './blitzkit';
|
||||||
export * from './databases';
|
export * from './databases';
|
||||||
export * from './i18n';
|
|
||||||
export * from './imgur';
|
|
||||||
export * from './math';
|
export * from './math';
|
||||||
export * from './patreon';
|
export * from './patreon';
|
||||||
export * from './protobuf';
|
export * from './protobuf';
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ export const AverageDefinitions_AveragesEntry: MessageFns<AverageDefinitions_Ave
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? AverageDefinitionsEntry.fromPartial(object.value)
|
? AverageDefinitionsEntry.fromPartial(object.value)
|
||||||
: createBaseAverageDefinitionsEntry();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ syntax = "proto2";
|
|||||||
|
|
||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message CamouflageDefinitions {
|
message CamouflageDefinitions {
|
||||||
map<uint32, Camouflage> camouflages = 1;
|
map<uint32, Camouflage> camouflages = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Camouflage {
|
message Camouflage {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required string name = 2;
|
required I18nString name = 2;
|
||||||
optional string tank_name = 3;
|
optional I18nString tank_name = 3;
|
||||||
optional string tank_name_full = 4;
|
optional I18nString tank_name_full = 4;
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -20,9 +21,9 @@ export interface CamouflageDefinitions_CamouflagesEntry {
|
|||||||
|
|
||||||
export interface Camouflage {
|
export interface Camouflage {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
tank_name?: string | undefined;
|
tank_name?: I18nString | undefined;
|
||||||
tank_name_full?: string | undefined;
|
tank_name_full?: I18nString | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createBaseCamouflageDefinitions(): CamouflageDefinitions {
|
function createBaseCamouflageDefinitions(): CamouflageDefinitions {
|
||||||
@@ -184,13 +185,13 @@ export const CamouflageDefinitions_CamouflagesEntry: MessageFns<CamouflageDefini
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? Camouflage.fromPartial(object.value)
|
? Camouflage.fromPartial(object.value)
|
||||||
: createBaseCamouflage();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function createBaseCamouflage(): Camouflage {
|
function createBaseCamouflage(): Camouflage {
|
||||||
return { id: 0, name: "", tank_name: undefined, tank_name_full: undefined };
|
return { id: 0, name: createBaseI18nString(), tank_name: undefined, tank_name_full: undefined };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Camouflage: MessageFns<Camouflage> = {
|
export const Camouflage: MessageFns<Camouflage> = {
|
||||||
@@ -198,14 +199,14 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
writer.uint32(8).uint32(message.id);
|
writer.uint32(8).uint32(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(18).string(message.name);
|
I18nString.encode(message.name, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.tank_name !== undefined && message.tank_name !== undefined) {
|
if (message.tank_name !== undefined) {
|
||||||
writer.uint32(26).string(message.tank_name);
|
I18nString.encode(message.tank_name, writer.uint32(26).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.tank_name_full !== undefined && message.tank_name_full !== undefined) {
|
if (message.tank_name_full !== undefined) {
|
||||||
writer.uint32(34).string(message.tank_name_full);
|
I18nString.encode(message.tank_name_full, writer.uint32(34).fork()).join();
|
||||||
}
|
}
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
@@ -230,7 +231,7 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@@ -238,7 +239,7 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.tank_name = reader.string();
|
message.tank_name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
@@ -246,7 +247,7 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.tank_name_full = reader.string();
|
message.tank_name_full = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,9 +262,9 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
fromJSON(object: any): Camouflage {
|
fromJSON(object: any): Camouflage {
|
||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("Camouflage.id", object.id)),
|
id: globalThis.Number(assertSet("Camouflage.id", object.id)),
|
||||||
name: globalThis.String(assertSet("Camouflage.name", object.name)),
|
name: I18nString.fromJSON(assertSet("Camouflage.name", object.name)),
|
||||||
tank_name: isSet(object.tank_name) ? globalThis.String(object.tank_name) : undefined,
|
tank_name: isSet(object.tank_name) ? I18nString.fromJSON(object.tank_name) : undefined,
|
||||||
tank_name_full: isSet(object.tank_name_full) ? globalThis.String(object.tank_name_full) : undefined,
|
tank_name_full: isSet(object.tank_name_full) ? I18nString.fromJSON(object.tank_name_full) : undefined,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -272,14 +273,14 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
obj.id = Math.round(message.id);
|
obj.id = Math.round(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.tank_name !== undefined && message.tank_name !== undefined) {
|
if (message.tank_name !== undefined) {
|
||||||
obj.tank_name = message.tank_name;
|
obj.tank_name = I18nString.toJSON(message.tank_name);
|
||||||
}
|
}
|
||||||
if (message.tank_name_full !== undefined && message.tank_name_full !== undefined) {
|
if (message.tank_name_full !== undefined) {
|
||||||
obj.tank_name_full = message.tank_name_full;
|
obj.tank_name_full = I18nString.toJSON(message.tank_name_full);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
@@ -290,9 +291,15 @@ export const Camouflage: MessageFns<Camouflage> = {
|
|||||||
fromPartial<I extends Exact<DeepPartial<Camouflage>, I>>(object: I): Camouflage {
|
fromPartial<I extends Exact<DeepPartial<Camouflage>, I>>(object: I): Camouflage {
|
||||||
const message = createBaseCamouflage();
|
const message = createBaseCamouflage();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
message.tank_name = object.tank_name ?? undefined;
|
? I18nString.fromPartial(object.name)
|
||||||
message.tank_name_full = object.tank_name_full ?? undefined;
|
: createBaseI18nString();
|
||||||
|
message.tank_name = (object.tank_name !== undefined && object.tank_name !== null)
|
||||||
|
? I18nString.fromPartial(object.tank_name)
|
||||||
|
: undefined;
|
||||||
|
message.tank_name_full = (object.tank_name_full !== undefined && object.tank_name_full !== null)
|
||||||
|
? I18nString.fromPartial(object.tank_name_full)
|
||||||
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ syntax = "proto2";
|
|||||||
|
|
||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message ConsumableDefinitions {
|
message ConsumableDefinitions {
|
||||||
map<uint32, Consumable> consumables = 1;
|
map<uint32, Consumable> consumables = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Consumable {
|
message Consumable {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required string name = 2;
|
required I18nString name = 2;
|
||||||
required uint32 cooldown = 3;
|
required uint32 cooldown = 3;
|
||||||
optional float duration = 4;
|
optional float duration = 4;
|
||||||
required bool game_mode_exclusive = 5;
|
required bool game_mode_exclusive = 5;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ export interface ConsumableDefinitions_ConsumablesEntry {
|
|||||||
|
|
||||||
export interface Consumable {
|
export interface Consumable {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
cooldown: number;
|
cooldown: number;
|
||||||
duration?: number | undefined;
|
duration?: number | undefined;
|
||||||
game_mode_exclusive: boolean;
|
game_mode_exclusive: boolean;
|
||||||
@@ -240,13 +241,21 @@ export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefini
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? Consumable.fromPartial(object.value)
|
? Consumable.fromPartial(object.value)
|
||||||
: createBaseConsumable();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function createBaseConsumable(): Consumable {
|
function createBaseConsumable(): Consumable {
|
||||||
return { id: 0, name: "", cooldown: 0, duration: undefined, game_mode_exclusive: false, include: [], exclude: [] };
|
return {
|
||||||
|
id: 0,
|
||||||
|
name: createBaseI18nString(),
|
||||||
|
cooldown: 0,
|
||||||
|
duration: undefined,
|
||||||
|
game_mode_exclusive: false,
|
||||||
|
include: [],
|
||||||
|
exclude: [],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Consumable: MessageFns<Consumable> = {
|
export const Consumable: MessageFns<Consumable> = {
|
||||||
@@ -254,8 +263,8 @@ export const Consumable: MessageFns<Consumable> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
writer.uint32(8).uint32(message.id);
|
writer.uint32(8).uint32(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(18).string(message.name);
|
I18nString.encode(message.name, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.cooldown !== 0) {
|
if (message.cooldown !== 0) {
|
||||||
writer.uint32(24).uint32(message.cooldown);
|
writer.uint32(24).uint32(message.cooldown);
|
||||||
@@ -295,7 +304,7 @@ export const Consumable: MessageFns<Consumable> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@@ -350,7 +359,7 @@ export const Consumable: MessageFns<Consumable> = {
|
|||||||
fromJSON(object: any): Consumable {
|
fromJSON(object: any): Consumable {
|
||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("Consumable.id", object.id)),
|
id: globalThis.Number(assertSet("Consumable.id", object.id)),
|
||||||
name: globalThis.String(assertSet("Consumable.name", object.name)),
|
name: I18nString.fromJSON(assertSet("Consumable.name", object.name)),
|
||||||
cooldown: globalThis.Number(assertSet("Consumable.cooldown", object.cooldown)),
|
cooldown: globalThis.Number(assertSet("Consumable.cooldown", object.cooldown)),
|
||||||
duration: isSet(object.duration) ? globalThis.Number(object.duration) : undefined,
|
duration: isSet(object.duration) ? globalThis.Number(object.duration) : undefined,
|
||||||
game_mode_exclusive: globalThis.Boolean(assertSet("Consumable.game_mode_exclusive", object.game_mode_exclusive)),
|
game_mode_exclusive: globalThis.Boolean(assertSet("Consumable.game_mode_exclusive", object.game_mode_exclusive)),
|
||||||
@@ -368,8 +377,8 @@ export const Consumable: MessageFns<Consumable> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
obj.id = Math.round(message.id);
|
obj.id = Math.round(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.cooldown !== 0) {
|
if (message.cooldown !== 0) {
|
||||||
obj.cooldown = Math.round(message.cooldown);
|
obj.cooldown = Math.round(message.cooldown);
|
||||||
@@ -395,7 +404,9 @@ export const Consumable: MessageFns<Consumable> = {
|
|||||||
fromPartial<I extends Exact<DeepPartial<Consumable>, I>>(object: I): Consumable {
|
fromPartial<I extends Exact<DeepPartial<Consumable>, I>>(object: I): Consumable {
|
||||||
const message = createBaseConsumable();
|
const message = createBaseConsumable();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.cooldown = object.cooldown ?? 0;
|
message.cooldown = object.cooldown ?? 0;
|
||||||
message.duration = object.duration ?? undefined;
|
message.duration = object.duration ?? undefined;
|
||||||
message.game_mode_exclusive = object.game_mode_exclusive ?? false;
|
message.game_mode_exclusive = object.game_mode_exclusive ?? false;
|
||||||
|
|||||||
@@ -2,14 +2,16 @@ syntax = "proto2";
|
|||||||
|
|
||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message EquipmentDefinitions {
|
message EquipmentDefinitions {
|
||||||
map<string, EquipmentPreset> presets = 1;
|
map<string, EquipmentPreset> presets = 1;
|
||||||
map<uint32, Equipment> equipments = 2;
|
map<uint32, Equipment> equipments = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Equipment {
|
message Equipment {
|
||||||
required string name = 1;
|
required I18nString name = 1;
|
||||||
required string description = 2;
|
required I18nString description = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message EquipmentPreset {
|
message EquipmentPreset {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -25,8 +26,8 @@ export interface EquipmentDefinitions_EquipmentsEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Equipment {
|
export interface Equipment {
|
||||||
name: string;
|
name: I18nString;
|
||||||
description: string;
|
description: I18nString;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EquipmentPreset {
|
export interface EquipmentPreset {
|
||||||
@@ -235,7 +236,7 @@ export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_
|
|||||||
message.key = object.key ?? "";
|
message.key = object.key ?? "";
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? EquipmentPreset.fromPartial(object.value)
|
? EquipmentPreset.fromPartial(object.value)
|
||||||
: createBaseEquipmentPreset();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -317,22 +318,22 @@ export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitio
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? Equipment.fromPartial(object.value)
|
? Equipment.fromPartial(object.value)
|
||||||
: createBaseEquipment();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function createBaseEquipment(): Equipment {
|
function createBaseEquipment(): Equipment {
|
||||||
return { name: "", description: "" };
|
return { name: createBaseI18nString(), description: createBaseI18nString() };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Equipment: MessageFns<Equipment> = {
|
export const Equipment: MessageFns<Equipment> = {
|
||||||
encode(message: Equipment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
encode(message: Equipment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(10).string(message.name);
|
I18nString.encode(message.name, writer.uint32(10).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.description !== "") {
|
if (message.description !== undefined) {
|
||||||
writer.uint32(18).string(message.description);
|
I18nString.encode(message.description, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
@@ -349,7 +350,7 @@ export const Equipment: MessageFns<Equipment> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
@@ -357,7 +358,7 @@ export const Equipment: MessageFns<Equipment> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.description = reader.string();
|
message.description = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,18 +372,18 @@ export const Equipment: MessageFns<Equipment> = {
|
|||||||
|
|
||||||
fromJSON(object: any): Equipment {
|
fromJSON(object: any): Equipment {
|
||||||
return {
|
return {
|
||||||
name: globalThis.String(assertSet("Equipment.name", object.name)),
|
name: I18nString.fromJSON(assertSet("Equipment.name", object.name)),
|
||||||
description: globalThis.String(assertSet("Equipment.description", object.description)),
|
description: I18nString.fromJSON(assertSet("Equipment.description", object.description)),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
toJSON(message: Equipment): unknown {
|
toJSON(message: Equipment): unknown {
|
||||||
const obj: any = {};
|
const obj: any = {};
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.description !== "") {
|
if (message.description !== undefined) {
|
||||||
obj.description = message.description;
|
obj.description = I18nString.toJSON(message.description);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
@@ -392,8 +393,12 @@ export const Equipment: MessageFns<Equipment> = {
|
|||||||
},
|
},
|
||||||
fromPartial<I extends Exact<DeepPartial<Equipment>, I>>(object: I): Equipment {
|
fromPartial<I extends Exact<DeepPartial<Equipment>, I>>(object: I): Equipment {
|
||||||
const message = createBaseEquipment();
|
const message = createBaseEquipment();
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
message.description = object.description ?? "";
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
|
message.description = (object.description !== undefined && object.description !== null)
|
||||||
|
? I18nString.fromPartial(object.description)
|
||||||
|
: createBaseI18nString();
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ syntax = "proto2";
|
|||||||
|
|
||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message GameDefinitions {
|
message GameDefinitions {
|
||||||
required string version = 1;
|
required string version = 1;
|
||||||
repeated string nations = 2;
|
repeated string nations = 2;
|
||||||
@@ -10,7 +12,7 @@ message GameDefinitions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GameMode {
|
message GameMode {
|
||||||
required string name = 1;
|
required I18nString name = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GameModeRole {
|
message GameModeRole {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ export interface GameDefinitions_RolesEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface GameMode {
|
export interface GameMode {
|
||||||
name: string;
|
name: I18nString;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GameModeRole {
|
export interface GameModeRole {
|
||||||
@@ -259,7 +260,7 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? GameMode.fromPartial(object.value)
|
? GameMode.fromPartial(object.value)
|
||||||
: createBaseGameMode();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -337,19 +338,19 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? GameModeRole.fromPartial(object.value)
|
? GameModeRole.fromPartial(object.value)
|
||||||
: createBaseGameModeRole();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function createBaseGameMode(): GameMode {
|
function createBaseGameMode(): GameMode {
|
||||||
return { name: "" };
|
return { name: createBaseI18nString() };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GameMode: MessageFns<GameMode> = {
|
export const GameMode: MessageFns<GameMode> = {
|
||||||
encode(message: GameMode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
encode(message: GameMode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(10).string(message.name);
|
I18nString.encode(message.name, writer.uint32(10).fork()).join();
|
||||||
}
|
}
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
@@ -366,7 +367,7 @@ export const GameMode: MessageFns<GameMode> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,13 +380,13 @@ export const GameMode: MessageFns<GameMode> = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
fromJSON(object: any): GameMode {
|
fromJSON(object: any): GameMode {
|
||||||
return { name: globalThis.String(assertSet("GameMode.name", object.name)) };
|
return { name: I18nString.fromJSON(assertSet("GameMode.name", object.name)) };
|
||||||
},
|
},
|
||||||
|
|
||||||
toJSON(message: GameMode): unknown {
|
toJSON(message: GameMode): unknown {
|
||||||
const obj: any = {};
|
const obj: any = {};
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
@@ -395,7 +396,9 @@ export const GameMode: MessageFns<GameMode> = {
|
|||||||
},
|
},
|
||||||
fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode {
|
fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode {
|
||||||
const message = createBaseGameMode();
|
const message = createBaseGameMode();
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package blitzkit;
|
||||||
|
|
||||||
|
message I18nString {
|
||||||
|
map<string, string> locales = 1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
// 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/i18n.proto
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
|
||||||
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
|
export interface I18nString {
|
||||||
|
locales: { [key: string]: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface I18nString_LocalesEntry {
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createBaseI18nString(): I18nString {
|
||||||
|
return { locales: {} };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const I18nString: MessageFns<I18nString> = {
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decode(input: BinaryReader | Uint8Array, length?: number): I18nString {
|
||||||
|
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) {
|
||||||
|
const tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1: {
|
||||||
|
if (tag !== 10) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const entry1 = I18nString_LocalesEntry.decode(reader, reader.uint32());
|
||||||
|
if (entry1.value !== undefined) {
|
||||||
|
message.locales[entry1.key] = entry1.value;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((tag & 7) === 4 || tag === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
reader.skip(tag & 7);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
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;
|
||||||
|
}, {})
|
||||||
|
: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: I18nString): unknown {
|
||||||
|
const obj: any = {};
|
||||||
|
if (message.locales) {
|
||||||
|
const entries = Object.entries(message.locales);
|
||||||
|
if (entries.length > 0) {
|
||||||
|
obj.locales = {};
|
||||||
|
entries.forEach(([k, v]) => {
|
||||||
|
obj.locales[k] = v;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
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 {
|
||||||
|
const message = createBaseI18nString();
|
||||||
|
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
||||||
|
if (value !== undefined) {
|
||||||
|
acc[key] = globalThis.String(value);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function createBaseI18nString_LocalesEntry(): I18nString_LocalesEntry {
|
||||||
|
return { key: "", value: "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
|
||||||
|
encode(message: I18nString_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||||
|
if (message.key !== undefined) {
|
||||||
|
writer.uint32(10).string(message.key);
|
||||||
|
}
|
||||||
|
if (message.value !== undefined) {
|
||||||
|
writer.uint32(18).string(message.value);
|
||||||
|
}
|
||||||
|
return writer;
|
||||||
|
},
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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 = reader.string();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((tag & 7) === 4 || tag === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
reader.skip(tag & 7);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
|
||||||
|
fromJSON(object: any): I18nString_LocalesEntry {
|
||||||
|
return {
|
||||||
|
key: globalThis.String(assertSet("I18nString_LocalesEntry.key", object.key)),
|
||||||
|
value: globalThis.String(assertSet("I18nString_LocalesEntry.value", object.value)),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
toJSON(message: I18nString_LocalesEntry): 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<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 {
|
||||||
|
const message = createBaseI18nString_LocalesEntry();
|
||||||
|
message.key = object.key ?? "";
|
||||||
|
message.value = object.value ?? "";
|
||||||
|
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;
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ export * from './camouflage_definitions.ts';
|
|||||||
export * from './consumable_definitions.ts';
|
export * from './consumable_definitions.ts';
|
||||||
export * from './equipment_definitions.ts';
|
export * from './equipment_definitions.ts';
|
||||||
export * from './game_definitions.ts';
|
export * from './game_definitions.ts';
|
||||||
|
export * from './i18n.ts';
|
||||||
export * from './map_definitions.ts';
|
export * from './map_definitions.ts';
|
||||||
export * from './model_definitions.ts';
|
export * from './model_definitions.ts';
|
||||||
export * from './provision_definitions.ts';
|
export * from './provision_definitions.ts';
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ syntax = "proto2";
|
|||||||
|
|
||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message MapDefinitions {
|
message MapDefinitions {
|
||||||
map<int32, MapDefinition> maps = 1;
|
map<int32, MapDefinition> maps = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MapDefinition {
|
message MapDefinition {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required string name = 2;
|
required I18nString name = 2;
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ export interface MapDefinitions_MapsEntry {
|
|||||||
|
|
||||||
export interface MapDefinition {
|
export interface MapDefinition {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createBaseMapDefinitions(): MapDefinitions {
|
function createBaseMapDefinitions(): MapDefinitions {
|
||||||
@@ -175,13 +176,13 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? MapDefinition.fromPartial(object.value)
|
? MapDefinition.fromPartial(object.value)
|
||||||
: createBaseMapDefinition();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function createBaseMapDefinition(): MapDefinition {
|
function createBaseMapDefinition(): MapDefinition {
|
||||||
return { id: 0, name: "" };
|
return { id: 0, name: createBaseI18nString() };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MapDefinition: MessageFns<MapDefinition> = {
|
export const MapDefinition: MessageFns<MapDefinition> = {
|
||||||
@@ -189,8 +190,8 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
writer.uint32(8).uint32(message.id);
|
writer.uint32(8).uint32(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(18).string(message.name);
|
I18nString.encode(message.name, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
return writer;
|
return writer;
|
||||||
},
|
},
|
||||||
@@ -215,7 +216,7 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +231,7 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
|||||||
fromJSON(object: any): MapDefinition {
|
fromJSON(object: any): MapDefinition {
|
||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("MapDefinition.id", object.id)),
|
id: globalThis.Number(assertSet("MapDefinition.id", object.id)),
|
||||||
name: globalThis.String(assertSet("MapDefinition.name", object.name)),
|
name: I18nString.fromJSON(assertSet("MapDefinition.name", object.name)),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -239,8 +240,8 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
obj.id = Math.round(message.id);
|
obj.id = Math.round(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
@@ -251,7 +252,9 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
|||||||
fromPartial<I extends Exact<DeepPartial<MapDefinition>, I>>(object: I): MapDefinition {
|
fromPartial<I extends Exact<DeepPartial<MapDefinition>, I>>(object: I): MapDefinition {
|
||||||
const message = createBaseMapDefinition();
|
const message = createBaseMapDefinition();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ export const ModelDefinitions_ModelsEntry: MessageFns<ModelDefinitions_ModelsEnt
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? ModelDefinition.fromPartial(object.value)
|
? ModelDefinition.fromPartial(object.value)
|
||||||
: createBaseModelDefinition();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -545,7 +545,7 @@ export const ModelDefinition_TurretsEntry: MessageFns<ModelDefinition_TurretsEnt
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? TurretModelDefinition.fromPartial(object.value)
|
? TurretModelDefinition.fromPartial(object.value)
|
||||||
: createBaseTurretModelDefinition();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -623,7 +623,7 @@ export const ModelDefinition_TracksEntry: MessageFns<ModelDefinition_TracksEntry
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? TrackModelDefinition.fromPartial(object.value)
|
? TrackModelDefinition.fromPartial(object.value)
|
||||||
: createBaseTrackModelDefinition();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1248,7 +1248,7 @@ export const TurretModelDefinition_GunsEntry: MessageFns<TurretModelDefinition_G
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? GunModelDefinition.fromPartial(object.value)
|
? GunModelDefinition.fromPartial(object.value)
|
||||||
: createBaseGunModelDefinition();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ syntax = "proto2";
|
|||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
import "packages/core/src/protos/consumable_definitions.proto";
|
import "packages/core/src/protos/consumable_definitions.proto";
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message ProvisionDefinitions {
|
message ProvisionDefinitions {
|
||||||
map<uint32, Provision> provisions = 1;
|
map<uint32, Provision> provisions = 1;
|
||||||
@@ -10,7 +11,7 @@ message ProvisionDefinitions {
|
|||||||
|
|
||||||
message Provision {
|
message Provision {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required string name = 2;
|
required I18nString name = 2;
|
||||||
optional float crew = 3;
|
optional float crew = 3;
|
||||||
required bool game_mode_exclusive = 5;
|
required bool game_mode_exclusive = 5;
|
||||||
repeated ConsumableTankFilter include = 6;
|
repeated ConsumableTankFilter include = 6;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
import { ConsumableTankFilter } from "./consumable_definitions";
|
import { ConsumableTankFilter } from "./consumable_definitions";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ export interface ProvisionDefinitions_ProvisionsEntry {
|
|||||||
|
|
||||||
export interface Provision {
|
export interface Provision {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
crew?: number | undefined;
|
crew?: number | undefined;
|
||||||
game_mode_exclusive: boolean;
|
game_mode_exclusive: boolean;
|
||||||
include: ConsumableTankFilter[];
|
include: ConsumableTankFilter[];
|
||||||
@@ -187,13 +188,13 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? Provision.fromPartial(object.value)
|
? Provision.fromPartial(object.value)
|
||||||
: createBaseProvision();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function createBaseProvision(): Provision {
|
function createBaseProvision(): Provision {
|
||||||
return { id: 0, name: "", crew: undefined, game_mode_exclusive: false, include: [], exclude: [] };
|
return { id: 0, name: createBaseI18nString(), crew: undefined, game_mode_exclusive: false, include: [], exclude: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Provision: MessageFns<Provision> = {
|
export const Provision: MessageFns<Provision> = {
|
||||||
@@ -201,8 +202,8 @@ export const Provision: MessageFns<Provision> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
writer.uint32(8).uint32(message.id);
|
writer.uint32(8).uint32(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(18).string(message.name);
|
I18nString.encode(message.name, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.crew !== undefined && message.crew !== undefined) {
|
if (message.crew !== undefined && message.crew !== undefined) {
|
||||||
writer.uint32(29).float(message.crew);
|
writer.uint32(29).float(message.crew);
|
||||||
@@ -239,7 +240,7 @@ export const Provision: MessageFns<Provision> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@@ -286,7 +287,7 @@ export const Provision: MessageFns<Provision> = {
|
|||||||
fromJSON(object: any): Provision {
|
fromJSON(object: any): Provision {
|
||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("Provision.id", object.id)),
|
id: globalThis.Number(assertSet("Provision.id", object.id)),
|
||||||
name: globalThis.String(assertSet("Provision.name", object.name)),
|
name: I18nString.fromJSON(assertSet("Provision.name", object.name)),
|
||||||
crew: isSet(object.crew) ? globalThis.Number(object.crew) : undefined,
|
crew: isSet(object.crew) ? globalThis.Number(object.crew) : undefined,
|
||||||
game_mode_exclusive: globalThis.Boolean(assertSet("Provision.game_mode_exclusive", object.game_mode_exclusive)),
|
game_mode_exclusive: globalThis.Boolean(assertSet("Provision.game_mode_exclusive", object.game_mode_exclusive)),
|
||||||
include: globalThis.Array.isArray(object?.include)
|
include: globalThis.Array.isArray(object?.include)
|
||||||
@@ -303,8 +304,8 @@ export const Provision: MessageFns<Provision> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
obj.id = Math.round(message.id);
|
obj.id = Math.round(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.crew !== undefined && message.crew !== undefined) {
|
if (message.crew !== undefined && message.crew !== undefined) {
|
||||||
obj.crew = message.crew;
|
obj.crew = message.crew;
|
||||||
@@ -327,7 +328,9 @@ export const Provision: MessageFns<Provision> = {
|
|||||||
fromPartial<I extends Exact<DeepPartial<Provision>, I>>(object: I): Provision {
|
fromPartial<I extends Exact<DeepPartial<Provision>, I>>(object: I): Provision {
|
||||||
const message = createBaseProvision();
|
const message = createBaseProvision();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.crew = object.crew ?? undefined;
|
message.crew = object.crew ?? undefined;
|
||||||
message.game_mode_exclusive = object.game_mode_exclusive ?? false;
|
message.game_mode_exclusive = object.game_mode_exclusive ?? false;
|
||||||
message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
|
message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ export const Reviews_ReviewsEntry: MessageFns<Reviews_ReviewsEntry> = {
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? Review.fromPartial(object.value)
|
? Review.fromPartial(object.value)
|
||||||
: createBaseReview();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ export const SkillDefinitions_ClassesEntry: MessageFns<SkillDefinitions_ClassesE
|
|||||||
): SkillDefinitions_ClassesEntry {
|
): SkillDefinitions_ClassesEntry {
|
||||||
const message = createBaseSkillDefinitions_ClassesEntry();
|
const message = createBaseSkillDefinitions_ClassesEntry();
|
||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null) ? Skill.fromPartial(object.value) : undefined;
|
||||||
? Skill.fromPartial(object.value)
|
|
||||||
: createBaseSkill();
|
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ syntax = "proto2";
|
|||||||
|
|
||||||
package blitzkit;
|
package blitzkit;
|
||||||
|
|
||||||
|
import "packages/core/src/protos/i18n.proto";
|
||||||
|
|
||||||
message TankDefinitions {
|
message TankDefinitions {
|
||||||
map<uint32, TankDefinition> tanks = 1;
|
map<uint32, TankDefinition> tanks = 1;
|
||||||
}
|
}
|
||||||
@@ -9,7 +11,6 @@ message TankDefinitions {
|
|||||||
message TankDefinition {
|
message TankDefinition {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
map<uint32, uint32> roles = 2;
|
map<uint32, uint32> roles = 2;
|
||||||
optional string description = 3;
|
|
||||||
required bool fixed_camouflage = 4;
|
required bool fixed_camouflage = 4;
|
||||||
repeated int32 camouflages = 5;
|
repeated int32 camouflages = 5;
|
||||||
repeated int32 ancestors = 6;
|
repeated int32 ancestors = 6;
|
||||||
@@ -17,8 +18,8 @@ message TankDefinition {
|
|||||||
repeated Crew crew = 8;
|
repeated Crew crew = 8;
|
||||||
required uint32 health = 9;
|
required uint32 health = 9;
|
||||||
required string nation = 10;
|
required string nation = 10;
|
||||||
required string name = 11;
|
required I18nString name = 11;
|
||||||
optional string name_full = 12;
|
optional I18nString name_full = 12;
|
||||||
required TankType type = 13;
|
required TankType type = 13;
|
||||||
required uint32 max_consumables = 14;
|
required uint32 max_consumables = 14;
|
||||||
required uint32 max_provisions = 15;
|
required uint32 max_provisions = 15;
|
||||||
@@ -65,7 +66,7 @@ message TankPrice {
|
|||||||
message TrackDefinition {
|
message TrackDefinition {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required uint32 tier = 2;
|
required uint32 tier = 2;
|
||||||
required string name = 3;
|
required I18nString name = 3;
|
||||||
required uint32 weight = 4;
|
required uint32 weight = 4;
|
||||||
required float traverse_speed = 5;
|
required float traverse_speed = 5;
|
||||||
optional ResearchCost research_cost = 6;
|
optional ResearchCost research_cost = 6;
|
||||||
@@ -79,7 +80,7 @@ message TrackDefinition {
|
|||||||
|
|
||||||
message EngineDefinition {
|
message EngineDefinition {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required string name = 2;
|
required I18nString name = 2;
|
||||||
optional ResearchCost research_cost = 3;
|
optional ResearchCost research_cost = 3;
|
||||||
required uint32 tier = 4;
|
required uint32 tier = 4;
|
||||||
required float fire_chance = 5;
|
required float fire_chance = 5;
|
||||||
@@ -94,7 +95,7 @@ message TurretDefinition {
|
|||||||
required uint32 view_range = 3;
|
required uint32 view_range = 3;
|
||||||
required float traverse_speed = 4;
|
required float traverse_speed = 4;
|
||||||
optional ResearchCost research_cost = 5;
|
optional ResearchCost research_cost = 5;
|
||||||
required string name = 6;
|
required I18nString name = 6;
|
||||||
required uint32 tier = 7;
|
required uint32 tier = 7;
|
||||||
required uint32 weight = 8;
|
required uint32 weight = 8;
|
||||||
repeated GunDefinition guns = 9;
|
repeated GunDefinition guns = 9;
|
||||||
@@ -145,7 +146,7 @@ message GunDefinitionBase {
|
|||||||
required float rotation_speed = 2;
|
required float rotation_speed = 2;
|
||||||
optional ResearchCost research_cost = 3;
|
optional ResearchCost research_cost = 3;
|
||||||
required uint32 weight = 4;
|
required uint32 weight = 4;
|
||||||
required string name = 5;
|
required I18nString name = 5;
|
||||||
required uint32 tier = 6;
|
required uint32 tier = 6;
|
||||||
repeated ShellDefinition shells = 7;
|
repeated ShellDefinition shells = 7;
|
||||||
required float camouflage_loss = 8;
|
required float camouflage_loss = 8;
|
||||||
@@ -160,7 +161,7 @@ message GunDefinitionBase {
|
|||||||
|
|
||||||
message ShellDefinition {
|
message ShellDefinition {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required string name = 2;
|
required I18nString name = 2;
|
||||||
required uint32 velocity = 3;
|
required uint32 velocity = 3;
|
||||||
required uint32 armor_damage = 4;
|
required uint32 armor_damage = 4;
|
||||||
required uint32 module_damage = 5;
|
required uint32 module_damage = 5;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||||
|
import { I18nString } from "./i18n";
|
||||||
|
|
||||||
export const protobufPackage = "blitzkit";
|
export const protobufPackage = "blitzkit";
|
||||||
|
|
||||||
@@ -261,7 +262,6 @@ export interface TankDefinitions_TanksEntry {
|
|||||||
export interface TankDefinition {
|
export interface TankDefinition {
|
||||||
id: number;
|
id: number;
|
||||||
roles: { [key: number]: number };
|
roles: { [key: number]: number };
|
||||||
description?: string | undefined;
|
|
||||||
fixed_camouflage: boolean;
|
fixed_camouflage: boolean;
|
||||||
camouflages: number[];
|
camouflages: number[];
|
||||||
ancestors: number[];
|
ancestors: number[];
|
||||||
@@ -269,8 +269,8 @@ export interface TankDefinition {
|
|||||||
crew: Crew[];
|
crew: Crew[];
|
||||||
health: number;
|
health: number;
|
||||||
nation: string;
|
nation: string;
|
||||||
name: string;
|
name: I18nString;
|
||||||
name_full?: string | undefined;
|
name_full?: I18nString | undefined;
|
||||||
type: TankType;
|
type: TankType;
|
||||||
max_consumables: number;
|
max_consumables: number;
|
||||||
max_provisions: number;
|
max_provisions: number;
|
||||||
@@ -317,7 +317,7 @@ export interface TankPrice {
|
|||||||
export interface TrackDefinition {
|
export interface TrackDefinition {
|
||||||
id: number;
|
id: number;
|
||||||
tier: number;
|
tier: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
weight: number;
|
weight: number;
|
||||||
traverse_speed: number;
|
traverse_speed: number;
|
||||||
research_cost?: ResearchCost | undefined;
|
research_cost?: ResearchCost | undefined;
|
||||||
@@ -331,7 +331,7 @@ export interface TrackDefinition {
|
|||||||
|
|
||||||
export interface EngineDefinition {
|
export interface EngineDefinition {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
research_cost?: ResearchCost | undefined;
|
research_cost?: ResearchCost | undefined;
|
||||||
tier: number;
|
tier: number;
|
||||||
fire_chance: number;
|
fire_chance: number;
|
||||||
@@ -346,7 +346,7 @@ export interface TurretDefinition {
|
|||||||
view_range: number;
|
view_range: number;
|
||||||
traverse_speed: number;
|
traverse_speed: number;
|
||||||
research_cost?: ResearchCost | undefined;
|
research_cost?: ResearchCost | undefined;
|
||||||
name: string;
|
name: I18nString;
|
||||||
tier: number;
|
tier: number;
|
||||||
weight: number;
|
weight: number;
|
||||||
guns: GunDefinition[];
|
guns: GunDefinition[];
|
||||||
@@ -397,7 +397,7 @@ export interface GunDefinitionBase {
|
|||||||
rotation_speed: number;
|
rotation_speed: number;
|
||||||
research_cost?: ResearchCost | undefined;
|
research_cost?: ResearchCost | undefined;
|
||||||
weight: number;
|
weight: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
tier: number;
|
tier: number;
|
||||||
shells: ShellDefinition[];
|
shells: ShellDefinition[];
|
||||||
camouflage_loss: number;
|
camouflage_loss: number;
|
||||||
@@ -412,7 +412,7 @@ export interface GunDefinitionBase {
|
|||||||
|
|
||||||
export interface ShellDefinition {
|
export interface ShellDefinition {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: I18nString;
|
||||||
velocity: number;
|
velocity: number;
|
||||||
armor_damage: number;
|
armor_damage: number;
|
||||||
module_damage: number;
|
module_damage: number;
|
||||||
@@ -603,7 +603,7 @@ export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry>
|
|||||||
message.key = object.key ?? 0;
|
message.key = object.key ?? 0;
|
||||||
message.value = (object.value !== undefined && object.value !== null)
|
message.value = (object.value !== undefined && object.value !== null)
|
||||||
? TankDefinition.fromPartial(object.value)
|
? TankDefinition.fromPartial(object.value)
|
||||||
: createBaseTankDefinition();
|
: undefined;
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -612,7 +612,6 @@ function createBaseTankDefinition(): TankDefinition {
|
|||||||
return {
|
return {
|
||||||
id: 0,
|
id: 0,
|
||||||
roles: {},
|
roles: {},
|
||||||
description: undefined,
|
|
||||||
fixed_camouflage: false,
|
fixed_camouflage: false,
|
||||||
camouflages: [],
|
camouflages: [],
|
||||||
ancestors: [],
|
ancestors: [],
|
||||||
@@ -620,7 +619,7 @@ function createBaseTankDefinition(): TankDefinition {
|
|||||||
crew: [],
|
crew: [],
|
||||||
health: 0,
|
health: 0,
|
||||||
nation: "",
|
nation: "",
|
||||||
name: "",
|
name: createBaseI18nString(),
|
||||||
name_full: undefined,
|
name_full: undefined,
|
||||||
type: 0,
|
type: 0,
|
||||||
max_consumables: 0,
|
max_consumables: 0,
|
||||||
@@ -652,9 +651,6 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
Object.entries(message.roles).forEach(([key, value]) => {
|
Object.entries(message.roles).forEach(([key, value]) => {
|
||||||
TankDefinition_RolesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
|
TankDefinition_RolesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
|
||||||
});
|
});
|
||||||
if (message.description !== undefined && message.description !== undefined) {
|
|
||||||
writer.uint32(26).string(message.description);
|
|
||||||
}
|
|
||||||
if (message.fixed_camouflage !== false) {
|
if (message.fixed_camouflage !== false) {
|
||||||
writer.uint32(32).bool(message.fixed_camouflage);
|
writer.uint32(32).bool(message.fixed_camouflage);
|
||||||
}
|
}
|
||||||
@@ -682,11 +678,11 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
if (message.nation !== "") {
|
if (message.nation !== "") {
|
||||||
writer.uint32(82).string(message.nation);
|
writer.uint32(82).string(message.nation);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(90).string(message.name);
|
I18nString.encode(message.name, writer.uint32(90).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.name_full !== undefined && message.name_full !== undefined) {
|
if (message.name_full !== undefined) {
|
||||||
writer.uint32(98).string(message.name_full);
|
I18nString.encode(message.name_full, writer.uint32(98).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.type !== 0) {
|
if (message.type !== 0) {
|
||||||
writer.uint32(104).int32(message.type);
|
writer.uint32(104).int32(message.type);
|
||||||
@@ -774,14 +770,6 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 3: {
|
|
||||||
if (tag !== 26) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
message.description = reader.string();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 4: {
|
case 4: {
|
||||||
if (tag !== 32) {
|
if (tag !== 32) {
|
||||||
break;
|
break;
|
||||||
@@ -873,7 +861,7 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 12: {
|
case 12: {
|
||||||
@@ -881,7 +869,7 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name_full = reader.string();
|
message.name_full = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 13: {
|
case 13: {
|
||||||
@@ -1054,7 +1042,6 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
: {},
|
: {},
|
||||||
description: isSet(object.description) ? globalThis.String(object.description) : undefined,
|
|
||||||
fixed_camouflage: globalThis.Boolean(assertSet("TankDefinition.fixed_camouflage", object.fixed_camouflage)),
|
fixed_camouflage: globalThis.Boolean(assertSet("TankDefinition.fixed_camouflage", object.fixed_camouflage)),
|
||||||
camouflages: globalThis.Array.isArray(object?.camouflages)
|
camouflages: globalThis.Array.isArray(object?.camouflages)
|
||||||
? object.camouflages.map((e: any) => globalThis.Number(e))
|
? object.camouflages.map((e: any) => globalThis.Number(e))
|
||||||
@@ -1068,8 +1055,8 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
crew: globalThis.Array.isArray(object?.crew) ? object.crew.map((e: any) => Crew.fromJSON(e)) : [],
|
crew: globalThis.Array.isArray(object?.crew) ? object.crew.map((e: any) => Crew.fromJSON(e)) : [],
|
||||||
health: globalThis.Number(assertSet("TankDefinition.health", object.health)),
|
health: globalThis.Number(assertSet("TankDefinition.health", object.health)),
|
||||||
nation: globalThis.String(assertSet("TankDefinition.nation", object.nation)),
|
nation: globalThis.String(assertSet("TankDefinition.nation", object.nation)),
|
||||||
name: globalThis.String(assertSet("TankDefinition.name", object.name)),
|
name: I18nString.fromJSON(assertSet("TankDefinition.name", object.name)),
|
||||||
name_full: isSet(object.name_full) ? globalThis.String(object.name_full) : undefined,
|
name_full: isSet(object.name_full) ? I18nString.fromJSON(object.name_full) : undefined,
|
||||||
type: tankTypeFromJSON(assertSet("TankDefinition.type", object.type)),
|
type: tankTypeFromJSON(assertSet("TankDefinition.type", object.type)),
|
||||||
max_consumables: globalThis.Number(assertSet("TankDefinition.max_consumables", object.max_consumables)),
|
max_consumables: globalThis.Number(assertSet("TankDefinition.max_consumables", object.max_consumables)),
|
||||||
max_provisions: globalThis.Number(assertSet("TankDefinition.max_provisions", object.max_provisions)),
|
max_provisions: globalThis.Number(assertSet("TankDefinition.max_provisions", object.max_provisions)),
|
||||||
@@ -1112,9 +1099,6 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message.description !== undefined && message.description !== undefined) {
|
|
||||||
obj.description = message.description;
|
|
||||||
}
|
|
||||||
if (message.fixed_camouflage !== false) {
|
if (message.fixed_camouflage !== false) {
|
||||||
obj.fixed_camouflage = message.fixed_camouflage;
|
obj.fixed_camouflage = message.fixed_camouflage;
|
||||||
}
|
}
|
||||||
@@ -1136,11 +1120,11 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
if (message.nation !== "") {
|
if (message.nation !== "") {
|
||||||
obj.nation = message.nation;
|
obj.nation = message.nation;
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.name_full !== undefined && message.name_full !== undefined) {
|
if (message.name_full !== undefined) {
|
||||||
obj.name_full = message.name_full;
|
obj.name_full = I18nString.toJSON(message.name_full);
|
||||||
}
|
}
|
||||||
if (message.type !== 0) {
|
if (message.type !== 0) {
|
||||||
obj.type = tankTypeToJSON(message.type);
|
obj.type = tankTypeToJSON(message.type);
|
||||||
@@ -1214,7 +1198,6 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
message.description = object.description ?? undefined;
|
|
||||||
message.fixed_camouflage = object.fixed_camouflage ?? false;
|
message.fixed_camouflage = object.fixed_camouflage ?? false;
|
||||||
message.camouflages = object.camouflages?.map((e) => e) || [];
|
message.camouflages = object.camouflages?.map((e) => e) || [];
|
||||||
message.ancestors = object.ancestors?.map((e) => e) || [];
|
message.ancestors = object.ancestors?.map((e) => e) || [];
|
||||||
@@ -1222,8 +1205,12 @@ export const TankDefinition: MessageFns<TankDefinition> = {
|
|||||||
message.crew = object.crew?.map((e) => Crew.fromPartial(e)) || [];
|
message.crew = object.crew?.map((e) => Crew.fromPartial(e)) || [];
|
||||||
message.health = object.health ?? 0;
|
message.health = object.health ?? 0;
|
||||||
message.nation = object.nation ?? "";
|
message.nation = object.nation ?? "";
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
message.name_full = object.name_full ?? undefined;
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
|
message.name_full = (object.name_full !== undefined && object.name_full !== null)
|
||||||
|
? I18nString.fromPartial(object.name_full)
|
||||||
|
: undefined;
|
||||||
message.type = object.type ?? 0;
|
message.type = object.type ?? 0;
|
||||||
message.max_consumables = object.max_consumables ?? 0;
|
message.max_consumables = object.max_consumables ?? 0;
|
||||||
message.max_provisions = object.max_provisions ?? 0;
|
message.max_provisions = object.max_provisions ?? 0;
|
||||||
@@ -1582,7 +1569,7 @@ function createBaseTrackDefinition(): TrackDefinition {
|
|||||||
return {
|
return {
|
||||||
id: 0,
|
id: 0,
|
||||||
tier: 0,
|
tier: 0,
|
||||||
name: "",
|
name: createBaseI18nString(),
|
||||||
weight: 0,
|
weight: 0,
|
||||||
traverse_speed: 0,
|
traverse_speed: 0,
|
||||||
research_cost: undefined,
|
research_cost: undefined,
|
||||||
@@ -1603,8 +1590,8 @@ export const TrackDefinition: MessageFns<TrackDefinition> = {
|
|||||||
if (message.tier !== 0) {
|
if (message.tier !== 0) {
|
||||||
writer.uint32(16).uint32(message.tier);
|
writer.uint32(16).uint32(message.tier);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(26).string(message.name);
|
I18nString.encode(message.name, writer.uint32(26).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.weight !== 0) {
|
if (message.weight !== 0) {
|
||||||
writer.uint32(32).uint32(message.weight);
|
writer.uint32(32).uint32(message.weight);
|
||||||
@@ -1664,7 +1651,7 @@ export const TrackDefinition: MessageFns<TrackDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
@@ -1752,7 +1739,7 @@ export const TrackDefinition: MessageFns<TrackDefinition> = {
|
|||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("TrackDefinition.id", object.id)),
|
id: globalThis.Number(assertSet("TrackDefinition.id", object.id)),
|
||||||
tier: globalThis.Number(assertSet("TrackDefinition.tier", object.tier)),
|
tier: globalThis.Number(assertSet("TrackDefinition.tier", object.tier)),
|
||||||
name: globalThis.String(assertSet("TrackDefinition.name", object.name)),
|
name: I18nString.fromJSON(assertSet("TrackDefinition.name", object.name)),
|
||||||
weight: globalThis.Number(assertSet("TrackDefinition.weight", object.weight)),
|
weight: globalThis.Number(assertSet("TrackDefinition.weight", object.weight)),
|
||||||
traverse_speed: globalThis.Number(assertSet("TrackDefinition.traverse_speed", object.traverse_speed)),
|
traverse_speed: globalThis.Number(assertSet("TrackDefinition.traverse_speed", object.traverse_speed)),
|
||||||
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
||||||
@@ -1775,8 +1762,8 @@ export const TrackDefinition: MessageFns<TrackDefinition> = {
|
|||||||
if (message.tier !== 0) {
|
if (message.tier !== 0) {
|
||||||
obj.tier = Math.round(message.tier);
|
obj.tier = Math.round(message.tier);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.weight !== 0) {
|
if (message.weight !== 0) {
|
||||||
obj.weight = Math.round(message.weight);
|
obj.weight = Math.round(message.weight);
|
||||||
@@ -1815,7 +1802,9 @@ export const TrackDefinition: MessageFns<TrackDefinition> = {
|
|||||||
const message = createBaseTrackDefinition();
|
const message = createBaseTrackDefinition();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.tier = object.tier ?? 0;
|
message.tier = object.tier ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.weight = object.weight ?? 0;
|
message.weight = object.weight ?? 0;
|
||||||
message.traverse_speed = object.traverse_speed ?? 0;
|
message.traverse_speed = object.traverse_speed ?? 0;
|
||||||
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
|
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
|
||||||
@@ -1832,7 +1821,16 @@ export const TrackDefinition: MessageFns<TrackDefinition> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function createBaseEngineDefinition(): EngineDefinition {
|
function createBaseEngineDefinition(): EngineDefinition {
|
||||||
return { id: 0, name: "", research_cost: undefined, tier: 0, fire_chance: 0, power: 0, weight: 0, unlocks: [] };
|
return {
|
||||||
|
id: 0,
|
||||||
|
name: createBaseI18nString(),
|
||||||
|
research_cost: undefined,
|
||||||
|
tier: 0,
|
||||||
|
fire_chance: 0,
|
||||||
|
power: 0,
|
||||||
|
weight: 0,
|
||||||
|
unlocks: [],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EngineDefinition: MessageFns<EngineDefinition> = {
|
export const EngineDefinition: MessageFns<EngineDefinition> = {
|
||||||
@@ -1840,8 +1838,8 @@ export const EngineDefinition: MessageFns<EngineDefinition> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
writer.uint32(8).uint32(message.id);
|
writer.uint32(8).uint32(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(18).string(message.name);
|
I18nString.encode(message.name, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.research_cost !== undefined) {
|
if (message.research_cost !== undefined) {
|
||||||
ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join();
|
ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join();
|
||||||
@@ -1884,7 +1882,7 @@ export const EngineDefinition: MessageFns<EngineDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@@ -1947,7 +1945,7 @@ export const EngineDefinition: MessageFns<EngineDefinition> = {
|
|||||||
fromJSON(object: any): EngineDefinition {
|
fromJSON(object: any): EngineDefinition {
|
||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("EngineDefinition.id", object.id)),
|
id: globalThis.Number(assertSet("EngineDefinition.id", object.id)),
|
||||||
name: globalThis.String(assertSet("EngineDefinition.name", object.name)),
|
name: I18nString.fromJSON(assertSet("EngineDefinition.name", object.name)),
|
||||||
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
||||||
tier: globalThis.Number(assertSet("EngineDefinition.tier", object.tier)),
|
tier: globalThis.Number(assertSet("EngineDefinition.tier", object.tier)),
|
||||||
fire_chance: globalThis.Number(assertSet("EngineDefinition.fire_chance", object.fire_chance)),
|
fire_chance: globalThis.Number(assertSet("EngineDefinition.fire_chance", object.fire_chance)),
|
||||||
@@ -1962,8 +1960,8 @@ export const EngineDefinition: MessageFns<EngineDefinition> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
obj.id = Math.round(message.id);
|
obj.id = Math.round(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.research_cost !== undefined) {
|
if (message.research_cost !== undefined) {
|
||||||
obj.research_cost = ResearchCost.toJSON(message.research_cost);
|
obj.research_cost = ResearchCost.toJSON(message.research_cost);
|
||||||
@@ -1992,7 +1990,9 @@ export const EngineDefinition: MessageFns<EngineDefinition> = {
|
|||||||
fromPartial<I extends Exact<DeepPartial<EngineDefinition>, I>>(object: I): EngineDefinition {
|
fromPartial<I extends Exact<DeepPartial<EngineDefinition>, I>>(object: I): EngineDefinition {
|
||||||
const message = createBaseEngineDefinition();
|
const message = createBaseEngineDefinition();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
|
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
|
||||||
? ResearchCost.fromPartial(object.research_cost)
|
? ResearchCost.fromPartial(object.research_cost)
|
||||||
: undefined;
|
: undefined;
|
||||||
@@ -2012,7 +2012,7 @@ function createBaseTurretDefinition(): TurretDefinition {
|
|||||||
view_range: 0,
|
view_range: 0,
|
||||||
traverse_speed: 0,
|
traverse_speed: 0,
|
||||||
research_cost: undefined,
|
research_cost: undefined,
|
||||||
name: "",
|
name: createBaseI18nString(),
|
||||||
tier: 0,
|
tier: 0,
|
||||||
weight: 0,
|
weight: 0,
|
||||||
guns: [],
|
guns: [],
|
||||||
@@ -2037,8 +2037,8 @@ export const TurretDefinition: MessageFns<TurretDefinition> = {
|
|||||||
if (message.research_cost !== undefined) {
|
if (message.research_cost !== undefined) {
|
||||||
ResearchCost.encode(message.research_cost, writer.uint32(42).fork()).join();
|
ResearchCost.encode(message.research_cost, writer.uint32(42).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(50).string(message.name);
|
I18nString.encode(message.name, writer.uint32(50).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.tier !== 0) {
|
if (message.tier !== 0) {
|
||||||
writer.uint32(56).uint32(message.tier);
|
writer.uint32(56).uint32(message.tier);
|
||||||
@@ -2107,7 +2107,7 @@ export const TurretDefinition: MessageFns<TurretDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
@@ -2158,7 +2158,7 @@ export const TurretDefinition: MessageFns<TurretDefinition> = {
|
|||||||
view_range: globalThis.Number(assertSet("TurretDefinition.view_range", object.view_range)),
|
view_range: globalThis.Number(assertSet("TurretDefinition.view_range", object.view_range)),
|
||||||
traverse_speed: globalThis.Number(assertSet("TurretDefinition.traverse_speed", object.traverse_speed)),
|
traverse_speed: globalThis.Number(assertSet("TurretDefinition.traverse_speed", object.traverse_speed)),
|
||||||
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
||||||
name: globalThis.String(assertSet("TurretDefinition.name", object.name)),
|
name: I18nString.fromJSON(assertSet("TurretDefinition.name", object.name)),
|
||||||
tier: globalThis.Number(assertSet("TurretDefinition.tier", object.tier)),
|
tier: globalThis.Number(assertSet("TurretDefinition.tier", object.tier)),
|
||||||
weight: globalThis.Number(assertSet("TurretDefinition.weight", object.weight)),
|
weight: globalThis.Number(assertSet("TurretDefinition.weight", object.weight)),
|
||||||
guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [],
|
guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [],
|
||||||
@@ -2183,8 +2183,8 @@ export const TurretDefinition: MessageFns<TurretDefinition> = {
|
|||||||
if (message.research_cost !== undefined) {
|
if (message.research_cost !== undefined) {
|
||||||
obj.research_cost = ResearchCost.toJSON(message.research_cost);
|
obj.research_cost = ResearchCost.toJSON(message.research_cost);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.tier !== 0) {
|
if (message.tier !== 0) {
|
||||||
obj.tier = Math.round(message.tier);
|
obj.tier = Math.round(message.tier);
|
||||||
@@ -2213,7 +2213,9 @@ export const TurretDefinition: MessageFns<TurretDefinition> = {
|
|||||||
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
|
message.research_cost = (object.research_cost !== undefined && object.research_cost !== null)
|
||||||
? ResearchCost.fromPartial(object.research_cost)
|
? ResearchCost.fromPartial(object.research_cost)
|
||||||
: undefined;
|
: undefined;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.tier = object.tier ?? 0;
|
message.tier = object.tier ?? 0;
|
||||||
message.weight = object.weight ?? 0;
|
message.weight = object.weight ?? 0;
|
||||||
message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || [];
|
message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || [];
|
||||||
@@ -2858,7 +2860,7 @@ function createBaseGunDefinitionBase(): GunDefinitionBase {
|
|||||||
rotation_speed: 0,
|
rotation_speed: 0,
|
||||||
research_cost: undefined,
|
research_cost: undefined,
|
||||||
weight: 0,
|
weight: 0,
|
||||||
name: "",
|
name: createBaseI18nString(),
|
||||||
tier: 0,
|
tier: 0,
|
||||||
shells: [],
|
shells: [],
|
||||||
camouflage_loss: 0,
|
camouflage_loss: 0,
|
||||||
@@ -2886,8 +2888,8 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
|
|||||||
if (message.weight !== 0) {
|
if (message.weight !== 0) {
|
||||||
writer.uint32(32).uint32(message.weight);
|
writer.uint32(32).uint32(message.weight);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(42).string(message.name);
|
I18nString.encode(message.name, writer.uint32(42).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.tier !== 0) {
|
if (message.tier !== 0) {
|
||||||
writer.uint32(48).uint32(message.tier);
|
writer.uint32(48).uint32(message.tier);
|
||||||
@@ -2966,7 +2968,7 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
@@ -3064,7 +3066,7 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
|
|||||||
rotation_speed: globalThis.Number(assertSet("GunDefinitionBase.rotation_speed", object.rotation_speed)),
|
rotation_speed: globalThis.Number(assertSet("GunDefinitionBase.rotation_speed", object.rotation_speed)),
|
||||||
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined,
|
||||||
weight: globalThis.Number(assertSet("GunDefinitionBase.weight", object.weight)),
|
weight: globalThis.Number(assertSet("GunDefinitionBase.weight", object.weight)),
|
||||||
name: globalThis.String(assertSet("GunDefinitionBase.name", object.name)),
|
name: I18nString.fromJSON(assertSet("GunDefinitionBase.name", object.name)),
|
||||||
tier: globalThis.Number(assertSet("GunDefinitionBase.tier", object.tier)),
|
tier: globalThis.Number(assertSet("GunDefinitionBase.tier", object.tier)),
|
||||||
shells: globalThis.Array.isArray(object?.shells)
|
shells: globalThis.Array.isArray(object?.shells)
|
||||||
? object.shells.map((e: any) => ShellDefinition.fromJSON(e))
|
? object.shells.map((e: any) => ShellDefinition.fromJSON(e))
|
||||||
@@ -3098,8 +3100,8 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
|
|||||||
if (message.weight !== 0) {
|
if (message.weight !== 0) {
|
||||||
obj.weight = Math.round(message.weight);
|
obj.weight = Math.round(message.weight);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.tier !== 0) {
|
if (message.tier !== 0) {
|
||||||
obj.tier = Math.round(message.tier);
|
obj.tier = Math.round(message.tier);
|
||||||
@@ -3145,7 +3147,9 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
|
|||||||
? ResearchCost.fromPartial(object.research_cost)
|
? ResearchCost.fromPartial(object.research_cost)
|
||||||
: undefined;
|
: undefined;
|
||||||
message.weight = object.weight ?? 0;
|
message.weight = object.weight ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.tier = object.tier ?? 0;
|
message.tier = object.tier ?? 0;
|
||||||
message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || [];
|
message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || [];
|
||||||
message.camouflage_loss = object.camouflage_loss ?? 0;
|
message.camouflage_loss = object.camouflage_loss ?? 0;
|
||||||
@@ -3163,7 +3167,7 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
|
|||||||
function createBaseShellDefinition(): ShellDefinition {
|
function createBaseShellDefinition(): ShellDefinition {
|
||||||
return {
|
return {
|
||||||
id: 0,
|
id: 0,
|
||||||
name: "",
|
name: createBaseI18nString(),
|
||||||
velocity: 0,
|
velocity: 0,
|
||||||
armor_damage: 0,
|
armor_damage: 0,
|
||||||
module_damage: 0,
|
module_damage: 0,
|
||||||
@@ -3183,8 +3187,8 @@ export const ShellDefinition: MessageFns<ShellDefinition> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
writer.uint32(8).uint32(message.id);
|
writer.uint32(8).uint32(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
writer.uint32(18).string(message.name);
|
I18nString.encode(message.name, writer.uint32(18).fork()).join();
|
||||||
}
|
}
|
||||||
if (message.velocity !== 0) {
|
if (message.velocity !== 0) {
|
||||||
writer.uint32(24).uint32(message.velocity);
|
writer.uint32(24).uint32(message.velocity);
|
||||||
@@ -3242,7 +3246,7 @@ export const ShellDefinition: MessageFns<ShellDefinition> = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.name = reader.string();
|
message.name = I18nString.decode(reader, reader.uint32());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@@ -3345,7 +3349,7 @@ export const ShellDefinition: MessageFns<ShellDefinition> = {
|
|||||||
fromJSON(object: any): ShellDefinition {
|
fromJSON(object: any): ShellDefinition {
|
||||||
return {
|
return {
|
||||||
id: globalThis.Number(assertSet("ShellDefinition.id", object.id)),
|
id: globalThis.Number(assertSet("ShellDefinition.id", object.id)),
|
||||||
name: globalThis.String(assertSet("ShellDefinition.name", object.name)),
|
name: I18nString.fromJSON(assertSet("ShellDefinition.name", object.name)),
|
||||||
velocity: globalThis.Number(assertSet("ShellDefinition.velocity", object.velocity)),
|
velocity: globalThis.Number(assertSet("ShellDefinition.velocity", object.velocity)),
|
||||||
armor_damage: globalThis.Number(assertSet("ShellDefinition.armor_damage", object.armor_damage)),
|
armor_damage: globalThis.Number(assertSet("ShellDefinition.armor_damage", object.armor_damage)),
|
||||||
module_damage: globalThis.Number(assertSet("ShellDefinition.module_damage", object.module_damage)),
|
module_damage: globalThis.Number(assertSet("ShellDefinition.module_damage", object.module_damage)),
|
||||||
@@ -3365,8 +3369,8 @@ export const ShellDefinition: MessageFns<ShellDefinition> = {
|
|||||||
if (message.id !== 0) {
|
if (message.id !== 0) {
|
||||||
obj.id = Math.round(message.id);
|
obj.id = Math.round(message.id);
|
||||||
}
|
}
|
||||||
if (message.name !== "") {
|
if (message.name !== undefined) {
|
||||||
obj.name = message.name;
|
obj.name = I18nString.toJSON(message.name);
|
||||||
}
|
}
|
||||||
if (message.velocity !== 0) {
|
if (message.velocity !== 0) {
|
||||||
obj.velocity = Math.round(message.velocity);
|
obj.velocity = Math.round(message.velocity);
|
||||||
@@ -3410,7 +3414,9 @@ export const ShellDefinition: MessageFns<ShellDefinition> = {
|
|||||||
fromPartial<I extends Exact<DeepPartial<ShellDefinition>, I>>(object: I): ShellDefinition {
|
fromPartial<I extends Exact<DeepPartial<ShellDefinition>, I>>(object: I): ShellDefinition {
|
||||||
const message = createBaseShellDefinition();
|
const message = createBaseShellDefinition();
|
||||||
message.id = object.id ?? 0;
|
message.id = object.id ?? 0;
|
||||||
message.name = object.name ?? "";
|
message.name = (object.name !== undefined && object.name !== null)
|
||||||
|
? I18nString.fromPartial(object.name)
|
||||||
|
: createBaseI18nString();
|
||||||
message.velocity = object.velocity ?? 0;
|
message.velocity = object.velocity ?? 0;
|
||||||
message.armor_damage = object.armor_damage ?? 0;
|
message.armor_damage = object.armor_damage ?? 0;
|
||||||
message.module_damage = object.module_damage ?? 0;
|
message.module_damage = object.module_damage ?? 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*", "../i18n/src/strings.ts"]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "@blitzkit/i18n",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"main": "src/index.ts",
|
||||||
|
"dependencies": {
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/adm-zip": "^0.5.5",
|
||||||
|
"@types/lz4js": "^0.2.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './strings';
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
|
import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from '@blitzkit/core/src/blitzkit';
|
||||||
import { merge } from 'lodash-es';
|
import { merge } from 'lodash-es';
|
||||||
import type en from '../../lang/en.json';
|
import type en from '../strings/en.json';
|
||||||
import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from '../blitzkit';
|
|
||||||
import { TranslationTree } from './translator';
|
export type TranslationTree = { [key: string]: TranslationNode };
|
||||||
|
|
||||||
|
export type TranslationNode = string | TranslationTree;
|
||||||
|
|
||||||
const files = import.meta.glob('../../lang/*.json', { eager: true });
|
const files = import.meta.glob('../../lang/*.json', { eager: true });
|
||||||
export const localizedStrings: Record<string, typeof en> = {};
|
export const localizedStrings: Record<string, typeof en> = {};
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blitzkit/core": "workspace:*",
|
"@blitzkit/core": "workspace:*",
|
||||||
|
"@blitzkit/i18n": "workspace:*",
|
||||||
"@gltf-transform/core": "^4.0.10",
|
"@gltf-transform/core": "^4.0.10",
|
||||||
"@gltf-transform/extensions": "^4.0.10",
|
"@gltf-transform/extensions": "^4.0.10",
|
||||||
"@gltf-transform/functions": "^4.0.10",
|
"@gltf-transform/functions": "^4.0.10",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
Armor,
|
Armor,
|
||||||
assertSecret,
|
|
||||||
BlitzTankClass,
|
BlitzTankClass,
|
||||||
CamouflageDefinitions,
|
CamouflageDefinitions,
|
||||||
Consumable,
|
Consumable,
|
||||||
@@ -8,12 +7,14 @@ import {
|
|||||||
ConsumableTankCategoryFilterCategory,
|
ConsumableTankCategoryFilterCategory,
|
||||||
Crew,
|
Crew,
|
||||||
CrewType,
|
CrewType,
|
||||||
|
DEFAULT_LOCALE,
|
||||||
encodePBBuffer,
|
encodePBBuffer,
|
||||||
EquipmentDefinitions,
|
EquipmentDefinitions,
|
||||||
EquipmentSlot,
|
EquipmentSlot,
|
||||||
GameDefinitions,
|
GameDefinitions,
|
||||||
GunDefinition,
|
GunDefinition,
|
||||||
GunDefinitionBase,
|
GunDefinitionBase,
|
||||||
|
I18nString,
|
||||||
MapDefinitions,
|
MapDefinitions,
|
||||||
ModelDefinitions,
|
ModelDefinitions,
|
||||||
ModuleType,
|
ModuleType,
|
||||||
@@ -22,6 +23,8 @@ import {
|
|||||||
ResearchCost,
|
ResearchCost,
|
||||||
ShellType,
|
ShellType,
|
||||||
SkillDefinitions,
|
SkillDefinitions,
|
||||||
|
SUPPORTED_LOCALE_BLITZ_MAP,
|
||||||
|
SUPPORTED_LOCALES,
|
||||||
TankClass,
|
TankClass,
|
||||||
TankDefinitions,
|
TankDefinitions,
|
||||||
TankPrice,
|
TankPrice,
|
||||||
@@ -212,7 +215,7 @@ interface VehicleDefinitions {
|
|||||||
circularVisionRadius: number;
|
circularVisionRadius: number;
|
||||||
maxHealth: number;
|
maxHealth: number;
|
||||||
armor: VehicleDefinitionArmor;
|
armor: VehicleDefinitionArmor;
|
||||||
userString: number;
|
userString: string;
|
||||||
level: number;
|
level: number;
|
||||||
yawLimits: string | string[];
|
yawLimits: string | string[];
|
||||||
gunPosition: string | string[];
|
gunPosition: string | string[];
|
||||||
@@ -497,9 +500,6 @@ const blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = {
|
|||||||
HIGH_EXPLOSIVE: ShellType.HE,
|
HIGH_EXPLOSIVE: ShellType.HE,
|
||||||
HOLLOW_CHARGE: ShellType.HEAT,
|
HOLLOW_CHARGE: ShellType.HEAT,
|
||||||
};
|
};
|
||||||
const missingStrings: Record<string, string> = {
|
|
||||||
'#artefacts:tungstentip/name': 'Tungsten Shells',
|
|
||||||
};
|
|
||||||
export const botPattern = /^.+((tutorial_bot(\d+)?)|(TU(R?)))$/;
|
export const botPattern = /^.+((tutorial_bot(\d+)?)|(TU(R?)))$/;
|
||||||
const blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType> = {
|
const blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType> = {
|
||||||
chassis: ModuleType.TRACKS,
|
chassis: ModuleType.TRACKS,
|
||||||
@@ -512,14 +512,6 @@ const blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType> = {
|
|||||||
export async function definitions() {
|
export async function definitions() {
|
||||||
console.log('Building definitions...');
|
console.log('Building definitions...');
|
||||||
|
|
||||||
const wargamingTankopedia = (await fetch(
|
|
||||||
`https://api.wotblitz.com/wotb/encyclopedia/vehicles/?application_id=${assertSecret(
|
|
||||||
import.meta.env.PUBLIC_WARGAMING_APPLICATION_ID,
|
|
||||||
)}&fields=description`,
|
|
||||||
).then((response) => response.json())) as {
|
|
||||||
data: { [key: number]: { description: null | string } };
|
|
||||||
};
|
|
||||||
|
|
||||||
const gameDefinitions: GameDefinitions = {
|
const gameDefinitions: GameDefinitions = {
|
||||||
version: (await readStringDVPL(`${DATA}/version.txt.dvpl`)).split(' ')[0],
|
version: (await readStringDVPL(`${DATA}/version.txt.dvpl`)).split(' ')[0],
|
||||||
nations: (
|
nations: (
|
||||||
@@ -552,9 +544,6 @@ export async function definitions() {
|
|||||||
(nations) => nations.filter((nation) => nation !== 'common'),
|
(nations) => nations.filter((nation) => nation !== 'common'),
|
||||||
);
|
);
|
||||||
const tankStringIdMap: Record<string, number> = {};
|
const tankStringIdMap: Record<string, number> = {};
|
||||||
const stringsPreInstalled = await readYAMLDVPL<BlitzStrings>(
|
|
||||||
`${DATA}/Strings/en.yaml.dvpl`,
|
|
||||||
);
|
|
||||||
const stringsCache = await fetch(
|
const stringsCache = await fetch(
|
||||||
'https://stufficons.wgcdn.co/localizations/en.yaml',
|
'https://stufficons.wgcdn.co/localizations/en.yaml',
|
||||||
)
|
)
|
||||||
@@ -563,10 +552,46 @@ export async function definitions() {
|
|||||||
const optionalDevices = await readXMLDVPL<{ root: OptionalDevices }>(
|
const optionalDevices = await readXMLDVPL<{ root: OptionalDevices }>(
|
||||||
`${DATA}/XML/item_defs/vehicles/common/optional_devices.xml.dvpl`,
|
`${DATA}/XML/item_defs/vehicles/common/optional_devices.xml.dvpl`,
|
||||||
);
|
);
|
||||||
const strings = {
|
const stringsI18n: Record<string, Record<string, string>> = {};
|
||||||
...stringsPreInstalled,
|
|
||||||
...stringsCache,
|
for (const locale of SUPPORTED_LOCALES) {
|
||||||
};
|
const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale];
|
||||||
|
const cache = await fetch(
|
||||||
|
`https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml`,
|
||||||
|
)
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((string) => parseYaml(string) as BlitzStrings);
|
||||||
|
const preInstalled = await readYAMLDVPL<BlitzStrings>(
|
||||||
|
`${DATA}/Strings/${blitzLocale}.yaml.dvpl`,
|
||||||
|
);
|
||||||
|
|
||||||
|
stringsI18n[locale] = {
|
||||||
|
...cache,
|
||||||
|
...preInstalled,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getString(name: string) {
|
||||||
|
const locales: Record<string, string> = {
|
||||||
|
[DEFAULT_LOCALE]: stringsI18n[DEFAULT_LOCALE][name],
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const locale of SUPPORTED_LOCALES) {
|
||||||
|
const localizedString = stringsI18n[locale][name];
|
||||||
|
|
||||||
|
if (
|
||||||
|
localizedString === undefined ||
|
||||||
|
localizedString === locales[DEFAULT_LOCALE]
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
locales[locale] = localizedString;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { locales } satisfies I18nString;
|
||||||
|
}
|
||||||
|
|
||||||
const optionalDeviceSlots = await readXMLDVPL<{
|
const optionalDeviceSlots = await readXMLDVPL<{
|
||||||
root: OptionalDeviceSlots;
|
root: OptionalDeviceSlots;
|
||||||
}>(`${DATA}/XML/item_defs/vehicles/common/optional_device_slots.xml.dvpl`);
|
}>(`${DATA}/XML/item_defs/vehicles/common/optional_device_slots.xml.dvpl`);
|
||||||
@@ -636,7 +661,7 @@ export async function definitions() {
|
|||||||
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
||||||
)) {
|
)) {
|
||||||
const id = Number(match[1]);
|
const id = Number(match[1]);
|
||||||
const name = strings[match[2]];
|
const name = getString(match[2]);
|
||||||
|
|
||||||
gameModeNativeNames[match[3]] = id;
|
gameModeNativeNames[match[3]] = id;
|
||||||
gameDefinitions.gameModes[id] = {
|
gameDefinitions.gameModes[id] = {
|
||||||
@@ -657,10 +682,10 @@ export async function definitions() {
|
|||||||
camouflagesXmlEntries.forEach(([camoKey, camo]) => {
|
camouflagesXmlEntries.forEach(([camoKey, camo]) => {
|
||||||
const yamlEntry = camouflagesYaml[camoKey];
|
const yamlEntry = camouflagesYaml[camoKey];
|
||||||
const fullName = yamlEntry.userString
|
const fullName = yamlEntry.userString
|
||||||
? strings[yamlEntry.userString]
|
? getString(yamlEntry.userString)
|
||||||
: undefined;
|
: undefined;
|
||||||
const shortName = yamlEntry.shortUserString
|
const shortName = yamlEntry.shortUserString
|
||||||
? strings[yamlEntry.shortUserString]
|
? getString(yamlEntry.shortUserString)
|
||||||
: undefined;
|
: undefined;
|
||||||
const resolvedTankName = shortName ?? fullName;
|
const resolvedTankName = shortName ?? fullName;
|
||||||
const resolvedTankNameFull =
|
const resolvedTankNameFull =
|
||||||
@@ -668,7 +693,7 @@ export async function definitions() {
|
|||||||
|
|
||||||
camouflageDefinitions.camouflages[camo.id] = {
|
camouflageDefinitions.camouflages[camo.id] = {
|
||||||
id: camo.id,
|
id: camo.id,
|
||||||
name: strings[camo.userString],
|
name: getString(camo.userString),
|
||||||
tank_name: resolvedTankName,
|
tank_name: resolvedTankName,
|
||||||
tank_name_full: resolvedTankNameFull,
|
tank_name_full: resolvedTankNameFull,
|
||||||
};
|
};
|
||||||
@@ -866,8 +891,6 @@ export async function definitions() {
|
|||||||
id: tankId,
|
id: tankId,
|
||||||
roles: {},
|
roles: {},
|
||||||
camouflages: camouflages,
|
camouflages: camouflages,
|
||||||
description:
|
|
||||||
wargamingTankopedia.data[tankId]?.description ?? undefined,
|
|
||||||
fixed_camouflage: fixedCamouflage,
|
fixed_camouflage: fixedCamouflage,
|
||||||
crew,
|
crew,
|
||||||
weight: tankDefinition.root.hull.weight,
|
weight: tankDefinition.root.hull.weight,
|
||||||
@@ -880,9 +903,9 @@ export async function definitions() {
|
|||||||
max_provisions: tankDefinition.root.provisionSlots,
|
max_provisions: tankDefinition.root.provisionSlots,
|
||||||
name:
|
name:
|
||||||
(tank.shortUserString
|
(tank.shortUserString
|
||||||
? strings[tank.shortUserString]
|
? getString(tank.shortUserString)
|
||||||
: undefined) ?? strings[tank.userString],
|
: undefined) ?? getString(tank.userString),
|
||||||
name_full: strings[tank.userString],
|
name_full: getString(tank.userString),
|
||||||
nation,
|
nation,
|
||||||
type: tankTags.includes('collectible')
|
type: tankTags.includes('collectible')
|
||||||
? TankType.COLLECTOR
|
? TankType.COLLECTOR
|
||||||
@@ -959,7 +982,7 @@ export async function definitions() {
|
|||||||
tankDefinitions.tanks[tankId].tracks.push({
|
tankDefinitions.tanks[tankId].tracks.push({
|
||||||
id: trackId,
|
id: trackId,
|
||||||
weight: track.weight,
|
weight: track.weight,
|
||||||
name: strings[track.userString],
|
name: getString(track.userString),
|
||||||
traverse_speed: track.rotationSpeed,
|
traverse_speed: track.rotationSpeed,
|
||||||
dispersion_move: track.shotDispersionFactors.vehicleMovement,
|
dispersion_move: track.shotDispersionFactors.vehicleMovement,
|
||||||
dispersion_traverse: track.shotDispersionFactors.vehicleRotation,
|
dispersion_traverse: track.shotDispersionFactors.vehicleRotation,
|
||||||
@@ -987,7 +1010,7 @@ export async function definitions() {
|
|||||||
totalUnlocks.push(engine.unlocks);
|
totalUnlocks.push(engine.unlocks);
|
||||||
tankDefinitions.tanks[tankId].engines.push({
|
tankDefinitions.tanks[tankId].engines.push({
|
||||||
id: engineId,
|
id: engineId,
|
||||||
name: strings[engineListEntry.userString],
|
name: getString(engineListEntry.userString),
|
||||||
fire_chance: engineListEntry.fireStartingChance,
|
fire_chance: engineListEntry.fireStartingChance,
|
||||||
tier: engineListEntry.level,
|
tier: engineListEntry.level,
|
||||||
weight: engineListEntry.weight,
|
weight: engineListEntry.weight,
|
||||||
@@ -1041,14 +1064,12 @@ export async function definitions() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
turret.userString;
|
||||||
|
|
||||||
tankDefinitions.tanks[tankId].turrets.push({
|
tankDefinitions.tanks[tankId].turrets.push({
|
||||||
id: turretId,
|
id: turretId,
|
||||||
traverse_speed: turret.rotationSpeed,
|
traverse_speed: turret.rotationSpeed,
|
||||||
name:
|
name: getString(turret.userString),
|
||||||
strings[turret.userString] ??
|
|
||||||
turretKey
|
|
||||||
.replaceAll('_', ' ')
|
|
||||||
.replace(/^(Turret ([0-9] )?)+/, ''),
|
|
||||||
tier: turret.level,
|
tier: turret.level,
|
||||||
guns: [],
|
guns: [],
|
||||||
health: turret.maxHealth,
|
health: turret.maxHealth,
|
||||||
@@ -1100,8 +1121,7 @@ export async function definitions() {
|
|||||||
const gunModel = Number(
|
const gunModel = Number(
|
||||||
parsePath(gun.models.undamaged).name.split('_')[1],
|
parsePath(gun.models.undamaged).name.split('_')[1],
|
||||||
);
|
);
|
||||||
const gunName =
|
const gunName = getString(gunListEntry.userString);
|
||||||
strings[gunListEntry.userString] ?? gunKey.replaceAll('_', ' ');
|
|
||||||
const gunType =
|
const gunType =
|
||||||
'clip' in gun
|
'clip' in gun
|
||||||
? gun.pumpGunMode
|
? gun.pumpGunMode
|
||||||
@@ -1250,8 +1270,7 @@ export async function definitions() {
|
|||||||
const gunShellEntry = gunListEntry.shots[shellKey];
|
const gunShellEntry = gunListEntry.shots[shellKey];
|
||||||
const shell = shellList.root[shellKey];
|
const shell = shellList.root[shellKey];
|
||||||
const shellId = toUniqueId(nation, shell.id);
|
const shellId = toUniqueId(nation, shell.id);
|
||||||
const shellName =
|
const shellName = getString(shell.userString);
|
||||||
strings[shell.userString] ?? shellKey.replaceAll('_', ' ');
|
|
||||||
const penetrationRaw = gunShellEntry.piercingPower
|
const penetrationRaw = gunShellEntry.piercingPower
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.filter((penetrationString) => penetrationString !== '')
|
.filter((penetrationString) => penetrationString !== '')
|
||||||
@@ -1385,8 +1404,8 @@ export async function definitions() {
|
|||||||
if (optionalDeviceKey === 'nextAvailableId') return;
|
if (optionalDeviceKey === 'nextAvailableId') return;
|
||||||
|
|
||||||
equipmentDefinitions.equipments[optionalDeviceEntry.id] = {
|
equipmentDefinitions.equipments[optionalDeviceEntry.id] = {
|
||||||
name: strings[optionalDeviceEntry.userString],
|
name: getString(optionalDeviceEntry.userString),
|
||||||
description: strings[optionalDeviceEntry.description],
|
description: getString(optionalDeviceEntry.description),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -1418,10 +1437,7 @@ export async function definitions() {
|
|||||||
game_mode_exclusive: 'gameModeFilter' in consumable,
|
game_mode_exclusive: 'gameModeFilter' in consumable,
|
||||||
cooldown: consumable.script.cooldown,
|
cooldown: consumable.script.cooldown,
|
||||||
duration: consumable.script.duration,
|
duration: consumable.script.duration,
|
||||||
name:
|
name: getString(consumable.userString),
|
||||||
strings[consumable.userString] ??
|
|
||||||
missingStrings[consumable.userString] ??
|
|
||||||
`Unknown ${consumable.id}`,
|
|
||||||
exclude: [],
|
exclude: [],
|
||||||
include: [],
|
include: [],
|
||||||
};
|
};
|
||||||
@@ -1523,10 +1539,7 @@ export async function definitions() {
|
|||||||
exclude: [],
|
exclude: [],
|
||||||
include: [],
|
include: [],
|
||||||
game_mode_exclusive: 'gameModeFilter' in provision,
|
game_mode_exclusive: 'gameModeFilter' in provision,
|
||||||
name:
|
name: getString(provision.userString),
|
||||||
strings[provision.userString] ??
|
|
||||||
missingStrings[provision.userString] ??
|
|
||||||
`Unknown ${provision.id}`,
|
|
||||||
};
|
};
|
||||||
provisionDefinitions.provisions[provision.id] = entry;
|
provisionDefinitions.provisions[provision.id] = entry;
|
||||||
|
|
||||||
@@ -1650,10 +1663,12 @@ export async function definitions() {
|
|||||||
Object.entries(maps.maps).forEach(([key, map]) => {
|
Object.entries(maps.maps).forEach(([key, map]) => {
|
||||||
mapDefinitions.maps[map.id] = {
|
mapDefinitions.maps[map.id] = {
|
||||||
id: map.id,
|
id: map.id,
|
||||||
name: strings[`#maps:${key}:${map.localName}`],
|
name: getString(`#maps:${key}:${map.localName}`),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
await commitAssets('definitions', [
|
await commitAssets('definitions', [
|
||||||
{
|
{
|
||||||
content: encodePBBuffer(GameDefinitions, gameDefinitions),
|
content: encodePBBuffer(GameDefinitions, gameDefinitions),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blitzkit/core": "workspace:*",
|
"@blitzkit/core": "workspace:*",
|
||||||
"prate": "workspace:*",
|
"@blitzkit/i18n": "workspace:*",
|
||||||
"@nanostores/persistent": "^0.10.2",
|
"@nanostores/persistent": "^0.10.2",
|
||||||
"@nanostores/react": "^0.7.3",
|
"@nanostores/react": "^0.7.3",
|
||||||
"@nivo/bar": "^0.87.0",
|
"@nivo/bar": "^0.87.0",
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import { Heading, Text } from '@radix-ui/themes';
|
|
||||||
import { Duel } from '../../stores/duel';
|
|
||||||
import { PageWrapper } from '../PageWrapper';
|
|
||||||
|
|
||||||
export function HistorySection() {
|
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
|
||||||
|
|
||||||
if (!tank.description) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageWrapper noFlex1 align="center" noMinHeight>
|
|
||||||
<Heading>History of the {tank.name}</Heading>
|
|
||||||
<Text>{tank.description}</Text>
|
|
||||||
</PageWrapper>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -55,7 +55,6 @@ export function Page({ id, skeleton, locale }: PageProps) {
|
|||||||
<CharacteristicsSection />
|
<CharacteristicsSection />
|
||||||
<GameModeSection />
|
<GameModeSection />
|
||||||
<VideoSection skeleton={skeleton} />
|
<VideoSection skeleton={skeleton} />
|
||||||
<HistorySection />
|
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
</Duel.Provider>
|
</Duel.Provider>
|
||||||
</TankopediaPersistent.Provider>
|
</TankopediaPersistent.Provider>
|
||||||
|
|||||||
Reference in new issue
Block a user