private double GetTradeOfferValue(SteamID partenar, List <TradeOffer.TradeStatusUser.TradeAsset> list) { if (list.Count > 0) { Console.WriteLine(list.Count); } double cent = 0; long[] contextID = new long[1]; contextID[0] = 2; List <long> appIDs = new List <long>(); GenericInventory gi = new GenericInventory(steamWeb); foreach (TradeOffer.TradeStatusUser.TradeAsset item in list) { if (!appIDs.Contains(item.AppId)) { appIDs.Add(item.AppId); } } foreach (int appID in appIDs) { gi.load(appID, contextID, partenar); foreach (TradeOffer.TradeStatusUser.TradeAsset item in list) { if (item.AppId != appID) { continue; } GenericInventory.ItemDescription ides = gi.getDescription((ulong)item.AssetId); SteamMarketPrices.Item itemInfo = smp.Items.Find(i => i.name == ides.market_hash_name); if (itemInfo != null) { cent += (itemInfo.value / 100.0); } else { Console.WriteLine("Item " + ides.market_hash_name + " not found !"); } } } return(cent); }
public bool Validate() { cent = 0.0; List <string> errors = new List <string> (); List <long> contextId = new List <long>(); contextId.Add(2); Bot.otherSteamInventory.load(Bot.BotGameUsage, contextId, OtherSID); if (Bot.sm.data.response.items != null && Bot.sm.data.response.items.Count != 0) { IEnumerable <TradeUserAssets> listOfferedItems = Trade.OtherOfferedItems; foreach (TradeUserAssets tradeItem in listOfferedItems) { if (Bot.otherSteamInventory.items.ContainsKey(tradeItem.assetid)) { SteamTrade.GenericInventory.ItemDescription description = Bot.otherSteamInventory.getDescription(tradeItem.assetid); SteamMarketPrices.Item itemInfo = Bot.sm.data.response.items.Find(i => i.name == description.name); if (itemInfo != null) { cent += (itemInfo.value / 100.0); } } } } else { errors.Add("[X] I'm busy right now, come back in 5 minutes !"); } //if (AmountAdded == TF2Value.Zero) // errors.Add ("[X] You must put up at least 1 scrap or 1 key !"); // send the errors if (errors.Count != 0) { SendTradeMessage("Hum... sorry. I can't accept that trade offer, check the messages bellow :"); foreach (string error in errors) { SendTradeMessage(error); } } return(errors.Count == 0); }