mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: gamemode defs
This commit is contained in:
1 parent
643c7272ca
commit
6ada813dd5
3 files changed
+37
-1
No files matched your search
Vendored
-1
@@ -68,7 +68,6 @@
|
|||||||
"Fullscreen",
|
"Fullscreen",
|
||||||
"fullstats",
|
"fullstats",
|
||||||
"fuzzysort",
|
"fuzzysort",
|
||||||
"gamemode",
|
|
||||||
"gameplay",
|
"gameplay",
|
||||||
"glsl",
|
"glsl",
|
||||||
"GLTF",
|
"GLTF",
|
||||||
|
|||||||
@@ -419,6 +419,7 @@ export async function definitions(production: boolean) {
|
|||||||
).then((response) => response.json())) as {
|
).then((response) => response.json())) as {
|
||||||
data: { [key: number]: { description: null | string } };
|
data: { [key: number]: { description: null | string } };
|
||||||
};
|
};
|
||||||
|
|
||||||
const gameDefinitions: GameDefinitions = {
|
const gameDefinitions: GameDefinitions = {
|
||||||
version: (await readStringDVPL(`${DATA}/version.txt.dvpl`))
|
version: (await readStringDVPL(`${DATA}/version.txt.dvpl`))
|
||||||
.split(' ')[0]
|
.split(' ')[0]
|
||||||
@@ -430,6 +431,7 @@ export async function definitions(production: boolean) {
|
|||||||
`${DATA}/available_nations.yaml.dvpl`,
|
`${DATA}/available_nations.yaml.dvpl`,
|
||||||
)
|
)
|
||||||
).available_nations,
|
).available_nations,
|
||||||
|
gameModes: {},
|
||||||
};
|
};
|
||||||
const tankDefinitions: TankDefinitions = {};
|
const tankDefinitions: TankDefinitions = {};
|
||||||
const camouflageDefinitions: CamouflageDefinitions = {};
|
const camouflageDefinitions: CamouflageDefinitions = {};
|
||||||
@@ -485,6 +487,35 @@ export async function definitions(production: boolean) {
|
|||||||
);
|
);
|
||||||
const camouflagesXmlEntries = Object.entries(camouflagesXml.root.camouflages);
|
const camouflagesXmlEntries = Object.entries(camouflagesXml.root.camouflages);
|
||||||
|
|
||||||
|
for (const match of (
|
||||||
|
await readYAMLDVPL<{
|
||||||
|
Prototypes: {
|
||||||
|
components: {
|
||||||
|
UIDataLocalBindingsComponent: {
|
||||||
|
data: string[][];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}[];
|
||||||
|
}>(`${DATA}/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml.dvpl`)
|
||||||
|
).Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||||
|
/battleType\/([a-zA-Z]+)/g,
|
||||||
|
)) {
|
||||||
|
const id = match[1];
|
||||||
|
const name = strings[`battleType/${id}`];
|
||||||
|
const description = (
|
||||||
|
strings[`hangar/battleType/${id}ShortDescription`] ??
|
||||||
|
strings[
|
||||||
|
`hangar/battleType/${id.slice(0, 1).toUpperCase() + id.slice(1)}ShortDescription`
|
||||||
|
] ??
|
||||||
|
strings[`hangar/battleType/${id}Description`]
|
||||||
|
).split('\n')[0];
|
||||||
|
|
||||||
|
gameDefinitions.gameModes[id] = {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
camouflagesXmlEntries.forEach(([camoKey, camo]) => {
|
camouflagesXmlEntries.forEach(([camoKey, camo]) => {
|
||||||
const yamlEntry = camouflagesYaml[camoKey];
|
const yamlEntry = camouflagesYaml[camoKey];
|
||||||
const fullName = yamlEntry.userString
|
const fullName = yamlEntry.userString
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { asset } from './asset';
|
import { asset } from './asset';
|
||||||
import { fetchCdonLz4 } from './fetchCdonLz4';
|
import { fetchCdonLz4 } from './fetchCdonLz4';
|
||||||
|
|
||||||
|
interface GameMode {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface GameDefinitions {
|
export interface GameDefinitions {
|
||||||
version: string;
|
version: string;
|
||||||
nations: string[];
|
nations: string[];
|
||||||
|
gameModes: Record<string, GameMode>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const gameDefinitions = fetchCdonLz4<GameDefinitions>(
|
export const gameDefinitions = fetchCdonLz4<GameDefinitions>(
|
||||||
|
|||||||
Reference in new issue
Block a user