|
| 1 | +_G["BINDING_HEADER_AVG_ITEM_LVL"] = "AvgItemLvl" |
| 2 | +_G["BINDING_NAME_INSPECT_TARGET"] = "Inspect Target" |
| 3 | +local alreadyInitialized = false |
| 4 | +local InspectFontStrings = {} |
| 5 | + |
| 6 | +local function initialize() |
| 7 | + if InspectModelFrame == nil then |
| 8 | + return |
| 9 | + end |
| 10 | + |
| 11 | + InspectFontStrings["avg"] = InspectModelFrame:CreateFontString(nil, "OVERLAY") |
| 12 | + InspectFontStrings["avg"]:SetPoint("TOPRIGHT", -5, -5) |
| 13 | + InspectFontStrings["avg"]:SetFont("Fonts\\FRIZQT__.ttf", 24, "OUTLINE") |
| 14 | + InspectFontStrings["avg"]:SetTextColor(0, 1, 0) |
| 15 | + |
| 16 | + alreadyInitialized = true |
| 17 | +end |
| 18 | + |
| 19 | +local function updateText() |
| 20 | + if InspectModelFrame == nil then |
| 21 | + return |
| 22 | + end |
| 23 | + |
| 24 | + local avgilvl = C_PaperDollInfo.GetInspectItemLevel("target") |
| 25 | + InspectFontStrings["avg"]:SetText(avgilvl) |
| 26 | + InspectFontStrings["avg"]:SetTextColor(255, 255, 0) |
| 27 | +end |
| 28 | + |
| 29 | +local function main() |
| 30 | + if CanInspect("target") then |
| 31 | + if not (alreadyInitialized) then |
| 32 | + initialize() |
| 33 | + end |
| 34 | + updateText() |
| 35 | + end |
| 36 | +end |
| 37 | +local inspectEventHandler = CreateFrame("Frame", nil, UIParent) |
| 38 | +inspectEventHandler:RegisterEvent("INSPECT_READY") |
| 39 | +inspectEventHandler:SetScript("OnEvent", main) |
0 commit comments