Exemplo n.º 1
0
        private void UpdateItemSellIn(int index)
        {
            switch (ItemTypeManager.GetItemTypeByName(Items[index].Name))
            {
            case ItemTypes.Legendary:
                break;

            default:
                Items[index].SellIn--;
                break;
            }
        }
Exemplo n.º 2
0
        //Calculates quality for the next day
        public static Item CalculateNewQuality(Item item)
        {
            ItemTypes       itemType = ItemTypeManager.GetItemTypeByName(item.Name);
            Item            newItem  = item;
            RangesContainer ranges;

            if (AllRanges.TryGetValue(itemType, out ranges) == false)
            {
                throw new Exception("Could not get value by given key");
            }

            foreach (Range range in ranges.GetList())
            {
                if (newItem.SellIn <= range.SellInUpperBoundary)
                {
                    UpdateItemQuality(ref newItem, range.QualityChange, itemType);
                    break;
                }
            }
            return(newItem);
        }