Skip to content

Commit

Permalink
Fixed an error on custom categories lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidan committed Feb 17, 2024
1 parent 49467bc commit 37a365f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local database = addon:GetModule('Database')
local debug = addon:GetModule('Debug')

---@class (exact) ItemData
---@field basic boolean
---@field itemInfo ExpandedItemInfo
---@field containerInfo ContainerItemInfo
---@field questInfo ItemQuestInfo
Expand Down Expand Up @@ -191,6 +192,7 @@ function items:AttachItemInfo(data)
local itemLocation = itemMixin:GetItemLocation() --[[@as ItemLocationMixin]]
local bagid, slotid = data.bagid, data.slotid
local itemID = C_Container.GetContainerItemID(bagid, slotid)
data.basic = false
if itemID == nil then
data.isItemEmpty = true
data.itemInfo = {} --[[@as table]]
Expand Down Expand Up @@ -257,6 +259,7 @@ function items:AttachBasicItemInfo(itemID, data)
isActive = false,
isQuestItem = false,
}
data.basic = true
data.itemInfo = {
itemID = itemID,
itemGUID = "",
Expand Down
8 changes: 4 additions & 4 deletions frames/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function itemFrame.itemProto:UpdateCooldown()
end

function itemFrame.itemProto:ToggleLock()
if self.data.isItemEmpty then return end
if self.data.isItemEmpty or self.data.basic then return end
local itemLocation = ItemLocation:CreateFromBagAndSlot(self.data.bagid, self.data.slotid)
if C_Item.IsLocked(itemLocation) then
self:Unlock()
Expand All @@ -160,7 +160,7 @@ function itemFrame.itemProto:ToggleLock()
end

function itemFrame.itemProto:SetLock(lock)
if self.data.isItemEmpty then return end
if self.data.isItemEmpty or self.data.basic then return end
if lock then
self:Lock()
else
Expand All @@ -169,7 +169,7 @@ function itemFrame.itemProto:SetLock(lock)
end

function itemFrame.itemProto:Lock()
if self.data.isItemEmpty then return end
if self.data.isItemEmpty or self.data.basic then return end
local itemLocation = ItemLocation:CreateFromBagAndSlot(self.data.bagid, self.data.slotid)
C_Item.LockItem(itemLocation)
self.data.itemInfo.isLocked = true
Expand All @@ -180,7 +180,7 @@ function itemFrame.itemProto:Lock()
end

function itemFrame.itemProto:Unlock()
if self.data.isItemEmpty then return end
if self.data.isItemEmpty or self.data.basic then return end
local itemLocation = ItemLocation:CreateFromBagAndSlot(self.data.bagid, self.data.slotid)
C_Item.UnlockItem(itemLocation)
self.data.itemInfo.isLocked = false
Expand Down

0 comments on commit 37a365f

Please sign in to comment.