public void Enchant(IEntity item, ItemClass itemClass, int itemLevel, IRandom random, RarityPicker rarityPicker)
        {
            var rarity = rarityPicker.Rarity;

            if (rarity == "Normal")
            {
                return;
            }

            if (rarity == "Magic")
            {
                SetEnchantedLineInDescription(item);

                if (random.PickOneFrom(1, 2) == 1)
                {
                    var enchantPower = (int)(itemLevel * 1.5);

                    var enchantment1 = GetEnchantmentFor(item, itemClass, enchantPower, random);

                    ApplyEnchantmentTo(item, enchantment1);

                    if (random.PickOneFrom(1, 2) == 1)
                    {
                        _itemNamer.NameMagicItem(item, enchantment1, null);
                    }
                    else
                    {
                        _itemNamer.NameMagicItem(item, null, enchantment1);
                    }
                }
                else
                {
                    var enchantPower = itemLevel;

                    var enchantment1 = GetEnchantmentFor(item, itemClass, enchantPower, random);

                    ApplyEnchantmentTo(item, enchantment1);

                    var enchantment2 = GetEnchantmentFor(item, itemClass, enchantPower, random);

                    ApplyEnchantmentTo(item, enchantment2);

                    _itemNamer.NameMagicItem(item, enchantment1, enchantment2);
                }

                return;
            }

            if (rarity == "Rare")
            {
                var numberOfEnchantments = random.Between(4, 6);
                var enchantPower         = itemLevel;

                for (int i = 0; i < numberOfEnchantments; i++)
                {
                    var enchantment = GetEnchantmentFor(item, itemClass, enchantPower, random);

                    ApplyEnchantmentTo(item, enchantment);
                }

                _itemNamer.NameRareItem(item, itemClass, random);

                return;
            }

            throw new ApplicationException("Unknown rarity in Enchant: " + rarity);
        }
        public IEntity CreateItem(int itemLevel, IRandom random, ItemClassPicker itemClassPicker, RarityPicker rarityPicker)
        {
            IEntity   selectedItem;
            ItemClass itemClass;

            if (itemClassPicker == null)
            {
                selectedItem = random.PickOne(_itemList);
                itemClass    = ItemClassHelper.Classify(selectedItem);
            }
            else
            {
                itemClass = itemClassPicker.ItemClass;

                var itemsInClass = _itemsByClass[itemClass];

                selectedItem = random.PickOne(itemsInClass);
            }
            var item = _systemContainer.PrototypeSystem.Get(selectedItem);

            ApplyItemClassSpecificChanges(item, itemClass, itemLevel, random);

            if (IsEnchantable(item, itemClass))
            {
                Enchant(item, itemClass, itemLevel, random, rarityPicker);
            }

            SetItemPrice(item);

            return(item);
        }