private async void butGetTradepile_Click(object sender, EventArgs e)
    {
        //var client = new FutClient();
        var tradePileResponse = await client.GetTradePileAsync();

        Console.WriteLine(tradePileResponse);
    }
示例#2
0
        private async void Checktradepile()
        {
            try
            {
                var tradePileResponse = await _client.GetTradePileAsync();

                foreach (var response in tradePileResponse.AuctionInfo)
                {
                    for (var i = 0; i < mgTable.Rows.Count - 1; i++)
                    {
                        if (response.ItemData != null &&
                            mgTable[8, i].Value.ToString().Contains(response.ItemData.AssetId.ToString()))
                        {
                            if ((response.TradeState == null || response.TradeState.Contains("expired")) &&
                                response.ItemData != null) //Player to list
                            {
                                var sellprice = uint.Parse(mgTable[3, i].Value.ToString());
                                if (sellprice == 0) //if price = 0 do not sell
                                {
                                    break;
                                }

                                if (sellprice > 100000)
                                {
                                    var auctionDetails = new AuctionDetails(response.ItemData.Id,
                                                                            AuctionDuration.OneHour,
                                                                            RoundPrices.RoundToFinal(sellprice - 1000), sellprice); //bidprice, buynow price
                                    await _client.ListAuctionAsync(auctionDetails);
                                }
                                else
                                {
                                    var auctionDetails = new AuctionDetails(response.ItemData.Id,
                                                                            AuctionDuration.OneHour,
                                                                            RoundPrices.RoundToFinal(sellprice - 250), sellprice); //bidprice, buynow price
                                    await _client.ListAuctionAsync(auctionDetails);
                                }
                                continue;
                            }
                            if (response.TradeState != null && response.ItemData != null &&
                                (response.TradeState.Contains("closed"))) //Player sold
                            {
                                await _client.RemoveFromTradePileAsync(response);

                                WriteLog.DoWrite(mgTable[1, i].Value + " sold for " + response.BuyNowPrice);
                                tbLog.SelectionColor = Color.Black;
                                tbLog.SelectedText   =
                                    (DateTime.Now.ToLongTimeString() + " " + mgTable[1, i].Value +
                                     " sold for " +
                                     response.BuyNowPrice) +
                                    Environment.NewLine;
                                if (_playSound)
                                {
                                    SystemSounds.Exclamation.Play();
                                }
                            }

                            //TODO ITEMS ON TRADEPILE

                            /*if (response.TradeState != null && response.ItemData != null) //Player on tradepile
                             *  {
                             *      tbTradepile.Text = "" + tbTradepile.Text + dgList[0, i].Value + " - " +
                             *                         response.BuyNowPrice + " Coins - " + response.Expires / 60 +
                             *                         " Minutes left " +
                             *                   Environment.NewLine;
                             *      tbTradepile.Text = "" + tbTradepile.Text + "***********************************************" +
                             *                   Environment.NewLine;
                             *
                             *  }
                             */
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                tbLog.SelectionColor = Color.Red;
                WriteLog.DoWrite("Tradepile Error: " + ex);
                tbLog.SelectedText = DateTime.Now.ToLongTimeString() + " Tradepile Error" + Environment.NewLine;
            }
            finally
            {
                GetCredits();
            }
        }