And if you're looking for something a bit simpler that just prints messages to chat when your ilvl changes, instead of showing it in an always-visible frame, you can try this (totally untested):
Code:
local ilvl = -1
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("PLAYER_AVG_ITEM_LEVEL_UPDATE")
f:SetScript("OnEvent", function()
local total, equipped = GetAverageItemLevel()
total = math.floor(total)
if total == ilvl then
return
end
local color = ChatTypeInfo["SYSTEM"]
if total > ilvl then
DEFAULT_CHAT_FRAME:AddMessage("Your average item level is now |cff99ff99" .. total .. "|r, up from " .. ilvl, color.r, color.g, color.b)
else
DEFAULT_CHAT_FRAME:AddMessage("Your average item level is now |cffff9999" .. total .. "|r, down from " .. ilvl, color.r, color.g, color.b)
end
ilvl = total
end)
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.bool.no/