diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index cd678e6..c4440b6 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -278,6 +278,14 @@ export class StatInkExporter implements GameExporter { url, }; } else { + if (game.detail.rule !== "REGULAR") { + return { + status: "skip", + reason: + `This salmon run rule is not supported yet: ${game.detail.rule}`, + }; + } + const body = await this.mapCoop(game); const { url } = await this.api.postCoop(body); @@ -776,7 +784,7 @@ export class StatInkExporter implements GameExporter { const result: StatInkCoopPostBody = { uuid: await gameId(detail.id), private: groupInfo?.mode === "PRIVATE_CUSTOM" ? "yes" : "no", - big_run: "no", + big_run: detail.rule === "BIG_RUN" ? "yes" : "no", stage: b64Number(detail.coopStage.id).toString(), danger_rate: dangerRate * 100, clear_waves, diff --git a/src/types.ts b/src/types.ts index 4af3ba6..ec3550d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -106,7 +106,7 @@ export type CoopHistoryGroup = { jobScore: number; }; mode: "PRIVATE_CUSTOM" | "REGULAR"; - rule: "REGULAR"; + rule: "REGULAR" | "BIG_RUN"; historyDetails: { nodes: CoopListNode[]; @@ -276,7 +276,7 @@ export type CoopHistoryDetail = { name: string; id: string; }; - rule: "REGULAR"; + rule: "REGULAR" | "BIG_RUN"; myResult: CoopHistoryPlayerResult; memberResults: CoopHistoryPlayerResult[]; bossResult: null | { @@ -690,7 +690,7 @@ export type StatInkCoopPostBody = { test?: "yes" | "no"; uuid: string; private: "yes" | "no"; - big_run: "no"; + big_run: "yes" | "no"; stage: string; // [0, 333] danger_rate: number; diff --git a/src/utils.test.ts b/src/utils.test.ts index 16be848..ff9df7c 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -2,16 +2,14 @@ import { base64 } from "../deps.ts"; import { assertEquals } from "../dev_deps.ts"; import { gameId, s3sCoopGameId } from "./utils.ts"; +const VS_ID = + `VsHistoryDetail-asdf:asdf:20220101T012345_12345678-abcd-1234-5678-0123456789ab`; const COOP_ID = `CoopHistoryDetail-u-asdf:20220101T012345_12345678-abcd-1234-5678-0123456789ab`; Deno.test("gameId", async () => { assertEquals( - await gameId( - base64.encode( - `VsHistoryDetail-asdf:asdf:20220101T012345_12345678-abcd-1234-5678-0123456789ab`, - ), - ), + await gameId(base64.encode(VS_ID)), "042bcac9-6b25-5d2e-a5ea-800939a6dea1", ); @@ -23,5 +21,8 @@ Deno.test("gameId", async () => { Deno.test("s3sCoopGameId", async () => { const S3S_COOP_UUID = "be4435b1-0ac5-577b-81bb-766585bec028"; - assertEquals(await s3sCoopGameId(base64.encode(COOP_ID)), S3S_COOP_UUID); + assertEquals( + await s3sCoopGameId(base64.encode(COOP_ID)), + S3S_COOP_UUID, + ); });