Hello,
Trying to use the Item Mixin, but doesn’t seem to “find” my item.
local AddonName, Addon = ...
local item = {}
Mixin(Item,ItemMixin)
local waitList={};
local normalLoop
function Addon:normalLoop()
item = Item:CreateFromItemID(30817)
local iname = Item:GetItemName()
--local iname = C_Item.GetItemInfo(30817)
if iname == nil then -- item not cached
print("iname == nil")
waitList[30817]= 4
else
local itemid = C_Item.GetItemIDForItemInfo(iname)
local icount = GetItemCount(itemid)
print("Info: ", iname==nil, iname, " ", icount, itemid)
end
end
local ii_frame = ii_frame or CreateFrame("Frame")
ii_frame:RegisterEvent("SPELLS_CHANGED")
ii_frame:RegisterEvent("GET_ITEM_INFO_RECEIVED")
ii_frame:SetScript("OnEvent", function(self, event, ...) --a1, a2, a3)
Addon.dprint = true; --needs to be set to true for DebugPrint function to print
if event == "SPELLS_CHANGED" then
Addon:normalLoop()
ii_frame:UnregisterEvent("SPELLS_CHANGED")
end
if event == "GET_ITEM_INFO_RECEIVED" then
local itemID = ...
--local iname = C_Item.GetItemInfo(itemID)
local iname = Item:GetItemName()
print("giir: ", iname)
if waitList[itemID] then
local icount = GetItemCount(itemID)
print("received",itemID, icount, iname)
end
end
end) -- end SetScript
If I change the code to use the C_Item.GetItemInfo and other C_Item objects, the code works as expected. Which is good for me, as long as it works. My question is why doesn’t the Mixin items work, for example:
local iname = Item:GetItemName()
print("giir: ", iname)
outputs giiir: nil
I am stumped.