mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-02 03:48:14 +03:00
New match type: inGameStrID (#960)
This commit is contained in:
@@ -125,12 +125,12 @@ export const ARCAEA_TOUCH_CONF = {
|
||||
},
|
||||
|
||||
chartData: z.strictObject({
|
||||
inGameID: z.string(),
|
||||
inGameStrID: z.string(),
|
||||
notecount: zodNonNegativeInt,
|
||||
}),
|
||||
|
||||
preferences: z.strictObject({}),
|
||||
scoreMeta: z.strictObject({}),
|
||||
|
||||
supportedMatchTypes: ["inGameID", "songTitle", "tachiSongID"],
|
||||
supportedMatchTypes: ["inGameStrID", "songTitle", "tachiSongID"],
|
||||
} as const satisfies INTERNAL_GAME_PT_CONFIG;
|
||||
|
||||
@@ -164,5 +164,5 @@ export const MAIMAI_SINGLE_CONF = {
|
||||
preferences: z.strictObject({}),
|
||||
scoreMeta: z.strictObject({}),
|
||||
|
||||
supportedMatchTypes: ["songTitle", "tachiSongID", "inGameID"],
|
||||
supportedMatchTypes: ["songTitle", "tachiSongID", "inGameID", "inGameStrID"],
|
||||
} as const satisfies INTERNAL_GAME_PT_CONFIG;
|
||||
|
||||
@@ -842,6 +842,7 @@ const PR_BATCH_MANUAL_SCORE = (game: Game, playtype: Playtype): PrudenceSchema =
|
||||
"itgChartHash",
|
||||
"sdvxInGameID",
|
||||
"inGameID",
|
||||
"inGameStrID",
|
||||
"uscChartHash",
|
||||
"popnChartHash"
|
||||
),
|
||||
|
||||
@@ -18,7 +18,12 @@ import type { AllFieldsNullableOptional } from "./utils";
|
||||
type MatchTypesNoDifficulty = "bmsChartHash" | "itgChartHash" | "popnChartHash" | "uscChartHash";
|
||||
|
||||
// These MatchTypes need `difficulty` set in the batch manual.
|
||||
type MatchTypesWithDifficulty = "inGameID" | "sdvxInGameID" | "songTitle" | "tachiSongID";
|
||||
type MatchTypesWithDifficulty =
|
||||
| "inGameID"
|
||||
| "inGameStrID"
|
||||
| "sdvxInGameID"
|
||||
| "songTitle"
|
||||
| "tachiSongID";
|
||||
|
||||
export type MatchTypes = MatchTypesNoDifficulty | MatchTypesWithDifficulty;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,7 @@ const MATCH_TYPE_CHECKS: Record<
|
||||
fn: (c: ChartDocument<"bms:7K" | "bms:14K">) => [c.data.hashMD5, c.data.hashSHA256],
|
||||
},
|
||||
inGameID: { type: "CHARTS", fn: (c) => `${c.data.inGameID}-${c.difficulty}` },
|
||||
inGameStrID: { type: "CHARTS", fn: (c) => `${c.data.inGameStrID}-${c.difficulty}` },
|
||||
itgChartHash: { type: "CHARTS", fn: (c) => c.data.hashGSv3 },
|
||||
popnChartHash: { type: "CHARTS", fn: (c) => c.data.hashSHA256 },
|
||||
sdvxInGameID: {
|
||||
|
||||
@@ -359,6 +359,46 @@ export async function ResolveMatchTypeToTachiData(
|
||||
return { song, chart };
|
||||
}
|
||||
|
||||
case "inGameStrID": {
|
||||
const difficulty = AssertStrAsDifficulty(data.difficulty, game, context.playtype);
|
||||
|
||||
let chart;
|
||||
|
||||
if (context.version) {
|
||||
chart = await db.anyCharts[game].findOne({
|
||||
"data.inGameStrID": data.identifier,
|
||||
playtype: context.playtype,
|
||||
difficulty,
|
||||
versions: context.version,
|
||||
});
|
||||
} else {
|
||||
chart = await db.anyCharts[game].findOne({
|
||||
"data.inGameStrID": data.identifier,
|
||||
playtype: context.playtype,
|
||||
difficulty,
|
||||
isPrimary: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (!chart) {
|
||||
throw new SongOrChartNotFoundFailure(
|
||||
`Cannot find chart for inGameStrID ${data.identifier} (${context.playtype}).`,
|
||||
importType,
|
||||
data,
|
||||
context
|
||||
);
|
||||
}
|
||||
|
||||
const song = await db.anySongs[game].findOne({ id: chart.songID });
|
||||
|
||||
if (!song) {
|
||||
logger.severe(`Song-Chart desync on ${chart.songID}.`);
|
||||
throw new InternalFailure(`Failed to get song for a chart that exists.`);
|
||||
}
|
||||
|
||||
return { song, chart };
|
||||
}
|
||||
|
||||
case "uscChartHash": {
|
||||
if (game !== "usc") {
|
||||
throw new InvalidScoreFailure(`uscChartHash matchType can only be used on USC.`);
|
||||
|
||||
Reference in New Issue
Block a user