diff --git a/AvgItemLvl.toc b/AvgItemLvl.toc new file mode 100644 index 0000000..6c5823b --- /dev/null +++ b/AvgItemLvl.toc @@ -0,0 +1,6 @@ +## Interface: 100005 +## Title: AvgItemLvl +## Author: ThundurTwonk +## Version: v1.0.0 + +main.lua \ No newline at end of file diff --git a/Bindings.xml b/Bindings.xml new file mode 100644 index 0000000..da6bc41 --- /dev/null +++ b/Bindings.xml @@ -0,0 +1,5 @@ + + + InspectUnit("target") + + \ No newline at end of file diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..1073d0f --- /dev/null +++ b/main.lua @@ -0,0 +1,39 @@ +_G["BINDING_HEADER_AVG_ITEM_LVL"] = "AvgItemLvl" +_G["BINDING_NAME_INSPECT_TARGET"] = "Inspect Target" +local alreadyInitialized = false +local InspectFontStrings = {} + +local function initialize() + if InspectModelFrame == nil then + return + end + + InspectFontStrings["avg"] = InspectModelFrame:CreateFontString(nil, "OVERLAY") + InspectFontStrings["avg"]:SetPoint("TOPRIGHT", -5, -5) + InspectFontStrings["avg"]:SetFont("Fonts\\FRIZQT__.ttf", 24, "OUTLINE") + InspectFontStrings["avg"]:SetTextColor(0, 1, 0) + + alreadyInitialized = true +end + +local function updateText() + if InspectModelFrame == nil then + return + end + + local avgilvl = C_PaperDollInfo.GetInspectItemLevel("target") + InspectFontStrings["avg"]:SetText(avgilvl) + InspectFontStrings["avg"]:SetTextColor(255, 255, 0) +end + +local function main() + if CanInspect("target") then + if not (alreadyInitialized) then + initialize() + end + updateText() + end +end +local inspectEventHandler = CreateFrame("Frame", nil, UIParent) +inspectEventHandler:RegisterEvent("INSPECT_READY") +inspectEventHandler:SetScript("OnEvent", main)