Files
coa-bagnon/Bagnon/utility/itemSlotInfo.lua
T
Andrew6810 4e3aff9d89 init
2022-10-21 06:37:39 -07:00

39 lines
1.1 KiB
Lua

--[[
itemSlotInfo.lua
Generic methods for accessing item slot information
--]]
local Bagnon = LibStub('AceAddon-3.0'):GetAddon('Bagnon')
local ItemSlotInfo = {}
Bagnon.ItemSlotInfo = ItemSlotInfo
function ItemSlotInfo:GetItemInfo(player, bag, slot)
local link, count, texture, quality, readable, locked, lootable
if self:IsCached(player, bag, slot) then
if BagnonDB then
link, count, texture, quality = BagnonDB:GetItemData(bag, slot, player)
end
else
texture, count, locked, quality, readable, lootable, link = GetContainerItemInfo(bag, slot)
--GetContainerItemInfo does not return a quality value for all items. If it does not, it returns -1
if link and quality < 0 then
quality = (select(3, GetItemInfo(link)))
end
-- link = GetContainerItemLinkWithRE(bag, slot)
end
return texture, count, locked, quality, readable, lootable, link
end
function ItemSlotInfo:IsLocked(player, bag, slot)
if self:IsCached(player, bag, slot) then
return false
end
return (select(3, GetContainerItemInfo(bag, slot)))
end
function ItemSlotInfo:IsCached(player, bag, slot)
return Bagnon.BagSlotInfo:IsCached(player, bag)
end