Quantcast

* Fixed: Storm Elemental totem

Taracque [09-14-15 - 14:05]
* Fixed: Storm Elemental totem
* Fixed: Completely new Enchancement rotation (thanks billlive)
* Added: Charge indicator to spell icons
Filename
Change_log.txt
Ele_GUI.lua
Elementarist.lua
modules/elemental.lua
modules/enhancement.lua
diff --git a/Change_log.txt b/Change_log.txt
index 4c3213d..0d5814a 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,8 @@
+***v3.4.8
+* Fixed: Storm Elemental totem
+* Fixed: Completely new Enchancement rotation (thanks billlive)
+* Added: Charge indicator to spell icons
+
 ***v3.4.7
 * Fixed: a typo in elemental rotation

diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index 01ceb2d..5a2c8da 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -653,6 +653,42 @@ function Elementarist:CreateGUI()
 	t:SetText("")
 	Elementarist.textList["dps"] = t

+	 t = displayFrame_next:CreateFontString("$parent_nextText","OVERLAY","GameFontHighlightLarge");
+	 t:SetAllPoints(displayFrame_next)
+	 t:SetAlpha(1);
+	 t:SetText("");
+	 t:SetJustifyH("RIGHT");
+	 t:SetJustifyV("BOTTOM");
+	 t:SetTextHeight(16);
+	 Elementarist.textList["next"] = t
+
+	 t = displayFrame_next1:CreateFontString("$parent_nextText","OVERLAY","GameFontHighlightLarge");
+	 t:SetAllPoints(displayFrame_next1)
+	 t:SetAlpha(1);
+	 t:SetText("");
+	 t:SetJustifyH("RIGHT");
+	 t:SetJustifyV("BOTTOM");
+	 t:SetTextHeight(16);
+	 Elementarist.textList["next1"] = t
+
+	 t = displayFrame_next2:CreateFontString("$parent_nextText","OVERLAY","GameFontHighlightLarge");
+	 t:SetAllPoints(displayFrame_next2)
+	 t:SetAlpha(1);
+	 t:SetText("");
+	 t:SetJustifyH("RIGHT");
+	 t:SetJustifyV("BOTTOM");
+	 t:SetTextHeight(16);
+	 Elementarist.textList["next2"] = t
+
+	 t = displayFrame_int:CreateFontString("$parent_intText","OVERLAY","GameFontHighlightLarge");
+	 t:SetAllPoints(displayFrame_int)
+	 t:SetAlpha(1);
+	 t:SetText("");
+	 t:SetJustifyH("RIGHT");
+	 t:SetJustifyV("BOTTOM");
+	 t:SetTextHeight(16);
+	 Elementarist.textList["int"] = t
+
 	displayFrame:SetScript("OnUpdate", function(this, elapsed)
 		Elementarist:OnUpdate(elapsed)
 	end)
diff --git a/Elementarist.lua b/Elementarist.lua
index 8704fba..e19751a 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.4.7
+-- Elementarist 3.4.8
 --
 -- Shows the advised spell for an elemental shaman for optimal DPS output.
 -------------------------------------------------------------------------------
@@ -8,7 +8,7 @@ Elementarist = {Locals = {}}

 local L = Elementarist.Locals

-Elementarist.versionNumber = '3.4.7';
+Elementarist.versionNumber = '3.4.8';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
@@ -45,11 +45,14 @@ Elementarist.SFHistory = {
 Elementarist.iLvl = 0;
 Elementarist.talent = ""
 Elementarist.role = ""
+Elementarist.faction = nil
 Elementarist.talentUnsure = true
 Elementarist.callbacks = {};
+Elementarist.tier4Talent = nil
 Elementarist.tier6Talent = nil
 Elementarist.tier7Talent = nil
 Elementarist.hasT17_4pcs = false
+Elementarist.hasT18_4pcs = false
 Elementarist.lastSpell = nil
 Elementarist.lastCastTime = nil
 Elementarist.CustomIDs = {
@@ -58,7 +61,10 @@ Elementarist.CustomIDs = {
 	["Crystal of Insanity Item"] = 86569,
 	["Crystal of Insanity Spell"] = 127230,
 	["Whispers of Insanity Item"] = 118922,
-	["Whispers of Insanity Spell"] = 176151
+	["Whispers of Insanity Spell"] = 176151,
+	["Empowered Augment Rune Alliance"] = 128482,
+	["Empowered Augment Rune Horde"] = 128475,
+	["Focus Augment Rune"] = 118632,
 }
 Elementarist.SpellList = {
 	["Ghost Wolf"] = GetSpellInfo(2645),
@@ -88,6 +94,7 @@ Elementarist.SpellList = {
 	["Alchemist's Flask"] = GetSpellInfo(Elementarist.CustomIDs["Alchemist's Flask Spell"]),
 	["Crystal of Insanity"] = GetSpellInfo(Elementarist.CustomIDs["Crystal of Insanity Spell"]),
 	["Whispers of Insanity"] = GetSpellInfo(Elementarist.CustomIDs["Whispers of Insanity Spell"]),
+	["Focus Augmentation"] = GetSpellInfo(175457),
 	["Flask of the Draconic Mind"] = GetSpellInfo(79470),
 	["Flask of the Warm Sun"] = GetSpellInfo(105691),
 	["Draenic Intellect Flask"] =GetSpellInfo(156070),
@@ -114,10 +121,16 @@ Elementarist.textureList = {
 Elementarist.ArmorSets = {
 	[165580]	= {	-- Shaman T17 DPS 4P Bonus
 		[115575] = true, [115576] = true, [115577] = true, [115578] = true, [115579] = true
+	},
+	[185872]	= {	-- Shaman T18 DPS 4P Bonus
+		[124293] = true, [124297] = true, [124302] = true, [124303] = true, [124308] = true
 	}
 }

 Elementarist.textList = {
+	["next"] = nil,
+	["next1"] = nil,
+	["next2"] = nil,
 	["dps"] = nil,
 	["debuff"] = nil,
 	["shield"] = nil
@@ -188,6 +201,7 @@ function Elementarist.events.PLAYER_ALIVE()
 	Elementarist:detectTalent()
 	Elementarist:detectiLevel();
 	Elementarist.hasT17_4pcs = Elementarist:HasSetBonus( 165580, 4 );
+	Elementarist.hasT18_4pcs = Elementarist:HasSetBonus( 185872, 4 );
 	Elementarist:ApplySettings()

 	-- Elementarist.eventFrame:UnregisterEvent("PLAYER_ALIVE")
@@ -197,11 +211,14 @@ function Elementarist.events.PLAYER_ENTERING_WORLD()
 	Elementarist:detectTalent();
 	Elementarist:detectiLevel();
 	Elementarist.hasT17_4pcs = Elementarist:HasSetBonus( 165580, 4 );
+	Elementarist.hasT18_4pcs = Elementarist:HasSetBonus( 185872, 4 );
+	Elementarist.faction = UnitFactionGroup("player");
 end

 function Elementarist.events.PLAYER_EQUIPMENT_CHANGED()
 	Elementarist:detectiLevel();
 	Elementarist.hasT17_4pcs = Elementarist:HasSetBonus( 165580, 4 );
+	Elementarist.hasT18_4pcs = Elementarist:HasSetBonus( 185872, 4 );
 end

 function Elementarist.events.PLAYER_LOGIN()
@@ -386,7 +403,7 @@ function Elementarist:detectTalent()
 	if (spec == 3) then
 		talent = "restoration"
 	end
-
+	_, Elementarist.tier4Talent = GetTalentRowSelectionInfo(4);
 	_, Elementarist.tier6Talent = GetTalentRowSelectionInfo(6);
 	_, Elementarist.tier7Talent = GetTalentRowSelectionInfo(7);

@@ -888,6 +905,18 @@ function Elementarist:FlashSpell(spell,spelltype)
 	end
 end

+function Elementarist:EmptyFrames()
+	Elementarist:SetTexture(Elementarist.textureList["next"],"")
+	Elementarist:SetTexture(Elementarist.textureList["next1"],"")
+	Elementarist:SetTexture(Elementarist.textureList["next2"],"")
+	Elementarist.textList["next"]:SetText("")
+	Elementarist.textList["next1"]:SetText("")
+	Elementarist.textList["next2"]:SetText("")
+	Elementarist.textList["int"]:SetText("")
+	Elementarist:SetTexture(Elementarist.textureList["misc"],"")
+	Elementarist:SetTexture(Elementarist.textureList["int"],"")
+end
+
 function Elementarist:DecideSpells()
 	if (not Elementarist.enabled) then
 		return;
@@ -902,34 +931,13 @@ function Elementarist:DecideSpells()
 		guid = nil
 	end

-	if (ElementaristDB.advisordisabled) or (UnitInVehicle("player") and HasVehicleActionBar()) then
+	if (ElementaristDB.advisordisabled) or (UnitInVehicle("player") and HasVehicleActionBar()) or (((guid == nil) or (UnitHealth("target") == 0)) and (Elementarist.role == "DPS")) then
 		-- player is in a "vehicle" or advisor disabled, so don't suggest spell
-		Elementarist:SetTexture(Elementarist.textureList["next"],"")
-		Elementarist:SetTexture(Elementarist.textureList["next1"],"")
-		Elementarist:SetTexture(Elementarist.textureList["next2"],"")
-		Elementarist:SetTexture(Elementarist.textureList["misc"],"")
-		Elementarist:SetTexture(Elementarist.textureList["int"],"")
+		Elementarist:EmptyFrames()

 		return
 	end

-	if (guid == nil) and (Elementarist.role == "DPS") then
-		Elementarist:SetTexture(Elementarist.textureList["next"],"")
-		Elementarist:SetTexture(Elementarist.textureList["next1"],"")
-		Elementarist:SetTexture(Elementarist.textureList["next2"],"")
-		Elementarist:SetTexture(Elementarist.textureList["misc"],"")
-		Elementarist:SetTexture(Elementarist.textureList["int"],"")
-
-		return
-	end
-  	if (UnitHealth("target") == 0) and (Elementarist.role == "DPS") then
-		Elementarist:SetTexture(Elementarist.textureList["next"],"")
-		Elementarist:SetTexture(Elementarist.textureList["next1"],"")
-		Elementarist:SetTexture(Elementarist.textureList["next2"],"")
-
-		return
-  	end
-
 	local spell = ""
 	spell = Elementarist:NextSpell()
 	if (spell) then
@@ -942,7 +950,14 @@ function Elementarist:DecideSpells()
 			end
 		end
 		Elementarist:SetTexture(Elementarist.textureList["next"],GetSpellTexture(spell))
-
+
+		local count = GetSpellCharges(spell)
+ 		if count then
+ 			Elementarist.textList["next"]:SetText(count)
+ 		else
+ 			Elementarist.textList["next"]:SetText("")
+ 		end
+
 		local _,_,_,ct1=GetSpellInfo(spell)
 		if (not ct1) then
 			ct1 = 0
@@ -955,6 +970,13 @@ function Elementarist:DecideSpells()
 		local spell1 = Elementarist:NextSpell(ct1,spell)
 		Elementarist:SetTexture(Elementarist.textureList["next1"],GetSpellTexture(spell1))

+		count = GetSpellCharges(spell1)
+		if count then
+			Elementarist.textList["next1"]:SetText(count)
+		else
+			Elementarist.textList["next1"]:SetText("")
+		end
+
 		local _,_,_,ct2=GetSpellInfo(spell1)
 		if (not ct2) then
 			ct2 = 0
@@ -966,6 +988,14 @@ function Elementarist:DecideSpells()
 		end
 		local spell2 = Elementarist:NextSpell(ct1+ct2,spell,spell1)
 		Elementarist:SetTexture(Elementarist.textureList["next2"],GetSpellTexture(spell2))
+
+		count = GetSpellCharges(spell2)
+		if count then
+			Elementarist.textList["next2"]:SetText(count)
+		else
+			Elementarist.textList["next2"]:SetText("")
+		end
+
 	end

 	if (not ElementaristDB.disableMini) then
@@ -985,6 +1015,12 @@ function Elementarist:DecideSpells()
 		spell = Elementarist:IntSpell()
 		Elementarist:FlashSpell(spell,"int")
 		Elementarist:SetTexture(Elementarist.textureList["int"],GetSpellTexture(spell))
+		count = GetSpellCharges(spell)
+		if count then
+			Elementarist.textList["int"]:SetText(count)
+		else
+			Elementarist.textList["int"]:SetText("")
+		end
 	end
 end

diff --git a/modules/elemental.lua b/modules/elemental.lua
index 9525796..0589d4f 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -31,6 +31,7 @@ Elementarist.elemental = {
 			["Healing Stream Totem"] = GetSpellInfo(5394),
 			["Liquid Magma"] = GetSpellInfo(152255),
 			["Enhanced Chain Lightning"]  = GetSpellInfo(157766),
+			["Storm Elemental Totem"] = GetSpellInfo(152256)
 		});

 		Elementarist.role = "DPS";
@@ -43,6 +44,7 @@ Elementarist.elemental = {
 		local currentTime = GetTime()
 		local s,d,e
 		local name, fsExpiration, unitCaster
+		local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration
 		local lastSpell
 		local doFS = false
 		local _
@@ -130,7 +132,7 @@ Elementarist.elemental = {
 		-- if Tier7 talent is Liquid Magma and fire totem has 10 sec or more, use it
 		if (Elementarist.tier7Talent == 21200) and (not ElementaristDB.DisableLM) then
 			if (Elementarist:Count(Elementarist.SpellList["Liquid Magma"],spellInCast,exspell1,exspell2) == 0) then
-				local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
+				haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
 				if ((fireTotemName ~= "") and (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) >= timeshift + 15)) or
 					(Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) ~= 0) then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Liquid Magma"])
@@ -292,6 +294,21 @@ Elementarist.elemental = {
 		local d, e
 		local name, expirationTime, _, name2, expirationTime2, name3, expirationTime3

+		------  Augment Rune
+		if (
+			(
+				((Elementarist.faction == "Horde") and (GetItemCount(Elementarist.CustomIDs["Empowered Augment Rune Horde"]) ~= 0)) or
+				((Elementarist.faction == "Alliance") and (GetItemCount(Elementarist.CustomIDs["Empowered Augment Rune Alliance"]) ~= 0))
+			) and ( not  Elementarist:hasBuff("player", Elementarist.SpellList["Focus Augmentation"]))
+		) then
+        	if (
+        		((Elementarist.faction == "Horde") and (Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Empowered Augment Rune Horde"]) < 2)) or
+        		((Elementarist.faction == "Alliance") and (Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Empowered Augment Rune Alliance"]) < 2))
+        	) then
+				return nil,GetItemIcon(Elementarist.CustomIDs["Empowered Augment Rune Horde"])
+			end
+       	end
+
 		-- Alchemy Flask of Enhancement
 		if	(
 			((GetItemCount(Elementarist.CustomIDs["Whispers of Insanity Item"]) ~= 0) and (Elementarist.playerLevel >= 90)  ) or
@@ -341,9 +358,17 @@ Elementarist.elemental = {
 				return Elementarist.SpellList["Lightning Shield"]
 			end
 		end
+
+		-- Fire Elemental Totem
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Fire Elemental Totem"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Fire Elemental Totem"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Fire Elemental Totem"]
+			end
+		end

 		-- Storm Elemental Totem
-		if (Elementarist.tier7Talent == Elementarist.CustomIDs["Storm Elemental Talent"]) then
+		if (Elementarist.tier7Talent == 21199) then
 			if Elementarist:SpellAvailable(Elementarist.SpellList["Storm Elemental Totem"]) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Storm Elemental Totem"])
 				if d <= 0.5 then
@@ -352,16 +377,6 @@ Elementarist.elemental = {
 			end
 		end

---[[
-		-- Searing Totem
-		if Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"]) then
-			local haveFireTotem,fireTotemName,_,_ = GetTotemInfo(1)
-			if (fireTotemName == "") then
-				-- no fire totem
-				return Elementarist.SpellList["Searing Totem"]
-			end
-		end
---]]
 		-- Liquid Magma if not in rotation and Tier7 talent is Liquid Magma and fire totem has 10 sec or more
 		if (Elementarist.tier7Talent == 21200) and (ElementaristDB.DisableLM) then
 			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
diff --git a/modules/enhancement.lua b/modules/enhancement.lua
index 0d85e17..b3f2338 100755
--- a/modules/enhancement.lua
+++ b/modules/enhancement.lua
@@ -15,20 +15,31 @@ Elementarist.enhancement = {
 			["Healing Stream Totem"] = GetSpellInfo(5394),
 			["Maelstrom Weapon"] = GetSpellInfo(51530),
 			["Stormstrike"] = GetSpellInfo(17364),
-			["Windstrike"] = 115357,		-- not is spellbook ID used
+			["Windstrike"] = 115357,		-- not in spellbook, ID must be used!
 			["Lava Lash"] = GetSpellInfo(60103),
 			["Unleash Flame"] = GetSpellInfo(165462),
 			["Unleash Elements"] = GetSpellInfo(73680),
 			["Frost Shock"] = GetSpellInfo(8056),
 			["Flask of Spring Blossoms"] = GetSpellInfo(76084),
-			["AscendanceEnhancementBuff"] = GetSpellInfo(114051)
+			["AscendanceEnhancementBuff"] = GetSpellInfo(114051),
+			["Elemental Fusion"] = GetSpellInfo(157174),
+			["Ancestral Swiftness"] = GetSpellInfo(16188),
+			["Feral Spirit"] = GetSpellInfo(51533),
+			["Fire Nova"] = GetSpellInfo(1535),
+
+			["Greater Draenic Agility Flask"] = GetSpellInfo(156064),
+			["Draenic Agility Flask"] = GetSpellInfo(156073),
+			["Flask of Spring Blossoms"] = GetSpellInfo(114769),
+			["Flask of the Winds"] = GetSpellInfo(79471)
 		});

 		Elementarist.role = "DPS";
 		Elementarist.trackAura = Elementarist.SpellList["Flame Shock"];
 		Elementarist.trackFilter = "PLAYER|HARMFUL";
 		Elementarist.trackDuration = 39;
+		Elementarist.trackSpread = false;
 		Elementarist.debuffCount = 0;
+		Elementarist.exspell1=nil;
 	end;
 	NextSpell = function(self,timeshift,exspell1,exspell2)
 		local guid = UnitGUID("target")
@@ -36,8 +47,34 @@ Elementarist.enhancement = {
 		local s,d,e
 		local name, fsExpiration, unitCaster
 		local lastSpell
+		local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration
+		local EBTalent, EETalent, EFTalent, MWcount, EFcount
+		local LLCharges, maxLLCharges, cdLLStart, cdLLLength
+		local SSCharges, maxSSCharges, cdSSStart, cdSSLength
+		local ascendance, ascendanceExp
+		local flameshockavail = false
+		local spellInCast, sICstartTime, sICendTime
 		local _
-
+
+		EETalent = (Elementarist.tier4Talent == 19273)
+		EBTalent = (Elementarist.tier6Talent == 19267)
+		Elementarist.exspell1=exspell1
+
+		 _, _, _, MWcount = Elementarist:hasBuff("player",Elementarist.SpellList["Maelstrom Weapon"])
+		if (MWcount == nil) then
+			MWcount = 0
+		end
+
+		 _, _, _, EFcount = Elementarist:hasBuff("player",Elementarist.SpellList["Elemental Fusion"])
+		if (EFcount == nil) then
+			EFcount = 0
+		end
+
+		ascendance, _, _, _, _, _, ascendanceExp = Elementarist:hasBuff("player", Elementarist.SpellList["AscendanceEnhancementBuff"])
+		if (ascendance == nil) then
+			ascendanceExp = 0
+		end
+
 		if (exspell1) then
 			if (exspell2) then
 				lastSpell = exspell2
@@ -50,15 +87,14 @@ Elementarist.enhancement = {

 		Elementarist.lastBaseGCD = 1.5 - (1.5 * Elementarist.spellHaste * .01)

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

 		-- check Shock CD
-		local s, d = GetSpellCooldown(Elementarist.SpellList["Flame Shock"])
+		s, d = GetSpellCooldown(Elementarist.SpellList["Flame Shock"])
 		if (d) and (d>0) and (s == 0) then
 			Elementarist.lastShockCD = d
 		end
-		local s, d = GetSpellCooldown(Elementarist.SpellList["Frost Shock"])
+		s, d = GetSpellCooldown(Elementarist.SpellList["Frost Shock"])
 		if (d) and (d>0) and (s == 0) then
 			Elementarist.lastShockCD = d
 		end
@@ -73,12 +109,12 @@ Elementarist.enhancement = {
 		end

 		-- check current spell
-		local spellInCast, _, _, _, sICstartTime, sICendTime = UnitCastingInfo("player")
+		spellInCast, _, _, _, sICstartTime, sICendTime = UnitCastingInfo("player")
 		if (spellInCast) then
 			if ( (sICendTime - sICstartTime) / 1000 ) < Elementarist.lastBaseGCD then
 				sICendTime = sICstartTime + (Elementarist.lastBaseGCD * 1000)
 			end
-			timeshift = timeshift + (sICendTime / 1000) - GetTime()
+			timeshift = timeshift + (sICendTime / 1000) - currentTime
 		else
 			-- no spell in cast, check global cd via Ghost Wolf
 			if (Elementarist.SpellList["Ghost Wolf"]) then
@@ -93,114 +129,234 @@ Elementarist.enhancement = {
 			end
 		end

-		-- if Tier6 talent is Elemental Blast use it
-		if (Elementarist.tier6Talent == 19267) then
-			if (
-				(exspell1 ~= Elementarist.SpellList["Elemental Blast"]) and
-				(exspell2 ~= Elementarist.SpellList["Elemental Blast"]) and
-				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1) and
-				(Elementarist.SpellList["Elemental Blast"] ~= spellInCast)
-			) then
-				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
-				if ((d - timeshift) <= 0) then
-					return Elementarist.SpellList["Elemental Blast"]
-				end
+		--------------------------- start of priority list ----------------
+
+		----Priority 1 ---  Searing Totem if no fire totem or fire totem about to expire
+		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+			haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
+			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - currentTime ) -timeshift <= 0) then
+				Elementarist:Debug(functionname,  "Priority1",1)
+ 				return Elementarist.SpellList["Searing Totem"];
 			end
 		end

-		-- if Tier6 talent is Unleashed Fury Unleash Flame
-		if (Elementarist.tier6Talent == 21773) then
-			if (exspell1 ~= Elementarist.SpellList["Unleash Flame"]) and (exspell2 ~= Elementarist.SpellList["Unleash Flame"]) then
-				e = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Flame"])
-				if (e-timeshift <= 0) then
-					return Elementarist.SpellList["Unleash Flame"];
+		----Priority 2 ---  -- if Tier6 talent is Unleashed Fury then use Unleash Elements
+		if (EFTalent) then
+			if (Elementaris:Count(Elementarist.SpellList["Unleash Elements"]),spellInCast,exspell1,exspell2) == 0) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Elements"])
+				if (d-timeshift <= 0) then
+					Elementarist:Debug(functionname, "Priority2",1)
+					return Elementarist.SpellList["Unleash Elements"];
 				end
 			end
 		end

-		-- if Maelstrom Weapon has 5 stacks cast Lightning Bolt
-		local _, _, _, mwcount = Elementarist:hasBuff("player",Elementarist.SpellList["Maelstrom Weapon"])
-		if (mwcount) and (mwcount >= 5) then
-			if (IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1) and
-				(exspell1 ~= Elementarist.SpellList["Lightning Bolt"]) and
-				(exspell2 ~= Elementarist.SpellList["Lightning Bolt"]) then
-				return Elementarist.SpellList["Lightning Bolt"]
+		----Priority 3	-- if Tier6 talent is Elemental Blast use it with 5 Maelstrom Weapon stacks (8 with 4 set)
+		if EBTalent then
+			if  (
+					(  (not Elementarist.hasT18_4pcs) and (MWcount >= 5)) or
+					(  (Elementarist.hasT18_4pcs) and (MWcount >= 8))
+			)  then
+				if (
+					(Elementaris:Count(Elementarist.SpellList["Elemental Blast"]),spellInCast,exspell1,exspell2) == 0) and
+					(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
+				) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
+					if ((d - timeshift) <= 0) then
+						return Elementarist.SpellList["Elemental Blast"]
+					end
+				end
 			end
 		end

-		-- stormstrike/windstrike
-		local ascendance, _, _, _, _, _, ascendanceExp = Elementarist:hasBuff("player",Elementarist.SpellList["AscendanceEnhancementBuff"]);
-		if (ascendance == nil) then
-			ascendanceExp = 0
+		----Priority 4	---- Load Windstrike and Stormstrike data
+		SSCharges, maxSSCharges, cdSSStart, cdSSLength  = GetSpellCharges(Elementarist.SpellList["Stormstrike"]);
+		if (SSCharges<maxSSCharges) and (((cdSSStart + cdSSLength)- currentTime) - timeshift <= 0) then
+			SSCharges = SSCharges + 1;
 		end
-		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Stormstrike"])
+		SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Stormstrike"],spellInCast,exspell1,exspell2);
+		SSCharges = SSCharges - Elementarist:Count(Elementarist.SpellList["Windstrike"],spellInCast,exspell1,exspell2);
+
+		--------- Windstrike (requires assendance) at max charges of SS/WS
+		if ascendance then
+			if (
+					(  SSCharges >= 1) and (not EETalent) or
+					( (SSCharges >= 2) )
+		    ) then
+				return Elementarist.SpellList["Windstrike"]
+			end
+		end
+
+		----Priority 5	-- Cast Lightning Bolt  with 5 Maelstrom Weapon stacks (8 with 4 set)
 		if (
-				((d - timeshift) <= 0) and
-				(exspell1 ~= Elementarist.SpellList["Stormstrike"]) and
-				(exspell2 ~= Elementarist.SpellList["Stormstrike"]) and
-				(exspell1 ~= Elementarist.SpellList["Windstrike"]) and
-				(exspell2 ~= Elementarist.SpellList["Windstrike"])
+				(  (MWcount >= 5)  and ( not ( Elementarist.hasT18_4pcs)) ) or
+		    	(  (MWcount >= 8) )
+		   ) then
+			if (
+					(IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1) and
+					(Elementarist:Count(Elementarist.SpellList["Lightning Bolt"],exspell1,exspell2) == 0)
 			) then
-			if (ascendance) and ((ascendanceExp-GetTime()-timeshift) > 0) then
-				return Elementarist.SpellList["Windstrike"]
-			else
+				return Elementarist.SpellList["Lightning Bolt"]
+			end
+		end
+
+		----Priority 6	-- stormstrike at max charges of SS/WS
+		if (not ascendance) then
+			if ( 	(  SSCharges >= 1) and (not EETalent) or
+				( (SSCharges >= 2) )
+
+			    ) then
 				return Elementarist.SpellList["Stormstrike"]
 			end
 		end

-		-- Lava Lash
-		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lava Lash"])
+		----Priority 7	-- Load Lava Lash Data
+		LLCharges, maxLLCharges, cdLLStart, cdLLLength  = GetSpellCharges(Elementarist.SpellList["Lava Lash"]);
+		if (LLCharges<maxLLCharges) and (((cdLLStart + cdLLLength)- currentTime) - timeshift <= 0) then
+			LLCharges = LLCharges + 1;
+		end
+		LLCharges = LLCharges - Elementarist:Count(Elementarist.SpellList["Lava Lash"],spellInCast, exspell1, exspell2);
+
+		-----Lava Lash at max charges of LL
 		if (
-				((d - timeshift) <= 0) and
-				(exspell1 ~= Elementarist.SpellList["Lava Lash"]) and
-				(exspell2 ~= Elementarist.SpellList["Lava Lash"])
-			) then
+			(  LLCharges >= 1) and (not EETalent) or
+			( (LLCharges >= 2) )
+		) then
 			return Elementarist.SpellList["Lava Lash"]
 		end

-		-- Flame shock if <9 sec remaining and Unleash Flame is up
+		----Priority 8	-- Flame shock if <9 sec remaining and Unleash Flame is up
 		name, _, _, _, _, _, fsExpiration, unitCaster = Elementarist:hasDeBuff("target", Elementarist.SpellList["Flame Shock"], "player");
 		if (not fsExpiration) then
 			fsExpiration = 0
 		end
 		if (Elementarist:hasBuff("player",Elementarist.SpellList["Unleash Flame"])) and
-			(exspell1 ~= Elementarist.SpellList["Frost Shock"]) and
-			(exspell2 ~= Elementarist.SpellList["Frost Shock"]) and
-			(exspell1 ~= Elementarist.SpellList["Flame Shock"]) and
-			(exspell2 ~= Elementarist.SpellList["Flame Shock"]) then
+			(Elementarist:Count(Elementarist.SpellList["Frost Shock"],exspell1,exspell2) == 0) and
+			(Elementarist:Count(Elementarist.SpellList["Flame Shock"],exspell1,exspell2) == 0) then
 			if IsSpellInRange(Elementarist.SpellList["Flame Shock"], "target") == 1 then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
-				if ((d - timeshift) <= 0) and ((fsExpiration - GetTime() - timeshift) < 9) then
+				if (
+					(  ((EFcount >= 2) and (d - timeshift) <= 0) and ((fsExpiration - currentTime - timeshift) < 16)     ) or
+					(  ((EFcount >= 1) and (d - timeshift) <= 0) and ((fsExpiration - currentTime - timeshift) < 9)    )   or
+					(  ((d - timeshift) <= 0) and ((fsExpiration - currentTime - timeshift) < 9)    )
+				    )	then
 					return Elementarist.SpellList["Flame Shock"]
 				end
 			end
 		end

-		-- Unleash Elements
-		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Elements"])
-		if ((d - timeshift) <= 0) then
-			return Elementarist.SpellList["Unleash Elements"]
+		-- Priority 9 : Unleash Elements
+		if (Elementarist:Count(Elementarist.SpellList["Unleash Elements"],spellInCast,exspell1,exspell2) == 0) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Unleash Elements"])
+			if ((d - timeshift) <= 0) then
+				return Elementarist.SpellList["Unleash Elements"]
+			end
+		end
+
+		-- Priority 10	: Windstrike (requires assendance) at 1 charges of SS/WS with EETalent
+		if ascendance then
+			if ( (SSCharges >= 1) and (EETalent) ) then
+				return Elementarist.SpellList["Windstrike"]
+			end
+		end
+
+		-- Priority 11 : check Elemental Blast is available first
+		if EBTalent then
+			if 	(
+				(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
+				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
+			) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
+				-- Elemental Blast (Tier 6 Talent) with Anscestral Swiftness buff
+				if ((d - timeshift) <= 0) then
+  					if Elementarist:hasBuff("player", Elementarist.SpellList["Ancestral Swiftness"]) then
+						return Elementarist.SpellList["Elemental Blast"]
+					end
+				end
+			end
+
+			-- Elemental Blast (Tier 6 Talent) with T18 4 set and 3 or More Maelstrom Weapon
+			if  ( (Elementarist.hasT18_4pcs) and (MWcount >= 3) ) then
+				if ((d - timeshift) <= 0) then
+					return Elementarist.SpellList["Elemental Blast"]
+				end
+			end
+		end
+
+		-- Priority 12 : lightning bolt near max count or with Ancesteral swiftness (only if not using T18 4 set)
+		if ( not  Elementarist.hasT18_4pcs) then
+			if (
+				((MWcount >=3 ) and (not ascendance)) or
+				Elementarist:hasBuff("player", Elementarist.SpellList["Ancestral Swiftness"])
+			) then
+				return Elementarist.SpellList["Lightning Bolt"]
+			end
 		end

-		-- Frost Shock
+		-- Priority 13 : Lava Lash at 1 charge with Echo of the elements
+		if ((  LLCharges >= 1) and EETalent) then
+			return Elementarist.SpellList["Lava Lash"]
+		end
+
+
+		-- Priority 14 : Frost Shock if not using Elemental Fusion or if more than 16 seconds remaining on Flame Shock debuff
 		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Frost Shock"])
-		if ((d - timeshift) <= 0) and
-			(exspell1 ~= Elementarist.SpellList["Frost Shock"]) and
-			(exspell2 ~= Elementarist.SpellList["Frost Shock"]) and
-			(exspell1 ~= Elementarist.SpellList["Flame Shock"]) and
-			(exspell2 ~= Elementarist.SpellList["Flame Shock"]) then
-			return Elementarist.SpellList["Frost Shock"]
+		if (
+			((d - timeshift) <= 0) and
+			(Elementarist:Count(Elementarist.SpellList["Frost Shock"],exspell1,exspell2) == 0) and
+			(Elementarist:Count(Elementarist.SpellList["Flame Shock"],exspell1,exspell2) == 0)
+		) then
+			if (EFTalent and ((fsExpiration - currentTime - timeshift) < 16)) or (not EFTalent) then
+				return Elementarist.SpellList["Frost Shock"]
+			end
+		end
+
+		-- Priority 15 : Elemental Blast if T18 4 piece and 2 or more Maelstom Weapon
+		if EBTalent and Elementarist.hasT18_4pcs and (MWcount >=2) then
+			if 	(
+				(Elementarist:Count(Elementarist.SpellList["Elemental Blast"],spellInCast,exspell1,exspell2) == 0) and
+				(IsSpellInRange(Elementarist.SpellList["Elemental Blast"], "target") == 1)
+	    	) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Blast"])
+				if ((d - timeshift) <= 0) then
+  					if Elementarist:hasBuff("player", Elementarist.SpellList["Ancestral Swiftness"]) then
+						return Elementarist.SpellList["Elemental Blast"]
+					end
+				end
+			end
+
+		end
+
+		-- Priority 16
+		if ( EETalent and (not Elementarist.hasT18_4pcs) and (MWcount >=2) ) then
+			return Elementarist.SpellList["Lightning Bolt"]
+		end
+
+		-- Priority 17 : storm strike if using Echo of Elements
+		if (not ascendance) then
+			if ((SSCharges >= 1) and EETalent ) then
+				return Elementarist.SpellList["Stormstrike"]
+			end
 		end

-		-- if Maelstrom Weapon has 1 stacks cast Lightning Bolt
-		local _, _, _, mwcount = Elementarist:hasBuff("player",Elementarist.SpellList["Maelstrom Weapon"])
-		if (mwcount) and (mwcount >= 1) then
+		-- Priority 18 : Lighnting bolt at low charges of Maelstrom weapon
+		if (
+			(Elementarist.hasT18_4pcs and (MWcount >=3)) or (MWcount >= 1)
+		) then
 			if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then
 				return Elementarist.SpellList["Lightning Bolt"]
 			end
 		end

-		return ""
+		-- Priority 19 : Searing Totem if less than 20 seconds until it expires
+		if (Elementarist:Count(Elementarist.SpellList["Searing Totem"],spellInCast,exspell1,exspell2) == 0) then
+			if (fireTotemName == "") or (fireTotemDuration and (fireTotemStart + fireTotemDuration - currentTime ) -timeshift <= 20) then
+ 				return Elementarist.SpellList["Searing Totem"];
+			end
+		end
+
+		-- Last Priority : if nothing else lighting bolt for the win!
+		return Elementarist.SpellList["Lightning Bolt"]
 	end;
 	MiscSpell = function(self)
 		-- Miscelaneous spell order:
@@ -210,17 +366,51 @@ Elementarist.enhancement = {
 		-- Blood Fury orc racial

 		local d, e
-		local name, expirationTime, _, name2, exp2
-
+		local name, expirationTime, _, name2, expirationTime2, name3, expirationTime3
+
+		------  Augment Rune
+		if (
+			(
+				((Elementarist.faction == "Horde") and (GetItemCount(Elementarist.CustomIDs["Empowered Augment Rune Horde"]) ~= 0)) or
+				((Elementarist.faction == "Alliance") and (GetItemCount(Elementarist.CustomIDs["Empowered Augment Rune Alliance"]) ~= 0))
+			) and ( not  Elementarist:hasBuff("player", Elementarist.SpellList["Focus Augmentation"]))
+		) then
+        	if (
+        		((Elementarist.faction == "Horde") and (Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Empowered Augment Rune Horde"]) < 2)) or
+        		((Elementarist.faction == "Alliance") and (Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Empowered Augment Rune Alliance"]) < 2))
+        	) then
+				return nil,GetItemIcon(Elementarist.CustomIDs["Empowered Augment Rune Horde"])
+			end
+       	end
+
 		-- Alchemy Flask of Enhancement
-		if ((GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) or (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0)) and (Elementarist.playerLevel<=90) then
-			name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of Spring Blossoms"]);
+		if	(
+			((GetItemCount(Elementarist.CustomIDs["Whispers of Insanity Item"]) ~= 0) and (Elementarist.playerLevel >= 90)  ) or
+			((GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0)and (Elementarist.playerLevel >= 85)  ) or
+			((GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0)  and (Elementarist.playerLevel <= 91)  )
+		) then
+			name = Elementarist:hasBuff("player", Elementarist.SpellList["Greater Draenic Agility Flask"]);
 			if (name == nil) then
-				name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Crystal of Insanity"], false, Elementarist.CustomIDs["Crystal of Insanity Spell"]);
-				name2, _, _, _, _, _, exp2 = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);
+				name = Elementarist:hasBuff("player", Elementarist.SpellList["Draenic Agility Flask"]);
+			end
+			if (name == nil) then
+				name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of Spring Blossoms"]);
+			end
+			if (name == nil) then
+				name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Winds"]);
+			end
+			if (name == nil) then
+				name,  _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Whispers of Insanity"], false, Elementarist.CustomIDs["Whispers of Insanity Spell"]);
+				name2, _, _, _, _, _, expirationTime2 = Elementarist:hasBuff("player", Elementarist.SpellList["Crystal of Insanity"], false, Elementarist.CustomIDs["Crystal of Insanity Spell"]);
+				name3, _, _, _, _, _, expirationTime3 = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);

-				if ((name == nil) and (name2 == nil)) or (((name ~= nil) and (expirationTime<2)) or ((name2 ~= nil) and (exp2<2))) then
-					if (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
+				if ((name == nil) and (name2 == nil) and (name3 == nil)) or (((name ~= nil) and (expirationTime<2)) or ((name2 ~= nil) and (expirationTime2<2)) or ((name3 ~= nil) and (expirationTime3<2))) then
+					if (GetItemCount(Elementarist.CustomIDs["Whispers of Insanity Item"]) ~= 0) then
+						local itemCooldown = Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Whispers of Insanity Item"]);
+						if ((name == nil) or (expirationTime < 2)) and (itemCooldown < 1) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Whispers of Insanity Item"])
+						end
+					elseif (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
 						local itemCooldown = Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Crystal of Insanity Item"]);
 						if ((name == nil) or (expirationTime < 2)) and (itemCooldown < 1) then
 							return nil,GetItemIcon(Elementarist.CustomIDs["Crystal of Insanity Item"])
@@ -243,21 +433,31 @@ Elementarist.enhancement = {
 			end
 		end

-		-- Searing or Magma Totem
-		if (Elementarist.person["foeCount"]>=2) then
-			if Elementarist:SpellAvailable(Elementarist.SpellList["Magma Totem"]) then
-				local haveFireTotem,fireTotemName,_,_ = GetTotemInfo(1)
-				if (fireTotemName == "") then
-					-- no fire totem
-					return Elementarist.SpellList["Magma Totem"]
+		-- Fire Elemental Totem
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Fire Elemental Totem"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Fire Elemental Totem"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Fire Elemental Totem"]
+			end
+		end
+
+		-- Liquid Magma if not in rotation and Tier7 talent is Liquid Magma and fire totem has 10 sec or more
+		if (Elementarist.tier7Talent == 21200) and (ElementaristDB.DisableLM) then
+			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
+			if (fireTotemName ~= "") and (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) >= 10) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Liquid Magma"])
+				if (d<=0.5) then
+					return Elementarist.SpellList["Liquid Magma"]
 				end
 			end
-		else
-			if Elementarist:SpellAvailable(Elementarist.SpellList["Searing Totem"]) then
-				local haveFireTotem,fireTotemName,_,_ = GetTotemInfo(1)
-				if (fireTotemName == "") then
-					-- no fire totem
-					return Elementarist.SpellList["Searing Totem"]
+		end
+
+		-- Storm Elemental Totem
+		if (Elementarist.tier7Talent == 21199) then
+			if Elementarist:SpellAvailable(Elementarist.SpellList["Storm Elemental Totem"]) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Storm Elemental Totem"])
+				if d <= 0.5 then
+					return Elementarist.SpellList["Storm Elemental Totem"]
 				end
 			end
 		end
@@ -273,6 +473,23 @@ Elementarist.enhancement = {
 			end
 		end

+
+		-- Feral Spirit
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Feral Spirit"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Feral Spirit"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Feral Spirit"]
+			end
+		end
+
+		-- Elemental Mastery
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Elemental Mastery"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Elemental Mastery"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Elemental Mastery"]
+			end
+		end
+
 		-- Ascendance
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Ascendance"]) then
 			name = Elementarist:hasBuff("player",Elementarist.SpellList["AscendanceElementalBuff"])
@@ -306,6 +523,62 @@ Elementarist.enhancement = {
 		-- interruptions, purge, and AoE on target
 		local d

+		Elementarist.trackSpread = (Elementarist.lastSpell == Elementarist.SpellList["Flame Shock"])
+
+		-- AOE at least 3 enemies
+ 		if (Elementarist.person["foeCount"]>=3) then
+			-- Searing Totem if no fire totem or fire totem about to expire
+			local haveFireTotem,fireTotemName,fireTotemStart,fireTotemDuration = GetTotemInfo(1);
+			if (
+				(fireTotemName == "") or (fireTotemName == "Searing Totem") or
+				(fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) <= 0)
+			) then
+				return Elementarist.SpellList["Magma Totem"];
+			end
+
+			-- Liquid  if not in rotation and Tier7 talent is Liquid Magma and fire totem has 10 sec or more
+			if (Elementarist.tier7Talent == 21200) then
+				if (fireTotemName ~= "") and (fireTotemDuration and (fireTotemStart + fireTotemDuration - GetTime() ) >= 10) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Liquid Magma"])
+					if (d<=0.5) then
+						return Elementarist.SpellList["Liquid Magma"]
+					end
+				end
+			end
+
+			-- Flame shock if <9 sec remaining and Unleash Flame is up
+			local name, _, _, _, _, _, fsExpiration, unitCaster = Elementarist:hasDeBuff("target", Elementarist.SpellList["Flame Shock"], "player");
+			if (not fsExpiration) then
+				fsExpiration = 0
+			end
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Flame Shock"])
+			if (d <= 0.5) and (fsExpiration - GetTime() < 9) then
+				return Elementarist.SpellList["Flame Shock"]
+			end
+
+			if Elementarist.trackSpread then
+				local LLCharges, maxLLCharges, cdLLStart, cdLLLength  = GetSpellCharges(Elementarist.SpellList["Lava Lash"]);
+				if (LLCharges > 0) then
+					return Elementarist.SpellList["Lava Lash"]
+				end
+			end
+
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Fire Nova"])
+			if ((d ) <= 0.5) then
+				return Elementarist.SpellList["Fire Nova"]
+			end
+
+			---- Chain Lightning in place of Lightning Bolt
+			if Elementarist.exspell1 == Elementarist.SpellList["Lightning Bolt"] then
+				if Elementarist:SpellAvailable(Elementarist.SpellList["Chain Lightning"]) then
+					return Elementarist.SpellList["Chain Lightning"]
+				end
+			end
+
+			return Elementarist.exspell1
+		end
+
+        -- Wind Shear
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Wind Shear"]) then
 			if IsSpellInRange(Elementarist.SpellList["Wind Shear"], "target") == 1 then
 				local _, status, threatpct, _, _ = UnitDetailedThreatSituation("player", "target")
@@ -325,7 +598,7 @@ Elementarist.enhancement = {
 			end
 		end

-		-- check if purgeable buff is on target (not sure if this is ok)
+		---------- check if purgeable buff is on target (not sure if this is ok)
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Purge"]) then
 			if IsSpellInRange(Elementarist.SpellList["Purge"], "target") == 1 then
 				if (Elementarist:hasBuff("target", ".", 1)) then
@@ -336,30 +609,6 @@ Elementarist.enhancement = {
 				end
 			end
 		end
-
-		-- Fire Nova if there are multiple targets, (count in a dirty way from combat log, not to accurate!!!)
-		if Elementarist:SpellAvailable(Elementarist.SpellList["Fire Nova"]) then
-			if (Elementarist.person["foeCount"]>2) and (Elementarist.debuffCount > 0) then
-				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Fire Nova"])
-				if (d) and (d<0.5) then
-					return Elementarist.SpellList["Fire Nova"]
-				end
-			end
-		end
-
-		-- CL if there are multiple targets, (count in a dirty way from combat log, not to accurate!!!)
-		if (exspell1 ~= Elementarist.SpellList["Chain Lightning"]) and (exspell2 ~= Elementarist.SpellList["Chain Lightning"]) then
-			if (Elementarist.person["foeCount"]>2) then
-				if IsSpellInRange(Elementarist.SpellList["Chain Lightning"], "target") == 1 then
-					if ((Elementarist.SpellList["Chain Lightning"]) ~= spellInCast) then
-						d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Chain Lightning"])
-						if (d) and (d<0.5) then
-							return Elementarist.SpellList["Chain Lightning"]
-						end
-					end
-				end
-			end
-		end

 		return ""
 	end;