Files
5etools-mirror-2.github.io/node/generate-subclass-lookup.js
TheGiddyLimit 2eeeb0771b v1.209.0
2024-07-10 20:47:40 +01:00

16 lines
617 B
JavaScript

import fs from "fs";
import "../js/parser.js";
import "../js/utils.js";
const out = {};
const classIndex = JSON.parse(fs.readFileSync("./data/class/index.json", "utf-8"));
Object.values(classIndex).forEach(f => {
const data = JSON.parse(fs.readFileSync(`./data/class/${f}`, "utf-8"));
(data.subclass || []).forEach(sc => {
MiscUtil.set(out, sc.classSource, sc.className, sc.source, sc.shortName, {name: sc.name, isReprinted: sc.isReprinted});
});
});
fs.writeFileSync(`./data/generated/gendata-subclass-lookup.json`, CleanUtil.getCleanJson(out, {isMinify: true}));
console.log("Regenerated subclass lookup.");