Quantcast

Added group conditions to the buff edit window, and ensured all conditions are being displayed

James Whitehead II [01-06-07 - 01:49]
Added group conditions to the buff edit window, and ensured all conditions are being displayed
Filename
PerfectRaid_Buffs.lua
diff --git a/PerfectRaid_Buffs.lua b/PerfectRaid_Buffs.lua
index 952d7a0..0588fe0 100644
--- a/PerfectRaid_Buffs.lua
+++ b/PerfectRaid_Buffs.lua
@@ -44,6 +44,11 @@ end

 function Buffs:Enable()
 	self:RegisterEvent("UNIT_AURA")
+	self:RegisterEvent("RAID_ROSTER_UPDATE")
+	if GetNumRaidMembers() > 0 then
+		self:RAID_ROSTER_UPDATE()
+	end
+
 	self:UpdateBuffTable()

 	for unit in pairs(frames) do
@@ -67,6 +72,20 @@ function Buffs:PERFECTRAID_TAB_CHANGED(old,new)
 	end
 end

+local raidLookup = {}
+for i=1,40 do
+	raidLookup[i] = "raid"..i
+end
+function Buffs:RAID_ROSTER_UPDATE()
+	if GetNumRaidMembers() > 0 then
+		for i=1,GetNumRaidMembers() do
+			local group = select(3, GetRaidRosterInfo(i))
+			local unit = raidLookup[i]
+			raidLookup[unit] = group
+		end
+	end
+end
+
 function Buffs:ConfigureButton(button)
 	local font = button:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
 	font:SetPoint("LEFT", button.rightbox, "LEFT", 3, 0)
@@ -121,9 +140,10 @@ function Buffs:UNIT_AURA(event, unit)

 		local class = select(2, UnitClass(unit))
 		local conds = self.conditions
+		local group = raidLookup[unit]
 		if checkcond then
 			for i,name in pairs(entry.cond) do
-				if conds[name] and conds[name](unit,class) then
+				if conds[name] and conds[name](unit,class,group) then
 					if num and num > 1 then
 						table.insert(work, entry.colortext .. "(" .. num .. ")")
 					else