Exemplo n.º 1
0
        void PlaceBetThreead(object bet)
        {
            if (Mode == 3 && TLEhash == null)
            {
                string TLE    = Client.GetAsync("tle").Result.Content.ReadAsStringAsync().Result;
                var    tleobj = json.JsonDeserialize <DDTLE>(TLE);
                TLEhash = tleobj.data.FirstOrDefault()?.hash;
            }
            PlaceBetObj   tmp5    = bet as PlaceBetObj;
            decimal       amount  = tmp5.Amount;
            decimal       chance  = tmp5.Chance;
            bool          High    = tmp5.High;
            StringContent Content = new StringContent(string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{{\"amount\":\"{0:0.00000000}\",\"symbol\":\"{1}\",\"chance\":{2:0.00},\"isHigh\":{3},\"faucet\":{4},\"tleHash\":\"{5}\"}}", amount, Currency, chance, High ? "true" : "false", this.Mode == 2?"true":"false", Mode == 3? TLEhash:null), Encoding.UTF8, "application/json");

            try
            {
                string   sEmitResponse = Client.PostAsync("play" + "?api_key=" + accesstoken + "&api_version=" + apiversion, Content).Result.Content.ReadAsStringAsync().Result;
                QuackBet newbet        = json.JsonDeserialize <QuackBet>(sEmitResponse);
                if (newbet.error != null)
                {
                    Parent.updateStatus(newbet.error);
                    return;
                }
                Bet tmp = new Bet
                {
                    //Id=newbet.ha
                    Amount     = decimal.Parse(newbet.bet.betAmount, System.Globalization.NumberFormatInfo.InvariantInfo),
                    Chance     = newbet.bet.chance,
                    clientseed = currentseed.clientSeed,
                    Currency   = Currency,
                    date       = DateTime.Now,
                    high       = High,
                    nonce      = currentseed.nonce++,
                    Profit     = decimal.Parse(newbet.bet.profit, System.Globalization.NumberFormatInfo.InvariantInfo),
                    Roll       = newbet.bet.number / 100,
                    serverhash = currentseed.serverSeedHash,
                    Id         = newbet.bet.hash,
                    Guid       = tmp5.Guid
                };
                lastupdate = DateTime.Now;
                profit     = decimal.Parse(newbet.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo);
                wagered    = decimal.Parse(newbet.user.volume, System.Globalization.NumberFormatInfo.InvariantInfo);
                balance    = decimal.Parse(newbet.user.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                wins       = newbet.user.wins;
                bets       = newbet.user.bets;
                losses     = bets - wins;
                FinishedBet(tmp);
            }
            catch (Exception e)
            {
                Parent.updateStatus("There was an error placing your bet.");
                Parent.DumpLog(e.ToString(), -1);
            }
        }
Exemplo n.º 2
0
        void PlaceBetThreead(object bet)
        {
            PlaceBetObj   tmp5    = bet as PlaceBetObj;
            decimal       amount  = tmp5.Amount;
            decimal       chance  = tmp5.Chance;
            bool          High    = tmp5.High;
            StringContent Content = new StringContent(string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{{\"amount\":\"{0:0.00000000}\",\"symbol\":\"{1}\",\"chance\":{2:0.00},\"isHigh\":{3}}}", amount, Currency, chance, High ? "true" : "false"), Encoding.UTF8, "application/json");

            try
            {
                string   sEmitResponse = Client.PostAsync("play", Content).Result.Content.ReadAsStringAsync().Result;
                QuackBet newbet        = json.JsonDeserialize <QuackBet>(sEmitResponse);
                if (newbet.error != null)
                {
                    Parent.updateStatus(newbet.error);
                    return;
                }
                Bet tmp = new Bet
                {
                    //Id=newbet.ha
                    Amount     = decimal.Parse(newbet.bet.betAmount, System.Globalization.NumberFormatInfo.InvariantInfo),
                    Chance     = newbet.bet.chance,
                    clientseed = currentseed.clientSeed,
                    Currency   = Currency,
                    date       = DateTime.Now,
                    high       = High,
                    nonce      = currentseed.nonce++,
                    Profit     = decimal.Parse(newbet.bet.profit, System.Globalization.NumberFormatInfo.InvariantInfo),
                    Roll       = newbet.bet.number / 100,
                    serverhash = currentseed.serverSeedHash,
                    Id         = newbet.bet.hash
                };
                lastupdate = DateTime.Now;
                profit     = decimal.Parse(newbet.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo);
                wagered    = decimal.Parse(newbet.user.volume, System.Globalization.NumberFormatInfo.InvariantInfo);
                balance    = decimal.Parse(newbet.user.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                wins       = newbet.user.wins;
                bets       = newbet.user.bets;
                losses     = bets - wins;
                FinishedBet(tmp);
            }
            catch (Exception e)
            {
                Parent.updateStatus("There was an error placing your bet.");
            }
        }