mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 22:00:49 +00:00
nameplates: don't pollute parent frame with shortcuts
This commit is contained in:
+14
-13
@@ -168,22 +168,23 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
|
|||||||
nameplate.cache = {}
|
nameplate.cache = {}
|
||||||
nameplate.UnitDebuff = PlateUnitDebuff
|
nameplate.UnitDebuff = PlateUnitDebuff
|
||||||
nameplate.CacheDebuffs = PlateCacheDebuffs
|
nameplate.CacheDebuffs = PlateCacheDebuffs
|
||||||
|
nameplate.original = {}
|
||||||
|
|
||||||
-- create shortcuts for all known elements and disable them
|
-- create shortcuts for all known elements and disable them
|
||||||
parent.healthbar, parent.castbar = parent:GetChildren()
|
nameplate.original.healthbar, nameplate.original.castbar = parent:GetChildren()
|
||||||
DisableObject(parent.healthbar)
|
DisableObject(nameplate.original.healthbar)
|
||||||
DisableObject(parent.castbar)
|
DisableObject(nameplate.original.castbar)
|
||||||
|
|
||||||
for i, object in pairs({parent:GetRegions()}) do
|
for i, object in pairs({parent:GetRegions()}) do
|
||||||
if NAMEPLATE_OBJECTORDER[i] and NAMEPLATE_OBJECTORDER[i] == "raidicon" then
|
if NAMEPLATE_OBJECTORDER[i] and NAMEPLATE_OBJECTORDER[i] == "raidicon" then
|
||||||
nameplate[NAMEPLATE_OBJECTORDER[i]] = object
|
nameplate[NAMEPLATE_OBJECTORDER[i]] = object
|
||||||
else
|
else
|
||||||
parent[NAMEPLATE_OBJECTORDER[i]] = object
|
nameplate.original[NAMEPLATE_OBJECTORDER[i]] = object
|
||||||
DisableObject(object)
|
DisableObject(object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
HookScript(parent.healthbar, "OnValueChanged", nameplates.OnValueChanged)
|
HookScript(nameplate.original.healthbar, "OnValueChanged", nameplates.OnValueChanged)
|
||||||
|
|
||||||
-- adjust sizes and scaling of the nameplate
|
-- adjust sizes and scaling of the nameplate
|
||||||
nameplate:SetScale(UIParent:GetScale())
|
nameplate:SetScale(UIParent:GetScale())
|
||||||
@@ -382,18 +383,18 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
|
|||||||
end
|
end
|
||||||
|
|
||||||
nameplates.OnDataChanged = function(self, plate)
|
nameplates.OnDataChanged = function(self, plate)
|
||||||
local hp = plate.parent.healthbar:GetValue()
|
local hp = plate.original.healthbar:GetValue()
|
||||||
local hpmin, hpmax = plate.parent.healthbar:GetMinMaxValues()
|
local hpmin, hpmax = plate.original.healthbar:GetMinMaxValues()
|
||||||
local name = plate.parent.name:GetText()
|
local name = plate.original.name:GetText()
|
||||||
local level = plate.parent.level:IsShown() and plate.parent.level:GetObjectType() == "FontString" and tonumber(plate.parent.level:GetText()) or "??"
|
local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??"
|
||||||
local class, _, elite, player = GetUnitData(name, true)
|
local class, _, elite, player = GetUnitData(name, true)
|
||||||
local target = UnitExists("target") and plate.parent:GetAlpha() == 1 or nil
|
local target = UnitExists("target") and plate.parent:GetAlpha() == 1 or nil
|
||||||
local mouseover = UnitExists("mouseover") and plate.parent.glow:IsShown() or nil
|
local mouseover = UnitExists("mouseover") and plate.original.glow:IsShown() or nil
|
||||||
local unitstr = target and "target" or mouseover and "mouseover" or nil
|
local unitstr = target and "target" or mouseover and "mouseover" or nil
|
||||||
local red, green, blue = plate.parent.healthbar:GetStatusBarColor()
|
local red, green, blue = plate.original.healthbar:GetStatusBarColor()
|
||||||
local unittype = GetUnitType(red, green, blue)
|
local unittype = GetUnitType(red, green, blue)
|
||||||
if player and unittype == "ENEMY_NPC" then unittype = "ENEMY_PLAYER" end
|
if player and unittype == "ENEMY_NPC" then unittype = "ENEMY_PLAYER" end
|
||||||
elite = plate.parent.levelicon:IsShown() and not player and "boss" or elite
|
elite = plate.original.levelicon:IsShown() and not player and "boss" or elite
|
||||||
if not class then plate.wait_for_scan = true end
|
if not class then plate.wait_for_scan = true end
|
||||||
|
|
||||||
-- target event sometimes fires too quickly, where nameplate identifiers are not
|
-- target event sometimes fires too quickly, where nameplate identifiers are not
|
||||||
@@ -521,7 +522,7 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
|
|||||||
local frame = frame or this
|
local frame = frame or this
|
||||||
local name = frame.name:GetText()
|
local name = frame.name:GetText()
|
||||||
local target = UnitExists("target") and frame:GetAlpha() == 1 or nil
|
local target = UnitExists("target") and frame:GetAlpha() == 1 or nil
|
||||||
local mouseover = UnitExists("mouseover") and frame.glow:IsShown() or nil
|
local mouseover = UnitExists("mouseover") and frame.nameplate.original.glow:IsShown() or nil
|
||||||
|
|
||||||
if frame:GetAlpha() < tonumber(C.nameplates.notargalpha) then frame:SetAlpha(tonumber(C.nameplates.notargalpha)) end
|
if frame:GetAlpha() < tonumber(C.nameplates.notargalpha) then frame:SetAlpha(tonumber(C.nameplates.notargalpha)) end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user