Example #1
0
        /// <summary>
        /// Returns the ItemPrices of the item with the given item ID
        /// </summary>
        /// <param name="itemId">the item to retrieve the prices for</param>
        /// <returns>The prices for the item</returns>
        public ItemPrices GetItemPrices(int itemId)
        {
            ItemPrices itemPrices = null;

            try
            {
                var prices = priceService.Find(itemId);
                if (prices != null && prices.ItemId > 0)
                {
                    itemPrices = new ItemPrices()
                    {
                        HighestBuyOrder   = prices.BuyOffers.UnitPrice,
                        BuyOrderQuantity  = prices.BuyOffers.Quantity,
                        LowestSellListing = prices.SellOffers.UnitPrice,
                        SellOrderQuantity = prices.SellOffers.Quantity
                    };
                }
            }
            catch (GW2DotNET.Common.ServiceException ex)
            {
                // Don't crash, just return null
                logger.Warn("Error finding prices for itemId {0}: {1}", ex);
            }

            return(itemPrices);
        }