コード例 #1
0
        public static string GetDecoratedName(this ItemDrop.ItemData itemData, string colorOverride = null)
        {
            var color = "white";
            var name  = itemData.m_shared.m_name;

            if (itemData.IsMagic())
            {
                var magicItem = itemData.GetMagicItem();
                color = magicItem.GetColorString();
                if (!string.IsNullOrEmpty(magicItem.DisplayName))
                {
                    name = magicItem.DisplayName;
                }
            }
            else if (itemData.IsMagicCraftingMaterial() || itemData.IsRunestone())
            {
                color = itemData.GetCraftingMaterialRarityColor();
            }

            if (!string.IsNullOrEmpty(colorOverride))
            {
                color = colorOverride;
            }

            return($"<color={color}>{name}</color>");
        }
コード例 #2
0
        public static void Postfix(ref string __result, ItemDrop.ItemData item)
        {
            if (item != null && (item.IsMagicCraftingMaterial() || item.IsRunestone()))
            {
                var rarityDisplay = EpicLoot.GetRarityDisplayName(item.GetCraftingMaterialRarity());
                __result = $"<color={item.GetCraftingMaterialRarityColor()}>{rarityDisplay} crafting material\n</color>" + __result;
            }

            if (item != null && !item.IsMagic())
            {
                var text = new StringBuilder();

                // Set stuff
                if (!string.IsNullOrEmpty(item.m_shared.m_setName))
                {
                    // Remove old set stuff
                    var index = __result.IndexOf("\n\n$item_seteffect", StringComparison.InvariantCulture);
                    if (index >= 0)
                    {
                        __result = __result.Remove(index);
                    }

                    // Create new
                    AddSetTooltip(item, text);
                }

                __result += text.ToString();
            }

            __result = __result.Replace("<color=orange>", "<color=lightblue>");
            __result = __result.Replace("<color=yellow>", "<color=lightblue>");
        }
コード例 #3
0
        public static ItemRarity GetRarity(this ItemDrop.ItemData itemData)
        {
            if (itemData.IsMagic())
            {
                return(itemData.GetMagicItem().Rarity);
            }
            else if (itemData.IsMagicCraftingMaterial())
            {
                return(itemData.GetCraftingMaterialRarity());
            }
            else if (itemData.IsRunestone())
            {
                return(itemData.GetRunestoneRarity());
            }

            throw new ArgumentException("itemData is not magic item, magic crafting material, or runestone");
        }
コード例 #4
0
        public static Color GetRarityColor(this ItemDrop.ItemData itemData)
        {
            var colorString = "white";

            if (itemData.IsMagic())
            {
                colorString = itemData.GetMagicItem().GetColorString();
            }
            else if (itemData.IsMagicCraftingMaterial())
            {
                colorString = itemData.GetCraftingMaterialRarityColor();
            }
            else if (itemData.IsRunestone())
            {
                colorString = itemData.GetRunestoneRarityColor();
            }

            return(ColorUtility.TryParseHtmlString(colorString, out var color) ? color : Color.white);
        }
コード例 #5
0
 public static bool UseMagicBackground(this ItemDrop.ItemData itemData)
 {
     return(itemData.IsMagic() || itemData.IsRunestone());
 }