pop'n groundwork.

This commit is contained in:
zkldi
2021-12-22 08:04:19 +00:00
parent 6e599411d4
commit e7d05f1c22
3 changed files with 109101 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,73 @@
const fs = require("fs");
const { Command } = require("commander");
const { CreateChartID } = require("../util");
const path = require("path");
const program = new Command();
program
.option("-f, --file <mxb-json>")
program.parse(process.argv);
const options = program.opts();
if (!options.file) {
throw new Error(`Please specify a file with --file.`);
}
let data = JSON.parse(fs.readFileSync(options.file));
data = data.filter(e => e != null);
const songs = [];
const charts = [];
let songID = 1;
for (const song of data) {
const isUpper = song.charts.some(k => k !== null && k.filename.startsWith("exx"));
let title = isUpper ? `${song.title} (UPPER)` : song.title;
songs.push({
id: songID,
title,
artist: song.artist,
searchTerms: [],
altTitles: [],
data: {
displayVersion: null,
genre: song.genre
},
})
for (const chart of song.charts) {
if (chart === null) {
continue;
}
if (chart.difficulty.startsWith("BATTLE")) {
continue;
}
charts.push({
songID,
chartID: CreateChartID(),
difficulty: chart.difficulty,
playtype: "9B",
level: chart.level.toString(),
levelNum: chart.level,
rgcID: null,
isPrimary: true,
data: {
hashSHA256: chart.hash,
},
tierlistInfo: {},
versions: ["peace"]
});
}
songID++;
}
fs.writeFileSync(path.join(__dirname, "../../collections/charts-popn.json"), JSON.stringify(charts, null, "\t"));
fs.writeFileSync(path.join(__dirname, "../../collections/songs-popn.json"), JSON.stringify(songs, null, "\t"));