mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 13:28:08 +03:00
feat: 14k sieglinde (and it just works)
This commit is contained in:
+15312
-1276
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,8 @@ const APPLICATION_ORDER = [
|
||||
"Stella",
|
||||
"Normal",
|
||||
"Insane",
|
||||
"DP Insane",
|
||||
"DP Normal",
|
||||
];
|
||||
|
||||
function fmtSgl(sgl) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# https://stackoverflow.com/questions/59895/how-can-i-get-the-directory-where-a-bash-script-is-located-from-within-the-scrip
|
||||
# if you actually think bash is a good programming language you are
|
||||
# *straight up delusional*
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
cd "$SCRIPT_DIR";
|
||||
|
||||
echo "Calculating Sieglinde..."
|
||||
cd ../../../../sieglinde && pnpm calc-v1 "$@"
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
ts-node apply-sieglinde.js
|
||||
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"calc-v1": "ts-node src/main.ts"
|
||||
"calc-v1": "ts-node src/main.ts $@"
|
||||
},
|
||||
"author": "zkldi",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -237,7 +237,7 @@ export class DifficultyComputer {
|
||||
logger.info("Writing regression info...");
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, `../cache/v1-calc-regressions/${tag}.json`),
|
||||
path.join(__dirname, `../../cache/v1-calc-regressions/${tag}.json`),
|
||||
JSON.stringify({
|
||||
songDifficulty: mapToObj(this.songDifficulty),
|
||||
userSkill: mapToObj(this.userSkill),
|
||||
|
||||
@@ -4,19 +4,21 @@ import TableValueGetters from "lookups";
|
||||
import { BMS_TABLES } from "tachi-common";
|
||||
import type { BMSTablesDataset } from "./types";
|
||||
import type { BMSTableEntryMD5 } from "bms-table-loader";
|
||||
|
||||
// only 7k supported atm
|
||||
const registeredTables: Array<BMSTablesDataset> = BMS_TABLES.filter((e) => e.playtype === "7K");
|
||||
import type { Playtypes } from "tachi-common";
|
||||
|
||||
export interface TableRes {
|
||||
table: BMSTablesDataset;
|
||||
charts: Array<BMSTableEntryMD5>;
|
||||
}
|
||||
|
||||
export default async function GetTableData(): Promise<Array<TableRes>> {
|
||||
export default async function GetTableData(
|
||||
forPlaytype: Playtypes["bms"]
|
||||
): Promise<Array<TableRes>> {
|
||||
const out = [];
|
||||
|
||||
for (const table of registeredTables.filter((e) => e.name in TableValueGetters)) {
|
||||
for (const table of BMS_TABLES.filter(
|
||||
(e) => e.name in TableValueGetters && e.playtype === forPlaytype
|
||||
)) {
|
||||
const bmsTable = await LoadBMSTable(table.url);
|
||||
|
||||
out.push({
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
const TableValueGetters: Record<
|
||||
"Insane" | "Insane2" | "Normal" | "Normal2" | "Overjoy" | "Satellite" | "Stella",
|
||||
| "DP Insane"
|
||||
| "DP Normal"
|
||||
| "Insane"
|
||||
| "Insane2"
|
||||
| "Normal"
|
||||
| "Normal2"
|
||||
| "Overjoy"
|
||||
| "Satellite"
|
||||
| "Stella",
|
||||
(x: number | string) => number | null
|
||||
> = {
|
||||
Insane: (c) => {
|
||||
@@ -20,6 +28,29 @@ const TableValueGetters: Record<
|
||||
|
||||
return n + 12;
|
||||
},
|
||||
"DP Normal": (c) => {
|
||||
// delta 99 is a real folder
|
||||
if (c === "99") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const n = Number(c);
|
||||
|
||||
if (Number.isNaN(n)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return n;
|
||||
},
|
||||
"DP Insane": (c) => {
|
||||
const n = Number(c);
|
||||
|
||||
if (Number.isNaN(n)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return n + 12;
|
||||
},
|
||||
Normal: (c) => {
|
||||
if (c === "11+") {
|
||||
return 11.5;
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import GetTableData from "./fetch-tables";
|
||||
import logger from "./logger";
|
||||
import SieglindeV1Calc from "calc/v1-jiminp";
|
||||
import { Command } from "commander";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import type { CalcReturns } from "types";
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program.requiredOption("-p, --playtype <7K or 14K>");
|
||||
|
||||
program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
|
||||
if (require.main !== module) {
|
||||
logger.error(`The script main.ts must be invoked directly!`);
|
||||
process.exit(-1);
|
||||
@@ -15,7 +23,7 @@ void (async () => {
|
||||
|
||||
fs.mkdirSync(`${__dirname}/cache`, { recursive: true });
|
||||
|
||||
const tableInfo = await GetTableData();
|
||||
const tableInfo = await GetTableData(options.playtype as "7K" | "14K");
|
||||
|
||||
logger.info(`Starting...`);
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import GetTableData from "../fetch-tables";
|
||||
import { ChunkifyPromiseAll, GetScoresForMD5 } from "../util";
|
||||
import type { Playtypes } from "tachi-common";
|
||||
|
||||
export default async function FetchAllTableScores() {
|
||||
const tableInfo = await GetTableData();
|
||||
export default async function FetchAllTableScores(playtype: Playtypes["bms"]) {
|
||||
const tableInfo = await GetTableData(playtype);
|
||||
|
||||
const promises = [];
|
||||
|
||||
@@ -16,5 +17,6 @@ export default async function FetchAllTableScores() {
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
void FetchAllTableScores();
|
||||
void FetchAllTableScores("7K");
|
||||
void FetchAllTableScores("14K");
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { XMLParser } from "fast-xml-parser";
|
||||
import fetch from "node-fetch";
|
||||
import { writeFile, readFile } from "fs/promises";
|
||||
import type { BMSTablesDataset } from "./types";
|
||||
import type { BMSTableEntry } from "bms-table-loader";
|
||||
import type { BMSTableEntry, BMSTableEntryMD5 } from "bms-table-loader";
|
||||
|
||||
const parser = new XMLParser();
|
||||
|
||||
@@ -93,7 +93,7 @@ export function GetBaseline(table: BMSTablesDataset, level: number | string): nu
|
||||
return TableValueGetters[table.name](level);
|
||||
}
|
||||
|
||||
export function GetFString(table: BMSTablesDataset, chart: BMSTableEntry) {
|
||||
export function GetFString(table: BMSTablesDataset, chart: BMSTableEntryMD5) {
|
||||
return table.prefix + chart.level.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user