Update class mechanics, stat rulesets, and CoA reference catalogs
This commit is contained in:
1 parent
b16821e92e
commit
39458d5de6
221 files changed
+2584962
-568
No files matched your search
@@ -1,9 +1,12 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { createHash } from "node:crypto";
|
||||
import { resolveSourceRoots } from "./coa-reference/local-source.mjs";
|
||||
|
||||
const projectRoot = path.resolve(import.meta.dirname, "..");
|
||||
const clientRoot = path.resolve(projectRoot, "..", "LadiksMPQEditor", "client-current");
|
||||
const spellPath = path.join(clientRoot, "area-52", "patch-D", "DBFilesClient", "Spell.dbc");
|
||||
const { extractedRoot } = resolveSourceRoots({ projectRoot });
|
||||
const clientRoot = path.join(extractedRoot, "client-current");
|
||||
const spellPath = path.join(clientRoot, "patch-T", "DBFilesClient", "Spell.dbc");
|
||||
const supportRoot = path.join(clientRoot, "patch-S", "DBFilesClient");
|
||||
const runtimePath = path.join(projectRoot, "src", "game", "generated", "coaAbilityRuntimeCatalog.json");
|
||||
const outputPath = path.join(projectRoot, "src", "game", "generated", "coaTriggeredSpellCatalog.json");
|
||||
@@ -176,19 +179,30 @@ const castTimes = dbcNumberTable(path.join(supportRoot, "SpellCastTimes.dbc"), 1
|
||||
const durations = dbcNumberTable(path.join(supportRoot, "SpellDuration.dbc"), 3);
|
||||
const radii = dbcNumberTable(path.join(supportRoot, "SpellRadius.dbc"), 3, true);
|
||||
const ranges = dbcRangeTable(path.join(supportRoot, "SpellRange.dbc"));
|
||||
const parseSpell = spellParser(fs.readFileSync(spellPath), castTimes, durations, radii, ranges);
|
||||
const spellBytes = fs.readFileSync(spellPath);
|
||||
const parseSpell = spellParser(spellBytes, castTimes, durations, radii, ranges);
|
||||
const pending = [...referencedSpellIds(runtime)];
|
||||
const spells = new Map();
|
||||
const visited = new Set();
|
||||
while (pending.length) {
|
||||
const id = pending.shift();
|
||||
if (spells.has(id)) continue;
|
||||
if (visited.has(id)) continue;
|
||||
visited.add(id);
|
||||
const spell = parseSpell(id);
|
||||
if (!spell) continue;
|
||||
spells.set(id, spell);
|
||||
for (const effect of spell.effects) {
|
||||
if (effect.triggerSpellId > 0 && !spells.has(effect.triggerSpellId)) pending.push(effect.triggerSpellId);
|
||||
if (effect.effectType === 168 && effect.miscValue > 0) pending.push(effect.miscValue);
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(outputPath, `${JSON.stringify({ schemaVersion: 1, spells: [...spells.values()] })}\n`, "utf8");
|
||||
const previous = JSON.parse(fs.readFileSync(outputPath, "utf8"));
|
||||
const classicSpells = previous.classicSpells ?? previous.spells;
|
||||
fs.writeFileSync(outputPath, `${JSON.stringify({
|
||||
schemaVersion: 1,
|
||||
source: { spellDbcPath: "client-current/patch-T/DBFilesClient/Spell.dbc", sha256: createHash("sha256").update(spellBytes).digest("hex") },
|
||||
spells: [...spells.values()].sort((left, right) => left.id - right.id),
|
||||
classicSpells,
|
||||
})}\n`, "utf8");
|
||||
console.log(`Wrote ${outputPath} with ${spells.size} triggered spell records.`);
|
||||
Reference in new issue
Block a user