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
+19 -8
View File
@@ -742,21 +742,24 @@ local function runDynamicConditionFunctions(funcs)
end
end
local function handleDynamicConditions(self, event, onlyUpdateState)
Private.StartProfileSystem("dynamic conditions")
local function UpdateDynamicConditonsStates(self, event)
if (globalDynamicConditionFuncs[event]) then
for i, func in ipairs(globalDynamicConditionFuncs[event]) do
func(globalConditionState);
end
end
if (dynamicConditions[event] and not onlyUpdateState) then
end
local function handleDynamicConditions(self, event)
Private.StartProfileSystem("dynamic conditions")
UpdateDynamicConditonsStates(self, event)
if (dynamicConditions[event]) then
runDynamicConditionFunctions(dynamicConditions[event]);
end
Private.StopProfileSystem("dynamic conditions")
end
local function handleDynamicConditionsPerUnit(self, event, unit, onlyUpdateState)
Private.StartProfileSystem("dynamic conditions")
local function UpdateDynamicConditionsPerUnitState(self, event, unit)
if unit and unit == self.unit then
local unitEvent = event..":"..unit
if globalDynamicConditionFuncs[unitEvent] then
@@ -764,7 +767,15 @@ local function handleDynamicConditionsPerUnit(self, event, unit, onlyUpdateState
func(globalConditionState);
end
end
if (dynamicConditions[unitEvent] and not onlyUpdateState) then
end
end
local function handleDynamicConditionsPerUnit(self, event, unit)
Private.StartProfileSystem("dynamic conditions")
if unit then
local unitEvent = event..":"..unit
UpdateDynamicConditionsPerUnitState(self, event, unit)
if (dynamicConditions[unitEvent]) then
runDynamicConditionFunctions(dynamicConditions[unitEvent]);
end
end
@@ -864,10 +875,10 @@ function Private.RegisterForGlobalConditions(uid)
end
dynamicConditionsFrame.units[unit].unit = unit;
pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame.units[unit], unitEvent);
handleDynamicConditionsPerUnit(dynamicConditionsFrame, event, unit, true)
UpdateDynamicConditionsPerUnitState(dynamicConditionsFrame, event, unit)
else
pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event);
handleDynamicConditions(dynamicConditionsFrame, event, true)
UpdateDynamicConditonsStates(dynamicConditionsFrame, event)
end
end
end
+20 -12
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,9 +3145,12 @@ do
end
end
end
if count and count ~= "" and count ~= v.count then
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
end
@@ -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,9 +3388,12 @@ do
if emphasized ~= nil and v.emphasized ~= emphasized then
return false
end
if count and count ~= "" and count ~= v.count then
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
end
@@ -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
+35 -14
View File
@@ -3949,6 +3949,13 @@ Private.event_prototypes = {
WeakAuras.RegisterDBMCallback("kill")
local ret = [=[
local triggerCounter = %q
local counter
if triggerCounter and triggerCounter ~= "" then
counter = Private.ExecEnv.CreateTriggerCounter(triggerCounter)
else
counter = Private.ExecEnv.CreateTriggerCounter()
end
return function (states, event, id)
local triggerId = %q
local triggerSpellId = %q
@@ -3958,10 +3965,10 @@ Private.event_prototypes = {
local extendTimer = %s
local triggerUseRemaining = %s
local triggerRemaining = %s
local triggerCount = %q
local triggerDbmType = %s
local cloneId = useClone and id or ""
local state = states[cloneId]
local counter = counter
function copyOrSchedule(bar, cloneId)
if triggerUseRemaining then
@@ -3985,7 +3992,7 @@ Private.event_prototypes = {
if useClone then
if event == "DBM_TimerStart" then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
local bar = WeakAuras.GetDBMTimerById(id)
if bar then
copyOrSchedule(bar, cloneId)
@@ -3999,7 +4006,7 @@ Private.event_prototypes = {
end
elseif event == "DBM_TimerUpdate" then
for id, bar in pairs(WeakAuras.GetAllDBMTimers()) do
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
copyOrSchedule(bar, id)
else
local state = states[id]
@@ -4015,7 +4022,7 @@ Private.event_prototypes = {
elseif event == "DBM_TimerForce" then
wipe(states)
for id, bar in pairs(WeakAuras.GetAllDBMTimers()) do
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
copyOrSchedule(bar, cloneId)
end
end
@@ -4023,13 +4030,13 @@ Private.event_prototypes = {
else
if event == "DBM_TimerStart" or event == "DBM_TimerUpdate" then
if extendTimer ~= 0 then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
local bar = WeakAuras.GetDBMTimerById(id)
Private.ExecEnv.ScheduleDbmCheck(bar.expirationTime + extendTimer)
end
end
end
local bar = WeakAuras.GetDBMTimer(triggerId, triggerText, triggerTextOperator, triggerSpellId, extendTimer, triggerDbmType, triggerCount)
local bar = WeakAuras.GetDBMTimer(triggerId, triggerText, triggerTextOperator, triggerSpellId, extendTimer, triggerDbmType, counter)
if bar then
if extendTimer == 0
or not (state and state.show)
@@ -4052,6 +4059,7 @@ Private.event_prototypes = {
]=]
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_id and trigger.id or "",
trigger.use_spellId and tostring(trigger.spellId) or "",
trigger.use_message and trigger.message or "",
@@ -4060,7 +4068,6 @@ Private.event_prototypes = {
trigger.use_extend and tonumber(trigger.extend or 0) or 0,
trigger.use_remaining and "true" or "false",
trigger.remaining or 0,
trigger.use_count and trigger.count or "",
trigger.use_dbmType and trigger.dbmType or "nil",
trigger.remaining_operator or "<"
)
@@ -4191,6 +4198,13 @@ Private.event_prototypes = {
triggerFunction = function(trigger)
WeakAuras.RegisterBigWigsTimer()
local ret = [=[
local triggerCounter = %q
local counter
if triggerCounter and triggerCounter ~= "" then
counter = Private.ExecEnv.CreateTriggerCounter(triggerCounter)
else
counter = Private.ExecEnv.CreateTriggerCounter()
end
return function(states, event, id)
local triggerSpellId = %q
local triggerText = %q
@@ -4200,11 +4214,11 @@ Private.event_prototypes = {
local triggerUseRemaining = %s
local triggerRemaining = %s
local triggerEmphasized = %s
local triggerCount = %q
local triggerCast = %s
local triggerIsCooldown = %s
local cloneId = useClone and id or ""
local state = states[cloneId]
local counter = counter
function copyOrSchedule(bar, cloneId)
if triggerUseRemaining then
@@ -4228,7 +4242,7 @@ Private.event_prototypes = {
if useClone then
if event == "BigWigs_StartBar" then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast, triggerIsCooldown) then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast, triggerIsCooldown) then
local bar = WeakAuras.GetBigWigsTimerById(id)
if bar then
copyOrSchedule(bar, cloneId)
@@ -4242,14 +4256,14 @@ Private.event_prototypes = {
end
elseif event == "BigWigs_Timer_Update" then
for id, bar in pairs(WeakAuras.GetAllBigWigsTimers()) do
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast) then
copyOrSchedule(bar, id)
end
end
elseif event == "BigWigs_Timer_Force" then
wipe(states)
for id, bar in pairs(WeakAuras.GetAllBigWigsTimers()) do
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast) then
copyOrSchedule(bar, id)
end
end
@@ -4257,13 +4271,13 @@ Private.event_prototypes = {
else
if event == "BigWigs_StartBar" then
if extendTimer ~= 0 then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast) then
local bar = WeakAuras.GetBigWigsTimerById(id)
Private.ExecEnv.ScheduleBigWigsCheck(bar.expirationTime + extendTimer)
end
end
end
local bar = WeakAuras.GetBigWigsTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, triggerEmphasized, triggerCount, triggerCast)
local bar = WeakAuras.GetBigWigsTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, triggerEmphasized, counter, triggerCast)
if bar then
if extendTimer == 0
or not (state and state.show)
@@ -4285,6 +4299,7 @@ Private.event_prototypes = {
end
]=]
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_spellId and tostring(trigger.spellId) or "",
trigger.use_text and trigger.text or "",
trigger.use_text and trigger.text_operator or "",
@@ -4293,7 +4308,6 @@ Private.event_prototypes = {
trigger.use_remaining and "true" or "false",
trigger.remaining or 0,
trigger.use_emphasized == nil and "nil" or trigger.use_emphasized and "true" or "false",
trigger.use_count and trigger.count or "",
trigger.use_cast == nil and "nil" or trigger.use_cast and "true" or "false",
trigger.use_isCooldown == nil and "nil" or trigger.use_isCooldown and "true" or "false",
trigger.remaining_operator or "<"
@@ -5462,6 +5476,13 @@ Private.event_prototypes = {
store = true,
test = "true"
},
{
name = "name",
hidden = true,
init = "GetSpellInfo(spellId)",
store = true,
test = "true"
},
},
countEvents = true,
delayEvents = true,
+2
View File
@@ -1789,6 +1789,8 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
local dereferencedParent = parent.references[id].options[parent.references[id].index]
if dereferencedParent.nameSource == optionData.index then
dereferencedParent.nameSource = 0
elseif dereferencedParent.nameSource > optionData.index then
dereferencedParent.nameSource = dereferencedParent.nameSource - 1
end
end
WeakAuras.Add(childData)