Beispiel #1
0
        /// <summary>
        /// Returns the ItemPrices of the items with the given item IDs
        /// </summary>
        /// <param name="itemIds">The items to search for</param>
        /// <returns>Dictionary containing all item prices for the given items</returns>
        public IDictionary <int, ItemPrices> GetItemPrices(ICollection <int> itemIds)
        {
            Dictionary <int, ItemPrices> prices = new Dictionary <int, ItemPrices>();

            try
            {
                var listings = priceService.FindAll(itemIds);
                foreach (var listing in listings)
                {
                    if (listing.Value.ItemId > 0)
                    {
                        var listingPrices = new ItemPrices()
                        {
                            HighestBuyOrder   = listing.Value.BuyOffers.UnitPrice,
                            BuyOrderQuantity  = listing.Value.BuyOffers.Quantity,
                            LowestSellListing = listing.Value.SellOffers.UnitPrice,
                            SellOrderQuantity = listing.Value.SellOffers.Quantity
                        };
                        prices.Add(listing.Key, listingPrices);
                    }
                }
            }
            catch (GW2DotNET.Common.ServiceException ex)
            {
                // Don't crash, just return null
                logger.Warn("Error finding prices: {0}", ex);
            }

            return(prices);
        }