Quantcast

option haste=spell or haste=melee added to some functions

Sidoine De Wispelaere [02-07-09 - 19:51]
option haste=spell or haste=melee added to some functions

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@20 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
defaut/Demoniste.lua
defaut/Pretre.lua
diff --git a/Condition.lua b/Condition.lua
index ef0da9e..9437928 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -1,5 +1,17 @@
 local LBCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable()

+local function avecHate(temps, hate)
+	if (not hate) then
+		return temps
+	elseif (hate == "spell") then
+		return temps/(1+Ovale.spellHaste/100)
+	elseif (hate == "melee") then
+		return temps/(1+Ovale.meleeHaste/100)
+	else
+		return temps
+	end
+end
+
 local function compare(a, comparison, b)
 	if (comparison == "more") then
 		if (not b or (a~=nil and a>b)) then
@@ -64,7 +76,7 @@ Ovale.conditions=
 	-- 2 : expiration time
 	BuffExpires = function(condition)
 		local buffName = Ovale:GetSpellInfoOrNil(condition[1])
-		i=1;
+		local i=1;
 		while (true) do
 			local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable =  UnitBuff("player", i);
 			if (not name) then
@@ -72,10 +84,11 @@ Ovale.conditions=
 			end
 			if (name == buffName) then
 				local timeLeft = expirationTime - Ovale.maintenant
-				if (timeLeft<condition[2]) then
+				local timeBefore = avecHate(condition[2], condition.haste)
+				if (timeLeft<timeBefore) then
 					return 0
 				else
-					return timeLeft-condition[2]
+					return timeLeft-timeBefore
 				end
 			end
 			i = i + 1;
@@ -247,12 +260,13 @@ Ovale.conditions=
 			if (not condition.mine or isMine) then
 				if (name == debuffName) then
 					local timeLeft = expirationTime - Ovale.maintenant
-					if (timeLeft<condition[2]) then
+					local tempsMax = avecHate(condition[2], condition.haste)
+					if (timeLeft<tempsMax) then
 						return 0
 					elseif (count~=0 and condition.stacks and count<condition.stacks) then
 						return 0
 					else
-						return timeLeft-condition[2]
+						return timeLeft-tempsMax
 					end
 				end
 			end
diff --git a/Ovale.lua b/Ovale.lua
index acf600b..c63e068 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -24,6 +24,8 @@ Ovale.dropDowns = {}
 Ovale.masterNodes = nil
 Ovale.bug = false
 Ovale.enCombat = false
+Ovale.spellHaste = 0
+Ovale.meleeHaste = 0

 Ovale.arbre = {}

@@ -209,6 +211,41 @@ function Ovale:UPDATE_BINDINGS()
 	self:RemplirActionIndexes()
 end

+function Ovale:UNIT_AURA(event, unit)
+	if (unit == "player") then
+		local hateBase = GetCombatRatingBonus(18)
+		local hateCommune=0;
+		local hateSorts = 0;
+		local hateCaC = 0;
+		local hateHero = 0
+		local hateClasse = 0
+		local i=1;
+		while (true) do
+			local name =  UnitBuff("player", i);
+			if (not name) then
+				break
+			end
+			if (name == self.RETRIBUTION_AURA or name == self.MOONKIN_AURA) then
+				hateCommune = 3
+			elseif (name == self.WRATH_OF_AIR_TOTEM) then
+				hateSorts = 5
+			elseif (name == self.WINDFURY_TOTEM and hateCaC == 0) then
+				hateCaC = 16
+			elseif (name == self.ICY_TALONS) then
+				hateCaC = 20
+			elseif (name == self.BLOODLUST or name == self.HEROISM) then
+				hateHero = 30
+			elseif (name == self.JUDGMENT_OF_THE_PURE) then
+				hateClasse = 15
+			end
+			i = i + 1;
+		end
+		self.spellHaste = hateBase + hateCommune + hateSorts + hateHero + hateClasse
+		self.meleeHaste = hateBase + hateCommune + hateCaC + hateHero + hateClasse
+--		print("spellHaste = "..self.spellHaste)
+	end
+end
+
 function Ovale:HandleProfileChanges()
 	if (self.firstInit) then
 		if (self.db.profile.code) then
@@ -218,11 +255,23 @@ function Ovale:HandleProfileChanges()
 	end
 end

+function Ovale:ChercherNomsBuffs()
+	self.MOONKIN_AURA = self:GetSpellInfoOrNil(24907)
+	self.RETRIBUTION_AURA = self:GetSpellInfoOrNil(7294)
+	self.WRATH_OF_AIR_TOTEM = self:GetSpellInfoOrNil(3738)
+	self.WINDFURY_TOTEM = self:GetSpellInfoOrNil(8512)
+	self.ICY_TALONS = self:GetSpellInfoOrNil(50880)
+	self.BLOODLUST = self:GetSpellInfoOrNil(2825)
+	self.HEROISM = self:GetSpellInfoOrNil(32182)
+	self.JUDGMENT_OF_THE_PURE = self:GetSpellInfoOrNil(54153)
+end
+
 function Ovale:FirstInit()
 	self:RemplirListeSorts()
 	self:RemplirListeFormes()
 	self:RemplirActionIndexes()
 	self:RemplirListeTalents()
+	self:ChercherNomsBuffs()
 	-- self:InitEcranOption()

 	local playerClass, englishClass = UnitClass("player")
@@ -271,11 +320,12 @@ function Ovale:OnEnable()
     self:RegisterEvent("CHARACTER_POINTS_CHANGED")
     self:RegisterEvent("ACTIONBAR_SLOT_CHANGED");
     self:RegisterEvent("UPDATE_BINDINGS");
+    self:RegisterEvent("UNIT_AURA");

 	if (not self.firstInit) then
 		self:FirstInit()
 	end
-
+	self:UNIT_AURA("","player")
 end

 function Ovale:PLAYER_REGEN_ENABLED()
@@ -294,6 +344,7 @@ function Ovale:OnDisable()
     self:UnregisterEvent("SPELLS_CHANGED")
     self:UnregisterEvent("CHARACTER_POINTS_CHANGED")
     self:UnregisterEvent("UPDATE_BINDINGS")
+    self:UnregisterEvent("UNIT_AURA")
     self.frame:Hide()
 end

diff --git a/Ovale.toc b/Ovale.toc
index 48614f5..bbde3ed 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.0.3
+## Version: 3.0.4
 ## OptionalDeps: Ace3
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/defaut/Demoniste.lua b/defaut/Demoniste.lua
index 098e1ea..57b7092 100644
--- a/defaut/Demoniste.lua
+++ b/defaut/Demoniste.lua
@@ -35,10 +35,10 @@ AddIcon
 {
 if TalentPoints(TALENTSHADOWEMBRACE more 0) and TargetDebuffExpires(SHADOWEMBRACE 0) Spell(SHADOWBOLT)
 if TargetDebuffExpires(HAUNT 1.5 mine=1) Spell(HAUNT doNotRepeat=1)
-if TargetDebuffExpires(UNSTABLEAFFLICTION 1.5 mine=1) Spell(UNSTABLEAFFLICTION doNotRepeat=1)
+if TargetDebuffExpires(UNSTABLEAFFLICTION 1.5 mine=1 haste=spell) Spell(UNSTABLEAFFLICTION doNotRepeat=1)
 if TalentPoints(TALENTBACKDRAFT more 0) and TargetDebuffExpires(IMMOLATE 3 mine=1)
    and TargetDebuffPresent(IMMOLATE mine=1) Spell(CONFLAGRATE doNotRepeat=1)
-if TargetDebuffExpires(IMMOLATE 1.5 mine=1) and TargetLifePercent(more 25) Spell(IMMOLATE doNotRepeat=1)
+if TargetDebuffExpires(IMMOLATE 1.5 mine=1 haste=spell) and TargetLifePercent(more 25) Spell(IMMOLATE doNotRepeat=1)
 if List(curse recklessness) and TargetDebuffExpires(CURSERECKLESSNESS 2) Spell(CURSERECKLESSNESS)
 if List(curse elements) and TargetDebuffExpires(CURSEELEMENTS 2) Spell(CURSEELEMENTS)
 if List(curse doom) and TargetDebuffExpires(CURSEDOOM 0 mine=1) Spell(CURSEDOOM)
diff --git a/defaut/Pretre.lua b/defaut/Pretre.lua
index 525b24d..9879c1c 100644
--- a/defaut/Pretre.lua
+++ b/defaut/Pretre.lua
@@ -31,7 +31,7 @@ AddIcon
      if BuffPresent(SHADOWWEAVE stacks=5) and TargetDebuffExpires(PAIN 0 mine=1)
         Spell(PAIN)

-     if TargetDebuffExpires(VAMPIRICTOUCH 1 mine=1)
+     if TargetDebuffExpires(VAMPIRICTOUCH 1.5 mine=1 haste=spell)
         Spell(VAMPIRICTOUCH doNotRepeat=1)

      if TalentPoints(TALENTDIVINEFURY less 1) # Fureur divine