diff --git a/docs/docs/contributing/cookbook/ddr-mdb.md b/docs/docs/contributing/cookbook/ddr-mdb.md new file mode 100644 index 000000000..d8ed35417 --- /dev/null +++ b/docs/docs/contributing/cookbook/ddr-mdb.md @@ -0,0 +1,77 @@ +# Merging DDR data into seeds + +!!! important + You need to have a working setup of Tachi to use this script. + + For instructions on how to do that, see [Tachi Setup](../setup.md). + +## Using `musicdb.xml` + +We have a script that already exists for parsing a `musicdb.xml` file and merging it with the database seeds. +This is convenient for when you want to provide an update for DDR based off data you have. + +### Importing DDR gamedata + +Navigate to `seeds/scripts/rerunners/ddr`. +The file you're looking to run is `parse-gameData-xml.ts`, but it needs two arguments: + +- `--input`, which is the location of the `musicdb.xml` file you're looking to parse. +- `--version`, what version of the game this music db is from. For a list of versions, see the [DDR Config](../../game-support/games/ddr-SP.md#versions). + +You can run this script by typing `ts-node parse-gameData-xml.ts --input YOUR_INPUT_HERE --version YOUR_VERSION_HERE` in the terminal. + +For example, if your file is in the same directory as the script, and you're importing from DDR World: +`ts-node parse-gameData-xml.ts --input ./musicdb.xml --version world` + +!!! warning "Warning" + + If all the difficulties in your XML file are set to `255`, you will need to enter them manually before importing. + Otherwise, the song won't be imported properly, and the difficulties won't show up. + + If the song is also in DDR Konaste, and you have the relevant json file, you can copy the values over. + Alternatively, you can use [RemyWiki](https://remywiki.com/). Look up the song's name, then copy the difficulties manually from the table. + + - Search for your song on RemyWiki. + - Scroll down to "Difficulty & Notecounts", then look for the table containing your game version. + - Manually copy the difficulties from it. + + For example, with [Cheerleader](https://remywiki.com/Cheerleader): + The difficulty in `musicdb.xml` is set to `255 255 255 255 255 0 255 255 255 255`, which is incorrect. + After following these steps, you should end up with `2 6 9 13 15 0 6 9 13 15`. + + Notes: There are 10 numbers, each one corresponding to a level of difficulty. + The first 5 are for SP, and the remaining are for DP. + The difficulty levels range from *BEGINNER*, *BASIC*, *DIFFICULT*, *EXPERT*, to *CHALLENGE*. + Any difficulty above 19 will be ignored, and a difficulty of 0 means that the song does not have it. + The *BEGINNER* field for DP is always set to 0 because it doesn't exist. + +### Updating stepCounts + +Step counts are generated from SSQ files. You're on your own to find them. + +Place all of your SSQ files in the `ssq` folder. The name of each file should correspond to the `basename` of each song, which is a 4~5 characters identifier. +Then, run `ts-node parse-charts.ts` + + +## Using a JSON file + +We have a script that already exists for parsing a JSON file and merging it with the database seeds. +This is convenient for when you want to provide an update for DDR based off data you have. + +!!! danger "Important" + + JSON files are usually used for Konaste game data, and therefore won't have all arcade songs. + Due to encoding differences, songs may contain Unicode characters in them instead of their actual names. You will have to manually fix this. + Additionally, the basename of existing songs may be edited incorrectly. + Therefore, this option is **not** recommended. + +Navigate to `seeds/scripts/rerunners/ddr`. +The file you're looking to run is `parse-gameData-json.ts`, but it needs two arguments: + +- `--input`, which is the location of the JSON file you're looking to parse. +- `--version`, what version of the game this music db is from. For a list of versions, see the [DDR Config](../../game-support/games/ddr-SP.md#versions). + +You can run this script by typing `ts-node parse-gameData-json.ts --input YOUR_INPUT_HERE --version YOUR_VERSION_HERE` in the terminal. + +For example, if your file is in the same directory as the script, and you're importing from DDR Konaste: +`ts-node parse-gameData-json.ts --input ./music.json --version konaste` \ No newline at end of file diff --git a/docs/docs/contributing/cookbook/sdvx-mdb.md b/docs/docs/contributing/cookbook/sdvx-mdb.md index b4bc1edda..5da756545 100644 --- a/docs/docs/contributing/cookbook/sdvx-mdb.md +++ b/docs/docs/contributing/cookbook/sdvx-mdb.md @@ -1,7 +1,7 @@ # Merging a SDVX music_db.xml into seeds We have a script that already exists for parsing a `music_db.xml` file and merging it with the database seeds. -This is convenient for when you want to provide an update for SDVX based off of data you have. +This is convenient for when you want to provide an update for SDVX based off data you have. !!! important You need to have a working setup of Tachi to use this script. diff --git a/docs/docs/game-support/games/ddr-DP.md b/docs/docs/game-support/games/ddr-DP.md index 6ac4c8836..44aaff747 100644 --- a/docs/docs/game-support/games/ddr-DP.md +++ b/docs/docs/game-support/games/ddr-DP.md @@ -76,7 +76,11 @@ The following judgements are defined: | ID | Pretty Name | | :: | :: | +| `a` | A | +| `a20` | A20 | +| `a20plus` | A20+ | | `a3` | A3 | +| `world` | WORLD | | `konaste` | Konaste | ## Supported Match Types diff --git a/docs/docs/game-support/games/ddr-SP.md b/docs/docs/game-support/games/ddr-SP.md index c3b4dbb37..d394970b5 100644 --- a/docs/docs/game-support/games/ddr-SP.md +++ b/docs/docs/game-support/games/ddr-SP.md @@ -76,7 +76,11 @@ The following judgements are defined: | ID | Pretty Name | | :: | :: | +| `a` | A | +| `a20` | A20 | +| `a20plus` | A20+ | | `a3` | A3 | +| `world` | WORLD | | `konaste` | Konaste | ## Supported Match Types diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7c4188ef5..99b1e57c9 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -37,10 +37,12 @@ nav: - "contributing/components/issues.md" - "contributing/components/documentation.md" - "contributing/components/seeds.md" + - "contributing/components/core.md" - Cookbook: - "contributing/cookbook/iidx-mdb.md" - "contributing/cookbook/sdvx-mdb.md" + - "contributing/cookbook/ddr-mdb.md" - "contributing/cookbook/bms-tables.md" - Supporting New Games: @@ -55,6 +57,7 @@ nav: - "game-support/server-impl.md" - "game-support/client-impl.md" + - "game-support/seeds.md" - Game Information: - "game-support/games/iidx-SP.md" @@ -78,6 +81,8 @@ nav: - "game-support/games/itg-Stamina.md" - "game-support/games/arcaea-Touch.md" - "game-support/games/ongeki-Single.md" + - "game-support/games/ddr-SP.md" + - "game-support/games/ddr-DP.md" - Wiki: - "wiki/index.md" @@ -130,7 +135,7 @@ nav: - Infrastructure: - "codebase/infrastructure/logging.md" - "codebase/infrastructure/branches.md" - - "codebase/infrastructure/seeds.md" + - "codebase/infrastructure/database-seeds.md" - OAuth2: - "codebase/infrastructure/api-clients.md" @@ -147,6 +152,7 @@ nav: - "codebase/batch-manual/direct-manual.md" - Score Importing: + - "codebase/import/overview.md" - "codebase/import/main.md" - "codebase/import/import-types.md" - "codebase/import/parse-conv.md" diff --git a/seeds/scripts/rerunners/ddr/README.md b/seeds/scripts/rerunners/ddr/README.md deleted file mode 100644 index a4a104495..000000000 --- a/seeds/scripts/rerunners/ddr/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Import DDR Gamedata - -1) Generate gamedata under the following XML format : - -```xml - - - - 999 - randomsong - This song doesn't exist - thissongdoesntexist - Some Artist - 120 - 2 - 1 - 1 - 3 5 6 9 0 0 6 8 8 0 - - - ... - - ... - -``` - -File must be stored in the same folder as the script with the name `musicdb.xml` - -2) At the last line of the script, eventually change the version if necessary. Current supported versions are `a3` and `konaste` (which are very similar since konaste is based on a3) -3) Run `ts-node parse-gameData-xml.ts` - -# Update stepCounts - -Step counts are generated from SSQ files. You're on your own to find them. - -1) Put all your SSQ files in the `ssq` folder. The name of each file should correspond to the `basename` of each song (a 4~5 characters identifier) -2) Run `ts-node parse-charts.ts` diff --git a/seeds/scripts/rerunners/ddr/parse-gameData-json.ts b/seeds/scripts/rerunners/ddr/parse-gameData-json.ts index 984d69d50..d42224a91 100644 --- a/seeds/scripts/rerunners/ddr/parse-gameData-json.ts +++ b/seeds/scripts/rerunners/ddr/parse-gameData-json.ts @@ -1,20 +1,21 @@ import fs from "fs"; -import {Music, parseGameData} from "./parse-gameData"; +import { Music, parseGameData } from "./parse-gameData"; +import { Command } from "commander"; interface JsonMusic { - mcode: number, - basename: string, - title: string, - title_sort: string, - artist: string, - bpmmax: number, - bpmmin: number, - level_str: string, - editable: boolean, - seriesid: number, - ac_seriesid: number, - limited_cha: number, - bemaniflag: number, + mcode: number; + basename: string; + title: string; + title_sort: string; + artist: string; + bpmmax: number; + bpmmin: number; + level_str: string; + editable: boolean; + seriesid: number; + ac_seriesid: number; + limited_cha: number; + bemaniflag: number; } function jsonMusicToMusic(jsonMusic: JsonMusic): Music { @@ -29,9 +30,16 @@ function jsonMusicToMusic(jsonMusic: JsonMusic): Music { bemaniflag: jsonMusic.bemaniflag, limited_cha: jsonMusic.limited_cha, diffLv: jsonMusic.level_str, - } + }; } -const gameData = JSON.parse(fs.readFileSync("music.json", "utf-8")).map(jsonMusicToMusic); +const program = new Command(); +program.requiredOption("-i, --input "); +program.requiredOption("-v, --version "); -parseGameData("konaste", gameData); +program.parse(process.argv); +const options = program.opts(); + +const gameData = JSON.parse(fs.readFileSync(options.input, "utf-8")).map(jsonMusicToMusic); + +parseGameData(options.version, gameData); diff --git a/seeds/scripts/rerunners/ddr/parse-gameData-xml.ts b/seeds/scripts/rerunners/ddr/parse-gameData-xml.ts index f795d6d89..16c12b540 100644 --- a/seeds/scripts/rerunners/ddr/parse-gameData-xml.ts +++ b/seeds/scripts/rerunners/ddr/parse-gameData-xml.ts @@ -1,9 +1,17 @@ -import {XMLParser} from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import fs from "fs"; -import {Music, parseGameData} from "./parse-gameData"; +import { Music, parseGameData } from "./parse-gameData"; +import { Command } from "commander"; const parser = new XMLParser(); -const gameData: Music[] = parser.parse(fs.readFileSync("musicdb.xml")).mdb.music; +const program = new Command(); +program.requiredOption("-i, --input "); +program.requiredOption("-v, --version "); -parseGameData("world", gameData); +program.parse(process.argv); +const options = program.opts(); + +const gameData: Music[] = parser.parse(fs.readFileSync(options.input)).mdb.music; + +parseGameData(options.version, gameData);