Example #1
0
        private void Betting()
        {
            SingleBetData data = new SingleBetData
            {
                Session    = session,
                PayIn      = -0.000000001m,
                Currency   = Currencies.Doge,
                ClientSeed = new Random().Next(),
                Repit      = 2,
                Drawdoun   = 33,
                GessLow    = 0,
                GessHigh   = 249749,
                PercentMax = 249749,
                PercentMin = 249000
                             //Repit = 9,
                             //Drawdoun = 150,
                             //GessLow = 0,
                             //GessHigh = 54900,
                             //PercentMax = 54900,
                             //PercentMin = 53900
            };

            data.PayIn = data.SetBaseBet();
            singleCycle.StartBet(data);
        }
        protected override void MyWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            SingleBetData bet = (SingleBetData)e.Argument;

            if (bet == null)
            {
                return;
            }

            int myBetCount = 0;

            while (bet.MaxBet > myBetCount)
            {
                var rezult = _singleBetting.StartBetting(bet);
                ProcessResult(rezult, bet);

                OnSendResult?.Invoke(this, rezult);

                if (myWorker.CancellationPending)
                {
                    e.Cancel = true;

                    return;
                }
                myBetCount++;
            }
            e.Result = bet;
        }
 public BackSingleController(IBetting <SingleBetData> singleBetting, PlayerSettingsModel settings) : base()
 {
     _singleBetting = singleBetting;
     _singleBetting.OnFinishMoney += _singleBetting_OnFinishMoney;
     _settings = settings;
     _betData  = new SingleBetData();
     _betData.SetData(_settings);
 }
        public BetResultData StartBetting(MultipleBetData data)
        {
            if (data == null)
            {
                return(null);
            }

            PlaceAutomatedBetsResponse rezBet = DiceWebAPI.PlaceAutomatedBets(data.Session, data.AutoSettings);
            var rezult = new BetResultData {
                Session = data.Session
            };

            if (rezBet.Success)
            {
                if (rezBet.TotalPayOut == 0) //запуск одиночных ставок
                {
                    decimal baseBet;
                    if (rezBet.BetCount > 1)
                    {
                        baseBet = rezBet.PayIns[rezBet.BetCount - 1] <= rezBet.PayIns[rezBet.BetCount - 2] ?
                                  2 * rezBet.PayIns[rezBet.BetCount - 1] : 2 * rezBet.PayIns[rezBet.BetCount - 2];
                    }
                    else
                    {
                        baseBet = 2 * rezBet.PayIns[rezBet.BetCount - 1];
                    }
                    //сформировать исходные данные для одиночных ставок
                    SingleBetData singlData = data.GetSingleData();
                    singlData.PayIn = baseBet;
                    BetResultData singleResult = singleBetting.StartBetting(singlData);

                    rezult.BetCount = rezBet.BetCount + singleResult.BetCount;
                    rezult.Percent  = singleResult.Percent;
                    rezult.Profit   = rezBet.TotalPayOut + singleResult.Profit;
                    rezult.Balance  = data.Session[data.Currency].Balance;
                }
                else //получен профит
                {
                    rezult.BetCount = rezBet.BetCount;
                    rezult.Percent  = 0;
                    rezult.Profit   = rezBet.TotalPayOut + rezBet.TotalPayIn;
                    rezult.Balance  = data.Session[data.Currency].Balance;
                }
            }
            else
            {
                if (rezBet.InsufficientFunds)
                {
                    OnFinishMoney?.Invoke(this, data);
                }
                else
                {
                    Thread.Sleep(30000);
                }
            }

            return(rezult);
        }
Example #5
0
        public async void StartBet(MultiBetData bet)
        {
            PlaceAutomatedBetsResponse result = await DiceWebAPI.PlaceAutomatedBetsAsync(bet.Session, bet.MultiBetSettings);

            if (result.Success)
            {
                betResult.BetCount++;
                if (result.TotalPayOut == 0)
                {
                    decimal baseBet;
                    if (result.BetCount > 1)
                    {
                        baseBet = result.PayIns[result.BetCount - 1] <= result.PayIns[result.BetCount - 2] ?
                                  2 * result.PayIns[result.BetCount - 1] : 2 * result.PayIns[result.BetCount - 2];
                    }
                    else
                    {
                        baseBet = 2 * result.PayIns[result.BetCount - 1];
                    }

                    SingleBetCycle singlBet = new SingleBetCycle();
                    SingleBetData  sBet     = bet.GetSingleData(baseBet);
                    singlBet.OnNoMoney += SinglBet_OnNoMoney;
                    BetResult singlResult = null;
                    singlBet.StartBet(sBet);
                    betResult.BetCount = result.BetCount + singlResult.BetCount;
                    betResult.Profit   = result.TotalPayOut + result.TotalPayIn + singlResult.Profit;
                }
                else
                {
                    betResult.BetCount = result.BetCount;
                    betResult.Profit   = result.TotalPayOut + result.TotalPayIn;
                    OnBetCompleted?.Invoke(betResult);
                }
            }
            else
            {
                if (result.InsufficientFunds)
                {
                    OnNoMoney?.Invoke(bet.Session.AccountId, bet.Currency);
                    Thread.Sleep(20000);
                }
            }
        }
Example #6
0
        private void CalcPercent(int betNr, SingleBetData bet)
        {
            int  col         = (bet.Drawdoun / 2) / 3;
            long percentPart = (bet.PercentMax - bet.PercentMin) / 3;

            if (betNr <= col)
            {
                bet.GessHigh = new Random().Next((int)bet.PercentMin, (int)(bet.PercentMin + percentPart));
            }
            else if (betNr > col && betNr <= 2 * col)
            {
                bet.GessHigh = betNr % 2 > 0 ? new Random().Next((int)bet.PercentMax - 100, (int)bet.PercentMax) :
                               new Random().Next((int)bet.PercentMin, (int)(bet.PercentMin + percentPart * 2));
            }
            else if (betNr > 2 * col)
            {
                bet.GessHigh = betNr % 2 > 0 ? new Random().Next((int)bet.PercentMax - 100, (int)bet.PercentMax) :
                               new Random().Next((int)(bet.PercentMin + percentPart * 2), (int)bet.PercentMax);
            }
            bet.ClientSeed = new Random().Next();
        }
        private void ProcessResult(BetResultData data, SingleBetData bet)
        {
            if (data.Balance > bet.ProfitEdge)
            {
                decimal minProfitToWitdraw = 0;
                switch (bet.Currency)
                {
                case Currencies.BTC:
                {
                    minProfitToWitdraw = Math.Max(data.Balance - bet.ProfitEdge, 0.0005m);
                }
                break;

                case Currencies.Doge:
                {
                    minProfitToWitdraw = Math.Max(data.Balance - bet.ProfitEdge, 2m);
                }
                break;

                case Currencies.LTC:
                {
                    minProfitToWitdraw = Math.Max(data.Balance - bet.ProfitEdge, 0.002m);
                }
                break;

                case Currencies.ETH:
                {
                    minProfitToWitdraw = Math.Max(data.Balance - bet.ProfitEdge, 0.002m);
                }
                break;
                }

                DiceWebAPI.Withdraw(bet.Session, minProfitToWitdraw, bet.AccountToSendProfit, bet.Currency);
            }
            _settings.UserBalance += data.Profit;
            bet.PayIn              = bet.SetBaseBet(_settings);
        }
Example #8
0
        public async void StartBet(SingleBetData bet)
        {
            var betResult = new BetResult();

            while (true)
            {
                var result = await DiceWebAPI.PlaceBetAsync(bet.Session, bet.PayIn, bet.GessLow, bet.GessHigh, bet.ClientSeed, bet.Currency);

                if (result.Success)
                {
                    betResult.BetCount++;
                    if (result.PayOut > 0)
                    {
                        betResult.Profit += result.PayOut - bet.PayIn;
                        OnBetCompleted?.Invoke(betResult);
                        break;
                    }
                    else
                    {
                        betResult.Profit -= bet.PayIn;
                        if (betResult.BetCount % bet.Repit == 0 && betResult.BetCount != 0)
                        {
                            bet.PayIn = bet.PayIn * 2;
                        }
                        CalcPercent(betResult.BetCount, bet);
                    }
                }
                else
                {
                    if (result.InsufficientFunds)
                    {
                        OnNoMoney?.Invoke(bet.Session.AccountId, bet.Currency);
                        Thread.Sleep(20000);
                    }
                }
            }
        }
 private void _singleBetting_OnFinishMoney(object sender, SingleBetData e)
 {
     OnFinishMoney?.Invoke(this, e.Session.Username);
 }
 private void SingleBetting_OnFinishMoney(object sender, SingleBetData e)
 {
 }