Quantcast

- bug : action bar were not updated when switching specs

Sidoine De Wispelaere [06-18-09 - 19:03]
- bug : action bar were not updated when switching specs
- added TargetBuffPresent

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@68 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
diff --git a/Condition.lua b/Condition.lua
index b88854c..8c5db26 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -415,6 +415,23 @@ Ovale.conditions=
 		end
 		return compare(Ovale.pointsTalent[condition[1]], condition[2], condition[3])
 	end,
+	-- Test if a buff is present on the target
+	-- 1 : buff spell id
+	-- stacks : how many stacks
+	TargetBuffPresent = function(condition)
+		local timeLeft, stacksLeft = GetTargetAura(condition, "HELPFUL", "target")
+		local tempsMin = avecHate(condition[2], condition.haste)
+
+		if (timeLeft and (condition[2]==nil or timeLeft>tempsMin)) then
+			if (stacksLeft~=0 and condition.stacks and stacksLeft<condition.stacks) then
+				return nil
+			else
+				return 0
+			end
+		else
+			return nil
+		end
+	end,
 	TargetClass = function(condition)
 		local loc, noloc = UnitClass("target")
 		return testbool(noloc == condition[1], condition[2])
diff --git a/Ovale.lua b/Ovale.lua
index 953fb5a..e295cb8 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -4,10 +4,8 @@ Ovale = LibStub("AceAddon-3.0"):NewAddon("Ovale", "AceEvent-3.0", "AceConsole-3.

 Ovale.defaut = {}
 Ovale.action = {}
-Ovale.listeSorts = {}
 Ovale.casesACocher = {}
 Ovale.actionSort = {}
-Ovale.listeFormes = {}
 Ovale.listeTalents = {}
 Ovale.pointsTalent = {}
 Ovale.talentIdToName = {}
@@ -212,12 +210,18 @@ function Ovale:OnInitialize()
 end

 function Ovale:ACTIONBAR_SLOT_CHANGED(event, slot, unknown)
-	if (slot) then
+	if (slot == 0) then
+		self:RemplirActionIndexes()
+	elseif (slot) then
 	-- on reçoit aussi si c'est une macro avec mouseover à chaque fois que la souris passe sur une cible!
 		self:RemplirActionIndex(tonumber(slot))
 	end
 end

+function Ovale:ACTIONBAR_PAGE_CHANGED()
+	-- self:RemplirActionIndexes()
+end
+
 function Ovale:CHARACTER_POINTS_CHANGED()
 	self:RemplirListeTalents()
 end
@@ -227,10 +231,8 @@ function Ovale:PLAYER_TALENT_UPDATE()
 end

 function Ovale:SPELLS_CHANGED()
-	self:RemplirListeSorts();
-	self:RemplirListeFormes()
-	self:RemplirActionIndexes()
-	self:RemplirListeTalents()
+	-- self:RemplirActionIndexes()
+	-- self:RemplirListeTalents()
 end

 function Ovale:UPDATE_BINDINGS()
@@ -335,8 +337,6 @@ function Ovale:ChercherNomsBuffs()
 end

 function Ovale:FirstInit()
-	self:RemplirListeSorts()
-	self:RemplirListeFormes()
 	self:RemplirActionIndexes()
 	self:RemplirListeTalents()
 	self:ChercherNomsBuffs()
@@ -393,6 +393,8 @@ function Ovale:OnEnable()
     self:RegisterEvent("ACTIONBAR_SLOT_CHANGED");
     self:RegisterEvent("UPDATE_BINDINGS");
     self:RegisterEvent("UNIT_AURA");
+    self:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
+
     -- self:RegisterEvent("PLAYER_TARGET_CHANGED")
     -- self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")

@@ -413,6 +415,7 @@ end

 function Ovale:OnDisable()
     -- Called when the addon is disabled
+    self:UnregisterEvent("ACTIONBAR_PAGE_CHANGED")
     self:UnregisterEvent("PLAYER_REGEN_ENABLED")
     self:UnregisterEvent("PLAYER_REGEN_DISABLED")
     self:UnregisterEvent("PLAYER_TALENT_UPDATE")
@@ -544,45 +547,11 @@ function Ovale:RemplirActionIndexes()
 	self.actionMacro = {}
 	self.actionObjet = {}
 	self.shortCut = {}
-
 	for i=1,120 do
 		self:RemplirActionIndex(i)
 	end
 end

-function Ovale:RemplirListeFormes()
-	self.listeFormes[0] = "Humanoïde";
-	local index=1;
-	while true do
-		local icon, name, active, castable = GetShapeshiftFormInfo(index);
-		if not icon then
-			break;
-		end
-		Ovale.listeFormes[index] = name;
-		index = index + 1
-	end
-end
-
-function Ovale:RemplirListeSorts()
-	local sorts = {};
-	local name, texture, offset, numSpells = GetSpellTabInfo(1);
-	local i=numSpells+1;
-	while true do
-		local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL)
-		if not spellName then
-			break
-		end
-		-- DEFAULT_CHAT_FRAME:AddMessage(spellName);
-		local nom = spellName;
-		local a, b, numeroRang = string.find(spellRank, "(%d+)");
-		--if (not numeroRang or tonumber(numeroRang)==1) then
-			Ovale.listeSorts[nom] = nom;
-		--else
-		--end
-		i = i+1;
-	end
-end
-
 function Ovale:RemplirListeTalents()
 	local numTabs = GetNumTalentTabs();
 	self.listeTalents = {}
diff --git a/Ovale.toc b/Ovale.toc
index c15611e..3f8b339 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.1.12
+## Version: 3.1.13
 ## OptionalDeps: Ace3
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC