Quantcast

do not update the icons each frame

Sidoine De Wispelaere [04-17-11 - 10:32]
do not update the icons each frame

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@397 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Ovale.lua
OvaleFrame.lua
defaut/Demoniste.lua
diff --git a/Ovale.lua b/Ovale.lua
index 16c5d81..5e506c0 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -73,6 +73,7 @@ Ovale.lastSpell = {}
 Ovale.spellDamage = {}
 Ovale.numberOfEnemies = nil
 Ovale.enemies = {}
+Ovale.refreshNeeded = false

 Ovale.buffSpellList =
 {
@@ -648,6 +649,7 @@ end
 function Ovale:CompileAll()
 	if self.db.profile.code then
 		self.masterNodes = self:Compile(self.db.profile.code)
+		self.refreshNeeded = true
 		self:UpdateFrame()
 		self.needCompile = false
 	end
@@ -822,6 +824,7 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 				if v.spellId == spellId then
 					if not v.channeled then
 						table.remove(self.lastSpell, i)
+						self.refreshNeeded = true
 						--self:Print("LOG_EVENT on supprime "..spellId.." a "..GetTime())
 					end
 					--self:Print(UnitDebuff("target", "Etreinte de l'ombre"))
@@ -837,9 +840,11 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 					local otherDebuff = self:GetOtherDebuffs(spellId)
 					if event == "SPELL_AURA_APPLIED" or event == "SPELL_AURA_REFRESH" then
 						otherDebuff[destGUID] = Ovale.maintenant + self:WithHaste(self.spellInfo[spellId].duration, self.spellInfo[spellId].durationhaste)
+						self.refreshNeeded = true
 					--	self:Print("ajout de "..spellName.." à "..destGUID)
 					elseif event == "SPELL_AURA_REMOVED" then
-						otherDebuff[destGUID] = nil
+						otherDebuff[destGUID] = nil
+						self.refreshNeeded = true
 					--	self:Print("suppression de "..spellName.." de "..destGUID)
 					end
 				end
@@ -856,6 +861,7 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 				if k==destGUID then
 					self.enemies[v] = nil
 					self.numberOfEnemies = self.numberOfEnemies - 1
+					self.refreshNeeded = true
 					--self:Print("enemy die")
 				end
 			end
@@ -865,12 +871,14 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 			self.enemies[sourceGUID] = true
 			--self:Print("new ennemy source=".. sourceName)
 			self.numberOfEnemies = self.numberOfEnemies + 1
+			self.refreshNeeded = true
 		elseif destGUID and not self.enemies[destGUID] and bit.band(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE)>0
 					and bit.band(destFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) > 0 and
 				sourceFlags and bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == 0 then
 			self.enemies[destGUID] = true
 			--self:Print("new ennemy dest=".. destName)
 			self.numberOfEnemies = self.numberOfEnemies + 1
+			self.refreshNeeded = true
 		end
 	end

@@ -881,6 +889,7 @@ function Ovale:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
 				for j,w in pairs(v) do
 					if j==destGUID then
 						v[j] = nil
+						self.refreshNeeded = true
 					end
 				end
 			end
@@ -892,6 +901,7 @@ end
 --Used to update the visibility e.g. if the user chose
 --to hide Ovale if a friendly unit is targeted
 function Ovale:PLAYER_TARGET_CHANGED()
+	self.refreshNeeded = true
 	self:UpdateVisibility()
 end

@@ -947,6 +957,8 @@ function Ovale:UNIT_AURA(event, unit)

 		self.spellHaste = hateBase + hateCommune + hateSorts + hateHero + hateClasse
 		self.meleeHaste = hateBase + hateCommune + hateCaC + hateHero + hateClasse
+
+		self.refreshNeeded = true
 --		self.rangedHaste = hateBase + hateCommune + hateHero + hateClasse -- TODO ajouter le bidule du chasseur en spé bête
 --		print("spellHaste = "..self.spellHaste)
 	end
@@ -979,6 +991,7 @@ function Ovale:RemoveSpellFromList(spellId, lineId)
 			break
 		end
 	end
+	self.refreshNeeded = true
 end

 --Called if the player interrupted early his cast
@@ -1076,6 +1089,7 @@ function Ovale:AddSpellToList(spellId, lineId, startTime, endTime, channeled)
 			end
 		end
 	end
+	self.refreshNeeded = true
 end

 function Ovale:GetCounterValue(id)
@@ -2284,7 +2298,7 @@ function Ovale:ChargerDefaut()
 				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 = "●", alpha = 1,
-				optionsAlpha = 1},
+				optionsAlpha = 1, updateInterval=0.1},
 			skin = {SkinID="Blizzard", Backdrop = true, Gloss = false, Colors = {}}
 		}
 	})
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index 57830e3..6147a70 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -1,6 +1,8 @@
 local AceGUI = LibStub("AceGUI-3.0")
 local LBF = LibStub("LibButtonFacade", true)

+local GetTime = GetTime
+
 ----------------
 -- Main Frame --
 ----------------
@@ -147,6 +149,15 @@ do
 			Ovale:CompileAll()
 			return
 		end
+
+		local now = GetTime()
+
+		if not Ovale.refreshNeeded and self.lastUpdate and now < self.lastUpdate + Ovale.db.profile.apparence.updateInterval then
+			return
+		end
+		Ovale.refreshNeeded = false
+		self.lastUpdate = now
+
 		Ovale:InitAllActions()
 		for k,node in pairs(Ovale.masterNodes) do
 			if Ovale.trace then
diff --git a/defaut/Demoniste.lua b/defaut/Demoniste.lua
index b3b9ffe..ef17e8d 100644
--- a/defaut/Demoniste.lua
+++ b/defaut/Demoniste.lua
@@ -233,7 +233,7 @@ AddIcon help=main mastery=2
 		if BuffPresent(DECIMATION) or BuffPresent(SOULBURN) Spell(SOULFIRE)
 	}
 	#/life_tap,if=mana_pct<=50&buff.bloodlust.down&buff.metamorphosis.down
-	if ManaPercent(less 50) and BuffExpires(heroism) and BuffExpires(METAMORPHOSIS) Spell(LIFETAP)
+	if ManaPercent(less 50) and BuffExpires(heroism) and BuffExpires(METAMORPHOSIS) and LifePercent(more 75) Spell(LIFETAP)
 	Spell(SHADOWBOLT)
 }