Originally Posted by Saiket
WoW actually manipulates the nameplates directly in C++, bypassing their Lua methods and thus skipping any hooks. Unfortunately, that leaves no way to detect color changes short of checking their color every time the screen repaints.
If you're determined to make the nameplates match though, you could overlay a transparent black texture over the nameplate bars as soon as they get created.
|
How would i do that? The 'as soon as they get created' part. I thought that there'd be an event to look for but i couldn't find one. Then i looked through rNameplates and it looks for nameplates every 0.33 sec via WorldFrame:GetChildren(). I suppose that's the 'brute force' method hank spoke of.
This is my latest approach (similar to rNameplates):
lua Code:
local frame = CreateFrame("Frame")
frame:SetScript("OnEvent", function(self, event)
if event == "NAMEPLATEPOPUPEVENT" then
local num = select('#', WorldFrame:GetChildren())
for i=2, num do
select(i, WorldFrame:GetChildren()):HookScript("OnShow", function(self)
local name = string.find(self:GetName(), "NamePlate")
if name then
local R, G, B, A = self:GetChildren():GetStatusBarColor()
self:GetChildren():SetStatusBarColor(R*0.5, G*0.5, B*0.5, A)
end
end)
end
end
end)
frame:RegisterEvent("NAMEPLATEPOPUPEVENT")
Edit: So after further blatant copying from rNameplates i tried this:
lua Code:
local frame = CreateFrame("Frame")
local lastupdate = 0
frame:SetScript("OnUpdate", function(self, elapsed)
lastupdate = lastupdate + elapsed
if lastupdate > 0.33 then
lastupdate = 0
local num = select('#', WorldFrame:GetChildren())
for i=2, num do
select(i, WorldFrame:GetChildren()):HookScript("OnShow", function(self)
local name = string.find(self:GetName(), "NamePlate")
if name then
local R, G, B = self:GetChildren():GetStatusBarColor()
self:GetChildren():SetStatusBarColor(1, 0, 0)
end
end)
end
end
end)
It works for some time, then stops working, starts working again. Hiding nameplates and showing them again sometimes helps, sometimes it doesn't. I get a serious urge to give up on the case.
Edit: I just thought that there's little reason to hook the script at this point?!