mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: skill definitions
This commit is contained in:
1 parent
b363c76639
commit
d79129df91
4 files changed
+30
-17
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
import { readdir, writeFile } from 'fs/promises';
|
import { readdir } from 'fs/promises';
|
||||||
import { parse as parsePath } from 'path';
|
import { parse as parsePath } from 'path';
|
||||||
import { Vector3Tuple } from 'three';
|
import { Vector3Tuple } from 'three';
|
||||||
import { parse as parseYaml } from 'yaml';
|
import { parse as parseYaml } from 'yaml';
|
||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
ModelDefinitions,
|
ModelDefinitions,
|
||||||
} from '../../src/core/blitzkrieg/modelDefinitions';
|
} from '../../src/core/blitzkrieg/modelDefinitions';
|
||||||
import { ProvisionDefinitions } from '../../src/core/blitzkrieg/provisionDefinitions';
|
import { ProvisionDefinitions } from '../../src/core/blitzkrieg/provisionDefinitions';
|
||||||
|
import { SkillDefinitions } from '../../src/core/blitzkrieg/skillDefinitions';
|
||||||
import { superCompress } from '../../src/core/blitzkrieg/superCompress';
|
import { superCompress } from '../../src/core/blitzkrieg/superCompress';
|
||||||
import {
|
import {
|
||||||
Crew,
|
Crew,
|
||||||
@@ -32,6 +33,7 @@ import {
|
|||||||
Tier,
|
Tier,
|
||||||
} from '../../src/core/blitzkrieg/tankDefinitions';
|
} from '../../src/core/blitzkrieg/tankDefinitions';
|
||||||
import { DATA, POI } from './constants';
|
import { DATA, POI } from './constants';
|
||||||
|
import { Avatar } from './skillIcons';
|
||||||
import { TankParameters } from './tankIcons';
|
import { TankParameters } from './tankIcons';
|
||||||
|
|
||||||
interface Strings {
|
interface Strings {
|
||||||
@@ -341,6 +343,9 @@ export async function definitions(production: boolean) {
|
|||||||
};
|
};
|
||||||
const consumableDefinitions: ConsumableDefinitions = {};
|
const consumableDefinitions: ConsumableDefinitions = {};
|
||||||
const provisionDefinitions: ProvisionDefinitions = {};
|
const provisionDefinitions: ProvisionDefinitions = {};
|
||||||
|
const skillDefinitions: SkillDefinitions = {
|
||||||
|
classes: { lightTank: [], mediumTank: [], heavyTank: [], 'AT-SPG': [] },
|
||||||
|
};
|
||||||
const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then(
|
const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then(
|
||||||
(nations) => nations.filter((nation) => nation !== 'common'),
|
(nations) => nations.filter((nation) => nation !== 'common'),
|
||||||
);
|
);
|
||||||
@@ -367,6 +372,9 @@ export async function definitions(production: boolean) {
|
|||||||
const provisions = await readXMLDVPL<{ root: ProvisionsCommon }>(
|
const provisions = await readXMLDVPL<{ root: ProvisionsCommon }>(
|
||||||
`${DATA}/${POI.provisionsCommon}.dvpl`,
|
`${DATA}/${POI.provisionsCommon}.dvpl`,
|
||||||
);
|
);
|
||||||
|
const avatar = await readXMLDVPL<{ root: Avatar }>(
|
||||||
|
`${DATA}/XML/item_defs/tankmen/avatar.xml.dvpl`,
|
||||||
|
);
|
||||||
|
|
||||||
const tankXps = new Map<number, number>();
|
const tankXps = new Map<number, number>();
|
||||||
|
|
||||||
@@ -1084,10 +1092,10 @@ export async function definitions(production: boolean) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
writeFile(
|
Object.entries(avatar.root.skillsByClasses).forEach(([tankClass, skills]) => {
|
||||||
'test.tanks.cdon.lz4',
|
skillDefinitions.classes[tankClass as TankClass] = skills.split(' ');
|
||||||
Buffer.from(superCompress(tankDefinitions), 'base64'),
|
});
|
||||||
);
|
|
||||||
await commitAssets(
|
await commitAssets(
|
||||||
'definitions',
|
'definitions',
|
||||||
[
|
[
|
||||||
@@ -1116,6 +1124,11 @@ export async function definitions(production: boolean) {
|
|||||||
encoding: 'base64',
|
encoding: 'base64',
|
||||||
path: 'definitions/provisions.cdon.lz4',
|
path: 'definitions/provisions.cdon.lz4',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
content: superCompress(skillDefinitions),
|
||||||
|
encoding: 'base64',
|
||||||
|
path: 'definitions/skills.cdon.lz4',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
production,
|
production,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ import { boosterIcons } from './boosterIcons';
|
|||||||
import { camouflageIcons } from './camouflageIcons';
|
import { camouflageIcons } from './camouflageIcons';
|
||||||
import { circleFlags } from './circleFlags';
|
import { circleFlags } from './circleFlags';
|
||||||
import { consumableProvisionIcons } from './consumableProvisionIcons';
|
import { consumableProvisionIcons } from './consumableProvisionIcons';
|
||||||
import { crewSkillIcons } from './crewSkillIcons';
|
|
||||||
import { currencies } from './currencies';
|
import { currencies } from './currencies';
|
||||||
import { definitions } from './definitions';
|
import { definitions } from './definitions';
|
||||||
import { equipmentIcons } from './equipmentIcons';
|
import { equipmentIcons } from './equipmentIcons';
|
||||||
import { moduleIcons } from './moduleIcons';
|
import { moduleIcons } from './moduleIcons';
|
||||||
import { scratchedFlags } from './scratchedFlags';
|
import { scratchedFlags } from './scratchedFlags';
|
||||||
import { shellIcons } from './shellIcons';
|
import { shellIcons } from './shellIcons';
|
||||||
|
import { skillIcons } from './skillIcons';
|
||||||
import { tankArmors } from './tankArmors';
|
import { tankArmors } from './tankArmors';
|
||||||
import { tankIcons } from './tankIcons';
|
import { tankIcons } from './tankIcons';
|
||||||
import { tankModels } from './tankModels';
|
import { tankModels } from './tankModels';
|
||||||
@@ -41,7 +41,7 @@ const methods = [
|
|||||||
tankArmors,
|
tankArmors,
|
||||||
tankModels,
|
tankModels,
|
||||||
currencies,
|
currencies,
|
||||||
crewSkillIcons,
|
skillIcons,
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const method of methods) {
|
for (const method of methods) {
|
||||||
|
|||||||
@@ -11,22 +11,22 @@ interface SkillIcon {
|
|||||||
state: number;
|
state: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Avatar {
|
export interface Avatar {
|
||||||
roles: unknown;
|
roles: unknown;
|
||||||
skillsByClasses: Record<TankClass, string>;
|
skillsByClasses: Record<TankClass, string>;
|
||||||
skills: {
|
skills: {
|
||||||
[name: string]: {
|
[name: string]: {
|
||||||
userString: '#crew_skills:surrounded_by_enemy/name';
|
userString: string;
|
||||||
effectDescription: '#crew_skills:surrounded_by_enemy/effect';
|
effectDescription: string;
|
||||||
tipDescription: '#crew_skills:surrounded_by_enemy/tip';
|
tipDescription: string;
|
||||||
icon: SkillIcon | SkillIcon[];
|
icon: SkillIcon | SkillIcon[];
|
||||||
type: 'continuous' | 'trigger';
|
type: 'continuous' | 'trigger';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function crewSkillIcons(production: boolean) {
|
export async function skillIcons(production: boolean) {
|
||||||
console.log('Building crew skill icons...');
|
console.log('Building skill icons...');
|
||||||
|
|
||||||
const avatar = await readXMLDVPL<{ root: Avatar }>(
|
const avatar = await readXMLDVPL<{ root: Avatar }>(
|
||||||
`${DATA}/XML/item_defs/tankmen/avatar.xml.dvpl`,
|
`${DATA}/XML/item_defs/tankmen/avatar.xml.dvpl`,
|
||||||
@@ -47,5 +47,5 @@ export async function crewSkillIcons(production: boolean) {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
commitAssets('crew skill icons', changes, production);
|
commitAssets('skill icons', changes, production);
|
||||||
}
|
}
|
||||||
+3
-3
@@ -2,10 +2,10 @@ import { TankClass } from '../../components/Tanks';
|
|||||||
import { asset } from './asset';
|
import { asset } from './asset';
|
||||||
import { fetchCdonLz4 } from './fetchCdonLz4';
|
import { fetchCdonLz4 } from './fetchCdonLz4';
|
||||||
|
|
||||||
export interface CrewSkillDefinitions {
|
export interface SkillDefinitions {
|
||||||
classes: Record<TankClass, [string, string, string, string]>;
|
classes: Record<TankClass, string[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const crewSkillDefinitions = fetchCdonLz4<CrewSkillDefinitions>(
|
export const skillDefinitions = fetchCdonLz4<SkillDefinitions>(
|
||||||
asset('definitions/equipment.cdon.lz4'),
|
asset('definitions/equipment.cdon.lz4'),
|
||||||
);
|
);
|
||||||
Reference in new issue
Block a user