from retail

This commit is contained in:
NoM0Re
2025-01-13 17:54:30 +01:00
parent d14313d848
commit 43c9ccec1c
4 changed files with 78 additions and 36 deletions
+22 -14
View File
@@ -1450,12 +1450,11 @@ do
return tests
end
function Private.CreateTriggerCounter(pattern)
function Private.ExecEnv.CreateTriggerCounter(pattern)
local counter = {
count = 0,
tests = {
},
fastMatches = {
},
@@ -1466,6 +1465,9 @@ do
self.count = self.count + 1
return self.count
end,
SetCount = function(self, count)
self.count = count
end,
}
if pattern then
counter.tests = ParseCron(pattern)
@@ -1591,9 +1593,9 @@ function GenericTrigger.Add(data, region)
if prototype.countEvents then
if trigger.use_count and type(trigger.count) == "string" and trigger.count ~= "" then
counter = Private.CreateTriggerCounter(trigger.count)
counter = Private.ExecEnv.CreateTriggerCounter(trigger.count)
else
counter = Private.CreateTriggerCounter()
counter = Private.ExecEnv.CreateTriggerCounter()
end
end
@@ -3051,7 +3053,7 @@ do
bar.icon = icon
bar.timerType = timerType
bar.spellId = tostring(spellId)
bar.count = msg:match("(%d+)") or "0"
bar.count = msg:match("%((%d+)%)") or "0"
bar.dbmType = dbmType
local barOptions = DBM.ReleaseRevision >= 20220412000000 and DBT.Options or DBM.Bars.options
@@ -3116,7 +3118,7 @@ do
end
end
function Private.ExecEnv.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count)
function Private.ExecEnv.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, counter)
if not bars[timerId] then
return false
end
@@ -3143,8 +3145,11 @@ do
end
end
end
if count and count ~= "" and count ~= v.count then
return false
if counter then
counter:SetCount(tonumber(v.count) or 0)
if not counter:Match() then
return false
end
end
if dbmType and dbmType ~= v.dbmType then
return false
@@ -3278,7 +3283,7 @@ do
bar.bwBackgroundColor = BWColorModule:GetColorTable("barBackground", addon, spellId)
local BWEmphasizedModule = BigWigs:GetPlugin("Super Emphasize")
bar.emphasized = BWEmphasizedModule:IsSuperEmphasized(addon, spellId) and true or false
bar.count = text:match("(%d+)") or "0"
bar.count = text:match("%((%d+)%)") or "0"
bar.cast = not(text:match("^[^<]") and true)
WeakAuras.ScanEvents("BigWigs_StartBar", text)
@@ -3355,7 +3360,7 @@ do
state.isCooldown = bar.isCooldown
end
function Private.ExecEnv.BigWigsTimerMatches(id, message, operator, spellId, emphasized, count, cast, cooldown)
function Private.ExecEnv.BigWigsTimerMatches(id, message, operator, spellId, emphasized, counter, cast, cooldown)
if not bars[id] then
return false
end
@@ -3383,8 +3388,11 @@ do
if emphasized ~= nil and v.emphasized ~= emphasized then
return false
end
if count and count ~= "" and count ~= v.count then
return false
if counter then
counter:SetCount(tonumber(v.count) or 0)
if not counter:Match() then
return false
end
end
if cast ~= nil and v.cast ~= cast then
return false
@@ -3403,10 +3411,10 @@ do
return bars[id]
end
function WeakAuras.GetBigWigsTimer(text, operator, spellId, extendTimer, emphasized, count, cast)
function WeakAuras.GetBigWigsTimer(text, operator, spellId, extendTimer, emphasized, counter, cast)
local bestMatch
for id, bar in pairs(bars) do
if Private.ExecEnv.BigWigsTimerMatches(id, text, operator, spellId, emphasized, count, cast)
if Private.ExecEnv.BigWigsTimerMatches(id, text, operator, spellId, emphasized, counter, cast)
and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime)
and bar.expirationTime + extendTimer > GetTime()
then