64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import { mkdirSync, writeFileSync } from "node:fs";
|
|
import { dirname, resolve } from "node:path";
|
|
import { CLASSES, type CoaClassId } from "../src/app/characterCatalog";
|
|
import {
|
|
COA_ABILITIES_BY_CLASS,
|
|
COA_CLASS_RESOURCES,
|
|
} from "../src/game/coaAbilityCatalog";
|
|
import {
|
|
COA_LIVE_SOURCE,
|
|
coaClassDefinition,
|
|
} from "../src/game/coaLiveCatalog";
|
|
import {
|
|
TALENT_NODES,
|
|
TALENT_TREES,
|
|
} from "../src/game/talentCatalog";
|
|
|
|
function writeJson(path: string, value: unknown): void {
|
|
const outputPath = resolve(path);
|
|
mkdirSync(dirname(outputPath), { recursive: true });
|
|
writeFileSync(outputPath, `${JSON.stringify(value)}\n`, "utf8");
|
|
console.log(`Wrote ${outputPath}`);
|
|
}
|
|
|
|
writeJson("src/game/generated/coaAbilityRuntimeCatalog.json", {
|
|
schemaVersion: 1,
|
|
abilitiesByClass: COA_ABILITIES_BY_CLASS,
|
|
resourcesByClass: COA_CLASS_RESOURCES,
|
|
});
|
|
|
|
const coaBudgetsByClass = Object.fromEntries(CLASSES
|
|
.filter((definition) => definition.mode === "conquest")
|
|
.map((definition) => {
|
|
const classId = definition.id as CoaClassId;
|
|
const live = coaClassDefinition(classId);
|
|
return [classId, {
|
|
maximumAbility: live.maxAbilityEssence,
|
|
maximumTalent: live.maxTalentEssence,
|
|
}];
|
|
}));
|
|
|
|
writeJson("src/game/generated/talentRuntimeCatalog.json", {
|
|
schemaVersion: 1,
|
|
maximumCoaLevel: COA_LIVE_SOURCE.maximumLevel,
|
|
coaBudgetsByClass,
|
|
trees: TALENT_TREES.map(({ id, classId }) => ({ id, classId })),
|
|
nodes: TALENT_NODES.map((node) => ({
|
|
id: node.id,
|
|
treeId: node.treeId,
|
|
index: node.index,
|
|
row: node.row,
|
|
maxRank: node.maxRank,
|
|
name: node.name,
|
|
prerequisites: node.prerequisites,
|
|
rankDescriptions: node.rankDescriptions,
|
|
system: node.system,
|
|
abilityEssenceCost: node.abilityEssenceCost,
|
|
talentEssenceCost: node.talentEssenceCost,
|
|
requiredClassPoints: node.requiredClassPoints,
|
|
requiredSpecPoints: node.requiredSpecPoints,
|
|
requiredLevel: node.requiredLevel,
|
|
isPassive: node.isPassive,
|
|
})),
|
|
});
|