new nameplate feature

new nameplate feature
This commit is contained in:
Meow
2026-01-21 20:58:38 +01:00
parent c890e44be1
commit 8af8809ada
3 changed files with 114 additions and 5 deletions
+5 -3
View File
@@ -754,9 +754,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("chat", "bubbles", "borders", "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, "showhostile", "1")
pfUI:UpdateConfig("nameplates", nil, "showfriendly", "0")
pfUI:UpdateConfig("nameplates", nil, "disable_hostile_in_friendly", "0")
pfUI:UpdateConfig("nameplates", nil, "disable_friendly_in_friendly", "0")
pfUI:UpdateConfig("nameplates", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("nameplates", nil, "legacy", "0")
pfUI:UpdateConfig("nameplates", nil, "overlap", "0")
pfUI:UpdateConfig("nameplates", nil, "verticalhealth", "0")
+2
View File
@@ -2314,6 +2314,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
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["Disable Hostile Nameplates In Friendly Zones"], C.nameplates, "disable_hostile_in_friendly", "checkbox")
CreateConfig(U["nameplates"], T["Disable Friendly Nameplates In Friendly Zones"], C.nameplates, "disable_friendly_in_friendly", "checkbox")
CreateConfig(U["nameplates"], T["Vertical Offset (|cffffaaaaExperimental|r)"], C.nameplates, "vertical_offset", nil, nil, nil, nil, nil, "vanilla")
CreateConfig(U["nameplates"], T["Inactive Nameplate Alpha"], C.nameplates, "notargalpha", "dropdown", pfUI.gui.dropdowns.percent_small)
CreateConfig(U["nameplates"], T["Draw Glow Around Target Nameplate"], C.nameplates, "targetglow", "checkbox")
+107 -2
View File
@@ -58,6 +58,11 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
-- catch all nameplates
local childs, regions, plate
local initialized = 0
-- Friendly zone nameplate disable state
local savedHostileState = nil
local savedFriendlyState = nil
local inFriendlyZone = false
local parentcount = 0
local platecount = 0
local registry = {}
@@ -351,6 +356,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
nameplates:RegisterEvent("UNIT_COMBO_POINTS")
nameplates:RegisterEvent("PLAYER_COMBO_POINTS")
nameplates:RegisterEvent("UNIT_AURA")
nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-- NEW: Register cast events like Overhead.lua
if superwow_active then
@@ -358,8 +364,52 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
end
nameplates:SetScript("OnEvent", function()
if event == "PLAYER_ENTERING_WORLD" then
this:SetGameVariables()
if event == "PLAYER_ENTERING_WORLD" or event == "ZONE_CHANGED_NEW_AREA" then
if event == "PLAYER_ENTERING_WORLD" then
this:SetGameVariables()
end
-- Handle friendly zone nameplate disable feature
local disableHostile = C.nameplates["disable_hostile_in_friendly"] == "1"
local disableFriendly = C.nameplates["disable_friendly_in_friendly"] == "1"
if disableHostile or disableFriendly then
local pvpType = GetZonePVPInfo()
local nowFriendly = (pvpType == "friendly")
if nowFriendly and not inFriendlyZone then
-- Entering friendly zone - save current state and hide based on options
inFriendlyZone = true
savedHostileState = C.nameplates["showhostile"]
savedFriendlyState = C.nameplates["showfriendly"]
if disableHostile then
_G.NAMEPLATES_ON = nil
HideNameplates()
end
if disableFriendly then
_G.FRIENDNAMEPLATES_ON = nil
HideFriendNameplates()
end
elseif not nowFriendly and inFriendlyZone then
-- Leaving friendly zone - restore previous state
inFriendlyZone = false
if savedHostileState == "1" then
_G.NAMEPLATES_ON = true
ShowNameplates()
end
if savedFriendlyState == "1" then
_G.FRIENDNAMEPLATES_ON = true
ShowFriendNameplates()
end
savedHostileState = nil
savedFriendlyState = nil
end
end
elseif event == "UNIT_CASTEVENT" then
-- NEW: Event-based cast handling from Overhead.lua
local casterGUID = arg1
@@ -1285,6 +1335,61 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
-- update debuff filters
DebuffFilterPopulate()
-- Check friendly zone state when config changes
local disableHostile = C.nameplates["disable_hostile_in_friendly"] == "1"
local disableFriendly = C.nameplates["disable_friendly_in_friendly"] == "1"
local pvpType = GetZonePVPInfo()
local nowFriendly = (pvpType == "friendly")
if nowFriendly and (disableHostile or disableFriendly) then
if not inFriendlyZone then
-- Just entered friendly zone or feature just enabled
inFriendlyZone = true
savedHostileState = C.nameplates["showhostile"]
savedFriendlyState = C.nameplates["showfriendly"]
end
-- Apply current settings based on options
if disableHostile then
_G.NAMEPLATES_ON = nil
HideNameplates()
else
-- Restore hostile if option is off but we're in friendly zone
if savedHostileState == "1" then
_G.NAMEPLATES_ON = true
ShowNameplates()
end
end
if disableFriendly then
_G.FRIENDNAMEPLATES_ON = nil
HideFriendNameplates()
else
-- Restore friendly if option is off but we're in friendly zone
if savedFriendlyState == "1" then
_G.FRIENDNAMEPLATES_ON = true
ShowFriendNameplates()
end
end
return -- Don't call SetGameVariables
elseif inFriendlyZone and not (disableHostile or disableFriendly) then
-- Both features disabled while in friendly zone - restore state
inFriendlyZone = false
if savedHostileState == "1" then
C.nameplates["showhostile"] = savedHostileState
end
if savedFriendlyState == "1" then
C.nameplates["showfriendly"] = savedFriendlyState
end
savedHostileState = nil
savedFriendlyState = nil
-- Fall through to SetGameVariables to restore nameplates
end
-- update nameplate visibility
nameplates:SetGameVariables()