mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Removed Claude's dodgy try/finally and added win size to the message
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using KfChatDotNetBot.Extensions;
|
using KfChatDotNetBot.Extensions;
|
||||||
using KfChatDotNetBot.Models;
|
using KfChatDotNetBot.Models;
|
||||||
@@ -38,11 +36,8 @@ public class SlotsCommand : ICommand
|
|||||||
Window = TimeSpan.FromSeconds(30)
|
Window = TimeSpan.FromSeconds(30)
|
||||||
};
|
};
|
||||||
|
|
||||||
public async Task RunCommand(ChatBot botInstance, MessageModel messagen, UserDbModel user,
|
public async Task RunCommand(ChatBot botInstance, MessageModel messagen, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
|
||||||
GroupCollection arguments,
|
|
||||||
CancellationToken ctx)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!arguments.TryGetValue("amount", out var amount)) //if user just enters !keno
|
if (!arguments.TryGetValue("amount", out var amount)) //if user just enters !keno
|
||||||
{
|
{
|
||||||
await botInstance.SendChatMessageAsync(
|
await botInstance.SendChatMessageAsync(
|
||||||
@@ -63,14 +58,10 @@ public class SlotsCommand : ICommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Raylib.SetConfigFlags(ConfigFlags.HiddenWindow);
|
Raylib.SetConfigFlags(ConfigFlags.HiddenWindow);
|
||||||
Raylib.InitWindow(500,900,"KiwiSlot");
|
Raylib.InitWindow(500,900,"KiwiSlot");
|
||||||
|
|
||||||
var board = new KiwiSlotBoard(wager);
|
var board = new KiwiSlotBoard(wager);
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
board.LoadAssets();
|
board.LoadAssets();
|
||||||
board.ExecuteGameLoop();
|
board.ExecuteGameLoop();
|
||||||
//var finalImage = board.GenerateAnimatedWebp(board.SlotFrames);
|
//var finalImage = board.GenerateAnimatedWebp(board.SlotFrames);
|
||||||
@@ -107,15 +98,9 @@ public class SlotsCommand : ICommand
|
|||||||
winnings -= wager;
|
winnings -= wager;
|
||||||
newBalance = await Money.NewWagerAsync(gambler.Id, wager, winnings, WagerGame.Slots, ct: ctx);
|
newBalance = await Money.NewWagerAsync(gambler.Id, wager, winnings, WagerGame.Slots, ct: ctx);
|
||||||
await botInstance.SendChatMessageAsync(
|
await botInstance.SendChatMessageAsync(
|
||||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]win[/color]! Current balance: {await newBalance.FormatKasinoCurrencyAsync()}" +
|
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won[/color] {await winnings.FormatKasinoCurrencyAsync()}! Current balance: {await newBalance.FormatKasinoCurrencyAsync()}" +
|
||||||
$"{featureAddOn}", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
$"{featureAddOn}", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
board.UnloadAssets(); // beep boop wanted a try catch
|
|
||||||
Raylib.CloseWindow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class KiwiSlotBoard
|
private class KiwiSlotBoard
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user