From d83d85245ba7001744642e16c1618add02e7c6e3 Mon Sep 17 00:00:00 2001 From: zeptognome Date: Wed, 4 Sep 2024 14:28:03 -0700 Subject: [PATCH] fixes category display for static items Signed-off-by: zeptognome --- frames/item.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frames/item.lua b/frames/item.lua index 53d3b861..895607ab 100644 --- a/frames/item.lua +++ b/frames/item.lua @@ -297,20 +297,20 @@ end ---@return integer function itemFrame.GetItemContextMatchResult(item) local itemLocation = ItemLocation:CreateFromBagAndSlot(item.bagID, item:GetID()) - if not itemLocation then return ItemButtonUtil.ItemContextMatchResult.DoesNotApply end - if not C_Item.DoesItemExist(itemLocation) then return ItemButtonUtil.ItemContextMatchResult.DoesNotApply end - if not itemLocation:IsBagAndSlot() then return ItemButtonUtil.ItemContextMatchResult.DoesNotApply end - local result = ItemButtonUtil.GetItemContextMatchResultForItem( itemLocation ) --[[@as integer]] - if not const.BACKPACK_BAGS[item.bagID] then return ItemButtonUtil.ItemContextMatchResult.Match end - if result == ItemButtonUtil.ItemContextMatchResult.Match then return ItemButtonUtil.ItemContextMatchResult.Match end - if addon.atBank and addon.Bags.Bank.bankTab >= const.BANK_TAB.ACCOUNT_BANK_1 then - if not C_Bank.IsItemAllowedInBankType( Enum.BankType.Account, itemLocation ) then - return ItemButtonUtil.ItemContextMatchResult.Mismatch - else - return ItemButtonUtil.ItemContextMatchResult.Match + if itemLocation and itemLocation:HasAnyLocation() and itemLocation:IsBagAndSlot() and itemLocation:IsValid() then + local result = ItemButtonUtil.GetItemContextMatchResultForItem( itemLocation ) --[[@as integer]] + if not const.BACKPACK_BAGS[item.bagID] then return ItemButtonUtil.ItemContextMatchResult.Match end + if result == ItemButtonUtil.ItemContextMatchResult.Match then return ItemButtonUtil.ItemContextMatchResult.Match end + if addon.atBank and addon.Bags.Bank.bankTab >= const.BANK_TAB.ACCOUNT_BANK_1 then + if not C_Bank.IsItemAllowedInBankType( Enum.BankType.Account, itemLocation ) then + return ItemButtonUtil.ItemContextMatchResult.Mismatch + else + return ItemButtonUtil.ItemContextMatchResult.Match + end end + return result or ItemButtonUtil.ItemContextMatchResult.Match end - return result or ItemButtonUtil.ItemContextMatchResult.Match + return ItemButtonUtil.ItemContextMatchResult.DoesNotApply end ---@param ctx Context