fix Leaderboards showing Bringer from previous weeks
This commit is contained in:
parent
78504b9f39
commit
8155722440
2 changed files with 12 additions and 11 deletions
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Character, Nation } from "@types";
|
||||
import { WRankEntry } from "@systems/wrank";
|
||||
import { WRankEntry, WRankWeek } from "@systems/wrank";
|
||||
import { Bringer } from "@systems/bringer";
|
||||
import { Leaves } from "@systems/leaves";
|
||||
import { Emoji } from "@systems/emojis";
|
||||
|
|
@ -61,8 +61,8 @@
|
|||
/**
|
||||
* Bringer indicator — returns " · {bringer emoji}" if char is Bringer.
|
||||
*/
|
||||
bringer(char: Character): string {
|
||||
const bringer = Bringer.get({ nation: char.nation });
|
||||
bringer(char: Character, week?: WRankWeek): string {
|
||||
const bringer = Bringer.get({ nation: char.nation, week });
|
||||
return bringer === char.name ? ` · ${format.bringer(char.nation)}` : "";
|
||||
},
|
||||
|
||||
|
|
@ -78,8 +78,8 @@
|
|||
/**
|
||||
* All indicators combined — bringer + cockroach.
|
||||
*/
|
||||
indicators(char: Character, opts: { historyKey?: TGKey } = {}): string {
|
||||
return Layout.bringer(char) + Layout.cockroach(char, opts.historyKey);
|
||||
indicators(char: Character, opts: { historyKey?: TGKey; week?: WRankWeek } = {}): string {
|
||||
return Layout.bringer(char, opts.week) + Layout.cockroach(char, opts.historyKey);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@
|
|||
allTgs: string[],
|
||||
allAtks: string[],
|
||||
allDefs: string[],
|
||||
allHeals: string[]
|
||||
allHeals: string[],
|
||||
week: WRankWeek
|
||||
): string {
|
||||
const char = row.character;
|
||||
const goal = Config.get({ section: "wrank", key: "goal" });
|
||||
|
|
@ -65,7 +66,7 @@
|
|||
rank: row.position ? formatRankOnly(row.position.currentRank, goalMet) : "—",
|
||||
class: Emoji.class(classKey) || classKey || "?",
|
||||
name: TextAlign.padToMax(char.name, allNames),
|
||||
indicators: Layout.indicators(char as any),
|
||||
indicators: Layout.indicators(char as any, { week }),
|
||||
score: `${scoreEmoji} ${TextAlign.gap(4)}${TextAlign.padToMax(scoreText, scoreColumn)}`,
|
||||
kd: TextAlign.gap(KD_GAP) + TextAlign.padToMax(kdText, kdColumn),
|
||||
tgs: TextAlign.gap(TGS_GAP) + TextAlign.padLeftToMax(tgText, tgsColumn),
|
||||
|
|
@ -119,8 +120,8 @@
|
|||
const capellaEmoji = Emoji.get("capella");
|
||||
const procyonEmoji = Emoji.get("procyon");
|
||||
|
||||
const capellaFormatted = sortedCapella.map((r) => formatRow(r, capContext, capellaNames, capellaScores, capellaKds, capellaTgs, capellaAtks, capellaDefs, capellaHeals));
|
||||
const procyonFormatted = sortedProcyon.map((r) => formatRow(r, proContext, procyonNames, procyonScores, procyonKds, procyonTgs, procyonAtks, procyonDefs, procyonHeals));
|
||||
const capellaFormatted = sortedCapella.map((r) => formatRow(r, capContext, capellaNames, capellaScores, capellaKds, capellaTgs, capellaAtks, capellaDefs, capellaHeals, week));
|
||||
const procyonFormatted = sortedProcyon.map((r) => formatRow(r, proContext, procyonNames, procyonScores, procyonKds, procyonTgs, procyonAtks, procyonDefs, procyonHeals, week));
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`🏆 Weekly Leaderboard — ${week.weekKey}`)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue