Merging changes from #66

Closes PR #66
This commit is contained in:
barelyprofessional
2026-02-07 11:33:09 -06:00
parent 8246b75868
commit eccbe44acd
7 changed files with 20 additions and 36 deletions

View File

@@ -14,13 +14,11 @@ namespace KfChatDotNetBot.Commands.Kasino;
public class KenoCommand : ICommand public class KenoCommand : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
new Regex(@"^keno (?<difficulty>classic|low|medium|high) (?<amount>\d+) (?<numbers>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^keno (?<difficulty>classic|low|medium|high) (?<amount>\d+(?:\.\d+)?) (?<numbers>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^keno (?<difficulty>classic|low|medium|high) (?<amount>\d+\.\d+) (?<numbers>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^keno (?<difficulty>classic|low|medium|high) (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^keno (?<amount>\d+) (?<numbers>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^keno (?<amount>\d+(?:\.\d+)?) (?<numbers>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^keno (?<amount>\d+\.\d+) (?<numbers>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^keno (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^keno (?<amount>\d+)$", RegexOptions.IgnoreCase), new Regex("^keno")
new Regex(@"^keno (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex("^keno$")
]; ];
public string? HelpText => "!keno [bet amount] [numbers to pick(optional, default 10)]"; public string? HelpText => "!keno [bet amount] [numbers to pick(optional, default 10)]";
public UserRight RequiredRight => UserRight.Loser; public UserRight RequiredRight => UserRight.Loser;

View File

@@ -15,12 +15,8 @@ namespace KfChatDotNetBot.Commands.Kasino;
public class LimboCommand : ICommand public class LimboCommand : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
new Regex(@"^limbo (?<amount>\d+) (?<number>\d+\.\d+)$", RegexOptions.IgnoreCase), new Regex(@"^limbo (?<amount>\d+(?:\.\d+)?) (?<number>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^limbo (?<amount>\d+\.\d+) (?<number>\d+\.\d+)$", RegexOptions.IgnoreCase), new Regex(@"^limbo (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^limbo (?<amount>\d+\.\d+) (?<number>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^limbo (?<amount>\d+) (?<number>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^limbo (?<amount>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^limbo (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex("^limbo") new Regex("^limbo")
]; ];
public string? HelpText => "!limbo <bet amount> <optional number, default 2>"; public string? HelpText => "!limbo <bet amount> <optional number, default 2>";

View File

@@ -13,10 +13,8 @@ public class MinesCommand : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
//attempting to start a game below here //attempting to start a game below here
new Regex(@"^mines (?<bet>\d+\.\d+) (?<size>\d+) (?<mines>\d+) (?<picks>\d+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase), new Regex(@"^mines (?<bet>\d+(?:\.\d+)?) (?<size>\d+) (?<mines>\d+) (?<picks>\d+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase),
new Regex(@"^mines (?<bet>\d+) (?<size>\d+) (?<mines>\d+) (?<picks>\d+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase), new Regex(@"^mines (?<bet>\d+(?:\.\d+)?) (?<size>\d+) (?<mines>\d+) (?<betString>.+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase),
new Regex(@"^mines (?<bet>\d+\.\d+) (?<size>\d+) (?<mines>\d+) (?<betString>.+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase),
new Regex(@"^mines (?<bet>\d+) (?<size>\d+) (?<mines>\d+) (?<betString>.+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase),
//attempting to continue a game below here //attempting to continue a game below here
new Regex(@"^mines (?<picks>\d+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase), new Regex(@"^mines (?<picks>\d+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase),
new Regex(@"^mines (?<betString>.+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase), new Regex(@"^mines (?<betString>.+)(?<cashout> cashout|)$", RegexOptions.IgnoreCase),

View File

@@ -16,8 +16,7 @@ namespace KfChatDotNetBot.Commands.Kasino;
public class Planes : ICommand public class Planes : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
new Regex(@"^planes (?<amount>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^planes (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^planes (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex("^planes$") new Regex("^planes$")
]; ];
public string? HelpText => "!planes <bet amount>"; public string? HelpText => "!planes <bet amount>";

View File

@@ -14,10 +14,8 @@ namespace KfChatDotNetBot.Commands.Kasino;
public class PlinkoCommand : ICommand public class PlinkoCommand : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
new Regex(@"^plinko (?<amount>\d+\.\d+) (?<number>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^plinko (?<amount>\d+(?:\.\d+)?) (?<number>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^plinko (?<amount>\d+) (?<number>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^plinko (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^plinko (?<amount>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^plinko (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex("^plinko") new Regex("^plinko")
]; ];
public string? HelpText => "!plinko <bet amount> <optional number of balls 1 - 10, default 1 if nothing entered>"; public string? HelpText => "!plinko <bet amount> <optional number of balls 1 - 10, default 1 if nothing entered>";

View File

@@ -11,8 +11,7 @@ namespace KfChatDotNetBot.Commands.Kasino;
public class RainCommand : ICommand public class RainCommand : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
new Regex(@"^rain (?<amount>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^rain (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^rain (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^rain", RegexOptions.IgnoreCase) new Regex(@"^rain", RegexOptions.IgnoreCase)
]; ];

View File

@@ -23,15 +23,11 @@ namespace KfChatDotNetBot.Commands.Kasino;
public class SlotsCommand : ICommand public class SlotsCommand : ICommand
{ {
public List<Regex> Patterns => [ public List<Regex> Patterns => [
new Regex(@"^slots (?<amount>\d+) (?<spins>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^slots (?<amount>\d+(?:\.\d+)?) (?<spins>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^slots (?<amount>\d+\.\d+) (?<spins>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^slots (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^slots (?<amount>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^slots (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex("^slots$", RegexOptions.IgnoreCase), new Regex("^slots$", RegexOptions.IgnoreCase),
new Regex(@"^sluts (?<amount>\d+) (?<spins>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^sluts (?<amount>\d+(?:\.\d+)?) (?<spins>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^sluts (?<amount>\d+\.\d+) (?<spins>\d+)$", RegexOptions.IgnoreCase), new Regex(@"^sluts (?<amount>\d+(?:\.\d+)?)$", RegexOptions.IgnoreCase),
new Regex(@"^sluts (?<amount>\d+)$", RegexOptions.IgnoreCase),
new Regex(@"^sluts (?<amount>\d+\.\d+)$", RegexOptions.IgnoreCase),
new Regex("^sluts", RegexOptions.IgnoreCase) new Regex("^sluts", RegexOptions.IgnoreCase)
]; ];
@@ -59,7 +55,7 @@ public class SlotsCommand : ICommand
{ {
var gameDisabledCleanupDelay= TimeSpan.FromMilliseconds(settings[BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay].ToType<int>()); var gameDisabledCleanupDelay= TimeSpan.FromMilliseconds(settings[BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay].ToType<int>());
await botInstance.SendChatMessageAsync( await botInstance.SendChatMessageAsync(
$"{user.FormatUsername()}, planes is currently disabled.", $"{user.FormatUsername()}, slots is currently disabled.",
true, autoDeleteAfter: gameDisabledCleanupDelay); true, autoDeleteAfter: gameDisabledCleanupDelay);
return; return;
} }
@@ -100,7 +96,7 @@ public class SlotsCommand : ICommand
} }
char rigged = '0'; char rigged = '0';
int rigCheck = Money.GetRandomNumber(gambler, 0, 1, 1); decimal rigCheck = (decimal)Money.GetRandomDouble(gambler);
if (HOUSE_EDGE > 1) if (HOUSE_EDGE > 1)
{ {
if (HOUSE_EDGE - rigCheck > 1) rigged = 'W'; if (HOUSE_EDGE - rigCheck > 1) rigged = 'W';
@@ -659,7 +655,7 @@ public class SlotsCommand : ICommand
{ {
//check both diagonals above for 1 space, and one space behind //check both diagonals above for 1 space, and one space behind
while (_preboard[row - 1, col - 1] == _preboard[row, col] || while (_preboard[row - 1, col - 1] == _preboard[row, col] ||
_preboard[row + 1, col + 1] == _preboard[row, col] || _preboard[row - 1, col + 1] == _preboard[row, col] ||
_preboard[row, col - 1] == _preboard[row, col]) _preboard[row, col - 1] == _preboard[row, col])
{ {
r = _rand.NextDouble() * 97.01; r = _rand.NextDouble() * 97.01;