What Ammako said. I've found the same issue in a couple of the addons I wrote. I ended up having to write a routine that parses the tooltip for the item and pulls the item level from there. I think this is what most people are doing, at least until the correct item level is returned by GetDetailedItemLevelInfo().
Lua Code:
local function GetItemLevel(bagID, slotID, slot)
local link = GetContainerItemLink(bagID, slotID)
if link then
local tip, leftside = CreateFrame('GameTooltip', 'mnkBackpackScanTooltip'), {}
for i = 1, 5 do
local L, R = tip:CreateFontString(), tip:CreateFontString()
L:SetFontObject(GameFontNormal)
R:SetFontObject(GameFontNormal)
tip:AddFontStrings(L, R)
leftside[i] = L
end
tip:ClearLines()
tip.leftside = leftside
tip:SetOwner(UIParent, 'ANCHOR_NONE')
--print(link, ' ', slot.itemLevel)
-- Weird issue with the tooltip not refilling/painting with the details of a bank item. This
-- resolves that issue and it makes no sense why.
if bagID < 0 then
tip:ClearLines()
tip:SetHyperlink(link)
end
tip:ClearLines()
tip:SetBagItem(bagID, slotID)
tip:Show()
for l = 1, #tip.leftside do
local t = tip.leftside[l]:GetText()
if t and t:find('Item Level') then
local _, i = string.find(t, 'Item Level%s%d')
-- check for boosted levels ie Chromeie scenarios.
local _, x = string.find(t, " (", 1, true)
--print(t, ' ', x)
if x then
return string.sub(t, i, x-2) or nil
end
return string.sub(t, i) or nil
end
end
return nil
else
return nil
end
end