fix(lr2hook): handle early exiting *properly*

This commit is contained in:
zkldi
2022-10-30 15:47:29 +00:00
parent 824df0ae21
commit 2bb54cdaaa
4 changed files with 9 additions and 12 deletions
@@ -32,7 +32,7 @@ t.test("#ConverterLR2Hook", (t) => {
scoreData: {
score: TestingLR2HookScore.scoreData.exScore,
hitMeta: {
bp: 75,
bp: 56,
},
},
game: "bms",
@@ -46,14 +46,11 @@ t.test("#ConverterLR2Hook", (t) => {
t.end();
});
t.test("Should null BP if the score was a fail with hard-gauge.", async (t) => {
t.test("Should null BP if the score was exited early.", async (t) => {
const res = await ConverterLR2Hook(
dmf(TestingLR2HookScore, {
playerData: {
gauge: "HARD",
},
scoreData: {
lamp: "FAIL",
notesPlayed: 10,
},
} as any),
{ timeReceived: 10 },
@@ -43,7 +43,7 @@ export const ConverterLR2Hook: ConverterFunction<LR2HookScore, LR2HookContext> =
// lr2hook doesn't send "max" BP so to speak. If you fail really early
// or quit out, you can have an early fail with like, 5 BP.
if ((lamp === "FAILED" || lamp === "NO PLAY") && gauge === "HARD") {
if (data.scoreData.notesPlayed !== data.scoreData.notesTotal) {
bp = null;
}
+4 -4
View File
@@ -254,11 +254,11 @@ export const TestingLR2HookScore: LR2HookScore = {
gauge: "GROOVE",
},
scoreData: {
pgreat: 1000,
great: 500,
good: 100,
pgreat: 1100,
great: 900,
good: 200,
bad: 50,
poor: 25,
poor: 6,
exScore: 2500,
maxCombo: 50,
moneyScore: 150_000,
+1 -1
View File
@@ -98,7 +98,7 @@ export function FindITGChartOnHash(hash: string) {
export function FindBMSChartOnHash(hash: string) {
return db.charts.bms.findOne({
$or: [{ "data.hashMD5": hash }, { "data.hashSHA256": hash }],
});
}) as Promise<ChartDocument<"bms:7K" | "bms:14K">>;
}
/**