Quantcast

**v3.3.3**

Taracque [10-21-14 - 13:55]
**v3.3.3**
* Fixed: lots of fixes, initial (non complete) enhancement module included
Filename
Change_log.txt
Ele_GUI.lua
Elementarist.lua
Elementarist.toc
Localization_enUS.lua
Localization_frFR.lua
Localization_zhCN.lua
modules/elemental.lua
modules/enhancement.lua
diff --git a/Change_log.txt b/Change_log.txt
index 36431cb..b861e0f 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+**v3.3.3**
+* Fixed: lots of fixes, initial (non complete) enhancement module included
+
 **v3.3.2**
 * Fixed: Next and Next-Next spell advise

diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index ddb71f4..3449f9a 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -264,7 +264,6 @@ function Elementarist:CreateConfig()
 	end)
 	Scale:SetPoint("TOPLEFT",10,-108)
 	Scale:Show()
-
 	local Alpha = Elementarist:CreateSlider(L.CONFIG_SPELL_ADV_ALPHA, Elementarist.configPanel, .0, 1, .1)
 	Alpha:SetScript('OnShow', function(self)
 		self.onShow = true
@@ -280,9 +279,8 @@ function Elementarist:CreateConfig()
 	end)
 	Alpha:SetPoint("TOPLEFT",200,-108)
 	Alpha:Show()
-
-	local DebuffDisableBtn = Elementarist:CreateCheckButton(L.CONFIG_DISABLE_DEBUFF_TRACKER, Elementarist.configPanel, ElementaristDB, "debuffdisabled", false)
-	DebuffDisableBtn:SetPoint('TOPLEFT', 10, -168)
+	local AdvisorDisableBtn = Elementarist:CreateCheckButton(L.CONFIG_DISABLE_ADVISOR, Elementarist.configPanel, ElementaristDB, "advisordisabled", false)
+	AdvisorDisableBtn:SetPoint('TOPLEFT', 10, -128)

 	local DebuffScale = Elementarist:CreateSlider(L.CONFIG_DEBUFF_TRACKER_SCALE, Elementarist.configPanel, .25, 3, .1)
 	DebuffScale:SetScript('OnShow', function(self)
@@ -297,8 +295,11 @@ function Elementarist:CreateConfig()
 			Elementarist.debuffTracker:SetScale(value)
 		end
 	end)
-	DebuffScale:SetPoint("TOPLEFT",10,-148)
+	DebuffScale:SetPoint("TOPLEFT",10,-168)
 	DebuffScale:Show()
+	local DebuffDisableBtn = Elementarist:CreateCheckButton(L.CONFIG_DISABLE_DEBUFF_TRACKER, Elementarist.configPanel, ElementaristDB, "debuffdisabled", false)
+	DebuffDisableBtn:SetPoint('TOPLEFT', 10, -188)
+

 	local DebuffAlpha = Elementarist:CreateSlider(L.CONFIG_DEBUFF_TRACKER_ALPHA, Elementarist.configPanel, .0, 1, .1)
 	DebuffAlpha:SetScript('OnShow', function(self)
@@ -313,11 +314,11 @@ function Elementarist:CreateConfig()
 			Elementarist.debuffTracker:SetAlpha(value)
 		end
 	end)
-	DebuffAlpha:SetPoint("TOPLEFT",200,-148)
+	DebuffAlpha:SetPoint("TOPLEFT",200,-168)
 	DebuffAlpha:Show()

 	local ShieldDisableBtn = Elementarist:CreateCheckButton(L.CONFIG_DISABLE_SHIELD_TRACKER, Elementarist.configPanel, ElementaristDB, "shielddisabled", false)
-	ShieldDisableBtn:SetPoint('TOPLEFT', 10, -228)
+	ShieldDisableBtn:SetPoint('TOPLEFT', 10, -248)

 	local ShieldScale = Elementarist:CreateSlider(L.CONFIG_SHIELD_TRACKER_SCALE, Elementarist.configPanel, .25, 3, .1)
 	ShieldScale:SetScript('OnShow', function(self)
@@ -332,7 +333,7 @@ function Elementarist:CreateConfig()
 			Elementarist.shieldTracker:SetScale(value)
 		end
 	end)
-	ShieldScale:SetPoint("TOPLEFT",10,-208)
+	ShieldScale:SetPoint("TOPLEFT",10,-228)
 	ShieldScale:Show()

 	local ShieldAlpha = Elementarist:CreateSlider(L.CONFIG_SHIELD_TRACKER_ALPHA, Elementarist.configPanel, .0, 1, .1)
@@ -348,14 +349,14 @@ function Elementarist:CreateConfig()
 			Elementarist.shieldTracker:SetAlpha(value)
 		end
 	end)
-	ShieldAlpha:SetPoint("TOPLEFT",200,-208)
+	ShieldAlpha:SetPoint("TOPLEFT",200,-228)
 	ShieldAlpha:Show()

 	local ThreatWarnBtn = Elementarist:CreateCheckButton(L.CONFIG_THREAT_WARNING, Elementarist.configPanel, ElementaristDB, "ThreatWarning", false)
-	ThreatWarnBtn:SetPoint('TOPLEFT', 10, -258)
+	ThreatWarnBtn:SetPoint('TOPLEFT', 10, -278)

 	local EleLayout = Elementarist:CreateDropDownMenu(L.CONFIG_LAYOUT, Elementarist.configPanel, ElementaristDB, "Layout", {{text = L.LAYOUT_GROW},{text = L.LAYOUT_RIGHTTOLEFT}}, 200)
-	EleLayout:SetPoint('TOPLEFT', 10, -288)
+	EleLayout:SetPoint('TOPLEFT', 10, -308)

 	local ResetBtn = Elementarist:CreateButton(L.CONFIG_RESET_POSITIONS, Elementarist.configPanel)
 	ResetBtn:SetWidth(160)
@@ -363,7 +364,7 @@ function Elementarist:CreateConfig()
 	ResetBtn:SetScript('OnClick', function()
 		Elementarist:ResetPosition()
 	end)
-	ResetBtn:SetPoint("TOPLEFT",10,-318)
+	ResetBtn:SetPoint("TOPLEFT",10,-338)
 	ResetBtn:Show()

 	Elementarist.configPanel.okay = function()
@@ -392,11 +393,13 @@ function Elementarist:CreateConfig()
 		ElementaristDB.ThreatWarning = true
 		ElementaristDB.Layout = Elementarist.EleLayout["1"]
 		ElementaristDB.version = Elementarist.versionNumber;
+		ElementaristDB.advisordisabled = false
 		Elementarist:ResetPosition()
 	end

 	-- always show frame if config panel is open
 	Elementarist.configPanel:SetScript('OnShow', function(self)
+		Elementarist:Debug("Options", "onShow");
 		self.onShow = true
 		Elementarist:DecideSpells()
 		self.onShow = nil
@@ -447,6 +450,9 @@ function Elementarist:CreateConfig()
 			end
 		end
 	end
+	Elementarist.configPanel:Hide();
+
+	return Elementarist.configPanel;
 end

 function Elementarist:ResetPosition()
diff --git a/Elementarist.lua b/Elementarist.lua
index fe44cfc..e03feec 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.3.2
+-- Elementarist 3.3.3
 --
 -- 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.3.2';
+Elementarist.versionNumber = '3.3.3';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
@@ -204,9 +204,6 @@ function Elementarist.events.ADDON_LOADED(addon)

 	-- load defaults, if first start
 	Elementarist:InitSettings()
-
-	-- Create config page
-	Elementarist:CreateConfig()

 	-- add slash command
 	SlashCmdList["Elementarist"] = function(msg)
@@ -225,7 +222,6 @@ function Elementarist.events.ADDON_LOADED(addon)
 		else
 			InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
 			InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
-			InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
 		end
 	end
 	SLASH_Elementarist1 = "/Elementarist"
@@ -256,6 +252,9 @@ function Elementarist.events.ADDON_LOADED(addon)
 	Elementarist:CreateGUI()
 	Elementarist.displayFrame:SetScale(ElementaristDB.scale)

+	-- Create config page
+	Elementarist:CreateConfig()
+
 	-- Register for Function Events
 	Elementarist.eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
 	Elementarist.eventFrame:RegisterEvent("COMBAT_RATING_UPDATE") -- Monitor the all-mighty haste
@@ -308,6 +307,7 @@ function Elementarist:InitSettings()
 	if ElementaristDB.CLBehavior == nil then ElementaristDB.CLBehavior = Elementarist.CLBehaviors["0"] end
 	if ElementaristDB.ThreatWarning == nil then ElementaristDB.ThreatWarning = true end
 	if ElementaristDB.EnableEQ == nil then ElementaristDB.EnableEQ = false end
+	if ElementaristDB.advisordisabled == nil then ElementaristDB.advisordisabled = false end
 	if not ElementaristDB.x then ElementaristDB.x = -200 end
 	if not ElementaristDB.y then ElementaristDB.y = -200 end
 	if not ElementaristDB.relativePoint then ElementaristDB.relativePoint = "CENTER" end
@@ -848,8 +848,8 @@ function Elementarist:DecideSpells()
 		guid = nil
 	end

-	if (UnitInVehicle("player") and HasVehicleActionBar()) then
-		-- player is in a "vehicle" don't suggest spell
+	if (ElementaristDB.advisordisabled) or (UnitInVehicle("player") and HasVehicleActionBar()) 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"],"")
diff --git a/Elementarist.toc b/Elementarist.toc
index 85db043..8cf9498 100755
--- a/Elementarist.toc
+++ b/Elementarist.toc
@@ -2,7 +2,7 @@
 ## Title: Elementarist
 ## Notes: Elemental shaman spell rotation helper
 ## Author: Taracque, Felmosórongy of Arathor
-## Version: 3.3.2
+## Version: 3.3.3
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies:
@@ -10,5 +10,8 @@
 Elementarist.lua
 Ele_GUI.lua
 Localization_enUS.lua
+Localization_znCH.lua
+Localization_frFR.lua
 modules\elemental.lua
-modules\restoration.lua
\ No newline at end of file
+modules\restoration.lua
+modules\enhancement.lua
\ No newline at end of file
diff --git a/Localization_enUS.lua b/Localization_enUS.lua
index 149c3ad..fbe840d 100755
--- a/Localization_enUS.lua
+++ b/Localization_enUS.lua
@@ -39,4 +39,6 @@ if GetLocale() then
 	L.CONFIG_ENABLE_HS_TOTEM = "Show Healing Stream Totem"
 	L.CONFIG_ENABLE_SEARING_TOTEM = "Show Searing Totem"
 	L.CONFIG_ANNOUNCE_STORMLASH = "Announce Stormlash Totem in Raid/Party chat"
+-- new for 3.3.3
+	L.CONFIG_DISABLE_ADVISOR = "Disable spell advisor"
 end
\ No newline at end of file
diff --git a/Localization_frFR.lua b/Localization_frFR.lua
new file mode 100755
index 0000000..c38dac3
--- /dev/null
+++ b/Localization_frFR.lua
@@ -0,0 +1,40 @@
+-- frFR localization file for Elementarist
+if ( GetLocale() ~= "frFR" ) then
+	return;
+end
+
+if GetLocale() then
+	local L = Elementarist.Locals
+
+	L["BEHAVIOR_FS_BEFORE_LVB"] = "Horion de flammes avant lave"
+	L["BEHAVIOR_KEEP_FS_UP"] = "Gardez Horion de flammes Up !"
+	L["CLSTBEHAVIOR_CL_AFTER_LVB"] = "Chain Lightning after Lava" -- Requires localization
+	L["CLSTBEHAVIOR_CL_ON_CD"] = "Temps de recharge de Chaîne d'éclairs"
+	L["CLSTBEHAVIOR_NONE"] = "None" -- Requires localization
+	L["CONFIG_ANNOUNCE_STORMLASH"] = "Announce Stormlash Totem in Raid/Party chat" -- Requires localization
+	L["CONFIG_BEHAVIOR"] = "Flame Shock behavior:" -- Requires localization
+	L["CONFIG_CLSTBEHAVIOR"] = "Chain Lightning single target behavior" -- Requires localization
+	L["CONFIG_DEBUFF_TRACKER_ALPHA"] = "Suivi des débuffs alpha"
+	L["CONFIG_DEBUFF_TRACKER_SCALE"] = "échelle du suivi des Debuff"
+	L["CONFIG_DISABLE_ADVISOR"] = "Disable spell advisor" -- Requires localization
+	L["CONFIG_DISABLE_DEBUFF_TRACKER"] = "Désactiver le suivi des débuffs"
+	L["CONFIG_DISABLE_MINI"] = "Désactiver les mini cadres"
+	L["CONFIG_DISABLE_SHIELD_TRACKER"] = "Désactiver le suivi du bouclier"
+	L["CONFIG_ENABLED"] = "Activé"
+	L["CONFIG_ENABLE_EQ_SPELL"] = "Active Tremblement de terre en rotation"
+	L["CONFIG_ENABLE_HS_TOTEM"] = "Show Healing Stream Totem" -- Requires localization
+	L["CONFIG_ENABLE_SEARING_TOTEM"] = "Show Searing Totem" -- Requires localization
+	L["CONFIG_LAYOUT"] = "Layout:" -- Requires localization
+	L["CONFIG_LOCK_FRAMES"] = "Verrouiller les cadres"
+	L["CONFIG_ONLY_ON_ELE"] = "Désactive vous n'êtes pas sur le talent élémentaire"
+	L["CONFIG_RESET_POSITIONS"] = "Réinitialiser la position du cadre"
+	L["CONFIG_SHIELD_TRACKER_ALPHA"] = "suivi du bouclier alpha"
+	L["CONFIG_SHIELD_TRACKER_SCALE"] = "échelle du suivi du bouclier"
+	L["CONFIG_SPELL_ADV_ALPHA"] = "Sort conseiller alpha"
+	L["CONFIG_SPELL_ADV_SCALE"] = "échelle du sort conseiller"
+	L["CONFIG_THREAT_WARNING"] = "Avertissement de menace"
+	L["LAYOUT_GROW"] = "Growing icons" -- Requires localization
+	L["LAYOUT_RIGHTTOLEFT"] = "Right to left" -- Requires localization
+	L["THREAT_WARNING_PREFIX"] = "Général"
+	L["THREAT_WARNING_SUFFIX"] = "% de menace!"
+end
\ No newline at end of file
diff --git a/Localization_zhCN.lua b/Localization_zhCN.lua
new file mode 100755
index 0000000..a818fbc
--- /dev/null
+++ b/Localization_zhCN.lua
@@ -0,0 +1,40 @@
+-- zhCN localization file for Elementarist
+if ( GetLocale() ~= "zhCN" ) then
+	return;
+end
+
+if GetLocale() then
+	local L = Elementarist.Locals
+
+	L["BEHAVIOR_FS_BEFORE_LVB"] = "熔岩爆裂前施放烈焰震击"
+	L["BEHAVIOR_KEEP_FS_UP"] = "保持烈焰震击"
+	L["CLSTBEHAVIOR_CL_AFTER_LVB"] = "熔岩爆裂后施放闪电链"
+	L["CLSTBEHAVIOR_CL_ON_CD"] = "闪电链冷却中"
+	L["CLSTBEHAVIOR_NONE"] = "无"
+	L["CONFIG_ANNOUNCE_STORMLASH"] = "Announce Stormlash Totem in Raid/Party chat" -- Requires localization
+	L["CONFIG_BEHAVIOR"] = "烈焰震击行为"
+	L["CONFIG_CLSTBEHAVIOR"] = "单目标闪电链行为"
+	L["CONFIG_DEBUFF_TRACKER_ALPHA"] = "Debuff 追踪器透明度"
+	L["CONFIG_DEBUFF_TRACKER_SCALE"] = "Debuff 追踪器尺寸"
+	L["CONFIG_DISABLE_ADVISOR"] = "Disable spell advisor" -- Requires localization
+	L["CONFIG_DISABLE_DEBUFF_TRACKER"] = "禁用 debuff 追踪器"
+	L["CONFIG_DISABLE_MINI"] = "禁用迷你框体"
+	L["CONFIG_DISABLE_SHIELD_TRACKER"] = "禁用护盾追踪器"
+	L["CONFIG_ENABLED"] = "启用"
+	L["CONFIG_ENABLE_EQ_SPELL"] = "循环中启用地震术"
+	L["CONFIG_ENABLE_HS_TOTEM"] = "显示治疗之泉图腾"
+	L["CONFIG_ENABLE_SEARING_TOTEM"] = "显示灼热图腾"
+	L["CONFIG_LAYOUT"] = "布局:"
+	L["CONFIG_LOCK_FRAMES"] = "锁定 Elementarist 框体"
+	L["CONFIG_ONLY_ON_ELE"] = "非元素天赋时禁用"
+	L["CONFIG_RESET_POSITIONS"] = "重置框体位置"
+	L["CONFIG_SHIELD_TRACKER_ALPHA"] = "护盾追踪器透明度"
+	L["CONFIG_SHIELD_TRACKER_SCALE"] = "护盾追踪器尺寸"
+	L["CONFIG_SPELL_ADV_ALPHA"] = "法术建议器透明度"
+	L["CONFIG_SPELL_ADV_SCALE"] = "法术建议器尺寸"
+	L["CONFIG_THREAT_WARNING"] = "威胁值警告"
+	L["LAYOUT_GROW"] = "渐变图标"
+	L["LAYOUT_RIGHTTOLEFT"] = "左置"
+	L["THREAT_WARNING_PREFIX"] = "" -- Requires localization
+	L["THREAT_WARNING_SUFFIX"] = "% 威胁值过高!"
+end
\ No newline at end of file
diff --git a/modules/elemental.lua b/modules/elemental.lua
index e38935c..368d838 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -30,10 +30,7 @@ Elementarist.elemental = {
 		Elementarist.role = "DPS";
 		Elementarist.trackAura = Elementarist.SpellList["Flame Shock"];
 		Elementarist.trackFilter = "PLAYER|HARMFUL";
-		Elementarist.trackDuration = 24;
-		if (Elementarist:hasGlyph(Elementarist.SpellList["Glyph of Flame Shock"])) then
-			Elementarist.trackDuration = Elementarist.trackDuration * 1.25;
-		end
+		Elementarist.trackDuration = 39;
 	end;
 	NextSpell = function(self,timeshift,exspell1,exspell2)
 		local guid = UnitGUID("target")
@@ -99,11 +96,13 @@ Elementarist.elemental = {
 		end

 		-- if item level >575 and Earthquake is enabled
-		if ((ElementaristDB.EnableEQ) and (Elementarist.iLvl>=575)) or (Elementarist.person["foeCount"]>1) then
-			if (exspell1 ~= Elementarist.SpellList["Earthquake"]) and (exspell2 ~= Elementarist.SpellList["Earthquake"]) and ((Elementarist.SpellList["Earthquake"]) ~= spellInCast) then
-				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
-				if (d) and (d<0.5) then
-					return Elementarist.SpellList["Earthquake"]
+		if (ElementaristDB.EnableEQ) then
+			if (Elementarist.iLvl>=575) or (Elementarist.person["foeCount"]>1) then
+				if (exspell1 ~= Elementarist.SpellList["Earthquake"]) and (exspell2 ~= Elementarist.SpellList["Earthquake"]) and ((Elementarist.SpellList["Earthquake"]) ~= spellInCast) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
+					if (d) and (d<0.5) then
+						return Elementarist.SpellList["Earthquake"]
+					end
 				end
 			end
 		end
@@ -327,7 +326,7 @@ Elementarist.elemental = {
 				return Elementarist.SpellList["Lifeblood"]
 			end
 		end
-
+
 		return ""
 	end;
 	IntSpell = function(self)
@@ -377,6 +376,18 @@ Elementarist.elemental = {
 			end
 		end

+		-- EQ if not in rotataion and has 3 or more targets
+		if (not ElementaristDB.EnableEQ) then
+			if ((Elementarist.iLvl>=550) and (Elementarist.person["foeCount"]>1)) or (Elementarist.person["foeCount"]>2) then
+				if (exspell1 ~= Elementarist.SpellList["Earthquake"]) and (exspell2 ~= Elementarist.SpellList["Earthquake"]) and ((Elementarist.SpellList["Earthquake"]) ~= spellInCast) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
+					if (d) and (d<0.5) then
+						return Elementarist.SpellList["Earthquake"]
+					end
+				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
diff --git a/modules/enhancement.lua b/modules/enhancement.lua
new file mode 100755
index 0000000..176818f
--- /dev/null
+++ b/modules/enhancement.lua
@@ -0,0 +1,370 @@
+local L = Elementarist.Locals;
+
+Elementarist:RegisterModule("enhancement");
+
+Elementarist.enhancement = {
+	["Configuration"] = {
+		["ShowHealingStream"] = {
+			["type"]	=	"CheckBox",
+			["label"]	=	L.CONFIG_ENABLE_HS_TOTEM
+		}
+	};
+	Initialize = function(self)
+		Elementarist:LoadSpells({
+			["Glyph of Flame Shock"] = GetSpellInfo(55447),
+			["Healing Stream Totem"] = GetSpellInfo(5394),
+			["Maelstrom Weapon"] = GetSpellInfo(51530),
+			["Stormstrike"] = GetSpellInfo(17364),
+			["Windstrike"] = GetSpellInfo(115356),
+			["Lava Lash"] = GetSpellInfo(60103),
+			["Unleash Flame"] = GetSpellInfo(165462),
+			["Unleash Elements"] = GetSpellInfo(73680),
+			["Frost Shock"] = GetSpellInfo(8056),
+			["Flask of Spring Blossoms"] = GetSpellInfo(76084)
+		});
+
+		Elementarist.role = "DPS";
+		Elementarist.trackAura = Elementarist.SpellList["Flame Shock"];
+		Elementarist.trackFilter = "PLAYER|HARMFUL";
+		Elementarist.trackDuration = 39;
+	end;
+	NextSpell = function(self,timeshift,exspell1,exspell2)
+		local guid = UnitGUID("target")
+		local currentTime = GetTime()
+		local s,d,e
+		local name, fsExpiration, unitCaster
+		local lastSpell
+		local _
+
+		if (exspell1) then
+			if (exspell2) then
+				lastSpell = exspell2
+			else
+				lastSpell = exspell1
+			end
+		else
+			lastSpell = Elementarist.lastSpell
+		end
+
+		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"])
+		if (d) and (d>0) and (s == 0) then
+			Elementarist.lastShockCD = d
+		end
+		local s, d = GetSpellCooldown(Elementarist.SpellList["Earth Shock"])
+		if (d) and (d>0) and (s == 0) then
+			Elementarist.lastShockCD = d
+		end
+
+		-- if target is dead, return ""
+		if (UnitHealth("target")<=0) then
+			return ""
+		end
+
+		if (not timeshift) then
+			timeshift = 0
+		end
+
+		-- check current spell
+		local 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()
+		else
+			-- no spell in cast, check global cd via Ghost Wolf
+			if (Elementarist.SpellList["Ghost Wolf"]) then
+				local ftcd = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Ghost Wolf"])
+				if (ftcd) then
+					timeshift = timeshift + Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Ghost Wolf"])
+				else
+					timeshift = timeshift + Elementarist.lastBaseGCD
+				end
+			else
+				timeshift = timeshift + Elementarist.lastBaseGCD
+			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
+			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"];
+				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 then
+				return Elementarist.SpellList["Lightning Bolt"]
+			end
+		end
+
+		-- stormstrike/windstrike
+		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Stormstrike"])
+		if (
+				((d - timeshift) <= 0) and
+				(exspell1 ~= Elementarist.SpellList["Stormstrike"]) and
+				(exspell2 ~= Elementarist.SpellList["Stormstrike"])
+			) then
+			return Elementarist.SpellList["Stormstrike"]
+		end
+
+		-- Lava Lash
+		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lava Lash"])
+		if (
+				((d - timeshift) <= 0) and
+				(exspell1 ~= Elementarist.SpellList["Lava Lash"]) and
+				(exspell2 ~= Elementarist.SpellList["Lava Lash"])
+			) then
+			return Elementarist.SpellList["Lava Lash"]
+		end
+
+		-- 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
+			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
+					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"]
+		end
+
+		-- Frost Shock
+		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"]
+		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
+			if IsSpellInRange(Elementarist.SpellList["Lightning Bolt"], "target") == 1 then
+				return Elementarist.SpellList["Lightning Bolt"]
+			end
+		end
+
+		return ""
+	end;
+	MiscSpell = function(self)
+		-- Miscelaneous spell order:
+		-- Lightning Shield
+		-- Searing Totem
+		-- Elemental Mastery
+		-- Berserking troll racial (if available)
+		-- Blood Fury orc racial
+		-- Lifeblood Herbalism spell
+
+		local d, e
+		local name, expirationTime, _, name2, exp2
+
+		-- Alchemy Flask of Enhancement
+		if (GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) or (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
+			name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of Spring Blossoms"]);
+			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"]);
+
+				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
+						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"])
+						end
+					elseif (GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) then
+						local itemCooldown = Elementarist:GetItemCooldownRemaining(Elementarist.CustomIDs["Alchemist's Flask Item"]);
+						if ((name == nil) or (expirationTime < 2)) and (itemCooldown < 1) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Alchemist's Flask Item"])
+						end
+					end
+				end
+			end
+		end
+
+		-- Lightning Shield
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Lightning Shield"]) then
+			name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Lightning Shield"]);
+			if (name == nil) or (expirationTime < 1) then
+				return Elementarist.SpellList["Lightning Shield"]
+			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
+
+		-- Healing Stream Totem
+		if (ElementaristDB.ShowHealingStream) and (Elementarist:SpellAvailable(Elementarist.SpellList["Healing Stream Totem"])) then
+			local haveWaterTotem,waterTotemName,_,_ = GetTotemInfo(3)
+			if (waterTotemName == "") then
+				e = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Healing Stream Totem"]);
+				if (e < 1) then
+					return Elementarist.SpellList["Healing Stream Totem"];
+				end;
+			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"])
+			if (name == nil) then
+				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Ascendance"])
+				if d <= 0.5 then
+					return Elementarist.SpellList["Ascendance"]
+				end
+			end
+		end
+
+		-- Berserking
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Berserking"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Berserking"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Berserking"]
+			end
+		end
+
+		-- Blood Fury
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Blood Fury"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Blood Fury"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Blood Fury"]
+			end
+		end
+
+		-- Lifeblood
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Lifeblood"]) then
+			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lifeblood"])
+			if d <= 0.5 then
+				return Elementarist.SpellList["Lifeblood"]
+			end
+		end
+
+		return ""
+	end;
+	IntSpell = function(self)
+		-- interruptions, purge, and AoE on target
+		local d
+
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Wind Shear"]) then
+			if IsSpellInRange(Elementarist.SpellList["Wind Shear"], "target") == 1 then
+				local _, status, threatpct, _, _ = UnitDetailedThreatSituation("player", "target")
+				if ((UnitCastingInfo("target")) or (UnitChannelInfo("target"))) or ((status) and (threatpct>80) and (Elementarist.person["friendCount"]>1) and (Elementarist.inParty>0)) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Wind Shear"])
+					if (d) and (d<0.5) and (IsSpellInRange(Elementarist.SpellList["Wind Shear"], "target") ) then
+						return Elementarist.SpellList["Wind Shear"]
+					end
+				end
+
+				if (UnitChannelInfo("target")) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Wind Shear"])
+					if (d<0.5) and (interruptable) and (IsSpellInRange(Elementarist.SpellList["Wind Shear"], "target") ) then
+						return Elementarist.SpellList["Wind Shear"]
+					end
+				end
+			end
+		end
+
+		-- 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
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Purge"])
+					if (d) and (d<0.5) then
+						return Elementarist.SpellList["Purge"]
+					end
+				end
+			end
+		end
+
+		-- Lava Beam if there are multiple targets, (count in a dirty way from combat log, not to accurate!!!)
+		if Elementarist:SpellAvailable(Elementarist.SpellList["Lava Beam"]) then
+			if (Elementarist.person["foeCount"]>2) then
+				if IsSpellInRange(Elementarist.SpellList["Lava Beam"], "target") == 1 then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lava Beam"])
+					if (d) and (d<0.5) then
+						return Elementarist.SpellList["Lava Beam"]
+					end
+				end
+			end
+		end
+
+		-- EQ if not in rotataion and has 3 or more targets
+		if (not ElementaristDB.EnableEQ) then
+			if ((Elementarist.iLvl>=550) and (Elementarist.person["foeCount"]>1)) or (Elementarist.person["foeCount"]>2) then
+				if (exspell1 ~= Elementarist.SpellList["Earthquake"]) and (exspell2 ~= Elementarist.SpellList["Earthquake"]) and ((Elementarist.SpellList["Earthquake"]) ~= spellInCast) then
+					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
+					if (d) and (d<0.5) then
+						return Elementarist.SpellList["Earthquake"]
+					end
+				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;
+	ShieldName = function(self)
+		return "Lightning Shield";
+	end;
+
+};