diff --git a/README.md b/README.md index 1a47c43..1848d43 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ A server for querying placement objects in *The Legend of Zelda: Tears of the Ki Run build.ts to generate a map database before starting the server for the first time. + ts-node build.ts -d ../totk/Banc + +This assumes the `totk/Banc` directory contains the YAML data object map files + ts-node build.ts -r ../totk -e tools This assumes the `totk` directory contains the unaltered romfs contents. diff --git a/build.ts b/build.ts index 8c182c7..cb65a27 100644 --- a/build.ts +++ b/build.ts @@ -7,17 +7,22 @@ import { Beco } from './beco'; let parseArgs = require('minimist'); let argv = parseArgs(process.argv); -if (!argv.e || !argv.r) { - console.log("Error: Must specify paths to directories with "); +const valid_romfs_args = (argv.e && argv.r); +const valid_folder_args = (argv.e && argv.b && argv.d); +if (!valid_romfs_args && !valid_folder_args) { + console.log("Error: Must specify paths to directories with -e and either -r or (-b and -d)"); + console.log(" -d Banc extracted YAML files"); + console.log(" -b field map area beco files"); console.log(" -e Ecosystem json files"); console.log(" -r Bare game romfs"); - console.log(" e.g. % ts-node build.ts -r path/to/romfs -e tools") + console.log(" e.g. % ts-node build.ts -d path/to/Banc -b path/to/beco -e path/to/Ecosystem") + console.log(" or: % ts-node build.ts -r path/to/romfs -e path/to/Ecosystem") process.exit(1); } const ecoPath = argv.e; const romfsPath = argv.r; -const totkData = path.join(romfsPath, 'Banc'); -const becoPath = path.join(romfsPath, 'Ecosystem', 'FieldMapArea'); +const totkData = argv.d || path.join(romfsPath, 'Banc'); +const becoPath = argv.b || path.join(romfsPath, 'Ecosystem', 'FieldMapArea'); fs.rmSync('map.db.tmp', { force: true }); const db = sqlite3('map.db.tmp');