public static void Postfix(HotkeyBar __instance, List <HotkeyBar.ElementData> ___m_elements, List <ItemDrop.ItemData> ___m_items, Player player) { if (player == null || player.IsDead()) { return; } for (var index = 0; index < ___m_elements.Count; index++) { var element = ___m_elements[index]; var magicItem = ItemBackgroundHelper.CreateAndGetMagicItemBackgroundImage(element.m_go, element.m_equiped, false); magicItem.enabled = false; } for (var index = 0; index < ___m_items.Count; ++index) { var itemData = ___m_items[index]; var element = GetElementForItem(___m_elements, itemData); if (element == null) { EpicLoot.LogWarning($"Tried to get element for {itemData.m_shared.m_name} at {itemData.m_gridPos}, but element was null (total elements = {___m_elements.Count})"); continue; } var magicItem = ItemBackgroundHelper.CreateAndGetMagicItemBackgroundImage(element.m_go, element.m_equiped, false); if (itemData.UseMagicBackground()) { magicItem.enabled = true; magicItem.sprite = EpicLoot.GetMagicItemBgSprite(); magicItem.color = itemData.GetRarityColor(); } } }
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; } } }
public static void Postfix(HotkeyBar __instance, List <HotkeyBar.ElementData> ___m_elements, List <ItemDrop.ItemData> ___m_items, Player player) { if (player == null || player.IsDead()) { return; } Dictionary <int, ItemDrop.ItemData> itemPosition = new Dictionary <int, ItemDrop.ItemData>(); foreach (ItemDrop.ItemData itemData in ___m_items) { if (GetElementIndexForItem(___m_elements, itemData) is int elementIndex) { itemPosition[elementIndex] = itemData; } else { EpicLoot.LogWarning($"Tried to get element for {itemData.m_shared.m_name} at {itemData.m_gridPos}, but element was null (total elements = {___m_elements.Count})"); } } for (var index = 0; index < ___m_elements.Count; index++) { var element = ___m_elements[index]; var magicItem = ItemBackgroundHelper.CreateAndGetMagicItemBackgroundImage(element.m_go, element.m_equiped, false); if (itemPosition.TryGetValue(index, out ItemDrop.ItemData itemData) && itemData.UseMagicBackground()) { magicItem.enabled = true; magicItem.sprite = EpicLoot.GetMagicItemBgSprite(); magicItem.color = itemData.GetRarityColor(); } else { magicItem.enabled = false; } } }