Quantcast

Updated Rotation for Class trinket, addes Lightning shield count to Earth Shock, updated Aurau tracker for mini frames

BillLive [12-26-15 - 23:03]
Updated Rotation for Class trinket, addes Lightning shield count to Earth Shock, updated Aurau tracker for mini frames
Filename
Change_log.txt
Elementarist.lua
modules/elemental.lua
diff --git a/Change_log.txt b/Change_log.txt
index f4040c0..32e8ad9 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+***v3.6.1
+* Updated: Elemental Shaman rotation changed to cater for Class trinket
+
 ***v3.5.3
 * Fixed: Fixed Stormstrike range checking bug

diff --git a/Elementarist.lua b/Elementarist.lua
index 545d44f..9a43ff1 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -53,6 +53,7 @@ Elementarist.tier6Talent = nil
 Elementarist.tier7Talent = nil
 Elementarist.hasT17_4pcs = false
 Elementarist.hasT18_4pcs = false
+Elementarist.hasT18_Class_Trinket = false
 Elementarist.lastSpell = nil
 Elementarist.lastCastTime = nil
 Elementarist.CustomIDs = {
@@ -204,6 +205,7 @@ function Elementarist.events.PLAYER_ALIVE()
 	Elementarist:detectiLevel();
 	Elementarist.hasT17_4pcs = Elementarist:HasSetBonus( 165580, 4 );
 	Elementarist.hasT18_4pcs = Elementarist:HasSetBonus( 185872, 4 );
+	Elementarist.hasT18_Class_Trinket = Elementarist:HasTrinket(124521);
 	Elementarist:ApplySettings()

 	-- Elementarist.eventFrame:UnregisterEvent("PLAYER_ALIVE")
@@ -214,6 +216,8 @@ function Elementarist.events.PLAYER_ENTERING_WORLD()
 	Elementarist:detectiLevel();
 	Elementarist.hasT17_4pcs = Elementarist:HasSetBonus( 165580, 4 );
 	Elementarist.hasT18_4pcs = Elementarist:HasSetBonus( 185872, 4 );
+	Elementarist.hasT18_Class_Trinket = Elementarist:HasTrinket(124521);
+
 	Elementarist.faction = UnitFactionGroup("player");
 end

@@ -221,6 +225,8 @@ function Elementarist.events.PLAYER_EQUIPMENT_CHANGED()
 	Elementarist:detectiLevel();
 	Elementarist.hasT17_4pcs = Elementarist:HasSetBonus( 165580, 4 );
 	Elementarist.hasT18_4pcs = Elementarist:HasSetBonus( 185872, 4 );
+	Elementarist.hasT18_Class_Trinket = Elementarist:HasTrinket(124521);
+
 end

 function Elementarist.events.PLAYER_LOGIN()
@@ -379,6 +385,11 @@ function Elementarist:HasSetBonus(spellID,minCount)
 	return (setCount >= minCount);
 end

+function Elementarist:HasTrinket(itemID)
+	return (GetInventoryItemID("player",GetInventorySlotInfo("Trinket0Slot")) == itemID) or (GetInventoryItemID("player",GetInventorySlotInfo("Trinket1Slot")) == itemID) ;
+end
+
+
 function Elementarist:detectiLevel()
 	local _,ilvl = GetAverageItemLevel();
 	Elementarist.iLvl = ilvl;
@@ -725,7 +736,7 @@ function Elementarist:UpdateAuraTracker()
 			if (not v["start"]) then
 				v = {}
 			else
-				if ( (v["start"] + v["duration"]) > GetTime() ) and (i ~= tguid) and (m <= 10) and (v["action"]>GetTime() - 4) then
+				if ( (v["start"] + v["duration"]) > GetTime() ) and (i ~= tguid) and (m <= 10) then
 					Elementarist:SetTexture(Elementarist.textureList["debuff_" .. tostring(m)],icon)
 					Elementarist.auraCooldownFrame["mini_" .. tostring(m)]:SetCooldown( v["start"], v["duration"])
 					m = m + 1
@@ -952,8 +963,11 @@ function Elementarist:DecideSpells()
 			end
 		end
 		Elementarist:SetTexture(Elementarist.textureList["next"],GetSpellTexture(spell))
+

 		local count = GetSpellCharges(spell)
+		if spell == Elementarist.SpellList["Earth Shock"] then 	_, _, _, count = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"]) end
+
  		if count then
  			Elementarist.textList["next"]:SetText(count)
  		else
@@ -973,6 +987,7 @@ function Elementarist:DecideSpells()
 		Elementarist:SetTexture(Elementarist.textureList["next1"],GetSpellTexture(spell1))

 		count = GetSpellCharges(spell1)
+		if spell1 == Elementarist.SpellList["Earth Shock"] then 	_, _, _, count = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"]) end
 		if count then
 			Elementarist.textList["next1"]:SetText(count)
 		else
@@ -992,6 +1007,7 @@ function Elementarist:DecideSpells()
 		Elementarist:SetTexture(Elementarist.textureList["next2"],GetSpellTexture(spell2))

 		count = GetSpellCharges(spell2)
+		if spell2 == Elementarist.SpellList["Earth Shock"] then 	_, _, _, count = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"]) end
 		if count then
 			Elementarist.textList["next2"]:SetText(count)
 		else
diff --git a/modules/elemental.lua b/modules/elemental.lua
index 0589d4f..0db442c 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -27,6 +27,8 @@ Elementarist.elemental = {
 	};
 	Initialize = function(self)
 		Elementarist:LoadSpells({
+			["Unleash Flame"] = GetSpellInfo(165462),
+			["Elemental Fusion"] = GetSpellInfo(157174),
 			["Glyph of Flame Shock"] = GetSpellInfo(55447),
 			["Healing Stream Totem"] = GetSpellInfo(5394),
 			["Liquid Magma"] = GetSpellInfo(152255),
@@ -43,12 +45,25 @@ Elementarist.elemental = {
 		local guid = UnitGUID("target")
 		local currentTime = GetTime()
 		local s,d,e
-		local name, fsExpiration, unitCaster
+		local name, fsDuration, fsExpiration, unitCaster
 		local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration
 		local lastSpell
 		local doFS = false
 		local _
-		local lscount
+		local lscount,efCount
+		local EBTalent = (Elementarist.tier6Talent == 19267)
+		local UFTalent =  (Elementarist.tier6Talent == 21773)
+		local EFTalent = (Elementarist.tier7Talent == 21198)
+
+		local fsRefreshPercentage=0.3
+		if Elementarist.hasT18_Class_Trinket then fsRefreshPercentage=fsRefreshPercentage + 0.48 end
+		if UFTalent then fsRefreshPercentage=fsRefreshPercentage + 0.22 end
+		Elementarist:Debug(fsRefreshPercentage,  "fsRefreshPercentage",1)
+
+		 _, _, _, efCount = Elementarist:hasBuff("player",Elementarist.SpellList["Elemental Fusion"])
+		 if (efCount == nil) then
+		   efCount = 0
+		 end

 		if (exspell1) then
 			if (exspell2) then
@@ -64,6 +79,7 @@ Elementarist.elemental = {

 		local flameshockavail = false
 		local LvBct = 2 - (2 * Elementarist.spellHaste * .01)
+

 		-- check Shock CD
 		s, d = GetSpellCooldown(Elementarist.SpellList["Flame Shock"])
@@ -150,10 +166,8 @@ Elementarist.elemental = {
 		end

 		-- check if Flame shock applied on target first
-		name, _, _, _, _, _, fsExpiration, unitCaster = Elementarist:hasDeBuff("target", Elementarist.SpellList["Flame Shock"], "player");
-		if (not fsExpiration) then
-			fsExpiration = 0
-		end
+		name, _, _, _, _, fsDuration,fsExpiration, unitCaster = Elementarist:hasDeBuff("target", Elementarist.SpellList["Flame Shock"], "player");
+		if (not fsExpiration) then fsExpiration = 0 fsDuration = 0 end
 		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
 			if IsSpellInRange(Elementarist.SpellList["Flame Shock"], "target") == 1 then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
@@ -189,6 +203,19 @@ Elementarist.elemental = {
 			end
 		end

+		-- Flame shock if 2 stacks Elemental Fussion and Unleashed Flame buff active
+		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
+			if ((d - timeshift) <= 0) then
+				if (
+				   (efCount==2) and
+				   (Elementarist:hasBuff("player",Elementarist.SpellList["Unleash Flame"]) or Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) > 0) and 					   (fsExpiration - currentTime - timeshift) < (fsDuration * fsRefreshPercentage )
+				   ) then
+					return Elementarist.SpellList["Flame Shock"]
+				end
+			end
+		end
+
 		-- Lava Burst if not on Cooldown
 		local ascendance, _, _, _, _, _, ascendanceExp = Elementarist:hasBuff("player",Elementarist.SpellList["AscendanceElementalBuff"]);
 		if (ascendance == nil) then
@@ -217,13 +244,13 @@ Elementarist.elemental = {
 			end
 		end

-		-- Earth shock if Lightning Shield count >=17 and not on cd, and FS debuff remaining > FS cooldown, or FS debuff remaining between FS and FS cd + 2sec and LS count>=13, or has T17 4pcs and LS Count >= 12
+		-- Earth shock if Lightning Shield count >=15 and not on cd, and FS debuff remaining > FS cooldown, or FS debuff remaining between FS and FS cd + 2sec and LS count>=13, or has T17 4pcs and LS Count >= 12
 		if (Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0 and Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
 			if ( (fsExpiration - GetTime() - timeshift) > Elementarist.lastShockCD ) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
 				if (
 					( (d) and ((d-timeshift) <= 0) and (lscount) ) and (	-- Earth Shock is available, and has lightning shield
-						(lscount>=17) or 														-- Lightning shield has 17 charge
+						(lscount>=15) or 														-- Lightning shield has 17 charge
 						( (lscount>=13) and ( (fsExpiration - GetTime() - timeshift) < Elementarist.lastShockCD + 2 ) ) or	-- or, has 13 or more charges but FS expiration within 2 secs to FS CD
 						( (lscount>=12) and Elementarist.hasT17_4pcs) -- or has T17 4pcs bonus, and 12 or more charges on LS
 					)
@@ -233,16 +260,19 @@ Elementarist.elemental = {
 			end
 		end

-		-- Searing Totem
-		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
-			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
-			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift) then
- 				return Elementarist.SpellList["Searing Totem"];
+		-- refresh FS at 30% duration
+		if 	(Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0) and (Elementarist:Count(Elementarist.SpellList["Earth Shock"],spellInCast,exspell1,exspell2) == 0) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
+			if ((d - timeshift) <= 0) then
+				if ((fsExpiration - GetTime() - timeshift) < (fsDuration * 0.3) ) then
+					return Elementarist.SpellList["Flame Shock"]
+				end
 			end
 		end

+
 		-- if Tier6 talent is Elemental Blast use it
-		if (Elementarist.tier6Talent == 19267) then
+		if (EBTalent) then
 			if (
 				(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
 				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
@@ -254,8 +284,19 @@ Elementarist.elemental = {
 			end
 		end

-		-- if Tier6 talent is Unleashed Fury Unleash Flame
-		if (Elementarist.tier6Talent == 21773) then
+
+		-- Searing Totem
+		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
+			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= timeshift) then
+ 				return Elementarist.SpellList["Searing Totem"];
+			end
+		end
+
+
+		-- if Tier6 talent is Unleashed Fury cast Unleash Flame
+		if (UFTalent)  or
+		   (efCount==2 and ( (fsExpiration - currentTime - timeshift) < (fsDuration * fsRefreshPercentage )  and (fsExpiration - currentTime - timeshift) > Elementarist.lastShockCD)    ) then
 			if (Elementarist:Count(Elementarist.SpellList["Unleash Flame"],spellInCast,exspell1,exspell2) == 0) then
 				e = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Flame"])
 				if (e-timeshift <= 0) then
@@ -264,12 +305,7 @@ Elementarist.elemental = {
 			end
 		end

-		-- refresh FS
-		if 	(Elementarist:Count(Elementarist.SpellList["Flame Shock"],spellInCast,exspell1,exspell2) == 0) then
-			if (doFS) and ((fsExpiration - GetTime() - timeshift) < 9) then
-				return Elementarist.SpellList["Flame Shock"]
-			end
-		end
+

 		-- otherwise lightning bolt
 		if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then