Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Update nameplate hook #636

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions blizzard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,17 @@ function oUF:DisableBlizzard(unit)
handleFrame('ArenaEnemyPrepFrame' .. i, true)
end
end
elseif(unit:match('nameplate%d+$')) then
local frame = C_NamePlate.GetNamePlateForUnit(unit)
if(frame and frame.UnitFrame) then
if(not frame.UnitFrame.isHooked) then
frame.UnitFrame:HookScript('OnShow', insecureOnShow)
frame.UnitFrame.isHooked = true
end
end
end

handleFrame(frame.UnitFrame, true)
end
function oUF:DisableNamePlate(frame)
if(not(frame or frame.UnitFrame)) then return end
if(frame.UnitFrame:IsForbidden()) then return end

if(not frame.UnitFrame.isHooked) then
frame.UnitFrame:HookScript('OnShow', insecureOnShow)
frame.UnitFrame.isHooked = true
end

handleFrame(frame.UnitFrame, true)
end
6 changes: 2 additions & 4 deletions ouf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -764,10 +764,8 @@ function oUF:SpawnNamePlates(namePrefix, nameplateCallback, nameplateCVars)
-- and because forbidden nameplates exist, we have to allow default nameplate
-- driver to create, update, and remove Blizz nameplates.
-- Disable only not forbidden nameplates.
NamePlateDriverFrame:HookScript('OnEvent', function(_, event, unit)
if(event == 'NAME_PLATE_UNIT_ADDED' and unit) then
self:DisableBlizzard(unit)
end
hooksecurefunc(NamePlateDriverFrame, 'AcquireUnitFrame', function(...)
self:DisableNamePlate(...)
end)

local eventHandler = CreateFrame('Frame', 'oUF_NamePlateDriver')
Expand Down