From 116243eac881aa7ea44a659c27ec6fdb61801289 Mon Sep 17 00:00:00 2001 From: imspace Date: Sat, 3 Jun 2023 23:31:43 +0800 Subject: [PATCH] feat: add support for Challenges (#72) --- CHANGELOG.md | 5 +++++ gui/src-tauri/tauri.conf.json | 4 ++-- src/constant.ts | 2 +- src/exporters/stat.ink.ts | 7 +++++++ src/types.ts | 22 +++++++++++++++++++--- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a25fe..98ca018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.4.1 + +feat: add support for Challenges +([#72](https://github.com/spacemeowx2/s3si.ts/issues/72)) + ## 0.4.0 feat: update `callImink` diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.json index 315dbc1..a4867df 100644 --- a/gui/src-tauri/tauri.conf.json +++ b/gui/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "s3si-ts", - "version": "0.4.0" + "version": "0.4.1" }, "tauri": { "allowlist": { @@ -93,4 +93,4 @@ } ] } -} +} \ No newline at end of file diff --git a/src/constant.ts b/src/constant.ts index fc0c8cc..7f2e298 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -1,7 +1,7 @@ import type { StatInkPostBody, VsHistoryDetail } from "./types.ts"; export const AGENT_NAME = "s3si.ts"; -export const S3SI_VERSION = "0.4.0"; +export const S3SI_VERSION = "0.4.1"; export const NSOAPP_VERSION = "2.5.1"; export const WEB_VIEW_VERSION = "4.0.0-e2ee936d"; export enum Queries { diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index c49b17b..2aed4b3 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -329,6 +329,8 @@ export class StatInkExporter implements GameExporter { } } else if (vsMode === "X_MATCH") { return "xmatch"; + } else if (vsMode === "LEAGUE") { + return "event"; } throw new TypeError(`Unknown vsMode ${vsMode}`); @@ -420,6 +422,7 @@ export class StatInkExporter implements GameExporter { myTeam, otherTeams, bankaraMatch, + leagueMatch, festMatch, playedTime, } = vsDetail; @@ -562,6 +565,10 @@ export class StatInkExporter implements GameExporter { result.rank_after_s_plus = result.rank_before_s_plus; } } + if (leagueMatch) { + result.event = leagueMatch.leagueMatchEvent?.id; + result.event_power = leagueMatch.myLeaguePower; + } if (challengeProgress) { result.challenge_win = challengeProgress.winCount; diff --git a/src/types.ts b/src/types.ts index c636b23..1d3d0d0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -204,7 +204,13 @@ export type CoopInfo = { }; }; export type Game = VsInfo | CoopInfo; -export type VsMode = "REGULAR" | "BANKARA" | "PRIVATE" | "FEST" | "X_MATCH"; +export type VsMode = + | "REGULAR" + | "BANKARA" + | "PRIVATE" + | "FEST" + | "X_MATCH" + | "LEAGUE"; export type VsHistoryDetail = { id: string; vsRule: { @@ -235,6 +241,13 @@ export type VsHistoryDetail = { contribution: number; myFestPower: number | null; } | null; + leagueMatch: { + leagueMatchEvent: { + "name": string; + "id": string; + } | null; + myLeaguePower: number | null; + } | null; myTeam: VsTeam; otherTeams: VsTeam[]; @@ -749,12 +762,13 @@ export type StatInkPostBody = { | "xmatch" | "splatfest_challenge" | "splatfest_open" - | "private"; + | "private" + | "event"; rule: "nawabari" | "area" | "hoko" | "yagura" | "asari" | "tricolor"; stage: string; weapon: string; result: "win" | "lose" | "draw" | "exempted_lose"; - knockout?: "yes" | "no"; // for TW, set null or not sending + knockout?: "yes" | "no" | null; // for TW, set null or not sending rank_in_team: number; // position in scoreboard kill?: number; assist?: number; @@ -806,6 +820,8 @@ export type StatInkPostBody = { clout_before?: number; // Splatfest Clout, before the battle clout_after?: number; // Splatfest Clout, after the battle clout_change?: number; // Splatfest Clout, equals to clout_after - clout_before if you know them + event?: string; + event_power?: number | null; cash_before?: number; cash_after?: number; our_team_players: StatInkPlayer[];