public async Task WagerDiceRollRangeAsync(OldAccount a, int wager, int size, int midpoint, bool dir = false) { Dice d = new Dice(size); int min = dir ? 1 : 2; int max = dir ? (size - 1) : size; // exception catchers. if (!midpoint.IsInRange(min, max)) { EmbedBuilder e = new EmbedBuilder(); e.WithColor(EmbedData.GetColor("error")); if (!a.Config.Overflow) { await ReplyAsync(embed : EmbedData.Throw(Context, "Midpoint out of range.", $"The midpoint must be inside the range of {min} to {max}.", false)); return; } midpoint = midpoint.InRange(min, max); } CasinoResult outcome = CasinoService.BetRangedRoll(a, d, wager, midpoint, dir); await ReplyAsync(embed : outcome.Generate()); }
// bet on a dice roll with n amount of sides // choose the sides that you think it will land on. public async Task WagerDiceRollAsync(OldAccount a, int wager, int size, params int[] clear) { EmbedBuilder e = new EmbedBuilder(); e.WithColor(EmbedData.GetColor("error")); Dice d = new Dice(size); string err = ""; if (clear.Length == 0) { err = "You need to at least place one landing point."; await ReplyAsync(embed : EmbedData.Throw(Context, "Empty landing points.", err, false)); return; } if (clear.Length > (d.Sides - 1)) { err = $"You can only place up to {d.Sides - 1} landing points."; await ReplyAsync(embed : EmbedData.Throw(Context, "Max landing points hit.", err, false)); return; } List <int> called = new List <int>(); foreach (int safe in clear) { if (safe > d.Sides) { err = $"You can't place a landing point higher than {d.Sides}."; await ReplyAsync(embed : EmbedData.Throw(Context, "Landing point out of range.", err, false)); return; } if (safe.EqualsAny(called)) { err = "You cannot place a landing point on a side twice."; await ReplyAsync(embed : EmbedData.Throw(Context, "Duplicate landing point.", err, false)); return; } else { called.Add(safe); } } CasinoResult outcome = CasinoService.BetSelectiveRoll(a, d, wager, clear); await ReplyAsync(embed : outcome.Generate()); }
public async Task DoubleOrNothingAsync(OldAccount a, ulong wager, int times) { if (times <= 0) { string err = "You need to set the tick counter for the machine to land on."; await ReplyAsync(embed : EmbedData.Throw(Context, "Invalid tick counter.", err, false)); return; } CasinoResult outcome = CasinoService.DoubleOrNothing(a, wager, times); await ReplyAsync(embed : outcome.Generate()); }
public async Task WagerCoinFlipAsync(OldAccount a, ulong wager, bool face = false) { CasinoResult outcome = CasinoService.BetCoinFlip(a, wager); await ReplyAsync(embed : outcome.Generate()); }