fix: update arcaea's CCs

This commit is contained in:
nairobi
2026-05-18 19:06:14 +02:00
parent 5f9d72a9bd
commit 3269b5a3c8
8 changed files with 411 additions and 429 deletions
File diff suppressed because it is too large Load Diff
+22
View File
@@ -120,6 +120,17 @@
"versionFilter": ["mobile"],
"where": "chart.level = '7'"
},
{
"game": "arcaea",
"id": "F19e3c01575ffb2191d9",
"inactive": false,
"legacyFolderID": "",
"searchTerms": [],
"slug": "7p-mobile",
"title": "Level 7+ (Mobile)",
"versionFilter": ["mobile"],
"where": "chart.level = '7+'"
},
{
"game": "arcaea",
"id": "F19d35f0cf25f9312476",
@@ -131,6 +142,17 @@
"versionFilter": ["mobile"],
"where": "chart.level = '8'"
},
{
"game": "arcaea",
"id": "F19e3c01575f43835f33",
"inactive": false,
"legacyFolderID": "",
"searchTerms": [],
"slug": "8p-mobile",
"title": "Level 8+ (Mobile)",
"versionFilter": ["mobile"],
"where": "chart.level = '8+'"
},
{
"game": "arcaea",
"id": "F19d35f0cf258374e9b3",
+2
View File
@@ -10,7 +10,9 @@
"5-mobile",
"6-mobile",
"7-mobile",
"7p-mobile",
"8-mobile",
"8p-mobile",
"9-mobile",
"9p-mobile",
"10-mobile",
+2 -3
View File
@@ -1,8 +1,7 @@
export function FindChartWithPTDFVersion(collection, songID, playtype, difficulty, version) {
export function FindChartWithDFVersion(collection, songID, difficulty, version) {
return collection.find(
(chart) =>
chart.song.id === songID &&
chart.playtype === playtype &&
chart.songID === songID &&
chart.difficulty === difficulty &&
chart.versions.includes(version),
);
@@ -0,0 +1 @@
wikiwiki-arcaea/*.json
@@ -1,6 +1,6 @@
## Chart constants
Get the data by going to [譜面定数表](https://wikiwiki.jp/arcaea/%E8%AD%9C%E9%9D%A2%E5%AE%9A%E6%95%B0%E8%A1%A8)
or [譜面定数表 (Level 7以下)](https://wikiwiki.jp/arcaea/譜面定数表/譜面定数表 (Level 7以下)) and paste in the contents
Get the data by going to [譜面定数表](https://wikiwiki.jp/arcaea/%E8%AD%9C%E9%9D%A2%E5%AE%9A%E6%95%B0%E8%A1%A8)
or [譜面定数表 (Level 7以下)]([https://wikiwiki.jp/arcaea/譜面定数表/譜面定数表 (Level 7以下)](https://wikiwiki.jp/arcaea/%E8%AD%9C%E9%9D%A2%E5%AE%9A%E6%95%B0%E8%A1%A8/%E8%AD%9C%E9%9D%A2%E5%AE%9A%E6%95%B0%E8%A1%A8%20%28Level%207%E4%BB%A5%E4%B8%8B%29)) and paste in the contents
of this script in the browser console:
```js
@@ -15,6 +15,8 @@ of this script in the browser console:
return "Future";
case "firebrick":
return "Beyond";
case "slateblue":
return "Eternal"
default:
throw new Error(
`Unknown difficulty color ${cssColor}. Update the script and try again.`
@@ -113,9 +115,9 @@ into the browser console:
const EXPECTED_HEADER_CELLS = ["Notes", "Song", "Composer", "Diff.", "Lv.", "F", "L", "A", "S"];
const results = [];
const tables = document.querySelectorAll("table");
for (const table of tables) {
const header = [...table.querySelectorAll("thead th")].map((th) => th.textContent);
@@ -138,7 +140,7 @@ into the browser console:
const difficulty = cells[3].textContent;
const level = cells[4].textContent;
const notecount = Number(cells[0].textContent);
if (Number.isNaN(notecount)) {
console.error(`Could not parse notecount ${
cells[0].textContent
@@ -2,9 +2,8 @@ import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { FindChartWithPTDFVersion } from "../../../finders.js";
import { ApplyMutations } from "../../../mutations.js";
import { ReadCollection } from "../../../util.js";
import { FindChartWithDFVersion } from "../../../finders.js";
import { ReadCollection, WriteCollection } from "../../../util.js";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -50,7 +49,6 @@ function parseScrapedData(file, mutationCallback) {
const charts = ReadCollection("charts-arcaea.json");
const ccData = JSON.parse(fs.readFileSync(path.join(__dirname, file), "utf-8"));
const mutations = [];
for (const entry of ccData) {
const song = findSong(songs, entry);
@@ -60,10 +58,9 @@ function parseScrapedData(file, mutationCallback) {
continue;
}
const chart = FindChartWithPTDFVersion(
const chart = FindChartWithDFVersion(
charts,
song.id,
"Touch",
entry.difficulty,
"mobile",
);
@@ -73,23 +70,16 @@ function parseScrapedData(file, mutationCallback) {
continue;
}
mutations.push(mutationCallback(chart, entry));
mutationCallback(chart, entry);
}
console.info(`Finished parsing ${file}`);
ApplyMutations("charts-arcaea.json", mutations);
WriteCollection("charts-arcaea.json", charts);
}
function chartConstantMutationCallback(chart, entry) {
return {
data: {
level: entry.level,
levelNum: entry.levelNum,
},
match: {
chartID: chart.chartID,
},
};
chart.level = entry.level;
chart.levelNum = entry.levelNum;
}
if (fs.existsSync(path.join(__dirname, "lower.json"))) {
@@ -101,14 +91,10 @@ if (fs.existsSync(path.join(__dirname, "upper.json"))) {
}
if (fs.existsSync(path.join(__dirname, "notecount.json"))) {
parseScrapedData("notecount.json", (chart, entry) => ({
data: {
data: {
notecount: entry.notecount,
},
},
match: {
chartID: chart.chartID,
},
}));
parseScrapedData("notecount.json", (chart, entry) => {
chart.data = {
...chart.data,
notecount: entry.notecount,
};
});
}
@@ -1,45 +1,15 @@
import { log as logger } from "../log.ts";
import { CreateFolderID, MutateCollection, ReadCollection, WriteCollection } from "../util.js";
const translateMap = new Map();
const origFolders = ReadCollection("folders.json", true);
import { CreateFolderID, MutateCollection } from "../util.js";
MutateCollection("folders.json", (folders) => {
logger.info("Updating Folders.");
for (const folder of folders) {
const newFolderID = CreateFolderID(folder.data, folder.game, folder.playtype);
translateMap.set(folder.folderID, newFolderID);
folder.folderID = newFolderID;
if(!folder.id?.startsWith("F")) {
folder.id = CreateFolderID();
logger.info(`Updating ${folder.slug}`);
}
}
return folders;
});
try {
MutateCollection("tables.json", (tables) => {
logger.info("Updating Tables.");
for (const table of tables) {
table.folders = table.folders.map((e) => {
const newFolderID = translateMap.get(e);
if (!newFolderID) {
throw new Error(`${e} doesn't exist as a folderID? Can't autofix.`);
}
return newFolderID;
});
}
logger.info("Done.");
return tables;
});
} catch (err) {
logger.error("Failed to update tables.json, reverting all auto-folder fixes.", { err });
WriteCollection("folders.json", origFolders);
}