Esempio n. 1
0
        public static List <KeyValuePair <ItemDrop, int> > GetAugmentCosts(ItemDrop.ItemData item)
        {
            var rarity = item.GetRarity();

            var augmentCostDef = EnchantCostsHelper.GetAugmentCost(item, rarity);

            if (augmentCostDef == null)
            {
                return(null);
            }

            var costList = new List <KeyValuePair <ItemDrop, int> >();

            foreach (var itemAmountConfig in augmentCostDef)
            {
                var prefab = ObjectDB.instance.GetItemPrefab(itemAmountConfig.Item);
                if (prefab == null)
                {
                    EpicLoot.LogWarning($"Tried to add unknown item ({itemAmountConfig.Item}) to augment cost for item ({item.m_shared.m_name})");
                    continue;
                }

                var itemDrop = prefab.GetComponent <ItemDrop>();
                if (itemDrop == null)
                {
                    EpicLoot.LogWarning($"Tried to add item without ItemDrop ({itemAmountConfig.Item}) to augment cost for item ({item.m_shared.m_name})");
                    continue;
                }

                costList.Add(new KeyValuePair <ItemDrop, int>(itemDrop, itemAmountConfig.Amount));
            }

            return(costList);
        }
Esempio n. 2
0
        public static List <KeyValuePair <ItemDrop, int> > GetDisenchantProducts(ItemDrop.ItemData item)
        {
            var productsDef = EnchantCostsHelper.GetDisenchantProducts(item);

            if (productsDef == null)
            {
                return(null);
            }

            var products = new List <KeyValuePair <ItemDrop, int> >();

            foreach (var itemAmountConfig in productsDef)
            {
                var prefab = ObjectDB.instance.GetItemPrefab(itemAmountConfig.Item);
                if (prefab == null)
                {
                    EpicLoot.LogWarning($"Tried to add unknown item ({itemAmountConfig.Item}) to disenchant product for item ({item.m_shared.m_name})");
                    continue;
                }

                var itemDrop = prefab.GetComponent <ItemDrop>();
                if (itemDrop == null)
                {
                    EpicLoot.LogWarning($"Tried to add object with no ItemDrop ({itemAmountConfig.Item}) to disenchant product for item ({item.m_shared.m_name})");
                    continue;
                }

                products.Add(new KeyValuePair <ItemDrop, int>(itemDrop, itemAmountConfig.Amount));
            }

            return(products);
        }
        private static string GetAugmentSelectorText(MagicItem magicItem, int i, IReadOnlyList <MagicItemEffect> augmentableEffects, ItemRarity rarity)
        {
            var  pip  = EpicLoot.GetMagicEffectPip(magicItem.IsEffectAugmented(i));
            bool free = EnchantCostsHelper.EffectIsDeprecated(augmentableEffects[i].EffectType);

            return($"{pip} {Localization.instance.Localize(MagicItem.GetEffectText(augmentableEffects[i], rarity, true))}{(free ? " [FREE]" : "")}");
        }