diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index 116a6a1..350fb53 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -742,20 +742,20 @@ local function runDynamicConditionFunctions(funcs) end end -local function handleDynamicConditions(self, event) +local function handleDynamicConditions(self, event, onlyUpdateState) Private.StartProfileSystem("dynamic conditions") if (globalDynamicConditionFuncs[event]) then for i, func in ipairs(globalDynamicConditionFuncs[event]) do func(globalConditionState); end end - if (dynamicConditions[event]) then + if (dynamicConditions[event] and not onlyUpdateState) then runDynamicConditionFunctions(dynamicConditions[event]); end Private.StopProfileSystem("dynamic conditions") end -local function handleDynamicConditionsPerUnit(self, event, unit) +local function handleDynamicConditionsPerUnit(self, event, unit, onlyUpdateState) Private.StartProfileSystem("dynamic conditions") if unit and unit == self.unit then local unitEvent = event..":"..unit @@ -764,7 +764,7 @@ local function handleDynamicConditionsPerUnit(self, event, unit) func(globalConditionState); end end - if (dynamicConditions[unitEvent]) then + if (dynamicConditions[unitEvent] and not onlyUpdateState) then runDynamicConditionFunctions(dynamicConditions[unitEvent]); end end @@ -853,7 +853,6 @@ function Private.RegisterForGlobalConditions(uid) if (not dynamicConditionsFrame.onUpdate) then dynamicConditionsFrame:SetScript("OnUpdate", handleDynamicConditionsOnUpdate); dynamicConditionsFrame.onUpdate = true; - handleDynamicConditionsOnUpdate(dynamicConditionsFrame, event) end else local unitEvent, unit = event:match("([^:]+):([^:]+)") @@ -865,10 +864,10 @@ function Private.RegisterForGlobalConditions(uid) end dynamicConditionsFrame.units[unit].unit = unit; pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame.units[unit], unitEvent); - handleDynamicConditionsPerUnit(dynamicConditionsFrame, event, unit) + handleDynamicConditionsPerUnit(dynamicConditionsFrame, event, unit, true) else pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event); - handleDynamicConditions(dynamicConditionsFrame, event) + handleDynamicConditions(dynamicConditionsFrame, event, true) end end end diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 1b104da..08a295a 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -445,7 +445,7 @@ function ConstructFunction(prototype, trigger) return table.concat(ret); end -function Private.EndEvent(id, triggernum, force, state) +function Private.EndEvent(state) if state then if (state.show ~= false and state.show ~= nil) then state.show = false; @@ -796,7 +796,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 elseif (ok and returnValue) or optionsEvent then for id, state in pairs(allStates) do if (state.changed) then - if (Private.EndEvent(id, triggernum, nil, state)) then + if (Private.EndEvent(state)) then updateTriggerState = true; end end @@ -808,11 +808,11 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 if arg1 then local state = allStates[cloneIdForUnitTrigger] if state then - local ok, returnValue = pcall(data.untriggerFunc, state, event, unitForUnitTrigger, arg2, ...); + local ok, returnValue = pcall(data.untriggerFunc, state, event, unitForUnitTrigger, arg1, arg2, ...); if not ok then errorHandler(returnValue) elseif ok and returnValue then - if (Private.EndEvent(id, triggernum, nil, state)) then + if (Private.EndEvent(state)) then updateTriggerState = true; end end @@ -832,7 +832,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 if not ok then errorHandler(returnValue) elseif (ok and returnValue) then - if (Private.EndEvent(id, triggernum, nil, state)) then + if (Private.EndEvent(state)) then updateTriggerState = true; end end @@ -845,7 +845,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 elseif (ok and returnValue) then allStates[""] = allStates[""] or {}; local state = allStates[""]; - if(Private.EndEvent(id, triggernum, nil, state)) then + if (Private.EndEvent(state)) then updateTriggerState = true; end end @@ -1790,8 +1790,7 @@ function GenericTrigger.Add(data, region) if warnAboutCLEUEvents then Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning", "warning", - L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"], - true) + L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"]) else Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning") end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 284e1bc..243a131 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -4713,7 +4713,7 @@ Private.event_prototypes = { tier = %s column = %s local name, icon, _, _, rank = GetTalentInfo(tier, column) - if rank > 0 then + if rank and rank > 0 then active = true; activeName = name; activeIcon = icon; @@ -5406,6 +5406,67 @@ Private.event_prototypes = { delayEvents = true, timedrequired = true }, + -- fixing later + --[[["Spell Cast Succeeded"] = { + type = "event", + events = function(trigger) + local result = {} + local unit = trigger.unit + AddUnitEventForEvents(result, unit, "UNIT_SPELLCAST_SUCCEEDED") + return result + end, + name = L["Spell Cast Succeeded"], + statesParameter = "unit", + args = { + {}, + { + name = "unit", + init = "arg", + display = L["Caster Unit"], + type = "unit", + test = "true", + values = "actual_unit_types_cast", + store = true, + conditionType = "select", + conditionTest = function(state, needle, op) + return state and state.show and (UnitIsUnit(needle, state.unit or '') == (op == "==")) + end + }, + { + name = "spellName", + type = "string", + init = "arg", + test = "true", + store = true, + hidden = true + }, + { + name = "rank", + type = "string", + init = "arg", + test = "true", + store = true, + hidden = true + }, + { + name = "spellId", + display = L["Spell Id"], + type = "string", + store = true, + conditionType = "number" + }, + { + name = "icon", + hidden = true, + init = "select(3, GetSpellInfo(spellId))", + store = true, + test = "true" + }, + }, + countEvents = true, + delayEvents = true, + timedrequired = true + },]] ["Ready Check"] = { type = "event", events = { diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index af109c5..7d1b923 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -338,9 +338,15 @@ local function SetAnimAlpha(self, alpha) end self.animAlpha = alpha; if (WeakAuras.IsOptionsOpen()) then - self:SetAlpha(max(self.animAlpha or self.alpha or 1, 0.5)); + local ok = pcall(self.SetAlpha, self, max(self.animAlpha or self.alpha or 1, 0.5)) + if not ok then + Private.GetErrorHandlerId(self.id, L["Custom Fade Animation"]) + end else - self:SetAlpha(self.animAlpha or self.alpha or 1); + local ok = pcall(self.SetAlpha, self, self.animAlpha or self.alpha or 1) + if not ok then + Private.GetErrorHandlerId(self.id, L["Custom Fade Animation"]) + end end self.subRegionEvents:Notify("AlphaChanged") end