Ejemplo 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);
        }
Ejemplo n.º 2
0
        public static List <ItemAmountConfig> GetDisenchantProducts(ItemDrop.ItemData item)
        {
            var isMagic = item.IsMagic();
            var type    = item.m_shared.m_itemType;
            var name    = item.m_shared.m_name;

            var configEntry = Config.DisenchantProducts.Find(x => {
                if (x.IsMagic && !isMagic)
                {
                    return(false);
                }

                if (isMagic && x.Rarity != item.GetRarity())
                {
                    return(false);
                }

                if (x.ItemTypes?.Count > 0 && !x.ItemTypes.Contains(type.ToString()))
                {
                    return(false);
                }

                if (x.ItemNames?.Count > 0 && !x.ItemNames.Contains(name))
                {
                    return(false);
                }

                return(true);
            });

            return(configEntry?.Products);
        }
Ejemplo n.º 3
0
        public static DisenchantRecipe GenerateDisenchantRecipe(ItemDrop.ItemData item)
        {
            if (item.IsMagic())
            {
                var recipe = new DisenchantRecipe {
                    FromItem = item.Extended()
                };
                recipe.Products = GetDisenchantProducts(item, item.GetRarity());
                return(recipe);
            }

            return(null);
        }
Ejemplo n.º 4
0
        public void Show(ItemDrop.ItemData item)
        {
            gameObject.SetActive(true);

            var rarityColor = item.IsMagic() ? item.GetRarityColor() : Color.white;

            MagicBG.enabled = item.IsMagic();
            MagicBG.color   = rarityColor;

            NameText.text    = Localization.instance.Localize(item.GetDecoratedName());
            Description.text = Localization.instance.Localize(item.GetTooltip());
            Icon.sprite      = item.GetIcon();

            if (item.IsMagic())
            {
                _audioSource.PlayOneShot(EpicLoot.GetMagicItemDropSFX(item.GetRarity()));
            }
        }
Ejemplo n.º 5
0
        public void Show(ItemDrop.ItemData item)
        {
            gameObject.SetActive(true);

            var rarityColor = item.IsMagic() ? item.GetRarityColor() : Color.white;

            if (MagicBG != null)
            {
                MagicBG.enabled = item.IsMagic();
                MagicBG.color   = rarityColor;
            }

            if (EpicLoot.HasAuga)
            {
                Auga.API.ComplexTooltip_SetItem(gameObject, item);
                EpicLoot.ExtendAugaTooltipForMagicItem(gameObject, item);
            }

            if (NameText != null)
            {
                NameText.text = Localization.instance.Localize(item.GetDecoratedName());
            }

            if (Description != null)
            {
                Description.text = Localization.instance.Localize(item.GetTooltip());
            }

            if (Icon != null)
            {
                Icon.sprite = item.GetIcon();
            }

            if (item.IsMagic())
            {
                _audioSource.PlayOneShot(EpicLoot.GetMagicItemDropSFX(item.GetRarity()));
            }
        }