diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 728d568..6daa6ba 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -2696,7 +2696,9 @@ function BuffTrigger.GetTriggerConditions(data, triggernum) } end - if not IsGroupTrigger(trigger) and trigger.matchesShowOn == "showAlways" then + if not IsGroupTrigger(trigger) and trigger.matchesShowOn == "showAlways" + or IsGroupTrigger(trigger) and trigger.showClones and trigger.unit ~= "multi" and trigger.combinePerUnit + then result["buffed"] = { display = L["Aura(s) Found"], type = "bool", diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index d1396dd..116a6a1 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -853,6 +853,7 @@ 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("([^:]+):([^:]+)") @@ -864,8 +865,10 @@ function Private.RegisterForGlobalConditions(uid) end dynamicConditionsFrame.units[unit].unit = unit; pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame.units[unit], unitEvent); + handleDynamicConditionsPerUnit(dynamicConditionsFrame, event, unit) else pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event); + handleDynamicConditions(dynamicConditionsFrame, event) end end end diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index c94d868..2813392 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -1410,14 +1410,19 @@ function GenericTrigger.Add(data, region) overlayFuncs = {}; local dest = 1; for i, v in ipairs(prototype.overlayFuncs) do - if (v.enable(trigger)) then + local enable = true + if type(v.enable) == "function" then + enable = v.enable(trigger) + elseif type(v.enable) == "boolean" then + enable = v.enable + end + if enable then overlayFuncs[dest] = v.func; dest = dest + 1; end end end - if (prototype.automaticrequired) then untriggerFunc = trueFunction elseif prototype.timedrequired then @@ -3789,7 +3794,13 @@ function GenericTrigger.GetOverlayInfo(data, triggernum) result = {}; local dest = 1; for i, v in ipairs(Private.event_prototypes[trigger.event].overlayFuncs) do - if (v.enable(trigger)) then + local enable = true + if type(v.enable) == "function" then + enable = v.enable(trigger) + elseif type(v.enable) == "boolean" then + enable = v.enable + end + if enable then result[dest] = v.name; dest = dest + 1; end @@ -4209,6 +4220,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state) state.expirationTime = math.huge; state.value = nil; state.total = nil; + Private.ActivateAuraEnvironment(nil) return; end arg1 = type(arg1) == "number" and arg1 or 0; diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index 565f6ab..e2bf10c 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -945,6 +945,7 @@ Private.inverse_point_types = { Private.anchor_frame_types = { SCREEN = L["Screen/Parent Group"], + UIPARENT = L["Screen"], MOUSE = L["Mouse Cursor"], SELECTFRAME = L["Select Frame"], UNITFRAME = L["Unit Frames"], @@ -956,6 +957,7 @@ end Private.anchor_frame_types_group = { SCREEN = L["Screen/Parent Group"], + UIPARENT = L["Screen"], MOUSE = L["Mouse Cursor"], SELECTFRAME = L["Select Frame"], CUSTOM = L["Custom"] diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 73f25ed..1fdc146 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -3977,7 +3977,6 @@ end local function evaluateTriggerStateTriggers(id) local result = false; - Private.ActivateAuraEnvironment(id); if WeakAuras.IsOptionsOpen() then -- While the options are open ignore the combination function @@ -3990,7 +3989,9 @@ local function evaluateTriggerStateTriggers(id) result = true; else if (triggerState[id].disjunctive == "custom" and triggerState[id].triggerLogicFunc) then + Private.ActivateAuraEnvironment(id) local ok, returnValue = pcall(triggerState[id].triggerLogicFunc, triggerState[id].triggers); + Private.ActivateAuraEnvironment() if not ok then Private.GetErrorHandlerId(id, L["Custom Trigger Combination"]) result = false @@ -4000,8 +4001,6 @@ local function evaluateTriggerStateTriggers(id) end end - Private.ActivateAuraEnvironment(); - return result; end @@ -4989,6 +4988,10 @@ local function GetAnchorFrame(data, region, parent) return parent; end + if (anchorFrameType == "UIPARENT") then + return UIParent; + end + if (anchorFrameType == "MOUSE") then ensureMouseFrame(); mouseFrame:anchorFrame(id, anchorFrameType); @@ -5080,7 +5083,7 @@ function Private.AnchorFrame(data, region, parent, force) local anchorParent = GetAnchorFrame(data, region, parent); if not anchorParent then return end if (data.anchorFrameParent or data.anchorFrameParent == nil - or data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE") then + or data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT" or data.anchorFrameType == "MOUSE") then local ok, ret = pcall(region.SetParent, region, anchorParent); if not ok then Private.GetErrorHandlerId(data.id, L["Anchoring"]) @@ -5091,7 +5094,7 @@ function Private.AnchorFrame(data, region, parent, force) local anchorPoint = data.anchorPoint if data.parent then - if data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" then + if data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT" or data.anchorFrameType == "MOUSE" then anchorPoint = "CENTER" end else diff --git a/WeakAurasOptions/BuffTrigger2.lua b/WeakAurasOptions/BuffTrigger2.lua index 4b130cb..f82efc4 100644 --- a/WeakAurasOptions/BuffTrigger2.lua +++ b/WeakAurasOptions/BuffTrigger2.lua @@ -560,9 +560,9 @@ local function GetBuffTriggerOptions(data, triggernum) end, desc = function() local value = trigger.ownOnly - if value == nil then return L["Only match auras cast by the player or his pet"] - elseif value == false then return L["Only match auras cast by people other than the player or his pet"] - else return L["Only match auras cast by the player or his pet"] end + if value == nil then return L["Only match auras cast by the player or their pet"] + elseif value == false then return L["Only match auras cast by people other than the player or their pet"] + else return L["Only match auras cast by the player or their pet"] end end, get = function() local value = trigger.ownOnly diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index ee48941..735b7b5 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -1079,7 +1079,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g return data.anchorFrameParent or data.anchorFrameParent == nil; end, hidden = function() - return not IsGroupByFrame() and (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" or IsParentDynamicGroup()); + return not IsGroupByFrame() and (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT" or data.anchorFrameType == "MOUSE" or IsParentDynamicGroup()); end, }, anchorFrameSpaceOne = { @@ -1089,7 +1089,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g order = 72, image = function() return "", 0, 0 end, hidden = function() - return IsParentDynamicGroup() or not (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE") + return IsParentDynamicGroup() or not (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT" or data.anchorFrameType == "MOUSE") end, }, -- Input field to select frame to anchor on @@ -1135,7 +1135,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g type = "select", width = WeakAuras.normalWidth, name = function() - if (data.anchorFrameType == "SCREEN") then + if (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT") then return L["To Screen's"] elseif (data.anchorFrameType == "PRD") then return L["To Personal Ressource Display's"]; @@ -1152,7 +1152,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g if IsParentDynamicGroup() then return true end - return data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE"; + return data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT" or data.anchorFrameType == "MOUSE"; else return data.anchorFrameType == "MOUSE"; end @@ -1169,7 +1169,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g if IsGroupByFrame() then return true end - if (data.anchorFrameType ~= "SCREEN") then + if (data.anchorFrameType ~= "SCREEN" and data.anchorFrameType ~= "UIPARENT") then return true; end if (data.parent) then @@ -1245,7 +1245,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g order = 82, image = function() return "", 0, 0 end, hidden = function() - return not (data.anchorFrameType ~= "SCREEN" or IsParentDynamicGroup()); + return not (data.anchorFrameType ~= "SCREEN" or data.anchorFrameType ~= "UIPARENT" or IsParentDynamicGroup()); end }, }; diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 26ac567..77dea31 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -185,7 +185,7 @@ end local function RecurseDiff(ours, theirs, ignoredForDiffChecking) local diff, seen, same = {}, {}, true for key, ourVal in pairs(ours) do - if type(ignoredForDiffChecking) ~= table or ignoredForDiffChecking[key] ~= true then + if not (type(ignoredForDiffChecking) == "table" and ignoredForDiffChecking[key] == true) then seen[key] = true local theirVal = theirs[key] if type(ourVal) == "table" and type(theirVal) == "table" then @@ -207,7 +207,7 @@ local function RecurseDiff(ours, theirs, ignoredForDiffChecking) end end for key, theirVal in pairs(theirs) do - if not seen[key] and (type(ignoredForDiffChecking) ~= table or ignoredForDiffChecking[key] ~= true) then + if not seen[key] and not (type(ignoredForDiffChecking) == "table" and ignoredForDiffChecking[key] == true) then diff[key] = theirVal same = false end @@ -230,10 +230,10 @@ local function RecurseSerial(lines, depth, chunk) end end -local function DebugPrintDiff(diff) +local function DebugPrintDiff(diff, id, uid) local lines = { "==========================", - "Diff detected: ", + string.format("Diff detected for %q (%s):", id, uid), "{", } RecurseSerial(lines, 1, diff) @@ -252,7 +252,7 @@ local function Diff(ours, theirs) local diff = RecurseDiff(ours, theirs, ignoredForDiffChecking) if diff then if debug then - DebugPrintDiff(diff, ours.id, theirs.id) + DebugPrintDiff(diff, theirs.id, theirs.uid) end return diff end @@ -516,7 +516,9 @@ local function BuildUidMap(data, children, type) end if self.map[uid].anchorFrameFrame then - local target = self:GetIdFor(self.map[uid].anchorFrameFrame) + data.anchorFrameFrame = nil + local anchorUid = self.map[uid].anchorFrameFrame + local target = self:Contains(anchorUid) and self:GetIdFor(anchorUid) if target then data.anchorFrameFrame = "WeakAuras:" .. target end @@ -1626,6 +1628,7 @@ local methods = { oldData.sortHybridTable = newData.sortHybridTable oldData.uid = uid oldData.id = matchInfo.newUidMap:GetIdFor(uid) + oldData.anchorFrameFrame = newData.anchorFrameFrame return oldData else return matchInfo.newUidMap:GetPhase2Data(uid) diff --git a/WeakAurasOptions/TriggerOptions.lua b/WeakAurasOptions/TriggerOptions.lua index 6236ba5..0f27297 100644 --- a/WeakAurasOptions/TriggerOptions.lua +++ b/WeakAurasOptions/TriggerOptions.lua @@ -199,8 +199,8 @@ local function DeleteConditionsForTriggerHandleSubChecks(checks, triggernum) check.trigger = check.trigger - 1; end - if (checks.checks) then - DeleteConditionsForTriggerHandleSubChecks(checks.checks, triggernum); + if (check.checks) then + DeleteConditionsForTriggerHandleSubChecks(check.checks, triggernum); end end end