parent
5409ecdb16
commit
0c916cc9e8
|
|
@ -1,3 +1,8 @@
|
|||
## 0.1.36
|
||||
|
||||
fix: map special weapon by url
|
||||
([#42](https://github.com/spacemeowx2/s3si.ts/issues/42))
|
||||
|
||||
## 0.1.35
|
||||
|
||||
feat: update Queries and `WEB_VIEW_VERSION` to match the latest version of the
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ for (const dir of dirs) {
|
|||
|
||||
const events = new Map<number, string>();
|
||||
const uniforms = new Map<number, string>();
|
||||
const specials = new Map<string, string>();
|
||||
const bosses = new Map<number, string>();
|
||||
|
||||
for (const file of files) {
|
||||
|
|
@ -40,6 +41,18 @@ for (const file of files) {
|
|||
uniforms.set(b64Number(id), name);
|
||||
}
|
||||
|
||||
for (
|
||||
const { image: { url }, name } of data.detail.waveResults.flatMap((i) =>
|
||||
i.specialWeapons
|
||||
)
|
||||
) {
|
||||
if (typeof url === "object") {
|
||||
const hash = /\/(\w+)_0\.\w+/.exec(url.pathname)?.[1];
|
||||
if (!hash) continue;
|
||||
specials.set(hash, name);
|
||||
}
|
||||
}
|
||||
|
||||
for (const { id, name } of data.detail.enemyResults.map((i) => i.enemy)) {
|
||||
bosses.set(b64Number(id), name);
|
||||
}
|
||||
|
|
@ -51,4 +64,5 @@ for (const file of files) {
|
|||
|
||||
console.log([...events.entries()].sort((a, b) => a[0] - b[0]));
|
||||
console.log([...uniforms.entries()].sort((a, b) => a[0] - b[0]));
|
||||
console.log([...specials.entries()]);
|
||||
console.log([...bosses.entries()].sort((a, b) => a[0] - b[0]));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { StatInkPostBody, VsHistoryDetail } from "./types.ts";
|
||||
|
||||
export const AGENT_NAME = "s3si.ts";
|
||||
export const S3SI_VERSION = "0.1.35";
|
||||
export const S3SI_VERSION = "0.1.36";
|
||||
export const NSOAPP_VERSION = "2.3.1";
|
||||
export const WEB_VIEW_VERSION = "2.0.0-8a061f6c";
|
||||
export const S3SI_LINK = "https://github.com/spacemeowx2/s3si.ts";
|
||||
|
|
@ -37,6 +37,7 @@ export const SPLATNET3_STATINK_MAP: {
|
|||
| "white"
|
||||
| undefined
|
||||
>;
|
||||
COOP_SPECIAL_MAP: Record<string, string | undefined>;
|
||||
WATER_LEVEL_MAP: Record<0 | 1 | 2, "low" | "normal" | "high">;
|
||||
} = {
|
||||
RULE: {
|
||||
|
|
@ -80,6 +81,22 @@ export const SPLATNET3_STATINK_MAP: {
|
|||
6: "black",
|
||||
7: "white",
|
||||
},
|
||||
COOP_SPECIAL_MAP: {
|
||||
"bd327d1b64372dedefd32adb28bea62a5b6152d93aada5d9fc4f669a1955d6d4":
|
||||
"nicedama",
|
||||
"463eedc60013608666b260c79ac8c352f9795c3d0cce074d3fbbdbd2c054a56d":
|
||||
"hopsonar",
|
||||
"fa8d49e8c850ee69f0231976208a913384e73dc0a39e6fb00806f6aa3da8a1ee":
|
||||
"megaphone51",
|
||||
"252059408283fbcb69ca9c18b98effd3b8653ab73b7349c42472281e5a1c38f9":
|
||||
"jetpack",
|
||||
"680379f8b83e5f9e033b828360827bc2f0e08c34df1abcc23de3d059fe2ac435":
|
||||
"kanitank",
|
||||
"0785cb4979024a83aaa2196e287e232d5d7e4ac959895a650c30ed00fedbc714":
|
||||
"sameride",
|
||||
"380e541b5bc5e49d77ff1a616f1343aeba01d500fee36aaddf8f09d74bd3d3bc":
|
||||
"tripletornado",
|
||||
},
|
||||
WATER_LEVEL_MAP: {
|
||||
0: "low",
|
||||
1: "normal",
|
||||
|
|
|
|||
|
|
@ -290,18 +290,13 @@ export class StatInkExporter implements GameExporter {
|
|||
url,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
status: "skip",
|
||||
reason:
|
||||
"Can not export Salmon Run for now. See https://github.com/spacemeowx2/s3si.ts/issues/42",
|
||||
};
|
||||
// const body = await this.mapCoop(game);
|
||||
// const { url } = await this.api.postCoop(body);
|
||||
const body = await this.mapCoop(game);
|
||||
const { url } = await this.api.postCoop(body);
|
||||
|
||||
// return {
|
||||
// status: "success",
|
||||
// url,
|
||||
// };
|
||||
return {
|
||||
status: "success",
|
||||
url,
|
||||
};
|
||||
}
|
||||
}
|
||||
async notExported(
|
||||
|
|
@ -592,15 +587,20 @@ export class StatInkExporter implements GameExporter {
|
|||
|
||||
return weapon;
|
||||
}
|
||||
async mapSpecial(name: string): Promise<string> {
|
||||
const specialMap = await this.api.getSpecialMap();
|
||||
const special = specialMap.get(name);
|
||||
mapSpecial({ name, image }: {
|
||||
image: Image;
|
||||
name: string;
|
||||
}): Promise<string> {
|
||||
const { url } = image;
|
||||
const imageName = typeof url === "object" ? url.pathname : url ?? "";
|
||||
const hash = /\/(\w+)_0\.\w+/.exec(imageName)?.[1] ?? "";
|
||||
const special = SPLATNET3_STATINK_MAP.COOP_SPECIAL_MAP[hash];
|
||||
|
||||
if (!special) {
|
||||
throw new Error(`Special not found: ${name}`);
|
||||
throw new Error(`Special not found: ${name} (${imageName})`);
|
||||
}
|
||||
|
||||
return special;
|
||||
return Promise.resolve(special);
|
||||
}
|
||||
async mapCoopPlayer({
|
||||
player,
|
||||
|
|
@ -620,9 +620,7 @@ export class StatInkExporter implements GameExporter {
|
|||
splashtag_title: player.byname,
|
||||
uniform:
|
||||
SPLATNET3_STATINK_MAP.COOP_UNIFORM_MAP[b64Number(player.uniform.id)],
|
||||
special: specialWeapon
|
||||
? await this.mapSpecial(specialWeapon.name)
|
||||
: undefined,
|
||||
special: specialWeapon ? await this.mapSpecial(specialWeapon) : undefined,
|
||||
weapons: await Promise.all(weapons.map((w) => this.mapCoopWeapon(w))),
|
||||
golden_eggs: goldenDeliverCount,
|
||||
golden_assist: goldenAssistCount,
|
||||
|
|
@ -648,7 +646,7 @@ export class StatInkExporter implements GameExporter {
|
|||
? SPLATNET3_STATINK_MAP.COOP_EVENT_MAP[b64Number(wave.eventWave.id)]
|
||||
: undefined;
|
||||
const special_uses = (await Promise.all(
|
||||
wave.specialWeapons.map((w) => this.mapSpecial(w.name)),
|
||||
wave.specialWeapons.map((w) => this.mapSpecial(w)),
|
||||
)).reduce((p, key) => ({
|
||||
...p,
|
||||
[key]: (p[key] ?? 0) + 1,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export type VarsMap = {
|
|||
};
|
||||
|
||||
export type Image = {
|
||||
url?: string;
|
||||
url?: string | { pathname: string };
|
||||
width?: number;
|
||||
height?: number;
|
||||
};
|
||||
|
|
@ -223,6 +223,7 @@ export type CoopHistoryPlayerResult = {
|
|||
};
|
||||
weapons: { name: string; image: Image | null }[];
|
||||
specialWeapon: null | {
|
||||
image: Image;
|
||||
name: string;
|
||||
};
|
||||
defeatEnemyCount: number;
|
||||
|
|
@ -269,6 +270,7 @@ export type CoopHistoryDetail = {
|
|||
goldenPopCount: number;
|
||||
teamDeliverCount: number;
|
||||
specialWeapons: {
|
||||
image: Image;
|
||||
name: string;
|
||||
}[];
|
||||
}[];
|
||||
|
|
|
|||
Loading…
Reference in New Issue