feat: Big Run (#50)

* style: less indents

* feat: add basic big run support

* feat: add skip big run for now
main
imspace 2022-12-09 17:15:55 +08:00 committed by GitHub
parent 751de398b0
commit 235391f002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 10 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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,
);
});