diff --git a/server/src/score-import/framework/common/score-utils.ts b/server/src/score-import/framework/common/score-utils.ts index da7168054..69bc24d72 100644 --- a/server/src/score-import/framework/common/score-utils.ts +++ b/server/src/score-import/framework/common/score-utils.ts @@ -6,6 +6,7 @@ import { AnyChartDocument, ChartDocument, ESDCore, + Playtypes, } from "kamaitachi-common"; import { judgementWindows } from "kamaitachi-common/js/config"; import CreateLogCtx from "../../../logger"; @@ -82,11 +83,15 @@ export function GenericCalculatePercent( * Calculates the ESD for a given game + percent combo. This function returns * null if the game does not support support ESD. */ -export function CalculateESDForGame(game: Game, percent: number): number | null { +export function CalculateESDForGame( + game: Game, + playtype: Playtypes[Game], + percent: number +): number | null { if (Object.prototype.hasOwnProperty.call(judgementWindows, game)) { if (percent > 0.1) { // @ts-expect-error i know better - return ESDCore.CalculateESD(judgementWindows[game], percent); + return ESDCore.CalculateESD(judgementWindows[game][playtype], percent); } else { return 200; } diff --git a/server/src/score-import/framework/score-importing/hydrate-score.ts b/server/src/score-import/framework/score-importing/hydrate-score.ts index 6c95e9fc1..bdfb25e02 100644 --- a/server/src/score-import/framework/score-importing/hydrate-score.ts +++ b/server/src/score-import/framework/score-importing/hydrate-score.ts @@ -22,7 +22,11 @@ export async function HydrateScore( scoreID: string, logger: KtLogger ): Promise { - const esd = CalculateESDForGame(dryScore.game, dryScore.scoreData.percent / 100); + const esd = CalculateESDForGame( + dryScore.game, + chart.playtype, + dryScore.scoreData.percent / 100 + ); const calculatedData = await CreateCalculatedData(dryScore, chart, esd, logger); // @todo