First pass at adding ilvl to inspect frame

This commit is contained in:
Andrew Tomaka 2021-02-21 14:24:31 -05:00
parent 42f27f355d
commit 9ad678a541
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -34,11 +34,44 @@ MyAddon.taunts = {
[1161] = true, -- Challenging Shout
[204079] = true -- Final Stand
}
inspectInitialized = false
local InspectFontStrings = {}
function MyAddon.OnEvent(self, event, ...)
events[event](self, ...)
end
function GetUnitFromGuid(guid)
if UnitGUID("target") == guid then return "target"
elseif IsInRaid() then
for i = 1, MAX_RAID_MEMBERS do
if UnitGUID("raid"..i) == guid then return "raid"..i end
end
elseif IsInGroup() then
for i = 1, MAX_PARTY_MEMBERS do
if UnitGUID("party"..i) == guid then return "party"..i end
end
else return nil end
end
function events:INSPECT_READY(guid)
local itemLevel = C_PaperDollInfo.GetInspectItemLevel(GetUnitFromGuid(guid))
print(itemLevel)
if not inspectInitialized then
print("initializing")
InspectFontStrings["itemLevel"] = InspectFrame:CreateFontString(nil, "OVERLAY")
InspectFontStrings["itemLevel"]:SetPoint("BOTTOMRIGHT", -5, 5)
InspectFontStrings["itemLevel"]:SetFont("Fonts\\FRIZQT__.ttf", 24, "OUTLINE")
InspectFontStrings["itemLevel"]:SetTextColor(1, 1, 1)
inspectInitialized = true
end
InspectFontStrings["itemLevel"]:SetText(itemLevel)
print(InspectFontStrings["itemLevel"]:GetText())
end
function events:GOSSIP_SHOW()
local isNecroticWake = GetZoneText() == 'The Necrotic Wake'
local isSteward = GetUnitName('npc') == 'Steward'