- added itemcount and itemset conditions
Sidoine De Wispelaere [02-14-12 - 19:09]
- added itemcount and itemset conditions
- retribution paladin: added 2T13
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@473 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/Ovale.lua b/Ovale.lua
index b073d77..245f9bc 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -79,6 +79,7 @@ Ovale.damageMultiplier = 1
Ovale.numberOfEnemies = nil
Ovale.enemies = {}
Ovale.refreshNeeded = false
+Ovale.compileOnItems = false
-- List haste buff that does not appear in the character sheet and that are not raid wide buffs
Ovale.selfHasteBuff =
@@ -797,6 +798,7 @@ function Ovale:OnEnable()
self:RegisterEvent("CHAT_MSG_ADDON")
self:RegisterEvent("GLYPH_UPDATED")
self:RegisterEvent("GLYPH_ADDED")
+ self:RegisterEvent("UNIT_INVENTORY_CHANGED")
if (not self.firstInit) then
self:FirstInit()
@@ -808,6 +810,7 @@ end
function Ovale:OnDisable()
-- Called when the addon is disabled
+ self:UnregisterEvent("UNIT_INVENTORY_CHANGED")
self:UnregisterEvent("ACTIONBAR_PAGE_CHANGED")
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
@@ -860,6 +863,13 @@ function Ovale:SPELLS_CHANGED()
self.needCompile = true
end
+function Ovale:UNIT_INVENTORY_CHANGED()
+ self.needCompile = self.compileOnItems
+ if not self.needCompile then
+ self.refreshNeeded = true
+ end
+end
+
--Called when the user changed his key bindings
function Ovale:UPDATE_BINDINGS()
self:RemplirActionIndexes()
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 3124e54..289e908 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -36,6 +36,63 @@ local function ParseParameters(params)
return paramList
end
+
+local function TestConditions(paramList)
+ if paramList.glyph and not HasGlyph(paramList.glyph) then
+ return false
+ end
+ if paramList.mastery and paramList.mastery~=GetPrimaryTalentTree() then
+ return false
+ end
+ if paramList.talent and not HasTalent(paramList.talent) then
+ return false
+ end
+ if paramList.checkboxon then
+ local cb = paramList.checkboxon
+ if not Ovale.casesACocher[cb] then
+ Ovale.casesACocher[cb] = {}
+ end
+ Ovale.casesACocher[cb].compile = true
+ if not Ovale.db.profile.check[cb] then
+ return false
+ end
+ end
+ if paramList.checkboxoff then
+ local cb = paramList.checkboxoff
+ if not Ovale.casesACocher[cb] then
+ Ovale.casesACocher[cb] = {}
+ end
+ Ovale.casesACocher[cb].compile = true
+ if Ovale.db.profile.check[cb] then
+ return false
+ end
+ end
+ if paramList.list and paramList.item then
+ local list = paramList.list
+ local key = paramList.item
+ if not Ovale.listes[list] then
+ Ovale.listes[list] = { items = {}}
+ end
+ Ovale.listes[list].compile = true
+ if Ovale.db.profile.list[list] ~= key then
+ return false
+ end
+ end
+ if paramList.itemset and paramList.itemcount then
+ local set = paramList.itemset
+ local count = paramList.itemcount
+ local nombre = 0
+ Ovale.compileOnItems = true
+ if OvaleEquipement.nombre[set] then
+ nombre = OvaleEquipement.nombre[set]
+ end
+ if nombre<=count then
+ return false
+ end
+ end
+ return true
+end
+
local function ParseTime(value)
return AddNode({type="time", value=tonumber(value)})
end
@@ -127,10 +184,7 @@ local function ParseSpellInfo(params)
local paramList = ParseParameters(params)
local spellId = paramList[1]
if spellId then
- if paramList.glyph and not HasGlyph(paramList.glyph) then
- return ""
- end
- if paramList.talent and not HasTalent(paramList.talent) then
+ if not TestConditions(paramList) then
return ""
end
local spellInfo = Ovale:GetSpellInfo(spellId)
@@ -247,49 +301,6 @@ local function subtest(text, pattern, func)
return text
end
-local function TestConditions(paramList)
- if paramList.glyph and not HasGlyph(paramList.glyph) then
- return false
- end
- if paramList.mastery and paramList.mastery~=GetPrimaryTalentTree() then
- return false
- end
- if paramList.talent and not HasTalent(paramList.talent) then
- return false
- end
- if paramList.checkboxon then
- local cb = paramList.checkboxon
- if not Ovale.casesACocher[cb] then
- Ovale.casesACocher[cb] = {}
- end
- Ovale.casesACocher[cb].compile = true
- if not Ovale.db.profile.check[cb] then
- return false
- end
- end
- if paramList.checkboxoff then
- local cb = paramList.checkboxoff
- if not Ovale.casesACocher[cb] then
- Ovale.casesACocher[cb] = {}
- end
- Ovale.casesACocher[cb].compile = true
- if Ovale.db.profile.check[cb] then
- return false
- end
- end
- if paramList.list and paramList.item then
- local list = paramList.list
- local key = paramList.item
- if not Ovale.listes[list] then
- Ovale.listes[list] = { items = {}}
- end
- Ovale.listes[list].compile = true
- if Ovale.db.profile.list[list] ~= key then
- return false
- end
- end
- return true
-end
local function ParseAddListItem(list, item, text, params)
local paramList = ParseParameters(params)
@@ -442,6 +453,7 @@ local function ParseL(text)
end
function Ovale:Compile(text)
+ self.compileOnItems = false
self.bug = false
node = {}
defines = {}
diff --git a/defaut/Paladin.lua b/defaut/Paladin.lua
index 5ccbdd0..faa9e76 100644
--- a/defaut/Paladin.lua
+++ b/defaut/Paladin.lua
@@ -44,6 +44,7 @@ Define(INQUISITION 84963)
SpellAddBuff(INQUISITION INQUISITION=12 DIVINEPURPOSE=0)
Define(JUDGEMENT 20271)
SpellInfo(JUDGEMENT cd=8)
+ SpellInfo(JUDGEMENT holy=1 itemset=T13 itemcount=2)
Define(LIGHTOFDAWN 85222)
SpellInfo(LIGHTOFDAWN holy=-3)
Define(REBUKE 96231)