Quantcast

- added WeaponEnchantExpires condition

Sidoine De Wispelaere [07-07-09 - 19:00]
- added WeaponEnchantExpires condition
- bug fix: icons were always visible on startup even when option were set to hide them

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@87 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
diff --git a/Condition.lua b/Condition.lua
index 8d16200..59dbb81 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -594,5 +594,29 @@ Ovale.conditions=
 		else
 			return timeLeft
 		end
-	end
+	end,
+	WeaponEnchantExpires = function(condition)
+		local hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges = GetWeaponEnchantInfo()
+		if (condition[1] == "mainhand") then
+			if (not hasMainHandEnchant) then
+				return 0
+			end
+			mainHandExpiration = mainHandExpiration/1000
+			if (condition[2] >= mainHandExpiration) then
+				return 0
+			else
+				return mainHandExpiration - condition[2]
+			end
+		else
+			if (not hasOffHandEnchant) then
+				return 0
+			end
+			offHandExpiration = offHandExpiration/1000
+			if (condition[2] >= offHandExpiration) then
+				return 0
+			else
+				return offHandExpiration - condition[2]
+			end
+		end
+	end,
 }
\ No newline at end of file
diff --git a/Ovale.lua b/Ovale.lua
index 08ed82b..00a4940 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -443,7 +443,7 @@ function Ovale:OnEnable()
 		self:FirstInit()
 	end
 	self:UNIT_AURA("","player")
-	self.frame:Show()
+	self:UpdateVisibility()
 end

 function Ovale:PLAYER_REGEN_ENABLED()
diff --git a/Ovale.toc b/Ovale.toc
index 6284228..602cdf0 100644
--- a/Ovale.toc
+++ b/Ovale.toc
@@ -3,7 +3,7 @@
 ## Notes: Show the icon of the next spell to cast
 ## Notes-frFR: Affiche l'icône du prochain sort à lancer
 ## Author: Sidoine
-## Version: 3.1.17
+## Version: 3.1.18
 ## OptionalDeps: Ace3, ButtonFacade
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC