Skip to content

Commit

Permalink
First push
Browse files Browse the repository at this point in the history
  • Loading branch information
LieutenantKernel committed Feb 24, 2023
0 parents commit e108804
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
6 changes: 6 additions & 0 deletions AvgItemLvl.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Interface: 100005
## Title: AvgItemLvl
## Author: ThundurTwonk
## Version: v1.0.0

main.lua
5 changes: 5 additions & 0 deletions Bindings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Bindings>
<Binding name="INSPECT_TARGET" header="AVG_ITEM_LVL" category="ADDONS">
InspectUnit("target")
</Binding>
</Bindings>
39 changes: 39 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e108804

Please sign in to comment.