feat: add support for Challenges (#72)

main
imspace 2023-06-03 23:31:43 +08:00
parent 3a599717de
commit 116243eac8
5 changed files with 34 additions and 6 deletions

View File

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

View File

@ -8,7 +8,7 @@
},
"package": {
"productName": "s3si-ts",
"version": "0.4.0"
"version": "0.4.1"
},
"tauri": {
"allowlist": {

View File

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

View File

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

View File

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