From 7e757448cdc2a99db8e66a3f381ed4fd5b9d5017 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Sun, 18 Dec 2022 23:01:46 +0000 Subject: [PATCH] fix: convert sdvx lamp properly (booth needs no special handling) --- .../common/api-cg/sdvx/converter.ts | 36 +++++-------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/server/src/lib/score-import/import-types/common/api-cg/sdvx/converter.ts b/server/src/lib/score-import/import-types/common/api-cg/sdvx/converter.ts index 5f22341e9..0bede9c52 100644 --- a/server/src/lib/score-import/import-types/common/api-cg/sdvx/converter.ts +++ b/server/src/lib/score-import/import-types/common/api-cg/sdvx/converter.ts @@ -42,7 +42,7 @@ export const ConverterAPICGSDVX: ConverterFunction = asy throw new InternalFailure(`Song-Chart desync with song ID ${chart.songID} (sdvx).`); } - const lamp = ConvertCGSDVXLamp(version, data.clearType); + const lamp = ConvertCGSDVXLamp(data.clearType); const { percent, grade } = GenericGetGradeAndPercent("sdvx", data.score, chart); @@ -114,37 +114,19 @@ function ConvertVersion(ver: number): GPTSupportedVersions["sdvx:Single"] { * Convert CG's clearType enum into a Tachi lamp. Note that what numbers mean what are * dependent on what version of the game we're listening for. */ -function ConvertCGSDVXLamp( - version: GPTSupportedVersions["sdvx:Single"], - clearType: number -): Lamps["sdvx:Single"] { +function ConvertCGSDVXLamp(clearType: number): Lamps["sdvx:Single"] { switch (clearType) { case 1: return "FAILED"; case 2: return "CLEAR"; + case 3: + return "EXCESSIVE CLEAR"; + case 4: + return "ULTIMATE CHAIN"; + case 5: + return "PERFECT ULTIMATE CHAIN"; } - // this version doesn't have excessive clears, so the ints are off by one. - if (version === "booth") { - switch (clearType) { - case 3: - return "ULTIMATE CHAIN"; - case 4: - return "PERFECT ULTIMATE CHAIN"; - } - } else { - switch (clearType) { - case 3: - return "EXCESSIVE CLEAR"; - case 4: - return "ULTIMATE CHAIN"; - case 5: - return "PERFECT ULTIMATE CHAIN"; - } - } - - throw new InvalidScoreFailure( - `Invalid lamp of ${clearType} for ${version} - Could not convert.` - ); + throw new InvalidScoreFailure(`Invalid lamp of ${clearType} - Could not convert.`); }