From c9bdf5411042b23ffe060a66d25daed213953d09 Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Fri, 25 Nov 2022 21:29:11 +0800 Subject: [PATCH] fix: specialWeapon null (#27) --- src/exporters/stat.ink.ts | 7 ++++--- src/types.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index daf4745..2a0cf7e 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -486,8 +486,9 @@ export class StatInkExporter implements GameExporter { splashtag_title: player.byname, uniform: SPLATNET3_STATINK_MAP.COOP_UNIFORM_MAP[b64Number(player.uniform.id)], - special: - SPLATNET3_STATINK_MAP.COOP_SPECIAL_MAP[b64Number(specialWeapon.id)], + special: specialWeapon + ? SPLATNET3_STATINK_MAP.COOP_SPECIAL_MAP[b64Number(specialWeapon.id)] + : undefined, weapons: await Promise.all(weapons.map((w) => this.mapCoopWeapon(w))), golden_eggs: goldenDeliverCount, golden_assist: goldenAssistCount, @@ -495,7 +496,7 @@ export class StatInkExporter implements GameExporter { rescue: rescueCount, rescued: rescuedCount, defeat_boss: defeatEnemyCount, - disconnected: "no", + disconnected: specialWeapon ? "no" : "yes", }; } mapKing(id?: string) { diff --git a/src/types.ts b/src/types.ts index 727b903..06faf21 100644 --- a/src/types.ts +++ b/src/types.ts @@ -210,7 +210,7 @@ export type CoopHistoryPlayerResult = { isMyself: boolean; }; weapons: { name: string }[]; - specialWeapon: { + specialWeapon: null | { name: string; id: string; }; @@ -446,7 +446,7 @@ export type StatInkCoopPlayer = { number: string; splashtag_title: string | null; uniform?: "orange" | "green" | "yellow" | "pink" | "blue" | "black" | "white"; - special: string; + special?: string; weapons: string[]; golden_eggs: number; golden_assist: number;