I'm working on an addon and I want to report the gear item level but I'm having trouble with
lua errors when I attempt it.
Here's what I'm doing:
local slotID = GetInventorySlotInfo(Headslot)
--this works, returning a 1
local ilvl = C_Item.GetCurrentItemLevel(slotID)
--This fails (*temporary) = "bad argument #1 to '?' (Usage: local currentItemLevel = C_Item.GetCurrentItemLevel(itemLocation))"
I obviously don't have the correct itemLocation but not sure how to find that.
I'm currently attempting to get the gear level when I open the mailbox but I could change this
to use the character screen, just not sure what event triggers when I open it.
I think I have a solution now. Here is what I'm doing...oops not quite - numbers don't match character screen??
Lua Code:
local function getGearItemLvl(slotName)
print("getGearItemLvl("..slotName..")")
local slotId, texture, checkRelic = GetInventorySlotInfo(slotName)
local itemId = GetInventoryItemID("player", slotId)
if (itemId ~= nil) then
local name, _, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemId)
print("getGearItemLvl("..slotName.." is "..iLevel..")")
end
end