From 4c6277c66710b218987c582800d8b827efac54cb Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Thu, 13 Feb 2025 18:18:03 +0100 Subject: [PATCH] from retail diffchecked --- WeakAuras/WeakAuras.lua | 5 +- WeakAurasOptions/AnimationOptions.lua | 91 +++++++++++++------------ WeakAurasOptions/AuthorOptions.lua | 5 +- WeakAurasOptions/BuffTrigger2.lua | 25 ++++--- WeakAurasOptions/CommonOptions.lua | 23 +++++-- WeakAurasOptions/ConditionOptions.lua | 33 ++++----- WeakAurasOptions/GenericTrigger.lua | 28 +++++--- WeakAurasOptions/InformationOptions.lua | 5 ++ WeakAurasOptions/LoadOptions.lua | 7 +- WeakAurasOptions/WeakAurasOptions.lua | 48 +++++++------ 10 files changed, 157 insertions(+), 113 deletions(-) diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 042048b..17a8ce5 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -2018,8 +2018,9 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_REPAIR"] = { Private.Login() end end, - whileDead = true, - showAlert = true, + + whileDead = 1, + showAlert = 1, timeout = 0, preferredindex = STATICPOPUP_NUMDIALOGS } diff --git a/WeakAurasOptions/AnimationOptions.lua b/WeakAurasOptions/AnimationOptions.lua index 20c7b2c..457941c 100644 --- a/WeakAurasOptions/AnimationOptions.lua +++ b/WeakAurasOptions/AnimationOptions.lua @@ -17,8 +17,8 @@ local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll) local function filterAnimPresetTypes(intable, id) local ret = {}; OptionsPrivate.Private.EnsureRegion(id) - local region = OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].region; - local regionType = OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].regionType; + local region = OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].region + local regionType = OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].regionType local data = WeakAuras.GetData(id); if data.controlledChildren then @@ -84,7 +84,8 @@ function OptionsPrivate.GetAnimationOptions(data) OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true); if(OptionsPrivate.Private.clones[id]) then for cloneId, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, + cloneRegion, false, nil, true, cloneId); end end end @@ -350,8 +351,8 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Color"], order = 48.2, hidden = function() - return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) - end + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, start_colorType = { type = "select", @@ -903,11 +904,11 @@ function OptionsPrivate.GetAnimationOptions(data) local function extraSetFunction() OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, - OptionsPrivate.Private.EnsureRegion(id), false, nil, true) + OptionsPrivate.Private.EnsureRegion(id), false, nil, true) if(OptionsPrivate.Private.clones[id]) then for cloneId, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, - cloneRegion, false, nil, true, cloneId) + cloneRegion, false, nil, true, cloneId) end end end @@ -915,8 +916,8 @@ function OptionsPrivate.GetAnimationOptions(data) -- Text Editors for "start" local function hideStartAlphaFunc() return data.animation.start.type ~= "custom" - or data.animation.start.alphaType ~= "custom" - or not data.animation.start.use_alpha + or data.animation.start.alphaType ~= "custom" + or not data.animation.start.use_alpha end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", @@ -924,20 +925,20 @@ function OptionsPrivate.GetAnimationOptions(data) local function hideStartTranslate() return data.animation.start.type ~= "custom" - or data.animation.start.translateType ~= "custom" - or not data.animation.start.use_translate + or data.animation.start.translateType ~= "custom" + or not data.animation.start.use_translate end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", 39.3, hideStartTranslate, {"animation", "start", "translateFunc"}, false); local function hideStartScale() return data.animation.start.type ~= "custom" - or data.animation.start.scaleType ~= "custom" - or not (data.animation.start.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) + or data.animation.start.scaleType ~= "custom" + or not (data.animation.start.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", 43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false); local function hideStartRotateFunc() @@ -946,45 +947,45 @@ function OptionsPrivate.GetAnimationOptions(data) or not (data.animation.start.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", 47.3, hideStartRotateFunc, {"animation", "start", "rotateFunc"}, false); local function hideStartColorFunc() return data.animation.start.type ~= "custom" - or data.animation.start.colorType ~= "custom" - or not (data.animation.start.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) + or data.animation.start.colorType ~= "custom" + or not (data.animation.start.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", 48.7, hideStartColorFunc, {"animation", "start", "colorFunc"}, false); -- Text Editors for "main" local function hideMainAlphaFunc() return data.animation.main.type ~= "custom" - or data.animation.main.alphaType ~= "custom" - or not data.animation.main.use_alpha + or data.animation.main.alphaType ~= "custom" + or not data.animation.main.use_alpha end local mainCodeOptions = { extraSetFunction = extraSetFunction } OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", 55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, mainCodeOptions); local function hideMainTranslate() return data.animation.main.type ~= "custom" - or data.animation.main.translateType ~= "custom" - or not data.animation.main.use_translate + or data.animation.main.translateType ~= "custom" + or not data.animation.main.use_translate end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", 59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, mainCodeOptions); local function hideMainScale() return data.animation.main.type ~= "custom" - or data.animation.main.scaleType ~= "custom" - or not (data.animation.main.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) + or data.animation.main.scaleType ~= "custom" + or not (data.animation.main.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", 63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, mainCodeOptions); local function hideMainRotateFunc() @@ -993,44 +994,44 @@ function OptionsPrivate.GetAnimationOptions(data) or not (data.animation.main.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", 67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, mainCodeOptions); local function hideMainColorFunc() return data.animation.main.type ~= "custom" - or data.animation.main.colorType ~= "custom" - or not (data.animation.main.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) + or data.animation.main.colorType ~= "custom" + or not (data.animation.main.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", 68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, mainCodeOptions); -- Text Editors for "finish" local function hideFinishAlphaFunc() return data.animation.finish.type ~= "custom" - or data.animation.finish.alphaType ~= "custom" - or not data.animation.finish.use_alpha + or data.animation.finish.alphaType ~= "custom" + or not data.animation.finish.use_alpha end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", 75.3, hideFinishAlphaFunc, {"animation", "finish", "alphaFunc"}, false); local function hideFinishTranslate() return data.animation.finish.type ~= "custom" - or data.animation.finish.translateType ~= "custom" - or not data.animation.finish.use_translate + or data.animation.finish.translateType ~= "custom" + or not data.animation.finish.use_translate end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", 79.3, hideFinishTranslate, {"animation", "finish", "translateFunc"}, false); local function hideFinishScale() return data.animation.finish.type ~= "custom" - or data.animation.finish.scaleType ~= "custom" - or not (data.animation.finish.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) + or data.animation.finish.scaleType ~= "custom" + or not (data.animation.finish.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", 83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false); local function hideFinishRotateFunc() @@ -1039,16 +1040,16 @@ function OptionsPrivate.GetAnimationOptions(data) or not (data.animation.finish.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", 87.3, hideFinishRotateFunc, {"animation", "finish", "rotateFunc"}, false); local function hideFinishColorFunc() return data.animation.finish.type ~= "custom" - or data.animation.finish.colorType ~= "custom" - or not (data.animation.finish.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) + or data.animation.finish.colorType ~= "custom" + or not (data.animation.finish.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) end OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", - "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", 88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false); if(data.controlledChildren) then diff --git a/WeakAurasOptions/AuthorOptions.lua b/WeakAurasOptions/AuthorOptions.lua index 0c512a3..59a3622 100644 --- a/WeakAurasOptions/AuthorOptions.lua +++ b/WeakAurasOptions/AuthorOptions.lua @@ -138,7 +138,7 @@ local function nameUserDesc(option) return option.text else local text = {} - for _, optionData in pairs(option.references) do + for id, optionData in pairs(option.references) do local childOption = optionData.options[optionData.index] if childOption.text and childOption.text ~= nil then tinsert(text, childOption.text) @@ -1244,7 +1244,7 @@ typeControlAdders = { name = WeakAuras.newFeatureString .. name(option, "noMerge", L["Prevent Merging"]), desc = desc(option, "noMerge", L["If checked, then this group will not merge with other group when selecting multiple auras."]), order = order(), - width = option.groupType == "simple" and WeakAuras.doubleWidth or WeakAuras.normalWidth, + width = option.groupType =="simple" and WeakAuras.doubleWidth or WeakAuras.normalWidth, get = get(option, "noMerge"), set = set(data, option, "noMerge"), } @@ -2587,6 +2587,7 @@ local function valuesAreEqual(t1, t2) return false end end + for k2, v2 in pairs(t2) do local v1 = t1[k2] if v1 == nil or not valuesAreEqual(v1, v2) then diff --git a/WeakAurasOptions/BuffTrigger2.lua b/WeakAurasOptions/BuffTrigger2.lua index 000fd06..744cfa5 100644 --- a/WeakAurasOptions/BuffTrigger2.lua +++ b/WeakAurasOptions/BuffTrigger2.lua @@ -55,7 +55,7 @@ end local function IsGroupTrigger(trigger) return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - or trigger.unit == "boss" or trigger.unit == "nameplate" or trigger.unit == "arena" or trigger.unit == "multi" + or trigger.unit == "boss" or trigger.unit == "nameplate" or trigger.unit == "arena" or trigger.unit == "multi" end local function IsSingleMissing(trigger) @@ -237,7 +237,6 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Unit"], order = 10, disabled = true, - hidden = function() return not trigger.type == "aura2" end, get = function() return true end }, unit = { @@ -248,8 +247,7 @@ local function GetBuffTriggerOptions(data, triggernum) values = function() return OptionsPrivate.Private.unit_types_bufftrigger_2 end, - hidden = function() return not trigger.type == "aura2" end, - desc = L["� |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.\n� |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.\n|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.\n� |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.\n� |cffffff00Smart Group|r adjusts to your current group type, matching just the \"player\" when solo, \"party\" units (including \"player\") in a party or \"raid\" units in a raid.\n� |cffffff00Multi-target|r attempts to use the Combat Log events, rather than unitID, to track affected units.\n|cffff0000Note|r: Without a direct relationship to actual unitIDs, results may vary.\n\n|cffffff00*|r Yellow Unit settings can match multiple units and will default to being active even while no affected units are found without a Unit Count or Match Count setting."], + desc = L["• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.\n• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.\n|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.\n• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.\n• |cffffff00Smart Group|r adjusts to your current group type, matching just the \"player\" when solo, \"party\" units (including \"player\") in a party or \"raid\" units in a raid.\n• |cffffff00Multi-target|r attempts to use the Combat Log events, rather than unitID, to track affected units.\n|cffff0000Note|r: Without a direct relationship to actual unitIDs, results may vary.\n\n|cffffff00*|r Yellow Unit settings can match multiple units and will default to being active even while no affected units are found without a Unit Count or Match Count setting."], }, useSpecificUnit = { type = "toggle", @@ -283,7 +281,6 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Type"], order = 11, disabled = true, - hidden = function() return not trigger.type == "aura2" end, get = function() return true end }, debuffType = { @@ -292,7 +289,6 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Aura Type"], order = 11.1, values = OptionsPrivate.Private.debuff_types, - hidden = function() return not trigger.type == "aura2" end }, spell_filters_header = { type = "header", @@ -304,7 +300,7 @@ local function GetBuffTriggerOptions(data, triggernum) width = WeakAuras.normalWidth, name = L["Debuff Type"], order = 11.2, - desc = L["Filter to only dispellable de/buffs of the given type(s)"], + desc = L["Filter to only dispellable de/buffs of the given type(s)\nBleed classification via LibDispel"], hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end }, debuffClass = { @@ -335,7 +331,6 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Name(s)"], order = 12, width = WeakAuras.normalWidth - 0.2, - hidden = function() return not trigger.type == "aura2" end }, useNameSpace = { type = "description", @@ -349,7 +344,6 @@ local function GetBuffTriggerOptions(data, triggernum) name = L["Exact Spell ID(s)"], width = WeakAuras.normalWidth - 0.2, order = 22, - hidden = function() return not trigger.type == "aura2" end }, useExactSpellIdSpace = { type = "description", @@ -523,7 +517,7 @@ local function GetBuffTriggerOptions(data, triggernum) }, use_stealable = { type = "toggle", - name = function() + name = function(input) local value = trigger.use_stealable if value == nil then return L["Is Stealable"] elseif value == false then return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Is Stealable"] .. "|r" @@ -674,6 +668,16 @@ local function GetBuffTriggerOptions(data, triggernum) order = 65.1, hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end }, + fetchRole = { + type = "toggle", + name = L["Fetch Role Information"], + desc = L["This adds %role, %roleIcon as text replacements. Does nothing if the unit is not a group member."], + order = 65.2, + width = WeakAuras.doubleWidth, + hidden = function() + return not (trigger.type == "aura2" and trigger.unit ~= "multi") + end + }, fetchRaidMark = { type = "toggle", name = L["Fetch Raid Mark Information"], @@ -711,6 +715,7 @@ local function GetBuffTriggerOptions(data, triggernum) and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_includePets) end }, + useActualSpec = { type = "toggle", width = WeakAuras.normalWidth, diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index 9695981..eea8412 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -123,7 +123,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) end local titleWidth = WeakAuras.doubleWidth - (hasAdd and 0.15 or 0) - (hasDelete and 0.15 or 0) - (hasUp and 0.15 or 0) - - (hasDown and 0.15 or 0) - (hasDuplicate and 0.15 or 0) - (hasApplyTemplate and 0.15 or 0) - (hasDynamicTextCodes and 0.15 or 0) + - (hasDown and 0.15 or 0) - (hasDuplicate and 0.15 or 0) - (hasApplyTemplate and 0.15 or 0) - (hasDynamicTextCodes and 0.15 or 0) options[key .. "collapseSpacer"] = { type = marginTop and "header" or "description", @@ -759,7 +759,6 @@ local function replaceNameDescFuncs(intable, data, subOption) display = math.floor(display * 100) / 100; else local nullBytePos = display:find("\0", nil, true) - if nullBytePos then display = display:sub(1, nullBytePos - 1) end @@ -824,6 +823,13 @@ local function replaceImageFuncs(intable, data, subOption) recurse(intable); end +local concatenableTypes = { + string = true, + number = true +} +local function isConcatenableValue(value) + return value and concatenableTypes[type(value)] +end local function replaceValuesFuncs(intable, data, subOption) local function valuesAll(info) local combinedValues = {}; @@ -854,7 +860,9 @@ local function replaceValuesFuncs(intable, data, subOption) -- Already known key/value pair else if (combinedValues[k]) then - combinedValues[k] = combinedValues[k] .. "/" .. v; + if isConcatenableValue(k) and isConcatenableValue(v) then + combinedValues[k] = combinedValues[k] .. "/" .. v; + end else combinedValues[k] = v; end @@ -1390,6 +1398,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g }, anchorFramePoints = { type = "execute", + width = WeakAuras.normalWidth, name = "", order = 78, image = function() return "", 0, 0 end, @@ -1400,9 +1409,9 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g xOffset = { type = "range", control = "WeakAurasSpinBox", - width = WeakAuras.normalWidth, name = L["X Offset"], order = 79, + width = WeakAuras.normalWidth, softMin = (-1 * screenWidth), min = (-4 * screenWidth), softMax = screenWidth, @@ -1420,9 +1429,9 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g yOffset = { type = "range", control = "WeakAurasSpinBox", - width = WeakAuras.normalWidth, name = L["Y Offset"], order = 80, + width = WeakAuras.normalWidth, softMin = (-1 * screenHeight), min = (-4 * screenHeight), softMax = screenHeight, @@ -1911,7 +1920,7 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p OptionsPrivate.ClearOptions(data.id) end end, - get = function() + get = function(info) return GetCustomCode(data, path); end }; @@ -1995,7 +2004,7 @@ local function AddCommonTriggerOptions(options, data, triggernum, doubleWidth) order = 1.1, values = trigger_types, sorting = OptionsPrivate.Private.SortOrderForValues(trigger_types), - get = function(info) + get = function() return trigger.type end, set = function(info, v) diff --git a/WeakAurasOptions/ConditionOptions.lua b/WeakAurasOptions/ConditionOptions.lua index dab8a66..3acc9d0 100644 --- a/WeakAurasOptions/ConditionOptions.lua +++ b/WeakAurasOptions/ConditionOptions.lua @@ -73,17 +73,17 @@ local function compareValues(a, b, propertytype) and a[2] == b[2] and a[3] == b[3] and a[4] == b[4]; - elseif propertytype == "progressSource" then - if type(a) == "table" and type(b) == "table" then - local triggerA, propertyA, triggerB, propertyB = a[1], a[2], b[1], b[2] - if triggerA ~= triggerB or propertyA ~= propertyB then - return false - end - if triggerA == 0 then - return a[3] == b[3] and a[4] == b[4] - end - return true + elseif propertytype == "progressSource" then + if type(a) == "table" and type(b) == "table" then + local triggerA, propertyA, triggerB, propertyB = a[1], a[2], b[1], b[2] + if triggerA ~= triggerB or propertyA ~= propertyB then + return false end + if triggerA == 0 then + return a[3] == b[3] and a[4] == b[4] + end + return true + end end return a == b; end @@ -223,7 +223,6 @@ end --- a sound from each setter local lastPlayedSoundFromSet - local function wrapWithPlaySound(func, kit) return function(info, v) func(info, v); @@ -380,11 +379,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA conditions[i].changes[j].value[4] = a; WeakAuras.ClearAndUpdateOptions(data.id) end - setValueTable = function(info, v) - conditions[i].changes[j].value = CopyTable(v) - WeakAuras.Add(data) - WeakAuras.ClearAndUpdateOptions(data.id) - end + setValueComplex = function(property) return function(info, v) for id, reference in pairs(conditions[i].changes[j].references) do @@ -442,6 +437,11 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA WeakAuras.Add(data); WeakAuras.ClearAndUpdateOptions(data.id) end + setValueTable = function(info, v) + conditions[i].changes[j].value = CopyTable(v) + WeakAuras.Add(data) + WeakAuras.ClearAndUpdateOptions(data.id) + end setValueColor = function(info, r, g, b, a) conditions[i].changes[j].value = conditions[i].changes[j].value or {}; conditions[i].changes[j].value[1] = r; @@ -625,6 +625,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA WeakAuras.Mixin(statusbarList, SharedMedia:HashTable("statusbar")) values = statusbarList end + args["condition" .. i .. "value" .. j] = { type = "select", width = WeakAuras.normalWidth, diff --git a/WeakAurasOptions/GenericTrigger.lua b/WeakAurasOptions/GenericTrigger.lua index 64b9c72..97083aa 100644 --- a/WeakAurasOptions/GenericTrigger.lua +++ b/WeakAurasOptions/GenericTrigger.lua @@ -121,7 +121,7 @@ local function GetCustomTriggerOptions(data, triggernum) end elseif trueEvent:match("^UNIT_") then local unit = string.lower(i) - if not ((OptionsPrivate.Private.baseUnitId[unit] and OptionsPrivate.Private.multiUnitId[unit]) or unit ~= "nameplate") then + if not OptionsPrivate.Private.baseUnitId[unit] and not OptionsPrivate.Private.multiUnitId[unit] then return "|cFFFF0000"..L["Unit %s is not a valid unit for RegisterUnitEvent"]:format(unit) end elseif trueEvent == "TRIGGER" then @@ -169,7 +169,7 @@ local function GetCustomTriggerOptions(data, triggernum) end elseif trueEvent:match("^UNIT_") then local unit = string.lower(i) - if not (OptionsPrivate.Private.baseUnitId[unit] or unit ~= "nameplate") then + if not OptionsPrivate.Private.baseUnitId[unit] then return false end elseif trueEvent == "TRIGGER" then @@ -403,14 +403,22 @@ local function GetCustomTriggerOptions(data, triggernum) 17 + i / 10, hideOverlay, appendToTriggerPath("customOverlay" .. i), false, { multipath = false, extraSetFunction = extraSetFunctionReload, extraFunctions = extraFunctions}); end - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info", - 18, hideIfTriggerStateUpdate, appendToTriggerPath("customName"), false, { multipath = false, extraSetFunction = extraSetFunctionReload}); - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info", - 20, hideIfTriggerStateUpdate, appendToTriggerPath("customIcon"), false, { multipath = false, extraSetFunction = extraSetFunction}); - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info", - 22, hideIfTriggerStateUpdate, appendToTriggerPath("customTexture"), false, { multipath = false, extraSetFunction = extraSetFunction}); - OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info", - 23, hideIfTriggerStateUpdate, appendToTriggerPath("customStacks"), false, { multipath = false, extraSetFunction = extraSetFunctionReload}); + OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info", + 18, hideIfTriggerStateUpdate, appendToTriggerPath("customName"), false, + { multipath = false, extraSetFunction = extraSetFunctionReload}); + OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info", + 20, hideIfTriggerStateUpdate, appendToTriggerPath("customIcon"), false, + { multipath = false, extraSetFunction = extraSetFunction}); + OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info", + 22, hideIfTriggerStateUpdate, appendToTriggerPath("customTexture"), false, + { multipath = false, extraSetFunction = extraSetFunction}); + OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info", + 23, hideIfTriggerStateUpdate, appendToTriggerPath("customStacks"), false, + { multipath = false, extraSetFunction = extraSetFunctionReload}); return customOptions; end diff --git a/WeakAurasOptions/InformationOptions.lua b/WeakAurasOptions/InformationOptions.lua index f8a58f3..89d25b3 100644 --- a/WeakAurasOptions/InformationOptions.lua +++ b/WeakAurasOptions/InformationOptions.lua @@ -332,6 +332,7 @@ function OptionsPrivate.GetInformationOptions(data) order = order, } order = order + 1 + args.debugLogDesc = { type = "description", name = L["This enables the collection of debug logs. Custom code can add debug information to the log through the function DebugPrint."], @@ -358,6 +359,7 @@ function OptionsPrivate.GetInformationOptions(data) end end end + args.debugLogToggle = { type = "toggle", name = sameDebugLog and L["Enable Debug Logging"] or "|cFF4080FF" .. L["Enable Debug Logging"], @@ -378,10 +380,12 @@ function OptionsPrivate.GetInformationOptions(data) OptionsPrivate.ClearOptions(child.id) end end + WeakAuras.ClearAndUpdateOptions(data.id) end } order = order + 1 + if not sameDebugLog or commonDebugLog then args.debugLogShow = { type = "execute", @@ -425,6 +429,7 @@ function OptionsPrivate.GetInformationOptions(data) end } order = order + 1 + args.debugLogClear = { type = "execute", name = L["Clear Debug Logs"], diff --git a/WeakAurasOptions/LoadOptions.lua b/WeakAurasOptions/LoadOptions.lua index 973017a..08f4046 100644 --- a/WeakAurasOptions/LoadOptions.lua +++ b/WeakAurasOptions/LoadOptions.lua @@ -364,7 +364,11 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum options["use_"..name].desc = arg.desc; end if(arg.required) then - trigger["use_"..realname] = true; + if arg.type == "multiselect" and arg.multiNoSingle then + trigger["use_"..realname] = false + else + trigger["use_"..realname] = true + end if not(triggertype) then options["use_"..name].disabled = true; else @@ -438,6 +442,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum values = arg.operator_types == "without_equal" and OptionsPrivate.Private.operator_types_without_equal or arg.operator_types == "only_equal" and OptionsPrivate.Private.equality_operator_types or OptionsPrivate.Private.operator_types, + get = function() return getValue(trigger, "use_"..realname, realname.."_operator", multiEntry, entryNumber) end, diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index da49fd2..15ba14e 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -456,10 +456,22 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { } function OptionsPrivate.IsWagoUpdateIgnored(auraId) + local auraData = WeakAuras.GetData(auraId) + if auraData then + for child in OptionsPrivate.Private.TraverseAll(auraData) do + if child.ignoreWagoUpdate then + return true + end + end + end + return false +end + +function OptionsPrivate.HasWagoUrl(auraId) local auraData = WeakAuras.GetData(auraId) if auraData then for child in OptionsPrivate.Private.TraverseAll(auraData) do - if child.ignoreWagoUpdate then + if child.url and child.url ~= "" then return true end end @@ -467,18 +479,6 @@ function OptionsPrivate.IsWagoUpdateIgnored(auraId) return false end -function OptionsPrivate.HasWagoUrl(auraId) -local auraData = WeakAuras.GetData(auraId) - if auraData then - for child in OptionsPrivate.Private.TraverseAll(auraData) do - if child.url and child.url ~= "" then - return true - end - end - end -return false -end - function OptionsPrivate.ConfirmDelete(toDelete, parents) if toDelete then local warningForm = L["You are about to delete %d aura(s). |cFFFF0000This cannot be undone!|r Would you like to continue?"] @@ -801,6 +801,7 @@ function OptionsPrivate.DeleteAuras(auras, parents) parentButton:SetNormalTooltip() WeakAuras.Add(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) + parentButton:UpdateParentWarning() frame.loadProgress:SetText(L["Finishing..."]) coroutine.yield() end @@ -887,6 +888,7 @@ function WeakAuras.ShowOptions(msg) if firstLoad then frame:ShowTip() end + end function OptionsPrivate.UpdateOptions() @@ -1407,7 +1409,10 @@ function OptionsPrivate.StartGrouping(data) end for id, button in pairs(displayButtons) do - button:StartGrouping({data.id}, data.id == id, data.regionType == "dynamicgroup" or data.regionType == "group", children[id]); + button:StartGrouping({data.id}, + data.id == id, + data.regionType == "dynamicgroup" or data.regionType == "group", + children[id]); end end end @@ -1587,7 +1592,7 @@ function OptionsPrivate.StartDrag(mainAura) children[child.id] = true end -- set dragging for non selected buttons - for _, button in pairs(displayButtons) do + for id, button in pairs(displayButtons) do if not children[button.data.id] then button:DragStart("MULTI", false, mainAura); end @@ -1603,7 +1608,7 @@ function OptionsPrivate.StartDrag(mainAura) children[child.id] = true end -- set dragging for non selected buttons - for id, button in pairs(displayButtons) do + for _, button in pairs(displayButtons) do if not children[button.data.id] then button:DragStart(mode, false, mainAura); end @@ -1696,7 +1701,6 @@ function OptionsPrivate.OpenModelPicker(baseObject, path) WeakAuras.prettyPrint(string.format(L["ModelPaths could not be loaded, the addon is %s"], reason)); WeakAuras.ModelPaths = {}; end - OptionsPrivate.ModelPicker(frame).modelTree:SetTree(WeakAuras.ModelPaths) end OptionsPrivate.ModelPicker(frame):Open(baseObject, path); @@ -2044,7 +2048,8 @@ function OptionsPrivate.MoveCollapseDataUp(id, namespace, path) collapsedOptions[id] = collapsedOptions[id] or {} collapsedOptions[id][namespace] = collapsedOptions[id][namespace] or {} if type(path) ~= "table" then - collapsedOptions[id][namespace][path], collapsedOptions[id][namespace][path - 1] = collapsedOptions[id][namespace][path - 1], collapsedOptions[id][namespace][path] + collapsedOptions[id][namespace][path], collapsedOptions[id][namespace][path - 1] + = collapsedOptions[id][namespace][path - 1], collapsedOptions[id][namespace][path] else local tmp = collapsedOptions[id][namespace] local lastKey = tremove(path) @@ -2060,7 +2065,8 @@ function OptionsPrivate.MoveCollapseDataDown(id, namespace, path) collapsedOptions[id] = collapsedOptions[id] or {} collapsedOptions[id][namespace] = collapsedOptions[id][namespace] or {} if type(path) ~= "table" then - collapsedOptions[id][namespace][path], collapsedOptions[id][namespace][path + 1] = collapsedOptions[id][namespace][path + 1], collapsedOptions[id][namespace][path] + collapsedOptions[id][namespace][path], collapsedOptions[id][namespace][path + 1] + = collapsedOptions[id][namespace][path + 1], collapsedOptions[id][namespace][path] else local tmp = collapsedOptions[id][namespace] local lastKey = tremove(path) @@ -2155,7 +2161,8 @@ function OptionsPrivate.DuplicateCollapseData(id, namespace, path) end end -function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, hidden, setHidden, withoutColor, index, total) +function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, hidden, setHidden, + withoutColor, index, total) local headerOption if withHeader and (not index or index == 1) then headerOption = { @@ -2182,6 +2189,7 @@ function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, h local seenSymbols = {} + local parseFn = function(symbol) if not seenSymbols[symbol] then local _, sym = string.match(symbol, "(.+)%.(.+)")