28 lines
1.3 KiB
Lua
28 lines
1.3 KiB
Lua
-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
|
|
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
|
|
-- Original Camelot FRIENDNAMEPLATES/ALLNAMEPLATES call Settings.SetValue for
|
|
-- players only. Classic friendly toggling includes NPCs. Keep those original
|
|
-- bindings, notifications and renderer; never replace the keyboard handler.
|
|
WoWHybridUI = WoWHybridUI or {};
|
|
local state = WoWHybridUI;
|
|
local function InstallNameplateCompatibility()
|
|
if state.nameplatesInstalled then return true; end
|
|
if not Settings or type(Settings.SetValue) ~= "function" then return false; end
|
|
hooksecurefunc(Settings, "SetValue", function(variable, value)
|
|
if variable == "nameplateShowFriendlyPlayers" and type(value) == "boolean" then
|
|
SetCVar("nameplateShowFriendlyNpcs", value and "1" or "0");
|
|
end
|
|
end);
|
|
state.nameplatesInstalled = true;
|
|
state.nameplatesRevision = 1;
|
|
return true;
|
|
end
|
|
if not InstallNameplateCompatibility() then
|
|
-- Normal addon initialization only; no engine function registration.
|
|
local frame = CreateFrame("Frame");
|
|
frame:RegisterEvent("ADDON_LOADED");
|
|
frame:SetScript("OnEvent", function(self)
|
|
if InstallNameplateCompatibility() then self:UnregisterEvent("ADDON_LOADED"); end
|
|
end);
|
|
end
|