Map Planner (#1145)

* Initial

* Add images

* Tweaks

* Proper sized bg image and weapons

* Stage bg picker

* Outlined weapon images for planner

* First version

* Lint

* Add alt and title to weapon
This commit is contained in:
Kalle
2022-11-23 17:38:38 +02:00
committed by GitHub
parent 02516e26bd
commit aea7406586
200 changed files with 2804 additions and 36 deletions

View File

@@ -0,0 +1,42 @@
/* eslint-disable */
// @ts-nocheck
import fs from "node:fs";
import path from "node:path";
import invariant from "tiny-invariant";
const DIR_PATH = path.join(
__dirname,
"..",
"public",
"img",
"main-weapons-outlined"
);
const WEAPON_JSON_PATH = path.join(__dirname, "output", "weapons.json");
async function main() {
const weapons = JSON.parse(fs.readFileSync(WEAPON_JSON_PATH, "utf8"));
const files = await fs.promises.readdir(DIR_PATH);
for (const file of files) {
// did we already replace the name
if (file.includes(".webp") || file.includes("Lv01")) {
// delete file
await fs.promises.unlink(path.join(DIR_PATH, file));
}
const weapon: any = weapons.find((weapon: any) =>
file.includes(weapon.internalName)
);
invariant(weapon, `Could not find weapon for ${file}`);
fs.renameSync(
path.join(DIR_PATH, file),
path.join(DIR_PATH, `${weapon.id}.png`)
);
}
console.log("done with all");
}
void main();