Quantcast

Earth Shield and Riptide tracking much more precise.

Taracque [12-10-12 - 12:53]
Earth Shield and Riptide tracking much more precise.
Filename
Elementarist.lua
modules/restoration.lua
diff --git a/Elementarist.lua b/Elementarist.lua
index 7b0ab5c..21cf369 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -590,6 +590,9 @@ function Elementarist:UpdateAuraTracker()
 	if (not Elementarist.trackAura) then
 		return;
 	end;
+
+	Elementarist:CallModule( "UpdateAuraTracker" );
+
 	local name,tguid,icon,d,e;
 	if (not Elementarist.callbacks.COMBAT_LOG) then
 		name, _, icon, _, _, d, e = Elementarist:hasAura("target",Elementarist.trackAura,"player",Elementarist.trackFilter)
diff --git a/modules/restoration.lua b/modules/restoration.lua
index 9492d37..674f815 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -26,6 +26,7 @@ Elementarist.restoration = {
 		Elementarist.trackDuration = 18;
 		Elementarist.callbacks = {
 			["COMBAT_LOG"] = function(self,event,spellName,srcGUID,dstGUID)
+
 				if (Elementarist.auraCooldowns["0"]) and (Elementarist.auraCooldowns["0"].seen) and ((GetTime() - Elementarist.auraCooldowns["0"].seen)> 60 ) then
 					Elementarist.auraCooldowns["0"] = {};
 					Elementarist:SetTexture(Elementarist.textureList["debuff"],"");
@@ -47,13 +48,13 @@ Elementarist.restoration = {
 						if (event=="SPELL_CAST_SUCCESS") then
 							Elementarist.auraCooldowns["0"].charges = 9;
 							Elementarist.auraCooldowns["0"].guid = dstGUID;
-							Elementarist.auraCooldowns["0"].seend = GetTime();
+							Elementarist.auraCooldowns["0"].seen = GetTime();
 							Elementarist:SetTexture(Elementarist.textureList["debuff"],select(3, GetSpellInfo(Elementarist.SpellList["Earth Shield"])));
 							Elementarist.textureList["debuff"]:Show();
 						end;
 						if (event=="SPELL_HEAL") and (Elementarist.auraCooldowns["0"]) and (Elementarist.auraCooldowns["0"].charges) then
 							Elementarist.auraCooldowns["0"].charges = Elementarist.auraCooldowns["0"].charges - 1;
-							Elementarist.auraCooldowns["0"].seend = GetTime();
+							Elementarist.auraCooldowns["0"].seen = GetTime();
 						end;
 						if (Elementarist.auraCooldowns["0"]) and (Elementarist.auraCooldowns["0"].charges) then
 							Elementarist.textList['debuff']:SetText( Elementarist.auraCooldowns["0"].charges );
@@ -68,6 +69,50 @@ Elementarist.restoration = {
 			end;
 		};
 	end;
+	UpdateBuffs = function(self,unitID)
+		local name,count,d,e;
+		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;
+			Elementarist.auraCooldowns[ guid ]["start"] = e-d;
+			Elementarist.auraCooldowns[ guid ]["duration"] = d;
+			Elementarist.auraCooldowns[ guid ]["action"] = GetTime();
+		end;
+		-- refresh earth shield
+		name, _, _, count, _, d, e = Elementarist:hasAura( unitID, Elementarist.SpellList["Earth Shield"], "player", Elementarist.trackFilter);
+		if (name) then
+			if (not Elementarist.auraCooldowns["0"]) then
+				Elementarist.auraCooldowns["0"] = {}
+			end;
+			if (not Elementarist.auraCooldowns["0"]) or (not Elementarist.auraCooldowns["0"].charges) or (Elementarist.auraCooldowns["0"].charges == 0) then
+				Elementarist:SetTexture(Elementarist.textureList["debuff"],select(3, GetSpellInfo(Elementarist.SpellList["Earth Shield"])));
+				Elementarist.textureList["debuff"]:Show();
+				Elementarist.textList['debuff']:SetText( count );
+			end;
+			Elementarist.auraCooldowns["0"].charges = count;
+			Elementarist.auraCooldowns["0"].seen = GetTime();
+			Elementarist.auraCooldowns["0"].guid = UnitGUID(unitID);
+		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
+			groupType = "party";
+		end;
+		for i=1,GetNumGroupMembers() do
+			Elementarist.restoration:UpdateBuffs( groupType .. i );
+		end;
+		-- check player
+		Elementarist.restoration:UpdateBuffs( "player" );
+	end;

 	NextSpell = function(self,timeshift,exspell1,exspell2)
 		local i, count, e;