#!/usr/bin/env node import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { packageWowOriginalEffects } from "./package-wow-original.mjs"; const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); const manifestPath = path.join(projectRoot, "public/assets/game/combat-effects/manifest.json"); const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")); const entryIndex = manifest.entries.findIndex((entry) => entry.key === "ascension:500135"); if (entryIndex < 0) throw new Error("Mage Meteor is absent from the combat effect manifest."); const entry = manifest.entries[entryIndex]; const phases = { release: entry.phases.release, impact: entry.phases.impact, }; const roots = ["patch-N", "common-2.mpq", "patch-3", "patch-2", "patch", "expansion", "lichking", "common"] .map((name) => path.resolve(projectRoot, "../LadiksMPQEditor", name)); const packaged = packageWowOriginalEffects({ entries: [{ ...entry, source: "wow335", phases }], coverage: {} }, { roots, catalog: { classes: {} }, }); if (packaged.report.failures.length) { throw new Error(`Meteor packaging failed: ${JSON.stringify(packaged.report.failures)}`); } const packagedPhases = packaged.manifest.entries[0].phases; for (const phase of Object.keys(phases)) { if (packagedPhases[phase].some((asset) => !asset.effectGraphUrl)) { throw new Error(`Meteor ${phase} has an unrenderable model.`); } } manifest.entries[entryIndex] = { ...entry, phases: { ...entry.phases, ...packagedPhases } }; fs.writeFileSync(manifestPath, `${JSON.stringify(manifest)}\n`); console.log(JSON.stringify({ key: entry.key, phases: packagedPhases, report: packaged.report }, null, 2));