Quantcast

added Exists function

Sidoine De Wispelaere [03-31-11 - 22:06]
added Exists function
added meleehaste and spellhaste buffs
added alpha levels for icons and options
fix bug with ButtonFacade

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@393 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
OvaleFrame.lua
diff --git a/Condition.lua b/Condition.lua
index 80dd9fd..9f6230f 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -578,6 +578,9 @@ Ovale.conditions=
 		end
 		return startCast + castTime/1000
 	end,
+	Exists = function(condition)
+		return testbool(UnitExists(getTarget(condition.target)) == 1, condition[1])
+	end,
 	Glyph = function(condition)
 		local present = false
 		for i = 1, GetNumGlyphSockets() do
diff --git a/Ovale.lua b/Ovale.lua
index 5753e2d..7f37685 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -178,6 +178,17 @@ Ovale.buffSpellList =
 		32182, --Heroism
 		80353, --Time warp
 		90355 -- Ancient Hysteria (Core Hound)
+	},
+	meleehaste =
+	{
+		8515, -- Windfury
+		55610, -- Improved Icy Talons
+		53290 -- Hunting Party
+	},
+	spellhaste =
+	{
+		24907, -- Moonkin aura
+		2895 -- Wrath of Air Totem
 	}
 }

@@ -321,6 +332,24 @@ local options =
 					get = function(info) return Ovale.db.profile.apparence.vertical end,
 					set = function(info, value) Ovale.db.profile.apparence.vertical = value; Ovale:UpdateFrame() end
 				},
+				alpha =
+				{
+					order = 9.5,
+					type = "range",
+					name = L["Opacité des icônes"],
+					min = 0, max = 100, step = 5,
+					get = function(info) return Ovale.db.profile.apparence.alpha * 100 end,
+					set = function(info, value) Ovale.db.profile.apparence.alpha = value/100; Ovale.frame.frame:SetAlpha(value/100) end
+				},
+				optionsAlpha =
+				{
+					order = 9.5,
+					type = "range",
+					name = L["Opacité des options"],
+					min = 0, max = 100, step = 5,
+					get = function(info) return Ovale.db.profile.apparence.optionsAlpha * 100 end,
+					set = function(info, value) Ovale.db.profile.apparence.optionsAlpha = value/100; Ovale.frame.content:SetAlpha(value/100) end
+				},
 				predictif =
 				{
 					order = 10,
@@ -862,11 +891,11 @@ function Ovale:UNIT_AURA(event, unit)
 			self.buff[spellId].lastSeen = Ovale.maintenant
 			self.buff[spellId].present = true

-			if spellId == 24907 or spellId == 2895 then --moonkin aura / wrath of air
+			if self.buffSpellList.spellhaste[spellId] then --moonkin aura / wrath of air
 				hateSorts = 5 --add shadow form?
-			elseif spellId == 8515 or spellId == 55610 or spellId == 53290 then --windfury / improved icy talons / hunting party
+			elseif self.buffSpellList.meleehaste[spellId] then
 				hateCaC = 10
-			elseif spellId == 2825 or spellId == 32182 then --bloodlust / heroism
+			elseif self.buffSpellList.heroism[spellId] then
 				hateHero = 30
 			elseif spellId == 53657 then --judgements of the pure
 				hateClasse = 9
@@ -2208,7 +2237,8 @@ function Ovale:ChargerDefaut()
 			apparence = {enCombat=false, iconScale = 2, margin = 4, fontScale = 0.5, iconShiftX = 0, iconShiftY = 0,
 				smallIconScale=1, raccourcis=true, numeric=false, avecCible = false,
 				verrouille = false, vertical = false, predictif=false, highlightIcon = true, clickThru = false,
-				latencyCorrection=true, hideVehicule=true, flashIcon=true, targetText = "●"},
+				latencyCorrection=true, hideVehicule=true, flashIcon=true, targetText = "●", alpha = 1,
+				optionsAlpha = 1},
 			skin = {SkinID="Blizzard", Backdrop = true, Gloss = false, Colors = {}}
 		}
 	})
diff --git a/Ovale.toc b/Ovale.toc
index c06c339..371125a 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: 4.0.36
+## Version: 4.0.37
 ## OptionalDeps: Ace3, ButtonFacade, Recount, Skada, LibBabble-CreatureType-3.0, LibRangeCheck-2.0
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index 731ae97..57830e3 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -105,10 +105,10 @@ do
 	end

 	local function OnSkinChanged(self, skinID, gloss, backdrop, group, button, colors)
-		Ovale.db.profile.SkinID = skinID
-		Ovale.db.profile.Gloss = gloss
-		Ovale.db.profile.Backdrop = backdrop
-		Ovale.db.profile.Colors = colors
+		Ovale.db.profile.skin.SkinID = skinID
+		Ovale.db.profile.skin.Gloss = gloss
+		Ovale.db.profile.skin.Backdrop = backdrop
+		Ovale.db.profile.skin.Colors = colors
 	end

 	local function GetScore(self, spellId)
@@ -390,7 +390,8 @@ do
 		frame:SetScript("OnLeave", frameOnLeave)
 	--	frame:SetScript("OnUpdate", frameOnUpdate)
 		frame:SetScript("OnHide",frameOnClose)
-
+		frame:SetAlpha(Ovale.db.profile.apparence.alpha)
+
 		self.updateFrame = CreateFrame("Frame")
 		self.updateFrame:SetScript("OnUpdate", frameOnUpdate)
 		self.updateFrame.obj = self
@@ -407,15 +408,24 @@ do
 		content:SetWidth(200)
 		content:SetHeight(100)
 		content:Hide()
+		content:SetAlpha(Ovale.db.profile.apparence.optionsAlpha)

 		AceGUI:RegisterAsContainer(self)

 		if LBF then
 			self.skinGroup = LBF:Group("Ovale")
-			self.skinGroup.SkinID = Ovale.db.profile.SkinID
-			self.skinGroup.Gloss = Ovale.db.profile.Gloss
-			self.skinGroup.Backdrop = Ovale.db.profile.Backdrop
-			self.skinGroup.Colors = Ovale.db.profile.Colors or {}
+			if Ovale.db.profile.SkinID then
+				-- Import old values
+				Ovale.db.profile.skin.SkinID = Ovale.db.profile.SkinID
+				Ovale.db.profile.skin.Gloss = Ovale.db.profile.Gloss
+				Ovale.db.profile.skin.Backdrop = Ovale.db.profile.Backdrop
+				Ovale.db.profile.skin.Colors = Ovale.db.profile.Colors
+				Ovale.db.profile.SkinID = nil
+			end
+			self.skinGroup.SkinID = Ovale.db.profile.skin.SkinID or "Blizzard"
+			self.skinGroup.Gloss = Ovale.db.profile.skin.Gloss
+			self.skinGroup.Backdrop = Ovale.db.profile.skin.Backdrop
+			self.skinGroup.Colors = Ovale.db.profile.skin.Colors or {}
 			LBF:RegisterSkinCallback("Ovale", self.OnSkinChanged, self)
 		end