mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.198.1
This commit is contained in:
33
node/generate-all-maps.js
Normal file
33
node/generate-all-maps.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as fs from "fs";
|
||||
import * as ut from "./util.js";
|
||||
|
||||
import "../js/parser.js";
|
||||
import "../js/utils.js";
|
||||
import "../js/maps-util.js";
|
||||
|
||||
const out = {};
|
||||
|
||||
console.log("Updating maps...");
|
||||
|
||||
[
|
||||
{
|
||||
prop: "adventure",
|
||||
index: `./data/adventures.json`,
|
||||
dir: `./data/adventure`,
|
||||
},
|
||||
{
|
||||
prop: "book",
|
||||
index: `./data/books.json`,
|
||||
dir: `./data/book`,
|
||||
},
|
||||
].forEach(({prop, index, dir}) => {
|
||||
ut.readJson(index)[prop].forEach(head => {
|
||||
console.log(`\tGenerating map data for ${head.id}`);
|
||||
const body = ut.readJson(`${dir}/${prop}-${head.id.toLowerCase()}.json`).data;
|
||||
const imageData = MapsUtil.getImageData({prop, head, body});
|
||||
if (imageData) Object.assign(out, imageData);
|
||||
});
|
||||
});
|
||||
|
||||
fs.writeFileSync("data/generated/gendata-maps.json", JSON.stringify(out), "utf8");
|
||||
console.log("Updated maps.");
|
||||
Reference in New Issue
Block a user