mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
kasino shop updated all chat message id to uuid (#95)
* Update KasinoMines.cs * Update SlotsCommand.cs * Update MinesCommand.cs * Update PlinkoCommand.cs * Update PlinkoCommand.cs * Update PlinkoCommand.cs * Update PlanesCommand.cs * Update LimboCommand.cs * Update KenoCommand.cs * Update KasinoUserCommands.cs * Update KasinoRain.cs * Create KasinoShop.cs * Create ShopCommands.cs * Update BotServices.cs * Update MoneyDbModels.cs
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using KfChatDotNetBot.Extensions;
|
using KfChatDotNetBot.Extensions;
|
||||||
using KfChatDotNetBot.Models;
|
using KfChatDotNetBot.Models;
|
||||||
@@ -30,6 +30,14 @@ public class GetBalanceCommand : ICommand
|
|||||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||||
await botInstance.SendChatMessageAsync(
|
await botInstance.SendChatMessageAsync(
|
||||||
$"{user.FormatUsername()}, your balance is {await gambler!.Balance.FormatKasinoCurrencyAsync()}", true);
|
$"{user.FormatUsername()}, your balance is {await gambler!.Balance.FormatKasinoCurrencyAsync()}", true);
|
||||||
|
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.SendChatMessageAsync(
|
||||||
|
$"{await botInstance.BotServices.KasinoShop.Gambler_Profiles[user.KfId].FormatBalanceAsync()}", true,
|
||||||
|
autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +125,14 @@ public class SendJuiceCommand : ICommand
|
|||||||
await Money.ModifyBalanceAsync(targetGambler.Id, amount, TransactionSourceEventType.Juicer, $"Juice from {user.KfUsername}",
|
await Money.ModifyBalanceAsync(targetGambler.Id, amount, TransactionSourceEventType.Juicer, $"Juice from {user.KfUsername}",
|
||||||
gambler.Id, ctx);
|
gambler.Id, ctx);
|
||||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, {await amount.FormatKasinoCurrencyAsync()} has been sent to {targetUser.FormatUsername()}", true);
|
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, {await amount.FormatKasinoCurrencyAsync()} has been sent to {targetUser.FormatUsername()}", true);
|
||||||
|
//KasinoShop stuff --------------------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, gambler.User, gambler);
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, targetGambler.User, targetGambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessJuicerOrRainTracking(gambler, targetGambler, amount);
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,13 @@ public class KenoCommand : ICommand
|
|||||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
HOUSE_EDGE += botInstance.BotServices.KasinoShop.Gambler_Profiles[user.KfId].HouseEdgeModifier;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------
|
||||||
var payoutMultipliersHigh =
|
var payoutMultipliersHigh =
|
||||||
new[,] //stole the payout multis from stake keno and re added the RTP, except for the 1000x
|
new[,] //stole the payout multis from stake keno and re added the RTP, except for the 1000x
|
||||||
{
|
{
|
||||||
@@ -193,6 +199,13 @@ public class KenoCommand : ICommand
|
|||||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]lost {await wager.FormatKasinoCurrencyAsync()}[/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.",
|
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]lost {await wager.FormatKasinoCurrencyAsync()}[/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.",
|
||||||
true, autoDeleteAfter: cleanupDelay);
|
true, autoDeleteAfter: cleanupDelay);
|
||||||
botInstance.ScheduleMessageAutoDelete(_kenoTable ?? throw new Exception("Cannot clean up _kenoTable as it's null"), cleanupDelay);
|
botInstance.ScheduleMessageAutoDelete(_kenoTable ?? throw new Exception("Cannot clean up _kenoTable as it's null"), cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Keno, wager, -wager, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +217,13 @@ public class KenoCommand : ICommand
|
|||||||
$"{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()}.",
|
$"{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, autoDeleteAfter: cleanupDelay);
|
true, autoDeleteAfter: cleanupDelay);
|
||||||
botInstance.ScheduleMessageAutoDelete(_kenoTable ?? throw new Exception("Cannot clean up _kenotable as it's null"), cleanupDelay);
|
botInstance.ScheduleMessageAutoDelete(_kenoTable ?? throw new Exception("Cannot clean up _kenotable as it's null"), cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Keno, wager, win, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AnimatedDisplayTable(List<int> playerNumbers, List<int> casinoNumbers, List<int> matches, ChatBot botInstance)
|
private async Task AnimatedDisplayTable(List<int> playerNumbers, List<int> casinoNumbers, List<int> matches, ChatBot botInstance)
|
||||||
|
|||||||
@@ -84,6 +84,14 @@ public class LimboCommand : ICommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
HOUSE_EDGE += botInstance.BotServices.KasinoShop.Gambler_Profiles[user.KfId].HouseEdgeModifier;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
if (!arguments.TryGetValue("number", out var number))
|
if (!arguments.TryGetValue("number", out var number))
|
||||||
{
|
{
|
||||||
limboNumber = 2;
|
limboNumber = 2;
|
||||||
@@ -110,6 +118,13 @@ public class LimboCommand : ICommand
|
|||||||
await botInstance.SendChatMessageAsync($"[b][color={colorToUse}] {casinoNumbers[1]:N2}[/color][/b][br]{user.FormatUsername()}, you " +
|
await botInstance.SendChatMessageAsync($"[b][color={colorToUse}] {casinoNumbers[1]:N2}[/color][/b][br]{user.FormatUsername()}, you " +
|
||||||
$"[color={settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value}] won {await win.FormatKasinoCurrencyAsync()}![/color] " +
|
$"[color={settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value}] won {await win.FormatKasinoCurrencyAsync()}![/color] " +
|
||||||
$"Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}!", true, autoDeleteAfter: cleanupDelay);
|
$"Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}!", true, autoDeleteAfter: cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Limbo, wager, win, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +138,13 @@ public class LimboCommand : ICommand
|
|||||||
$"[b][color={colorToUse}] {casinoNumbers[1]:N2}[/color][/b][br]{user.FormatUsername()}, you [color={settings[BuiltIn.Keys.KiwiFarmsRedColor].Value}]" +
|
$"[b][color={colorToUse}] {casinoNumbers[1]:N2}[/color][/b][br]{user.FormatUsername()}, you [color={settings[BuiltIn.Keys.KiwiFarmsRedColor].Value}]" +
|
||||||
$"lost {await wager.FormatKasinoCurrencyAsync()}[/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.",
|
$"lost {await wager.FormatKasinoCurrencyAsync()}[/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.",
|
||||||
true, autoDeleteAfter: cleanupDelay);
|
true, autoDeleteAfter: cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Limbo, wager, -wager, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,11 +206,11 @@ public class MinesCommand : ICommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await KasinoMines.Bet(gambler.Id, precisePicks, msg, cashout);
|
await KasinoMines.Bet(gambler, precisePicks, msg, cashout);
|
||||||
}
|
}
|
||||||
else //if using picks
|
else //if using picks
|
||||||
{
|
{
|
||||||
await KasinoMines.Bet(gambler.Id, pick, msg, cashout);
|
await KasinoMines.Bet(gambler, pick, msg, cashout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -291,12 +291,12 @@ public class MinesCommand : ICommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await KasinoMines.Bet(gambler.Id, precisePicks, msg, cashout);
|
await KasinoMines.Bet(gambler, precisePicks, msg, cashout);
|
||||||
|
|
||||||
}
|
}
|
||||||
else //if using picks
|
else //if using picks
|
||||||
{
|
{
|
||||||
await KasinoMines.Bet(gambler.Id, pick, msg, cashout);
|
await KasinoMines.Bet(gambler, pick, msg, cashout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,14 @@ public class Planes : ICommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
HOUSE_EDGE += botInstance.BotServices.KasinoShop.Gambler_Profiles[user.KfId].HouseEdgeModifier;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
if (HOUSE_EDGE < 1)
|
if (HOUSE_EDGE < 1)
|
||||||
{
|
{
|
||||||
if (Money.GetRandomDouble(gambler) > (double)HOUSE_EDGE)
|
if (Money.GetRandomDouble(gambler) > (double)HOUSE_EDGE)
|
||||||
@@ -269,6 +277,13 @@ public class Planes : ICommand
|
|||||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]successfully landed with {await win.FormatKasinoCurrencyAsync()} from a total {plane.MultiTracker:N2}x multi![/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}",
|
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]successfully landed with {await win.FormatKasinoCurrencyAsync()} from a total {plane.MultiTracker:N2}x multi![/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}",
|
||||||
true, autoDeleteAfter: cleanupDelay);
|
true, autoDeleteAfter: cleanupDelay);
|
||||||
botInstance.ScheduleMessageAutoDelete(msgId, cleanupDelay);
|
botInstance.ScheduleMessageAutoDelete(msgId, cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Planes, wager, win, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plane.Crash();
|
plane.Crash();
|
||||||
@@ -280,6 +295,13 @@ public class Planes : ICommand
|
|||||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]crashed![/color] Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}",
|
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]crashed![/color] Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}",
|
||||||
true, autoDeleteAfter: cleanupDelay);
|
true, autoDeleteAfter: cleanupDelay);
|
||||||
botInstance.ScheduleMessageAutoDelete(msgId, cleanupDelay);
|
botInstance.ScheduleMessageAutoDelete(msgId, cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Planes, wager, -wager, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPreGameBoard(int fullCounter, int[,] planesBoard, Plane plane, int carrierCount, bool noseUp)
|
private string GetPreGameBoard(int fullCounter, int[,] planesBoard, Plane plane, int carrierCount, bool noseUp)
|
||||||
|
|||||||
@@ -132,6 +132,15 @@ public class PlinkoCommand : ICommand
|
|||||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||||
if (gambler == null)
|
if (gambler == null)
|
||||||
throw new InvalidOperationException($"Caught a null when retrieving gambler for {user.KfUsername}");
|
throw new InvalidOperationException($"Caught a null when retrieving gambler for {user.KfUsername}");
|
||||||
|
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
HOUSE_EDGE += botInstance.BotServices.KasinoShop.Gambler_Profiles[user.KfId].HouseEdgeModifier;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
int numberOfBalls = 0;
|
int numberOfBalls = 0;
|
||||||
if (!arguments.TryGetValue("number", out var number))
|
if (!arguments.TryGetValue("number", out var number))
|
||||||
{
|
{
|
||||||
@@ -225,7 +234,13 @@ public class PlinkoCommand : ICommand
|
|||||||
}
|
}
|
||||||
var newBalance = await Money.NewWagerAsync(gambler.Id, wager*numberOfBalls, payout-(wager*numberOfBalls), WagerGame.Plinko, ct: ctx);
|
var newBalance = await Money.NewWagerAsync(gambler.Id, wager*numberOfBalls, payout-(wager*numberOfBalls), WagerGame.Plinko, ct: ctx);
|
||||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, [u]you won {await payout.FormatKasinoCurrencyAsync()} from {numberOfBalls} plinko balls worth ${wager} KKK. Balance: {await newBalance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: cleanupDelay);
|
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, [u]you won {await payout.FormatKasinoCurrencyAsync()} from {numberOfBalls} plinko balls worth ${wager} KKK. Balance: {await newBalance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: cleanupDelay);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Plinko, wager*numberOfBalls, payout-(wager*numberOfBalls), newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
public string PlinkoBoardDisplay(List<PlinkoBall> balls)
|
public string PlinkoBoardDisplay(List<PlinkoBall> balls)
|
||||||
|
|||||||
@@ -98,7 +98,13 @@ public class SlotsCommand : ICommand
|
|||||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
HOUSE_EDGE += botInstance.BotServices.KasinoShop.Gambler_Profiles[user.KfId].HouseEdgeModifier;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------
|
||||||
char rigged = '0';
|
char rigged = '0';
|
||||||
decimal rigCheck = (decimal)Money.GetRandomDouble(gambler);
|
decimal rigCheck = (decimal)Money.GetRandomDouble(gambler);
|
||||||
if (HOUSE_EDGE > 1)
|
if (HOUSE_EDGE > 1)
|
||||||
@@ -151,6 +157,13 @@ public class SlotsCommand : ICommand
|
|||||||
await botInstance.SendChatMessageAsync(
|
await botInstance.SendChatMessageAsync(
|
||||||
$"{user.FormatUsername()} you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]lost[/color] {await totalWager.FormatKasinoCurrencyAsync()} with {spins} spins. Current balance: {await newBalance.FormatKasinoCurrencyAsync()}",
|
$"{user.FormatUsername()} you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]lost[/color] {await totalWager.FormatKasinoCurrencyAsync()} with {spins} spins. Current balance: {await newBalance.FormatKasinoCurrencyAsync()}",
|
||||||
true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Slots, wager*spins, -wager*spins, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,6 +174,13 @@ public class SlotsCommand : ICommand
|
|||||||
string winstr = netwin ? "" : "-";
|
string winstr = netwin ? "" : "-";
|
||||||
newBalance = await Money.NewWagerAsync(gambler.Id, wager*spins, winnings, WagerGame.Slots, ct: ctx);
|
newBalance = await Money.NewWagerAsync(gambler.Id, wager*spins, winnings, WagerGame.Slots, ct: ctx);
|
||||||
winnings = Math.Abs(winnings);
|
winnings = Math.Abs(winnings);
|
||||||
|
//Kasino Shop stuff----------------------------------------------------------------------
|
||||||
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||||
|
await botInstance.BotServices.KasinoShop.ProcessWagerTracking(gambler, WagerGame.Slots, wager*spins, winnings, newBalance);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
await Task.Delay(TimeSpan.FromSeconds(spins * 2));
|
await Task.Delay(TimeSpan.FromSeconds(spins * 2));
|
||||||
await botInstance.SendChatMessageAsync(
|
await botInstance.SendChatMessageAsync(
|
||||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won[/color] {await rawWinnings.FormatKasinoCurrencyAsync()} from {spins} spins worth {await wager.FormatKasinoCurrencyAsync()}! Net: {winstr}{await winnings.FormatKasinoCurrencyAsync()} Current balance: {await newBalance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won[/color] {await rawWinnings.FormatKasinoCurrencyAsync()} from {spins} spins worth {await wager.FormatKasinoCurrencyAsync()}! Net: {winstr}{await winnings.FormatKasinoCurrencyAsync()} Current balance: {await newBalance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||||
|
|||||||
1341
KfChatDotNetBot/Commands/ShopCommands.cs
Normal file
1341
KfChatDotNetBot/Commands/ShopCommands.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace KfChatDotNetBot.Models.DbModels;
|
namespace KfChatDotNetBot.Models.DbModels;
|
||||||
@@ -278,7 +278,11 @@ public enum TransactionSourceEventType
|
|||||||
///<summary>
|
///<summary>
|
||||||
///A form of juicer where the value is split among a number of participants
|
///A form of juicer where the value is split among a number of participants
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Rain
|
Rain,
|
||||||
|
Deposit,
|
||||||
|
Withdraw,
|
||||||
|
Sponsorship,
|
||||||
|
Loan
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum WagerGame
|
public enum WagerGame
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class BotServices
|
|||||||
private ShuffleDotUs? _shuffleDotUs;
|
private ShuffleDotUs? _shuffleDotUs;
|
||||||
private YouTubePubSub? _youTubePubSub;
|
private YouTubePubSub? _youTubePubSub;
|
||||||
public KasinoRain? KasinoRain;
|
public KasinoRain? KasinoRain;
|
||||||
|
public KasinoShop? KasinoShop;
|
||||||
|
|
||||||
private Task? _websocketWatchdog;
|
private Task? _websocketWatchdog;
|
||||||
private Task? _howlggGetUserTimer;
|
private Task? _howlggGetUserTimer;
|
||||||
@@ -93,7 +94,8 @@ public class BotServices
|
|||||||
BuildOwncastLiveStatusCheck(),
|
BuildOwncastLiveStatusCheck(),
|
||||||
BuildShuffleDotUs(),
|
BuildShuffleDotUs(),
|
||||||
BuildYouTubePubSub(),
|
BuildYouTubePubSub(),
|
||||||
BuildKasinoRain()
|
BuildKasinoRain(),
|
||||||
|
BuildKasinoShop()
|
||||||
];
|
];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -116,6 +118,12 @@ public class BotServices
|
|||||||
KasinoRain = new KasinoRain(_chatBot, _cancellationToken);
|
KasinoRain = new KasinoRain(_chatBot, _cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task BuildKasinoShop()
|
||||||
|
{
|
||||||
|
_logger.Debug("Building the kasino shop");
|
||||||
|
KasinoShop = new KasinoShop(_chatBot);
|
||||||
|
}
|
||||||
|
|
||||||
private async Task BuildShuffle()
|
private async Task BuildShuffle()
|
||||||
{
|
{
|
||||||
_logger.Debug("Building Shuffle");
|
_logger.Debug("Building Shuffle");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using KfChatDotNetBot.Settings;
|
|||||||
using NLog;
|
using NLog;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using KfChatDotNetBot.Commands.Kasino;
|
||||||
|
|
||||||
namespace KfChatDotNetBot.Services;
|
namespace KfChatDotNetBot.Services;
|
||||||
|
|
||||||
@@ -340,8 +341,9 @@ public class KasinoMines
|
|||||||
await RemoveGame(game.Creator.Id);
|
await RemoveGame(game.Creator.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> Bet(int gamblerId, int count, SentMessageTrackerModel msg, bool cashOut) //returns false if you hit a bomb, true if you didn't
|
public async Task<bool> Bet(GamblerDbModel gambler, int count, SentMessageTrackerModel msg, bool cashOut) //returns false if you hit a bomb, true if you didn't
|
||||||
{
|
{
|
||||||
|
int gamblerId = gambler.Id;
|
||||||
await GetSavedGames(gamblerId);
|
await GetSavedGames(gamblerId);
|
||||||
var game = ActiveGames[gamblerId];
|
var game = ActiveGames[gamblerId];
|
||||||
game.LastInteracted = DateTimeOffset.UtcNow;
|
game.LastInteracted = DateTimeOffset.UtcNow;
|
||||||
@@ -396,12 +398,19 @@ public class KasinoMines
|
|||||||
validBets.RemoveAt(rand);
|
validBets.RemoveAt(rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Bet(gamblerId, betCoords, msg, cashOut, true);
|
return await Bet(gambler, betCoords, msg, cashOut, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> Bet(int gamblerId, List<(int r, int c)> coords, SentMessageTrackerModel msg, bool cashOut, bool calledFromBet = false)
|
public async Task<bool> Bet(GamblerDbModel gambler, List<(int r, int c)> coords, SentMessageTrackerModel msg, bool cashOut, bool calledFromBet = false)
|
||||||
{
|
{
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (_kfChatBot.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(_kfChatBot, gambler.User, gambler);
|
||||||
|
HOUSE_EDGE += _kfChatBot.BotServices.KasinoShop.Gambler_Profiles[gambler.User.KfId].HouseEdgeModifier;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------------------------
|
||||||
|
int gamblerId = gambler.Id;
|
||||||
await GetSavedGames(gamblerId);
|
await GetSavedGames(gamblerId);
|
||||||
var game = ActiveGames[gamblerId];
|
var game = ActiveGames[gamblerId];
|
||||||
game.LastInteracted = DateTimeOffset.UtcNow;
|
game.LastInteracted = DateTimeOffset.UtcNow;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using KfChatDotNetBot.Commands.Kasino;
|
||||||
using KfChatDotNetBot.Extensions;
|
using KfChatDotNetBot.Extensions;
|
||||||
using KfChatDotNetBot.Models.DbModels;
|
using KfChatDotNetBot.Models.DbModels;
|
||||||
using KfChatDotNetBot.Settings;
|
using KfChatDotNetBot.Settings;
|
||||||
@@ -119,6 +120,16 @@ public class KasinoRain : IDisposable
|
|||||||
participantNames.Add(gambler.User.FormatUsername());
|
participantNames.Add(gambler.User.FormatUsername());
|
||||||
await Money.ModifyBalanceAsync(gambler.Id, payout, TransactionSourceEventType.Rain,
|
await Money.ModifyBalanceAsync(gambler.Id, payout, TransactionSourceEventType.Rain,
|
||||||
"Payout from rain event", creator.Id, _ct);
|
"Payout from rain event", creator.Id, _ct);
|
||||||
|
//KasinoShop stuff -------------------------------------------------------------------------
|
||||||
|
if (_kfChatBot.BotServices.KasinoShop != null)
|
||||||
|
{
|
||||||
|
await GlobalShopFunctions.CheckProfile(_kfChatBot, gambler.User, gambler);
|
||||||
|
await using var db = new ApplicationDbContext();
|
||||||
|
var creatorGambler = await db.Gamblers.FirstOrDefaultAsync(x => x.Id == creator.Id, _ct);
|
||||||
|
await _kfChatBot.BotServices.KasinoShop.ProcessJuicerOrRainTracking(creatorGambler!, gambler,
|
||||||
|
payout);
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
await Money.ModifyBalanceAsync(creator.Id, -rain.RainAmount + failedPayoutAmount, TransactionSourceEventType.Rain,
|
await Money.ModifyBalanceAsync(creator.Id, -rain.RainAmount + failedPayoutAmount, TransactionSourceEventType.Rain,
|
||||||
|
|||||||
2120
KfChatDotNetBot/Services/KasinoShop.cs
Normal file
2120
KfChatDotNetBot/Services/KasinoShop.cs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user