Quantcast

Fixed: Wrong logic, if both alchemist flask, and Crystal of Insanity presents

Taracque [06-14-13 - 09:44]
Fixed: Wrong logic, if both alchemist flask, and Crystal of Insanity presents
Filename
Change_log.txt
Elementarist.lua
Elementarist.toc
modules/elemental.lua
modules/restoration.lua
diff --git a/Change_log.txt b/Change_log.txt
index ae83e58..2bb3f30 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+**v3.2.1**
+* Fixed: Wrong logic, if both alchemist flask, and Crystal of Insanity presents
+
 **v3.2.0**
 * Added: Crystal of Insanity detection (both Resto and Elemental)
 * Changed: 5.3 compatibility
diff --git a/Elementarist.lua b/Elementarist.lua
index b2004d9..2207357 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.2.0
+-- Elementarist 3.2.1
 --
 -- 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.0';
+Elementarist.versionNumber = '3.2.1';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
diff --git a/Elementarist.toc b/Elementarist.toc
index 1198849..c3043f8 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.0
+## Version: 3.2.1
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies:
diff --git a/modules/elemental.lua b/modules/elemental.lua
index 9f50a43..55acb33 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -223,7 +223,7 @@ Elementarist.elemental = {
 		-- Lifeblood Herbalism spell

 		local d, e
-		local name, expirationTime, _
+		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
@@ -232,22 +232,18 @@ Elementarist.elemental = {
 				name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Draconic Mind"]);
 			end
 			if (name == nil) then
-				if (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
-					name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Crystal of Insanity"], false, Elementarist.CustomIDs["Crystal of Insanity Spell"]);
-					if (name == nil) or (expirationTime < 2) then
-						if (icon == nil) then
-							icon = GetItemIcon(Elementarist.CustomIDs["Crystal of Insanity Item"])
+				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
+						if (name == nil) or (expirationTime < 2) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Crystal of Insanity Item"])
 						end
-						return nil,icon
-					end
-				end
-				if (GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) then
-					name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);
-					if (name == nil) or (expirationTime < 2) then
-						if (icon == nil) then
-							icon = GetItemIcon(Elementarist.CustomIDs["Alchemist's Flask Item"])
+					elseif (GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) then
+						if (name2 == nil) or (expirationTime2 < 2) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Alchemist's Flask Item"])
 						end
-						return nil,icon
 					end
 				end
 			end
diff --git a/modules/restoration.lua b/modules/restoration.lua
index 702b9af..5dd3da4 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -218,7 +218,7 @@ Elementarist.restoration = {

 	MiscSpell = function(self)
 		local d, e
-		local name, expirationTime, _
+		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
@@ -227,22 +227,18 @@ Elementarist.restoration = {
 				name = Elementarist:hasBuff("player", Elementarist.SpellList["Flask of the Draconic Mind"]);
 			end
 			if (name == nil) then
-				if (GetItemCount(Elementarist.CustomIDs["Crystal of Insanity Item"]) ~= 0) then
-					name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Crystal of Insanity"], false, Elementarist.CustomIDs["Crystal of Insanity Spell"]);
-					if (name == nil) or (expirationTime < 2) then
-						if (icon == nil) then
-							icon = GetItemIcon(Elementarist.CustomIDs["Crystal of Insanity Item"])
+				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
+						if (name == nil) or (expirationTime < 2) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Crystal of Insanity Item"])
 						end
-						return nil,icon
-					end
-				end
-				if (GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) then
-					name, _, _, _, _, _, expirationTime = Elementarist:hasBuff("player", Elementarist.SpellList["Alchemist's Flask"], false, Elementarist.CustomIDs["Alchemist's Flask Spell"]);
-					if (name == nil) or (expirationTime < 2) then
-						if (icon == nil) then
-							icon = GetItemIcon(Elementarist.CustomIDs["Alchemist's Flask Item"])
+					elseif (GetItemCount(Elementarist.CustomIDs["Alchemist's Flask Item"]) ~= 0) then
+						if (name2 == nil) or (expirationTime2 < 2) then
+							return nil,GetItemIcon(Elementarist.CustomIDs["Alchemist's Flask Item"])
 						end
-						return nil,icon
 					end
 				end
 			end