void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            _initialDateTime = DateTime.Now;
            _manuallyStopped = false;
            var timelapse = new Stopwatch();

            
            while (!_manuallyStopped)
            {
                if ((sender as BackgroundWorker).CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }
                Dispatcher.BeginInvoke(new dWriteConsole(WriteConsole), System.Windows.Threading.DispatcherPriority.DataBind, string.Format("Betting {0} at {1} {2}", _currentAmount, _chance, _bet?"over":"under"));
                _roll = _CurrentSite.Roll(_currentAmount, _chance, _bet);

                if (_roll.status)
                {
                    _balance = _roll.balance;
                    parseScript(_roll);
                    _contador++;
                }
                (sender as BackgroundWorker).ReportProgress(_contador);
            }
            
        }
Exemple #2
0
        private void RollWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            _CurrentProfit = 0;
            _AuxProfit = 0;
            _CurrentBet = _NumStartingBet;
            _CurrentChance = _NumStartingChange;
            _CurrentMultiplier = _NumMultiplierLoss;
            _manuallyStopped = false;
            _WinStreak = 0;
            _LossStreak = 0;
            var counter = 0;
            _initialDateTime = DateTime.Now;
            var timelapse = new Stopwatch();
            while (!_manuallyStopped)
            {
                if ((sender as BackgroundWorker).CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }
                if (DelayEnabled) timelapse.Start();
                _roll = RequestBet();
                if (_roll.status)
                {
                    _CloudTotalBets++;
                    _Wagered += _roll.data.amount;
                    _CloudProfit += _roll.data.profit;

                    _TotalProfit += _roll.data.profit;
                    _CurrentProfit += _roll.data.profit;
                    _AuxProfit += _roll.data.profit;
                    if (_DoOneRoll)
                    {
                        _manuallyStopped = true;
                    }
                    counter++;
                    _balance = _roll.balance;
                    if (_roll.data != null && _roll.data.status.Equals("WIN"))
                    {
                        if (_StopOnWon)
                        {
                            _manuallyStopped = true;
                        }
                        _WonsCounter++;
                        _WinStreak++;
                        _LossStreak = 0;
                        if (_WinStreak > _MaxWinStreak)
                        {
                            _MaxWinStreak = _WinStreak;
                        }
                        if (_BiggestBet < _roll.data.amount)
                        {
                            _BiggestBet = _roll.data.amount;
                        }
                        if (_BiggestWon < _roll.data.payout)
                        {
                            _BiggestWon = _roll.data.payout;
                        }
                        if (_martingale)
                        {
                            Martingale(true);
                        }
                        else if (_fibonacci)
                        {
                            Fibonacci(true);
                        }
                    }
                    else if (_roll.data != null && _roll.data.status.Equals("LOSS"))
                    {
                        _LostCounter++;
                        _LossStreak++;
                        _WinStreak = 0;
                        if (_LossStreak > _MaxLossStreak)
                        {
                            _MaxLossStreak = _LossStreak;
                        }
                        if (_BiggestBet < _roll.data.amount)
                        {
                            _BiggestBet = _roll.data.amount;
                        }
                        if (_BiggestLost < _roll.data.amount)
                        {
                            _BiggestLost = _roll.data.amount;
                        }
                        if (_martingale)
                        {
                            Martingale(false);
                        }
                        else if (_fibonacci)
                        {
                            Fibonacci(false);
                        }
                    }
                    _CloudWinStreak = _WinStreak;
                    _CloudLossStreak = _LossStreak;
                    CheckStopConditions();
                }
                if (timelapse.IsRunning)
                {
                    if (timelapse.ElapsedMilliseconds < (1000 / _delay))
                    {
                        Thread.Sleep((int)(1000 / _delay) - (int)(timelapse.ElapsedMilliseconds));
                    }
                    timelapse.Reset();
                }
                (sender as BackgroundWorker).ReportProgress(counter);
            }
        }
        private void parseScript(GenericRoll bet)
        {

            try
            {
                
                bool Win = bet.data.status.Equals("WIN");
                SetLuaVars();
                Lua["win"] = Win;
                Lua["currentprofit"] = bet.data.profit;
                Lua["lastBet"] = bet;
                LuaRuntime.SetLua(Lua);
                LuaRuntime.Run("dobet()");
                GetLuaVars();
            }
            catch
            {

            }

        }
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            _initialDateTime = DateTime.Now;
            _manuallyStopped = false;
            var timelapse = new Stopwatch();

            #region Infinite bets
            if (_cantidad == 0)
            {
                while (!_manuallyStopped)
                {
                    if ((sender as BackgroundWorker).CancellationPending)
                    {
                        e.Cancel = true;
                        break;
                    }
                    if (DelayEnabled) timelapse.Start();
                    _roll = _CurrentSite.Roll(_currentAmount, _chance, _bet.Equals("over"));

                    if (_roll.status)
                    {
                        _balance = _roll.balance;
                        _contador++;
                        if (_roll.data.status.Equals("WIN"))
                        {
                            _winAmounts++;
                            if (_stopWin)
                            {
                                if (_winAmounts >= _maximumWin)
                                {
                                    _manuallyStopped = true;
                                }
                            }
                            if (_stopIfEarned &&
                                Math.Round((_roll.balance * 100000000) - (_initialBalance * 100000000)) >=
                                _amountEarnedToQuit)
                            {
                                _manuallyStopped = true;
                            }
                            if (_returnWin)
                            {
                                _currentAmount = _baseAmount;
                            }
                            else if (_incDecWin)
                            {
                                _currentAmount += (_currentAmount * ((double)_amountIncWin / 100));
                                _currentAmount = Math.Round(_currentAmount, 8, MidpointRounding.AwayFromZero);
                                if (_currentAmount < 0.00000000)
                                {
                                    _currentAmount = 0.00000001;
                                }
                            }
                            if (_switchBetting)
                            {
                                _bet = _bet.Equals("over") ? "under" : "over";
                            }
                            if (_isRandom)
                            {
                                RandomizeBet();
                            }
                        }
                        else if (_roll.data.status.Equals("LOSS"))
                        {
                            _loseAmounts++;
                            if (_stopLose)
                            {
                                if (_loseAmounts >= _maximumLose)
                                {
                                    _manuallyStopped = true;
                                }
                            }
                            if (_returnLose)
                            {
                                _currentAmount = _baseAmount;
                            }
                            else if (_incDecLose)
                            {
                                _currentAmount += (_currentAmount * ((double)_amountIncLose / 100));
                                _currentAmount = Math.Round(_currentAmount, 8, MidpointRounding.AwayFromZero);
                                if (_currentAmount < 0.00000000)
                                {
                                    _currentAmount = 0.00000001;
                                }

                            }
                            if (_switchBettingLost)
                            {
                                _bet = _bet.Equals("over") ? "under" : "over";
                            }
                            if (_isRandom)
                            {
                                RandomizeBet();
                            }
                        }
                        if (_returnBaseIfAmount)
                        {
                            if ((_currentAmount * 100000000) > _amountMaximumBeforeReturn)
                            {
                                _currentAmount = _baseAmount;
                            }
                        }
                    }
                    if (timelapse.IsRunning)
                    {
                        if (timelapse.ElapsedMilliseconds < (1000/_delay))
                        {
                            Thread.Sleep((int) (1000/_delay) - (int) (timelapse.ElapsedMilliseconds));
                        }
                        timelapse.Reset();
                    }

                    (sender as BackgroundWorker).ReportProgress(_contador);
                }
            }
            #endregion
            else
            #region Limited bets
            {
                for (var i = 1; i <= _cantidad; i++)
                {
                    if ((sender as BackgroundWorker).CancellationPending)
                    {
                        e.Cancel = true;
                        break;
                    }
                    if (DelayEnabled) timelapse.Start();
                    _roll = _CurrentSite.Roll(_currentAmount, _chance, _bet.Equals("over"));
                    if (_roll.status)
                    {
                        _balance = _roll.balance;
                        if (_roll.data.status.Equals("WIN"))
                        {
                            _winAmounts++;
                            if (_stopWin && _winAmounts >= _maximumWin)
                            {
                                i = _cantidad + 1;
                                _manuallyStopped = true;
                            }
                            if (_stopIfEarned && Math.Round((_roll.balance * 100000000) - (_initialBalance * 100000000)) >= _amountEarnedToQuit)
                            {
                                i = _cantidad + 1;
                                _manuallyStopped = true;
                            }
                            if (_returnWin)
                            {
                                _currentAmount = _baseAmount;
                            }
                            else if (_incDecWin)
                            {
                                _currentAmount += (_currentAmount * ((double)_amountIncWin / 100));
                                _currentAmount = Math.Round(_currentAmount, 8, MidpointRounding.AwayFromZero);
                                if (_currentAmount < 0.00000000)
                                {
                                    _currentAmount = 0.00000001;
                                }
                            }
                            if (_switchBetting)
                            {
                                _bet = _bet.Equals("over") ? "under" : "over";
                            }
                            if (_isRandom)
                            {
                                RandomizeBet();
                            }
                        }
                        else if (_roll.data.status.Equals("LOSS"))
                        {
                            _loseAmounts++;
                            if (_stopLose)
                            {
                                if (_loseAmounts >= _maximumLose)
                                {
                                    i = _cantidad + 1;
                                    _manuallyStopped = true;
                                }
                            }
                            if (_returnLose)
                            {
                                _currentAmount = _baseAmount;
                            }
                            else if (_incDecLose)
                            {
                                _currentAmount += (_currentAmount * ((double)_amountIncLose / 100));
                                _currentAmount = Math.Round(_currentAmount, 8, MidpointRounding.AwayFromZero);
                                if (_currentAmount < 0.00000000)
                                {
                                    _currentAmount = 0.00000001;
                                }
                            }
                            if (_switchBettingLost)
                            {
                                _bet = _bet.Equals("over") ? "under" : "over";
                            }
                            if (_isRandom)
                            {
                                RandomizeBet();
                            }
                        }
                        if (_returnBaseIfAmount)
                        {
                            if ((_currentAmount * 100000000) > _amountMaximumBeforeReturn)
                            {
                                _manuallyStopped = true;
                            }
                        }
                    }
                    else
                    {
                        i -= 1;
                    }
                    if (timelapse.IsRunning)
                    {
                        if (timelapse.ElapsedMilliseconds < (1000/_delay))
                        {
                            Thread.Sleep((int) (1000/_delay) - (int) (timelapse.ElapsedMilliseconds));
                        }
                        timelapse.Reset();
                    }

                    (sender as BackgroundWorker).ReportProgress(i);
                }
            }
            #endregion

        }