Остання активність 1 month ago

nuno ревизій цього gist 1 month ago. До ревизії

1 file changed, 65 insertions

gistfile1.txt(файл створено)

@@ -0,0 +1,65 @@
1 + function formatCharRow(entry: VoteEntry, showNationEmoji = false): string {
2 + const cfgFormat = cfg("charDisplayFormat");
3 + const nation = entry.characterNation;
4 + const wRankEntry = entry.characterName ? getEntry(entry.characterName, nation ?? "Capella") : null;
5 +
6 + let wrank = "";
7 + if (wRankEntry) {
8 + const wRankGoal = cfg("wRankGoal");
9 + wrank = format.wrank.full(wRankEntry, { goal: wRankGoal, brackets: true });
10 + }
11 +
12 + const classStr = entry.characterClass
13 + ? (getClassEmoji(entry.characterClass) || entry.characterClass)
14 + : "";
15 +
16 + const levelStr = entry.characterLevel && cfg("showLevelInMessages" as any)
17 + ? `${entry.characterLevel}`
18 + : "";
19 +
20 + let row = cfgFormat
21 + .replace("{wrank}", wrank)
22 + .replace("{class}", classStr)
23 + .replace("{level}", levelStr)
24 + .replace("{name}", entry.characterName ?? entry.displayName)
25 + .replace(/\s+/g, " ")
26 + .trim();
27 +
28 + // Bringer title — independent of W.Rank so override always shows
29 + function getNationBringerTitle(nation: Nation) {
30 + const stormBringerIcon = getEmoji("storm_bringer") || "⚡";
31 + const stormBringer = `${stormBringerIcon}`;
32 +
33 + const luminousBringerIcon = getEmoji("luminous_bringer") || "⚡";
34 + const luminousBringer = `${luminousBringerIcon}` || `⚡ Luminous Bringer`;
35 +
36 + const nationMap = {
37 + "Capella": luminousBringer,
38 + "Procyon": stormBringer
39 + };
40 +
41 + return nationMap[nation];
42 + }
43 + if (nation && entry.userKey) {
44 + const bringer = getBringer(nation);
45 + if (bringer && bringer === entry.characterName) {
46 + const bringerTitle = getNationBringerTitle(nation);
47 + row += ` · ${bringerTitle}`;
48 + }
49 + // if (bringer && bringer === entry.characterName) {
50 + // const emoji = nation === "Capella"
51 + // ? (getEmoji("luminous_bringer") || "🔆")
52 + // : (getEmoji("storm_bringer") || "⚡");
53 + // const title = nation === "Capella" ? "Luminous Bringer" : "Storm Bringer";
54 + // row += ` · ${emoji} **${title}**`;
55 + // }
56 + }
57 +
58 + if (entry.borrowedFrom) {
59 + row += ` ${getEmoji("borrowed") || "🔗"}`;
60 + }
61 +
62 + if (showNationEmoji && nation) row = `${getNationEmoji(nation)} ${row}`;
63 +
64 + return row;
65 + }
Новіше Пізніше