mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
krash fix hopefuly (#105)
* Update KrashCommand.cs add wager limit * Update KasinoKrash.cs * actual fix for payout found the bug it was using the game multi instead of the bet multi * Update KrashCommand.cs remove wager limit * actually fix the actual bug fix the actual bug
This commit is contained in:
committed by
GitHub
parent
64e318ce84
commit
354b1cfd99
@@ -28,7 +28,7 @@ public class KrashBetCommand : ICommand
|
||||
GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
{
|
||||
return;
|
||||
|
||||
var cleanupDelay = TimeSpan.FromSeconds(10);
|
||||
|
||||
if (message is { IsWhisper: false, MessageUuid: not null })
|
||||
@@ -62,6 +62,7 @@ public class KrashBetCommand : ICommand
|
||||
multi = Convert.ToDecimal(multiGroup.Value);
|
||||
}
|
||||
wager = Convert.ToDecimal(amountGroup.Value);
|
||||
//decimal wagerLimit = 10;
|
||||
if (wager > gambler.Balance)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
@@ -69,6 +70,14 @@ public class KrashBetCommand : ICommand
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(5));
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (wager > wagerLimit)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you can't bet more than {wagerLimit} on krash during testing.",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(5));
|
||||
return;
|
||||
}*/
|
||||
if (botInstance.BotServices.KasinoKrash.TheGame == null)
|
||||
{
|
||||
//start a new game
|
||||
|
||||
@@ -75,10 +75,11 @@ public class KasinoKrash : IDisposable
|
||||
|
||||
var krashBet = TheGame.Bets[index];
|
||||
TheGame.Bets.RemoveAt(index);
|
||||
var payout = TheGame.CurrentMulti * krashBet.Wager - krashBet.Wager;
|
||||
var multi = TheGame.CurrentMulti;
|
||||
var payout = multi * krashBet.Wager - krashBet.Wager;
|
||||
var newBalance = await Money.NewWagerAsync(krashBet.Gambler.Id, krashBet.Wager, payout, WagerGame.Krash, ct: _ct);
|
||||
await _kfChatBot.SendChatMessageAsync(
|
||||
$"{krashBet.Gambler.User.FormatUsername()}, you [color=limegreen][b]won[/b][/color] {await payout.FormatKasinoCurrencyAsync()}!",
|
||||
$"{krashBet.Gambler.User.FormatUsername()}, you [color=limegreen][b]won[/b][/color] {await payout.FormatKasinoCurrencyAsync()} by cashing out the krash at {multi}x!",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||
if (_kfChatBot.BotServices.KasinoShop != null)
|
||||
{
|
||||
@@ -182,7 +183,7 @@ public class KasinoKrash : IDisposable
|
||||
if (bet.Multi <= TheGame.FinalMulti && bet.Multi != -1)
|
||||
{
|
||||
//you win
|
||||
var payout = TheGame.CurrentMulti * bet.Wager - bet.Wager;
|
||||
var payout = bet.Multi * bet.Wager - bet.Wager;
|
||||
var newBalance = await Money.NewWagerAsync(bet.Gambler.Id, bet.Wager, payout, WagerGame.Krash, ct: _ct);
|
||||
await _kfChatBot.SendChatMessageAsync(
|
||||
$"{bet.Gambler.User.FormatUsername()}, you [color=limegreen][b]won[/b][/color] {await payout.FormatKasinoCurrencyAsync()}!",
|
||||
|
||||
Reference in New Issue
Block a user