Example #1
0
        void PlaceBetThread(object _High)
        {
            try
            {
                lastbet = DateTime.Now;
                bool   High      = (bool)_High;
                double tmpchance = High ? 99.99 - chance : chance;
                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", tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo)));
                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         = double.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0;
                    bets            = tmp.statistics.bets;

                    losses = tmp.statistics.losses;
                    profit = double.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0;

                    wagered     = double.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0;
                    wins        = (tmp.statistics.wins);
                    LastBalance = 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));
                    }
                }
            }
        }
Example #2
0
        void PlaceBetThread(object _High)
        {
            try
            {
                PlaceBetObj tmp9   = _High as PlaceBetObj;
                bool        High   = tmp9.High;
                decimal     amount = tmp9.Amount;
                decimal     chance = tmp9.Chance;
                lastbet = DateTime.Now;
                //bool High = (bool)_High;
                decimal tmpchance  = High ? maxRoll - chance : chance;
                string  sendchance = tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo);
                Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low"));

                string jsoncontent = json.JsonSerializer <RollinBetPlace>(new RollinBetPlace {
                    bet_amount = decimal.Parse((amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo), System.Globalization.NumberFormatInfo.InvariantInfo),
                    bet_number = decimal.Parse(sendchance, System.Globalization.NumberFormatInfo.InvariantInfo),
                    prediction = High ? "bigger" : "smaller",
                    seed       = R.Next(int.MaxValue).ToString()
                });
                StringContent Content = new StringContent(jsoncontent, Encoding.UTF8, "application/json");
                Client.DefaultRequestHeaders.Remove("X-API-Nonce");

                string x = mfagenerator.GetCode(Key);
                Client.DefaultRequestHeaders.Add("X-API-Nonce", x);
                HttpResponseMessage tmpresp = Client.PostAsync("games/dice/play", Content).Result;
                string    sEmitResponse     = tmpresp.Content.ReadAsStringAsync().Result;
                RollinBet tmp = json.JsonDeserialize <RollinBet>(sEmitResponse);
                if (tmp.errors != null && tmp.errors.Length > 0)
                {
                    Parent.updateStatus(tmp.errors[0]);
                }
                else
                {
                    Bet tmp2 = tmp.ToBet();
                    tmp2.serverhash = server_hash;
                    server_hash     = tmp.customer.server_hash;
                    balance         = decimal.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m;
                    bets            = tmp.statistics.bets;

                    losses = tmp.statistics.losses;
                    profit = decimal.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m;

                    wagered     = decimal.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m;
                    wins        = (tmp.statistics.wins);
                    LastBalance = DateTime.Now;
                    tmp2.date   = DateTime.Now;
                    FinishedBet(tmp2);
                    retrycount = 0;
                }
            }
            catch (Exception E)
            {
                if (retrycount++ < 3)
                {
                    PlaceBetThread(High);
                    return;
                }
                Parent.updateStatus(E.Message);
                if (Parent.logging > 1)
                {
                    using (StreamWriter sw = File.AppendText("log.txt"))
                    {
                        sw.WriteLine(E.Message);
                        sw.WriteLine(E.StackTrace);
                        sw.WriteLine(json.JsonSerializer <System.Collections.IDictionary> (E.Data));
                    }
                }
            }
        }
Example #3
0
        void PlaceBetThread(object _High)
        {
            try
            {
                lastbet = DateTime.Now;
                bool High = (bool)_High;
                Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low"));
                HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/games/dice/play");
                betrequest.CookieContainer = Cookies;
                betrequest.Headers.Add("X-CSRF-Token", Token);
                if (Prox != null)
                {
                    betrequest.Proxy = Prox;
                }
                betrequest.Method = "POST";
                double tmpchance = High ? 99.99 - chance : chance;
                string post      = string.Format("bet_amount={0}&bet_number={1}&prediction={2}&seed={3}", (amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo), tmpchance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo), High ? "bigger" : "smaller", R.Next(int.MaxValue));
                betrequest.ContentLength = post.Length;
                betrequest.ContentType   = "application/x-www-form-urlencoded; charset=UTF-8";

                using (var writer = new StreamWriter(betrequest.GetRequestStream()))
                {
                    writer.Write(post);
                }
                HttpWebResponse EmitResponse  = (HttpWebResponse)betrequest.GetResponse();
                string          sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();
                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         = double.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0;
                    bets            = tmp.statistics.bets;

                    losses = tmp.statistics.losses;
                    profit = double.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0;

                    wagered     = double.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0;
                    wins        = (tmp.statistics.wins);
                    LastBalance = DateTime.Now;
                    FinishedBet(tmp2);
                }
            }
            catch (Exception E)
            {
                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));
                    }
                }
            }
        }