feat: tracks salmon run grade by group info
parent
a3d829d859
commit
e52b55bbac
|
|
@ -137,17 +137,30 @@ export class GameFetcher {
|
||||||
type: "CoopInfo",
|
type: "CoopInfo",
|
||||||
listNode: null,
|
listNode: null,
|
||||||
groupInfo: null,
|
groupInfo: null,
|
||||||
|
gradeBefore: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const { historyDetails, ...groupInfo } = group;
|
const { historyDetails, ...groupInfo } = group;
|
||||||
const listNode = historyDetails.nodes.find((i) => i.id === id) ??
|
const listNodeIdx = historyDetails.nodes.findIndex((i) => i.id === id) ??
|
||||||
null;
|
null;
|
||||||
|
const listNode = listNodeIdx !== null
|
||||||
|
? historyDetails.nodes[listNodeIdx]
|
||||||
|
: null;
|
||||||
|
const listNodeBefore = listNodeIdx !== null
|
||||||
|
? (historyDetails.nodes[listNodeIdx + 1] ?? null)
|
||||||
|
: null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: "CoopInfo",
|
type: "CoopInfo",
|
||||||
listNode,
|
listNode,
|
||||||
groupInfo,
|
groupInfo,
|
||||||
|
gradeBefore: listNodeBefore?.afterGrade && listNodeBefore.afterGradePoint
|
||||||
|
? {
|
||||||
|
grade: listNodeBefore.afterGrade,
|
||||||
|
gradePoint: listNodeBefore.afterGradePoint,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async getBattleMetaById(
|
async getBattleMetaById(
|
||||||
|
|
|
||||||
|
|
@ -686,6 +686,7 @@ export class StatInkExporter implements GameExporter {
|
||||||
}
|
}
|
||||||
async mapCoop(
|
async mapCoop(
|
||||||
{
|
{
|
||||||
|
gradeBefore,
|
||||||
groupInfo,
|
groupInfo,
|
||||||
detail,
|
detail,
|
||||||
}: CoopInfo,
|
}: CoopInfo,
|
||||||
|
|
@ -732,25 +733,33 @@ export class StatInkExporter implements GameExporter {
|
||||||
|
|
||||||
let title_before: string | undefined = undefined;
|
let title_before: string | undefined = undefined;
|
||||||
let title_exp_before: number | undefined = undefined;
|
let title_exp_before: number | undefined = undefined;
|
||||||
const expDiff = COOP_POINT_MAP[clear_waves];
|
|
||||||
|
|
||||||
if (
|
if (gradeBefore) {
|
||||||
nonNullable(title_after) && nonNullable(title_exp_after) &&
|
title_before = b64Number(gradeBefore.grade.id).toString();
|
||||||
nonNullable(expDiff)
|
title_exp_before = gradeBefore.gradePoint;
|
||||||
) {
|
} else {
|
||||||
if (title_exp_after === 40 && expDiff === 20) {
|
const expDiff = COOP_POINT_MAP[clear_waves];
|
||||||
// 20 -> 40 or ?(rank up) -> 40
|
|
||||||
} else if (title_exp_after === 40 && expDiff < 0 && title_after !== "8") {
|
if (
|
||||||
// 60,50 -> 40 or ?(rank down) to 40
|
nonNullable(title_after) && nonNullable(title_exp_after) &&
|
||||||
} else if (title_exp_after === 999 && expDiff !== 0) {
|
nonNullable(expDiff)
|
||||||
// 980,990 -> 999
|
) {
|
||||||
title_before = title_after;
|
if (title_exp_after === 40 && expDiff === 20) {
|
||||||
} else {
|
// 20 -> 40 or ?(rank up) -> 40
|
||||||
if (title_exp_after - expDiff >= 0) {
|
} else if (
|
||||||
|
title_exp_after === 40 && expDiff < 0 && title_after !== "8"
|
||||||
|
) {
|
||||||
|
// 60,50 -> 40 or ?(rank down) to 40
|
||||||
|
} else if (title_exp_after === 999 && expDiff !== 0) {
|
||||||
|
// 980,990 -> 999
|
||||||
title_before = title_after;
|
title_before = title_after;
|
||||||
title_exp_before = title_exp_after - expDiff;
|
|
||||||
} else {
|
} else {
|
||||||
title_before = (parseInt(title_after) - 1).toString();
|
if (title_exp_after - expDiff >= 0) {
|
||||||
|
title_before = title_after;
|
||||||
|
title_exp_before = title_exp_after - expDiff;
|
||||||
|
} else {
|
||||||
|
title_before = (parseInt(title_after) - 1).toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
src/types.ts
12
src/types.ts
|
|
@ -77,6 +77,11 @@ export type BattleListNode = {
|
||||||
};
|
};
|
||||||
export type CoopListNode = {
|
export type CoopListNode = {
|
||||||
id: string;
|
id: string;
|
||||||
|
afterGrade: null | {
|
||||||
|
"name": string;
|
||||||
|
"id": string;
|
||||||
|
};
|
||||||
|
afterGradePoint: null | number;
|
||||||
};
|
};
|
||||||
export type HistoryGroupItem<T> = {
|
export type HistoryGroupItem<T> = {
|
||||||
bankaraMatchChallenge: null | BankaraMatchChallenge;
|
bankaraMatchChallenge: null | BankaraMatchChallenge;
|
||||||
|
|
@ -193,6 +198,13 @@ export type CoopInfo = {
|
||||||
listNode: null | CoopListNode;
|
listNode: null | CoopListNode;
|
||||||
groupInfo: null | Omit<CoopHistoryGroup, "historyDetails">;
|
groupInfo: null | Omit<CoopHistoryGroup, "historyDetails">;
|
||||||
detail: CoopHistoryDetail;
|
detail: CoopHistoryDetail;
|
||||||
|
gradeBefore: null | {
|
||||||
|
grade: {
|
||||||
|
name: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
gradePoint: number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
export type Game = VsInfo | CoopInfo;
|
export type Game = VsInfo | CoopInfo;
|
||||||
export type VsMode = "REGULAR" | "BANKARA" | "PRIVATE" | "FEST" | "X_MATCH";
|
export type VsMode = "REGULAR" | "BANKARA" | "PRIVATE" | "FEST" | "X_MATCH";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue