raid: only run during raid and always set label

This commit is contained in:
shagu
2020-03-05 19:28:47 +01:00
parent 47c8816bae
commit 4add42cdd4
+3 -2
View File
@@ -39,6 +39,7 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
local function SetRaidIndex(frame, id)
frame.id = id
frame.label = "raid"
if frame.SetAttribute and RegisterStateDriver then
frame:SetAttribute("unit", UnitName("raid" .. id))
@@ -66,8 +67,8 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
pfUI.uf.raid:RegisterEvent("VARIABLES_LOADED")
pfUI.uf.raid:SetScript("OnEvent", function() this:Show() end)
pfUI.uf.raid:SetScript("OnUpdate", function()
-- skip during combat
if InCombatLockdown and InCombatLockdown() then return end
-- don't proceed without raid or during combat
if not UnitInRaid("player") or (InCombatLockdown and InCombatLockdown()) then return end
-- clear all existing frames
for i=1, 40 do SetRaidIndex(pfUI.uf.raid[i], 0) end