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