public override PlaceDiceBet RunReset() { decimal Amount = 0; LabList = BetList.ToArray().ToList <decimal>(); if (LabList.Count == 1) { Amount = LabList[0]; } else if (LabList.Count > 1) { Amount = LabList[0] + LabList[LabList.Count - 1]; } High = starthigh; return(new PlaceDiceBet(Amount, High, (decimal)Chance)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BetList res = null; isCatch = !string.IsNullOrEmpty(Request.Params["catchCode"]); if (!isCatch) { palCatch.Visible = false; res = this.GetBetting(); } else { string catchCode = Request.Params["catchCode"]; CatchCode = catchCode; string issueCode = Request.Params["issueCode"]; res = GetCatch(catchCode, issueCode); res.PalyRadioCode = res.RadioCode; palCatch.Visible = true; } var bet = Request.Params["betcode"]; if (res == null && !string.IsNullOrEmpty(bet) && bet.StartsWith("i")) { palCatch.Visible = true; // ISysCatchNumIssueService catNumIssue = IoC.Resolve <ISysCatchNumIssueService>(); var item = catNumIssue.Where(x => x.CatchNumIssueCode == bet).FirstOrDefault(); if (null != item) { CatchCode = item.CatchNumCode; isCatch = true; res = GetCatch(item.CatchNumCode, item.IssueCode); res.PalyRadioCode = res.RadioCode; } } this.palCatch.HRef = "/Lottery/CatchDetail.aspx?catchCode=" + CatchCode; BindData(res); } }
/// <summary> /// 计算中奖金额,stepAmt * 10 * item.BackNum *10得意思是:除以0.1相当于*10 /// </summary> /// <param name="item">投注详情</param> /// <param name="baseAmt">基础奖金</param> /// <param name="stepAmt">每增加0.1的返点 增加多少奖金</param> /// <param name="count">中多少注</param> /// <returns></returns> protected decimal TotalWinMoney(BetList item, int count, PlayTypeRadio fs, SysUser user, bool isAppendMiu = true) { decimal[] models = { 1M, 0.1M, 0.01M, 0.001M }; //计算 decimal stepAmt = 0; decimal baseAmt = 0; //返点/舍弃返点 if (user.PlayType == 0)//1800 { baseAmt = fs.MaxBonus - Convert.ToDecimal(user.Rebate) * 10 * fs.StepAmt; if (item.PrizeType == 1) { baseAmt = fs.BonusBasic; } } else { baseAmt = fs.MaxBonus17 - Convert.ToDecimal(user.Rebate) * 10 * fs.StepAmt1700; if (item.PrizeType == 1) { baseAmt = fs.BonusBasic17; } } decimal total = 0; if (isAppendMiu) { total = count * (baseAmt - stepAmt) * models[item.Model] * item.Multiple; } else { total = (baseAmt - stepAmt) * models[item.Model]; } return(Math.Round(total, 4)); }
private void BindData(BetList item) { if (item.Stauts == 3) { exitTd.Visible = true; } if (!isCatch) { LotteryCode = IoC.Resolve <ILotteryTypeService>().Where(c => c.LotteryCode == item.LotteryCode).FirstOrDefault().Id.ToString(); } else { ISysCatchNumIssueService issueServices = IoC.Resolve <ISysCatchNumIssueService>(); var xd = issueServices.GetLotteryId(item.BetCode); if (xd != null) { LotteryCode = xd.Value.ToString(); } } this.lbCode.Text = item.Code; this.lbGame.Text = item.LotteryName; this.lbbettCode.Text = item.BetCode; string st = "本人撤单"; if (item.Stauts == 1) { st = "已中奖"; } else if (item.Stauts == 2) { st = "未中奖"; } else if (item.Stauts == 3) { st = "未开奖"; } else if (item.Stauts == 5) { st = "系统撤单"; } string modelStr = "元"; switch (item.Model) { case 1: modelStr = "角"; break; case 2: modelStr = "分"; break; case 3: modelStr = "厘"; break; } this.lbState.Text = st; this.lbModel.Text = item.Multiple + "倍 - " + modelStr + ""; this.lbbetTime.Text = item.OccDate.ToString("yyyy-MM-dd HH:mm:ss"); this.lbIssue.Text = item.IssueCode; this.lbOpenTime.Text = item.OpenResult; /***/ lbPlayType.Text = item.PlayTypeName + "" + item.PlayTypeRadioName;//玩法 this.lbMonerty.Text = item.WinMoney.ToString(); this.lbSumMonery.Text = item.TotalAmt.ToString(); this.hidPostionName.Value = item.PostionName; this.lbSubscription.Text = item.Subscription.ToString(); // //可能中的奖金 var fs = PlayTypeRadioServiceCatch.GetAll().Where(p => p.RadioCode == item.PalyRadioCode).FirstOrDefault(); if (null == fs) { return; } txtContent.Text = item.BetContent; //"zhouke" var betUser = IoC.Resolve <ISysUserService>().Get(item.Code); if (null == betUser) { return; } List <WinsEntity> winSource = new List <WinsEntity>(); if (!fs.HasMoreBonus)//普通奖金 { //返点/舍弃返点 string backText = string.Empty; double dm = 0; if (betUser.PlayType == 0)//1800 { dm = Math.Round((fs.MaxRebate - betUser.Rebate), 1); backText = item.PrizeType == 1 ? " - " + dm + " % " : " - 0%"; } else { dm = Math.Round((fs.MaxRebate1700 - betUser.Rebate), 1); backText = item.PrizeType == 1 ? " - " + dm + " % " : " - 0%"; } if (dm <= 0) { dongtaiMonery.Visible = false; } lbBackNum.Text = TotalWinMoney(item, 1, fs, betUser, false).ToString(); lbBackNumlst.Text = backText; //如果为lhc,则隐藏返点 if (item.LotteryCode == "hk6") { dongtaiMonery.Visible = false; } winSource.Add(new WinsEntity() { itemContent = txtContent.Text, meWinMoney = item.LotteryCode == "hk6" ? (item.TotalAmt * (decimal)Ytg.ServerWeb.BootStrapper.SiteHelper.GetLiuHeMiult()).ToString() : TotalWinMoney(item, 1, fs, betUser).ToString(), Multiple = item.Multiple, PlayTypeRadioName = string.IsNullOrEmpty(item.PostionName) ? item.PlayTypeRadioName : item.PostionName, DetCount = item.BetCount }); } else {//拥有更多中奖方式的 List <string> ct = new List <string>(); if (item.BetContent.IndexOf("-") >= 0) { var cts = item.BetContent.Split('-'); foreach (var c in cts) { if (string.IsNullOrEmpty(c)) { continue; } ct.Add(SpecialConvert.ConvertTo(Convert.ToInt32("-" + c))); } } var wins = PlayTypeRadiosBonusServiceCatch.GetAll().Where(c => c.RadioCode == fs.RadioCode).ToList(); //是否为特殊玩法 for (var i = 0; i < wins.Count; i++) { var itemw = wins[i]; if (ct.Count > 0 && !ct.Contains(itemw.BonusTitle)) { continue; } decimal[] models = { 1M, 0.1M, 0.01M, 0.001M }; winSource.Add(new WinsEntity() { itemContent = txtContent.Text, meWinMoney = (Ytg.Comm.Global.DecimalConvert(betUser.PlayType == 0 ? itemw.BonusBasic : itemw.BonusBasic17) * models[item.Model] * item.Multiple).ToString(), Multiple = item.Multiple, PlayTypeRadioName = HanZi[i] + "等奖_" + itemw.BonusTitle, DetCount = item.BetCount //投注注数 }); } dongtaiMonery.Visible = false; } this.rptWins.DataSource = winSource; this.rptWins.DataBind(); }
/* * private void ParseMatch(ChromiumWebBrowser browser) * { * if (!browser.IsBrowserInitialized || browser.IsLoading) * return; * * var task = browser.GetSourceAsync(); * task.Wait(2000); * if (!task.IsCompleted) return; * string html = task.Result; * * HtmlDocument doc = new HtmlDocument(); * doc.LoadHtml(html); * * ParseMatchPageHtml(doc, browser.Address); * }*/ public override void ParseMatchPageHtml(HtmlDocument doc, string url) { MatchName matchName = GetFullMatchName(doc); if (matchName == null) { return; } Sport sport = GetSport(doc); if (sport == Sport.NotSupported) { return; } string BetUrl = url; Bet result = null; HtmlNodeCollection maindocument = doc.DocumentNode.SelectNodes("//li[@class='groupedListItem']"); if (maindocument == null) { return; } foreach (var node in maindocument) { result = null; try { string all_main = node.InnerHtml; HtmlDocument document = new HtmlDocument(); document.LoadHtml(all_main); string Way = document.DocumentNode.SelectNodes("//table[@class]").First().Attributes["class"].Value; string maintype = document.DocumentNode.SelectNodes("//h3").First().InnerText; HtmlNodeCollection betsNodes = document.DocumentNode.SelectNodes("//a[@id]"); Team team = GetTeam(maintype); Time time = GetTime(maintype);// зробити час foreach (var node2 in betsNodes) { string value = node2.InnerHtml; if (!value.Contains("class=\"oddHolder\"")) { continue; } HtmlDocument document2 = new HtmlDocument(); document2.LoadHtml(value); HtmlNodeCollection test = document2.DocumentNode.SelectNodes("//div"); HtmlAttribute idAttribude = node.Attributes["id"]; if (idAttribude == null) { continue; } JavaSelectCode = "(function() { var element = document.evaluate( '" + node2.XPath + "' ,document, null, XPathResult.ANY_TYPE, null ).singleNodeValue; element.click(); })();"; string type = test.First().InnerText; string coeff = test.Last().InnerText; double Probability = Convert.ToDouble(coeff.Replace(".", ",")); if (maintype.Contains("1X2")) { if (Way == "list cell2") { if (type == "1") { result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (type == "2") { result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if (Way == "list cell3") { if (type == "1") { result = new ResultBet(ResultBetType.First, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (type == "x" || type == "X") { result = new ResultBet(ResultBetType.Draw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (type == "2") { result = new ResultBet(ResultBetType.Second, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } } if (maintype.Contains("Double Chance") || maintype.Contains("Double chance"))// за весь час чи нормальний час брати? Inc All OT { if (type == "1x" || type == "1X") { result = new ResultBet(ResultBetType.FirstOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (type == "12") { result = new ResultBet(ResultBetType.FirstOrSecond, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (type == "x2" || type == "X2") { result = new ResultBet(ResultBetType.SecondOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } // importantly!!!! // You have to see it. if ((maintype.Contains("Total") || maintype.Contains("total")) && (!maintype.Contains("aggregated") && !maintype.Contains("Totals"))) { if (sport == Sport.Basketball && (!maintype.Contains("including overtime") && !maintype.Contains("Including overtime") && !maintype.Contains("including Overtime"))) { continue; } // перевірити правильність написання including overtime(регістр) if (type.Contains("Under")) { try { double param = Convert.ToDouble(type.Split(new string[] { "Under (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); result = new TotalBet(TotalBetType.Under, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } catch { } } if (type.Contains("Over")) { double param = Convert.ToDouble(type.Split(new string[] { "Over (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); result = new TotalBet(TotalBetType.Over, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if ((maintype.Contains("Handicap") || maintype.Contains("handicap")) && maintype.Contains("Asian")) { if (sport == Sport.Basketball && (!maintype.Contains("inc. ОТ") && !maintype.Contains("Inc. OT") && !maintype.Contains("INC. OT") && !maintype.Contains("including overtime"))) { continue; } // перевірити правильність написання including overtime(регістр) string first_or_second_team = type.Split(new string[] { " (" }, StringSplitOptions.RemoveEmptyEntries)[0]; if (first_or_second_team == "1") { double param = Convert.ToDouble(type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ",")); result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (first_or_second_team == "2") { double param = Convert.ToDouble(type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ",")); result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } else if (maintype.Contains("Handicap") && !maintype.Contains("Asian")) { // коли буде матч переглянути як тут пишуть INC.OT. string first_or_second_team = type.Split(new string[] { " (" }, StringSplitOptions.RemoveEmptyEntries)[0]; if (first_or_second_team == "1") { string initial_score = type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1]; int first_number = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0]); int second_number = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1]); double param = 0; if (first_number != 0) { param = first_number - 0.5; } if (second_number != 0) { param = (-1) * (second_number) - 0.5; } result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else if (first_or_second_team == "2") { string initial_score = type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1]; int first_number = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0]); int second_number = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1]); double param = 0; if (first_number != 0) { param = (-1) * first_number - 0.5; } if (second_number != 0) { param = second_number - 0.5; } result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } else if (maintype.Contains("Draw No Bet")) { if (sport == Sport.Basketball && (!maintype.Contains("inc. ОТ") && !maintype.Contains("Inc. OT") && !maintype.Contains("INC. OT") && !maintype.Contains("including overtime"))) { continue; } double param = 0; if (type.Contains("1")) { result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else if (type.Contains("2")) { result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if (result != null) { int index = BetList.IndexOf(result); if (index != -1) { BetList[index].ChangeOdds(result.Odds); } else { BetList.Add(result); } } } } catch (Exception e) { Console.Write(e.Message); } } System.Threading.Thread.Sleep(50); }
public override void ParseMatchPageHtml(HtmlDocument doc, string url) { Sport sport = GetSport(doc); if (sport == Sport.NotSupported) { return; } MatchName matchName = GetFullMatchName(doc); // повне ім'я (only for tennis cuz all event names were writed like (Coppejans K.) ) if (matchName == null) { return; } string BetUrl = url; HtmlNodeCollection betsNodes = doc.DocumentNode.SelectNodes("//td"); Bet result = null; if (betsNodes == null) { return; } foreach (var node in betsNodes) { result = null; //if (node.Attributes["data-market-type"] != null) continue; HtmlAttribute attribute = node.Attributes["data-sel"]; if (attribute == null) { continue; } string value = attribute.Value.Replace("\"", string.Empty).Replace(""", string.Empty); JavaSelectCode = "(function() { var element = document.evaluate( '" + node.XPath + "' ,document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue; element.click(); })();"; string coeff = value.Split(new string[] { ",epr:", ",prices:{" }, StringSplitOptions.RemoveEmptyEntries)[1]; double Probability = Convert.ToDouble(coeff.Replace(".", ",")); string type = value.Split(new string[] { "sn:", ",mn:" }, StringSplitOptions.RemoveEmptyEntries)[1]; string TotalorHand = value.Split(new string[] { "mn:", ",ewc:" }, StringSplitOptions.RemoveEmptyEntries)[1]; if (TotalorHand.Contains(" + ")) { continue; } if (TotalorHand.ToLower().Contains("min.")) { continue; } Team team = GetTeam(TotalorHand, matchName); Time time = GetTime(TotalorHand); #region main bets if (TotalorHand.Contains("Match Result") || TotalorHand == "Result" || TotalorHand.Contains("Match Winner Including All OT") || (TotalorHand.Contains("Result") && TotalorHand.Contains("Set")) || TotalorHand.Contains("Normal Time Result") || TotalorHand.Contains("To Win Match") && !TotalorHand.Contains("Handicap")) { if (TotalorHand.Contains("Match Winner Including All OT")) { if (type == matchName.FirstTeam) { if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY") { result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } else if (type == matchName.SecondTeam) { if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY") { result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } } if (TotalorHand.Contains("To Win Match")) { if (type == matchName.FirstTeam) { if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY") { result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } else if (type == matchName.SecondTeam) { if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY") { result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } } if (type == matchName.FirstTeam + " To Win") { if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY") { result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else { result = new ResultBet(ResultBetType.First, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } else if (type == "Draw") { result = new ResultBet(ResultBetType.Draw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else if (type == matchName.SecondTeam + " To Win") { if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY") { result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else { result = new ResultBet(ResultBetType.Second, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } else if (type == matchName.FirstTeam + " To Win or Draw") { result = new ResultBet(ResultBetType.FirstOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else if (type == matchName.FirstTeam + " To Win or " + matchName.SecondTeam + " To Win") { result = new ResultBet(ResultBetType.FirstOrSecond, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } else if (type == matchName.SecondTeam + " To Win or Draw") { result = new ResultBet(ResultBetType.SecondOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } #endregion else #region Totals for All Team // Totals if (TotalorHand.Contains("Total") && !TotalorHand.Contains("Sets") && !TotalorHand.Contains("Innings")) { if (type.Contains("Under")) { if (TotalorHand.Contains("Asian")) { try { double first_param = Convert.ToDouble(type.Split(new string[] { "Under ", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); double second_param = Convert.ToDouble(type.Split(new string[] { "Under ", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ",")); double param = (first_param + second_param) / 2; result = new TotalBet(TotalBetType.Under, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } catch { } } else { try { double param = Convert.ToDouble(type.Split(new string[] { "Under ", "\0" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); result = new TotalBet(TotalBetType.Under, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } catch { } } } if (type.Contains("Over")) { if (TotalorHand.Contains("Asian")) { try { double first_param = Convert.ToDouble(type.Split(new string[] { "Over ", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); double second_param = Convert.ToDouble(type.Split(new string[] { "Over ", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ",")); double param = (first_param + second_param) / 2; result = new TotalBet(TotalBetType.Over, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } catch { } } else { try { double param = Convert.ToDouble(type.Split(new string[] { "Over ", "\0" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); result = new TotalBet(TotalBetType.Over, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } catch { } } } } #endregion else #region All Handicaps if (TotalorHand.Contains("Handicap") || TotalorHand.Contains("Draw No Bet")) // переробити. draw no bet = 0 все інше нормально. з ханд робити { if (type.Contains(matchName.FirstTeam)) { double param = 0; string test; if (TotalorHand.Contains("Draw No Bet")) { param = 0; } else { if (TotalorHand.Contains("Asian")) { try { double first_param = Convert.ToDouble(type.Split(new string[] { matchName.FirstTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); double second_param = Convert.ToDouble(type.Split(new string[] { matchName.FirstTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ",")); param = (first_param + second_param) / 2; } catch { } } else { try { test = type.Split(new string[] { matchName.FirstTeam + " (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","); param = Convert.ToDouble(test); } catch { continue; } } } result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (type.Contains(matchName.SecondTeam)) { double param = 0; string test; if (TotalorHand.Contains("Draw No Bet")) { param = 0; } else { if (TotalorHand.Contains("Asian")) { try { double first_param = Convert.ToDouble(type.Split(new string[] { matchName.SecondTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",")); double second_param = Convert.ToDouble(type.Split(new string[] { matchName.SecondTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ",")); param = (first_param + second_param) / 2; } catch { } } else { try { test = type.Split(new string[] { matchName.SecondTeam + " (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","); param = Convert.ToDouble(test); } catch { continue; } } } result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker); } } #endregion if (result != null) { int index = BetList.IndexOf(result); if (index != -1) { BetList[index].ChangeOdds(result.Odds); } else { BetList.Add(result); } } } System.Threading.Thread.Sleep(50); }
public PlaceDiceBet CalculateNextDiceBet(DiceBet PreviousBet, bool Win) { decimal Lastbet = PreviousBet.TotalAmount; if (Win) { if (chkReverseLab) { if (LabList.Count == 1) { LabList.Add(LabList[0]); } else { LabList.Add(LabList[0] + LabList[LabList.Count - 1]); } } else if (LabList.Count > 1) { LabList.RemoveAt(0); LabList.RemoveAt(LabList.Count - 1); if (LabList.Count == 0) { if (rdbLabStop) { CallStop("End of labouchere list reached"); } else { RunReset(); } } } else { if (rdbLabStop) { CallStop("End of labouchere list reached"); } else { LabList = BetList.ToArray().ToList <decimal>(); if (LabList.Count == 1) { Lastbet = LabList[0]; } else if (LabList.Count > 1) { Lastbet = LabList[0] + LabList[LabList.Count - 1]; } } } } else { //do laboucghere logic if (!chkReverseLab) { if (LabList.Count == 1) { LabList.Add(LabList[0]); } else { LabList.Add(LabList[0] + LabList[LabList.Count - 1]); } } else { if (LabList.Count > 1) { LabList.RemoveAt(0); LabList.RemoveAt(LabList.Count - 1); if (LabList.Count == 0) { CallStop("Stopping: End of labouchere list reached."); } } else { if (rdbLabStop) { CallStop("Stopping: End of labouchere list reached."); } else { LabList = BetList.ToArray().ToList <decimal>(); if (LabList.Count == 1) { Lastbet = LabList[0]; } else if (LabList.Count > 1) { Lastbet = LabList[0] + LabList[LabList.Count - 1]; } } } } //end labouchere logic } if (LabList.Count == 1) { Lastbet = LabList[0]; } else if (LabList.Count > 1) { Lastbet = LabList[0] + LabList[LabList.Count - 1]; } else { if (rdbLabStop) { CallStop("Stopping: End of labouchere list reached."); } else { LabList = BetList.ToArray().ToList <decimal>(); if (LabList.Count == 1) { Lastbet = LabList[0]; } else if (LabList.Count > 1) { Lastbet = LabList[0] + LabList[LabList.Count - 1]; } } } return(new PlaceDiceBet(Lastbet, High, PreviousBet.Chance)); }
public override void ParseMatchPageHtml(HtmlDocument doc, string url) { MatchName matchName = GetMatchName(doc); if (matchName == null) { return; } Sport sport = GetSport(doc); if (sport == Sport.NotSupported) { return; } string BetUrl = url; Bet result = null; HtmlNodeCollection maindocument = doc.DocumentNode.SelectNodes("//span[@class='bet_sel koefs']"); if (maindocument == null) { return; } foreach (var node in maindocument) { result = null; try { string[] betParams = node.Attributes["data-select"].Value.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries); HtmlNodeCollection coeffNodes = node.SelectNodes(".//b"); if (coeffNodes == null) { continue; } string coeff = coeffNodes.First().InnerText; double odds = Convert.ToDouble(coeff.Replace(".", ",")); Time time = GetTime(betParams); if (time == null) { continue; } JavaSelectCode = "(function() { var elements = Array.from(document.getElementsByClassName('bet_sel koefs')); elements.forEach(function(item, i, arr) {" + "if(item.getAttribute('data-select') == '" + node.Attributes["data-select"].Value + "') item.click(); }); })();"; if (betParams[1] == "1") // 1, X, 2, 1X, 12, x2 { if (betParams[2] == "1" || betParams[2] == "10" || betParams[2] == "13" || betParams[2] == "16") // 1, X, 2 { if (betParams[4] == "1") { result = new ResultBet(ResultBetType.First, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[4] == "2") { result = new ResultBet(ResultBetType.Draw, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[4] == "3") { result = new ResultBet(ResultBetType.Second, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if (betParams[2] == "2" || betParams[2] == "9" || betParams[2] == "22") // 1, 2 all game { if (betParams[4] == "1") { result = new ResultBet(ResultBetType.P1, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[4] == "2") { result = new ResultBet(ResultBetType.P2, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if (betParams[2] == "3") // 1x, 12, x2 all game { if (betParams[4] == "1") { result = new ResultBet(ResultBetType.FirstOrDraw, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[4] == "2") { result = new ResultBet(ResultBetType.FirstOrSecond, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[4] == "3") { result = new ResultBet(ResultBetType.SecondOrDraw, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } } } if (betParams[1] == "2") // handicap, under { double param = Convert.ToDouble(betParams[3].Replace(".", ",")); if (betParams[2] == "4" || betParams[2] == "168" || betParams[2] == "11" || betParams[2] == "14" || betParams[2] == "17") // f1/f2 { HandicapBetType type = betParams[4] == "1" ? HandicapBetType.F1 : HandicapBetType.F2; result = new HandicapBet(type, param, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[2] == "5" || betParams[2] == "12" || betParams[2] == "15" || betParams[2] == "18") // under { result = new TotalBet(TotalBetType.Under, param, time, Team.All, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[2] == "7") //first team { result = new TotalBet(TotalBetType.Under, param, time, Team.First, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[2] == "8") //second team { result = new TotalBet(TotalBetType.Under, param, time, Team.Second, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if (betParams[1] == "3") // over { double param = Convert.ToDouble(betParams[3].Replace(".", ",")); if (betParams[2] == "5" || betParams[2] == "12" || betParams[2] == "15" || betParams[2] == "18") // over { result = new TotalBet(TotalBetType.Over, param, time, Team.All, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[2] == "7") //first team { result = new TotalBet(TotalBetType.Over, param, time, Team.First, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } if (betParams[2] == "8") //second team { result = new TotalBet(TotalBetType.Over, param, time, Team.Second, odds, matchName, BetUrl, JavaSelectCode, sport, Maker); } } if (result != null) { int index = BetList.IndexOf(result); if (index != -1) { BetList[index].ChangeOdds(result.Odds); } else { BetList.Add(result); } } } catch (Exception e) { Console.Write(e.Message); } } System.Threading.Thread.Sleep(50); }