gistfile1.txt
· 2.1 KiB · Text
Surowy
function formatCharRow(entry: VoteEntry, showNationEmoji = false): string {
const cfgFormat = cfg("charDisplayFormat");
const nation = entry.characterNation;
const wRankEntry = entry.characterName ? getEntry(entry.characterName, nation ?? "Capella") : null;
let wrank = "";
if (wRankEntry) {
const wRankGoal = cfg("wRankGoal");
wrank = format.wrank.full(wRankEntry, { goal: wRankGoal, brackets: true });
}
const classStr = entry.characterClass
? (getClassEmoji(entry.characterClass) || entry.characterClass)
: "";
const levelStr = entry.characterLevel && cfg("showLevelInMessages" as any)
? `${entry.characterLevel}`
: "";
let row = cfgFormat
.replace("{wrank}", wrank)
.replace("{class}", classStr)
.replace("{level}", levelStr)
.replace("{name}", entry.characterName ?? entry.displayName)
.replace(/\s+/g, " ")
.trim();
// Bringer title — independent of W.Rank so override always shows
function getNationBringerTitle(nation: Nation) {
const stormBringerIcon = getEmoji("storm_bringer") || "⚡";
const stormBringer = `${stormBringerIcon}`;
const luminousBringerIcon = getEmoji("luminous_bringer") || "⚡";
const luminousBringer = `${luminousBringerIcon}` || `⚡ Luminous Bringer`;
const nationMap = {
"Capella": luminousBringer,
"Procyon": stormBringer
};
return nationMap[nation];
}
if (nation && entry.userKey) {
const bringer = getBringer(nation);
if (bringer && bringer === entry.characterName) {
const bringerTitle = getNationBringerTitle(nation);
row += ` · ${bringerTitle}`;
}
// if (bringer && bringer === entry.characterName) {
// const emoji = nation === "Capella"
// ? (getEmoji("luminous_bringer") || "🔆")
// : (getEmoji("storm_bringer") || "⚡");
// const title = nation === "Capella" ? "Luminous Bringer" : "Storm Bringer";
// row += ` · ${emoji} **${title}**`;
// }
}
if (entry.borrowedFrom) {
row += ` ${getEmoji("borrowed") || "🔗"}`;
}
if (showNationEmoji && nation) row = `${getNationEmoji(nation)} ${row}`;
return row;
}
| 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 | } |