public Graph(Bet[] _Bets) { InitializeComponent(); Series Bets; Bets = new Series("Profit"); Bets.ChartType = SeriesChartType.Line; Bets.Points.AddXY(0, 0); chrtProfitChart.ChartAreas[0].AxisX.Minimum = 0; chrtProfitChart.ChartAreas[0].AxisX.Minimum = 0; chrtProfitChart.ChartAreas[0].AxisX.Title = "Bets"; chrtProfitChart.ChartAreas[0].AxisY.Title = "Profit (Btc)"; chrtProfitChart.ChartAreas[0].AxisY2.Title = "Wagered"; chrtProfitChart.Legends.Add(Bets.Legend); if (_Bets!=null) { foreach (Bet NewBet in _Bets) { Bets.Points.Add(new DataPoint(++betcount, (double)(Profit += NewBet.Profit))); } } chrtProfitChart.Series.Add(Bets); //chrtProfitChart.Show(); }
public Bet ToBet() { Bet tmp = new Bet { Amount=decimal.Parse(game.bet_amount, System.Globalization.CultureInfo.InvariantCulture)/1000m, date = DateTime.Now, Id = statistics.bets, Roll = game.number, high = game.prediction=="bigger", Chance = game.odds, serverhash = customer.server_hash }; decimal Profit = decimal.Parse(game.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000m; if ((tmp.high && tmp.Roll>(99-tmp.Chance)) || (!tmp.high && tmp.Roll < tmp.Chance)) { tmp.Profit = Profit; } else { tmp.Profit = -decimal.Parse(game.bet_amount, System.Globalization.CultureInfo.InvariantCulture) / 1000m; } return tmp; }
public static void AddBet(Bet curbet, string sitename) { SQLiteConnection sqcon = GetConnection(); try { sqcon.Open(); SQLiteCommand Command = new SQLiteCommand("", sqcon); try { Command.CommandText = string.Format("insert into seed(hash,server) values('{0}','{1}')", curbet.serverhash, curbet.serverseed, sitename); Command.ExecuteNonQuery(); } catch { } Command.CommandText = string.Format("insert into bet(betid, date,stake,profit,chance,high,lucky,hash,nonce,uid,client,site) values('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{0}')", sitename, curbet.Id, curbet.date, curbet.Amount, curbet.Profit, curbet.Chance, curbet.high?"1":"0", curbet.Roll, curbet.serverhash, curbet.nonce, curbet.uid,curbet.clientseed); Command.ExecuteNonQuery(); } catch { } sqcon.Clone(); }
private void parseScript(Bet bet) { try { bool Win = !(((bool)bet.high ? (decimal)bet.Roll < 100m - (decimal)(bet.Chance) : (decimal)bet.Roll > (decimal)(bet.Chance))); SetLuaVars(); Lua["win"] = Win; Lua["currentprofit"] = ((double)(bet.Profit * 100000000)) / 100000000.0; Lua["lastBet"] = bet; LuaRuntime.SetLua(Lua); LuaRuntime.Run("dobet()"); GetLuaVars(); } catch { } }
public void DoBet(Bet bet) { bool Win = (((bool)bet.high ? (decimal)bet.Roll> (decimal)CurrentSite.maxRoll - (decimal)(bet.Chance) : (decimal)bet.Roll < (decimal)(bet.Chance))); if (!Win) { } double profit = (double)bet.Profit; retriedbet = false; if (!stop && !reset) { if (Win) { if (LargestWin < profit) LargestWin = profit; } else { if (LargestLoss < -profit) LargestLoss = -profit; } if (LargestBet < Lastbet) LargestBet = Lastbet; //if its a win if (Win && !(reset)) { if (PreviousBalance != 0) { if (Winstreak == 0) { currentprofit = 0; StreakProfitSinceLastReset = 0; StreakLossSinceLastReset = 0; } currentprofit += profit; ProfitSinceLastReset += profit; StreakProfitSinceLastReset += profit; Wins++; Winstreak++; trazelwin++; CalculateLuck(true); if (StatsWindows != null) if (!StatsWindows.IsDisposed) { if (Winstreak >= StatsWindows.nudLastStreakWin.Value) laststreakwin = Winstreak; } if (!programmerToolStripMenuItem.Checked || EnableReset) { if (chkResetBetWins.Checked && Winstreak % nudResetWins.Value == 0) { Reset(); } if (currentprofit >= ((double)nudStopWinBtcStreak.Value) && chkStopWinBtcStreak.Checked) { Stop("Made " + currentprofit + " profit in a row"); } if (Winstreak >= nudStopWinStreak.Value && chkStopWinStreak.Checked) { Stop("Won "+ Winstreak + " bets in a row"); } if (this.profit >= (double)nudStopWinBtc.Value && chkStopWinBtc.Checked) { Stop("Made " + this.profit + " profit"); } if (StreakProfitSinceLastReset >= (double)nudResetBtcStreakProfit.Value && chkResetBtcStreakProfit.Checked) { Reset(); StreakProfitSinceLastReset -= (double)nudResetBtcStreakProfit.Value; } if (ProfitSinceLastReset> (double)nudResetBtcProfit.Value && chkResetBtcProfit.Checked) { Reset(); ProfitSinceLastReset -= (double)nudResetBtcProfit.Value; } } if (Losestreak != 0) { double avglosecalc = avgloss * numlosesreaks; avglosecalc += Losestreak; avglosecalc /= ++numlosesreaks; avgloss = avglosecalc; double avgbetcalc = avgstreak * numstreaks; avgbetcalc -= Losestreak; avgbetcalc /= ++numstreaks; avgstreak = avgbetcalc; if (Losestreak > WorstStreak3) { WorstStreak3 = Losestreak; if (Losestreak > WorstStreak2) { WorstStreak3 = WorstStreak2; WorstStreak2 = Losestreak; if (Losestreak > WorstStreak) { WorstStreak2 = WorstStreak; WorstStreak = Losestreak; } } } } Losestreak = 0; } if (stoponwin) { Stop("Stop on win clicked, bet won"); } iMultiplyCounter = 0; Multiplier = (double)(nudMultiplier.Value); if ((!programmerToolStripMenuItem.Checked) || EnableProgZigZag) { if (chkZigZagWins.Checked && Wins% (int)nudZigZagWins.Value==0 && Wins!=0) { high = !high; } if (chkZigZagWinsStreak.Checked && Winstreak % (int)nudZigZagWinsStreak.Value ==0 && Winstreak!=0) { high = !high; } } } //if its a loss else if (!Win && !(reset)) { //do i use this line? iMultiplyCounter++; //reset current profit when switching from a winning streak to a losing streak if (Losestreak == 0) { currentprofit = 0; StreakProfitSinceLastReset = 0; StreakLossSinceLastReset = 0; } //adjust profit currentprofit -= Lastbet; ProfitSinceLastReset -= Lastbet; StreakLossSinceLastReset -= Lastbet; //increase losses and losestreak Losses++; Losestreak++; CalculateLuck(false); //update last losing streak if it is above the specified value to show in the stats if (StatsWindows != null) if (!StatsWindows.IsDisposed) if (Losestreak >= StatsWindows.nudLastStreakLose.Value) laststreaklose = Losestreak; //switch high low if applied in the zig zag tab if ((!programmerToolStripMenuItem.Checked) || EnableProgZigZag) { if (chkZigZagLoss.Checked && Losses % (int)nudZigZagLoss.Value == 0 && Losses != 0) { high = !high; } if (chkZigZagLossStreak.Checked && Losestreak % (int)nudZigZagLossStreak.Value == 0 && Losestreak != 0) { high = !high; } } //change chance after a certain losing streak if (chkChangeChanceLose.Checked && (Losestreak == nudChangeChanceLoseStreak.Value)) { try { Chance = (double)nudChangeChanceLoseTo.Value; if (!RunningSimulation) CurrentSite.chance = (double)(nudChangeChanceLoseTo.Value); } catch { } } if (!programmerToolStripMenuItem.Checked || EnableReset) { if (chkResetBetLoss.Checked && Losestreak %nudResetBetLoss.Value == 0) { Reset(); } //stop conditions: //stop if lose streak is higher than specified if (Losestreak >= nudStopLossStreak.Value && chkStopLossStreak.Checked) { Stop("Lost " +Losestreak + "bets in a row"); } //stop if current profit drops below specified value/ loss is larger than specified value if (currentprofit <= (0.0 - (double)nudStopLossBtcStreal.Value) && chkStopLossBtcStreak.Checked) { Stop("Lost " + currentprofit+ " " + CurrentSite.Currency+" in a row"); } // stop if total profit/total loss is below/above certain value if (this.profit <= 0.0 - (double)nudStopLossBtc.Value && chkStopLossBtc.Checked) { Stop("Lost " + this.profit + " " + CurrentSite.Currency); } if (StreakLossSinceLastReset <= -(double)nudResetBtcStreakLoss.Value && chkResetBtcStreakLoss.Checked) { Reset(); StreakLossSinceLastReset += (double)nudResetBtcStreakLoss.Value; } if (ProfitSinceLastReset < -(double)nudResetBtcLoss.Value && chkResetBtcLoss.Checked) { Reset(); ProfitSinceLastReset += (double)nudResetBtcLoss.Value; } } //when switching from win streak to lose streak, calculate some stats if (Winstreak != 0) { double avgwincalc = avgwin * numwinstreasks; avgwincalc += Winstreak; avgwincalc /= ++numwinstreasks; avgwin = avgwincalc; double avgbetcalc = avgstreak * numstreaks; avgbetcalc += Winstreak; avgbetcalc /= ++numstreaks; avgstreak = avgbetcalc; if (Winstreak > BestStreak3) { BestStreak3 = Winstreak; if (Winstreak > BestStreak2) { BestStreak3 = BestStreak2; BestStreak2 = Winstreak; if (Winstreak > BestStreak) { BestStreak2 = BestStreak; BestStreak = Winstreak; } } } } //reset win streak Winstreak = 0; //sounds if (!RunningSimulation) if (Sound && SoundStreak && Losestreak > SoundStreakCount) playalarm(); //email if (!RunningSimulation) if (Emails.Streak && Losestreak > Emails.StreakSize) Emails.SendStreak(Losestreak, Emails.StreakSize, dPreviousBalance); //update worst streaks if (!RunningSimulation) if (Losestreak > WorstStreak) WorstStreak = Losestreak; //reset win multplier WinMultiplier = (double)(nudWinMultiplier.Value); } if (chkZigZagBets.Checked && (!programmerToolStripMenuItem.Checked || EnableProgZigZag )) { if ((Wins+Losses) % (int)nudZigZagBets.Value == 0 && (Wins+Losses)!=0 ) { high = !high; } } if (!RunningSimulation) if (dPreviousBalance >= Limit && chkLimit.Checked && (!programmerToolStripMenuItem.Checked)) { if (rdbStop.Checked) { Stop("Balance larger than "+Limit+" (limit)"); } else if (rdbWithdraw.Checked) { Withdraw(); } else if (rdbInvest.Checked) { Invest(); } } if (!RunningSimulation) if (dPreviousBalance - Lastbet <= LowerLimit && chkLowerLimit.Checked &&(!programmerToolStripMenuItem.Checked)) { //TrayIcon.BalloonTipText = "Balance lower than " + nudLowerLimit.Value + "\nStopping Bets..."; TrayIcon.ShowBalloonTip(1000); Stop("Balance lower than " + nudLowerLimit.Value); if (Sound && SoundLow) playalarm(); TrayIcon.BalloonTipText = "DiceBot has Stopped Betting\nThe next bet will will have put your Balance below your lower limit"; if (Emails.Lower) Emails.SendLowLimit(dPreviousBalance, LowerLimit, Lastbet); } if (!RunningSimulation) if ( Wins!=0 && Losses!=0 && chkResetSeed.Checked && (!programmerToolStripMenuItem.Checked)) { if ( ((rdbResetSeedBets.Checked && (Wins+Losses) % nudResetSeed.Value == 0) || (rdbResetSeedWins.Checked && Wins % nudResetSeed.Value == 0 && Losestreak==0)|| (rdbResetSeedLosses.Checked && Losses % nudResetSeed.Value == 0 && Winstreak == 0)) && !withdrew) { ResetSeed(); } } try { UpdateStats(); } catch { } if (RunningSimulation && (Wins + Losses > SimWindow.nudSimNumBets.Value || Lastbet > PreviousBalance)) { Stop("Simulation complete"); } if (!(stop || withdraw ||invest)) { if (programmerToolStripMenuItem.Checked) { parseScript(bet); } else if (!reset) { if (rdbMartingale.Checked) { martingale(Win); } else if (rdbLabEnable.Checked) { Labouchere(Win); } else if (rdbFibonacci.Checked) { Fibonacci(Win); } else if (rdbAlembert.Checked) { Alembert(Win); } else if (rdbPreset.Checked) { PresetList(Win); } } if (chkMinBet.Checked && (!programmerToolStripMenuItem.Checked || EnableReset) && Lastbet< (double)nudMinumumBet.Value) { Lastbet = (double)nudMinumumBet.Value; } if (chkMaxBet.Checked && (!programmerToolStripMenuItem.Checked || EnableReset) && Lastbet > (double)nudMaximumBet.Value) { Lastbet = (double)nudMaximumBet.Value; } if (RunningSimulation && Lastbet > dPreviousBalance) { Stop("Simulation complete"); } if (!stop) { WriteConsole("Betting " + Lastbet + " at " + Chance +"% chance to win, "+ (high?"high":"low")); EnableTimer(tmBet, true); withdrew = false; } } } if (RunningSimulation && stop) { RunningSimulation = false; } reset = false; }
public void PlaceBetThread(object BetObject) { try { var curBet = BetObject as PlaceBetObj; string ClientSeed = R.Next(0, int.MaxValue).ToString(); string Highlow = curBet.High ? "high" : "low"; string request = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "dice?api_key={0}¤cy={1}&amount={2}&chance={3}&type={4}", APIKey, Currency, curBet.Amount, curBet.Chance, Highlow, ClientSeed, CurrentSeed.id); var BetResponse = Client.PostAsync(request, new StringContent("")).Result; string sbetresult = BetResponse.Content.ReadAsStringAsync().Result; BDBetResponse NewBet = json.JsonDeserialize <BDBetResponse>(sbetresult); try { if (!string.IsNullOrWhiteSpace(NewBet.error)) { Parent.updateStatus(NewBet.error); return; } if (CurrentSeed.id != NewBet.bet.data.secret) { string SecretResponse = Client.GetStringAsync($"dice/secret?api_key={APIKey}").Result; BDSeed tmpSeed = json.JsonDeserialize <BDSeed>(SecretResponse); CurrentSeed = tmpSeed; } Bet result = new Bet { Amount = NewBet.bet.amount, date = DateTime.Now, Chance = NewBet.bet.data.chance, clientseed = ClientSeed, Guid = curBet.Guid, Currency = Currency, high = NewBet.bet.data.high, Id = NewBet.bet.id.ToString(), nonce = NewBet.bet.data.nonce, Profit = NewBet.bet.profit, Roll = NewBet.bet.data.lucky, serverhash = CurrentSeed.hash, //serverseed = NewBet.old.secret }; //CurrentSeed = new BDSeed { hash = NewBet.secret.hash, id = NewBet.secret.id }; bool win = NewBet.bet.data.result; if (win) { wins++; } else { losses++; } bets++; wagered += result.Amount; profit += result.Profit; balance = NewBet.balance; FinishedBet(result); } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); Parent.updateStatus("An unknown error has occurred"); } } catch (Exception e) { Parent.DumpLog(e.ToString(), -1); Parent.updateStatus("An unknown error has occurred"); } }
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 Obj) { PlaceBetObj tmp = Obj as PlaceBetObj; bool High = tmp.High; double amount = tmp.Amount; double 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 ? 100000000 : 1000000000000)), payout = (double)(((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(System.Globalization.NumberFormatInfo.InvariantInfo) : ((long)(chance * 10000)).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 = (double)(((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 = json.ToDateTime2(tmpResult.processTime); 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; 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 += (double)bet.Profit; ++bets; wagered += (double)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 += (double)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() { string err = ""; try { Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, this.chance, High ? "High" : "Low")); double chance = (999999.0) * (this.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(); return; } } } if (responseData.Contains("error")) { if (BetRetries++ < 3) { Thread.Sleep(200); PlaceBetThread(); 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)Math.Ceiling(amount * 100000000.0)).ToString(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); responseData = ""; using (var response = Client.PostAsync("", Content)) { try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { if (e.InnerException.Message.Contains("ssl")) { PlaceBetThread(); 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++; BetRetries = 0; sqlite_helper.InsertSeed(tmp.serverhash, tmp.serverseed); next = tmpBet.Next; FinishedBet(tmp); } } catch { if (err != "") Parent.updateStatus(err); else Parent.updateStatus("Something went wrong! stopped betting"); } }
void placebetthread(object _High) { try { bool High = (bool)_High; int client = R.Next(0, int.MaxValue); HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://api.moneypot.com/v1/bets/simple-dice?access_token="+token); betrequest.CookieContainer = new CookieContainer(); betrequest.CookieContainer.Add(new Cookie("sessionId", token, "/", "moneypot.com")); if (Prox != null) betrequest.Proxy = Prox; betrequest.Method = "POST"; double tmpchance = High ? maxRoll - chance : chance; MPBetPlace betplace = new MPBetPlace { client_seed = client, cond = High ? ">" : "<", hash=next, payout = (((double)(100.0m - edge) / chance) * (amount * 100000000)), target = tmpchance, wager = amount * 100000000 }; string post = json.JsonSerializer<MPBetPlace>(betplace); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/json"; using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); MPBet tmp = json.JsonDeserialize<MPBet>(sEmitResponse); Bet tmpBet = new Bet { Amount = (decimal)amount, date = DateTime.Now, Id = tmp.bet_id, Profit = (decimal)tmp.profit/100000000m, Roll = (decimal)tmp.outcome, high = High, Chance = (decimal)chance, nonce = 0, serverhash = next, serverseed = tmp.secret.ToString(), clientseed = client.ToString() }; next = tmp.next_hash; //lastupdate = DateTime.Now; balance += tmp.profit / 100000000.0; //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.0); FinishedBet(tmpBet); } 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); } } }
public Bet ToBet() { Bet tmp = new Bet { Amount = amount, date = json.ToDateTime2(timestamp.ToString()), Id=id, Profit = profit, Roll = result, high = bet.ToLower().StartsWith("over"), Chance = chance, nonce=nonce, serverhash="", clientseed="", uid=0 }; return tmp; }
void ReceivedBet(CoinichiwaBet ReceivedBet) { delay = ReceivedBet.delay; LastBet = DateTime.Now; Bet tmp = new Bet(); tmp.Amount = (decimal)amount; tmp.date = DateTime.Now; tmp.Roll = (decimal)ReceivedBet.luckyNumber; tmp.Id = ReceivedBet.betid; tmp.Profit = (decimal)ReceivedBet.profit / 100000000m; tmp.high = High; tmp.Chance = (decimal)chance; tmp.nonce = ReceivedBet.seedIncrement; tmp.serverhash = ""; tmp.clientseed = ""; bool Win = (((bool)tmp.high ? (decimal)tmp.Roll > (decimal)maxRoll - (decimal)(tmp.Chance) : (decimal)tmp.Roll < (decimal)(tmp.Chance))); if (Win) wins++; else losses++; bets++; balance = ReceivedBet.balance/100000000.0; profit += (double)tmp.Profit; wagered += (double)tmp.Amount; FinishedBet(tmp); }
private void Sock_MessageReceived(object sender, MessageReceivedEventArgs e) { if (e.Message == "3probe") { (sender as WebSocket).Send("5"); //Sock.Send("420[\"join\",{\"ott\":\"" + ott + "\",\"api_version\":1}]"); } else { Parent.DumpLog(e.Message, -1); if (e.Message.StartsWith("42[\"game_starting\",")) { //42["game_starting",{"game_id":214035,"max_win":3782817516,"time_till_start":5000}] string id = e.Message.Substring(e.Message.IndexOf("\"game_id\":") + "\"game_id\":".Length); id = id.Substring(0, id.IndexOf(",")); GameId = id; cashedout = false; this.guid = ""; //open betting for user betsOpen = true; Parent.updateStatus("Game starting - waiting for bet"); } else if (e.Message.StartsWith("42[\"game_started\",")) { //close betting and wait for result betsOpen = false; } else if (e.Message.StartsWith("42[\"game_crash\",") && guid != "") { //if not cashed out yet, it's a loss and debit balance Bet bet = new Bet { Amount = (decimal)amount, Profit = -amount, Chance = chance, high = true, Currency = Currency, date = DateTime.Now, Id = GameId != ""?GameId:Guid.NewGuid().ToString(), Roll = 0, UserName = username, nonce = -1, Guid = guid }; this.balance -= amount; this.profit -= amount; this.wagered += amount; this.losses++; this.bets++; this.guid = ""; FinishedBet(bet); Parent.updateStatus("Game crashed - Waiting for next game"); } else if (e.Message.StartsWith("42[\"cashed_out\"") && guid != "") { //check if the cashed out user is the current user, if it is, it's a win. if (e.Message.Contains("\"" + username + "\"")) { cashedout = true; Bet bet = new Bet { Amount = (decimal)amount, Profit = ((100 - edge) / chance) * amount - amount, Chance = chance, high = true, Currency = Currency, date = DateTime.Now, Id = GameId != "" ? GameId : Guid.NewGuid().ToString(), Roll = (100 - chance) + 0.00001m, UserName = username, nonce = -1, Guid = guid }; this.guid = ""; this.balance += bet.Profit; this.profit += bet.Profit; this.wagered += amount; this.wins++; this.bets++; FinishedBet(bet); } } else if (e.Message.StartsWith("430[null,{\"state")) { string content = e.Message.Substring(e.Message.IndexOf("{")); content = content.Substring(0, content.LastIndexOf("}")); ECLogin tmplogin = json.JsonDeserialize <ECLogin>(content); if (tmplogin != null) { this.username = tmplogin.username; this.balance = (tmplogin.balance_satoshis) / 100000000m; Parent.updateBalance(balance); } } else if (e.Message.StartsWith("42[\"game_tick\"")) { if (guid != "" || cashedout) { //42["game_tick",13969] string x = e.Message.Substring(e.Message.IndexOf(",") + 1); x = x.Substring(0, x.LastIndexOf("]")); decimal tickval = 0; if (decimal.TryParse(x, out tickval)) { double mult = 0; mult = Math.Floor(100 * Math.Pow(Math.E, 0.00006 * (double)tickval)); string message = ""; if (guid != null) { message = string.Format("Game running - {0:0.00000000} at {1:0.0000} - {2:0.00}x", amount, (100 - edge) / chance, mult / 100); } else { message = string.Format("Game running - Cashed out - {2:0.00}x", amount, (100 - edge) / chance, mult / 100); } Parent.updateStatus(message); } } } } }
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)), bet_number = decimal.Parse(sendchance), 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; MPBetPlace betplace = new MPBetPlace { client_seed = client, cond = High ? ">" : "<", hash = next, payout = (((decimal)(100.0m - edge) / chance) * (amount * 100000000)), target = tmpchance, wager = amount * 100000000 }; 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 { Amount = (decimal)amount, date = DateTime.Now, Id = tmp.bet_id, 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 WSClient_MessageReceived(object sender, MessageReceivedEventArgs e) { //Parent.DumpLog(e.Message, -1); if (e.Message == "3probe") { WSClient.Send("5"); //4214["access_token_data",{"app_id":2668,"access_token":"49af40dd-5f96-4c67-ab16-6ff05f0d364b"}] //20:421["get_hash",null] WSClient.Send("42" + id++ + "[\"get_hash\",null]"); string getbalance = string.Format("42{0}[\"access_token_data\",{{\"app_id\":{1},\"access_token\":\"{2}\"}}]", id++, APPId, accesstoken); WSClient.Send(getbalance); //148:420["chat_init",{"app_id":926,"access_token":"5ed59498-d425-4c63-835e-348f56753d5a","subscriptions":["CHAT","DEPOSITS","BETS"],"room":"ENGLISH_RM"}] } else { if (e.Message.Contains("[null,{\"hash\":")) { //431[null,{"hash":"60a4fb16aa9aa7020d6adc397730952d102adde98428007701836dcb5e4c48eb","bet_hash":"60a4fb16aa9aa7020d6adc397730952d102adde98428007701836dcb5e4c48eb"}] string msg = e.Message.Substring(e.Message.IndexOf("{")); msg = msg.Substring(0, msg.Length - 1); SDiceHash tmphash = json.JsonDeserialize <SDiceHash>(msg); this.OldHash = tmphash.bet_hash; } if (e.Message.Contains("[null,{\"token\":")) { // get balance and stats string msg = e.Message.Substring(e.Message.IndexOf("{")); msg = msg.Substring(0, msg.Length - 1); SDIceAccToken tmphash = json.JsonDeserialize <SDIceAccToken>(msg); this.balance = tmphash.auth.user.balance / 100000000m; this.profit = tmphash.auth.user.betted_profit / 100000000m; this.wagered = tmphash.auth.user.betted_wagered / 100000000m; this.bets = (int)tmphash.auth.user.betted_count; Parent.updateBalance(balance); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateBets(bets); } if (e.Message.Contains("[null,{\"id\":")) { //do bet string msg = e.Message.Substring(e.Message.IndexOf("{")); msg = msg.Substring(0, msg.Length - 1); SDIceBet tmphash = json.JsonDeserialize <SDIceBet>(msg); Bet newbet = new Bet { Amount = amount, date = DateTime.Now, Chance = chance, high = High, clientseed = ClientSeed, Id = tmphash.bet_id.ToString(), nonce = tmphash.secret, serverseed = tmphash.salt, serverhash = OldHash, Profit = tmphash.profit / 100000000m, Roll = decimal.Parse(tmphash.outcome, System.Globalization.NumberFormatInfo.InvariantInfo) }; OldHash = tmphash.next_hash; balance += newbet.Profit; profit += newbet.Profit; bets++; wagered += newbet.Amount; bool win = false; if ((newbet.Roll > maxRoll - newbet.Chance && High) || (newbet.Roll < newbet.Chance && !High)) { win = true; } if (win) { wins++; } else { losses++; } FinishedBet(newbet); } } }
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.ToString(), nonce = -1, Profit = (decimal)betresult.bet.profitInSatoshis / 100000000m, serverhash = betresult.serverHash, serverseed = betresult.serverRoll + "-" + betresult.serverSalt, Roll = decimal.Parse(betresult.bet.rollInPercent), Guid = obj.Guid }; 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("00.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 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); } }
public Bet toBet() { Bet tmp = new Bet { Amount = (decimal)wager, date = DateTime.Now, Profit = (decimal)profit, Roll = (decimal)result, high = direction == 1, clientseed = clientSeed.ToString(), serverseed = serverSeed, Id=betId }; tmp.Chance = tmp.high ? 99.99m - (decimal)target : (decimal)target; return tmp; }
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(System.Globalization.NumberFormatInfo.InvariantInfo, "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 ? 1000000000000m: 100000000m)), payout = (decimal)(((long)(((100m - edge) / chance) * (curen == 2 ? 1000000000000m : 100000000m))) / (curen == 2 ? 1000000000000m : 100000000m)), 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); 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("api/dicebets", cont).Result) { Resp = response.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 ? 1000000000000m : 100000000m); 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 ? 1000000000000m : 100000000m); bet.Roll = (decimal)tmpResult.roll / 10000m; bet.serverhash = serverhash; bet.uid = (int)tmpResult.accountId; balance += (decimal)bet.Profit; bet.Guid = tmp.Guid; ++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; } } }
public void AddBet(Bet NewBet) { chrtProfitChart.Series[0].Points.Add(new DataPoint(++betcount, (double)(Profit += NewBet.Profit))); //chrtProfitChart.Show(); }
public Bet toBet() { Bet tmp = new Bet { Amount = (decimal)amount / 100000000m, date = json.ToDateTime2(timestamp), Id = decimal.Parse(id, System.Globalization.CultureInfo.InvariantCulture), Profit=(decimal)profit/100000000m, Roll=(decimal)roll, high=condition==">", Chance = condition == ">" ? 99.99m - (decimal)target : (decimal)target, nonce=nonce , serverhash = serverhash, clientseed = client, uid=player_id }; return tmp; }
static Bet BetParser(SQLiteDataReader Reader) { string site = ""; Bet tmp = new Bet(); for (int i = 0; i< Reader.FieldCount; i++) { switch (Reader.GetName(i)) { case "betid": tmp.Id = (long)Reader[i]; break; case "date": tmp.date = (DateTime)Reader[i]; break; case "stake": tmp.Amount = (decimal)Reader[i]; break; case "profit": tmp.Profit = (decimal)Reader[i]; break; case "chance": tmp.Chance = (decimal)Reader[i]; break; case "high": tmp.high = (short)Reader[i] == 1; break; case "lucky": tmp.Roll = (decimal)Reader[i]; break; case "hash": tmp.serverhash = (string)Reader[i]; break; case "nonce": tmp.nonce = (long)Reader[i]; break; case "uid": tmp.uid = (int)Reader[i]; break; case "Client": tmp.clientseed = (string)Reader[i]; break; case "server": tmp.serverseed = (string)Reader[i]; break; case "site": site = (string)Reader[i]; break; } } if (!string.IsNullOrEmpty(tmp.serverseed) && tmp.nonce != -1 && !string.IsNullOrEmpty(tmp.clientseed) && tmp.Roll!=-1 && site!="") { switch (site) { case "JustDice": tmp.Verified = tmp.Roll == (decimal)DiceSite.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "PrimeDice": tmp.Verified = tmp.Roll == (decimal)PD.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "999Dice": tmp.Verified = tmp.Roll== (decimal)dice999.sGetLucky(tmp.serverseed, (tmp.clientseed), (int)tmp.nonce, /*(long)(tmp.Roll*10000m),*/ tmp.serverhash); break; //case "SafeDice": tmp.Verified = tmp.Roll == (decimal)SD.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; //case "PRC": tmp.Verified = tmp.Roll == (decimal)PD.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; } } return tmp; }
void PlaceBetThread(object high) { bool High = (bool)high; double prize = amount * ((100.0 - (double)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.Amount = decimal.Parse(tmp.bet_data.size, System.Globalization.NumberFormatInfo.InvariantInfo); tmp2.date = DateTime.Now; tmp2.Id = (decimal)tmp.bet_data.bet_id; 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 += (double)tmp2.Amount; balance = tmp.bet_data.balance; profit += (double)tmp2.Profit; if (tmp.bet_data.win) { wins++; } else { losses++; } FinishedBet(tmp2); } else Parent.updateStatus(tmp.bet_data.error); }
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)); } } } }
public Bet ToBet() { Bet tmp = new Bet { Amount= (decimal)(bet_amount / 100000000.0), date = DateTime.Parse(bet_time), Id = long.Parse(bet_id), Profit = (decimal)(bet_profit/100000000.0), Roll = bet_roll, high = bet_game_type=="over", nonce = long.Parse(bet_nonce, System.Globalization.NumberFormatInfo.InvariantInfo), serverhash = bet_seed_id, clientseed = bet_key_id}; decimal tchance = decimal.Parse(bet_game_value, System.Globalization.NumberFormatInfo.InvariantInfo); tmp.Chance = (tmp.high ? 99.99m - tchance : tchance); return tmp; }
void ProcessBet(string response) { YLBetResponse tmpbetrespo = json.JsonDeserialize <YLBetResponse>(response).result; lastbet = DateTime.Now; delay = tmpbetrespo.delay; if (tmpbetrespo != null) { Bet tmp = new Bet() { Guid = this.Guid, Id = tmpbetrespo.id.ToString(), Amount = (decimal)tmpbetrespo.amount / 100000000m, date = DateTime.Now, Chance = (decimal)tmpbetrespo.target / 10000m, high = tmpbetrespo.range == "hi", Profit = (decimal)tmpbetrespo.profit / 100000000m, Roll = (decimal)tmpbetrespo.rolled / 10000m, nonce = tmpbetrespo.nonce, Currency = tmpbetrespo.coin }; bool sent = false; DateTime StartWait = DateTime.Now; if (Currentseed == null) { //while (Currentseed == null && (DateTime.Now-StartWait).TotalSeconds<20) { if (!sent) { sent = true; Write("read_seed", "{\"selector\":{\"id\":" + tmpbetrespo.seed_id + "}}"); Parent.updateStatus("Getting seed data. Please wait."); } //Thread.Sleep(100); } } if (Currentseed != null) { if (Currentseed.id != tmpbetrespo.seed_id) { //while (Currentseed.id != tmpbetrespo.seed_id && (DateTime.Now - StartWait).TotalSeconds < 20) { if (!sent) { sent = true; Write("read_seed", "{\"selector\":{\"id\":" + tmpbetrespo.seed_id + "}}"); Parent.updateStatus("Getting seed data. Please wait."); } //Thread.Sleep(100); } } } if (Currentseed != null) { tmp.serverhash = Currentseed.secret_hashed; tmp.clientseed = Currentseed.client_seed; } if (tmpbetrespo.user_data != null) { balance = (decimal)tmpbetrespo.user_data.balance / 100000000m; bets = (int)tmpbetrespo.user_data.bets; wins = (int)tmpbetrespo.user_data.wins; losses = (int)tmpbetrespo.user_data.losses; profit = (decimal)tmpbetrespo.user_data.profit / 100000000m; wagered = (decimal)tmpbetrespo.user_data.wagered / 100000000m; } else { balance += tmp.Profit; wagered += tmp.Amount; bets++; bool win = false; if ((tmp.Roll > maxRoll - tmp.Chance && High) || (tmp.Roll < tmp.Chance && !High)) { win = true; } if (win) { wins++; } else { losses++; } } FinishedBet(tmp); } }
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) + ",\"clientSeed\":\"" + clientseed + "\"}"; 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 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 { 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) { } }
public void GetBetResult(double Balance, Bet bet) { if (logging>2) using (StreamWriter sw = File.AppendText("log.txt")) { sw.WriteLine(json.JsonSerializer<Bet>(bet)); } PreviousBalance = (double)Balance; profit += (double)bet.Profit; if (!RunningSimulation) { AddChartPoint(profit); } if (InvokeRequired) { Invoke(new dDobet(DoBet),bet); } else DoBet(bet); }
void placebetthread() { try { 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)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string responseData = ""; using (var response = Client.PostAsync("betDice/", Content)) { try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { if (retrycount++ < 3) { placebetthread(); return; } if (e.InnerException.Message.Contains("ssl")) { placebetthread(); 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.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(); } } catch (Exception e) { } }
void Simbet() { dtLastBet = DateTime.Now; EnableTimer(tmBet, false); Bet tmp = new Bet(); if (Wins + Losses <= SimWindow.nudSimNumBets.Value) { string betstring = (Wins + Losses).ToString() + ","; double number = CurrentSite.GetLucky(server, client, Wins + Losses); tmp.Roll = (decimal)number; tmp.Chance = (decimal)Chance; tmp.Amount = (decimal)Lastbet; tmp.high = high; tmp.date = DateTime.Now; betstring += number.ToString() + "," + Chance.ToString() + ","; bool win = false; if (high) betstring += ">" + (CurrentSite.maxRoll - Chance) + ","; else betstring += "<" + Chance + ","; if (high && number > CurrentSite.maxRoll - Chance) { win = true; } else if (!high && number < Chance) { win = true; } double betProfit = 0; if (win) { betstring += "win,"; betstring += Lastbet + ","; betProfit = (Lastbet * 99 / Chance) - Lastbet; betstring += betProfit + ","; tmp.Profit = (decimal)betProfit; } else { betstring += "lose,"; betstring += Lastbet + ","; betProfit = -Lastbet ; betstring += betProfit +","; tmp.Profit = (decimal)betProfit; } this.PreviousBalance = dPreviousBalance + betProfit; betstring += PreviousBalance + ","; betstring += profit; tempsim.bets.Add(betstring); int bets = Wins + Losses; if (bets % 1000 == 0) { Updatetext(SimWindow.lblSimProgress, ((double)bets / (double)SimWindow.nudSimNumBets.Value * 100.00).ToString("00.00") + "%"); } if (bets % 10000 == 0) { using (StreamWriter sw = File.AppendText(Environment.GetEnvironmentVariable("APPDATA") + "\\DiceBot2\\tempsim")) { foreach (string tmpbet in tempsim.bets) { sw.WriteLine(tmpbet); } } tempsim.bets.Clear(); } GetBetResult(PreviousBalance, tmp); } else Stop("Simulation Complete"); }
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) { } }
private void placebetthread(object obj) { try { PlaceBetObj tmp5 = obj as PlaceBetObj; decimal tmpchance = Math.Round(tmp5.Chance, 2); WolfPlaceBet tmp = new WolfPlaceBet { amount = tmp5.Amount.ToString("0.00000000", System.Globalization.NumberFormatInfo.InvariantInfo), currency = Currency, rule = tmp5.High ? "over" : "under", multiplier = ((100m - edge) / tmpchance).ToString("0.####", System.Globalization.NumberFormatInfo.InvariantInfo), bet_value = (High ? maxRoll - tmpchance : tmpchance).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 = tmp5.High ? 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 = tmp5.High, 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 }; bets++; bool Win = (((bool)High ? tmpRsult.Roll > (decimal)maxRoll - (decimal)(tmpRsult.Chance) : (decimal)tmpRsult.Roll < (decimal)(tmpRsult.Chance))); if (Win) { wins++; } else { losses++; } wagered += amount; profit += tmpRsult.Profit; this.balance = result.userBalance.amount; FinishedBet(tmpRsult); } else { Parent.DumpLog(sEmitResponse, -1); } } 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 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 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) { string err = ""; try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; //decimal chance = tmp9.Chance; Parent.updateStatus(string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, tmp9.Chance, High ? "High" : "Low")); decimal chance = (999999.0m) * (tmp9.Chance / 100.0m); //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)((decimal)amount * 100000000m)).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 = (decimal)tmpBet.StartingBalance / 100000000.0m - (amount) + ((decimal)tmpBet.PayOut / 100000000.0m); profit += -(amount) + (decimal)(tmpBet.PayOut / 100000000m); Bet tmp = new Bet(); tmp.Guid = tmp9.Guid; tmp.Amount = (decimal)amount; tmp.date = DateTime.Now; tmp.Chance = ((decimal)chance * 100m) / 999999m; tmp.clientseed = ClientSeed; tmp.Currency = Currency; tmp.high = High; tmp.Id = tmpBet.BetId.ToString(); 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 Client_MessageReceived(object sender, MessageReceivedEventArgs e) { try { List <string> Msgs = e.Message.Split(new string[1] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); if (Incomplete != "") { Msgs[0] = Incomplete + Msgs[0]; Incomplete = ""; } if (!e.Message.EndsWith("\r\n")) { Incomplete = Msgs[Msgs.Count - 1]; Msgs.RemoveAt(Msgs.Count - 1); } foreach (string s in Msgs) { string[] RetObjs = s.Split(','); if (RetObjs[0] == ("63")) { Client.Send("67,2\r\n"); balance = decimal.Parse(RetObjs[2], System.Globalization.NumberFormatInfo.InvariantInfo); Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateWins(wins); Parent.updateLosses(losses); Parent.updateWagered(wagered); Parent.updateProfit(profit); } if (RetObjs[0] == ("53")) { } if (RetObjs[0] == ("65")) { //string[] values = e.Message.Split(','); Bet Result = new Bet { Amount = decimal.Parse(RetObjs[5], System.Globalization.NumberFormatInfo.InvariantInfo), Id = long.Parse(RetObjs[1]).ToString(), date = DateTime.Now, Profit = decimal.Parse(RetObjs[6], System.Globalization.NumberFormatInfo.InvariantInfo), Roll = decimal.Parse(RetObjs[9], System.Globalization.NumberFormatInfo.InvariantInfo) / 100m, serverseed = (RetObjs[10]), clientseed = (RetObjs[11]), high = RetObjs[8] == "1", uid = int.Parse(RetObjs[3]), Guid = this.Guid }; decimal tmpChance = decimal.Parse(RetObjs[7], System.Globalization.NumberFormatInfo.InvariantInfo) / 100m; Result.Chance = Result.high ? (decimal)maxRoll - tmpChance : tmpChance; bool win = false; if ((Result.Roll > 99.99m - Result.Chance && Result.high) || (Result.Roll < Result.Chance && !Result.high)) { win = true; } //set win if (win) { wins++; } else { losses++; } bets++; wagered += (decimal)Result.Amount; profit += (decimal)Result.Profit; balance += (decimal)Result.Profit; FinishedBet(Result); } if (RetObjs[0] == ("90")) { string error = ""; switch (RetObjs[1]) { case "1": error = "CONCURRENT_CONNECTION"; break; case "2": error = "INVALID_SESSION"; break; case "3": error = "INSUFFICIENT_FUNDS"; break; case "4": error = "INVALID_BET_AMOUNT"; break; case "5": error = "MONEY_TRANSFER_ERROR"; break; } Parent.updateStatus("An error has occured: " + error); } } } catch { Parent.updateStatus("An error has occured"); } }
private void parseScript(Bet bet) { try { bool Win = !(((bool)bet.high ? (decimal)bet.Roll < 100m - (decimal)(bet.Chance) : (decimal)bet.Roll > (decimal)(bet.Chance))); SetLuaVars(); Lua["win"] = Win; Lua["currentprofit"] = ((double)(bet.Profit * 100000000)) / 100000000.0; Lua["lastBet"] = bet; LuaRuntime.SetLua(Lua); LuaRuntime.Run("dobet()"); GetLuaVars(); } catch (LuaException e) { Stop("Lua error!"); DumpLog(e.Message, 1); DumpLog(e.StackTrace, 2); WriteConsole(e.Message); } catch (Exception e) { Stop("An error has occurred parsing the lua script."); DumpLog(e.Message, 1); DumpLog(e.StackTrace, 2); WriteConsole(e.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 ? 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 amount 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.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(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); } }
private void Sock_MessageReceived(object sender, MessageReceivedEventArgs e) { if (e.Message == "3probe") { Sock.Send("5"); } Parent.DumpLog(e.Message, 7); if (e.Message.StartsWith("42[\"showDiceBet\"")) { string x = e.Message.Substring(e.Message.IndexOf(",") + 1); x = x.Substring(0, x.Length - 1); BKBet tmpbet = json.JsonDeserialize <BKBet>(x); if (tmpbet != null) { if (tmpbet.userName == username && id != tmpbet.id) { id = tmpbet.id; Bet NewBet = new Bet() { Guid = this.Guid, Amount = tmpbet.betAmount, date = DateTime.Now, Chance = tmpbet.chance, clientseed = clientseed, Currency = tmpbet.currency.ToString(), high = tmpbet.target == 0, Id = tmpbet.id.ToString(), Profit = tmpbet.profit, Roll = tmpbet.roll, serverhash = serverseedhash, nonce = nonce }; this.wagered += NewBet.Amount; this.profit += NewBet.Profit; this.bets++; bool win = (NewBet.Roll > 99.99m - NewBet.Chance && High) || (NewBet.Roll < NewBet.Chance && !High); if (win) { wins++; } else { losses++; } FinishedBet(NewBet); } } } if (e.Message.StartsWith("42[\"diceBetResult\",")) { string x = e.Message.Substring(e.Message.IndexOf(",") + 1); x = x.Substring(0, x.Length - 1); BKBet2 tmpbet = json.JsonDeserialize <BKBet2>(x); if (tmpbet != null) { this.nonce = tmpbet.nonce; this.balance = tmpbet.balance; } } }
void placebetthread(object _High) { try { bool High = (bool)_High; int client = R.Next(0, int.MaxValue); double tmpchance = High ? maxRoll - chance : chance; MPBetPlace betplace = new MPBetPlace { client_seed = client, cond = High ? ">" : "<", hash = next, payout = (((double)(100.0m - edge) / chance) * (amount * 100000000)), target = tmpchance, wager = amount * 100000000 }; 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() == "you did not provide a valid hash") { ResetSeed(); placebetthread(High); return; } Bet tmpBet = new Bet { Amount = (decimal)amount, date = DateTime.Now, Id = tmp.bet_id, Profit = (decimal)tmp.profit/100000000m, Roll = (decimal)tmp.outcome, high = High, Chance = (decimal)chance, nonce = 0, serverhash = next, serverseed = tmp.secret.ToString(), clientseed = client.ToString() }; next = tmp.next_hash; //lastupdate = DateTime.Now; balance += tmp.profit / 100000000.0; //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.0); FinishedBet(tmpBet); } catch (AggregateException e) { if (e.InnerException.InnerException.Message.Contains("tsl/ssl") || e.InnerException.Message.Contains("502")) { Thread.Sleep(200); placebetthread(High); } } catch (Exception e2) { } }
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", System.Globalization.NumberFormatInfo.InvariantInfo), perc = chance.ToString("0.0000", System.Globalization.NumberFormatInfo.InvariantInfo), 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); if (BetResult.info == null) { 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, Profit = BetResult.amount }; 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); } else { Parent.updateStatus(BetResult.info); } } catch (Exception Ex) { Parent.DumpLog(Ex.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 + 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 { 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 = 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.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: 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 _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() { 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, 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 High) { try { Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, (bool)High ? "High" : "Low")); 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 = (double)(((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(); SafeDiceBetResult tmpResult = json.JsonDeserialize<SafeDiceBetResult>(sEmitResponse); Bet bet = new Bet(); bet.Amount = (decimal)tmpResult.amount / (curen != 2 ? 100000000m : 1000000000000m); bet.date = json.ToDateTime2(tmpResult.processTime); 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; 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 += (double)bet.Profit; ++bets; wagered += (double)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 += (double)bet.Profit; FinishedBet(bet); } 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."); }*/ } } }
void placebetthread(object _High) { try { bool High = (bool)_High; int client = R.Next(0, int.MaxValue); HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://api.moneypot.com/v1/bets/simple-dice?access_token=" + token); betrequest.CookieContainer = new CookieContainer(); betrequest.CookieContainer.Add(new Cookie("sessionId", token, "/", "moneypot.com")); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.Method = "POST"; double tmpchance = High ? maxRoll - chance : chance; MPBetPlace betplace = new MPBetPlace { client_seed = client, cond = High ? ">" : "<", hash = next, payout = (((double)(100.0m - edge) / chance) * (amount * 100000000)), target = tmpchance, wager = amount * 100000000 }; string post = json.JsonSerializer <MPBetPlace>(betplace); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/json"; using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); MPBet tmp = json.JsonDeserialize <MPBet>(sEmitResponse); Bet tmpBet = new Bet { Amount = (decimal)amount, date = DateTime.Now, Id = tmp.bet_id, Profit = (decimal)tmp.profit / 100000000m, Roll = (decimal)tmp.outcome, high = High, Chance = (decimal)chance, nonce = 0, serverhash = next, serverseed = tmp.secret.ToString(), clientseed = client.ToString() }; next = tmp.next_hash; //lastupdate = DateTime.Now; balance += tmp.profit / 100000000.0; //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.0); FinishedBet(tmpBet); } 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); } } }
void PlaceBetThread() { try { Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, this.chance, High ? "High" : "Low")); HttpWebRequest loginrequest = HttpWebRequest.Create("https://www.999dice.com/api/web.aspx") as HttpWebRequest; if (Prox != null) loginrequest.Proxy = Prox; string post = string.Format("a=GetServerSeedHash&s={0}", sessionCookie); string sEmitResponse = ""; double chance = (999999.0) * (this.chance / 100.0); HttpWebResponse EmitResponse; if (next == "" && next!=null) { loginrequest = HttpWebRequest.Create("https://www.999dice.com/api/web.aspx") as HttpWebRequest; if (Prox != null) loginrequest.Proxy = Prox; post = string.Format("a=GetServerSeedHash&s={0}", sessionCookie); loginrequest.Method = "POST"; loginrequest.ContentLength = post.Length; loginrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(loginrequest.GetRequestStream())) { writer.Write(post); } EmitResponse = (HttpWebResponse)loginrequest.GetResponse(); sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); if (sEmitResponse.Contains("error")) { if (BetRetries++ < 3) { Thread.Sleep(200); PlaceBetThread(); return; } else throw new Exception(); } string Hash = next = json.JsonDeserialize<d999Hash>(sEmitResponse).Hash; } loginrequest = HttpWebRequest.Create("https://www.999dice.com/api/web.aspx") as HttpWebRequest; if (Prox != null) loginrequest.Proxy = Prox; string ClientSeed = r.Next(0, int.MaxValue).ToString(); post = string.Format("a=PlaceBet&s={0}&PayIn={1}&Low={2}&High={3}&ClientSeed={4}&Currency={5}&ProtocolVersion=2", sessionCookie, (long)Math.Ceiling(amount * 100000000.0), High ? 999999 - (int)chance : 0, High ? 999999 : (int)chance, ClientSeed, Currency); loginrequest.Method = "POST"; loginrequest.ContentLength = post.Length; loginrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(loginrequest.GetRequestStream())) { writer.Write(post); } EmitResponse = (HttpWebResponse)loginrequest.GetResponse(); sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); d999Bet tmpBet = json.JsonDeserialize<d999Bet>(sEmitResponse); if (amount>=21) { } if (tmpBet.ChanceTooHigh==1 || tmpBet.ChanceTooLow==1| tmpBet.InsufficientFunds == 1|| tmpBet.MaxPayoutExceeded==1|| tmpBet.NoPossibleProfit==1) { throw new Exception(); } if (tmpBet.BetId==0) { } 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++; BetRetries = 0; sqlite_helper.InsertSeed(tmp.serverhash, tmp.serverseed); next = tmpBet.Next; FinishedBet(tmp); } catch { System.Windows.Forms.MessageBox.Show("Something went wrong! betting stopped."); } }
static Bet BetParser(SQLiteDataReader Reader) { string site = ""; Bet tmp = new Bet(); for (int i = 0; i < Reader.FieldCount; i++) { switch (Reader.GetName(i)) { case "betid": tmp.Id = (long)Reader[i]; break; case "date": tmp.date = (DateTime)Reader[i]; break; case "stake": tmp.Amount = (decimal)Reader[i]; break; case "profit": tmp.Profit = (decimal)Reader[i]; break; case "chance": tmp.Chance = (decimal)Reader[i]; break; case "high": tmp.high = (short)Reader[i] == 1; break; case "lucky": tmp.Roll = (decimal)Reader[i]; break; case "hash": tmp.serverhash = (string)Reader[i]; break; case "nonce": tmp.nonce = (long)Reader[i]; break; case "uid": tmp.uid = (int)Reader[i]; break; case "Client": tmp.clientseed = (string)Reader[i]; break; case "server": tmp.serverseed = (string)Reader[i]; break; case "site": site = (string)Reader[i]; break; } } if (!string.IsNullOrEmpty(tmp.serverseed) && !string.IsNullOrEmpty(tmp.clientseed) && tmp.Roll != -1 && site != "") { switch (site) { case "JustDice": tmp.Verified = tmp.Roll == (decimal)DiceSite.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "PrimeDice": tmp.Verified = tmp.Roll == (decimal)PD.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "999Dice": tmp.Verified = tmp.Roll == (decimal)dice999.sGetLucky(tmp.serverseed, (tmp.clientseed), (int)tmp.nonce, /*(long)(tmp.Roll*10000m),*/ tmp.serverhash); break; case "SafeDice": tmp.Verified = tmp.Roll == (decimal)SafeDice.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "PRCDice": tmp.Verified = tmp.Roll == (decimal)PRC.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "RollinIO": tmp.Verified = tmp.Roll == (decimal)rollin.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "BitDice": tmp.Verified = tmp.Roll == (decimal)bitdice.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "BetterBets": tmp.Verified = tmp.Roll == (decimal)BB.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "MoneyPot": tmp.Verified = tmp.Roll == (decimal)moneypot.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "MoneroDice": tmp.Verified = tmp.Roll == (decimal)MoneroDice.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "FortuneJack": tmp.Verified = tmp.Roll == (decimal)FortuneJack.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "Coinichiwa": tmp.Verified = tmp.Roll == (decimal)Coinichiwa.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "CoinMillions": tmp.Verified = tmp.Roll == (decimal)CoinMillions.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "CryptoGames": tmp.Verified = tmp.Roll == (decimal)cryptogames.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "Bitsler": tmp.Verified = tmp.Roll == (decimal)Bitsler.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "Wealthydice": tmp.Verified = tmp.Roll == (decimal)WD.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; case "SatoshiDice": tmp.Verified = tmp.Roll == (decimal)SatoshiDice.sGetLucky(tmp.serverseed, tmp.clientseed, (int)tmp.nonce); break; } } return(tmp); }
void Client_BetResult(bitstatsbet Bet) { if (Bet.user.username == username) { Bet tmp = new Bet(); tmp.Amount = decimal.Parse(Bet.amount, System.Globalization.NumberFormatInfo.InvariantInfo); tmp.date = DateTime.Parse(Bet.created_at, System.Globalization.NumberFormatInfo.InvariantInfo); tmp.Id = (decimal)(Bet.id); tmp.Profit = decimal.Parse(Bet.win, System.Globalization.NumberFormatInfo.InvariantInfo); tmp.Roll = decimal.Parse(Bet.lucky, System.Globalization.NumberFormatInfo.InvariantInfo); tmp.high = Bet.high; tmp.Chance = decimal.Parse(Bet.chance, System.Globalization.NumberFormatInfo.InvariantInfo); //tmp.no = decimal.Parse(Bet.amount, System.Globalization.NumberFormatInfo.InvariantInfo); FinishedBet(tmp); } }
public static Bet[] Search(bool betid, bool chance, bool stake, bool roll, bool profit, bool client, bool server, bool hash, int high, int verified, string Query, string SiteName, DateTime Start, DateTime End) { Query = Query.Replace("'", "\""); string searchSring = "select bet.*,seed.server from bet, seed where bet.hash=seed.hash "; if (SiteName != "") { searchSring += " and site = '" + SiteName + "'"; } searchSring += " ("; if (betid) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " betid like '" + Query + "'"; } if (chance) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " chance like '" + Query + "'"; } if (stake) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " stake like '" + Query + "'"; } if (roll) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " lucky like '" + Query + "'"; } if (profit) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " profit like '" + Query + "'"; } if (client) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " client like '" + Query + "'"; } if (server) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " server like '" + Query + "'"; } if (hash) { if (!searchSring.EndsWith("(")) { searchSring += " or"; } searchSring += " hash like '" + Query + "'"; } searchSring += " )"; if (high == 1) { searchSring += " and high = 1"; } else if (high == 2) { searchSring += " and high = 0"; } searchSring += "and date >= '" + Start.ToShortDateString() + "'"; searchSring += "and date <= '" + End.ToShortDateString() + "'"; //ing ( SQLiteConnection sqcon = GetConnection(); { try { sqcon.Open(); SQLiteCommand Command = new SQLiteCommand(searchSring, sqcon); SQLiteDataReader Reader = Command.ExecuteReader(); List <Bet> Bets = new List <Bet>(); while (Reader.Read()) { Bet b = (BetParser(Reader)); if ((b.Verified && verified == 1) || (!b.Verified && verified == 2) || verified == 3) { Bets.Add(b); } } sqcon.Close(); return(Bets.ToArray()); } catch { } sqcon.Close(); } return(null); }
public Bet Tobet(decimal chance) { Bet tmp = new Bet { Amount = decimal.Parse(amount, System.Globalization.NumberFormatInfo.InvariantInfo), date = DateTime.Now, Id = id, Profit = decimal.Parse(profit, System.Globalization.NumberFormatInfo.InvariantInfo), high = roll_type == "h", Chance = chance, Roll = decimal.Parse(lucky_number, System.Globalization.NumberFormatInfo.InvariantInfo) }; return tmp; }
protected void FinishedBet(Bet newBet) { Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); Parent.AddBet(newBet); Parent.GetBetResult(balance, newBet); }