mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-22 23:18:05 +03:00
Merge pull request #796 from TNG-dev/zkldi/rm-overjoy-sgl
This commit is contained in:
+16178
-12526
File diff suppressed because it is too large
Load Diff
@@ -4,13 +4,13 @@ const path = require("path");
|
||||
const { MutateCollection } = require("../../util");
|
||||
|
||||
const program = new Command();
|
||||
program.option("-i, --input <sieglinde output/ folder>");
|
||||
program.option("-i, --input <sieglinde output/folder>");
|
||||
|
||||
program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
|
||||
if (!options.input) {
|
||||
throw new Error(`Missing --input.`);
|
||||
options.input = "../../../../sieglinde/src/output/";
|
||||
}
|
||||
|
||||
const APPLICATION_ORDER = [
|
||||
@@ -81,10 +81,12 @@ for (const tableName of APPLICATION_ORDER) {
|
||||
maybeSgl.hcStr = maybeSgl.ecStr;
|
||||
}
|
||||
|
||||
// overjoy hc data is screwed, disable it for now.
|
||||
// all overjoy data is screwed, disable it for now.
|
||||
if (maybeSgl.baseLevel.startsWith("★★")) {
|
||||
maybeSgl.hc = 0;
|
||||
maybeSgl.hcStr += "?";
|
||||
maybeSgl.ec = 0;
|
||||
maybeSgl.ecStr += "?";
|
||||
}
|
||||
|
||||
// sl12 data is screwed, neuter it.
|
||||
|
||||
Generated
+2
@@ -502,6 +502,7 @@ importers:
|
||||
sieglinde:
|
||||
specifiers:
|
||||
'@types/node-fetch': '2'
|
||||
bms-table-loader: ^1.0.1
|
||||
commander: ^8.3.0
|
||||
fast-xml-parser: ^4.0.0-beta.2
|
||||
mei-logger: ^1.0.1
|
||||
@@ -510,6 +511,7 @@ importers:
|
||||
winston: 3.5.1
|
||||
dependencies:
|
||||
'@types/node-fetch': 2.5.12
|
||||
bms-table-loader: 1.0.1
|
||||
commander: 8.3.0
|
||||
fast-xml-parser: 4.0.2
|
||||
mei-logger: 1.0.3
|
||||
|
||||
+6
-2
@@ -15,5 +15,9 @@ our goals.
|
||||
|
||||
```
|
||||
pnpm install
|
||||
pnpm run
|
||||
```
|
||||
pnpm calc-v1
|
||||
```
|
||||
|
||||
## Synchronising with seeds
|
||||
|
||||
Run `ts-node database-seeds/scripts/rerunners/bms-pms/apply-sieglinde`.
|
||||
@@ -12,6 +12,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node-fetch": "2",
|
||||
"bms-table-loader": "^1.0.1",
|
||||
"commander": "^8.3.0",
|
||||
"fast-xml-parser": "^4.0.0-beta.2",
|
||||
"mei-logger": "^1.0.1",
|
||||
|
||||
@@ -135,7 +135,7 @@ export default async function SieglindeV1Calc(tableInfo: TableRes): Promise<Arra
|
||||
|
||||
return {
|
||||
md5: chart.md5,
|
||||
title: chart.title,
|
||||
title: "title" in chart ? String(chart.title) : "",
|
||||
baseLevel: GetFString(tableInfo.table, chart),
|
||||
|
||||
ec: ecVal,
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { LoadBMSTable } from "bms-table-loader";
|
||||
import TableValueGetters from "lookups";
|
||||
import fetch from "node-fetch";
|
||||
import { BMS_TABLES } from "tachi-common";
|
||||
import type { BMSTablesDataset, BMSTableChart } from "./types";
|
||||
import type { BMSTablesDataset } from "./types";
|
||||
import type { BMSTableEntry } from "bms-table-loader";
|
||||
|
||||
// only 7k supported atm
|
||||
const registeredTables: Array<BMSTablesDataset> = BMS_TABLES.filter((e) => e.playtype === "7K");
|
||||
|
||||
export interface TableRes {
|
||||
table: BMSTablesDataset;
|
||||
charts: Array<BMSTableChart>;
|
||||
charts: Array<BMSTableEntry>;
|
||||
}
|
||||
|
||||
export default async function GetTableData(): Promise<Array<TableRes>> {
|
||||
const out = [];
|
||||
|
||||
for (const table of registeredTables.filter((e) => e.name in TableValueGetters)) {
|
||||
const charts = await fetch(table.url).then((r) => r.json());
|
||||
const bmsTable = await LoadBMSTable(table.url);
|
||||
|
||||
out.push({ table, charts });
|
||||
out.push({ table, charts: bmsTable.body });
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const TableValueGetters: Record<
|
||||
"Insane" | "Insane2" | "Normal" | "Normal2" | "Overjoy" | "Satellite" | "Stella",
|
||||
(x: string) => number | null
|
||||
(x: number | string) => number | null
|
||||
> = {
|
||||
Insane: (c) => {
|
||||
const n = Number(c);
|
||||
|
||||
@@ -6,16 +6,6 @@ export interface BMSTablesDataset {
|
||||
prefix: string;
|
||||
}
|
||||
|
||||
export interface BMSTableChart {
|
||||
title: string;
|
||||
artist: string;
|
||||
url: string;
|
||||
url_diff: string;
|
||||
md5: string;
|
||||
sha256: string;
|
||||
level: string;
|
||||
}
|
||||
|
||||
export interface CalcReturns {
|
||||
md5: string;
|
||||
title: string;
|
||||
|
||||
@@ -8,7 +8,8 @@ import TableValueGetters from "./lookups";
|
||||
import { XMLParser } from "fast-xml-parser";
|
||||
import fetch from "node-fetch";
|
||||
import { writeFile, readFile } from "fs/promises";
|
||||
import type { BMSTableChart, BMSTablesDataset } from "./types";
|
||||
import type { BMSTablesDataset } from "./types";
|
||||
import type { BMSTableEntry } from "bms-table-loader";
|
||||
|
||||
const parser = new XMLParser();
|
||||
|
||||
@@ -26,11 +27,12 @@ export async function FetchScoresForMD5(md5: string) {
|
||||
`http://dream-pro.info/~lavalse/LR2IR/2/getrankingxml.cgi?songmd5=${md5}&id=1`
|
||||
).then((r) => r.text());
|
||||
|
||||
const data = parser.parse(scores).ranking.score;
|
||||
let data = parser.parse(scores).ranking.score;
|
||||
|
||||
// in the event this thing has only one score
|
||||
// it won't be an array due to xml parsing. patch this by hand.
|
||||
if (!Array.isArray(data)) {
|
||||
logger.error(`Got rate limited for ${md5}!`, { data });
|
||||
throw new Error(`Got rate limited on ${md5}.`);
|
||||
data = [data];
|
||||
}
|
||||
|
||||
// xml sucks
|
||||
@@ -86,13 +88,13 @@ export function GetSigmoidalValue(x: number) {
|
||||
return 0.5 * (1 + Math.sin(x * Math.PI - Math.PI / 2));
|
||||
}
|
||||
|
||||
export function GetBaseline(table: BMSTablesDataset, level: string): number | null {
|
||||
export function GetBaseline(table: BMSTablesDataset, level: number | string): number | null {
|
||||
// @ts-expect-error don't care it's exhaustive
|
||||
return TableValueGetters[table.name](level);
|
||||
}
|
||||
|
||||
export function GetFString(table: BMSTablesDataset, chart: BMSTableChart) {
|
||||
return table.prefix + chart.level;
|
||||
export function GetFString(table: BMSTablesDataset, chart: BMSTableEntry) {
|
||||
return table.prefix + chart.level.toString();
|
||||
}
|
||||
|
||||
export function Sleep(ms: number) {
|
||||
|
||||
Reference in New Issue
Block a user