Esempio n. 1
0
        /// <summary>
        /// Adds a drop to the dictionary of logged drops.
        /// </summary>
        /// <param name="drop"></param>
        public void LogDrop(Drop drop)
        {
            LoggedDrop dropToAdd = new LoggedDrop(drop);

            if (LoggedDrops.Contains(dropToAdd))
            {
                int existingDropIndex = LoggedDrops.IndexOf(dropToAdd);
                dropToAdd.Quantity            += LoggedDrops[existingDropIndex].Quantity;
                LoggedDrops[existingDropIndex] = dropToAdd;
            }
            else
            {
                LoggedDrops.Add(dropToAdd);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Computes the total value of the drops for a specific item ID. This method looks up the price of the
        /// item and then multiplies it by the number of items.
        /// </summary>
        /// <param name="loggedDrop"></param>
        /// <returns></returns>
        public static int GetPriceForDrops(LoggedDrop loggedDrop)
        {
            int itemId = GetItemIdForName(loggedDrop.Name);

            if (loggedDrop.Name.Contains("Coin"))
            {
                return(loggedDrop.Quantity);
            }

            if (itemId == 0)
            {
                return(0);
            }

            ItemPrice price      = ItemPrices[itemId];
            int       priceToUse = price.OverallAverage > 0 ? price.OverallAverage : (price.SellAverage + price.BuyAverage) / 2;

            return(priceToUse * loggedDrop.Quantity);
        }