Skip to content

Commit e108804

Browse files
First push
0 parents  commit e108804

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

AvgItemLvl.toc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Interface: 100005
2+
## Title: AvgItemLvl
3+
## Author: ThundurTwonk
4+
## Version: v1.0.0
5+
6+
main.lua

Bindings.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Bindings>
2+
<Binding name="INSPECT_TARGET" header="AVG_ITEM_LVL" category="ADDONS">
3+
InspectUnit("target")
4+
</Binding>
5+
</Bindings>

main.lua

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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

Comments
 (0)