mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: fire chance
This commit is contained in:
1 parent
eea2024549
commit
c34edbd3ac
8 files changed
+94
-32
No files matched your search
@@ -55,6 +55,17 @@ type ShellDefinitionsList = Record<
|
||||
> & {
|
||||
icons: Record<string, string>;
|
||||
};
|
||||
interface EngineDefinitionsList {
|
||||
nextAvailableId: number;
|
||||
ids: Record<string, number>;
|
||||
shared: {
|
||||
[key: string]: {
|
||||
userString: string;
|
||||
level: number;
|
||||
fireStartingChance: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
type VehicleDefinitionArmor = Record<
|
||||
string,
|
||||
number | { vehicleDamageFactor: 0; '#text': number }
|
||||
@@ -91,6 +102,9 @@ interface VehicleDefinitions {
|
||||
};
|
||||
};
|
||||
};
|
||||
engines: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
turrets0: {
|
||||
[key: string]: {
|
||||
maxHealth: number;
|
||||
@@ -260,7 +274,7 @@ export async function definitions(production: boolean) {
|
||||
(nations) => nations.filter((nation) => nation !== 'common'),
|
||||
);
|
||||
const tankStringIdMap: Record<string, number> = {};
|
||||
const strings = await readYAMLDVPL<Strings>(
|
||||
const stringsPreInstalled = await readYAMLDVPL<Strings>(
|
||||
`${DATA}/${POI.strings}/en.yaml.dvpl`,
|
||||
);
|
||||
const stringsCache = await fetch(POI.cachedStrings)
|
||||
@@ -269,6 +283,10 @@ export async function definitions(production: boolean) {
|
||||
const optionalDevices = await readXMLDVPL<{ root: OptionalDevices }>(
|
||||
`${DATA}/${POI.optionalDevices}.dvpl`,
|
||||
);
|
||||
const strings = {
|
||||
...stringsPreInstalled,
|
||||
...stringsCache,
|
||||
};
|
||||
const optionalDeviceSlots = await readXMLDVPL<{
|
||||
root: OptionalDeviceSlots;
|
||||
}>(`${DATA}/${POI.optionalDeviceSlots}.dvpl`);
|
||||
@@ -299,6 +317,11 @@ export async function definitions(production: boolean) {
|
||||
}>(
|
||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/components/shells.xml.dvpl`,
|
||||
);
|
||||
const enginesList = await readXMLDVPL<{
|
||||
root: EngineDefinitionsList;
|
||||
}>(
|
||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/components/engines.xml.dvpl`,
|
||||
);
|
||||
|
||||
for (const tankKey in tankList.root) {
|
||||
const tank = tankList.root[tankKey];
|
||||
@@ -354,12 +377,9 @@ export async function definitions(production: boolean) {
|
||||
provisions: tankDefinition.root.provisionSlots,
|
||||
name:
|
||||
(tank.shortUserString
|
||||
? strings[tank.shortUserString] ??
|
||||
stringsCache[tank.shortUserString]
|
||||
: undefined) ??
|
||||
strings[tank.userString] ??
|
||||
stringsCache[tank.userString],
|
||||
name_full: strings[tank.userString] ?? stringsCache[tank.userString],
|
||||
? strings[tank.shortUserString]
|
||||
: undefined) ?? strings[tank.userString],
|
||||
name_full: strings[tank.userString],
|
||||
nation,
|
||||
tree_type: tankTags.includes('collectible')
|
||||
? 'collector'
|
||||
@@ -376,6 +396,7 @@ export async function definitions(production: boolean) {
|
||||
firing: tankDefinition.root.invisibility.firePenalty,
|
||||
},
|
||||
turrets: [],
|
||||
engines: [],
|
||||
};
|
||||
|
||||
if (
|
||||
@@ -402,6 +423,18 @@ export async function definitions(production: boolean) {
|
||||
turrets: {},
|
||||
};
|
||||
|
||||
Object.keys(tankDefinition.root.engines).forEach((engineKey) => {
|
||||
const engine = enginesList.root.shared[engineKey];
|
||||
const engineId = toUniqueId(nation, enginesList.root.ids[engineKey]);
|
||||
|
||||
tankDefinitions[tankId].engines.push({
|
||||
id: engineId,
|
||||
name: strings[engine.userString],
|
||||
fire_chance: engine.fireStartingChance,
|
||||
tier: engine.level as Tier,
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(tankDefinition.root.turrets0).forEach(
|
||||
(turretKey, turretIndex) => {
|
||||
const turret = tankDefinition.root.turrets0[turretKey];
|
||||
|
||||
Reference in new issue
Block a user