.betstats now looks uwu

This commit is contained in:
Kwoth
2022-10-11 19:59:58 +02:00
parent 0469705037
commit a7fe9ae08f
2 changed files with 125 additions and 119 deletions

View File

@@ -76,11 +76,15 @@ public partial class Gambling : GamblingModule<GamblingService>
var eb = _eb.Create(ctx) var eb = _eb.Create(ctx)
.WithOkColor(); .WithOkColor();
var str = "**Feature | Bet | Paid Out | Payout %** \n"; var str = "` Feature `` Bet ``Paid Out`` RoI `\n";
str += "――――――――――――――――――――\n";
foreach (var stat in stats) foreach (var stat in stats)
{ {
var perc = (stat.PaidOut / stat.Bet).ToString("P2", Culture); var perc = (stat.PaidOut / stat.Bet).ToString("P2", Culture);
str += $"`{stat.Feature}` | {N(stat.Bet)} | {N(stat.PaidOut)} | {perc}\n"; str += $"`{stat.Feature.PadBoth(9)}`" +
$"`{stat.Bet.ToString("N0").PadLeft(8, '')}`" +
$"`{stat.PaidOut.ToString("N0").PadLeft(8, '')}`" +
$"`{perc.PadLeft(6, '')}`\n";
} }
var bet = stats.Sum(x => x.Bet); var bet = stats.Sum(x => x.Bet);
@@ -90,8 +94,11 @@ public partial class Gambling : GamblingModule<GamblingService>
bet = 1; bet = 1;
var tPerc = (paidOut / bet).ToString("P2", Culture); var tPerc = (paidOut / bet).ToString("P2", Culture);
str += "--------------------------------------------\n"; str += "――――――――――――――――――――\n";
str += $"**TOTAL** | {N(bet)} | {N(paidOut)} | {tPerc}"; str += $"` {("TOTAL").PadBoth(7)}` " +
$"**{N(bet).PadLeft(8, '')}**" +
$"**{N(paidOut).PadLeft(8, '')}**" +
$"`{tPerc.PadLeft(6, '')}`";
eb.WithDescription(str); eb.WithDescription(str);
@@ -832,7 +839,7 @@ public partial class Gambling : GamblingModule<GamblingService>
} }
else if (result.Result == RpsResultType.Win) else if (result.Result == RpsResultType.Win)
{ {
if((long)result.Won > 0) if ((long)result.Won > 0)
embed.AddField(GetText(strs.won), N(amount.Value)); embed.AddField(GetText(strs.won), N(amount.Value));
msg = GetText(strs.rps_win(ctx.User.Mention, msg = GetText(strs.rps_win(ctx.User.Mention,
@@ -990,5 +997,4 @@ public partial class Gambling : GamblingModule<GamblingService>
sb.ToString(), sb.ToString(),
footer: $"Total Bet: {tests} | Payout: {payout:F0} | {payout * 1.0M / tests * 100}%"); footer: $"Total Bet: {tests} | Payout: {payout:F0} | {payout * 1.0M / tests * 100}%");
} }
} }

View File

@@ -24,7 +24,7 @@ public static class StringExtensions
{ {
var spaces = length - str.Length; var spaces = length - str.Length;
var padLeft = (spaces / 2) + str.Length; var padLeft = (spaces / 2) + str.Length;
return str.PadLeft(padLeft, '_').PadRight(length, '_'); return str.PadLeft(padLeft, '').PadRight(length, '');
} }
public static T? MapJson<T>(this string str) public static T? MapJson<T>(this string str)