Ejemplo n.º 1
0
 void SetStats(WolfBetStats Stats)
 {
     try
     {
         PropertyInfo tmp = typeof(Dice).GetProperty(CurrentCurrency.ToLower());
         if (tmp != null)
         {
             WBStat stat = tmp.GetValue(Stats.dice) as WBStat;
             if (stat != null)
             {
                 this.Stats.Bets    = int.Parse(stat.total_bets);
                 this.Stats.Wins    = int.Parse(stat.win);
                 this.Stats.Losses  = int.Parse(stat.lose);
                 this.Stats.Wagered = decimal.Parse(stat.waggered, System.Globalization.NumberFormatInfo.InvariantInfo);
                 this.Stats.Profit  = decimal.Parse(stat.profit, System.Globalization.NumberFormatInfo.InvariantInfo);
             }
         }
     }
     catch
     {
         this.Stats.Bets    = 0;
         this.Stats.Wins    = 0;
         this.Stats.Losses  = 0;
         this.Stats.Wagered = 0;
         this.Stats.Profit  = 0;
     }
 }
Ejemplo n.º 2
0
        void UpdateStats(WolfBetStats Stats)
        {
            PropertyInfo tmp = typeof(Dice).GetProperty(Currency.ToLower());

            if (tmp != null)
            {
                WBStat stat = tmp.GetValue(Stats.dice) as WBStat;
                if (stat != null)
                {
                    this.bets    = stat.total_bets;
                    this.wins    = int.Parse(stat.win);
                    this.losses  = int.Parse(stat.lose);
                    this.wagered = decimal.Parse(stat.waggered, System.Globalization.NumberFormatInfo.InvariantInfo);
                    this.profit  = decimal.Parse(stat.profit, System.Globalization.NumberFormatInfo.InvariantInfo);
                    Parent.updateBets(bets);
                    Parent.updateWins(wins);
                    Parent.updateLosses(losses);
                    Parent.updateWagered(wagered);
                    Parent.updateProfit(profit);
                }
            }
        }
Ejemplo n.º 3
0
        protected override void _UpdateStats()
        {
            string         sEmitResponse = Client.GetStringAsync("user/balances").Result;
            WolfBetProfile tmpProfile    = json.JsonDeserialize <WolfBetProfile>(sEmitResponse);

            if (tmpProfile.user != null)
            {
                //set balance here
                foreach (Balance x in tmpProfile.user.balances)
                {
                    if (x.currency.ToLower() == CurrentCurrency.ToLower())
                    {
                        Stats.Balance = decimal.Parse(x.amount, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                }
                //get stats
                //set stats
                sEmitResponse = Client.GetStringAsync("user/stats/bets").Result;
                WolfBetStats tmpStats = json.JsonDeserialize <WolfBetStats>(sEmitResponse);
                SetStats(tmpStats);
            }
        }
Ejemplo n.º 4
0
 void GetBalanceThread()
 {
     while (ispd)
     {
         try
         {
             if (((DateTime.Now - lastupdate).TotalSeconds > 30 || ForceUpdateStats))
             {
                 lastupdate       = DateTime.Now;
                 ForceUpdateStats = false;
                 string         sEmitResponse = Client.GetStringAsync("user/profile").Result;
                 WolfBetProfile tmpProfile    = json.JsonDeserialize <WolfBetProfile>(sEmitResponse);
                 if (tmpProfile.user != null)
                 {
                     //set balance here
                     foreach (Balance x in tmpProfile.user.balances)
                     {
                         if (x.currency.ToLower() == Currency.ToLower())
                         {
                             this.balance = decimal.Parse(x.amount, System.Globalization.NumberFormatInfo.InvariantInfo);
                             Parent.updateBalance(balance);
                         }
                     }
                     //get stats
                     //set stats
                     sEmitResponse = Client.GetStringAsync("user/stats/bets").Result;
                     WolfBetStats tmpStats = json.JsonDeserialize <WolfBetStats>(sEmitResponse);
                     UpdateStats(tmpStats);
                 }
             }
         }
         catch (Exception e)
         {
             Parent.DumpLog(e.ToString(), -1);
         }
         Thread.Sleep(100);
     }
 }
Ejemplo n.º 5
0
 public override void Login(string Username, string Password, string twofa)
 {
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                            | SecurityProtocolType.Tls11
                                            | SecurityProtocolType.Tls12
                                            | SecurityProtocolType.Ssl3;
     ClientHandlr = new HttpClientHandler {
         UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
     };
     Client = new HttpClient(ClientHandlr)
     {
         BaseAddress = new Uri(URL + "/api/v1/")
     };
     Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
     Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
     Client.DefaultRequestHeaders.Add("UserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36");
     Client.DefaultRequestHeaders.Add("Origin", "https://wolf.bet");
     Client.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
     try
     {
         /*HttpResponseMessage resp1 = Client.GetAsync("").Result;
          * string s1 = "";
          * if (resp1.IsSuccessStatusCode)
          * {
          *  s1 = resp1.Content.ReadAsStringAsync().Result;
          *  //Parent.DumpLog("BE login 2.1", 7);
          * }
          * else
          * {
          *  //Parent.DumpLog("BE login 2.2", 7);
          *  if (resp1.StatusCode == HttpStatusCode.ServiceUnavailable)
          *  {
          *      s1 = resp1.Content.ReadAsStringAsync().Result;
          *      //cflevel = 0;
          *      System.Threading.Tasks.Task.Factory.StartNew(() =>
          *      {
          *          System.Windows.Forms.MessageBox.Show($"{Name} has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
          *      });
          *      if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, URL.Replace("https://","")))
          *      {
          *
          *          finishedlogin(false);
          *          return;
          *      }
          *
          *  }
          *  //Parent.DumpLog("BE login 2.3", 7);
          * }
          * Client.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");
          * string mfa = twofa==""?"": $",\"code\":\"{twofa}\"";
          * string LoginString = $"{{\"login\":\"{Username}\",\"password\":\"{Password}\"{mfa}}}";
          * HttpContent cont = new StringContent(LoginString);
          * cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
          * HttpResponseMessage resp2 = Client.PostAsync("login", cont).Result;
          *
          * if (resp2.IsSuccessStatusCode)
          * {
          *
          * }
          * string sEmitResponse = resp2.Content.ReadAsStringAsync().Result;
          * WolfBetLogin LoginResponse = json.JsonDeserialize<WolfBetLogin>(sEmitResponse);*/
         if (Password != null)
         {
             Client.DefaultRequestHeaders.Add("authorization", "Bearer " + Password);
         }
         string sEmitResponse = Client.GetStringAsync("user/profile").Result;
         try
         {
             WolfBetProfile tmpProfile = json.JsonDeserialize <WolfBetProfile>(sEmitResponse);
             if (tmpProfile.user != null)
             {
                 //set balance here
                 foreach (Balance x in tmpProfile.user.balances)
                 {
                     if (x.currency.ToLower() == Currency.ToLower())
                     {
                         this.balance = decimal.Parse(x.amount, System.Globalization.NumberFormatInfo.InvariantInfo);
                         Parent.updateBalance(balance);
                     }
                 }
                 //get stats
                 //set stats
                 sEmitResponse = Client.GetStringAsync("user/stats/bets").Result;
                 WolfBetStats tmpStats = json.JsonDeserialize <WolfBetStats>(sEmitResponse);
                 UpdateStats(tmpStats);
                 ispd       = true;
                 lastupdate = DateTime.Now;
                 new Thread(new ThreadStart(GetBalanceThread)).Start();
                 this.finishedlogin(true);
                 return;
             }
         }
         catch (Exception e)
         {
             Parent.DumpLog(e.ToString(), -1);
             Parent.DumpLog(sEmitResponse, -1);
             Parent.updateStatus("Error: " + sEmitResponse);
         }
     }
     catch (Exception e)
     {
         Parent.DumpLog(e.ToString(), -1);
     }
     this.finishedlogin(false);
 }
Ejemplo n.º 6
0
 public override void Login(string Username, string Password, string twofa)
 {
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                            | SecurityProtocolType.Tls11
                                            | SecurityProtocolType.Tls12
                                            | SecurityProtocolType.Ssl3;
     ClientHandlr = new HttpClientHandler {
         UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
     };
     Client = new HttpClient(ClientHandlr)
     {
         BaseAddress = new Uri(URL + "/api/v1/")
     };
     Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
     Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
     Client.DefaultRequestHeaders.Add("UserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36");
     Client.DefaultRequestHeaders.Add("Origin", "https://wolf.bet");
     Client.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
     try
     {
         if (Password != null)
         {
             Client.DefaultRequestHeaders.Add("authorization", "Bearer " + Password);
         }
         string sEmitResponse = Client.GetStringAsync("user/balances").Result;
         try
         {
             WolfBetProfile tmpProfile = json.JsonDeserialize <WolfBetProfile>(sEmitResponse);
             if (tmpProfile.balances != null)
             {
                 //set balance here
                 foreach (Balance x in tmpProfile.balances)
                 {
                     if (x.currency.ToLower() == Currency.ToLower())
                     {
                         this.balance = decimal.Parse(x.amount, System.Globalization.NumberFormatInfo.InvariantInfo);
                         Parent.updateBalance(balance);
                     }
                 }
                 //get stats
                 //set stats
                 sEmitResponse = Client.GetStringAsync("user/stats/bets").Result;
                 WolfBetStats tmpStats = json.JsonDeserialize <WolfBetStats>(sEmitResponse);
                 UpdateStats(tmpStats);
                 ispd       = true;
                 lastupdate = DateTime.Now;
                 new Thread(new ThreadStart(GetBalanceThread)).Start();
                 this.finishedlogin(true);
                 return;
             }
         }
         catch (Exception e)
         {
             Parent.DumpLog(e.ToString(), -1);
             Parent.DumpLog(sEmitResponse, -1);
             Parent.updateStatus("Error: " + sEmitResponse);
         }
     }
     catch (Exception e)
     {
         Parent.DumpLog(e.ToString(), -1);
     }
     this.finishedlogin(false);
 }
Ejemplo n.º 7
0
        public override void Login(string Username, string Password, string twofa)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                   | SecurityProtocolType.Tls11
                                                   | SecurityProtocolType.Tls12
                                                   | SecurityProtocolType.Ssl3;
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri(URL + "/api/v1/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            Client.DefaultRequestHeaders.Add("UserAgent", Parent.UserAgent);
            try
            {
                string      mfa         = twofa == ""?"": $",\"code\":\"{twofa}\"";
                string      LoginString = $"{{\"login\":\"{Username}\",\"password\":\"{Password}\"{mfa}}}";
                HttpContent cont        = new StringContent(LoginString);
                cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                HttpResponseMessage resp2 = Client.PostAsync("login", cont).Result;

                if (resp2.IsSuccessStatusCode)
                {
                }
                string       sEmitResponse = resp2.Content.ReadAsStringAsync().Result;
                WolfBetLogin LoginResponse = json.JsonDeserialize <WolfBetLogin>(sEmitResponse);
                if (LoginResponse.access_token != null)
                {
                    Client.DefaultRequestHeaders.Add("authorization", "Bearer " + LoginResponse.access_token);
                }
                sEmitResponse = Client.GetStringAsync("user/profile").Result;
                try
                {
                    WolfBetProfile tmpProfile = json.JsonDeserialize <WolfBetProfile>(sEmitResponse);
                    if (tmpProfile.user != null)
                    {
                        //set balance here
                        foreach (Balance x in tmpProfile.user.balances)
                        {
                            if (x.currency.ToLower() == Currency.ToLower())
                            {
                                this.balance = decimal.Parse(x.amount, System.Globalization.NumberFormatInfo.InvariantInfo);
                                Parent.updateBalance(balance);
                            }
                        }
                        //get stats
                        //set stats
                        sEmitResponse = Client.GetStringAsync("user/stats/bets").Result;
                        WolfBetStats tmpStats = json.JsonDeserialize <WolfBetStats>(sEmitResponse);
                        UpdateStats(tmpStats);
                        ispd       = true;
                        lastupdate = DateTime.Now;
                        new Thread(new ThreadStart(GetBalanceThread)).Start();
                        this.finishedlogin(true);
                        return;
                    }
                }
                catch (Exception e)
                {
                    Parent.DumpLog(e.ToString(), -1);
                    Parent.DumpLog(sEmitResponse, -1);
                    Parent.updateStatus("Error: " + sEmitResponse);
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), -1);
            }
            this.finishedlogin(false);
        }