コード例 #1
0
ファイル: SimpleUserHandler.cs プロジェクト: xaustinx/Mist
 public override void OnTradeRemoveItem(GenericInventory.Inventory.Item inventoryItem)
 {
     Bot.main.Invoke((Action)(() =>
     {
         ChatTab.AppendLog(OtherSID, "[Trade Chat] " + Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " removed: " + inventoryItem.Name + "\r\n");
     }));
 }
コード例 #2
0
        public static double GetSteamMarketPrice(SteamBot.Bot bot, GenericInventory.Inventory.Item item, bool withFee = true)
        {
            var url      = string.Format("http://steamcommunity.com/market/listings/{0}/{1}/render?currency=1", item.AppId, item.MarketHashName);
            var response = SteamWeb.Fetch(url, "GET", null, bot.botCookies, false);

            try
            {
                var           json     = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(response);
                List <double> prices   = new List <double>();
                int           count    = 0;
                var           listings = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(Convert.ToString(json.listinginfo));
                foreach (var listingItem in listings.Values)
                {
                    if (listingItem.price == 0)
                    {
                        continue;
                    }
                    if (count == 3)
                    {
                        break;
                    }
                    var basePrice = (double)listingItem.converted_price;
                    var fee       = withFee ? (double)listingItem.converted_fee : 0;
                    var price     = (double)((basePrice + fee) / 100);
                    prices.Add(price);
                    count++;
                }
                var totalPrices = 0.0;
                foreach (var price in prices)
                {
                    totalPrices += price;
                }
                var averagePrice = prices.Count > 0 ? Math.Round(totalPrices / prices.Count, 2) : 0;
                return(averagePrice);
            }
            catch
            {
                return(0);
            }
        }
コード例 #3
0
 public override void OnTradeAddItem(GenericInventory.Inventory.Item inventoryItem)
 {
 }
コード例 #4
0
 public abstract void OnTradeRemoveItem(GenericInventory.Inventory.Item inventoryItem);