feat: add fail_reason for salmon run

main
spacemeowx2 2022-11-26 14:12:24 +08:00
parent 54d53fc488
commit ba43bb6c55
3 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,7 @@
## 0.1.29
feat: add fail_reason for salmon run
## 0.1.28 ## 0.1.28
fix: allow random weapon fix: allow random weapon

View File

@ -1,7 +1,7 @@
import type { StatInkPostBody, VsHistoryDetail } from "./types.ts"; import type { StatInkPostBody, VsHistoryDetail } from "./types.ts";
export const AGENT_NAME = "s3si.ts"; export const AGENT_NAME = "s3si.ts";
export const S3SI_VERSION = "0.1.28"; export const S3SI_VERSION = "0.1.29";
export const NSOAPP_VERSION = "2.3.1"; export const NSOAPP_VERSION = "2.3.1";
export const WEB_VIEW_VERSION = "1.0.0-433ec0e8"; export const WEB_VIEW_VERSION = "1.0.0-433ec0e8";
export const S3SI_LINK = "https://github.com/spacemeowx2/s3si.ts"; export const S3SI_LINK = "https://github.com/spacemeowx2/s3si.ts";

View File

@ -604,6 +604,15 @@ export class StatInkExporter implements GameExporter {
} }
} }
let fail_reason: StatInkCoopPostBody["fail_reason"] = null;
// failed
if (clear_waves !== 3 && detail.waveResults.length > 0) {
const lastWave = detail.waveResults[detail.waveResults.length - 1];
if (lastWave.teamDeliverCount >= lastWave.deliverNorm) {
fail_reason = "wipe_out";
}
}
const result: StatInkCoopPostBody = { const result: StatInkCoopPostBody = {
uuid: await gameId(detail.id), uuid: await gameId(detail.id),
private: groupInfo?.mode === "PRIVATE_CUSTOM" ? "yes" : "no", private: groupInfo?.mode === "PRIVATE_CUSTOM" ? "yes" : "no",
@ -611,7 +620,7 @@ export class StatInkExporter implements GameExporter {
stage: b64Number(detail.coopStage.id).toString(), stage: b64Number(detail.coopStage.id).toString(),
danger_rate: dangerRate * 100, danger_rate: dangerRate * 100,
clear_waves, clear_waves,
fail_reason: null, fail_reason,
king_smell: smellMeter, king_smell: smellMeter,
king_salmonid: this.mapKing(detail.bossResult?.boss.id), king_salmonid: this.mapKing(detail.bossResult?.boss.id),
clear_extra: bossResult?.hasDefeatBoss ? "yes" : "no", clear_extra: bossResult?.hasDefeatBoss ? "yes" : "no",