Наследование: IFutClient
Пример #1
0
        public async void DoRelog()
        {
            
            lblTimer.Text = @"";
            lblRelog.Text = @"Performing relog";
            WriteLog.DoWrite("Performing relog");
            Platform platform = Platform.Pc;
            switch (int.Parse(_account[3]))
            {
                case 0:
                    platform = Platform.Pc;
                    break;
                case 1:
                    platform = Platform.Ps3;
                    break;
                case 2:
                    platform = Platform.Ps4;
                    break;
                case 3:
                    platform = Platform.Xbox360;
                    break;
                case 4:
                    platform = Platform.XboxOne;
                    break;
            }

            
            try
            {
                CookieContainer cookie = CookieUtil.ReadCookiesFromDisk("cookies\\" + _account[0] + "_cookie.dat");
                Client = new FutClient(cookie);
                var loginDetails = new LoginDetails(_account[0], _account[1], _account[2], platform);
                await Client.LoginAsync(loginDetails, null);
                this.Close();
            }
            catch (Exception)
            {
                if (_i >= 5)
                {
                    WriteLog.DoWrite("Relog failed 5 times, exiting FutBud");
                    Application.Exit();
                }
                WriteLog.DoWrite("Relog failed");
                lblRelog.Text = (@"Relog failed");
                var start = DateTime.UtcNow;
                _endTime = start.AddMinutes(5);
                tmrCountdown.Enabled = true;
                _i++;
            }
        }
Пример #2
0
        public FormMain(FutClient client, string[] account)
        {
            InitializeComponent();
            _client = client;
            this._account = account;
            StyleManager = metroStyleManager;

            try
            {
                metroStyleManager.Style = Properties.Settings.Default.MetroColor;
                metroStyleManager.Theme = Properties.Settings.Default.MetroTheme;
                mgTable.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;

                tbSearch.Text = (Math.Round((double) _searchMs/1000, 1)).ToString(CultureInfo.InvariantCulture);
                tbChecktradepile.Text = (_tradepileMs/1000).ToString();

                numericUpDownPricefix.Value = _maxplayersonrequest;
                tmrChecktradepile.Interval = _tradepileMs;
                tmrSearchRequest.Interval = _searchMs;
                trackbarSearch.Value = _searchMs;
                trackbarChecktradepile.Value = _tradepileMs;
                cbPlaySound.Checked = _playSound;
                cbResetCounter.Checked = _resetCounter;
                cbDebug.Checked = _debug;
                cbAutoprice.Checked = _autoPrice;
                nudBuy.Value = _buyperc*100;
                nudSell.Value = _sellperc*100;
            }
            catch (Exception)
            {
                WriteLog.DoWrite("Could not load settings");
            }
            lblAccount.Text = account[0];
            lblVersion.Text = @"Version " + ProductVersion;
            if(_client!=null)
                GetCredits();

        }
Пример #3
0
        private async void SearchMarket()
        {
            if (_i >= mgTable.Rows.Count - 1) //check if i needs a reset
                _i = 0;

                try
                   {
                
                    var searchParameters = new PlayerSearchParameters
                    {
                        Page = 1,
                        MaxBuy = uint.Parse(mgTable[2, _i].Value.ToString()),
                        ResourceId = uint.Parse(mgTable[8, _i].Value.ToString())

                    };

                    // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
                    uint.Parse(mgTable[3, _i].Value.ToString()); //check sell for null

                    var searchResponse = await _client.SearchAsync(searchParameters);
                    if (_debug)
                    {
                        tbLog.SelectionColor = Color.Blue;
                        tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Search for Player " +
                                             mgTable[1, _i].Value + Environment.NewLine;
                        tbLog.SelectionColor = Color.Blue;
                        tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " " +
                                             searchResponse.AuctionInfo.Count + " Auctions found" +
                                             Environment.NewLine;
                    }
                    foreach (var auctionInfo in searchResponse.AuctionInfo)
                    {
                        // Handle auction data
                        if (searchResponse.AuctionInfo.Count < _maxplayersonrequest) //check for pricefix
                        {
                            await _client.PlaceBidAsync(auctionInfo, auctionInfo.BuyNowPrice);
                            //Buyout Item
                            await _client.SendItemToTradePileAsync(auctionInfo.ItemData);

                            //send Item to Tradepile
                            int counter = int.Parse(mgTable[4, _i].Value.ToString());
                            counter++;
                            mgTable[4, _i].Value = counter.ToString();
                            tbLog.SelectionColor = Color.Goldenrod;
                            tbLog.SelectedText = DateTime.Now.ToLongTimeString() +
                                                 " Buyout for " + mgTable[1, _i].Value + " for " + auctionInfo.BuyNowPrice + " Credits" + Environment.NewLine;
                            WriteLog.DoWrite("Buyout for " + mgTable[1, _i].Value + " for " + auctionInfo.BuyNowPrice + " Credits");
                            if (_playSound)
                                SystemSounds.Exclamation.Play();
                            GetCredits();
                        }
                    }
                  }
            
            catch (NotEnoughCreditException)
            {
                WriteLog.DoWrite("Not enough credits");
                tbLog.SelectionColor = Color.Red;
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Not enough credits " +
                                     Environment.NewLine;
            }
            catch (CaptchaTriggeredException) //Captcha Triggered!
            {
                WriteLog.DoWrite("Captach triggered");
                tbLog.SelectionColor = Color.Red;
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Captcha triggered " +
                                     Environment.NewLine;
                Stopbot();
            }
            catch (ExpiredSessionException) //Session Expired
            {
                WriteLog.DoWrite("Session Expired");
                tbLog.SelectionColor = Color.Red;
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Session Expired " +
                                     Environment.NewLine;
                Stopbot();
                using (var x = new FormRelog(_account))
                {
                    x.ShowDialog();
                    this._client = x.Client;
                }
                Startbot();
            }
            catch (FormatException)
            {
                tbLog.SelectionColor = Color.Red;
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Entry " + _i +
                                     " has an invalid Format or is null" +
                                     Environment.NewLine;
                Stopbot();
            }
            catch (NullReferenceException)
            {
                tbLog.SelectionColor = Color.Red;
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Entry " + _i +
                                     " has an invalid Format or is null" +
                                     Environment.NewLine;
                Stopbot();
            }
            catch (Exception ex)
            {
                WriteLog.DoWrite("Error on search: " + ex.Message);
                tbLog.SelectionColor = Color.Red;
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() +
                                     " Error on search - Possible temp. ban. Check the market on the WebApp. " + ex.Message +
                                     Environment.NewLine;
            }
            finally
            {
                _i++;
            }
        }