-
Notifications
You must be signed in to change notification settings - Fork 0
/
NameplatePosition.lua
69 lines (58 loc) · 2.33 KB
/
NameplatePosition.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
local feature = ns.Register({
identifier = "NameplatePosition",
description = "Adjusts nameplate position to not overlap with mobs.",
category = "interface",
config = {
nameplate = {
base = 115,
notch = 25,
height = 35,
scaleTweak = 0.05,
}
}
})
local frame = CreateFrame("Frame")
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
local function IsNamePlateFrame(frame)
local overlayRegion = frame:GetRegions()
if not overlayRegion or overlayRegion:GetObjectType() ~= "Texture" or overlayRegion:GetTexture() ~= "Interface\\Tooltips\\Nameplate-Border" then
return false
end
return true
end
frame:SetScript("OnEvent", function()
if not ns.IsEnabled(feature.identifier) then return end
end)
frame:SetScript("OnUpdate", function()
if not ns.IsEnabled(feature.identifier) then return end
local frames = {WorldFrame:GetChildren()}
-- local scale = UIParent:GetScale() - feature.config.nameplate.scaleTweak
for _, nameplate in ipairs(frames) do
if IsNamePlateFrame(nameplate) then
DebugPlaceholder(nameplate, 0, 0, 1, 0.3)
nameplate:ClearAllPoints()
-- nameplate:SetPoint("TOP", -300)
-- nameplate:SetHeight(300)
-- local HealthBar = nameplate:GetChildren()
-- local Border, Glow, Name, Level = nameplate:GetRegions()
-- nameplate:SetWidth((feature.config.nameplate.base + feature.config.nameplate.notch) * scale)
-- nameplate:SetHeight(feature.config.nameplate.height * scale)
--
-- HealthBar:ClearAllPoints()
-- HealthBar:SetWidth(feature.config.nameplate.base * scale)
-- HealthBar:SetHeight(((feature.config.nameplate.height / 2) - (5 * scale)) * scale)
-- HealthBar:SetPoint("BOTTOM", nameplate, "BOTTOM", -(8 * scale), (2 * scale))
--
-- Name:ClearAllPoints()
-- Name:SetFont(STANDARD_TEXT_FONT, (12 * scale), "OUTLINE")
-- Name:SetPoint("BOTTOM", nameplate, "BOTTOM", 0, (16 * scale) + (3 * scale))
-- Name:SetShadowColor(0, 0, 0, .3)
--
-- Level:ClearAllPoints()
-- Level:SetPoint("BOTTOM", nameplate, "BOTTOM", (((feature.config.nameplate.base / 2)) * scale), ((feature.config.nameplate.height / 2) * scale) - (12 * scale))
-- Level:SetFont(UNIT_NAME_FONT, (9 * scale), "OUTLINE")
-- Level:SetShadowColor(0, 0, 0, .3)
end
end
end)