diff --git a/api/config.lua b/api/config.lua index 19ea9f12..7426c7fa 100644 --- a/api/config.lua +++ b/api/config.lua @@ -603,6 +603,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("chat", "global", "scrollspeed", "1") pfUI:UpdateConfig("chat", "bubbles", "alpha", ".75") + pfUI:UpdateConfig("nameplates", nil, "showhostile", "1") + pfUI:UpdateConfig("nameplates", nil, "showfriendly", "0") pfUI:UpdateConfig("nameplates", nil, "use_unitfonts", "0") pfUI:UpdateConfig("nameplates", nil, "legacy", "0") pfUI:UpdateConfig("nameplates", nil, "overlap", "0") diff --git a/modules/gui.lua b/modules/gui.lua index 678a16a6..50055363 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2026,6 +2026,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () end) CreateGUIEntry(T["Nameplates"], nil, function() + CreateConfig(U["nameplates"], T["Show On Hostile Units"], C.nameplates, "showhostile", "checkbox") + CreateConfig(U["nameplates"], T["Show On Friendly Units"], C.nameplates, "showfriendly", "checkbox") CreateConfig(U["nameplates"], T["Use Unit Fonts"], C.nameplates, "use_unitfonts", "checkbox") CreateConfig(U["nameplates"], T["Enable Castbars"], C.nameplates, "showcastbar", "checkbox") CreateConfig(U["nameplates"], T["Enable Spellname"], C.nameplates, "spellname", "checkbox") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 4e1bd094..65b07f44 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -675,7 +675,34 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () end end + -- set nameplate game settings + nameplates.SetGameVariables = function() + -- update visibility (hostile) + if C.nameplates["showhostile"] == "1" then + _G.NAMEPLATES_ON = true + ShowNameplates() + else + _G.NAMEPLATES_ON = nil + HideNameplates() + end + + -- update visibility (hostile) + if C.nameplates["showfriendly"] == "1" then + _G.FRIENDNAMEPLATES_ON = true + ShowFriendNameplates() + else + _G.FRIENDNAMEPLATES_ON = nil + HideFriendNameplates() + end + end + + nameplates:SetGameVariables() + nameplates.UpdateConfig = function() + -- update nameplate visibility + nameplates:SetGameVariables() + + -- apply all config changes for plate in pairs(registry) do nameplates.OnConfigChange(plate) end