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 ## 0.4.0
feat: update `callImink` feat: update `callImink`

View File

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

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.4.0"; export const S3SI_VERSION = "0.4.1";
export const NSOAPP_VERSION = "2.5.1"; export const NSOAPP_VERSION = "2.5.1";
export const WEB_VIEW_VERSION = "4.0.0-e2ee936d"; export const WEB_VIEW_VERSION = "4.0.0-e2ee936d";
export enum Queries { export enum Queries {

View File

@ -329,6 +329,8 @@ export class StatInkExporter implements GameExporter {
} }
} else if (vsMode === "X_MATCH") { } else if (vsMode === "X_MATCH") {
return "xmatch"; return "xmatch";
} else if (vsMode === "LEAGUE") {
return "event";
} }
throw new TypeError(`Unknown vsMode ${vsMode}`); throw new TypeError(`Unknown vsMode ${vsMode}`);
@ -420,6 +422,7 @@ export class StatInkExporter implements GameExporter {
myTeam, myTeam,
otherTeams, otherTeams,
bankaraMatch, bankaraMatch,
leagueMatch,
festMatch, festMatch,
playedTime, playedTime,
} = vsDetail; } = vsDetail;
@ -562,6 +565,10 @@ export class StatInkExporter implements GameExporter {
result.rank_after_s_plus = result.rank_before_s_plus; result.rank_after_s_plus = result.rank_before_s_plus;
} }
} }
if (leagueMatch) {
result.event = leagueMatch.leagueMatchEvent?.id;
result.event_power = leagueMatch.myLeaguePower;
}
if (challengeProgress) { if (challengeProgress) {
result.challenge_win = challengeProgress.winCount; result.challenge_win = challengeProgress.winCount;

View File

@ -204,7 +204,13 @@ export type CoopInfo = {
}; };
}; };
export type Game = VsInfo | 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 = { export type VsHistoryDetail = {
id: string; id: string;
vsRule: { vsRule: {
@ -235,6 +241,13 @@ export type VsHistoryDetail = {
contribution: number; contribution: number;
myFestPower: number | null; myFestPower: number | null;
} | null; } | null;
leagueMatch: {
leagueMatchEvent: {
"name": string;
"id": string;
} | null;
myLeaguePower: number | null;
} | null;
myTeam: VsTeam; myTeam: VsTeam;
otherTeams: VsTeam[]; otherTeams: VsTeam[];
@ -749,12 +762,13 @@ export type StatInkPostBody = {
| "xmatch" | "xmatch"
| "splatfest_challenge" | "splatfest_challenge"
| "splatfest_open" | "splatfest_open"
| "private"; | "private"
| "event";
rule: "nawabari" | "area" | "hoko" | "yagura" | "asari" | "tricolor"; rule: "nawabari" | "area" | "hoko" | "yagura" | "asari" | "tricolor";
stage: string; stage: string;
weapon: string; weapon: string;
result: "win" | "lose" | "draw" | "exempted_lose"; 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 rank_in_team: number; // position in scoreboard
kill?: number; kill?: number;
assist?: number; assist?: number;
@ -806,6 +820,8 @@ export type StatInkPostBody = {
clout_before?: number; // Splatfest Clout, before the battle clout_before?: number; // Splatfest Clout, before the battle
clout_after?: number; // Splatfest Clout, after 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 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_before?: number;
cash_after?: number; cash_after?: number;
our_team_players: StatInkPlayer[]; our_team_players: StatInkPlayer[];