from retail
This commit is contained in:
@@ -108,18 +108,17 @@ local function valueToString(a, propertytype)
|
||||
return tostring(a);
|
||||
end
|
||||
|
||||
local function isSubset(data, reference)
|
||||
local function isSubset(data, reference, totalAuraCount)
|
||||
if (data.controlledChildren) then
|
||||
local auraCount = #data.controlledChildren;
|
||||
if (auraCount > reference.referenceCount) then
|
||||
if (totalAuraCount > reference.referenceCount) then
|
||||
return true;
|
||||
end
|
||||
end
|
||||
return false;
|
||||
end
|
||||
|
||||
local function blueIfSubset(data, reference)
|
||||
if (isSubset(data, reference)) then
|
||||
local function blueIfSubset(data, reference, totalAuraCount)
|
||||
if (isSubset(data, reference, totalAuraCount)) then
|
||||
return "|cFF4080FF";
|
||||
end
|
||||
return "";
|
||||
@@ -143,8 +142,8 @@ local function blueIfNoValue2(data, object, variable, subvariable, blueString, n
|
||||
return normalString or "";
|
||||
end
|
||||
|
||||
local function descIfSubset(data, reference)
|
||||
if (isSubset(data, reference)) then
|
||||
local function descIfSubset(data, reference, totalAuraCount)
|
||||
if (isSubset(data, reference, totalAuraCount)) then
|
||||
local desc = L["Used in auras:"];
|
||||
for id in pairs(reference.references) do
|
||||
desc = desc .. "\n" .. id;
|
||||
@@ -156,7 +155,6 @@ end
|
||||
|
||||
local function descIfNoValue(data, object, variable, type, values)
|
||||
if (data.controlledChildren) then
|
||||
local auraCount = #data.controlledChildren;
|
||||
if (object["same" .. variable] == false) then
|
||||
local desc = "";
|
||||
for id, reference in pairs(object.references) do
|
||||
@@ -174,7 +172,6 @@ end
|
||||
|
||||
local function descIfNoValue2(data, object, variable, subvariable, type, values)
|
||||
if (data.controlledChildren) then
|
||||
local auraCount = #data.controlledChildren;
|
||||
if (object["same" .. variable] and object["same" .. variable][subvariable] == false) then
|
||||
local desc = "";
|
||||
for id, reference in pairs(object.references) do
|
||||
@@ -215,15 +212,15 @@ local function wrapWithPlaySound(func, kit)
|
||||
end
|
||||
end
|
||||
|
||||
local function addControlsForChange(args, order, data, conditionVariable, conditions, i, j, allProperties, usedProperties)
|
||||
local function addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties)
|
||||
local thenText = (j == 1) and L["Then "] or L["And "];
|
||||
local display = isSubset(data, conditions[i].changes[j]) and allProperties.displayWithCopy or allProperties.display;
|
||||
local display = isSubset(data, conditions[i].changes[j], totalAuraCount) and allProperties.displayWithCopy or allProperties.display;
|
||||
local valuesForProperty = filterUsedProperties(allProperties.indexToProperty, display, usedProperties, conditions[i].changes[j].property);
|
||||
args["condition" .. i .. "property" .. j] = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = blueIfSubset(data, conditions[i].changes[j]) .. thenText,
|
||||
desc = descIfSubset(data, conditions[i].changes[j]),
|
||||
name = blueIfSubset(data, conditions[i].changes[j], totalAuraCount) .. thenText,
|
||||
desc = descIfSubset(data, conditions[i].changes[j], totalAuraCount),
|
||||
order = order,
|
||||
values = valuesForProperty,
|
||||
control = "WeakAurasTwoColumnDropdown",
|
||||
@@ -234,13 +231,13 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
set = function(info, index)
|
||||
local property = allProperties.indexToProperty[index];
|
||||
if (property == "COPY") then
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
if (conditions[i].changes[j].references[id]) then
|
||||
for child in OptionsPrivate.Private.TraverseLeafs(data) do
|
||||
if (conditions[i].changes[j].references[child.id]) then
|
||||
-- Already exist
|
||||
else
|
||||
local insertPoint = 1;
|
||||
for index = j, 1, -1 do
|
||||
if (conditions[i].changes[index].references[id]) then
|
||||
if (conditions[i].changes[index].references[child.id]) then
|
||||
insertPoint = index + 1;
|
||||
break;
|
||||
end
|
||||
@@ -254,13 +251,16 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
change.value = conditions[i].changes[j].value;
|
||||
end
|
||||
|
||||
local conditionIndex = conditions[i].check.references[id].conditionIndex;
|
||||
local auraData = WeakAuras.GetData(id);
|
||||
tinsert(auraData[conditionVariable][conditionIndex].changes, insertPoint, change);
|
||||
WeakAuras.Add(auraData);
|
||||
local reference = conditions[i].check.references[child.id]
|
||||
if reference then
|
||||
local conditionIndex = reference.conditionIndex;
|
||||
tinsert(child[conditionVariable][conditionIndex].changes, insertPoint, change);
|
||||
WeakAuras.Add(child);
|
||||
OptionsPrivate.ClearOptions(child.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
elseif (property == "DELETE") then
|
||||
if (data.controlledChildren) then
|
||||
@@ -269,12 +269,13 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
local conditionIndex = conditions[i].check.references[id].conditionIndex;
|
||||
tremove(auraData[conditionVariable][conditionIndex].changes, reference.changeIndex);
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
else
|
||||
tremove(conditions[i].changes, j);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
return;
|
||||
end
|
||||
@@ -287,14 +288,15 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].property = property;
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = default;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
conditions[i].changes[j].property = property;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
else
|
||||
conditions[i].changes[j].property = property;
|
||||
conditions[i].changes[j].value = default;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -311,9 +313,10 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
local conditionIndex = conditions[i].check.references[id].conditionIndex;
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = v;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
conditions[i].changes[j].value = v;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
setValueColor = function(info, r, g, b, a)
|
||||
for id, reference in pairs(conditions[i].changes[j].references) do
|
||||
@@ -325,16 +328,17 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[3] = b;
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[4] = a;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
conditions[i].changes[j].value = conditions[i].changes[j].value or {};
|
||||
conditions[i].changes[j].value[1] = r;
|
||||
conditions[i].changes[j].value[2] = g;
|
||||
conditions[i].changes[j].value[3] = b;
|
||||
conditions[i].changes[j].value[4] = a;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
|
||||
setValueComplex = function(property, reloadOptions)
|
||||
setValueComplex = function(property)
|
||||
return function(info, v)
|
||||
for id, reference in pairs(conditions[i].changes[j].references) do
|
||||
local auraData = WeakAuras.GetData(id);
|
||||
@@ -344,15 +348,15 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
end
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property] = v;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
if (type(conditions[i].changes[j].value) ~= "table") then
|
||||
conditions[i].changes[j].value = {};
|
||||
end
|
||||
conditions[i].changes[j].value[property] = v;
|
||||
|
||||
if reloadOptions then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -372,6 +376,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][3] = b;
|
||||
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][4] = a;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
if (type(conditions[i].changes[j].value) ~= "table") then
|
||||
conditions[i].changes[j].value = {};
|
||||
@@ -383,13 +388,14 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
conditions[i].changes[j].value[property][2] = g;
|
||||
conditions[i].changes[j].value[property][3] = b;
|
||||
conditions[i].changes[j].value[property][4] = a;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
else
|
||||
setValue = function(info, v)
|
||||
conditions[i].changes[j].value = 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 {};
|
||||
@@ -398,18 +404,17 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
conditions[i].changes[j].value[3] = b;
|
||||
conditions[i].changes[j].value[4] = a;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
|
||||
setValueComplex = function(property, reloadOptions)
|
||||
setValueComplex = function(property)
|
||||
return function(info, v)
|
||||
if (type (conditions[i].changes[j].value) ~= "table") then
|
||||
conditions[i].changes[j].value = {};
|
||||
end
|
||||
conditions[i].changes[j].value[property] = v;
|
||||
WeakAuras.Add(data);
|
||||
if reloadOptions then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -426,6 +431,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
conditions[i].changes[j].value[property][3] = b;
|
||||
conditions[i].changes[j].value[property][4] = a;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -694,11 +700,60 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
return false;
|
||||
end
|
||||
|
||||
if WeakAuras.IsRetail() then
|
||||
args["condition" .. i .. "value" .. j .. "message type warning"] = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."],
|
||||
order = order,
|
||||
hidden = function()
|
||||
return not (anyMessageType("SAY") or anyMessageType("YELL") or anyMessageType("SMARTRAID"));
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
end
|
||||
|
||||
args["condition" .. i .. "value" .. j .. "_indent"] = {
|
||||
type = "description",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = "",
|
||||
order = order,
|
||||
hidden = function()
|
||||
return anyMessageType("WHISPER");
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
args["condition" .. i .. "value" .. j .. "message color"] = {
|
||||
type = "color",
|
||||
width = WeakAuras.normalWidth,
|
||||
hasAlpha = false,
|
||||
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_color", L["Color"], L["Color"]),
|
||||
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_color", propertyType),
|
||||
order = order,
|
||||
get = function()
|
||||
if (conditions[i].changes[j].value and type(conditions[i].changes[j].value) == "table") and type(conditions[i].changes[j].value.message_color) == "table" then
|
||||
return conditions[i].changes[j].value.message_color[1], conditions[i].changes[j].value.message_color[2], conditions[i].changes[j].value.message_color[3];
|
||||
end
|
||||
return 1, 1, 1, 1;
|
||||
end,
|
||||
set = setValueColorComplex("message_color"),
|
||||
hidden = function()
|
||||
return not (anyMessageType("COMBAT") or anyMessageType("PRINT") or anyMessageType("ERROR"));
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType);
|
||||
if (not descMessage and data ~= OptionsPrivate.tempGroup) then
|
||||
descMessage = L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
|
||||
end
|
||||
|
||||
args["condition" .. i .. "value" .. j .. "message dest"] = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_dest", L["Send To"], L["Send To"]),
|
||||
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_dest", propertyType),
|
||||
desc = descMessage,
|
||||
order = order,
|
||||
get = function()
|
||||
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest;
|
||||
@@ -710,10 +765,21 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType);
|
||||
if (not descMessage and data ~= OptionsPrivate.tempGroup) then
|
||||
descMessage = L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
|
||||
end
|
||||
args["condition" .. i .. "value" .. j] = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = blueIfNoValue(data, conditions[i].changes[j], "value", "message_dest_isunit", L["Is Unit"], L["Is Unit"]),
|
||||
desc = descIfNoValue(data, conditions[i].changes[j], "value", "message_dest_isunit", propertyType),
|
||||
order = order,
|
||||
get = function()
|
||||
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest_isunit;
|
||||
end,
|
||||
set = setValueComplex("message_dest_isunit"),
|
||||
hidden = function()
|
||||
return not anyMessageType("WHISPER");
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
local message_getter = function()
|
||||
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
|
||||
@@ -753,8 +819,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
option.desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_format_" .. key, nil, option.values)
|
||||
end
|
||||
|
||||
option.set = setValueComplex("message_format_" .. key, option.reloadOptions)
|
||||
option.reloadOptions = nil
|
||||
option.set = setValueComplex("message_format_" .. key)
|
||||
|
||||
args[fullKey] = option
|
||||
end
|
||||
@@ -776,11 +841,11 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
end
|
||||
for index, reference in ipairs(ordered) do
|
||||
local input = reference.value and reference.value.message
|
||||
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden, index, #ordered)
|
||||
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden, true, index, #ordered)
|
||||
end
|
||||
else
|
||||
local input = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message"]
|
||||
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden)
|
||||
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden, true)
|
||||
end
|
||||
|
||||
if hasTextFormatOption then
|
||||
@@ -794,8 +859,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
|
||||
local function customHidden()
|
||||
local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
|
||||
if (not message) then return true; end
|
||||
return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message);
|
||||
local message_dest = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type == "WHISPER" and conditions[i].changes[j].value.message_dest
|
||||
if (not message and not message_dest) then return true; end
|
||||
return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message) and not OptionsPrivate.Private.ContainsCustomPlaceHolder(message_dest);
|
||||
end
|
||||
|
||||
args["condition" .. i .. "value" .. j .. "custom"] = {
|
||||
@@ -824,9 +890,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
local changeIndex = reference.changeIndex;
|
||||
multipath[id] = {"conditions", conditionIndex, "changes", changeIndex, "value", "custom"};
|
||||
end
|
||||
OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
|
||||
OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1");
|
||||
else
|
||||
OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
|
||||
OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1");
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -993,6 +1059,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", L["Glow Frame Type"], L["Glow Frame Type"]),
|
||||
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", propertyType, {
|
||||
UNITFRAME = L["Unit Frame"],
|
||||
NAMEPLATE = L["Nameplate"],
|
||||
FRAMESELECTOR = L["Frame Selector"]
|
||||
}),
|
||||
order = order,
|
||||
@@ -1065,6 +1132,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
order = order + 1
|
||||
args["condition" .. i .. "value" .. j .. "glow_color"] = {
|
||||
type = "color",
|
||||
hasAlpha = true,
|
||||
width = WeakAuras.normalWidth,
|
||||
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_color", L["Glow Color"], L["Glow Color"]),
|
||||
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_color", "color"),
|
||||
@@ -1284,7 +1352,7 @@ local function removeSubCheck(base, path)
|
||||
tremove(parent.checks, path[#path]);
|
||||
end
|
||||
|
||||
local function addControlsForIfLine(args, order, data, conditionVariable, conditions, i, path, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, parentType)
|
||||
local function addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, path, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, parentType)
|
||||
local check = getSubCheck(conditions[i].check, path);
|
||||
|
||||
local indentDepth = min(#path, 3); -- Be reasonable
|
||||
@@ -1293,7 +1361,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
|
||||
local conditionTemplatesToUse = indentDepth < 3 and conditionTemplates or conditionTemplateWithoutCombinations;
|
||||
|
||||
local optionsName = blueIfSubset(data, conditions[i].check);
|
||||
local optionsName = blueIfSubset(data, conditions[i].check, totalAuraCount);
|
||||
local needsTriggerName = check and check.trigger and check.trigger ~= -1 and check.trigger ~= -2;
|
||||
if (parentType) then
|
||||
local isFirst = path[#path] == 1;
|
||||
@@ -1363,27 +1431,27 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
if (indentDepth > 0) then
|
||||
valuesForIf = conditionTemplatesToUse.displayWithRemove;
|
||||
else
|
||||
valuesForIf = isSubset(data, conditions[i].check) and conditionTemplatesToUse.displayWithCopy or conditionTemplatesToUse.display;
|
||||
valuesForIf = isSubset(data, conditions[i].check, totalAuraCount) and conditionTemplatesToUse.displayWithCopy or conditionTemplatesToUse.display;
|
||||
end
|
||||
|
||||
args["condition" .. i .. tostring(path) .. "if"] = {
|
||||
type = "select",
|
||||
name = optionsName,
|
||||
desc = descIfSubset(data, conditions[i].check),
|
||||
desc = descIfSubset(data, conditions[i].check, totalAuraCount),
|
||||
order = order,
|
||||
values = valuesForIf,
|
||||
width = normalWidth;
|
||||
set = function(info, v)
|
||||
if (conditionTemplatesToUse.indexToTrigger[v] == "COPY") then
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
if (conditions[i].check.references[id]) then
|
||||
for child in OptionsPrivate.Private.TraverseLeafs(data) do
|
||||
if (conditions[i].check.references[child.id]) then
|
||||
-- Already exists
|
||||
else
|
||||
-- find a good insertion point, if any other condition has a reference to this
|
||||
-- insert directly after that
|
||||
local insertPoint = 1;
|
||||
for index = i, 1, -1 do
|
||||
if (conditions[index].check.references[id]) then
|
||||
if (conditions[index].check.references[child.id]) then
|
||||
insertPoint = index + 1;
|
||||
break;
|
||||
end
|
||||
@@ -1414,12 +1482,12 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
end
|
||||
end
|
||||
|
||||
local auraData = WeakAuras.GetData(id);
|
||||
tinsert(auraData[conditionVariable], insertPoint, condition);
|
||||
WeakAuras.Add(auraData);
|
||||
tinsert(child[conditionVariable], insertPoint, condition);
|
||||
WeakAuras.Add(child);
|
||||
OptionsPrivate.ClearOptions(child.id)
|
||||
end
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -1453,8 +1521,9 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
childCheck.trigger = trigger;
|
||||
childCheck.value = nil;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
else
|
||||
local oldType;
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
@@ -1470,7 +1539,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
check.value = nil;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end,
|
||||
get = function()
|
||||
@@ -1495,7 +1564,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
for subCheck = 1, subCheckCount do
|
||||
local subPath = CopyTable(path);
|
||||
tinsert(subPath, subCheck);
|
||||
order = addControlsForIfLine(args, order, data, conditionVariable, conditions, i, subPath, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, check.variable);
|
||||
order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, subPath, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, check.variable);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1509,46 +1578,33 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
end
|
||||
|
||||
if (currentConditionTemplate and currentConditionTemplate.type and type(currentConditionTemplate.type) == "string") then
|
||||
local setOp;
|
||||
local setValue;
|
||||
if (data.controlledChildren) then
|
||||
setOp = function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
for id, reference in pairs(conditions[i].check.references) do
|
||||
local auraData = WeakAuras.GetData(id);
|
||||
local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path);
|
||||
childCheck.op = v;
|
||||
WeakAuras.Add(auraData);
|
||||
local function makeSetter(field)
|
||||
if (data.controlledChildren) then
|
||||
return function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
for id, reference in pairs(conditions[i].check.references) do
|
||||
local auraData = WeakAuras.GetData(id);
|
||||
local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path);
|
||||
childCheck[field] = v;
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
check[field] = v;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
check.op = v;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
setValue = function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
for id, reference in pairs(conditions[i].check.references) do
|
||||
local auraData = WeakAuras.GetData(id);
|
||||
local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path);
|
||||
childCheck.value = v;
|
||||
WeakAuras.Add(auraData);
|
||||
else
|
||||
return function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
check[field] = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
check.value = v;
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
else
|
||||
setOp = function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
check.op = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
setValue = function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
check.value = v;
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
local setOp = makeSetter("op")
|
||||
local setValue = makeSetter("value")
|
||||
|
||||
if (currentConditionTemplate.type == "number" or currentConditionTemplate.type == "timer" or currentConditionTemplate.type == "elapsedTimer") then
|
||||
local opTypes = OptionsPrivate.Private.operator_types
|
||||
if currentConditionTemplate.operator_types == "without_equal" then
|
||||
@@ -1694,6 +1750,95 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
order = order + 1;
|
||||
elseif currentConditionTemplate.type == "alwaystrue" then
|
||||
order = addSpace(args, order)
|
||||
elseif (currentConditionTemplate.type == "range") then
|
||||
args["condition" .. i .. tostring(path) .. "_op_range"] = {
|
||||
name = blueIfNoValue(data, conditions[i].check, "op_range", L["Differences"]),
|
||||
desc = descIfNoValue(data, conditions[i].check, "op_range", currentConditionTemplate.type),
|
||||
type = "select",
|
||||
order = order,
|
||||
values = OptionsPrivate.Private.operator_types_without_equal,
|
||||
width = WeakAuras.halfWidth,
|
||||
get = function()
|
||||
return check.op_range;
|
||||
end,
|
||||
set = makeSetter("op_range"),
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
args["condition" .. i .. tostring(path) .. "_range"] = {
|
||||
type = "input",
|
||||
name = L["Range in yards"],
|
||||
desc = descIfNoValue(data, conditions[i].check, "range", currentConditionTemplate.type),
|
||||
width = WeakAuras.halfWidth,
|
||||
order = order,
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
get = function()
|
||||
return check.range;
|
||||
end,
|
||||
set = makeSetter("range")
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
if (indentWidth > 0) then
|
||||
args["condition" .. i .. tostring(path) .. "_space"] = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = order,
|
||||
width = WeakAuras.doubleWidth * 1.5,
|
||||
}
|
||||
order = order + 1;
|
||||
args["condition" .. i .. tostring(path) .. "_indent"] = {
|
||||
type = "description",
|
||||
width = indentWidth,
|
||||
name = "",
|
||||
order = order
|
||||
}
|
||||
order = order + 1;
|
||||
end
|
||||
|
||||
args["condition" .. i .. tostring(path) .. "_type"] = {
|
||||
type = "select",
|
||||
width = normalWidth,
|
||||
name = blueIfNoValue(data, conditions[i].check, "type", L["Differences"]),
|
||||
desc = descIfNoValue(data, conditions[i].check, "type", currentConditionTemplate.type),
|
||||
order = order,
|
||||
values = {
|
||||
group = L["Group player(s) found"],
|
||||
},
|
||||
get = function()
|
||||
return check.type
|
||||
end,
|
||||
set = makeSetter("type"),
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
args["condition" .. i .. tostring(path) .. "_op"] = {
|
||||
name = blueIfNoValue(data, conditions[i].check, "op", L["Differences"]),
|
||||
desc = descIfNoValue(data, conditions[i].check, "op", currentConditionTemplate.type),
|
||||
type = "select",
|
||||
order = order,
|
||||
values = OptionsPrivate.Private.operator_types,
|
||||
width = WeakAuras.halfWidth,
|
||||
get = function()
|
||||
return check.op;
|
||||
end,
|
||||
set = setOp,
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
args["condition" .. i .. tostring(path) .. "_value"] = {
|
||||
type = "input",
|
||||
name = blueIfNoValue(data, conditions[i].check, "value", L["Differences"]),
|
||||
desc = descIfNoValue(data, conditions[i].check, "value", currentConditionTemplate.type),
|
||||
width = WeakAuras.halfWidth,
|
||||
order = order,
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
get = function()
|
||||
return check.value;
|
||||
end,
|
||||
set = setValue
|
||||
}
|
||||
order = order + 1;
|
||||
elseif currentConditionTemplate.type == "customcheck" then
|
||||
args["condition" .. i .. tostring(path) .. "_op"] = {
|
||||
name = blueIfNoValue(data, conditions[i].check, "op", L["Additional Events"], L["Additional Events"]),
|
||||
@@ -1799,7 +1944,7 @@ local function fixUpLinkedInFirstCondition(conditions)
|
||||
end
|
||||
end
|
||||
|
||||
local function addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
|
||||
local function addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
|
||||
if (not conditions[i].check) then
|
||||
return order;
|
||||
end
|
||||
@@ -1828,11 +1973,12 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
for id, reference in pairs(conditions[i].check.references) do
|
||||
local index = reference.conditionIndex
|
||||
OptionsPrivate.SetCollapsed(id, "condition", index, not collapsed);
|
||||
OptionsPrivate.ClearOptions(id)
|
||||
end
|
||||
else
|
||||
OptionsPrivate.SetCollapsed(data.id, "condition", i, not collapsed);
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end,
|
||||
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" ,
|
||||
imageWidth = 18,
|
||||
@@ -1870,9 +2016,10 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
fixUpLinkedInFirstCondition(auraData[conditionVariable])
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.MoveCollapseDataUp(auraData.id, "condition", {reference.conditionIndex})
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
else
|
||||
if (i > 1) then
|
||||
local tmp = conditions[i];
|
||||
@@ -1881,7 +2028,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
fixUpLinkedInFirstCondition(conditions)
|
||||
WeakAuras.Add(data);
|
||||
OptionsPrivate.MoveCollapseDataUp(data.id, "condition", {i})
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
end,
|
||||
@@ -1923,9 +2070,10 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
fixUpLinkedInFirstCondition(auraData[conditionVariable])
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.MoveCollapseDataDown(auraData.id, "condition", {reference.conditionIndex})
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
else
|
||||
if (i < #conditions) then
|
||||
@@ -1935,7 +2083,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
fixUpLinkedInFirstCondition(conditions)
|
||||
WeakAuras.Add(data);
|
||||
OptionsPrivate.MoveCollapseDataDown(data.id, "condition", {i})
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
end
|
||||
end
|
||||
@@ -1960,15 +2108,16 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
tinsert(auraData[conditionVariable], reference.conditionIndex + 1, clone);
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.DuplicateCollapseData(auraData.id, "condition", {reference.conditionIndex})
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
else
|
||||
local clone = CopyTable(conditions[i])
|
||||
tinsert(conditions, i + 1, clone);
|
||||
WeakAuras.Add(data);
|
||||
OptionsPrivate.DuplicateCollapseData(data.id, "condition", {i})
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
end
|
||||
end,
|
||||
@@ -1992,15 +2141,16 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
fixUpLinkedInFirstCondition(auraData[conditionVariable])
|
||||
WeakAuras.Add(auraData);
|
||||
OptionsPrivate.RemoveCollapsed(auraData.id, "condition", {reference.conditionIndex})
|
||||
OptionsPrivate.ClearOptions(auraData.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
else
|
||||
tremove(conditions, i);
|
||||
fixUpLinkedInFirstCondition(conditions)
|
||||
WeakAuras.Add(data);
|
||||
OptionsPrivate.RemoveCollapsed(data.id, "condition", {i})
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
return;
|
||||
end
|
||||
end,
|
||||
@@ -2016,7 +2166,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
return order;
|
||||
end
|
||||
|
||||
order = addControlsForIfLine(args, order, data, conditionVariable, conditions, i, {}, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
|
||||
order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, {}, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
|
||||
|
||||
-- Add Property changes
|
||||
|
||||
@@ -2029,7 +2179,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
end
|
||||
|
||||
for j = 1, conditions[i].changes and #conditions[i].changes or 0 do
|
||||
order = addControlsForChange(args, order, data, conditionVariable, conditions, i, j, allProperties, usedProperties);
|
||||
order = addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties);
|
||||
end
|
||||
|
||||
args["condition" .. i .. "_addChange"] = {
|
||||
@@ -2044,13 +2194,14 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
auradata[conditionVariable][reference.conditionIndex].changes = auradata[conditionVariable][reference.conditionIndex].changes or {}
|
||||
tinsert(auradata[conditionVariable][reference.conditionIndex].changes, {})
|
||||
WeakAuras.Add(auradata);
|
||||
OptionsPrivate.ClearOptions(auradata.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
else
|
||||
conditions[i].changes = conditions[i].changes or {};
|
||||
conditions[i].changes[#conditions[i].changes + 1] = {};
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -2091,13 +2242,14 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
if reference.conditionIndex > 1 then
|
||||
auradata[conditionVariable][reference.conditionIndex].linked = not isLinked
|
||||
WeakAuras.Add(auradata);
|
||||
OptionsPrivate.ClearOptions(auradata.id)
|
||||
end
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
else
|
||||
conditions[i].linked = not isLinked
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -2196,11 +2348,10 @@ local function createConditionTemplates(data)
|
||||
local numTriggers = 0;
|
||||
if (data.controlledChildren) then
|
||||
allConditionTemplates = {};
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
local data = WeakAuras.GetData(id);
|
||||
numTriggers = max(numTriggers, #data.triggers);
|
||||
for child in OptionsPrivate.Private.TraverseLeafs(data) do
|
||||
numTriggers = max(numTriggers, #child.triggers);
|
||||
|
||||
local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(data);
|
||||
local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(child);
|
||||
mergeConditionTemplates(allConditionTemplates, auraConditionsTemplate, numTriggers)
|
||||
end
|
||||
else
|
||||
@@ -2238,39 +2389,28 @@ end
|
||||
local function buildAllPotentialProperties(data, category)
|
||||
local allProperties = {};
|
||||
allProperties.propertyMap = {};
|
||||
if (data.controlledChildren) then
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
local auradata = WeakAuras.GetData(id);
|
||||
local regionProperties = OptionsPrivate.Private.GetProperties(auradata);
|
||||
if (regionProperties) then
|
||||
for k, v in pairs(regionProperties) do
|
||||
if (v.category == category) then
|
||||
if (allProperties.propertyMap[k]) then
|
||||
if (allProperties.propertyMap[k].type ~= v.type) then
|
||||
allProperties.propertyMap[k].type = "incompatible";
|
||||
end
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
|
||||
local regionProperties = OptionsPrivate.Private.GetProperties(child);
|
||||
|
||||
if (allProperties.propertyMap[k].type == "list") then
|
||||
-- Merge value lists
|
||||
for key, value in pairs(v.values) do
|
||||
if (allProperties.propertyMap[k].values[key] == nil) then
|
||||
allProperties.propertyMap[k].values[key] = value;
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
allProperties.propertyMap[k] = CopyTable(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local regionProperties = OptionsPrivate.Private.GetProperties(data);
|
||||
if (regionProperties) then
|
||||
for k, v in pairs(regionProperties) do
|
||||
if (v.category == category) then
|
||||
allProperties.propertyMap[k] = v;
|
||||
if (allProperties.propertyMap[k]) then
|
||||
if (allProperties.propertyMap[k].type ~= v.type) then
|
||||
allProperties.propertyMap[k].type = "incompatible";
|
||||
end
|
||||
|
||||
if (allProperties.propertyMap[k].type == "list") then
|
||||
-- Merge value lists
|
||||
for key, value in pairs(v.values) do
|
||||
if (allProperties.propertyMap[k].values[key] == nil) then
|
||||
allProperties.propertyMap[k].values[key] = value;
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
allProperties.propertyMap[k] = CopyTable(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2411,7 +2551,7 @@ local function SubPropertiesForChange(change)
|
||||
"glow_scale", "glow_border"
|
||||
}
|
||||
elseif change.property == "chat" then
|
||||
local result = { "message_type", "message_dest", "message_channel", "message", "custom" }
|
||||
local result = { "message_type", "message_dest", "message_channel", "message_color", "message", "custom" }
|
||||
local input = change.value and change.value.message
|
||||
if input then
|
||||
local getter = function(key)
|
||||
@@ -2419,14 +2559,15 @@ local function SubPropertiesForChange(change)
|
||||
end
|
||||
OptionsPrivate.AddTextFormatOption(input, false, getter, function(key)
|
||||
tinsert(result, "message_format_" .. key)
|
||||
end)
|
||||
end, nil, nil, true)
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
local subPropertyToType = {
|
||||
glow_color = "color"
|
||||
glow_color = "color",
|
||||
message_color = "color"
|
||||
}
|
||||
|
||||
local function mergeConditionChange(all, change, id, changeIndex, allProperties)
|
||||
@@ -2601,16 +2742,23 @@ function OptionsPrivate.GetConditionOptions(data)
|
||||
|
||||
-- Build currently selected conditions
|
||||
local conditions;
|
||||
local totalAuraCount
|
||||
|
||||
if (data.controlledChildren) then
|
||||
local allChildren = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafs(data) do
|
||||
tinsert(allChildren, child)
|
||||
end
|
||||
totalAuraCount = #allChildren
|
||||
|
||||
conditions = {};
|
||||
local last = #data.controlledChildren;
|
||||
for index = last, 1, -1 do
|
||||
local id = data.controlledChildren[index];
|
||||
local data = WeakAuras.GetData(id);
|
||||
fixupConditions(data[conditionVariable])
|
||||
mergeConditions(conditions, data[conditionVariable], data.id, conditionTemplates.all, allProperties);
|
||||
for index = totalAuraCount, 1, -1 do
|
||||
local child = allChildren[index]
|
||||
fixupConditions(child[conditionVariable])
|
||||
mergeConditions(conditions, child[conditionVariable], child.id, conditionTemplates.all, allProperties);
|
||||
end
|
||||
else
|
||||
totalAuraCount = 1
|
||||
data[conditionVariable] = data[conditionVariable] or {};
|
||||
conditions = data[conditionVariable];
|
||||
fixupConditions(data[conditionVariable])
|
||||
@@ -2618,7 +2766,7 @@ function OptionsPrivate.GetConditionOptions(data)
|
||||
|
||||
local order = startorder;
|
||||
for i = 1, #conditions do
|
||||
order = addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
|
||||
order = addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
|
||||
end
|
||||
|
||||
args["addConditionHeader"] = {
|
||||
@@ -2635,28 +2783,17 @@ function OptionsPrivate.GetConditionOptions(data)
|
||||
name = L["Add Condition"],
|
||||
order = order,
|
||||
func = function()
|
||||
if (data.controlledChildren) then
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
local aura = WeakAuras.GetData(id);
|
||||
aura[conditionVariable][#aura[conditionVariable] + 1] = {};
|
||||
aura[conditionVariable][#aura[conditionVariable]].check = {};
|
||||
aura[conditionVariable][#aura[conditionVariable]].changes = {};
|
||||
aura[conditionVariable][#aura[conditionVariable]].changes[1] = {}
|
||||
aura[conditionVariable][#aura[conditionVariable]].category = category;
|
||||
OptionsPrivate.SetCollapsed(id, "condition", #aura[conditionVariable], false);
|
||||
WeakAuras.Add(aura);
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
conditions[#conditions + 1] = {};
|
||||
conditions[#conditions].check = {};
|
||||
conditions[#conditions].changes = {};
|
||||
conditions[#conditions].changes[1] = {}
|
||||
conditions[#conditions].category = category;
|
||||
OptionsPrivate.SetCollapsed(data.id, "condition", #conditions, false);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
|
||||
child[conditionVariable][#child[conditionVariable] + 1] = {};
|
||||
child[conditionVariable][#child[conditionVariable]].check = {};
|
||||
child[conditionVariable][#child[conditionVariable]].changes = {};
|
||||
child[conditionVariable][#child[conditionVariable]].changes[1] = {}
|
||||
child[conditionVariable][#child[conditionVariable]].category = category;
|
||||
OptionsPrivate.SetCollapsed(child.id, "condition", #child[conditionVariable], false);
|
||||
WeakAuras.Add(child);
|
||||
OptionsPrivate.ClearOptions(child.id)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
Reference in New Issue
Block a user