Quantcast

- update is done even if Ovale is hidden, which allows to play sounds

Sidoine De Wispelaere [12-30-09 - 12:16]
- update is done even if Ovale is hidden, which allows to play sounds
- added glyph and talent options to SpellInfo, which allows to modify spell infos based on a glyph spell id or a talent id
- added forceduration to SpellInfo to tell Ovale to ignore the aura duration given by WoW and use its own duration (used for Glyph of Shred for example)
- added addduration and addcd to SpellInfo to use in combination with glyph and talent parameter: allows to modify previous values (e.g. Glyph of Rip add 4s to the duration of Rip)
- see Druid default script for an example (note that this script does not use the information anyway)
It's experimental, please report any bug

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@176 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Ovale.lua
Ovale.toc
OvaleCompile.lua
OvaleFrame.lua
defaut/Druide.lua
diff --git a/Ovale.lua b/Ovale.lua
index 2ad1bc8..ef7209b 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -291,10 +291,14 @@ end

 function Ovale:CHARACTER_POINTS_CHANGED()
 	self:RemplirListeTalents()
+--	self:Print("CHARACTER_POINTS_CHANGED")
+	self:CompileAll()
 end

 function Ovale:PLAYER_TALENT_UPDATE()
 	self:RemplirListeTalents()
+--	self:Print("PLAYER_TALENT_UPDATE")
+	self:CompileAll()
 end

 function Ovale:SPELLS_CHANGED()
@@ -440,11 +444,15 @@ function Ovale:UNIT_AURA(event, unit)
 	end
 end

+function Ovale:CompileAll()
+	self.masterNodes = self:Compile(self.db.profile.code)
+	self:UpdateFrame()
+end
+
 function Ovale:HandleProfileChanges()
 	if (self.firstInit) then
 		if (self.db.profile.code) then
-			self.masterNodes = self:Compile(self.db.profile.code)
-			self:UpdateFrame()
+			self:CompileAll()
 		end
 	end
 end
@@ -806,8 +814,13 @@ function Ovale:GetAura(target, filter, spellId)
 		if (unitCaster=="player" or not myAura.mine) and name == auraName and icon==auraIcon then
 			myAura.mine = (unitCaster == "player")
 			myAura.start = expirationTime - duration
+
+			if self.spellInfo[name] and self.spellInfo[name].forceduration then
+				duration = self.spellInfo[name].duration
+			end
+
 			if expirationTime>0 then
-				myAura.ending = expirationTime
+				myAura.ending = myAura.start + duration

 			else
 				myAura.ending = nil
diff --git a/Ovale.toc b/Ovale.toc
index c00e935..2835845 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.3.5
+## Version: 3.3.6
 ## OptionalDeps: Ace3, ButtonFacade, Recount
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 38717dc..795303d 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -65,13 +65,46 @@ local function ParseSpellAddTargetDebuff(params)
 	return ""
 end

+local function HasGlyph(spellId)
+	for i = 1, GetNumGlyphSockets() do
+		local enalbled, glypType, glyphSpellID = GetGlyphSocketInfo(i)
+		if (glyphSpellID == spellId) then
+			return true
+		end
+	end
+	return false
+end
+
+local function HasTalent(talentId)
+	if not Ovale.listeTalentsRemplie then
+		Ovale:RemplirListeTalents()
+	end
+	if Ovale.listeTalentsRemplie then
+		return Ovale.pointsTalent[talentId]>0
+	else
+		return false
+	end
+end
+
 local function ParseSpellInfo(params)
 	local paramList = ParseParameters(params)
 	local spell = Ovale:GetSpellInfoOrNil(paramList[1])
 	if (spell) then
+		if paramList.glyph and not HasGlyph(paramList.glyph) then
+			return ""
+		end
+		if paramList.talent and not HasTalent(paramList.talent) then
+			return ""
+		end
 		local spellInfo = Ovale:GetSpellInfo(spell)
 		for k,v in pairs(paramList) do
-			spellInfo[k] = v
+			if k == "addduration" then
+				spellInfo.duration = spellInfo.duration + v
+			elseif k == "addcd" then
+				spellInfo.cd = spellInfo.cd + v
+			else
+				spellInfo[k] = v
+			end
 		end
 	end
 	return ""
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index b687f71..aeb9b37 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -350,6 +350,7 @@ do
 		self.localstatus = {}
 		self.actions = {}

+
 		self.frame = frame
 		frame.obj = self
 		frame:SetWidth(100)
@@ -362,8 +363,12 @@ do
 		frame:SetScript("OnMouseUp", frameOnMouseUp)
 		frame:SetScript("OnEnter", frameOnEnter)
 		frame:SetScript("OnLeave", frameOnLeave)
-		frame:SetScript("OnUpdate", frameOnUpdate)
+	--	frame:SetScript("OnUpdate", frameOnUpdate)
 		frame:SetScript("OnHide",frameOnClose)
+
+		self.updateFrame = CreateFrame("Frame")
+		self.updateFrame:SetScript("OnUpdate", frameOnUpdate)
+		self.updateFrame.obj = self

 		self.barre = self.frame:CreateTexture();
 		self.barre:SetTexture(0,0.8,0)
diff --git a/defaut/Druide.lua b/defaut/Druide.lua
index 4075542..36d9381 100644
--- a/defaut/Druide.lua
+++ b/defaut/Druide.lua
@@ -26,6 +26,8 @@ Define(CLEARCASTING 16870)
 Define(CLAW 16827)
 Define(STARFALL 48505)
 Define(TRAUMA 46856)
+Define(GLYPHOFSHRED 54815)
+Define(GLYPHOFRIP 54818)

 AddCheckBox(multi L(AOE))
 AddCheckBox(mangle SpellName(MANGLECAT) default)
@@ -55,8 +57,10 @@ SpellInfo(MANGLECAT combo=1)
 SpellInfo(RAKE combo=1)
 SpellInfo(SHRED combo=1)
 SpellInfo(SAVAGEROAR combo=-5)
-SpellInfo(RIP combo=-5)
+SpellInfo(RIP combo=-5 duration=12)
 SpellInfo(FEROCIOUSBITE combo=-5)
+SpellInfo(RIP glyph=GLYPHOFSHRED forceduration=1 addduration=6)
+SpellInfo(RIP glyph=GLYPHOFRIP addduration=4)

 AddIcon help=main
 {