feat: support random primary ability

splashcat-exporter
spacemeowx2 2023-10-23 20:00:44 +08:00
parent f236a523f7
commit 94c33bae8f
5 changed files with 14 additions and 8 deletions

View File

@ -1,3 +1,7 @@
## 0.4.10
feat: support random primary ability
## 0.4.9 ## 0.4.9
feat: add species and crown_type feat: add species and crown_type

View File

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

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.9"; export const S3SI_VERSION = "0.4.10";
export const NSOAPP_VERSION = "2.7.0"; export const NSOAPP_VERSION = "2.7.0";
export const WEB_VIEW_VERSION = "4.0.0-dae4328c"; export const WEB_VIEW_VERSION = "4.0.0-dae4328c";
export enum Queries { export enum Queries {

View File

@ -365,7 +365,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 {
@ -629,16 +629,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(

View File

@ -640,7 +640,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)[];
}; };