From f78f0b243bc18926c092cae52c02e72371986bb7 Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Tue, 7 Oct 2025 01:11:09 -0500 Subject: [PATCH] Patch from A Log plus fixed currency formatting for win/loss --- .../Commands/KasinoGambaCommands.cs | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/KfChatDotNetBot/Commands/KasinoGambaCommands.cs b/KfChatDotNetBot/Commands/KasinoGambaCommands.cs index 361d214..3d2c86f 100644 --- a/KfChatDotNetBot/Commands/KasinoGambaCommands.cs +++ b/KfChatDotNetBot/Commands/KasinoGambaCommands.cs @@ -5,6 +5,7 @@ using KfChatDotNetBot.Models.DbModels; using KfChatDotNetBot.Services; using KfChatDotNetBot.Settings; using KfChatDotNetWsClient.Models.Events; +using NLog; namespace KfChatDotNetBot.Commands; @@ -144,7 +145,7 @@ public class KenoCommand : ICommand if (payoutMulti == 0) //you lose { await Money.NewWagerAsync(gambler.Id, wager, -wager, WagerGame.Keno, ct: ctx); - await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]lost {wager}[/color]. Your balance is now: {await gambler.Balance.FormatKasinoCurrencyAsync()}.", true); + await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]lost {await wager.FormatKasinoCurrencyAsync()}[/color]. Your balance is now: {await gambler.Balance.FormatKasinoCurrencyAsync()}.", true); return; } @@ -153,11 +154,12 @@ public class KenoCommand : ICommand // Required to avoid compiler errors when trying to format it in the win message var newBalance = gambler.Balance + win; await Money.NewWagerAsync(gambler.Id, wager, wager * (decimal)payoutMulti, WagerGame.Keno, ct: ctx); - await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won {wager * (decimal)payoutMulti} with a {payoutMulti}x multi![/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.", true); + await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won {await win.FormatKasinoCurrencyAsync()} with a {payoutMulti}x multi![/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.", true); } - - private async Task AnimatedDisplayTable(List playerNumbers, List casinoNumbers, List matches, ChatBot botInstance) + +private async Task AnimatedDisplayTable(List playerNumbers, List casinoNumbers, List matches, ChatBot botInstance) { + var logger = LogManager.GetCurrentClassLogger(); var displayMessage = ""; //keno board is 8 x 5, numbers left to right, top to bottom //FIRST FRAME 11111111111111111111111111111 @@ -191,30 +193,37 @@ public class KenoCommand : ICommand { for (var row = 0; row < 8; row++) { - if (casinoNumbers[frame] == totalCounter) + if (casinoNumbers.Take(frame+1).Contains(totalCounter)) { - displayMessage += CasinoNumberDisplay; + if (matches.Contains(totalCounter)) { displayMessage += MatchRevealDisplay; - } else { displayMessage += CasinoNumberDisplay; } - } else if (playerNumbers.Contains(totalCounter)) displayMessage += PlayerNumberDisplay; - else displayMessage += BlankSpaceDisplay; + + totalCounter++; } displayMessage += "[br]"; } await botInstance.KfClient.EditMessageAsync(msg.ChatMessageId!.Value, displayMessage); await Task.Delay(500); + if (displayMessage.Length > 79 || !displayMessage.Contains(BlankSpaceDisplay) || + !(displayMessage.Contains(CasinoNumberDisplay) || displayMessage.Contains(MatchRevealDisplay)) && frame != 9) //every board should have blank spaces and casino numbers or matches. player numbers might be hidden by matches + { + logger.Info($"Casino numbers: {string.Join(",", casinoNumbers)} | Player Numbers: {string.Join(",", playerNumbers)} | Matches: {string.Join(",", matches)} | Frame: {frame - 1} | Display Board:"); + logger.Info(displayMessage); + await botInstance.SendChatMessageAsync($"Keno is bugged dewd, died on frame {frame} :bossman:", true); + } } } + private List GenerateKenoNumbers(int size, GamblerDbModel gambler) { var numbers = new List();