mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
plinko fix frfr this time (#30)
* Update cleanup delay settings for PlinkoCommand, use plinko delay instead of limbo Update cleanup delay settings for PlinkoCommand, use plinko delay instead of limbo * wait for chat message id update wait for chat message id update * update plinko to fix shit update plinko to fix shit * add underline to final blackjack message add underline to final blackjack message to make it easier to read which game is which when many games are happening at once * plinko fix frfr this time plinko fix frfr this time * settings fix as requested settings fix as requested
This commit is contained in:
@@ -26,12 +26,13 @@ public class PlinkoCommand : ICommand
|
|||||||
|
|
||||||
public RateLimitOptionsModel? RateLimitOptions => null;
|
public RateLimitOptionsModel? RateLimitOptions => null;
|
||||||
|
|
||||||
private string NULLSPACE = "⚫";
|
private readonly string NULLSPACE = "⚫";
|
||||||
private string EMPTYSPACE = "⚪";
|
private readonly string EMPTYSPACE = "⚪";
|
||||||
private string BALL = "🟠";
|
private readonly string BALL = "🟠";
|
||||||
private int DIFFICULTY = 7;//maybe plan to allow user to change difficulty of plinko in future updates, would need to change the payout logic though
|
private readonly int DIFFICULTY = 7;//maybe plan to allow user to change difficulty of plinko in future updates, would need to change the payout logic though
|
||||||
|
private static readonly double VACUUM = 0.02;
|
||||||
private readonly Dictionary<int, decimal> PlinkoPayoutBoard = new()
|
|
||||||
|
private static readonly Dictionary<int, decimal> PlinkoPayoutBoard = new()
|
||||||
{
|
{
|
||||||
{0, 25},
|
{0, 25},
|
||||||
{1, 2_5},
|
{1, 2_5},
|
||||||
@@ -52,6 +53,7 @@ public class PlinkoCommand : ICommand
|
|||||||
var settings = await SettingsProvider.GetMultipleValuesAsync([
|
var settings = await SettingsProvider.GetMultipleValuesAsync([
|
||||||
BuiltIn.Keys.KasinoPlinkoCleanupDelay, BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor,
|
BuiltIn.Keys.KasinoPlinkoCleanupDelay, BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor,
|
||||||
BuiltIn.Keys.KasinoPlinkoEnabled, BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay
|
BuiltIn.Keys.KasinoPlinkoEnabled, BuiltIn.Keys.KasinoGameDisabledMessageCleanupDelay
|
||||||
|
BuiltIn.Keys.KasinoPlinkoCleanupDelay, BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!settings[BuiltIn.Keys.KasinoPlinkoEnabled].ToBoolean())
|
if (!settings[BuiltIn.Keys.KasinoPlinkoEnabled].ToBoolean())
|
||||||
@@ -125,6 +127,7 @@ public class PlinkoCommand : ICommand
|
|||||||
if (ballsInPlay[0].POSITION.row == DIFFICULTY - 1) //once your ball has reached the bottom calculate the payout
|
if (ballsInPlay[0].POSITION.row == DIFFICULTY - 1) //once your ball has reached the bottom calculate the payout
|
||||||
{
|
{
|
||||||
currentPayout = wager * PlinkoPayoutBoard[ballsInPlay[0].POSITION.col];
|
currentPayout = wager * PlinkoPayoutBoard[ballsInPlay[0].POSITION.col];
|
||||||
|
payout += currentPayout;
|
||||||
ballsInPlay.RemoveAt(0);
|
ballsInPlay.RemoveAt(0);
|
||||||
if (currentPayout > wager)
|
if (currentPayout > wager)
|
||||||
{
|
{
|
||||||
@@ -142,9 +145,9 @@ public class PlinkoCommand : ICommand
|
|||||||
ball.Iterate();
|
ball.Iterate();
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(100);
|
await Task.Delay(250);
|
||||||
await botInstance.KfClient.EditMessageAsync(plinkoMessageID.ChatMessageId!.Value,PlinkoBoardDisplay(ballsInPlay));
|
await botInstance.KfClient.EditMessageAsync(plinkoMessageID.ChatMessageId!.Value,PlinkoBoardDisplay(ballsInPlay));
|
||||||
await Task.Delay(100);
|
await Task.Delay(250);
|
||||||
|
|
||||||
}
|
}
|
||||||
var newBalance = await Money.NewWagerAsync(gambler.Id, wager*numberOfBalls, payout, WagerGame.Plinko, ct: ctx);
|
var newBalance = await Money.NewWagerAsync(gambler.Id, wager*numberOfBalls, payout, WagerGame.Plinko, ct: ctx);
|
||||||
@@ -208,19 +211,26 @@ public class PlinkoCommand : ICommand
|
|||||||
|
|
||||||
public PlinkoBall()
|
public PlinkoBall()
|
||||||
{
|
{
|
||||||
POSITION = (0, 0);
|
POSITION = (0, 3);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Iterate()
|
public void Iterate()
|
||||||
{
|
{
|
||||||
int rng = RAND.Next(2);
|
double rng = RAND.NextDouble();
|
||||||
bool evenrow = POSITION.row % 2 == 0;
|
bool evenrow = POSITION.row % 2 == 0;
|
||||||
|
if (POSITION.col < 2)
|
||||||
|
{
|
||||||
|
rng -= VACUUM;
|
||||||
|
}
|
||||||
|
else if (POSITION.col > 4)
|
||||||
|
{
|
||||||
|
rng += VACUUM;
|
||||||
|
}
|
||||||
switch (rng)
|
switch (rng)
|
||||||
{
|
{
|
||||||
case 0:
|
case >= 0.5:
|
||||||
if (!evenrow && Math.Abs(POSITION.col) > POSITION.row / 2) POSITION.col--;
|
if (!evenrow && Math.Abs(POSITION.col) > POSITION.row / 2) POSITION.col--;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case < 0.5:
|
||||||
if (!evenrow && POSITION.col > POSITION.row / 2) POSITION.col++;
|
if (!evenrow && POSITION.col > POSITION.row / 2) POSITION.col++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user