mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
(2) some definitions headers
This commit is contained in:
1 parent
17c54be1c8
commit
fd8448b0a6
8 files changed
+195
-157
No files matched your search
@@ -2,18 +2,24 @@ import {
|
||||
AbstractVFS,
|
||||
BlitzStrings,
|
||||
CamouflageDefinitions,
|
||||
CamouflagesXml,
|
||||
CamouflagesYaml,
|
||||
CombatRolesYaml,
|
||||
ConsumableDefinitions,
|
||||
ConsumablesCommon,
|
||||
EquipmentDefinitions,
|
||||
I18nString,
|
||||
MapDefinitions,
|
||||
MapsYaml,
|
||||
ModelDefinitions,
|
||||
OptionalDevices,
|
||||
OptionalDeviceSlots,
|
||||
ProvisionDefinitions,
|
||||
ProvisionsCommon,
|
||||
SkillDefinitions,
|
||||
SquadBattleTypeStylesYaml,
|
||||
TankDefinitions,
|
||||
TankmenAvatar,
|
||||
} from "@blitzkit/core";
|
||||
import { SUPPORTED_LOCALE_BLITZ_MAP } from "@blitzkit/i18n";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
@@ -29,8 +35,16 @@ export class ServerBlitzKitAPI extends BlitzKitAPI {
|
||||
consumablesCommon: ConsumablesCommon = {};
|
||||
provisionsCommon: ProvisionsCommon = {};
|
||||
|
||||
// TODO: suffix with "yaml"s and "xml"s
|
||||
private optionalDevices?: { root: OptionalDevices };
|
||||
private optionalDeviceSlots?: { root: OptionalDeviceSlots };
|
||||
private tankmenAvatar?: { root: TankmenAvatar };
|
||||
private mapsYaml?: MapsYaml;
|
||||
private camouflagesXml?: { root: CamouflagesXml };
|
||||
private camouflagesYaml?: CamouflagesYaml;
|
||||
private squadBattleTypeStyles?: SquadBattleTypeStylesYaml;
|
||||
private gameTypeSelectorStyles?: SquadBattleTypeStylesYaml;
|
||||
private combatRoles?: CombatRolesYaml;
|
||||
|
||||
constructor(vfs: AbstractVFS) {
|
||||
super();
|
||||
@@ -38,6 +52,37 @@ export class ServerBlitzKitAPI extends BlitzKitAPI {
|
||||
}
|
||||
|
||||
async init() {
|
||||
this.nationsDir = await this.vfs
|
||||
.dir("Data/XML/item_defs/vehicles")
|
||||
.then((files) => files.filter((nation) => nation !== "common"));
|
||||
|
||||
this.optionalDevices = await this.vfs.xml<{ root: OptionalDevices }>(
|
||||
"Data/XML/item_defs/vehicles/common/optional_devices.xml",
|
||||
);
|
||||
this.optionalDeviceSlots = await this.vfs.xml<{
|
||||
root: OptionalDeviceSlots;
|
||||
}>("Data/XML/item_defs/vehicles/common/optional_device_slots.xml");
|
||||
this.tankmenAvatar = await this.vfs.xml<{ root: TankmenAvatar }>(
|
||||
"Data/XML/item_defs/tankmen/avatar.xml",
|
||||
);
|
||||
this.mapsYaml = await this.vfs.yaml<MapsYaml>("Data/maps.yaml");
|
||||
this.camouflagesXml = await this.vfs.xml<{ root: CamouflagesXml }>(
|
||||
"Data/XML/item_defs/vehicles/common/camouflages.xml",
|
||||
);
|
||||
this.camouflagesYaml = await this.vfs.yaml<CamouflagesYaml>(
|
||||
"Data/camouflages.yaml",
|
||||
);
|
||||
this.squadBattleTypeStyles = await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
||||
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
|
||||
);
|
||||
this.gameTypeSelectorStyles =
|
||||
await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
||||
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
|
||||
);
|
||||
this.combatRoles = await this.vfs.yaml<CombatRolesYaml>(
|
||||
`Data/XML/item_defs/vehicles/common/combat_roles.yaml`,
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
locales.supported.map(async ({ locale }) => {
|
||||
const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale];
|
||||
@@ -57,16 +102,39 @@ export class ServerBlitzKitAPI extends BlitzKitAPI {
|
||||
}),
|
||||
);
|
||||
|
||||
this.nationsDir = await this.vfs
|
||||
.dir("Data/XML/item_defs/vehicles")
|
||||
.then((files) => files.filter((nation) => nation !== "common"));
|
||||
for (const match of (
|
||||
await this.vfs.text(
|
||||
`Data/XML/item_defs/vehicles/common/consumables/list.xml`,
|
||||
)
|
||||
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
|
||||
if (match[1] === "prototypes") continue;
|
||||
|
||||
this.optionalDevices = await this.vfs.xml<{ root: OptionalDevices }>(
|
||||
"Data/XML/item_defs/vehicles/common/optional_devices.xml",
|
||||
);
|
||||
this.optionalDeviceSlots = await this.vfs.xml<{
|
||||
root: OptionalDeviceSlots;
|
||||
}>(`Data/XML/item_defs/vehicles/common/optional_device_slots.xml`);
|
||||
Object.assign(
|
||||
this.consumablesCommon,
|
||||
(
|
||||
await this.vfs.xml<{ root: ConsumablesCommon }>(
|
||||
`Data/XML/item_defs/vehicles/common/consumables/${match[1]}.xml`,
|
||||
)
|
||||
).root,
|
||||
);
|
||||
}
|
||||
|
||||
for (const match of (
|
||||
await this.vfs.text(
|
||||
`Data/XML/item_defs/vehicles/common/provisions/list.xml`,
|
||||
)
|
||||
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
|
||||
if (match[1] === "prototypes") continue;
|
||||
|
||||
Object.assign(
|
||||
this.provisionsCommon,
|
||||
(
|
||||
await this.vfs.xml<{ root: ConsumablesCommon }>(
|
||||
`Data/XML/item_defs/vehicles/common/provisions/${match[1]}.xml`,
|
||||
)
|
||||
).root,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private getString(name: string) {
|
||||
@@ -92,33 +160,49 @@ export class ServerBlitzKitAPI extends BlitzKitAPI {
|
||||
|
||||
async tankDefinitions() {
|
||||
const tankDefinitions = TankDefinitions.create();
|
||||
|
||||
return tankDefinitions;
|
||||
}
|
||||
|
||||
async camouflageDefinitions() {
|
||||
const camouflageDefinitions = CamouflageDefinitions.create();
|
||||
|
||||
return camouflageDefinitions;
|
||||
}
|
||||
|
||||
async modelDefinitions() {
|
||||
const modelDefinitions = ModelDefinitions.create();
|
||||
|
||||
return modelDefinitions;
|
||||
}
|
||||
|
||||
async mapDefinitions() {
|
||||
const mapDefinitions = MapDefinitions.create();
|
||||
|
||||
return mapDefinitions;
|
||||
}
|
||||
|
||||
async equipmentDefinitions() {
|
||||
const equipmentDefinitions = EquipmentDefinitions.create();
|
||||
|
||||
return equipmentDefinitions;
|
||||
}
|
||||
|
||||
async consumableDefinitions() {
|
||||
const consumableDefinitions = ConsumableDefinitions.create();
|
||||
|
||||
return consumableDefinitions;
|
||||
}
|
||||
|
||||
async provisionDefinitions() {
|
||||
const provisionDefinitions = ProvisionDefinitions.create();
|
||||
|
||||
return provisionDefinitions;
|
||||
}
|
||||
|
||||
async skillDefinitions() {
|
||||
const skillDefinitions = SkillDefinitions.create();
|
||||
|
||||
return skillDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
export interface CamouflagesXml {
|
||||
camouflages: Record<
|
||||
string,
|
||||
{
|
||||
id: number;
|
||||
userString: string;
|
||||
description: string;
|
||||
category: string;
|
||||
group: string;
|
||||
kind: string;
|
||||
notInShop: boolean;
|
||||
unlockCostCategory?: string;
|
||||
vehicleFilter: {
|
||||
include?: CamouflagesInclude | CamouflagesInclude[];
|
||||
};
|
||||
script: string[] | string;
|
||||
icon?: string;
|
||||
unlockPremium?: string;
|
||||
unlockQuest?: string;
|
||||
unlockClanLevel?: number;
|
||||
unlockShopBundle?: string;
|
||||
unlockTankRank?: number;
|
||||
}
|
||||
>;
|
||||
}
|
||||
|
||||
type CamouflagesInclude =
|
||||
| {
|
||||
nations?: string;
|
||||
}
|
||||
| {
|
||||
vehicle?: { name?: string; minLevel?: number; maxLevel?: number };
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
export type CamouflagesYaml = Record<
|
||||
string,
|
||||
{
|
||||
userString?: string;
|
||||
shortUserString?: string;
|
||||
}
|
||||
>;
|
||||
@@ -1,11 +1,15 @@
|
||||
export * from "./availableNationsYaml";
|
||||
export * from "./blitzStrings";
|
||||
export * from "./camouflagesXml";
|
||||
export * from "./camouflagesYaml";
|
||||
export * from "./combatRolesYaml";
|
||||
export * from "./consumablesCommon";
|
||||
export * from "./consumablesVehicleFilter";
|
||||
export * from "./glossary";
|
||||
export * from "./mapsYaml";
|
||||
export * from "./optionalDevices";
|
||||
export * from "./optionalDeviceSlots";
|
||||
export * from "./provisionsCommon";
|
||||
export * from "./squadBattleTypeStylesYaml";
|
||||
export * from "./tankmenAvatar";
|
||||
export * from "./tanksStats";
|
||||
@@ -0,0 +1,24 @@
|
||||
export interface MapsYaml {
|
||||
maps: {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
tags?: string;
|
||||
localName: string;
|
||||
avaliableInTrainingRoom: boolean; // lol wg typo
|
||||
spriteFrame: number;
|
||||
supremacyPointsThreshold?: number;
|
||||
availableModes: number[];
|
||||
shadowMapsAvailable?: boolean;
|
||||
assaultRespawnPoints: {
|
||||
allies: MapAlly[];
|
||||
enemies: MapAlly[];
|
||||
};
|
||||
levels?: number[];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface MapAlly {
|
||||
respawnNumber: number;
|
||||
points: Array<number[]>;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { TankClass } from "@blitzkit/core";
|
||||
|
||||
export interface TankmenAvatar {
|
||||
roles: unknown;
|
||||
skillsByClasses: Record<TankClass, string>;
|
||||
skills: {
|
||||
[name: string]: {
|
||||
userString: string;
|
||||
effectDescription: string;
|
||||
tipDescription: string;
|
||||
icon: SkillIcon | SkillIcon[];
|
||||
type: "continuous" | "trigger";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface SkillIcon {
|
||||
name: string;
|
||||
state: number;
|
||||
}
|
||||
Reference in new issue
Block a user