New match type: inGameStrID (#960)

This commit is contained in:
beerpsi
2023-10-11 18:11:43 +01:00
committed by GitHub
parent 7f5c56efa4
commit d9e0172dd7
7 changed files with 1146 additions and 1099 deletions
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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;
+1
View File
@@ -842,6 +842,7 @@ const PR_BATCH_MANUAL_SCORE = (game: Game, playtype: Playtype): PrudenceSchema =
"itgChartHash",
"sdvxInGameID",
"inGameID",
"inGameStrID",
"uscChartHash",
"popnChartHash"
),
+6 -1
View File
@@ -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.`);