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 2. Run
`deno run -Ar https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/s3si.ts` `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 ## Credits
- https://github.com/frozenpandaman/s3s - https://github.com/frozenpandaman/s3s

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.1.1"; export const S3SI_VERSION = "0.1.2";
export const NSOAPP_VERSION = "2.3.1"; export const NSOAPP_VERSION = "2.3.1";
export const WEB_VIEW_VERSION = "1.0.0-216d0219"; export const WEB_VIEW_VERSION = "1.0.0-216d0219";

View File

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

View File

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

View File

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