Commit a66bc882 authored by Simpy's avatar Simpy 🐹
Browse files

nameplates to react to UNIT_FACTION this changes some oUF code slightly.

parent 344679ab
......@@ -776,6 +776,7 @@ function oUF:SpawnNamePlates(namePrefix, nameplateCallback, nameplateCVars)
eventHandler:RegisterEvent('NAME_PLATE_UNIT_ADDED')
eventHandler:RegisterEvent('NAME_PLATE_UNIT_REMOVED')
eventHandler:RegisterEvent('PLAYER_TARGET_CHANGED')
eventHandler:RegisterEvent('UNIT_FACTION')
if(IsLoggedIn()) then
if(nameplateCVars) then
......@@ -805,6 +806,13 @@ function oUF:SpawnNamePlates(namePrefix, nameplateCallback, nameplateCVars)
if(nameplate) then
nameplate.unitFrame:UpdateAllElements(event)
end
elseif(event == 'UNIT_FACTION' and unit) then
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
if(not nameplate) then return end
if(nameplateCallback) then
nameplateCallback(nameplate.unitFrame, event, unit)
end
elseif(event == 'NAME_PLATE_UNIT_ADDED' and unit) then
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
if(not nameplate) then return end
......
......@@ -587,7 +587,7 @@ function NP:UpdatePlateGUID(nameplate, guid)
end
function NP:NamePlateCallBack(nameplate, event, unit)
if event == 'NAME_PLATE_UNIT_ADDED' then
if event == 'NAME_PLATE_UNIT_ADDED' or (event == 'UNIT_FACTION' and nameplate) then
local updateBase = NP:StyleFilterClear(nameplate) -- keep this at the top
unit = unit or nameplate.unit
......@@ -654,7 +654,7 @@ function NP:NamePlateCallBack(nameplate, event, unit)
nameplate.previousType = nameplate.frameType
end
if NP.db.fadeIn and nameplate.frameType ~= 'PLAYER' then
if NP.db.fadeIn and (event == 'NAME_PLATE_UNIT_ADDED' and nameplate.frameType ~= 'PLAYER') then
NP:PlateFade(nameplate, 1, 0, 1)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment