public bool RemoveTheirItem(int appId, long contextId, long assetId, long amount = 1) { var asset = new TradeAsset(); asset.CreateItemAsset(appId, contextId, assetId, amount); return(ShouldUpdate(TheirOfferedItems.RemoveItem(asset))); }
public bool AddTheirItem(int appId, string contextId, string assetId, long amount = 1) { var asset = new TradeAsset(); asset.CreateItemAsset(appId, contextId, assetId, amount); return(this.ShouldUpdate(this.TheirOfferedItems.AddItem(asset))); }
public bool AddMyItem(int appId, long contextId, long assetId, long amount = 1) { var asset = new TradeAsset(); asset.CreateItemAsset(appId, contextId, assetId, amount); return(ShouldUpdate(MyOfferedItems.AddItem(asset))); }
public TradeOffer(OfferSession session, Offer offer) { var myAssets = new List <TradeAsset>(); var theirAssets = new List <TradeAsset>(); if (offer.ItemsToGive != null) { foreach (var asset in offer.ItemsToGive) { var tradeAsset = new TradeAsset(); // todo: for currency items we need to check descriptions for currency bool and use the appropriate method tradeAsset.CreateItemAsset( Convert.ToInt64(asset.AppId), asset.ContextId, 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); } } } if (offer.ItemsToReceive != null) { foreach (var asset in offer.ItemsToReceive) { var tradeAsset = new TradeAsset(); tradeAsset.CreateItemAsset( Convert.ToInt64(asset.AppId), asset.ContextId, asset.AssetId, Convert.ToInt64(asset.Amount)); if (!asset.IsMissing) { theirAssets.Add(tradeAsset); } } } this.Session = session; // assume public individual this.PartnerSteamId = new SteamID( Convert.ToUInt32(offer.AccountIdOther), EUniverse.Public, EAccountType.Individual); this.TradeOfferId = offer.TradeOfferId; this.OfferState = offer.TradeOfferState; this.IsOurOffer = offer.IsOurOffer; this.ExpirationTime = offer.ExpirationTime; this.TimeCreated = offer.TimeCreated; this.TimeUpdated = offer.TimeUpdated; this.Message = offer.Message; this.Items = new TradeStatus(myAssets, theirAssets); }