void placebetthread(object bet) { try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; string clientseed = r.Next(0, int.MaxValue).ToString(); string jsoncontent = json.JsonSerializer <NDPlaceBet>(new NDPlaceBet() { amount = amount.ToString("0.00000000"), perc = chance.ToString("0.0000"), pos = High ? "hi" : "lo", times = 1, cseed = clientseed }); StringContent Content = new StringContent(jsoncontent, Encoding.UTF8, "application/json"); string Response = Client.PostAsync("api/bet", Content).Result.Content.ReadAsStringAsync().Result; NDGetBet BetResult = json.JsonDeserialize <NDGetBet>(Response); Bet tmp = new Bet { Amount = BetResult.amount, date = DateTime.Now, Chance = chance, clientseed = clientseed , serverhash = lastHash, Guid = tmp5.Guid, high = High, Id = BetResult.n.ToString(), nonce = BetResult.index, Roll = BetResult.n / 10000m, serverseed = BetResult.sseed, }; sqlite_helper.InsertSeed(tmp.serverhash, tmp.serverseed); lastHash = BetResult.sshash; bets++; bool win = (tmp.Roll > 99.99m - tmp.Chance && High) || (tmp.Roll < tmp.Chance && !High); balance = BetResult.balance; wagered += amount; profit += BetResult.amount; if (win) { wins++; } else { losses++; } FinishedBet(tmp); } catch (Exception Ex) { Parent.DumpLog(Ex.ToString(), -1); } }
void Placebetthread(object Obj) { try { PlaceBetObj tmpObj = Obj as PlaceBetObj; byte[] bytes = new byte[4]; R.GetBytes(bytes); string seed = ((long)BitConverter.ToUInt32(bytes, 0)).ToString(); List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("wager", (tmpObj.Amount).ToString("0.00000000"))); pairs.Add(new KeyValuePair <string, string>("region", tmpObj.High ? ">" : "<")); pairs.Add(new KeyValuePair <string, string>("target", (tmpObj.High ? maxRoll - tmpObj.Chance : tmpObj.Chance).ToString("0.00"))); pairs.Add(new KeyValuePair <string, string>("odds", tmpObj.Chance.ToString("0.00"))); pairs.Add(new KeyValuePair <string, string>("clientSeed", seed)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("bet", Content).Result.Content.ReadAsStringAsync().Result; CoinProBet tmpbet = json.JsonDeserialize <CoinProBet>(sEmitResponse); if (tmpbet.error != null) { Parent.updateStatus(tmpbet.error); return; } Bet tmp = new Bet { Guid = tmpObj.Guid, Amount = (decimal)tmpObj.Amount, date = DateTime.Now, Id = tmpbet.bet_id.ToString(), Profit = (decimal)tmpbet.profit / 100000000m, Roll = (decimal)tmpbet.outcome, high = tmpObj.High, Chance = (decimal)tmpObj.Chance, nonce = (int)(tmpbet.outcome * 100), serverhash = lasthash, serverseed = tmpbet.secret.ToString(), clientseed = seed }; lasthash = tmpbet.next_hash; bets++; bool Win = (((bool)tmp.high ? (decimal)tmp.Roll > (decimal)maxRoll - (decimal)(tmp.Chance) : (decimal)tmp.Roll < (decimal)(tmp.Chance))); if (Win) { wins++; } else { losses++; } wagered += tmpObj.Amount; profit += tmp.Profit; balance = tmpbet.balance / 100000000m; FinishedBet(tmp); } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); Parent.updateStatus("An unknown error has occured while placing a bet."); } }
void PlaceBetThread(object BetObj) { PlaceBetObj bet = BetObj as PlaceBetObj; this.Guid = bet.Guid; string cont = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{{\"appId\":{0},\"chance\":{1:0.0000},\"betAmount\":{2:0.00000000},\"target\":{3},\"currency\":{4}}}", 0, chance, amount, High ? 0 : 1, Curs[Currency]); var content = new StringContent(cont, Encoding.UTF8, "application/json"); HttpResponseMessage response = Client.PostAsync("https://api.betking.io/api/dice/bet", content).Result; }
void PlaceBetThreead(object bet) { if (Mode == 3 && TLEhash == null) { string TLE = Client.GetAsync("tle").Result.Content.ReadAsStringAsync().Result; var tleobj = json.JsonDeserialize <DDTLE>(TLE); TLEhash = tleobj.data.FirstOrDefault()?.hash; } PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; StringContent Content = new StringContent(string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{{\"amount\":\"{0:0.00000000}\",\"symbol\":\"{1}\",\"chance\":{2:0.00},\"isHigh\":{3},\"faucet\":{4},\"tleHash\":\"{5}\"}}", amount, Currency, chance, High ? "true" : "false", this.Mode == 2?"true":"false", Mode == 3? TLEhash:null), Encoding.UTF8, "application/json"); try { string sEmitResponse = Client.PostAsync("play" + "?api_key=" + accesstoken + "&api_version=" + apiversion, Content).Result.Content.ReadAsStringAsync().Result; QuackBet newbet = json.JsonDeserialize <QuackBet>(sEmitResponse); if (newbet.error != null) { Parent.updateStatus(newbet.error); return; } Bet tmp = new Bet { //Id=newbet.ha Amount = decimal.Parse(newbet.bet.betAmount, System.Globalization.NumberFormatInfo.InvariantInfo), Chance = newbet.bet.chance, clientseed = currentseed.clientSeed, Currency = Currency, date = DateTime.Now, high = High, nonce = currentseed.nonce++, Profit = decimal.Parse(newbet.bet.profit, System.Globalization.NumberFormatInfo.InvariantInfo), Roll = newbet.bet.number / 100, serverhash = currentseed.serverSeedHash, Id = newbet.bet.hash, Guid = tmp5.Guid }; lastupdate = DateTime.Now; profit = decimal.Parse(newbet.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo); wagered = decimal.Parse(newbet.user.volume, System.Globalization.NumberFormatInfo.InvariantInfo); balance = decimal.Parse(newbet.user.balance, System.Globalization.NumberFormatInfo.InvariantInfo); wins = newbet.user.wins; bets = newbet.user.bets; losses = bets - wins; FinishedBet(tmp); } catch (Exception e) { Parent.updateStatus("There was an error placing your bet."); Parent.DumpLog(e.ToString(), -1); } }
void PlaceBetThread(object high) { try { PlaceBetObj tmp9 = high as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chacne = tmp9.Chance; decimal prize = amount * ((100.0m - edge) / chance); List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("public_key", pub)); pairs.Add(new KeyValuePair <string, string>("private_key", priv)); pairs.Add(new KeyValuePair <string, string>("input_bet", amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("input_prize", prize.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("input_roll_type", (High ? "over" : "under"))); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("bet", Content).Result.Content.ReadAsStringAsync().Result; monerobase tmp = json.JsonDeserialize <monerobase>(sEmitResponse); if (tmp.bet_data.error == null) { Bet tmp2 = new Bet(); tmp2.Guid = tmp9.Guid; tmp2.Amount = decimal.Parse(tmp.bet_data.size, System.Globalization.NumberFormatInfo.InvariantInfo); tmp2.date = DateTime.Now; tmp2.Id = tmp.bet_data.bet_id.ToString(); tmp2.Profit = (tmp.bet_data.win) ? decimal.Parse(tmp.bet_data.profit, System.Globalization.NumberFormatInfo.InvariantInfo) : -tmp2.Amount; tmp2.Roll = decimal.Parse(tmp.bet_data.roll_result, System.Globalization.NumberFormatInfo.InvariantInfo); tmp2.high = tmp.bet_data.roll_type == "over"; tmp2.Chance = decimal.Parse(tmp.bet_data.win_chance, System.Globalization.NumberFormatInfo.InvariantInfo); tmp2.nonce = (long)tmp.bet_data.nonce; tmp2.serverhash = tmp.bet_data.hash; tmp2.clientseed = tmp.bet_data.seed_user; bets++; wagered += (decimal)tmp2.Amount; balance = tmp.bet_data.balance; profit += (decimal)tmp2.Profit; if (tmp.bet_data.win) { wins++; } else { losses++; } FinishedBet(tmp2); } else { Parent.updateStatus(tmp.bet_data.error); } } catch { } }
void PlaceBetThread(object BetObj) { PlaceBetObj obj = BetObj as PlaceBetObj; bool High = obj.High; decimal chance = obj.Chance; decimal amount = obj.Amount; decimal tmpchance = High ? maxRoll - chance : chance; string t = CreateRandomString(); this.Requests.Add(t, 0); string s = string.Format("[2,\"0.{0}\",\"bet\",{{\"betAmount\":{1:0.00000000},\"betCondition\":\"{2}\",\"betTarget\":{3:0.00}}}]", t, amount, High ? "H" : "L", tmpchance); NSSocket.Send(s); }
void PlaceBetThreead(object bet) { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; StringContent Content = new StringContent(string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{{\"amount\":\"{0:0.00000000}\",\"symbol\":\"{1}\",\"chance\":{2:0.00},\"isHigh\":{3}}}", amount, Currency, chance, High ? "true" : "false"), Encoding.UTF8, "application/json"); try { string sEmitResponse = Client.PostAsync("play", Content).Result.Content.ReadAsStringAsync().Result; QuackBet newbet = json.JsonDeserialize <QuackBet>(sEmitResponse); if (newbet.error != null) { Parent.updateStatus(newbet.error); return; } Bet tmp = new Bet { //Id=newbet.ha Amount = decimal.Parse(newbet.bet.betAmount, System.Globalization.NumberFormatInfo.InvariantInfo), Chance = newbet.bet.chance, clientseed = currentseed.clientSeed, Currency = Currency, date = DateTime.Now, high = High, nonce = currentseed.nonce++, Profit = decimal.Parse(newbet.bet.profit, System.Globalization.NumberFormatInfo.InvariantInfo), Roll = newbet.bet.number / 100, serverhash = currentseed.serverSeedHash, Id = newbet.bet.hash }; lastupdate = DateTime.Now; profit = decimal.Parse(newbet.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo); wagered = decimal.Parse(newbet.user.volume, System.Globalization.NumberFormatInfo.InvariantInfo); balance = decimal.Parse(newbet.user.balance, System.Globalization.NumberFormatInfo.InvariantInfo); wins = newbet.user.wins; bets = newbet.user.bets; losses = bets - wins; FinishedBet(tmp); } catch (Exception e) { Parent.updateStatus("There was an error placing your bet."); } }
void PlaceBetThread(object BetObject) { try { PlaceBetObj obj = BetObject as PlaceBetObj; /*List<KeyValuePair<string, string>> pairs = new List<KeyValuePair<string, string>>(); * pairs.Add(new KeyValuePair<string, string>("ctoken", accesstoken)); * pairs.Add(new KeyValuePair<string, string>("betInSatoshis", (obj.Amount*100000000m).ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo))); * pairs.Add(new KeyValuePair<string, string>("id", GameID.ToString())); * pairs.Add(new KeyValuePair<string, string>("serverHash", curHash)); * pairs.Add(new KeyValuePair<string, string>("clientRoll", "200"));//R.Next(0, int.MaxValue).ToString())); * pairs.Add(new KeyValuePair<string, string>("belowRollToWin", ((obj.Chance/100m)*65535).ToString("0"))); * FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); * string sEmitResponse = Client.PostAsync("placebet.php", Content).Result.Content.ReadAsStringAsync().Result; */ string sEmitResponse = Client.GetStringAsync(string.Format( "placebet.php?ctoken={0}&betInSatoshis={1}&" + "id={2}&serverHash={3}&clientRoll={4}&belowRollToWin={5}", accesstoken, (obj.Amount * 100000000m).ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo), GameID, curHash, R.Next(0, int.MaxValue).ToString(), ((obj.Chance / 100m) * 65535).ToString("0"))).Result; SatGame betresult = json.JsonDeserialize <SatGame>(sEmitResponse); if (betresult.status == "success") { Bet tmpRes = new Bet() { Amount = (decimal)betresult.bet.betInSatoshis / 100000000m, date = DateTime.Now, Chance = decimal.Parse(betresult.bet.probability), clientseed = betresult.clientRoll.ToString(), high = false, Id = betresult.bet.betID, nonce = -1, Profit = (decimal)betresult.bet.profitInSatoshis / 100000000m, serverhash = betresult.serverHash, serverseed = betresult.serverRoll + "-" + betresult.serverSalt, Roll = decimal.Parse(betresult.bet.rollInPercent) }; balance = betresult.userBalanceInSatoshis / 100000000.0m; bets++; if (betresult.bet.result == "loss") { losses++; } else { wins++; } wagered += tmpRes.Amount; profit += tmpRes.Profit; curHash = betresult.nextRound.hash; GameID = betresult.nextRound.id; FinishedBet(tmpRes); } else { Parent.updateStatus(betresult.message); } } catch { Parent.updateStatus("An error has occurred. Bot will retry in 30 seconds."); } }
void placebetthread(object bet) { try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; /*if (amount < 10000 && (DateTime.Now - Lastbet).TotalMilliseconds < 500) * { * Thread.Sleep((int)(500.0 - (DateTime.Now - Lastbet).TotalMilliseconds)); * }*/ decimal tmpchance = High ? 99.99m - chance : chance; GraphQLResponse betresult = GQLClient.PostAsync(new GraphQLRequest { Query = "mutation{rollDice(amount:" + amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo) + ", target:" + tmpchance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo) + ",condition:" + (High ? "above" : "below") + ",currency:btc) { id iid nonce currency amount value payout result target condition createdAt seed{serverSeedHash serverSeed clientSeed nonce} user{balances{available{amount currency}} statistic{bets wins losses amount profit currency}}}}" }).Result; RollDice tmp = betresult.GetDataFieldAs <RollDice>("rollDice"); Lastbet = DateTime.Now; try { lastupdate = DateTime.Now; foreach (Statistic x in tmp.user.statistic) { if (x.currency.ToLower() == Currency.ToLower()) { this.bets = (int)x.bets; this.wins = (int)x.wins; this.losses = (int)x.losses; this.profit = (decimal)x.profit; this.wagered = (decimal)x.amount; break; } } foreach (Balance x in tmp.user.balances) { if (x.available.currency.ToLower() == Currency.ToLower()) { balance = (decimal)x.available.amount; break; } } Bet tmpbet = tmp.ToBet(); tmpbet.Guid = tmp5.Guid; FinishedBet(tmpbet); retrycount = 0; } catch { Parent.updateStatus("Some kind of error happened. I don't really know graphql, so your guess as to what went wrong is as good as mine."); } } catch (AggregateException e) { if (retrycount++ < 3) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance, (bet as PlaceBetObj).Guid)); return; } if (e.InnerException.Message.Contains("429") || e.InnerException.Message.Contains("502")) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance, (bet as PlaceBetObj).Guid)); } } catch (Exception e2) { Parent.updateStatus("Error occured while trying to bet, retrying in 30 seconds. Probably."); Parent.DumpLog(e2.ToString(), -1); } }
void PlaceBetThread(object _High) { try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZqwertyuiopasdfghjklzxcvbnm1234567890"; while (clientseed.Length < 16) { clientseed += chars[R.Next(0, chars.Length)]; } string Params = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "m={0}&client_seed={1}&jackpot=0&stake={2}&multiplier={3}&rand={5}&csrf_token={4}", High?"hi":"lo", clientseed, amount, (100m - edge) / chance, csrf, R.Next(0, 9999999) / 10000000); var betresult = Client.GetAsync("https://freebitco.in/cgi-bin/bet.pl?" + Params).Result; if (betresult.IsSuccessStatusCode) { string Result = betresult.Content.ReadAsStringAsync().Result; string[] msgs = Result.Split(':'); if (msgs.Length > 2) { /* * 1. Success code (s1) * 2. Result (w/l) * 3. Rolled number * 4. User balance * 5. Amount won or lost (always positive). If 2. is l, then amount is subtracted from balance else if w it is added. * 6. Redundant (can ignore) * 7. Server seed hash for next roll * 8. Client seed of previous roll * 9. Nonce for next roll * 10. Server seed for previous roll * 11. Server seed hash for previous roll * 12. Client seed again (can ignore) * 13. Previous nonce * 14. Jackpot result (1 if won 0 if not won) * 15. Redundant (can ignore) * 16. Jackpot amount won (0 if lost) * 17. Bonus account balance after bet * 18. Bonus account wager remaining * 19. Max. amount of bonus eligible * 20. Max bet * 21. Account balance before bet * 22. Account balance after bet * 23. Bonus account balance before bet * 24. Bonus account balance after bet */ Bet tmp = new Bet { Guid = tmp9.Guid, Amount = amount, date = DateTime.Now, Chance = chance, clientseed = msgs[7], high = High, Id = bets.ToString(), Profit = msgs[1] == "w"?decimal.Parse(msgs[4]):-decimal.Parse(msgs[4], System.Globalization.NumberFormatInfo.InvariantInfo), nonce = long.Parse(msgs[12], System.Globalization.NumberFormatInfo.InvariantInfo), serverhash = msgs[10], serverseed = msgs[9], Roll = decimal.Parse(msgs[2], System.Globalization.NumberFormatInfo.InvariantInfo) / 100.0m }; balance = decimal.Parse(msgs[3], System.Globalization.NumberFormatInfo.InvariantInfo); if (msgs[1] == "w") { wins++; } else { losses++; } bets++; wagered += amount; profit += tmp.Profit; FinishedBet(tmp); } else if (msgs.Length > 0) { //20 - too low balance if (msgs.Length > 1) { if (msgs[1] == "20") { Parent.updateStatus("Balance too low."); } } else { Parent.updateStatus("Site returned unknown error. Retrying in 30 seconds."); } } else { Parent.updateStatus("Site returned unknown error. Retrying in 30 seconds."); } } } catch (Exception e) { Parent.DumpLog(e.ToString(), 0); Parent.updateStatus("An internal error occured. Retrying in 30 seconds."); } }
void PlaceBetThread(object Obj) { PlaceBetObj tmp = Obj as PlaceBetObj; bool High = tmp.High; decimal amount = tmp.Amount; decimal chance = tmp.Chance; try { Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, (bool)High ? "High" : "Low")); SafeDiceBet tmpBet = new SafeDiceBet { siteId = curen, amount = (long)(amount * (curen != 2 ? 100000000m : 1000000000000m)), payout = (decimal)(((long)((99.5m / chance) * (curen != 2 ? 100000000m : 1000000000000m))) / (curen != 2 ? 100000000.0m : 1000000000000.0m)), isFixedPayout = false, isRollLow = !(bool)High, target = ((bool)High) ? (999999m - ((long)(chance * 10000m))).ToString(System.Globalization.NumberFormatInfo.InvariantInfo) : ((long)(chance * 10000m)).ToString(System.Globalization.NumberFormatInfo.InvariantInfo) }; string post = json.JsonSerializer <SafeDiceBet>(tmpBet); /*HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://safedice.com/api/dicebets"); * if (Prox != null) * betrequest.Proxy = Prox; * betrequest.Method = "POST"; * SafeDiceBet tmpBet = new SafeDiceBet * { * siteId = curen, * amount = (long)(amount * ( Currency!="2"? 100000000: 1000000000000)), * payout = (decimal)(((long)((99.5 / chance) * (curen != 2 ? 100000000 : 1000000000000))) / (curen != 2 ? 100000000.0 : 1000000000000.0)), * isFixedPayout = false, * isRollLow = !(bool)High, * target = ((bool)High) ? (999999 - ((long)(chance * 10000))).ToString() : ((long)(chance * 10000)).ToString() * }; * string post = json.JsonSerializer<SafeDiceBet>(tmpBet); * * betrequest.ContentLength = post.Length; * betrequest.ContentType = " application/json;charset=utf-8"; * betrequest.Headers.Add("authorization", "Bearer " + accesstoken); * betrequest.CookieContainer = new CookieContainer(); * using (var writer = new StreamWriter(betrequest.GetRequestStream())) * { * * writer.Write(post); * writer.Flush(); * writer.Close(); * } * string tmp = betrequest.ToString(); * HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse();*/ string sEmitResponse = ""; //new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); HttpContent cont = new StringContent(post); cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); string Resp = ""; using (var response = Client.PostAsync("dicebets", cont)) { Resp = response.Result.Content.ReadAsStringAsync().Result; if (Resp == "{}") { Parent.updateStatus("Something went wrong! Please check your bet size."); return; } } SafeDiceBetResult tmpResult = json.JsonDeserialize <SafeDiceBetResult>(Resp); Bet bet = new Bet(); bet.Amount = (decimal)tmpResult.amount / (curen != 2 ? 100000000m : 1000000000000m); bet.date = DateTime.Now; bet.Chance = (!tmpResult.isRollLow ? 100m - (decimal)tmpResult.target / 1000000m * 100m : (decimal)tmpResult.target / 1000000m * 100m); bet.high = !tmpResult.isRollLow; bet.clientseed = client; bet.Id = tmpResult.id.ToString(); bet.nonce = nonce++; bet.Profit = tmpResult.profit / (curen != 2 ? 100000000m : 1000000000000m); bet.Roll = (decimal)tmpResult.roll / 10000m; bet.serverhash = serverhash; bet.uid = (int)tmpResult.accountId; balance += (decimal)bet.Profit; ++bets; wagered += (decimal)bet.Amount; bool win = false; if (tmpResult.isRollLow && tmpResult.roll < tmpResult.target) { win = true; } else if (!tmpResult.isRollLow && tmpResult.roll > tmpResult.target) { win = true; } if (win) { ++wins; } else { ++losses; } profit += (decimal)bet.Profit; FinishedBet(bet); retrycount = 0; } catch (WebException e) { if (e.Response != null) { string sEmitResponse = new StreamReader(e.Response.GetResponseStream()).ReadToEnd(); Parent.updateStatus(sEmitResponse); System.Windows.Forms.MessageBox.Show("Error placing bet. Betting stopped"); /*if (e.Message.Contains("401")) * { * System.Windows.Forms.MessageBox.Show("Could not log in. Please ensure the username, passowrd and 2fa code are all correct."); * }*/ } } catch (AggregateException e) { Parent.DumpLog(e.InnerException.Message, 3); Parent.DumpLog(e.InnerException.StackTrace, 4); } catch { if (retrycount++ < 3) { PlaceBetThread(tmp); return; } } }
void placebetthread(object bet) { if (string.IsNullOrWhiteSpace(seed)) { seed = RandomSeed(); } try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; decimal tmpchance = High ?maxRoll - chance + 0.0001m : chance - 0.0001m; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); //string seed = RandomSeed(); pairs.Add(new KeyValuePair <string, string>("bet", (amount).ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("target", tmpchance.ToString("0.0000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("side", High ? "high" : "low")); pairs.Add(new KeyValuePair <string, string>("act", "play_dice")); pairs.Add(new KeyValuePair <string, string>("currency", Currency)); pairs.Add(new KeyValuePair <string, string>("secret", secret)); pairs.Add(new KeyValuePair <string, string>("token", accesstoken)); pairs.Add(new KeyValuePair <string, string>("user_seed", seed)); pairs.Add(new KeyValuePair <string, string>("v", "101")); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("action.php", Content).Result.Content.ReadAsStringAsync().Result; Lastbet = DateTime.Now; try { string x = sEmitResponse.Replace("f-", "f_").Replace("n-", "n_").Replace("ce-", "ce_").Replace("r-", "r_"); bitvestbet tmp = json.JsonDeserialize <bitvestbet>(x); if (tmp.success) { lastupdate = DateTime.Now; Bet resbet = new Bet { Amount = tmp5.Amount, date = DateTime.Now, Chance = tmp5.Chance, high = tmp5.High, clientseed = seed, serverhash = tmp.server_hash, serverseed = tmp.server_seed, Roll = tmp.game_result.roll, Profit = tmp.game_result.win == 0 ? -tmp5.Amount : tmp.game_result.win - tmp5.Amount, nonce = long.Parse(tmp.player_seed.Substring(tmp.player_seed.IndexOf("|") + 1)), Id = tmp.game_id.ToString(), Currency = Currency }; resbet.Guid = tmp5.Guid; bets++; //lasthash = tmp.server_hash; bool Win = (((bool)High ? (decimal)tmp.game_result.roll > (decimal)maxRoll - (decimal)(chance) : (decimal)tmp.game_result.roll < (decimal)(chance))); if (Win) { wins++; } else { losses++; } wagered += amount; profit += resbet.Profit; balance = decimal.Parse( Currency.ToLower() == "bitcoins"? tmp.data.balance: Currency.ToLower() == "ethers"? tmp.data.balance_ether : Currency.ToLower() == "litecoins"?tmp.data.balance_litecoin: Currency.ToLower() == "dogecoins" ? tmp.data.balance_dogecoin : Currency.ToLower() == "bcash" ? tmp.data.balance_bcash : tmp.data.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo); /*tmp.bet.client = tmp.user.client; * tmp.bet.serverhash = tmp.user.server; * lastupdate = DateTime.Now; * balance = tmp.user.balance / 100000000.0m; //i assume * bets = tmp.user.bets; * wins = tmp.user.wins; * losses = tmp.user.losses; * wagered = (decimal)(tmp.user.wagered / 100000000m); * profit = (decimal)(tmp.user.profit / 100000000m); */ FinishedBet(resbet); retrycount = 0; } else { Parent.updateStatus(tmp.msg); if (tmp.msg.ToLower() == "bet rate limit exceeded") { Parent.updateStatus(tmp.msg + ". Retrying in a second;"); Thread.Sleep(1000); placebetthread(bet); return; } } } catch (Exception e) { Parent.updateStatus("An unknown error has occurred"); Parent.DumpLog(e.ToString(), -1); } } catch (AggregateException e) { Parent.DumpLog(e.ToString(), -1); } catch (Exception e2) { Parent.DumpLog(e2.ToString(), -1); } }
void placebetthread(object BetObj) { try { PlaceBetObj tmp9 = BetObj as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; byte[] bytes = new byte[4]; R.GetBytes(bytes); long client = (long)BitConverter.ToUInt32(bytes, 0); List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("accessToken", accesstoken)); pairs.Add(new KeyValuePair <string, string>("wager", amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("chance", chance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("direction", High?"1":"0")); pairs.Add(new KeyValuePair <string, string>("coin", Currency)); pairs.Add(new KeyValuePair <string, string>("clientSeed", client.ToString())); R.GetBytes(bytes); client = (long)BitConverter.ToUInt32(bytes, 0); if (Currency == "btc") { pairs.Add(new KeyValuePair <string, string>("clientSeedNext", client.ToString())); } FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string responseData = ""; using (var response = Client.PostAsync("betDice", Content)) { while (!response.IsCompleted) { Thread.Sleep(100); } try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { if (retrycount++ < 3) { placebetthread(new PlaceBetObj(High, amount, chance)); return; } if (e.InnerException.Message.Contains("ssl")) { placebetthread(new PlaceBetObj(High, amount, chance)); return; } } } bbResult tmp = json.JsonDeserialize <bbResult>(responseData); if (tmp.error != 1) { next = tmp.nextServerSeed; lastupdate = DateTime.Now; balance = tmp.balance; bets++; if (tmp.win == 1) { wins++; } else { losses++; } wagered += (tmp.wager); profit += tmp.profit; Bet tmp2 = tmp.toBet(); tmp2.date = DateTime.Now; tmp2.serverhash = next; next = tmp.nextServerSeed; FinishedBet(tmp2); retrycount = 0; } else { Parent.updateStatus("An error has occured! Betting has stopped for your safety."); } } catch (WebException e) { if (e.Response != null) { string sEmitResponse = new StreamReader(e.Response.GetResponseStream()).ReadToEnd(); Parent.updateStatus(sEmitResponse); } if (e.Message.Contains("429") || e.Message.Contains("502")) { Thread.Sleep(200); placebetthread(new PlaceBetObj(High, amount, chance)); } } catch (Exception e) { } }
void placebetthread(object bet) { try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; /*if (amount < 10000 && (DateTime.Now - Lastbet).TotalMilliseconds < 500) * { * Thread.Sleep((int)(500.0 - (DateTime.Now - Lastbet).TotalMilliseconds)); * }*/ decimal tmpchance = High ? 99.99m - chance : chance; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("amount", (amount * 100000000m).ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("target", tmpchance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("condition", High ? ">" : "<")); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("bet?api_key=" + accesstoken, Content).Result.Content.ReadAsStringAsync().Result; Lastbet = DateTime.Now; try { pdbetresult tmp = json.JsonDeserialize <pdbetresult>(sEmitResponse); tmp.bet.client = tmp.user.client; tmp.bet.serverhash = tmp.user.server; lastupdate = DateTime.Now; balance = tmp.user.balance / 100000000.0m; //i assume bets = tmp.user.bets; wins = tmp.user.wins; losses = tmp.user.losses; wagered = (decimal)(tmp.user.wagered / 100000000m); profit = (decimal)(tmp.user.profit / 100000000m); Bet tmpbet = tmp.bet.toBet(); tmpbet.Guid = tmp5.Guid; FinishedBet(tmpbet); retrycount = 0; } catch { Parent.updateStatus(sEmitResponse); } } catch (AggregateException e) { if (retrycount++ < 3) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance, (bet as PlaceBetObj).Guid)); return; } if (e.InnerException.Message.Contains("429") || e.InnerException.Message.Contains("502")) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance, (bet as PlaceBetObj).Guid)); } } catch (Exception e2) { } }
void PlaceBetThread(object Bool) { try { PlaceBetObj tmp9 = Bool as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; //decimal tmpchance = High ? 99.99 - chance : chance; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("a", "place_bet")); pairs.Add(new KeyValuePair <string, string>("amount", (amount).ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("win_chance", chance.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("direction", High ? "over" : "under")); pairs.Add(new KeyValuePair <string, string>("auth_key", authkey)); pairs.Add(new KeyValuePair <string, string>("origin", "manual")); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("ajax.php", Content).Result.Content.ReadAsStringAsync().Result; try { MDBet tmp = json.JsonDeserialize <MDBet>(sEmitResponse); if (tmp.error == 0) { Bet tmp2 = tmp.ToBet(); tmp2.Guid = tmp9.Guid; balance += (decimal)tmp2.Profit; bets++; if (tmp.bet_win) { wins++; } else { losses++; } wagered += (decimal)(tmp2.Amount); profit += (decimal)(tmp2.Profit); FinishedBet(tmp2); retrycount = 0; } else { Parent.updateStatus(tmp.msg); } } catch (Exception e) { Parent.DumpLog(e.Message, 3); Parent.DumpLog(e.StackTrace, 4); Parent.updateStatus(sEmitResponse); } } catch (AggregateException e) { if (retrycount++ < 3) { PlaceBetThread(High); return; } if (e.InnerException.Message.Contains("429") || e.InnerException.Message.Contains("502")) { Thread.Sleep(200); PlaceBetThread(High); } Parent.DumpLog(e.InnerException.Message, 3); Parent.DumpLog(e.InnerException.StackTrace, 4); } catch (Exception e2) { Parent.DumpLog(e2.Message, 3); Parent.DumpLog(e2.StackTrace, 4); } }
private void placebetthread(object obj) { try { PlaceBetObj tmp5 = obj as PlaceBetObj; WolfPlaceBet tmp = new WolfPlaceBet { amount = tmp5.Amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo), currency = Currency, rule = tmp5.High ? "over" : "under", multiplier = ((100m - edge) / tmp5.Chance).ToString("0.####", System.Globalization.NumberFormatInfo.InvariantInfo), bet_value = (High ? maxRoll - tmp5.Chance : tmp5.Chance).ToString("0.##", System.Globalization.NumberFormatInfo.InvariantInfo), game = "dice" }; string LoginString = json.JsonSerializer <WolfPlaceBet>(tmp); HttpContent cont = new StringContent(LoginString); cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage resp2 = Client.PostAsync("bet/place", cont).Result; if (resp2.IsSuccessStatusCode) { } string sEmitResponse = resp2.Content.ReadAsStringAsync().Result; try { WolfBetResult result = json.JsonDeserialize <WolfBetResult>(sEmitResponse); if (result.bet != null) { Bet tmpRsult = new Bet() { Amount = decimal.Parse(result.bet.amount, System.Globalization.NumberFormatInfo.InvariantInfo), Chance = result.bet.rule == "over" ? maxRoll - decimal.Parse(result.bet.bet_value, System.Globalization.NumberFormatInfo.InvariantInfo): decimal.Parse(result.bet.bet_value, System.Globalization.NumberFormatInfo.InvariantInfo), clientseed = result.bet.user_seed, date = DateTime.Now, Currency = Currency, Guid = tmp5.Guid, nonce = result.bet.nonce, Id = result.bet.hash, high = result.bet.rule == "over", Roll = decimal.Parse(result.bet.result_value, System.Globalization.NumberFormatInfo.InvariantInfo), Profit = decimal.Parse(result.bet.profit, System.Globalization.NumberFormatInfo.InvariantInfo), serverhash = result.bet.server_seed_hashed }; bool Win = (((bool)High ? tmpRsult.Roll > (decimal)maxRoll - (decimal)(chance) : (decimal)tmpRsult.Roll < (decimal)(chance))); if (Win) { wins++; } else { losses++; } wagered += amount; profit += tmpRsult.Profit; this.balance = result.userBalance.amount; FinishedBet(tmpRsult); } } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); Parent.DumpLog(sEmitResponse, -1); Parent.updateStatus("Error: " + sEmitResponse); } } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); } }
void PlacebetThread(object RollObject) { try { string ClientSeed = R.Next(0, 100).ToString(); PlaceBetObj tmp5 = RollObject as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; decimal tmpchance = High ? 99m - chance : chance; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("rollAmount", (amount * 100000000m).ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("rollUnder", tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("mode", High ? "2" : "1")); pairs.Add(new KeyValuePair <string, string>("rollClient", ClientSeed)); pairs.Add(new KeyValuePair <string, string>("token", accesstoken)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("play.php", Content).Result.Content.ReadAsStringAsync().Result; //Lastbet = DateTime.Now; try { KDBet tmp = json.JsonDeserialize <KDBet>(sEmitResponse); if (tmp.roll_id != null && tmp.roll_id != null) { Bet tmpBet = new Bet { Guid = tmp5.Guid, Amount = amount, date = DateTime.Now, Id = tmp.roll_id.ToString(), Profit = tmp.roll_profit / 100000000m, Roll = tmp.roll_number, high = High, Chance = tmp.probability, nonce = (long)tmp.provablef_serverRoll, serverhash = LastHash, serverseed = tmp.provablef_Hash, clientseed = ClientSeed }; if (tmp.roll_result == "win") { wins++; } else { losses++; } wagered += amount; profit += tmp.roll_profit / 100000000m; bets++; LastHash = tmp.roll_next.hash; balance = tmp.balance / 100000000m; FinishedBet(tmpBet); } else { Parent.updateStatus("An unknown error has occurred. Bet will retry in 30 seconds."); } //retrycount = 0; } catch { Parent.updateStatus(sEmitResponse); } } catch (Exception e) { } }
void PlaceBetThread(object _High) { try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; lastbet = DateTime.Now; //bool High = (bool)_High; decimal tmpchance = High ? maxRoll - chance : chance; string sendchance = tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo); Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low")); string jsoncontent = json.JsonSerializer <RollinBetPlace>(new RollinBetPlace { bet_amount = decimal.Parse((amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo), System.Globalization.NumberFormatInfo.InvariantInfo), bet_number = decimal.Parse(sendchance, System.Globalization.NumberFormatInfo.InvariantInfo), prediction = High ? "bigger" : "smaller", seed = R.Next(int.MaxValue).ToString() }); StringContent Content = new StringContent(jsoncontent, Encoding.UTF8, "application/json"); Client.DefaultRequestHeaders.Remove("X-API-Nonce"); string x = mfagenerator.GetCode(Key); Client.DefaultRequestHeaders.Add("X-API-Nonce", x); HttpResponseMessage tmpresp = Client.PostAsync("games/dice/play", Content).Result; string sEmitResponse = tmpresp.Content.ReadAsStringAsync().Result; RollinBet tmp = json.JsonDeserialize <RollinBet>(sEmitResponse); if (tmp.errors != null && tmp.errors.Length > 0) { Parent.updateStatus(tmp.errors[0]); } else { Bet tmp2 = tmp.ToBet(); tmp2.serverhash = server_hash; server_hash = tmp.customer.server_hash; balance = decimal.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; bets = tmp.statistics.bets; losses = tmp.statistics.losses; profit = decimal.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m; wagered = decimal.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m; wins = (tmp.statistics.wins); LastBalance = DateTime.Now; tmp2.date = DateTime.Now; FinishedBet(tmp2); retrycount = 0; } } catch (Exception E) { if (retrycount++ < 3) { PlaceBetThread(High); return; } Parent.updateStatus(E.Message); if (Parent.logging > 1) { using (StreamWriter sw = File.AppendText("log.txt")) { sw.WriteLine(E.Message); sw.WriteLine(E.StackTrace); sw.WriteLine(json.JsonSerializer <System.Collections.IDictionary> (E.Data)); } } } }
void placebetthread(object _High) { try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; byte[] bytes = new byte[4]; R.GetBytes(bytes); long client = (long)BitConverter.ToUInt32(bytes, 0); decimal tmpchance = High ? maxRoll - chance : chance; long Roundedamount = (long)(Math.Round((amount), 8) * 100000000); MPBetPlace betplace = new MPBetPlace { client_seed = client, cond = High ? ">" : "<", hash = next, payout = (((decimal)(100.0m - edge) / chance) * Roundedamount), target = tmpchance, wager = Roundedamount }; HttpContent cont = new StringContent(json.JsonSerializer <MPBetPlace>(betplace)); cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); string Resp = ""; using (var response = Client.PostAsync("bets/simple-dice?access_token=" + token, cont)) { Resp = response.Result.Content.ReadAsStringAsync().Result; } MPBet tmp = json.JsonDeserialize <MPBet>(Resp); if (tmp.error != null) { if (tmp.error.ToLower().Contains("invalid_hash") || tmp.error.ToLower().Contains("valid hash")) { ResetSeed(); placebetthread(High); return; } else { Parent.updateStatus(tmp.error); } return; } Bet tmpBet = new Bet { Guid = tmp9.Guid, Amount = (decimal)amount, date = DateTime.Now, Id = tmp.bet_id.ToString(), Profit = (decimal)tmp.profit / 100000000m, Roll = (decimal)tmp.outcome, high = High, Chance = (decimal)chance, nonce = (int)(tmp.outcome * 100), serverhash = next, serverseed = tmp.secret.ToString(), clientseed = client.ToString() }; next = tmp.next_hash; //lastupdate = DateTime.Now; balance += tmp.profit / 100000000.0m; //i assume bets++; bool Win = (((bool)tmpBet.high ? (decimal)tmpBet.Roll > (decimal)maxRoll - (decimal)(tmpBet.Chance) : (decimal)tmpBet.Roll < (decimal)(tmpBet.Chance))); if (Win) { wins++; } else { losses++; } wagered += amount; profit += (tmp.profit / 100000000.0m); retrycount = 0; FinishedBet(tmpBet); } catch (AggregateException e) { if (retrycount++ < 3) { placebetthread(High); return; } if (e.InnerException.InnerException.Message.Contains("tsl/ssl") || e.InnerException.Message.Contains("502")) { Thread.Sleep(200); placebetthread(High); } } catch (Exception e2) { } }
void PlaceBetThread(object BetObj) { PlaceBetObj betobj = BetObj as PlaceBetObj; decimal low = 0; decimal high = 0; if (betobj.High) { high = maxRoll * 100; low = (maxRoll - chance) * 100 + 1; } else { high = chance * 100 - 1; low = 0; } string loginjson = json.JsonSerializer <WDPlaceBet>(new WDPlaceBet() { curr = Currency, bet = betobj.Amount, game = "in", high = (int)high, low = (int)low }); HttpContent cont = new StringContent(loginjson); cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage resp2 = Client.PostAsync("roll", cont).Result; if (resp2.IsSuccessStatusCode) { string response = resp2.Content.ReadAsStringAsync().Result; WDBet tmpBalance = json.JsonDeserialize <WDBet>(response); if (tmpBalance.status == "success") { Bet Result = new Bet() { Amount = betobj.Amount, date = DateTime.Now, Chance = tmpBalance.data.chance, clientseed = currentseed.client, Currency = Currency, Guid = betobj.Guid, Id = tmpBalance.data.hash, high = betobj.High, nonce = tmpBalance.data.nonce, Profit = tmpBalance.data.win - tmpBalance.data.bet, Roll = tmpBalance.data.result / 100m, serverhash = currentseed.hash }; this.bets++; bool Win = (((bool)High ? (decimal)Result.Roll > (decimal)maxRoll - (decimal)(chance) : (decimal)Result.Roll < (decimal)(chance))); if (Win) { wins++; } else { losses++; } wagered += amount; profit += Result.Profit; balance += Result.Profit; FinishedBet(Result); } else { Parent.updateStatus(tmpBalance.message); } } }
void placebetthread(object bet) { try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; decimal tmpchance = High ? 99.99m - chance : chance; try { string jsons = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{{\"amount\":{0:0},\"target\":\"{1:00.00}\",\"guess\":\"{2}\",\"currency\":\"{3}\"}}", amount * 100000000.0m, High ? 99.99m - (chance) : chance, High ? ">" : "<", Currency.ToLower()); var content = new StringContent(jsons, Encoding.UTF8, "application/json"); HttpResponseMessage Response = Client.PostAsync("games/dice/bet?hash=" + hash, content).Result; if (Response.IsSuccessStatusCode) { string Result = Response.Content.ReadAsStringAsync().Result; StakeDiceBetResult tmpresult = json.JsonDeserialize <StakeDiceBetResult>(Result); if (tmpresult != null) { if (tmpresult.bet != null && tmpresult.user != null) { Bet Tmp = new Bet { Amount = tmpresult.bet.amount / 100000000m, Chance = chance, clientseed = tmpresult.bet.clientSeedId, Currency = "btc", date = DateTime.Now, high = High, Id = tmpresult.bet.iid.ToString(), Profit = tmpresult.bet.state.profit / 100000000m, Roll = (decimal)tmpresult.bet.state.result, Guid = tmp5.Guid }; foreach (StakeBetBalance x in tmpresult.balances) { if (x.currency.ToLower() == Currency.ToLower()) { balance = x.balance / 100000000.0m; } } //balance = (decimal)(tmpresult.userBalance / 100000000.0m); bets++; if ((Tmp.high && Tmp.Roll > maxRoll - Tmp.Chance) || (!Tmp.high && Tmp.Roll < Tmp.Chance)) { wins++; } else { losses++; } profit += Tmp.Profit; wagered += Tmp.Amount; FinishedBet(Tmp); } } } else { string x = Response.Content.ReadAsStringAsync().Result; if (x.ToLower().Contains("valid amount")) { Parent.updateStatus("Invalid Bet amount"); } else if (x.ToLower().Contains("funds")) { Parent.updateStatus("Insufficient Funds, probably."); } Parent.updateStatus(x); } } catch (Exception er) { Parent.DumpLog(er.ToString(), 0); } } catch (Exception er) { Parent.DumpLog(er.ToString(), 0); } }
void PlaceBetThread(object BetObj) { try { PlaceBetObj tmpob = BetObj as PlaceBetObj; LastBetAmount = (double)tmpob.Amount; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); /*access_token * type:dice * amount:0.00000001 * condition:< or > * game:49.5 * devise:btc*/ pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken)); pairs.Add(new KeyValuePair <string, string>("type", "dice")); pairs.Add(new KeyValuePair <string, string>("amount", tmpob.Amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("condition", tmpob.High?">":"<")); pairs.Add(new KeyValuePair <string, string>("game", !tmpob.High ? tmpob.Chance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo) : (maxRoll - tmpob.Chance).ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("devise", Currency)); pairs.Add(new KeyValuePair <string, string>("api_key", "0b2edbfe44e98df79665e52896c22987445683e78")); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); HttpResponseMessage tmpmsg = Client.PostAsync("api/bet", Content).Result; string sEmitResponse = tmpmsg.Content.ReadAsStringAsync().Result; bsBetBase bsbase = null; try { bsbase = json.JsonDeserialize <bsBetBase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); } catch (Exception e) { } if (bsbase != null) { if (bsbase._return != null) { if (bsbase._return.success == "true") { balance = decimal.Parse(bsbase._return.new_balance, System.Globalization.NumberFormatInfo.InvariantInfo); lastupdate = DateTime.Now; Bet tmp = bsbase._return.ToBet(); tmp.Guid = tmpob.Guid; profit += (decimal)tmp.Profit; wagered += (decimal)tmp.Amount; tmp.date = DateTime.Now; bool win = false; if ((tmp.Roll > 99.99m - tmp.Chance && tmp.high) || (tmp.Roll < tmp.Chance && !tmp.high)) { win = true; } //set win if (win) { wins++; } else { losses++; } bets++; LastBetAmount = (double)tmpob.Amount; LastBet = DateTime.Now; FinishedBet(tmp); return; } else { if (bsbase._return.value != null) { if (bsbase._return.value.Contains("Bet in progress, please wait few seconds and retry.")) { Parent.updateStatus("Bet in progress. You need to log in with your browser and place a bet manually to fix this."); } else { Parent.updateStatus(bsbase._return.value); } } } } } // } catch (AggregateException e) { Parent.updateStatus("An Unknown error has ocurred."); } catch (Exception e) { Parent.updateStatus("An Unknown error has ocurred."); } }
void PlaceBetThread(object _High) { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; try { List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("crypto", Currency)); pairs.Add(new KeyValuePair <string, string>("amount", amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("chance_to_win", chance.ToString("0.0000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("roll_type", High ? "h" : "l")); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string responseData = ""; using (var response = Client.PostAsync("game/dice/bet", Content)) { try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { if (retrycount++ < 3) { PlaceBetThread(High); return; } if (e.InnerException.Message.Contains("ssl")) { PlaceBetThread(_High); return; } else { Parent.updateStatus("Oops! Something went wrong. Make sure your bet is larger than the minimum."); return; } } } CmBetResult tmp = json.JsonDeserialize <CmBetResult>(responseData); if (tmp.details != null || tmp.error_code != 0) { if (tmp.details.Length > 0) { Parent.updateStatus(tmp.details[0]); } else { Parent.updateStatus("Oops! Something went wrong. Make sure your bet is larger than the minimum."); } } else { Bet tmp2 = tmp.Tobet((decimal)chance); tmp2.Guid = tmp9.Guid; tmp2.date = DateTime.Now; //next = tmp.nextServerSeed; lastupdate = DateTime.Now; balance = decimal.Parse(tmp.new_balance.btc.available, System.Globalization.NumberFormatInfo.InvariantInfo); bets++; /*if (tmp2) * wins++; * else losses++;*/ wagered += (decimal)(tmp2.Amount); profit += (decimal)tmp2.Profit; //tmp2.serverhash = next; //next = tmp.nextServerSeed; FinishedBet(tmp2); retrycount = 0; } } catch (WebException e) { if (e.Response != null) { string sEmitResponse = new StreamReader(e.Response.GetResponseStream()).ReadToEnd(); Parent.updateStatus(sEmitResponse); } if (e.Message.Contains("429") || e.Message.Contains("502")) { Thread.Sleep(200); PlaceBetThread(_High); } } catch (Exception e) { if (retrycount++ < 3) { PlaceBetThread(High); return; } Parent.updateStatus("Oops! Something went wrong. Make sure your bet is larger than the minimum."); } }
void PlaceBetThread(object _High) { string err = ""; try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; double amount = tmp9.Amount; //double chance = tmp9.Chance; Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, tmp9.Chance, High ? "High" : "Low")); double chance = (999999.0) * (tmp9.Chance / 100.0); //HttpWebResponse EmitResponse; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string responseData = ""; if (next == "" && next != null) { pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("a", "GetServerSeedHash")); pairs.Add(new KeyValuePair <string, string>("s", sessionCookie)); Content = new FormUrlEncodedContent(pairs); responseData = ""; using (var response = Client.PostAsync("", Content)) { try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { if (e.InnerException.Message.Contains("ssl")) { PlaceBetThread(High); return; } } } if (responseData.Contains("error")) { if (retrycount++ < 3) { Thread.Sleep(200); PlaceBetThread(High); return; } else { throw new Exception(); } } string Hash = next = json.JsonDeserialize <d999Hash>(responseData).Hash; } string ClientSeed = r.Next(0, int.MaxValue).ToString(); pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("a", "PlaceBet")); pairs.Add(new KeyValuePair <string, string>("s", sessionCookie)); pairs.Add(new KeyValuePair <string, string>("PayIn", ((long)(amount * 100000000.0)).ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("Low", (High ? 999999 - (int)chance : 0).ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("High", (High ? 999999 : (int)chance).ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("ClientSeed", ClientSeed)); pairs.Add(new KeyValuePair <string, string>("Currency", Currency)); pairs.Add(new KeyValuePair <string, string>("ProtocolVersion", "2")); Content = new FormUrlEncodedContent(pairs); string tmps = Content.ReadAsStringAsync().Result; responseData = ""; using (var response = Client.PostAsync("", Content)) { try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { Parent.DumpLog(e.InnerException.Message, 0); if (retrycount++ < 3) { PlaceBetThread(High); return; } if (e.InnerException.Message.Contains("ssl")) { PlaceBetThread(High); return; } else { Parent.updateStatus("An error has occurred"); } } } d999Bet tmpBet = json.JsonDeserialize <d999Bet>(responseData); if (amount >= 21) { } if (tmpBet.ChanceTooHigh == 1 || tmpBet.ChanceTooLow == 1 | tmpBet.InsufficientFunds == 1 || tmpBet.MaxPayoutExceeded == 1 || tmpBet.NoPossibleProfit == 1) { if (tmpBet.ChanceTooHigh == 1) { err = "Chance too high"; } if (tmpBet.ChanceTooLow == 1) { err += "Chance too Low"; } if (tmpBet.InsufficientFunds == 1) { err += "Insufficient Funds"; } if (tmpBet.MaxPayoutExceeded == 1) { err += "Max Payout Exceeded"; } if (tmpBet.NoPossibleProfit == 1) { err += "No Possible Profit"; } throw new Exception(); } else if (tmpBet.BetId == 0) { throw new Exception(); } else { balance = (double)tmpBet.StartingBalance / 100000000.0 - (amount) + ((double)tmpBet.PayOut / 100000000.0); profit += -(amount) + (double)(tmpBet.PayOut / 100000000m); Bet tmp = new Bet(); tmp.Amount = (decimal)amount; tmp.BetDate = DateTime.Now.ToString();; tmp.Chance = ((decimal)chance * 100m) / 999999m; tmp.clientseed = ClientSeed; tmp.Currency = Currency; tmp.high = High; tmp.Id = tmpBet.BetId; tmp.nonce = 0; tmp.Profit = ((decimal)tmpBet.PayOut / 100000000m) - ((decimal)amount); tmp.Roll = tmpBet.Secret / 10000m; tmp.serverhash = next; tmp.serverseed = tmpBet.ServerSeed; tmp.uid = (int)uid; tmp.UserName = ""; bool win = false; if ((tmp.Roll > 99.99m - tmp.Chance && High) || (tmp.Roll < tmp.Chance && !High)) { win = true; } if (win) { wins++; } else { losses++; } Wagered += tmp.Amount; bets++; sqlite_helper.InsertSeed(tmp.serverhash, tmp.serverseed); next = tmpBet.Next; retrycount = 0; FinishedBet(tmp); } } catch { if (err != "") { Parent.updateStatus(err); } else { Parent.updateStatus("Something went wrong! stopped betting"); } } }
void placebetthread(object bet) { try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; decimal tmpchance = High ?maxRoll - chance + 0.0001m : chance - 0.0001m; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); string seed = RandomSeed(); pairs.Add(new KeyValuePair <string, string>("bet", (amount).ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("target", tmpchance.ToString("0.0000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("side", High ? "high" : "low")); pairs.Add(new KeyValuePair <string, string>("act", "play_dice")); pairs.Add(new KeyValuePair <string, string>("currency", Currency)); pairs.Add(new KeyValuePair <string, string>("secret", secret)); pairs.Add(new KeyValuePair <string, string>("token", accesstoken)); pairs.Add(new KeyValuePair <string, string>("user_seed", seed)); pairs.Add(new KeyValuePair <string, string>("v", "65535")); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("action.php", Content).Result.Content.ReadAsStringAsync().Result; Lastbet = DateTime.Now; try { bitvestbet tmp = json.JsonDeserialize <bitvestbet>(sEmitResponse.Replace("f-", "f_").Replace("n-", "n_")); if (tmp.success) { Bet resbet = new Bet { Amount = tmp5.Amount, date = DateTime.Now, Chance = tmp5.Chance, high = tmp5.High, clientseed = seed, serverhash = lasthash, serverseed = tmp.server_seed, Roll = tmp.game_result.roll, Profit = tmp.game_result.win == 0 ? -tmp5.Amount : tmp.game_result.win - tmp5.Amount, nonce = -1, Id = tmp.game_id, Currency = Currency }; bets++; lasthash = tmp.server_hash; bool Win = (((bool)High ? (decimal)tmp.game_result.roll > (decimal)maxRoll - (decimal)(chance) : (decimal)tmp.game_result.roll < (decimal)(chance))); if (Win) { wins++; } else { losses++; } wagered += amount; profit += resbet.Profit; balance = decimal.Parse(Currency.ToLower() == "bitcoins"?tmp.data.balance:tmp.data.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo); /*tmp.bet.client = tmp.user.client; * tmp.bet.serverhash = tmp.user.server; * lastupdate = DateTime.Now; * balance = tmp.user.balance / 100000000.0m; //i assume * bets = tmp.user.bets; * wins = tmp.user.wins; * losses = tmp.user.losses; * wagered = (decimal)(tmp.user.wagered / 100000000m); * profit = (decimal)(tmp.user.profit / 100000000m); */ FinishedBet(resbet); retrycount = 0; } else { Parent.updateStatus(tmp.msg); if (tmp.msg.ToLower() == "bet rate limit exceeded") { Parent.updateStatus(tmp.msg + ". Retrying in a second;"); Thread.Sleep(1000); placebetthread(bet); return; } } } catch { Parent.updateStatus(sEmitResponse); } } catch (AggregateException e) { if (retrycount++ < 3) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance)); return; } if (e.InnerException.Message.Contains("429") || e.InnerException.Message.Contains("502")) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance)); } } catch (Exception e2) { } }
void PlaceBetThread(object _High) { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; string Clients = ClientSeedGen.Next(0, int.MaxValue).ToString(); decimal payout = decimal.Parse(((100m - edge) / (decimal)chance).ToString("0.0000")); cgPlaceBet tmpPlaceBet = new cgPlaceBet() { Bet = amount, ClientSeed = Clients, UnderOver = High, Payout = (decimal)payout }; string post = json.JsonSerializer <cgPlaceBet>(tmpPlaceBet); HttpContent cont = new StringContent(post); cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); /*List<KeyValuePair<string, string>> pairs = new List<KeyValuePair<string, string>>(); * pairs.Add(new KeyValuePair<string, string>("value", post)); * //pairs.Add(new KeyValuePair<string, string>("affiliate", "seuntjie")); * FormUrlEncodedContent cont = new FormUrlEncodedContent(pairs);*/ try { string sEmitResponse = Client.PostAsync("placebet/" + Currency + "/" + accesstoken, cont).Result.Content.ReadAsStringAsync().Result; cgGetBet Response = json.JsonDeserialize <cgGetBet>(sEmitResponse); if (Response.Message != "" && Response.Message != null) { Parent.updateStatus(Response.Message); return; } Bet bet = new Bet() { Guid = tmp9.Guid, Amount = (decimal)amount, Profit = (decimal)Response.Profit, Roll = (decimal)Response.Roll, Chance = decimal.Parse(Response.Target.Substring(3), System.Globalization.NumberFormatInfo.InvariantInfo), date = DateTime.Now, clientseed = Clients, Currency = Currency, Id = Response.BetId.ToString(), high = Response.Target.Contains(">"), serverhash = CurrenyHash, nonce = -1, serverseed = Response.ServerSeed }; if (bet.high) { bet.Chance = (decimal)maxRoll - bet.Chance; } this.CurrenyHash = Response.NextServerSeedHash; bool Win = (((bool)bet.high ? (decimal)bet.Roll > (decimal)maxRoll - (decimal)(bet.Chance) : (decimal)bet.Roll < (decimal)(bet.Chance))); if (Win) { wins++; } else { losses++; } bets++; wagered += amount; balance += Response.Profit; profit += Response.Profit; FinishedBet(bet); } catch { } }
void PlaceBetThread(object BetObj) { try { PlaceBetObj tmpob = BetObj as PlaceBetObj; //LastBetAmount = (double)tmpob.Amount; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("betAmount", "\"" + (amount * (decimal)CurrentCurrency.EffectiveScale).ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo) + "\"")); pairs.Add(new KeyValuePair <string, string>("chance", chance.ToString("0.#####", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("currency", CurrentCurrency.id.ToString())); pairs.Add(new KeyValuePair <string, string>("target", tmpob.High ? "1" : "0")); string loginjson = "{\"betAmount\":\"" + (amount * (decimal)CurrentCurrency.EffectiveScale).ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo) + "\",\"currency\":" + CurrentCurrency.id.ToString() + ",\"target\":" + (tmpob.High ? "1" : "0") + ",\"chance\":" + chance.ToString("0.#####", System.Globalization.NumberFormatInfo.InvariantInfo) + "}";//string.Format("{{username:\"{0}\",password:\"{1}\",code:\"{2}\",captcha:\"{3}\"}}",Username,Password,twofa,""); HttpContent cont = new StringContent(loginjson); cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage tmpmsg = Client.PostAsync("api/dice/bet", cont).Result; string sEmitResponse = tmpmsg.Content.ReadAsStringAsync().Result; bkPlaceBet tmpBet = json.JsonDeserialize <bkPlaceBet>(sEmitResponse); if (tmpBet.error != null) { Parent.DumpLog(tmpBet.error, 1); if (tmpBet.error == ("MIN_BET_AMOUNT_FOR_CURRENCYNAME_IS")) { Parent.updateStatus("Bet too small"); } else { Parent.updateStatus("Bet too small"); } } this.balance = decimal.Parse(tmpBet.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / CurrentCurrency.EffectiveScale; Bet newBet = new Bet { Amount = tmpob.Amount, date = DateTime.Now, Chance = tmpob.Chance, Guid = tmpob.Guid, Currency = Currency, high = tmpob.High, nonce = tmpBet.nextNonce - 1, Roll = (decimal)tmpBet.game_details.roll, UserName = username, Id = tmpBet.id, serverhash = serverseedhash, clientseed = clientseed }; bool win = false; if ((newBet.Roll > maxRoll - newBet.Chance && tmpob.High) || (newBet.Roll < newBet.Chance && !tmpob.High)) { win = true; } if (win) { newBet.Profit = (newBet.Amount * (((100m - edge) / chance) - 1)); wins++; } else { newBet.Profit -= newBet.Amount; losses++; } profit += newBet.Profit; wagered += newBet.Amount; bets++; FinishedBet(newBet); return; } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); } }
void placebetthread(object bet) { try { PlaceBetObj tmp5 = bet as PlaceBetObj; decimal amount = tmp5.Amount; decimal chance = tmp5.Chance; bool High = tmp5.High; decimal tmpchance = High ? maxRoll - chance : chance; GraphQLResponse betresult = GQLClient.PostAsync(new GraphQLRequest { Query = "mutation{" + RolName + "(amount:" + amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo) + ", target:" + tmpchance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo) + ",condition:" + (High ? "above" : "below") + ",currency:" + Currency.ToLower() + ") { id nonce currency amount payout state { ... on " + GameName + " { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profit currency}}}}" }).Result; if (betresult.Errors != null) { if (betresult.Errors.Length > 0) { Parent.updateStatus(betresult.Errors[0].Message); } } if (betresult.Data != null) { RollDice tmp = betresult.GetDataFieldAs <RollDice>(RolName); Lastbet = DateTime.Now; try { lastupdate = DateTime.Now; foreach (Statistic x in tmp.user.statistic) { if (x.currency.ToLower() == Currency.ToLower() && x.game == StatGameName) { this.bets = (int)x.bets; this.wins = (int)x.wins; this.losses = (int)x.losses; this.profit = (decimal)x.profit; this.wagered = (decimal)x.betAmount; break; } } foreach (Balance x in tmp.user.balances) { if (x.available.currency.ToLower() == Currency.ToLower()) { balance = (decimal)x.available.amount; break; } } Bet tmpbet = tmp.ToBet(maxRoll); if (getid) { GraphQLResponse betresult2 = GQLClient.PostAsync(new GraphQLRequest { Query = " query{bet(betId:\"" + tmpbet.Id + "\"){iid}}" }).Result; if (betresult2.Data != null) { //RollDice tmp2 = betresult2.GetDataFieldAs<RollDice>(RolName); //tmpbet.Id = tmp2.iid; tmpbet.Id = betresult2.Data.bet.iid; if (tmpbet.Id.Contains("house:")) { tmpbet.Id = tmpbet.Id.Substring("house:".Length); } } } tmpbet.Guid = tmp5.Guid; FinishedBet(tmpbet); retrycount = 0; } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); Parent.updateStatus("Some kind of error happened. I don't really know graphql, so your guess as to what went wrong is as good as mine."); } } } catch (AggregateException e) { if (retrycount++ < 3) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance, (bet as PlaceBetObj).Guid)); return; } if (e.InnerException.Message.Contains("429") || e.InnerException.Message.Contains("502")) { Thread.Sleep(500); placebetthread(new PlaceBetObj(High, amount, chance, (bet as PlaceBetObj).Guid)); } } catch (Exception e2) { Parent.updateStatus("Error occured while trying to bet, retrying in 30 seconds. Probably."); Parent.DumpLog(e2.ToString(), -1); } }
void PlaceBetThread(object _High) { try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; lastbet = DateTime.Now; //bool High = (bool)_High; decimal tmpchance = High ? maxRoll - chance : chance; string sendchance = tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo); Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low")); List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("bet_amount", (amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("bet_number", sendchance)); pairs.Add(new KeyValuePair <string, string>("prediction", High ? "bigger" : "smaller")); pairs.Add(new KeyValuePair <string, string>("seed", R.Next(int.MaxValue).ToString())); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("games/dice/play", Content).Result.Content.ReadAsStringAsync().Result; RollinBet tmp = json.JsonDeserialize <RollinBet>(sEmitResponse); if (tmp.errors != null && tmp.errors.Length > 0) { Parent.updateStatus(tmp.errors[0]); } else { Bet tmp2 = tmp.ToBet(); tmp2.serverhash = server_hash; server_hash = tmp.customer.server_hash; balance = decimal.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; bets = tmp.statistics.bets; losses = tmp.statistics.losses; profit = decimal.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m; wagered = decimal.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m; wins = (tmp.statistics.wins); LastBalance = DateTime.Now; tmp2.date = DateTime.Now; FinishedBet(tmp2); retrycount = 0; } } catch (Exception E) { if (retrycount++ < 3) { PlaceBetThread(High); return; } Parent.updateStatus(E.Message); if (Parent.logging > 1) { using (StreamWriter sw = File.AppendText("log.txt")) { sw.WriteLine(E.Message); sw.WriteLine(E.StackTrace); sw.WriteLine(json.JsonSerializer <System.Collections.IDictionary> (E.Data)); } } } }