Quantcast

3.2.5: various num to nil comparison fixed, fixed slash command

Taracque [03-04-14 - 13:37]
3.2.5: various num to nil comparison fixed, fixed slash command
Filename
Change_log.txt
Ele_GUI.lua
Elementarist.lua
Elementarist.toc
modules/elemental.lua
modules/restoration.lua
diff --git a/Change_log.txt b/Change_log.txt
index dd26c2c..dc6c377 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+**v3.2.5**
+* Fixed: various num to nil comparison fixed
+
 **v3.2.4**
 * Fixed: Earthquake logic was bugged

diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index 8a1227f..a7d88bc 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -452,24 +452,6 @@ function Elementarist:CreateConfig()
 	end
 end

-function Elementarist.Options(msg)
-	if (msg=='debug') then
-		if (Elementarist.DebugMode) then
-			Elementarist:Debug("Debug ended", GetTime())
-		end
-		Elementarist.DebugMode = not ( Elementarist.DebugMode )
-		local debugStatus = "disabled"
-		if (Elementarist.DebugMode) then
-			Elementarist.DebugChat = Elementarist:GetDebugFrame()
-			debugStatus = "enabled. Using frame: " .. Elementarist.DebugChat:GetID()
-			Elementarist:Debug("Debug started", GetTime())
-		end
-		DEFAULT_CHAT_FRAME:AddMessage("Elementarist Debug " .. debugStatus)
-	else
-		InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
-	end
-end
-
 function Elementarist:ResetPosition()
 	ElementaristDB.x = 0
 	ElementaristDB.y = -100
diff --git a/Elementarist.lua b/Elementarist.lua
index 3c304a6..d6a5d74 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.2.4
+-- Elementarist 3.2.5
 --
 -- 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.2.4';
+Elementarist.versionNumber = '3.2.5';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
@@ -178,9 +178,6 @@ function Elementarist.events.PLAYER_ALIVE()
 end

 function Elementarist.events.PLAYER_ENTERING_WORLD()
-	-- Create config page
-	Elementarist:CreateConfig()
-
 	Elementarist:detectTalent()
 end

@@ -203,8 +200,29 @@ function Elementarist.events.ADDON_LOADED(addon)
 	-- load defaults, if first start
 	Elementarist:InitSettings()

+	-- Create config page
+	Elementarist:CreateConfig()
+
 	-- add slash command
-	SlashCmdList["Elementarist"] = Elementarist.Options
+	SlashCmdList["Elementarist"] = function(msg)
+		if (msg=='debug') then
+			if (Elementarist.DebugMode) then
+				Elementarist:Debug("Debug ended", GetTime())
+			end
+			Elementarist.DebugMode = not ( Elementarist.DebugMode )
+			local debugStatus = "disabled"
+			if (Elementarist.DebugMode) then
+				Elementarist.DebugChat = Elementarist:GetDebugFrame()
+				debugStatus = "enabled. Using frame: " .. Elementarist.DebugChat:GetID()
+				Elementarist:Debug("Debug started", GetTime())
+			end
+			DEFAULT_CHAT_FRAME:AddMessage("Elementarist Debug " .. debugStatus)
+		else
+			InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
+			InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
+			InterfaceOptionsFrame_OpenToCategory(getglobal("ElementaristConfigPanel"))
+		end
+	end
 	SLASH_Elementarist1 = "/Elementarist"
 	SLASH_Elementarist2 = "/ele"

diff --git a/Elementarist.toc b/Elementarist.toc
index 39573c1..21f476d 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.2.4
+## Version: 3.2.5
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies:
diff --git a/modules/elemental.lua b/modules/elemental.lua
index f3eef21..419320f 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -295,7 +295,7 @@ Elementarist.elemental = {

 		-- Ascendance
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Ascendance"]) then
-			local name = Elementarist:hasBuff("player",Elementarist.SpellList["AscendanceElementalBuff"])
+			name = Elementarist:hasBuff("player",Elementarist.SpellList["AscendanceElementalBuff"])
 			if (name == nil) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Ascendance"])
 				if d <= 0.5 then
@@ -363,7 +363,7 @@ Elementarist.elemental = {

 		-- check if mana is below 70% and Thunderstorm available
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Thunderstorm"]) then
-			local d = GetSpellCooldown(Elementarist.SpellList["Thunderstorm"])
+			d = GetSpellCooldown(Elementarist.SpellList["Thunderstorm"])
 			if (d) and ((UnitPower("player",0) / UnitPowerMax("player",0)) < 0.7) and (d < 0.5) then
 				return Elementarist.SpellList["Thunderstorm"]
 			end
@@ -373,7 +373,7 @@ Elementarist.elemental = {
 		if (ElementaristDB.EnableEQ) then
 			if (Elementarist.person["foeCount"]>=4) then
 				d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"])
-				if (d<0.5) then
+				if (d) and (d<0.5) then
 					return Elementarist.SpellList["Earthquake"]
 				end
 			end
@@ -384,7 +384,7 @@ Elementarist.elemental = {
 			if IsSpellInRange(Elementarist.SpellList["Purge"], "target") == 1 then
 				if (Elementarist:hasBuff("target", ".", 1)) then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Purge"])
-					if (d<0.5) then
+					if (d) and (d<0.5) then
 						return Elementarist.SpellList["Purge"]
 					end
 				end
@@ -396,7 +396,7 @@ Elementarist.elemental = {
 			if (Elementarist.person["foeCount"]>2) then
 				if IsSpellInRange(Elementarist.SpellList["Lava Beam"], "target") == 1 then
 					d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Lava Beam"])
-					if (d<0.5) then
+					if (d) and (d<0.5) then
 						return Elementarist.SpellList["Lava Beam"]
 					end
 				end
@@ -409,7 +409,7 @@ Elementarist.elemental = {
 				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<0.5) then
+						if (d) and (d<0.5) then
 							return Elementarist.SpellList["Chain Lightning"]
 						end
 					end
diff --git a/modules/restoration.lua b/modules/restoration.lua
index 5dd3da4..5eb34f2 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -265,7 +265,7 @@ Elementarist.restoration = {
 			local haveWaterTotem,waterTotemName,_,_ = GetTotemInfo(3)
 			if (waterTotemName == "") then
 				e = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Healing Stream Totem"]);
-				if (e < 1) then
+				if (e) and (e < 1) then
 					return Elementarist.SpellList["Healing Stream Totem"];
 				end;
 			end
@@ -283,7 +283,7 @@ Elementarist.restoration = {
 		-- Stormlash Totem
 		if Elementarist:SpellAvailable(Elementarist.SpellList["Stormlash Totem"]) then
 			d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Stormlash Totem"])
-			if d <= 0.5 then
+			if (d) and (d <= 0.5) then
 				return Elementarist.SpellList["Stormlash Totem"]
 			end
 		end