from retail
This commit is contained in:
@@ -1378,14 +1378,14 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA
|
||||
local isFirst = path[#path] == 1;
|
||||
if (isFirst) then
|
||||
if (needsTriggerName) then
|
||||
optionsName = optionsName .. string.format(L["Trigger %s"], check.trigger);
|
||||
optionsName = optionsName .. OptionsPrivate.GetTriggerTitle(data, check.trigger)
|
||||
end
|
||||
else
|
||||
if (needsTriggerName) then
|
||||
if (parentType == "AND") then
|
||||
optionsName = optionsName .. string.format(L["and Trigger %s"], check.trigger);
|
||||
optionsName = optionsName .. string.format(L["and %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||
else
|
||||
optionsName = optionsName .. string.format(L["or Trigger %s"], check.trigger);
|
||||
optionsName = optionsName .. string.format(L["or %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1393,9 +1393,9 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA
|
||||
local isLinked = conditions[i].linked and i > 1
|
||||
if (needsTriggerName) then
|
||||
if isLinked then
|
||||
optionsName = optionsName .. string.format(L["Else If Trigger %s"], check.trigger);
|
||||
optionsName = optionsName .. string.format(L["Else If %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||
else
|
||||
optionsName = optionsName .. string.format(L["If Trigger %s"], check.trigger);
|
||||
optionsName = optionsName .. string.format(L["If %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||
end
|
||||
else
|
||||
optionsName = optionsName .. (isLinked and L["Else If"] or L["If"])
|
||||
@@ -1954,6 +1954,49 @@ local function fixUpLinkedInFirstCondition(conditions)
|
||||
end
|
||||
end
|
||||
|
||||
local function formatConditionTitle(text, propertyType, value)
|
||||
if propertyType == "color" and type(value) == "table" then
|
||||
local r, g, b = unpack(value)
|
||||
r, g, b = r or 1, g or 1, b or 1
|
||||
return ("|cFF%2x%2x%2x%s|r"):format(r * 220 + 35, g * 220 + 35, b * 220 + 35, text)
|
||||
elseif propertyType == "bool" then
|
||||
return ("%s: %s"):format(text, value and L["ON"] or L["OFF"])
|
||||
elseif propertyType == "sound" and type(value) == "table" and type(value.sound) == "string" and value.sound ~= "" then
|
||||
if OptionsPrivate.Private.sound_types[value.sound] then
|
||||
return ("%s: %s"):format(text, OptionsPrivate.Private.sound_types[value.sound])
|
||||
end
|
||||
elseif value ~= nil and type(value) ~= "table" then
|
||||
return ("%s: %s"):format(text, value)
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
local function GetConditionTitle(changes, conditionnum, allProperties)
|
||||
if type(changes) == "table" and #changes > 0 then
|
||||
local outs = {}
|
||||
for i, change in ipairs(changes) do
|
||||
local property = change.property
|
||||
if property and allProperties.propertyMap[property] then
|
||||
local display = allProperties.propertyMap[property].display
|
||||
local propertyType = allProperties.propertyMap[property].type
|
||||
local title
|
||||
if type(display) == "string" then
|
||||
title = display
|
||||
elseif type(display) == "table" then
|
||||
title = ("%s %s"):format(display[1], display[2])
|
||||
end
|
||||
if title then
|
||||
tinsert(outs, formatConditionTitle(title, propertyType, change.value))
|
||||
end
|
||||
end
|
||||
end
|
||||
if #outs > 0 then
|
||||
return L["%i. %s"]:format(conditionnum, table.concat(outs, ", "))
|
||||
end
|
||||
end
|
||||
return L["%i."]:format(conditionnum)
|
||||
end
|
||||
|
||||
local function addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
|
||||
if (not conditions[i].check) then
|
||||
return order;
|
||||
@@ -1975,7 +2018,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot
|
||||
|
||||
args["condition" .. i .. "header"] = {
|
||||
type = "execute",
|
||||
name = L["Condition %i"]:format(i),
|
||||
name = GetConditionTitle(conditions[i].changes, i, allProperties),
|
||||
order = order,
|
||||
width = WeakAuras.doubleWidth - 0.6,
|
||||
func = function()
|
||||
@@ -1993,7 +2036,8 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot
|
||||
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" ,
|
||||
imageWidth = 18,
|
||||
imageHeight = 18,
|
||||
control = "WeakAurasExpand"
|
||||
control = "WeakAurasExpand",
|
||||
fontObject = GameFontHighlight
|
||||
};
|
||||
order = order + 1;
|
||||
|
||||
@@ -2292,7 +2336,7 @@ local function mergeConditionTemplates(allConditionTemplates, auraConditionsTemp
|
||||
end
|
||||
end
|
||||
|
||||
local function createConditionTemplatesValueList(allConditionTemplates, numTriggers, excludeCombinations)
|
||||
local function createConditionTemplatesValueList(allConditionTemplates, numTriggers, excludeCombinations, data)
|
||||
local conditionTemplates = {};
|
||||
conditionTemplates.all = allConditionTemplates;
|
||||
conditionTemplates.indexToTrigger = {};
|
||||
@@ -2322,7 +2366,7 @@ local function createConditionTemplatesValueList(allConditionTemplates, numTrigg
|
||||
elseif (triggernum == -1) then
|
||||
conditionTemplates.display[index] = string.format(L["Global Conditions"]);
|
||||
else
|
||||
conditionTemplates.display[index] = string.format(L["Trigger %d"], triggernum);
|
||||
conditionTemplates.display[index] = OptionsPrivate.GetTriggerTitle(data, triggernum)
|
||||
end
|
||||
index = index + 1;
|
||||
|
||||
@@ -2381,7 +2425,7 @@ local function createConditionTemplates(data)
|
||||
}
|
||||
allConditionTemplates[-1] = OptionsPrivate.Private.GetGlobalConditions();
|
||||
|
||||
local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers);
|
||||
local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers, nil, data);
|
||||
|
||||
if (data.controlledChildren) then
|
||||
conditionTemplates.displayWithCopy = CopyTable(conditionTemplates.display);
|
||||
@@ -2391,7 +2435,7 @@ local function createConditionTemplates(data)
|
||||
conditionTemplates.indexToVariable[9998] = "COPY";
|
||||
end
|
||||
|
||||
local conditionTemplateWithoutCombinations = createConditionTemplatesValueList(allConditionTemplates, numTriggers, true);
|
||||
local conditionTemplateWithoutCombinations = createConditionTemplatesValueList(allConditionTemplates, numTriggers, true, data);
|
||||
|
||||
return conditionTemplates, conditionTemplateWithoutCombinations;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user