public bool RemoveTheirItem(int appId, long contextId, long assetId, long amount = 1) { var asset = new TradeStatusUser.TradeAsset(); asset.CreateItemAsset(appId, contextId, assetId, amount); return(ShouldUpdate(TheirOfferedItems.RemoveItem(asset))); }
public TradeOffer(OfferSession session, Offer offer) { var myAssets = new List <TradeStatusUser.TradeAsset>(); var myMissingAssets = new List <TradeStatusUser.TradeAsset>(); var theirAssets = new List <TradeStatusUser.TradeAsset>(); var theirMissingAssets = new List <TradeStatusUser.TradeAsset>(); if (offer.ItemsToGive != null) { foreach (var asset in offer.ItemsToGive) { var tradeAsset = new TradeStatusUser.TradeAsset(); //todo: for currency items we need to check descriptions for currency bool and use the appropriate method tradeAsset.CreateItemAsset(Convert.ToInt64(asset.AppId), Convert.ToInt64(asset.ContextId), Convert.ToInt64(asset.AssetId), Convert.ToInt64(asset.Amount)); //todo: for missing assets we should store them somewhere else? if offer state is active we shouldn't be here though if (!asset.IsMissing) { myAssets.Add(tradeAsset); } else { myMissingAssets.Add(tradeAsset); } } } if (offer.ItemsToReceive != null) { foreach (var asset in offer.ItemsToReceive) { var tradeAsset = new TradeStatusUser.TradeAsset(); tradeAsset.CreateItemAsset(Convert.ToInt64(asset.AppId), Convert.ToInt64(asset.ContextId), Convert.ToInt64(asset.AssetId), Convert.ToInt64(asset.Amount)); if (!asset.IsMissing) { theirAssets.Add(tradeAsset); } else { theirMissingAssets.Add(tradeAsset); } } } this.Session = session; //assume public individual PartnerSteamId = new SteamID(Convert.ToUInt32(offer.AccountIdOther), EUniverse.Public, EAccountType.Individual); TradeOfferId = offer.TradeOfferId; OfferState = offer.TradeOfferState; IsOurOffer = offer.IsOurOffer; ExpirationTime = offer.ExpirationTime; TimeCreated = offer.TimeCreated; TimeUpdated = offer.TimeUpdated; TradeID = offer.TradeID; Message = offer.Message; Items = new TradeStatus(myAssets, theirAssets); }