Beispiel #1
0
        private CommonItem CreateCommonItem(IItem iItem, string itemId, EnchantmentsEnchantment enchantment,
                                            Craftingrequirements[] craftingrequirements, bool isTransmut, int enchantIp = 0)
        {
            var im = new ItemMarket();
            var enchantmentlevel = enchantment?.enchantmentlevel ?? (iItem is IItemEnchantmentLevel ie ? ie.enchantmentlevel : 0);

            var main = CreateCommonItemExt(iItem, itemId,
                                           CreateCraftingAndUpgradeRequirements(iItem.uniquename, craftingrequirements, enchantment, isTransmut),
                                           enchantmentlevel, 1, im, enchantIp);

            main.QualityLevels = Empty;
            if (iItem is IItemPowered)
            {
                main.QualityLevels = new CommonItem[4];
                for (var i = 1; i < 5; i++)
                {
//                    var upgrades = CreateUpgradeRequirements(iItem.uniquename, enchantment, i + 1);
                    var upgrades = CreateCraftingAndUpgradeRequirements(iItem.uniquename, craftingrequirements, enchantment, isTransmut, i + 1);
                    main.QualityLevels[i - 1] =
                        CreateCommonItemExt(iItem, itemId,
                                            upgrades, enchantmentlevel, i + 1, im, enchantIp);
                }
            }

            return(main);
        }
Beispiel #2
0
        /// <summary>
        ///     upgrade existed
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="enchantment"></param>
        /// <returns></returns>
        private BaseResorcedRequirement CreateUpgradeRequirement(string itemId,
                                                                 EnchantmentsEnchantment enchantment,
                                                                 int qualityLevel)
        {
            var id   = GetId(itemId, enchantment.enchantmentlevel - 1);
            var res  = CreateResources(enchantment.upgraderequirements).ToList();
            var item = Items[id + (qualityLevel > 1 ? $"_{qualityLevel}" : "")];

            res.Add(new CraftingResource(item, 1, false));

            return(new UpgradeRequirement(res.ToArray()));
        }
Beispiel #3
0
 /// <summary>
 ///     enchanted versions
 /// </summary>
 /// <param name="itemId"></param>
 /// <param name="craftingrequirements"></param>
 /// <param name="enchantment"></param>
 /// <param name="isTransmut"></param>
 /// <returns></returns>
 private IEnumerable <BaseResorcedRequirement> CreateCraftingAndUpgradeRequirements(string itemId,
                                                                                    Craftingrequirements[] craftingrequirements,
                                                                                    EnchantmentsEnchantment enchantment, bool isTransmut,
                                                                                    int qualityLevel = 1)
 {
     foreach (var c in CreateCraftingRequirements(craftingrequirements, isTransmut, itemId))
     {
         yield return(c);
     }
     if (enchantment?.upgraderequirements != null)
     {
         yield return(CreateUpgradeRequirement(itemId, enchantment, qualityLevel));
     }
 }