mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-21 03:40:49 +00:00
raid: fix raidframe groups for tbc
This commit is contained in:
+29
-15
@@ -39,24 +39,41 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function SetRaidIndex(frame, id)
|
||||||
|
frame.id = id
|
||||||
|
|
||||||
|
if frame.SetAttribute and RegisterStateDriver then
|
||||||
|
frame:SetAttribute("unit", UnitName("raid" .. id))
|
||||||
|
frame.visibilitycondition = string.format("[target=%s,exists] show; hide", id > 0 and UnitName("raid" .. id) or "__NONE__")
|
||||||
|
RegisterStateDriver(frame, 'visibility', frame.visibilitycondition)
|
||||||
|
else
|
||||||
|
if id > 0 then frame:Show() else frame:Hide() end
|
||||||
|
pfUI.uf:RefreshUnit(frame, "all")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- add units to the beginning of their groups
|
-- add units to the beginning of their groups
|
||||||
function pfUI.uf.raid:AddUnitToGroup(index, group)
|
function pfUI.uf.raid:AddUnitToGroup(index, group)
|
||||||
for subindex = 1, 5 do
|
for subindex = 1, 5 do
|
||||||
local ids = subindex + 5*(group-1)
|
local ids = subindex + 5*(group-1)
|
||||||
if pfUI.uf.raid[ids].id == 0 and pfUI.uf.raid[ids].config.visible == "1" then
|
if pfUI.uf.raid[ids].id == 0 and pfUI.uf.raid[ids].config.visible == "1" then
|
||||||
pfUI.uf.raid[ids].id = index
|
SetRaidIndex(pfUI.uf.raid[ids], index)
|
||||||
pfUI.uf.raid[ids]:Show()
|
return
|
||||||
pfUI.uf:RefreshUnit(pfUI.uf.raid[ids], "all")
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function pfUI.uf.raid:RaidSetup()
|
pfUI.uf.raid:Hide()
|
||||||
for i=1, 40 do
|
pfUI.uf.raid:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||||
pfUI.uf.raid[i].id = 0
|
pfUI.uf.raid:RegisterEvent("VARIABLES_LOADED")
|
||||||
pfUI.uf.raid[i]:Hide()
|
pfUI.uf.raid:SetScript("OnEvent", function() this:Show() end)
|
||||||
end
|
pfUI.uf.raid:SetScript("OnUpdate", function()
|
||||||
|
-- skip during combat
|
||||||
|
if InCombatLockdown and InCombatLockdown() then return end
|
||||||
|
|
||||||
|
-- clear all existing frames
|
||||||
|
for i=1, 40 do SetRaidIndex(pfUI.uf.raid[i], 0) end
|
||||||
|
|
||||||
-- sort tanks into their groups
|
-- sort tanks into their groups
|
||||||
for i=1, GetNumRaidMembers() do
|
for i=1, GetNumRaidMembers() do
|
||||||
@@ -73,12 +90,9 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
|
|||||||
pfUI.uf.raid:AddUnitToGroup(i, subgroup)
|
pfUI.uf.raid:AddUnitToGroup(i, subgroup)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
pfUI.uf.raid:Hide()
|
this:Hide()
|
||||||
pfUI.uf.raid:RegisterEvent("RAID_ROSTER_UPDATE")
|
end)
|
||||||
pfUI.uf.raid:RegisterEvent("VARIABLES_LOADED")
|
|
||||||
pfUI.uf.raid:SetScript("OnEvent", function() pfUI.uf.raid:RaidSetup() end)
|
|
||||||
|
|
||||||
-- raid popup option to toggle tank role
|
-- raid popup option to toggle tank role
|
||||||
local iupm = table.getn(UnitPopupMenus["RAID"])
|
local iupm = table.getn(UnitPopupMenus["RAID"])
|
||||||
@@ -95,7 +109,7 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
|
|||||||
|
|
||||||
if button and pfUI.uf.raid.tanksfirst[button] and name then
|
if button and pfUI.uf.raid.tanksfirst[button] and name then
|
||||||
pfUI.uf.raid.tankrole[name] = not pfUI.uf.raid.tankrole[name]
|
pfUI.uf.raid.tankrole[name] = not pfUI.uf.raid.tankrole[name]
|
||||||
pfUI.uf.raid:RaidSetup()
|
pfUI.uf.raid:Show()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user