party support added (untested)
Dorwido [10-26-11 - 12:34]
party support added (untested)
diff --git a/HealerManaWatch.lua b/HealerManaWatch.lua
index a65447f..ea3d7d2 100644
--- a/HealerManaWatch.lua
+++ b/HealerManaWatch.lua
@@ -14,6 +14,7 @@ f:SetWidth(barsize.width)
function f:OnLoad()
f:SetScript("OnEvent",f.EventHandler);
f:RegisterEvent("RAID_ROSTER_UPDATE");
+ f:RegisterEvent("PARTY_MEMBERS_CHANGED");
f:RegisterEvent("ADDON_LOADED");
end
@@ -90,6 +91,7 @@ function f:EventHandler(event,...)
if(event=="RAID_ROSTER_UPDATE") then
if not(UnitInRaid("player")) then
f:DisableMod();
+ f:RegisterEvent("PARTY_MEMBERS_CHANGED"); --reactive party watching on raid leave
return;
end
local _,name,class,role
@@ -112,6 +114,53 @@ function f:EventHandler(event,...)
if (modactive==false) then
f:EnableMod()
end
+ elseif(event=="PARTY_MEMBERS_CHANGED") then
+ if UnitInRaid("player") then
+ f:UnregisterEvent("PARTY_MEMBERS_CHANGED"); --no need to use this if in raid
+ return;
+ elseif not(UnitInParty("player") then
+ f:DisableMod();
+ end
+
+ watching = {}
+ f:HideBars();
+
+ if(UnitGroupRolesAssigned("player")=="HEALER") then
+ unittowatch = "player";
+ else
+ for i=1,GetNumPartyMembers() do
+ if(UnitGroupRolesAssigned("party"..i) == "HEALER") then
+ unittowatch = "party"..i;
+ end
+ end
+ end
+ if(unittowatch == nil) then
+ if (modactive==true) then
+ f:DisableMod();
+ modactive=false;
+ end
+ return; --no healer in party currently
+ end
+
+
+ local _,isdead,online,name,class;
+ watching[unittowatch]=1;
+ isdead = UnitIsDeadOrGhost(unittowatch);
+ name = UnitName(unittowatch);
+ online = UnitIsConnected(unittowatch);
+ _,class = UnitClass(unittowatch);
+
+ local mb = f:CreateOrReturnBar(1,name,RAID_CLASS_COLORS[class],online,isdead)
+ if(online==1 and isdead==nil) then
+ f:UpdateMana(unittowatch,"MANA");
+ end
+ mb:Show()
+
+
+ if (modactive==false) then
+ f:EnableMod()
+ end
+
elseif(event=="UNIT_POWER" or event=="UNIT_MAXPOWER") then
local unitid,powertype = ...;
f:UpdateMana(unitid,powertype);
@@ -180,4 +229,4 @@ f:RegisterForDrag("LeftButton");
f:SetMovable(true);
f:SetScript("OnDragStart", function(self) if IsShiftKeyDown() then self:StartMoving() end end)
f:SetScript("OnDragStop", function(self) self:StopMovingOrSizing(); local a,b,c,d,e = self:GetPoint(); if(b~=nil) then b=b:GetName(); end; HealerManaWatchSaved.points = {a,b,c,d,e} end);
-f:OnLoad();
\ No newline at end of file
+f:OnLoad();
diff --git a/HealerManaWatch.toc b/HealerManaWatch.toc
index e422beb..faa4b1d 100644
--- a/HealerManaWatch.toc
+++ b/HealerManaWatch.toc
@@ -1,7 +1,7 @@
## Interface: 40200
## Title: Healer Mana Watch
## Author: DarkStarX
-## Version: 1.0.3
+## Version: 1.1.0
## Notes: Shows the percentage of healers a bar
## SavedVariablesPerCharacter: HealerManaWatchSaved