From 194feb94dd240c851eb9b69cac936dce4e6ed0bf Mon Sep 17 00:00:00 2001 From: Eveldee Date: Wed, 7 Dec 2022 23:49:58 +0100 Subject: [PATCH] [Raid] Fix raid embed format --- Cocotte/Modules/Raids/RaidFormatter.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Cocotte/Modules/Raids/RaidFormatter.cs b/Cocotte/Modules/Raids/RaidFormatter.cs index 68b4e28..906ae14 100644 --- a/Cocotte/Modules/Raids/RaidFormatter.cs +++ b/Cocotte/Modules/Raids/RaidFormatter.cs @@ -1,4 +1,5 @@ -using Cocotte.Options; +using System.Numerics; +using Cocotte.Options; using Cocotte.Utils; using Discord; @@ -21,10 +22,10 @@ public class RaidFormatter _ => ":question:".ToEmote() }; - public static string FcFormat(uint fc) => fc switch + public static string FcFormat(T fc) where T : IBinaryInteger => fc switch { < 1_000 => $"{fc}", - _ => $"{fc/1000}k" + _ => $"{fc/T.CreateChecked(1000)}k" }; public string FormatRosterPlayer(RosterPlayer player) => player.Substitute switch @@ -42,10 +43,10 @@ public class RaidFormatter var substitute = rosterPlayers.Where(p => p.Substitute); var separatorLength = players.Select(p => p.Name.Length).Max(); - separatorLength = (int) ((separatorLength + 13) * 0.49); // Don't ask why, it just works + separatorLength = (int) ((separatorLength + 5) * 1.31); // Don't ask why, it just works return new EmbedFieldBuilder() - .WithName($"Roster {rosterNumber} ({nonSubstitute.Sum(p => p.Fc)} FC)") + .WithName($"Roster {rosterNumber} ({FcFormat(nonSubstitute.Sum(p => p.Fc))} FC)") .WithValue($"{string.Join("\n", nonSubstitute.Select(FormatRosterPlayer))}\n{new string('━', separatorLength)}\n{string.Join("\n", substitute.Select(FormatRosterPlayer))}") .WithIsInline(true); }