Quantcast

Restoration fixes

Taracque [12-27-12 - 23:56]
Restoration fixes
Filename
modules/restoration.lua
diff --git a/modules/restoration.lua b/modules/restoration.lua
index b8db8e9..17d01b7 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -72,9 +72,10 @@ Elementarist.restoration = {
 	end;
 	UpdateBuffs = function(self,unitID)
 		local name,count,d,e;
+		local guid = UnitGUID(unitID);
+
 		name, _, _, _, _, d, e = Elementarist:hasAura(unitID,Elementarist.trackAura,"player",Elementarist.trackFilter);
 		if (name) then
-			local guid = UnitGUID(unitID);
 			if (not Elementarist.auraCooldowns[ guid ]) then
 				Elementarist.auraCooldowns[ guid ] = {};
 			end;
@@ -90,24 +91,30 @@ Elementarist.restoration = {
 			end;
 			if (not Elementarist.auraCooldowns["0"]) or (not Elementarist.auraCooldowns["0"].charges) or (Elementarist.auraCooldowns["0"].charges ~= count) then
 				Elementarist:SetTexture(Elementarist.textureList["debuff"],select(3, GetSpellInfo(Elementarist.SpellList["Earth Shield"])));
-				if ( Elementarist.auraCooldowns["0"].charges == 0 ) then
+				if ( count == 0 ) then
 					Elementarist.textureList["debuff"]:SetTexture(Elementarist.textureList["debuff"],"");
 					Elementarist.textList['debuff']:SetText("");
 				else
 					Elementarist.textureList["debuff"]:Show();
-					Elementarist.textList['debuff']:SetText( Elementarist.auraCooldowns["0"].charges );
+					Elementarist.textList['debuff']:SetText( count );
 				end
 			end;
 			Elementarist.auraCooldowns["0"].charges = count;
 			Elementarist.auraCooldowns["0"].seen = GetTime();
-			Elementarist.auraCooldowns["0"].guid = UnitGUID(unitID);
-		end;
+			Elementarist.auraCooldowns["0"].guid = guid;
+		else
+			if ((Elementarist.auraCooldowns["0"] ) and (Elementarist.auraCooldowns["0"].guid) and (Elementarist.auraCooldowns["0"].guid == guid)) then
+				Elementarist.auraCooldowns["0"] = {};
+				Elementarist:SetTexture(Elementarist.textureList["debuff"],"");
+				Elementarist.textList['debuff']:SetText("");
+			end
+		end
 	end;

 	UpdateAuraTracker = function(self)
 		-- check all friendly units and refresh buff durations (Riptide and Earth Shield)
 		local _,i,friendGUID,name,count,d,e,groupType;
-
+
 		if (Elementarist.inParty == 2) then
 			groupType = "raid";
 		elseif (Elementarist.inParty == 1) then
@@ -165,7 +172,7 @@ Elementarist.restoration = {
 		-- Healing Tide Totem
 		if (exspell1 ~= Elementarist.SpellList["Healing Tide Totem"]) and (exspell2 ~= Elementarist.SpellList["Healing Tide Totem"]) then
 			e = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Healing Tide Totem"]);
-			if (e-timeshift <= 0) then
+			if (e) and (e-timeshift <= 0) then
 				return Elementarist.SpellList["Healing Tide Totem"];
 			end;
 		end;