Quantcast

Fix: Flame Shock doesn't shown in the queue after Earth Shock.

Taracque [06-27-11 - 10:29]
Fix: Flame Shock doesn't shown in the queue after Earth Shock.
Change: Earth Shock advised only if FS debuff has higher remaining than FS cooldown.
Filename
Change_log.txt
Ele_GUI.lua
Elementarist.lua
Elementarist.toc
diff --git a/Change_log.txt b/Change_log.txt
index 990779e..2a1d94e 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,7 @@
+**v2.0.3**
+* Bugfix: Flame Shock doesn't shown in the queue after Earth Shock.
+* Change: Earth Shock advised only if FS debuff has higher remaining than FS cooldown.
+
 **v2.0.2**
 * Bugfix: Flame Shock tracker are now more accurate, if there is no FS tick on an enemy in last 4sec, it is automatically removed from tracker

diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index 2397542..ee546c8 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -6,6 +6,10 @@

 local L = Elementarist.Locals

+function Elementarist:SetTexture(frame,icon)
+	frame:SetTexture(icon)
+end
+
 function Elementarist:CreateCheckButton(name, parent, table, field, radio)
 	local button
 	if radio then
@@ -74,7 +78,8 @@ end

 function Elementarist:CreateDropDownMenu(text, parent, dbTree, varName, itemList, width)
 	local name = parent:GetName() .. text
-    local menu = CreateFrame("Frame", name, parent, "UIDropDownMenuTemplate");
+
+    local menu = CreateFrame("Frame", name, parent, "UIDropDownMenuTemplate")
     menu.displayMode = "MENU"

 	local frame = _G[menu:GetName() .. 'Text']
@@ -478,7 +483,6 @@ function Elementarist:CreateGUI()
 	displayFrame_int:SetHeight(40)
 	displayFrame_dps:SetHeight(30)

-
 	displayFrame_next:SetPoint("TOPLEFT", 45, -30)
 	displayFrame_next1:SetPoint("TOPLEFT", 55, -10)
 	displayFrame_next2:SetPoint("TOPLEFT", 65, 0)
@@ -488,35 +492,35 @@ function Elementarist:CreateGUI()
 	displayFrame_dps:SetPoint("TOPLEFT", 45, -90)

 	t = displayFrame_next:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t, "")
 	t:SetAllPoints(displayFrame_next)
 	t:SetAlpha(1)
 	displayFrame_next.texture = t
 	Elementarist.textureList["next"] = t

 	t = displayFrame_next1:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t,"")
 	t:SetAllPoints(displayFrame_next1)
 	t:SetAlpha(0.7)
 	displayFrame_next1.texture = t
 	Elementarist.textureList["next1"] = t

 	t = displayFrame_next2:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t,"")
 	t:SetAllPoints(displayFrame_next2)
 	t:SetAlpha(0.5)
 	displayFrame_next2.texture = t
 	Elementarist.textureList["next2"] = t

 	t = displayFrame_misc:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t,"")
 	t:SetAllPoints(displayFrame_misc)
 	t:SetAlpha(1)
 	displayFrame_misc.texture = t
 	Elementarist.textureList["misc"] = t

 	t = displayFrame_int:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t,"")
 	t:SetAllPoints(displayFrame_int)
 	t:SetAlpha(1)
 	displayFrame_int.texture = t
@@ -566,7 +570,7 @@ function Elementarist:CreateGUI()
 	debuffTracker_cd:SetHeight(50)
 	debuffTracker_cd:SetPoint("TOPLEFT", 0, 0)
 	t = debuffTracker_cd:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t,"")
 	t:SetAllPoints(debuffTracker_cd)
 	t:SetAlpha(1)
 	debuffTracker_cd.texture = t
@@ -591,7 +595,7 @@ function Elementarist:CreateGUI()
 		debuffTracker_cd:SetHeight(25)
 		debuffTracker_cd:SetPoint("TOPLEFT", 50 + (25 * ( (i - 1) % 2) ), - ( 25 * ( math.floor( (i - 1) / 2) ) ) )
 		t = debuffTracker_cd:CreateTexture(nil,"BACKGROUND")
-		t:SetTexture(nil)
+		Elementarist:SetTexture(t,"")
 		t:SetAllPoints(debuffTracker_cd)
 		t:SetAlpha(1)
 		debuffTracker_cd.texture = t
@@ -620,7 +624,7 @@ function Elementarist:CreateGUI()
 	shieldTracker_cd:SetHeight(50)
 	shieldTracker_cd:SetPoint("CENTER", 0, 0)
 	t = shieldTracker_cd:CreateTexture(nil,"BACKGROUND")
-	t:SetTexture(nil)
+	Elementarist:SetTexture(t,"")
 	t:SetAllPoints(shieldTracker_cd)
 	t:SetAlpha(1)
 	shieldTracker_cd.texture = t
@@ -648,5 +652,6 @@ function Elementarist:CreateGUI()
 		Elementarist:UnLockFrames()
 	end

+
 	DEFAULT_CHAT_FRAME:AddMessage("Elementarist " .. Elementarist.versionNumber .. " loaded")
 end
diff --git a/Elementarist.lua b/Elementarist.lua
index 631718d..218f9b0 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 2.0.2
+-- Elementarist 2.0.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 = '2.0.2'
+Elementarist.versionNumber = '2.0.3'
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
 Elementarist.targetGUID = nil
@@ -521,11 +521,11 @@ function Elementarist:UpdateShieldTracker()

 	Elementarist.shieldTrackerUpdate = GetTime()
 	if (name) then
-		Elementarist.textureList["shield"]:SetTexture(icon)
+		Elementarist:SetTexture(Elementarist.textureList["shield"],icon)
 		Elementarist.textList["shield"]:SetText(format('%.0f', count))
 		Elementarist.shieldCooldownFrame:SetCooldown( e-d, d)
 	else
-		Elementarist.textureList["shield"]:SetTexture("")
+		Elementarist:SetTexture(Elementarist.textureList["shield"],"")
 		Elementarist.textList["shield"]:SetText("")
 		Elementarist.shieldCooldownFrame:SetCooldown(0, 0)
 	end
@@ -551,25 +551,25 @@ function Elementarist:UpdateDebuffTracker()
 	local m = 1
 	for i,v in pairs(Elementarist.debuffCooldowns) do
 		if ( (v["start"] + v["duration"]) > GetTime() ) and (i ~= tguid) and (m <= 4) and (v["action"]>GetTime() - 4) then
-			Elementarist.textureList["debuff_" .. tostring(m)]:SetTexture(icon)
+			Elementarist:SetTexture(Elementarist.textureList["debuff_" .. tostring(m)],icon)
 			Elementarist.debuffCooldownFrame["mini_" .. tostring(m)]:SetCooldown( v["start"], v["duration"])
 			m = m + 1
 		end
 	end
 	for i=m,4,1 do
-		Elementarist.textureList["debuff_" .. tostring(m)]:SetTexture("")
+		Elementarist:SetTexture(Elementarist.textureList["debuff_" .. tostring(m)],"")
 		Elementarist.debuffCooldownFrame["mini_" .. tostring(m)]:SetCooldown( 0, 0)
 	end

 	-- update main frame
 	if (name) then
-		Elementarist.textureList["debuff"]:SetTexture(icon)
+		Elementarist:SetTexture(Elementarist.textureList["debuff"],icon)
 		if (not Elementarist.OmniCC) then
 			Elementarist.textList["debuff"]:SetText(format('%.1f', (e - GetTime())))
 		end
 		Elementarist.debuffCooldownFrame["main"]:SetCooldown( e-d, d)
 	else
-		Elementarist.textureList["debuff"]:SetTexture("")
+		Elementarist:SetTexture(Elementarist.textureList["debuff"],"")
 		Elementarist.textList["debuff"]:SetText("")
 		Elementarist.debuffCooldownFrame["main"]:SetCooldown(0, 0)
 	end
@@ -711,7 +711,7 @@ function Elementarist:NextSpell(timeshift,exspell1,exspell2)

 	-- check if Flame shock applied on target first
 	name, _, _, _, _, _, fsExpiration, unitCaster = Elementarist:hasDeBuff("target", Elementarist.SpellList["Flame Shock"], "player");
-	if (exspell1 ~= Elementarist.SpellList["Flame Shock"]) and (exspell2 ~= Elementarist.SpellList["Flame Shock"]) then
+	if (exspell1 ~= Elementarist.SpellList["Flame Shock"]) and (exspell2 ~= Elementarist.SpellList["Flame Shock"]) and (exspell1 ~= Elementarist.SpellList["Earth Shock"]) and (exspell2 ~= Elementarist.SpellList["Earth Shock"]) then
 		if IsSpellInRange(Elementarist.SpellList["Flame Shock"], "target") == 1 then
 			if (not fsExpiration) then
 				fsExpiration = 0
@@ -816,16 +816,17 @@ function Elementarist:NextSpell(timeshift,exspell1,exspell2)
 		end
 	end

-	-- Earth shock if Lightning Shield count >=9 and not on cd or FS debuff remaining between FS and FS cd + 2sec and LS count>=7
+	-- Earth shock if Lightning Shield count >=9 and not on cd, and FS debuff remaining > FS cooldown, or FS debuff remaining between FS and FS cd + 2sec and LS count>=7
 	if ( (exspell1 ~= Elementarist.SpellList["Earth Shock"]) and (exspell2 ~= Elementarist.SpellList["Earth Shock"]) ) then
 		d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"])
 		local _, _, _, lscount = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"])
 		if (
-				( (d) and ((d-timeshift) <= 0) and (lscount) ) and (
-					(lscount>=9) or
-					( (lscount>=7) and
-						( (fsExpiration - GetTime() - timeshift) > Elementarist.lastShockCD ) and
-						( (fsExpiration - GetTime() - timeshift) < Elementarist.lastShockCD + 2 )
+				( (d) and ((d-timeshift) <= 0) and (lscount) ) and (	-- Earth Shock is available, and has lightning shield
+					(
+						( (fsExpiration - GetTime() - timeshift) > Elementarist.lastShockCD ) and (	-- Flame Shock debuff expiration time > Flame Shock CD (which is equals to Earth Shock CD)
+							(lscount>=9) or 														-- Lightning shield has 9 charge
+							( (lscount>=7) and ( (fsExpiration - GetTime() - timeshift) < Elementarist.lastShockCD + 2 ) )	-- or, has 7 or more charges but FS expiration within 2 secs to FS CD
+						)
 					)
 				)
 			) then
@@ -1032,28 +1033,28 @@ function Elementarist:DecideSpells()

 	if UnitInVehicle("player") then
 		-- player is in a "vehicle" don't suggest spell
-		Elementarist.textureList["next"]:SetTexture("")
-		Elementarist.textureList["next1"]:SetTexture("")
-		Elementarist.textureList["next2"]:SetTexture("")
-		Elementarist.textureList["misc"]:SetTexture("")
-		Elementarist.textureList["int"]:SetTexture("")
+		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 guid == nil then
-		Elementarist.textureList["next"]:SetTexture("")
-		Elementarist.textureList["next1"]:SetTexture("")
-		Elementarist.textureList["next2"]:SetTexture("")
-		Elementarist.textureList["misc"]:SetTexture("")
-		Elementarist.textureList["int"]:SetTexture("")
+		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) then
-		Elementarist.textureList["next"]:SetTexture("")
-		Elementarist.textureList["next1"]:SetTexture("")
-		Elementarist.textureList["next2"]:SetTexture("")
+		Elementarist:SetTexture(Elementarist.textureList["next"],"")
+		Elementarist:SetTexture(Elementarist.textureList["next1"],"")
+		Elementarist:SetTexture(Elementarist.textureList["next2"],"")

 		return
   	end
@@ -1068,7 +1069,7 @@ function Elementarist:DecideSpells()
 			Elementarist.cooldownFrame:SetCooldown(cdStart, Elementarist.lastBaseGCD)
 		end
 	end
-	Elementarist.textureList["next"]:SetTexture(GetSpellTexture(spell))
+	Elementarist:SetTexture(Elementarist.textureList["next"],GetSpellTexture(spell))

 	local _,_,_,_,_,_,ct1=GetSpellInfo(spell)
 	if (not ct1) then
@@ -1077,7 +1078,7 @@ function Elementarist:DecideSpells()
 		ct1 = (ct1 / 1000)
 	end
 	local spell1 = Elementarist:NextSpell(ct1,spell)
-	Elementarist.textureList["next1"]:SetTexture(GetSpellTexture(spell1))
+	Elementarist:SetTexture(Elementarist.textureList["next1"],GetSpellTexture(spell1))

 	local _,_,_,_,_,_,ct2=GetSpellInfo(spell1)
 	if (not ct2) then
@@ -1089,7 +1090,7 @@ function Elementarist:DecideSpells()
 		ct2 = Elementarist.lastBaseGCD
 	end
 	local spell2 = Elementarist:NextSpell(ct1+ct2,spell,spell1)
-	Elementarist.textureList["next2"]:SetTexture(GetSpellTexture(spell2))
+	Elementarist:SetTexture(Elementarist.textureList["next2"],GetSpellTexture(spell2))

 	local icon

@@ -1097,16 +1098,16 @@ function Elementarist:DecideSpells()
 	Elementarist:FlashSpell(spell,"misc")

 	if (icon) then
-		Elementarist.textureList["misc"]:SetTexture(icon)
+		Elementarist:SetTexture(Elementarist.textureList["misc"],icon)
 	else
 		if (spell) then
-			Elementarist.textureList["misc"]:SetTexture(GetSpellTexture(spell))
+			Elementarist:SetTexture(Elementarist.textureList["misc"],GetSpellTexture(spell))
 		end
 	end

 	spell = Elementarist:IntSpell()
 	Elementarist:FlashSpell(spell,"int")
-	Elementarist.textureList["int"]:SetTexture(GetSpellTexture(spell))
+	Elementarist:SetTexture(Elementarist.textureList["int"],GetSpellTexture(spell))


 end
diff --git a/Elementarist.toc b/Elementarist.toc
index 526eeb1..c94f637 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: 2.0.2
+## Version: 2.0.3
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies: