diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index ed6eb66..cc49cc5 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -412,7 +412,7 @@ local function FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit) end end end - return bestMatch, matchCount, nextCheck + return bestMatch, matchCount, stackCount, nextCheck end local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, unaffected) @@ -1074,8 +1074,8 @@ local function UpdateTriggerState(time, id, triggernum) for unit, unitData in pairs(matchDataByTrigger[id][triggernum]) do local bestMatch, countPerUnit, stacks, nextCheckForMatch = FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit) matchCount = matchCount + countPerUnit + totalStacks = totalStacks + (stacks or 0) if bestMatch then - totalStacks = totalStacks + (bestMatch.stacks or 0) unitCount = unitCount + 1 matchedUnits[unit] = true end diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 6004e1e..9f37e69 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -138,9 +138,11 @@ function TestForLongString(trigger, arg) local name = arg.name; local test; if(trigger[name.."_operator"] == "==") then - test = "("..name.."==\""..trigger[name].."\")"; - else - test = "("..name.." and "..name..":"..trigger[name.."_operator"]:format(trigger[name])..")"; + test = ("(%s == %q)"):format(name, trigger[name]) + elseif(trigger[name.."_operator"] == "find('%s')") then + test = "(" .. name .. " and " .. name .. string.format(":find(%q)", trigger[name]) .. ")" + elseif(trigger[name.."_operator"] == "match('%s')") then + test = "(" .. name .. " and " .. name .. string.format(":match(%q)", trigger[name]) .. ")" end return test; end diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index 8c5511a..4f026eb 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -8,7 +8,7 @@ WeakAuras.halfWidth = WeakAuras.normalWidth / 2 WeakAuras.doubleWidth = WeakAuras.normalWidth * 2 local versionStringFromToc = GetAddOnMetadata("WeakAuras", "Version") -local versionString = "3.1.5" +local versionString = "3.1.8" local buildTime = "20201210233053" WeakAuras.versionString = versionStringFromToc diff --git a/WeakAuras/RegionTypes/Texture.lua b/WeakAuras/RegionTypes/Texture.lua index 47aae0a..ac2f834 100644 --- a/WeakAuras/RegionTypes/Texture.lua +++ b/WeakAuras/RegionTypes/Texture.lua @@ -11,7 +11,7 @@ local default = { desaturate = false, width = 200, height = 200, - color = {1, 1, 1, 0.75}, + color = {1, 1, 1, 1}, blendMode = "BLEND", rotation = 0, discrete_rotation = 0, diff --git a/WeakAuras/WeakAuras.toc b/WeakAuras/WeakAuras.toc index c34a541..59106aa 100644 --- a/WeakAuras/WeakAuras.toc +++ b/WeakAuras/WeakAuras.toc @@ -1,7 +1,7 @@ ## Interface: 30300 ## Title: WeakAuras ## Author: The WeakAuras Team -## Version: 3.1.5 +## Version: 3.1.8 ## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers. ## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores. ## Notes-deDE: Ein leistungsfähiges, umfassendes Addon zur grafischen Darstellung von Informationen von Auren, Cooldowns, Timern und vielem mehr. diff --git a/WeakAurasOptions/TriggerOptions.lua b/WeakAurasOptions/TriggerOptions.lua index 1140008..194ee3e 100644 --- a/WeakAurasOptions/TriggerOptions.lua +++ b/WeakAurasOptions/TriggerOptions.lua @@ -261,6 +261,8 @@ function OptionsPrivate.ClearTriggerExpandState() maxTriggerNumForExpand = 0 end +local triggerDeleteDialogOpen = false + function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) options.__title = L["Trigger %s"]:format(triggernum) options.__order = triggernum * 10 @@ -311,28 +313,48 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) disabled = function() return #data.triggers == 1 end, - func = function() - if #data.triggers > 1 then + func = function(...) + if triggerDeleteDialogOpen then + -- This function is called multiple times if multiple auras are selected + return + end + + local canDelete = false + -- Since we want to handle all selected auras in one dialog, we have to iterate over GetPickedDisplay + local picked = OptionsPrivate.GetPickedDisplay() + OptionsPrivate.Private.ApplyToDataOrChildData(picked, function(childData) + if #childData.triggers > 1 and #childData.triggers >= triggernum then + canDelete = true + end + end) + + if canDelete then StaticPopupDialogs["WEAKAURAS_CONFIRM_TRIGGER_DELETE"] = { text = L["You are about to delete a trigger. |cFFFF0000This cannot be undone!|r Would you like to continue?"], button1 = L["Delete"], button2 = L["Cancel"], OnAccept = function() - tremove(data.triggers, triggernum) - DeleteConditionsForTrigger(data, triggernum) - WeakAuras.Add(data) - OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", {triggernum}) - WeakAuras.ClearAndUpdateOptions(data.id) + OptionsPrivate.Private.ApplyToDataOrChildData(picked, function(childData) + if #childData.triggers > 1 and #childData.triggers >= triggernum then + tremove(childData.triggers, triggernum) + DeleteConditionsForTrigger(childData, triggernum) + WeakAuras.Add(childData) + OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", {triggernum}) + WeakAuras.ClearAndUpdateOptions(childData.id) + end + end) WeakAuras.FillOptions() + triggerDeleteDialogOpen = false end, OnCancel = function() - -- no-op + triggerDeleteDialogOpen = false end, showAlert = 1, whileDead = 1, timeout = 0, preferredindex = STATICPOPUP_NUMDIALOGS, } + triggerDeleteDialogOpen = true StaticPopup_Show("WEAKAURAS_CONFIRM_TRIGGER_DELETE") end end diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index 2455789..56850ff 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -1,7 +1,7 @@ ## Interface: 30300 ## Title: WeakAuras Options ## Author: The WeakAuras Team -## Version: 3.1.5 +## Version: 3.1.8 ## Notes: Options for WeakAuras ## Notes-esES: Opciones para WeakAuras ## Notes-deDE: Optionen für WeakAuras