From 5e36f6c33d7e0e2d30c40f72bbce1b7e0ffcec08 Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Fri, 8 Sep 2023 08:54:36 +0800 Subject: [PATCH 1/5] feat: add stat.ink types --- src/types.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/types.ts b/src/types.ts index 43825e7..ef94cdf 100644 --- a/src/types.ts +++ b/src/types.ts @@ -663,7 +663,9 @@ export type StatInkPlayer = { special?: number; gears?: StatInkGears; crown?: "yes" | "no"; + crown_type?: "x" | "100x" | "333x"; disconnected: "yes" | "no"; + species: "inkling" | "octoling"; }; export type StatInkStage = { @@ -713,6 +715,7 @@ export type StatInkCoopPlayer = { rescued: number; defeat_boss: number; disconnected: "yes" | "no"; + species: "inkling" | "octoling"; }; export type StatInkCoopBoss = { From 0cfe618f2f71ea5ae3e337b37406b04113ac6067 Mon Sep 17 00:00:00 2001 From: imspace Date: Mon, 11 Sep 2023 18:48:17 +0800 Subject: [PATCH 2/5] feat: add species and crown_type https://github.com/fetus-hina/stat.ink/issues/1227 --- src/exporters/stat.ink.ts | 10 ++++++++++ src/types.ts | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index de31e9c..a63baa3 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -393,6 +393,8 @@ export class StatInkExporter implements GameExporter { inked: player.paint, gears: await this.mapGears(player), crown: player.crown ? "yes" : "no", + crown_type: undefined, + species: player.species === "INKLING" ? "inkling" : "octoling", disconnected: player.result ? "no" : "yes", }; if (player.result) { @@ -403,6 +405,13 @@ export class StatInkExporter implements GameExporter { result.signal = player.result.noroshiTry ?? undefined; result.special = player.result.special; } + if (player.crown) { + result.crown_type = "x"; + } else if (player.festDragonCert === "DRAGON") { + result.crown_type = "100x"; + } else if (player.festDragonCert === "DOUBLE_DRAGON") { + result.crown_type = "333x"; + } return result; }; async mapBattle( @@ -699,6 +708,7 @@ export class StatInkExporter implements GameExporter { rescued: rescuedCount, defeat_boss: defeatEnemyCount, disconnected: disconnected ? "yes" : "no", + species: player.species === "INKLING" ? "inkling" : "octoling", }; } mapKing(id?: string) { diff --git a/src/types.ts b/src/types.ts index ef94cdf..0fc0432 100644 --- a/src/types.ts +++ b/src/types.ts @@ -145,6 +145,7 @@ export type VsPlayer = { } | null; paint: number; crown: boolean; + festDragonCert: "NONE" | "DRAGON" | "DOUBLE_DRAGON"; headGear: PlayerGear; clothingGear: PlayerGear; @@ -270,6 +271,8 @@ export type CoopHistoryPlayerResult = { name: string; id: string; }; + isMyself: boolean; + species: "INKLING" | "OCTOLING"; }; weapons: { name: string; image: Image | null }[]; specialWeapon: null | { From b2555783bb9fe3415221ef46f78170879b6c5a65 Mon Sep 17 00:00:00 2001 From: imspace Date: Fri, 15 Sep 2023 01:06:16 +0800 Subject: [PATCH 3/5] chore: bump version 0.4.9 --- CHANGELOG.md | 4 ++++ gui/src-tauri/tauri.conf.json | 2 +- src/constant.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9a7816..22882d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.9 + +feat: add species and crown_type + ## 0.4.8 chore: update `WEB_VIEW_VERSION` and queries diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.json index 95ce9c1..a9fbac6 100644 --- a/gui/src-tauri/tauri.conf.json +++ b/gui/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "s3si-ts", - "version": "0.4.8" + "version": "0.4.9" }, "tauri": { "allowlist": { diff --git a/src/constant.ts b/src/constant.ts index 8c41652..f435361 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.8"; +export const S3SI_VERSION = "0.4.9"; export const NSOAPP_VERSION = "2.7.0"; export const WEB_VIEW_VERSION = "4.0.0-091d4283"; export enum Queries { From f236a523f7bb51efb7a2ab2390490a7d056f0a4e Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Tue, 17 Oct 2023 15:15:51 +0800 Subject: [PATCH 4/5] chore: update `WEB_VIEW_VERSION` --- src/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constant.ts b/src/constant.ts index f435361..16d2eaa 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -3,7 +3,7 @@ import type { StatInkPostBody, VsHistoryDetail } from "./types.ts"; export const AGENT_NAME = "s3si.ts"; export const S3SI_VERSION = "0.4.9"; export const NSOAPP_VERSION = "2.7.0"; -export const WEB_VIEW_VERSION = "4.0.0-091d4283"; +export const WEB_VIEW_VERSION = "4.0.0-dae4328c"; export enum Queries { HomeQuery = "51fc56bbf006caf37728914aa8bc0e2c86a80cf195b4d4027d6822a3623098a8", From 94c33bae8f50c94b78a7403b00cf774a56d6016d Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Mon, 23 Oct 2023 20:00:44 +0800 Subject: [PATCH 5/5] feat: support random primary ability --- CHANGELOG.md | 4 ++++ gui/src-tauri/tauri.conf.json | 2 +- src/constant.ts | 2 +- src/exporters/stat.ink.ts | 12 +++++++----- src/types.ts | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22882d6..9c48c19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.10 + +feat: support random primary ability + ## 0.4.9 feat: add species and crown_type diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.json index a9fbac6..b738e83 100644 --- a/gui/src-tauri/tauri.conf.json +++ b/gui/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "s3si-ts", - "version": "0.4.9" + "version": "0.4.10" }, "tauri": { "allowlist": { diff --git a/src/constant.ts b/src/constant.ts index 16d2eaa..8055ffe 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.9"; +export const S3SI_VERSION = "0.4.10"; export const NSOAPP_VERSION = "2.7.0"; export const WEB_VIEW_VERSION = "4.0.0-dae4328c"; export enum Queries { diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index a63baa3..19c3a10 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -365,7 +365,7 @@ export class StatInkExporter implements GameExporter { { primaryGearPower, additionalGearPowers }: PlayerGear, ): StatInkGear => { const primary = mapAbility(primaryGearPower); - if (!primary) { + if (!primary && !this.isRandom(primaryGearPower.image)) { throw new Error("Unknown ability: " + primaryGearPower.name); } return { @@ -629,16 +629,18 @@ export class StatInkExporter implements GameExporter { } isRandom(image: Image | null): boolean { // question mark - const RANDOM_FILENAME = - "473fffb2442075078d8bb7125744905abdeae651b6a5b7453ae295582e45f7d1"; + const RANDOM_FILENAME = [ + "473fffb2442075078d8bb7125744905abdeae651b6a5b7453ae295582e45f7d1", + "dc937b59892604f5a86ac96936cd7ff09e25f18ae6b758e8014a24c7fa039e91", + ]; // file exporter will replace url to { pathname: string } | string const url = image?.url as ReturnType | undefined | null; if (typeof url === "string") { - return url.includes(RANDOM_FILENAME); + return RANDOM_FILENAME.some((i) => url.includes(i)); } else if (url === undefined || url === null) { return false; } else { - return url.pathname.includes(RANDOM_FILENAME); + return RANDOM_FILENAME.some((i) => url.pathname.includes(i)); } } async mapCoopWeapon( diff --git a/src/types.ts b/src/types.ts index 0fc0432..8e1c95d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -640,7 +640,7 @@ export type StatInkWeapon = { }[]; export type StatInkGear = { - primary_ability: string; + primary_ability: string | null; secondary_abilities: (string | null)[]; };