Extracted all parts of all characters

This commit is contained in:
2021-10-17 19:05:40 -07:00
parent c2bbaad5dd
commit 38c10c0db0
77 changed files with 62 additions and 12 deletions

View File

@ -7,6 +7,7 @@ const { mkdirp } = require('../utils/file');
// Parse Args
if(!args.root) throw new Error(`Missing root argument`);
if(!args.assets) throw new Error(`Missing assets argument`);
if(!args.in) throw new Error(`Missing in argument`);
if(!args.out) throw new Error(`Missing out argument`);
if(!args.in.endsWith('xml')) throw new Error(`Invalid in XML`);
@ -14,9 +15,9 @@ if(!args.out.endsWith('png')) throw new Error(`Invalid out PNG`);
// Determine in and out.
const root = path.resolve(args.root);
const file = path.resolve(args.in);
const file = path.resolve(args.root, args.assets, args.in);
if(!fs.existsSync(file)) throw new Error(`Could not find ${file}`);
const outFile = path.resolve(args.out);
const outFile = path.resolve(args.assets, args.out);
if(fs.existsSync(outFile)) return;
// Load XML
@ -25,7 +26,7 @@ const [ character ] = data.elements;
// Validate file.
if(!character.attributes.context) throw new Error(`Missing context`)
const dir = path.resolve(root, 'assets', character.attributes.context);
const dir = path.resolve(root, args.assets, character.attributes.context);
// Parse base and layers
const base = character.elements.find(e => e.name == 'base').attributes;