Quantcast

test

Sidoine De Wispelaere [11-13-11 - 16:43]
test

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@431 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleFrame.lua
OvaleIcone.lua
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index 89b7e62..13e28bf 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -169,52 +169,60 @@ do
 				Ovale:Log("CalculerMeilleureAction start = "..start)
 			end
 			local action = self.actions[k]
-
-			local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
-					actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellId, actionTarget, noRed = Ovale:GetActionInfo(element)
-			if noRed then
-				start = actionCooldownStart + actionCooldownDuration
-				if start < Ovale.currentTime then
-					start = Ovale.currentTime
+			Ovale:Log("node.params.type = " .. node.params.type)
+			if node.params.type == "value" then
+				local actionTexture
+				if node.params.texture then
+					actionTexture = GetSpellTexture(node.params.texture)
 				end
-			end
-
-			-- Dans le cas de canStopChannelling, on risque de demander d'interrompre le channelling courant, ce qui est stupide
-			if start and Ovale.currentSpellId and Ovale.attenteFinCast and spellId == Ovale.currentSpellId and start<Ovale.attenteFinCast then
-				start = Ovale.attenteFinCast
-			end
-
-			if (node.params.nocd and start~=nil and Ovale.maintenant<start-node.params.nocd) then
-				action.icons[1]:Update(element, nil)
+				action.icons[1]:SetValue(start, actionTexture)
 			else
-				action.icons[1]:Update(element, start, actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
-					actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellId, actionTarget)
-			end
-
-			action.spellId = spellId
-
-			if start == Ovale.maintenant and actionUsable then
-				if not action.waitStart then
-					action.waitStart = Ovale.maintenant
+				local actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
+						actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellId, actionTarget, noRed = Ovale:GetActionInfo(element)
+				if noRed then
+					start = actionCooldownStart + actionCooldownDuration
+					if start < Ovale.currentTime then
+						start = Ovale.currentTime
+					end
 				end
-			else
-				action.waitStart = nil
-			end
-
-			if Ovale.db.profile.apparence.moving and action.icons[1].debutAction and action.icons[1].finAction then
-				local top=1-(Ovale.maintenant - action.icons[1].debutAction)/(action.icons[1].finAction-action.icons[1].debutAction)
-				if top<0 then
-					top = 0
-				elseif top>1 then
-					top = 1
+
+				-- Dans le cas de canStopChannelling, on risque de demander d'interrompre le channelling courant, ce qui est stupide
+				if start and Ovale.currentSpellId and Ovale.attenteFinCast and spellId == Ovale.currentSpellId and start<Ovale.attenteFinCast then
+					start = Ovale.attenteFinCast
+				end
+
+				if (node.params.nocd and start~=nil and Ovale.maintenant<start-node.params.nocd) then
+					action.icons[1]:Update(element, nil)
+				else
+					action.icons[1]:Update(element, start, actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
+						actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellId, actionTarget)
 				end
-				action.icons[1]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",(action.left + top*action.dx)/action.scale,(action.top - top*action.dy)/action.scale)
-				if action.icons[2] then
-					action.icons[2]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",(action.left + (top+1)*action.dx)/action.scale,(action.top - (top+1)*action.dy)/action.scale)
+
+				action.spellId = spellId
+
+				if start == Ovale.maintenant and actionUsable then
+					if not action.waitStart then
+						action.waitStart = Ovale.maintenant
+					end
+				else
+					action.waitStart = nil
+				end
+
+				if Ovale.db.profile.apparence.moving and action.icons[1].debutAction and action.icons[1].finAction then
+					local top=1-(Ovale.maintenant - action.icons[1].debutAction)/(action.icons[1].finAction-action.icons[1].debutAction)
+					if top<0 then
+						top = 0
+					elseif top>1 then
+						top = 1
+					end
+					action.icons[1]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",(action.left + top*action.dx)/action.scale,(action.top - top*action.dy)/action.scale)
+					if action.icons[2] then
+						action.icons[2]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",(action.left + (top+1)*action.dx)/action.scale,(action.top - (top+1)*action.dy)/action.scale)
+					end
 				end
 			end

-			if (node.params.size ~= "small" and not node.params.nocd and Ovale.db.profile.apparence.predictif) then
+			if (node.params.size ~= "small" and not node.params.nocd and Ovale.db.profile.apparence.predictif and node.params.type ~= "value") then
 				if start then
 					local castTime=0
 					if spellId then
@@ -331,6 +339,7 @@ do
 				icon:SetPoint("TOPLEFT",self.frame,"TOPLEFT",(action.left + (l-1)*action.dx)/scale,(action.top - (l-1)*action.dy)/scale)
 				icon:SetScale(scale)
 				icon:SetFontScale(Ovale.db.profile.apparence.fontScale)
+				icon:SetParams(node.params)
 				icon:SetHelp(node.params.help)
 				icon:SetRangeIndicator(Ovale.db.profile.apparence.targetText)
 				icon:EnableMouse(not Ovale.db.profile.apparence.clickThru)
diff --git a/OvaleIcone.lua b/OvaleIcone.lua
index 1841dbc..b37ba38 100644
--- a/OvaleIcone.lua
+++ b/OvaleIcone.lua
@@ -1,6 +1,18 @@
 local LBF = LibStub("LibButtonFacade", true)
 local L = LibStub("AceLocale-3.0"):GetLocale("Ovale")

+local function SetValue(self, value, actionTexture)
+	self.icone:Show()
+	self.icone:SetTexture(actionTexture);
+	self.icone:SetAlpha(1.0)
+	self.cd:Hide()
+	self.aPortee:Hide()
+	self.shortcut:Hide()
+	self.remains:SetText("TOTO") --string.format("%.1f", value))
+	self.remains:Show()
+	self:Show()
+end
+
 local function Update(self, element, minAttente, actionTexture, actionInRange, actionCooldownStart, actionCooldownDuration,
 				actionUsable, actionShortcut, actionIsCurrent, actionEnable, spellId, actionTarget)

@@ -88,7 +100,7 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a
 		end

 		-- Le temps restant
-		if (Ovale.db.profile.apparence.numeric and minAttente > Ovale.maintenant) then
+		if ((Ovale.db.profile.apparence.numeric or self.params.text == "always") and minAttente > Ovale.maintenant) then
 			self.remains:SetText(string.format("%.1f", minAttente - Ovale.maintenant))
 			self.remains:Show()
 		else
@@ -164,6 +176,10 @@ local function SetHelp(self, help)
 	self.help = help
 end

+local function SetParams(self, params)
+	self.params = params
+end
+
 local function SetFontScale(self, scale)
 	self.fontScale = scale
 	self.shortcut:SetFont(self.fontName, self.fontHeight * self.fontScale, self.fontFlags)
@@ -227,8 +243,10 @@ function OvaleIcone_OnLoad(self)
 	self.Update = Update
 	self.SetSize = SetSize
 	self.SetHelp = SetHelp
+	self.SetParams = SetParams
 	self.SetFontScale = SetFontScale
 	self.SetRangeIndicator = SetRangeIndicator
+	self.SetValue = SetValue
 	self.cdShown = true
 	if Ovale.db.profile.clickThru then
 		self:EnableMouse(false)