Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        // 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());
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            // Lcg
            var casinoService = new CasinoService();
            var results       = new List <PlayResult>();
            var account       = casinoService.CreateAccount(AccountId).Result;

            for (var i = 0; i < 3; i++)
            {
                var playResult = casinoService.Play(AccountId, 17).Result;
                results.Add(playResult);
            }

            var lcgParams = LcgDecryptor.AttackMultiplier(
                results[2].RealNumber,
                results[1].RealNumber,
                results[0].RealNumber,
                new LcgParams());

            var result           = LcgEncryptor.Next(results[2].RealNumber, lcgParams);
            var successfulResult = casinoService.Play(AccountId, result).Result;

            Console.WriteLine(successfulResult.Message);
        }
Ejemplo n.º 5
0
        public async Task WagerCoinFlipAsync(OldAccount a, ulong wager, bool face = false)
        {
            CasinoResult outcome = CasinoService.BetCoinFlip(a, wager);

            await ReplyAsync(embed : outcome.Generate());
        }
Ejemplo n.º 6
0
 public CasinoModule(CasinoService casinoService, Settings.Deserialized.Settings settings)
 {
     _casinoService = casinoService;
     _settings      = settings;
 }
Ejemplo n.º 7
0
 public CasinoModule(CasinoService casinoService)
 {
     _casinoService = casinoService;
 }