This is some of the code i use in my own scripted default ui so it should work / be useful as a more advanced starting point. The only part i am unsure of is the ScaleNameplateNames part. I used my script to hide the names on enemy nameplates completly as a reference though it might not work with scaling the names.
also keep in mind this code snippet is completly untested by myself so there might be some typos etc. that prevent it from working.
Code:
local EventWatcher = CreateFrame("Frame")
local NameplateUpdater = CreateFrame("Frame")
local timer = 0
local function SetNameplates()
-- Set some CVars
SetCVar("nameplateMaxDistance", 45)
SetCVar("nameplateSelectedScale", 1.2)
SetCVar("nameplateMinScale", 0.8) -- minimum scale of all nameplates; default value = 0.8
-- Move Debuffs
local function MoveDebuffs(self)
if self.BuffFrame then
self.name.SetFont(STANDARD_TEXT_FONT, 12)
self.name.SetShadowOffset(1, -1)
self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, 0)
-- If ComboPoints are shown above Enemy Nameplates:
--self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, -10) -- Debuffs between Combo Points and HealthBar
--self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, 20) -- Debuffs directly above ComboPoints
end
end
hooksecurefunc("CompactUnitFrame_OnLoad", MoveDebuffs)
-- Scale Debuffs
local function ScaleNameplateDebuffs(...)
for _, v in pairs(C_NamePlate.GetNameplates()) do
local bf = v.UnitFrame.BuffFrame
bf:SetScale(1) -- Your desired debuff scale
end
end
NamePlateDriverFrame:HookScript("OnEvent", ScaleNameplateDebuffs)
end
-- Scale Names
function ScaleNameplateNames()
for i, frame in ipairs(C_NamePlate.GetNamePlates()) do
local Uf = frame.UnitFrame
Uf.name:SetScale(1) -- Your desired font size
timer = 0
end
end
NamePlateUpdater:SetScript("OnUpdate", function(self, elapsed)
timer = timer + elapsed
if timer >= 0.01 then
timer = 0
ScaleNamePlateNames()
end
end
-- Load the stuff
local function LoginEvent(self, event, ...)
EventWatcher:UnregisterEvent("PLAYER_LOGIN")
SetNameplates() -- Needs to be loaded before first nameplate is loaded
end
EventWatcher:SetScript("OnEvent", LoginEvent)
EventWatcher:RegisterEvent("PLAYER_LOGIN")