Updated stats
This commit is contained in:
@@ -6,9 +6,16 @@ export function getGuildMember(guild: Guild["guild"], uuid: string) {
|
||||
|
||||
export function getGuildRankTag(guild: Guild["guild"], uuid: string) {
|
||||
const member = getGuildMember(guild, uuid)
|
||||
return member?.rank === "Guild Master"
|
||||
? "[GM]"
|
||||
: `[${guild.ranks.find(r => r.name === member?.rank)?.tag}]`
|
||||
|
||||
if (member?.rank === "Guild Master") return "[GM]"
|
||||
|
||||
const rank = guild.ranks.find(r => r.name === member?.rank)?.tag
|
||||
|
||||
if (rank == null) {
|
||||
return ""
|
||||
} else {
|
||||
return `[${rank}]`
|
||||
}
|
||||
}
|
||||
|
||||
export function getMemberGEXP(guild: Guild["guild"], uuid: string, days: number = 0) {
|
||||
|
||||
@@ -15,7 +15,11 @@ export function getCoinMultiplier(level: number) {
|
||||
return MULTIPLIER[0].value
|
||||
}
|
||||
|
||||
export function getTotalCoins(stats: Record<string, Record<"coins", number | undefined>>) {
|
||||
export function getTotalCoins(stats: Record<string, Record<"coins", number | undefined>> | undefined) {
|
||||
if (!stats) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return Object.values(stats).reduce((total, stat) => total + (stat.coins || 0), 0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user