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); }
public BetResultData StartBetting(SingleBetData bet) { int betNr = 0; var rezult = new BetResultData(); while (true) { PlaceBetResponse rezBet = DiceWebAPI.PlaceBet(bet.Session, bet.PayIn, bet.GessLow, bet.GessHigh, bet.ClientSeed, bet.Currency); if (rezBet.Success) { betNr++; if (rezBet.PayOut > 0) { rezult.Profit += rezBet.PayOut - bet.PayIn; rezult.BetCount = betNr; rezult.Percent = bet.GessHigh; rezult.Balance = bet.Session[bet.Currency].Balance; rezult.Session = bet.Session; break; } else { rezult.Profit -= bet.PayIn; CalcPercent(betNr, bet); bet.ClientSeed = new Random().Next(); if (betNr % bet.Repit == 0 && betNr != 0) { bet.PayIn = bet.PayIn * 2; } } } else { if (rezBet.InsufficientFunds) { OnFinishMoney?.Invoke(this, bet); } else { Thread.Sleep(30000); } } } return(rezult); }
private void _singleBetting_OnFinishMoney(object sender, SingleBetData e) { OnFinishMoney?.Invoke(this, e.Session.Username); }