Quantcast

* Fixed: Crystal of Instanity and Alchemist's Flask Cooldowns are checked

Taracque [03-24-14 - 18:14]
* Fixed: Crystal of Instanity and Alchemist's Flask Cooldowns are checked
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 dc6c377..7591340 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+**v3.2.6**
+* Fixed: Crystal of Instanity and Alchemist's Flask Cooldowns are checked
+
 **v3.2.5**
 * Fixed: various num to nil comparison fixed

diff --git a/Elementarist.lua b/Elementarist.lua
index d6a5d74..074b9fc 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.2.5
+-- Elementarist 3.2.6
 --
 -- 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.5';
+Elementarist.versionNumber = '3.2.6';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
@@ -702,6 +702,15 @@ function Elementarist:UpdateAuraTracker()
 	end;
 end

+function Elementarist:GetItemCooldownRemaining(itemID)
+    local s, d, _ = GetItemCooldown(itemID)
+    if (d) and (d>0) then
+        d = s - GetTime() + d
+    end
+
+    return d
+end
+
 function Elementarist:GetSpellCooldownRemaining(spell)
 	local s, d, _ = GetSpellCooldown(spell)
 	if (d) and (d>0) then
diff --git a/Elementarist.toc b/Elementarist.toc
index 21f476d..756001d 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.5
+## Version: 3.2.6
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies:
diff --git a/modules/elemental.lua b/modules/elemental.lua
index 419320f..a6bac89 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -237,11 +237,13 @@ Elementarist.elemental = {

 				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
+						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
-						if (name2 == nil) or (expirationTime2 < 2) 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
diff --git a/modules/restoration.lua b/modules/restoration.lua
index 5eb34f2..52389ed 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -232,11 +232,13 @@ Elementarist.restoration = {

 				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
+						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
-						if (name2 == nil) or (expirationTime2 < 2) 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