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