Compare commits

...

6 Commits

Author SHA1 Message Date
Rosalina daad8f5a94
Merge remote-tracking branch 'upstream/main' into splashcat-exporter 2023-11-09 01:05:29 -05:00
spacemeowx2 94c33bae8f feat: support random primary ability 2023-10-23 20:00:44 +08:00
spacemeowx2 f236a523f7 chore: update `WEB_VIEW_VERSION` 2023-10-17 15:15:51 +08:00
imspace b2555783bb chore: bump version 0.4.9 2023-09-15 15:13:05 +08:00
imspace 0cfe618f2f feat: add species and crown_type
https://github.com/fetus-hina/stat.ink/issues/1227
2023-09-15 15:13:05 +08:00
spacemeowx2 5e36f6c33d feat: add stat.ink types 2023-09-15 15:13:05 +08:00
5 changed files with 35 additions and 9 deletions

View File

@ -1,3 +1,11 @@
## 0.4.10
feat: support random primary ability
## 0.4.9
feat: add species and crown_type
## 0.4.8 ## 0.4.8
chore: update `WEB_VIEW_VERSION` and queries chore: update `WEB_VIEW_VERSION` and queries

View File

@ -9,7 +9,7 @@
}, },
"package": { "package": {
"productName": "s3si-ts", "productName": "s3si-ts",
"version": "0.4.8" "version": "0.4.10"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@ -2,10 +2,10 @@ import type { StatInkPostBody, VsHistoryDetail } from "./types.ts";
export const AGENT_NAME = "splashcat / s3si.ts"; export const AGENT_NAME = "splashcat / s3si.ts";
export const AGENT_VERSION = "1.1.1"; export const AGENT_VERSION = "1.1.1";
export const S3SI_VERSION = "0.4.8"; export const S3SI_VERSION = "0.4.10";
export const COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`; export const COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`;
export const NSOAPP_VERSION = "2.7.0"; 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 { export enum Queries {
HomeQuery = HomeQuery =
"51fc56bbf006caf37728914aa8bc0e2c86a80cf195b4d4027d6822a3623098a8", "51fc56bbf006caf37728914aa8bc0e2c86a80cf195b4d4027d6822a3623098a8",

View File

@ -366,7 +366,7 @@ export class StatInkExporter implements GameExporter {
{ primaryGearPower, additionalGearPowers }: PlayerGear, { primaryGearPower, additionalGearPowers }: PlayerGear,
): StatInkGear => { ): StatInkGear => {
const primary = mapAbility(primaryGearPower); const primary = mapAbility(primaryGearPower);
if (!primary) { if (!primary && !this.isRandom(primaryGearPower.image)) {
throw new Error("Unknown ability: " + primaryGearPower.name); throw new Error("Unknown ability: " + primaryGearPower.name);
} }
return { return {
@ -394,6 +394,8 @@ export class StatInkExporter implements GameExporter {
inked: player.paint, inked: player.paint,
gears: await this.mapGears(player), gears: await this.mapGears(player),
crown: player.crown ? "yes" : "no", crown: player.crown ? "yes" : "no",
crown_type: undefined,
species: player.species === "INKLING" ? "inkling" : "octoling",
disconnected: player.result ? "no" : "yes", disconnected: player.result ? "no" : "yes",
}; };
if (player.result) { if (player.result) {
@ -404,6 +406,13 @@ export class StatInkExporter implements GameExporter {
result.signal = player.result.noroshiTry ?? undefined; result.signal = player.result.noroshiTry ?? undefined;
result.special = player.result.special; 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; return result;
}; };
async mapBattle( async mapBattle(
@ -621,16 +630,18 @@ export class StatInkExporter implements GameExporter {
} }
isRandom(image: Image | null): boolean { isRandom(image: Image | null): boolean {
// question mark // question mark
const RANDOM_FILENAME = const RANDOM_FILENAME = [
"473fffb2442075078d8bb7125744905abdeae651b6a5b7453ae295582e45f7d1"; "473fffb2442075078d8bb7125744905abdeae651b6a5b7453ae295582e45f7d1",
"dc937b59892604f5a86ac96936cd7ff09e25f18ae6b758e8014a24c7fa039e91",
];
// file exporter will replace url to { pathname: string } | string // file exporter will replace url to { pathname: string } | string
const url = image?.url as ReturnType<typeof urlSimplify> | undefined | null; const url = image?.url as ReturnType<typeof urlSimplify> | undefined | null;
if (typeof url === "string") { if (typeof url === "string") {
return url.includes(RANDOM_FILENAME); return RANDOM_FILENAME.some((i) => url.includes(i));
} else if (url === undefined || url === null) { } else if (url === undefined || url === null) {
return false; return false;
} else { } else {
return url.pathname.includes(RANDOM_FILENAME); return RANDOM_FILENAME.some((i) => url.pathname.includes(i));
} }
} }
async mapCoopWeapon( async mapCoopWeapon(
@ -700,6 +711,7 @@ export class StatInkExporter implements GameExporter {
rescued: rescuedCount, rescued: rescuedCount,
defeat_boss: defeatEnemyCount, defeat_boss: defeatEnemyCount,
disconnected: disconnected ? "yes" : "no", disconnected: disconnected ? "yes" : "no",
species: player.species === "INKLING" ? "inkling" : "octoling",
}; };
} }
mapKing(id?: string) { mapKing(id?: string) {

View File

@ -148,6 +148,7 @@ export type VsPlayer = {
} | null; } | null;
paint: number; paint: number;
crown: boolean; crown: boolean;
festDragonCert: "NONE" | "DRAGON" | "DOUBLE_DRAGON";
headGear: PlayerGear; headGear: PlayerGear;
clothingGear: PlayerGear; clothingGear: PlayerGear;
@ -279,6 +280,8 @@ export type CoopHistoryPlayerResult = {
name: string; name: string;
id: string; id: string;
}; };
isMyself: boolean;
species: "INKLING" | "OCTOLING";
}; };
weapons: { name: string; image: Image | null }[]; weapons: { name: string; image: Image | null }[];
specialWeapon: null | { specialWeapon: null | {
@ -650,7 +653,7 @@ export type StatInkWeapon = {
}[]; }[];
export type StatInkGear = { export type StatInkGear = {
primary_ability: string; primary_ability: string | null;
secondary_abilities: (string | null)[]; secondary_abilities: (string | null)[];
}; };
@ -676,7 +679,9 @@ export type StatInkPlayer = {
special?: number; special?: number;
gears?: StatInkGears; gears?: StatInkGears;
crown?: "yes" | "no"; crown?: "yes" | "no";
crown_type?: "x" | "100x" | "333x";
disconnected: "yes" | "no"; disconnected: "yes" | "no";
species: "inkling" | "octoling";
}; };
export type StatInkStage = { export type StatInkStage = {
@ -726,6 +731,7 @@ export type StatInkCoopPlayer = {
rescued: number; rescued: number;
defeat_boss: number; defeat_boss: number;
disconnected: "yes" | "no"; disconnected: "yes" | "no";
species: "inkling" | "octoling";
}; };
export type StatInkCoopBoss = { export type StatInkCoopBoss = {