From eced3c3185007e081e1c4ade85284763d44b837f Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Mon, 5 May 2014 18:03:01 +0000 Subject: [PATCH] Extend BuffCount() condition to allow requiring a minimum stack. The syntax is BuffCount(id stacks=N) where N is the minimum stack size for the aura to count toward the running total. This allows one to get the count of Lifebloom x3 stacks across the raid. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1377 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 11 ++++++----- conditions/BuffCountOnAny.lua | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index 74075d8..e61ce15 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -1165,8 +1165,9 @@ do the first aura to expire that will change the total count, and the time interval over which the count is more than 0. --]] - statePrototype.AuraCount = function(state, auraId, filter, mine) + statePrototype.AuraCount = function(state, auraId, filter, mine, minStacks) -- Initialize. + minStacks = minStacks or 0 count = 0 startChangeCount, endingChangeCount = math.huge, math.huge startFirst, endingLast = math.huge, 0 @@ -1178,13 +1179,13 @@ do if auraTable[auraId] then if mine then local aura = GetStateAura(state, guid, auraId, self_guid) - if state:IsActiveAura(aura, now) and aura.filter == filter and not aura.state then + if state:IsActiveAura(aura, now) and aura.filter == filter and aura.stacks >= minStacks and not aura.state then CountMatchingActiveAura(aura) end else for casterGUID in pairs(auraTable[auraId]) do local aura = GetStateAura(state, guid, auraId, casterGUID) - if state:IsActiveAura(aura, now) and aura.filter == filter and not aura.state then + if state:IsActiveAura(aura, now) and aura.filter == filter and aura.stacks >= minStacks and not aura.state then CountMatchingActiveAura(aura) end end @@ -1197,13 +1198,13 @@ do if mine then local aura = auraTable[auraId][self_guid] if aura then - if state:IsActiveAura(aura, now) and aura.filter == filter then + if state:IsActiveAura(aura, now) and aura.filter == filter and aura.stacks >= minStacks then CountMatchingActiveAura(aura) end end else for casterGUID, aura in pairs(auraTable[auraId]) do - if state:IsActiveAura(aura, now) and aura.filter == filter then + if state:IsActiveAura(aura, now) and aura.filter == filter and aura.stacks >= minStacks then CountMatchingActiveAura(aura) end end diff --git a/conditions/BuffCountOnAny.lua b/conditions/BuffCountOnAny.lua index 16d464a..f7aaab1 100644 --- a/conditions/BuffCountOnAny.lua +++ b/conditions/BuffCountOnAny.lua @@ -24,6 +24,9 @@ do -- @param id The spell ID of the aura or the name of a spell list. -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. -- @param number Optional. The number to compare against. + -- @param stacks Optional. The minimum number of stacks of the aura required. + -- Defaults to stacks=1. + -- Valid values: any number greater than zero. -- @param any Optional. Sets by whom the aura was applied. If the aura can be applied by anyone, then set any=1. -- Defaults to any=0. -- Valid values: 0, 1. @@ -35,7 +38,7 @@ do local auraId, comparator, limit = condition[1], condition[2], condition[3] local _, filter, mine = ParseCondition(condition) - local count, startChangeCount, endingChangeCount, startFirst, endingLast = state:AuraCount(auraId, filter, mine) + local count, startChangeCount, endingChangeCount, startFirst, endingLast = state:AuraCount(auraId, filter, mine, condition.stacks) Ovale:Logf("BuffCount(%d) is %s, %s, %s, %s, %s", auraId, count, startChangeCount, endingChangeCount, startFirst, endingLast) if count > 0 and startChangeCount < math.huge then local origin = startChangeCount -- 1.7.9.5