feat: send challenge every battle

main
spacemeowx2 2022-10-21 18:58:36 +08:00
parent f2dce12532
commit d953279549
5 changed files with 17 additions and 15 deletions

View File

@ -9,6 +9,16 @@ Export your battles from SplatNet to stat.ink
2. Run
`deno run -Ar https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/s3si.ts`
```
Options:
--profile-path <path>, -p Path to config file (default: ./profile.json)
--exporter <exporter>, -e Exporter list to use (default: stat.ink)
Multiple exporters can be separated by commas
(e.g. "stat.ink,file")
--no-progress, -n Disable progress bar
--help Show this help message and exit
```
## Credits
- https://github.com/frozenpandaman/s3s

View File

@ -1,7 +1,7 @@
import type { StatInkPostBody, VsHistoryDetail } from "./types.ts";
export const AGENT_NAME = "s3si.ts";
export const S3SI_VERSION = "0.1.1";
export const S3SI_VERSION = "0.1.2";
export const NSOAPP_VERSION = "2.3.1";
export const WEB_VIEW_VERSION = "1.0.0-216d0219";

View File

@ -164,8 +164,7 @@ export class StatInkExporter implements BattleExporter<VsBattle> {
return result;
}
async mapBattle(
{ lastInChallenge, bankaraMatchChallenge, listNode, detail: vsDetail }:
VsBattle,
{ bankaraMatchChallenge, listNode, detail: vsDetail }: VsBattle,
): Promise<StatInkPostBody> {
const {
knockout,
@ -257,13 +256,11 @@ export class StatInkExporter implements BattleExporter<VsBattle> {
result.rank_after = result.rank_before;
result.rank_after_s_plus = result.rank_before_s_plus;
}
if (lastInChallenge) {
result.challenge_win = bankaraMatchChallenge.winCount;
result.challenge_lose = bankaraMatchChallenge.loseCount;
result.rank_exp_change = bankaraMatchChallenge.earnedUdemaePoint ??
undefined;
}
}
return result;
}

View File

@ -86,20 +86,16 @@ class BattleFetcher {
return {
bankaraMatchChallenge: null,
listNode: null,
lastInChallenge: null,
};
}
const { bankaraMatchChallenge } = group;
const listNode = group.historyDetails.nodes.find((i) => i._bid === bid) ??
null;
const idx = group.historyDetails.nodes.indexOf(listNode!);
return {
bankaraMatchChallenge,
listNode,
lastInChallenge: (bankaraMatchChallenge?.state !== "INPROGRESS") &&
(idx === 0),
};
}
async getBattleDetail(id: string): Promise<VsHistoryDetail> {
@ -143,7 +139,7 @@ class App {
constructor(public opts: Opts) {
if (this.opts.help) {
console.log(
`Usage: deno run --allow-net --allow-read --allow-write ${Deno.mainModule} [options]
`Usage: deno run -A ${Deno.mainModule} [options]
Options:
--profile-path <path>, -p Path to config file (default: ./profile.json)

View File

@ -93,7 +93,6 @@ export type VsRule =
export type VsBattle = {
listNode: null | BattleListNode;
bankaraMatchChallenge: null | BankaraMatchChallenge;
lastInChallenge: null | boolean;
detail: VsHistoryDetail;
};
export type VsHistoryDetail = {