Exemplo n.º 1
0
 public static void Postfix(InventoryGrid __instance)
 {
     foreach (ItemDrop.ItemData item in __instance.m_inventory.m_inventory)
     {
         InventoryGrid.Element element = __instance.GetElement(item.m_gridPos.x, item.m_gridPos.y, __instance.m_width);
         if (element != null && item.HasMagicEffect(MagicEffectType.Indestructible))
         {
             element.m_durability.gameObject.SetActive(false);
         }
     }
 }
Exemplo n.º 2
0
        public static void Postfix(InventoryGrid __instance, Player player, ItemDrop.ItemData dragItem)
        {
            foreach (var element in __instance.m_elements)
            {
                var magicItemTransform = element.m_go.transform.Find("magicItem");
                if (magicItemTransform != null)
                {
                    var magicItem = magicItemTransform.GetComponent <Image>();
                    if (magicItem != null)
                    {
                        magicItem.enabled = false;
                    }
                }

                var setItemTransform = element.m_go.transform.Find("setItem");
                if (setItemTransform != null)
                {
                    var setItem = setItemTransform.GetComponent <Image>();
                    if (setItem != null)
                    {
                        setItem.enabled = false;
                    }
                }
            }

            foreach (var item in __instance.m_inventory.m_inventory)
            {
                var element = __instance.GetElement(item.m_gridPos.x, item.m_gridPos.y, __instance.m_inventory.GetWidth());
                if (element == null)
                {
                    EpicLoot.LogError($"Could not find element for item ({item.m_shared.m_name}: {item.m_gridPos}) in inventory: {__instance.m_inventory.m_name}");
                    continue;
                }

                var magicItem = ItemBackgroundHelper.CreateAndGetMagicItemBackgroundImage(element.m_go, element.m_equiped.gameObject, true);
                if (item.UseMagicBackground())
                {
                    magicItem.enabled = true;
                    magicItem.sprite  = EpicLoot.GetMagicItemBgSprite();
                    magicItem.color   = item.GetRarityColor();
                }

                var setItemTransform = element.m_go.transform.Find("setItem");
                if (setItemTransform != null)
                {
                    var setItem = setItemTransform.GetComponent <Image>();
                    if (setItem != null)
                    {
                        setItem.enabled = item.IsSetItem();
                    }
                }
            }
        }
        public static void Postfix(InventoryGrid __instance, Player player, ItemDrop.ItemData dragItem)
        {
            foreach (var element in __instance.m_elements)
            {
                var magicItemTransform = element.m_go.transform.Find("magicItem");
                if (magicItemTransform != null)
                {
                    var magicItem = magicItemTransform.GetComponent <Image>();
                    if (magicItem != null)
                    {
                        magicItem.enabled = false;
                    }
                }

                var setItemTransform = element.m_go.transform.Find("setItem");
                if (setItemTransform != null)
                {
                    var setItem = setItemTransform.GetComponent <Image>();
                    if (setItem != null)
                    {
                        setItem.enabled = false;
                    }
                }
            }

            foreach (var item in __instance.m_inventory.GetAllItems())
            {
                var element = __instance.GetElement(item.m_gridPos.x, item.m_gridPos.y, __instance.m_inventory.GetWidth());

                var magicItem = ItemBackgroundHelper.CreateAndGetMagicItemBackgroundImage(element.m_go, element.m_equiped.gameObject, true);
                if (item.UseMagicBackground())
                {
                    magicItem.enabled = true;
                    magicItem.sprite  = EpicLoot.GetMagicItemBgSprite();
                    magicItem.color   = item.GetRarityColor();
                }

                var setItem = element.m_go.transform.Find("setItem").GetComponent <Image>();
                if (setItem != null && !string.IsNullOrEmpty(item.m_shared.m_setName))
                {
                    setItem.enabled = true;
                }
            }
        }
Exemplo n.º 4
0
        private static void PatchInventory(ref InventoryGrid __instance, ref Player player, ItemDrop.ItemData dragItem)
        {
            if (!Main.showDurabilityColor.Value && !Main.showItemStars.Value)
            {
                return;
            }

            foreach (ItemDrop.ItemData itemData in __instance.m_inventory.GetAllItems())
            {
                InventoryGrid.Element element = __instance.GetElement(itemData.m_gridPos.x, itemData.m_gridPos.y, __instance.m_inventory.GetWidth());
                if (element.m_icon.transform.localScale == Vector3.one)
                {
                    element.m_icon.transform.localScale *= Mathf.Max(Main.iconScaleSize.Value, 0.1f);
                }
                if (itemData.m_shared.m_useDurability)
                {
                    if (itemData.m_durability <= 0f) // Item has no durability, original code should do this
                    {
                        //element.m_durability.SetValue(1f);
                        //element.m_durability.SetColor((Mathf.Sin(Time.time * 10f) > 0f) ? Color.red : new Color(0f, 0f, 0f, 0f));
                    }
                    else // Item has durability left
                    {
                        if (Main.showDurabilityColor.Value)
                        {
                            Patches.DurabilityBar.UpdateColor(element, itemData.GetDurabilityPercentage());
                        }
                    }
                }
                // Change item quality info
                if (itemData.m_shared.m_maxQuality > 1)
                {
                    if (Main.showItemStars.Value)
                    {
                        Patches.Stars.Draw(element, itemData.m_quality);
                    }
                }
            }
        }