mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 02:48:01 +03:00
Add main script for l.v. folders
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
const { FormatGame } = require("tachi-common");
|
||||
const { MutateCollection, CreateFolderID } = require("../util");
|
||||
|
||||
const ptFolders = {};
|
||||
|
||||
module.exports = function AddLevelVersionFolders(name, game, playtypes, version, levels) {
|
||||
MutateCollection("folders.json", (folders) => {
|
||||
for (const level of levels) {
|
||||
const folder = {
|
||||
title: `Level ${level} (${name})`,
|
||||
game,
|
||||
type: "charts",
|
||||
data: {
|
||||
level,
|
||||
versions: version
|
||||
},
|
||||
inactive: false,
|
||||
searchTerms: [],
|
||||
}
|
||||
|
||||
for (const playtype of playtypes) {
|
||||
const folderID = CreateFolderID(folder.data, folder.game, playtype);
|
||||
|
||||
const realFolder = Object.assign({ playtype, folderID }, folder);
|
||||
|
||||
if (ptFolders[playtype]) {
|
||||
ptFolders[playtype].push(realFolder);
|
||||
} else {
|
||||
ptFolders[playtype] = [realFolder];
|
||||
}
|
||||
|
||||
folders.push(realFolder);
|
||||
}
|
||||
}
|
||||
|
||||
return folders;
|
||||
});
|
||||
|
||||
MutateCollection("tables.json", (tables) => {
|
||||
for (const playtype of playtypes) {
|
||||
tables.push({
|
||||
tableID: `${game}-${playtype}-${version}-levels`,
|
||||
description: `Levels for ${FormatGame(game, playtype)} in ${name}.`,
|
||||
folders: ptFolders[playtype].map(e => e.folderID),
|
||||
game,
|
||||
playtype,
|
||||
inactive: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return tables;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// usage:
|
||||
|
||||
// const levels = [];
|
||||
// for (let i = 1; i <= 12; i++) {
|
||||
// levels.push(i.toString())
|
||||
// }
|
||||
//
|
||||
// addLevelVersionFolders("CastHour", "iidx", ["SP", "DP"], "29", levels);
|
||||
Reference in New Issue
Block a user