from retail
This commit is contained in:
@@ -68,6 +68,9 @@ WeakAuras.WA_ClassColorName = WA_ClassColorName
|
||||
-- UTF-8 Sub is pretty commonly needed
|
||||
local WA_Utf8Sub = function(input, size)
|
||||
local output = ""
|
||||
if not input then
|
||||
return output
|
||||
end
|
||||
local i = 1
|
||||
while (size > 0) do
|
||||
local byte = input:byte(i)
|
||||
@@ -258,10 +261,7 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
|
||||
if(actions and actions.do_custom and actions.custom) then
|
||||
local func = WeakAuras.customActionsFunctions[id]["init"]
|
||||
if func then
|
||||
local ok, ret = pcall(func)
|
||||
if not ok then
|
||||
geterrorhandler()(ret)
|
||||
end
|
||||
xpcall(func, geterrorhandler())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -544,7 +544,7 @@ local function importPendingData()
|
||||
button.callbacks.UpdateExpandButton()
|
||||
WeakAuras.UpdateGroupOrders(parentData)
|
||||
WeakAuras.UpdateDisplayButton(parentData)
|
||||
WeakAuras.ReloadGroupRegionOptions(parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
WeakAuras.SortDisplayButtons()
|
||||
end
|
||||
WeakAuras.SetImporting(false)
|
||||
|
||||
+21
-3
@@ -165,6 +165,12 @@ WeakAuras.format_types = {
|
||||
hidden = hidden
|
||||
})
|
||||
end,
|
||||
addOption(symbol .. "_big_number_space", {
|
||||
type = "description",
|
||||
name = "",
|
||||
width = WeakAuras.normalWidth,
|
||||
hidden = hidden
|
||||
})
|
||||
CreateFormatter = function(symbol, get)
|
||||
local format = get(symbol .. "_big_number_format", "AbbreviateNumbers")
|
||||
if (format == "AbbreviateNumbers") then
|
||||
@@ -255,7 +261,7 @@ WeakAuras.format_types = {
|
||||
local abbreviateFunc
|
||||
if color == "class" then
|
||||
colorFunc = function(unit, text)
|
||||
if UnitPlayerControlled(unit) then
|
||||
if unit and UnitPlayerControlled(unit) then
|
||||
return GetClassColoredTextForUnit(unit, text)
|
||||
end
|
||||
return text
|
||||
@@ -263,9 +269,14 @@ WeakAuras.format_types = {
|
||||
end
|
||||
|
||||
if realm == "never" then
|
||||
nameFunc = UnitName
|
||||
nameFunc = function(unit)
|
||||
return unit and UnitName(unit)
|
||||
end
|
||||
elseif realm == "star" then
|
||||
nameFunc = function(unit)
|
||||
if not unit then
|
||||
return ""
|
||||
end
|
||||
local name, realm = UnitName(unit)
|
||||
if realm then
|
||||
return name .. "*"
|
||||
@@ -274,6 +285,9 @@ WeakAuras.format_types = {
|
||||
end
|
||||
elseif realm == "differentServer" then
|
||||
nameFunc = function(unit)
|
||||
if not unit then
|
||||
return ""
|
||||
end
|
||||
local name, realm = UnitName(unit)
|
||||
if realm then
|
||||
return name .. "-" .. realm
|
||||
@@ -282,6 +296,9 @@ WeakAuras.format_types = {
|
||||
end
|
||||
elseif realm == "always" then
|
||||
nameFunc = function(unit)
|
||||
if not unit then
|
||||
return ""
|
||||
end
|
||||
local name, realm = WeakAuras.UnitNameWithRealm(unit)
|
||||
return name .. "-" .. realm
|
||||
end
|
||||
@@ -350,6 +367,7 @@ WeakAuras.format_types = {
|
||||
min = 1,
|
||||
max = 20,
|
||||
hidden = hidden,
|
||||
step = 1,
|
||||
disabled = function()
|
||||
return not get(symbol .. "_abbreviate")
|
||||
end
|
||||
@@ -366,7 +384,7 @@ WeakAuras.format_types = {
|
||||
local abbreviateFunc
|
||||
if color == "class" then
|
||||
colorFunc = function(class, text)
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = class and RAID_CLASS_COLORS[class]
|
||||
if color then
|
||||
return string.format("|c%s%s|r", string.format("ff%.2x%.2x%.2x", color.r * 255, color.g * 255, color.b * 255), text)
|
||||
else
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
WeakAurasInlineGroup based on InlineGroup Container
|
||||
Simple container widget that has the same API as a InlineGroup, without actually
|
||||
showing any borders or a title.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "WeakAurasInlineGroup", 1
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetWidth(300)
|
||||
self:SetHeight(100)
|
||||
self:SetTitle("")
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetTitle"] = function(self)
|
||||
-- Do nothing
|
||||
end,
|
||||
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
if self.noAutoHeight then return end
|
||||
self:SetHeight((height or 0) + 40)
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
content:SetWidth(width)
|
||||
content.width = width
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
content:SetHeight(height)
|
||||
content.height = height
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, frame)
|
||||
content:SetPoint("TOPLEFT", 0, 0)
|
||||
content:SetPoint("BOTTOMRIGHT", 0, 0)
|
||||
|
||||
local widget = {
|
||||
frame = frame,
|
||||
content = content,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -4,7 +4,7 @@ local tinsert, tconcat, tremove, wipe = table.insert, table.concat, table.remove
|
||||
local select, pairs, next, type, unpack = select, pairs, next, type, unpack
|
||||
local tostring, error = tostring, error
|
||||
|
||||
local Type, Version = "WeakAurasDisplayButton", 54
|
||||
local Type, Version = "WeakAurasDisplayButton", 55
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -95,18 +95,21 @@ clipboard.pasteMenuEntry = {
|
||||
for index, childId in pairs(clipboard.current.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
copyAuraPart(clipboard.source, childData, clipboard.part);
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.Add(childData)
|
||||
WeakAuras.ClearAndUpdateOptions(childData.id)
|
||||
end
|
||||
else
|
||||
copyAuraPart(clipboard.source, clipboard.current, clipboard.part);
|
||||
WeakAuras.Add(clipboard.current);
|
||||
WeakAuras.Add(clipboard.current)
|
||||
WeakAuras.ClearAndUpdateOptions(clipboard.current.id)
|
||||
end
|
||||
|
||||
WeakAuras.FillOptions()
|
||||
WeakAuras.ScanForLoads({[clipboard.current.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
WeakAuras.PickDisplay(clipboard.current.id);
|
||||
WeakAuras.UpdateDisplayButton(clipboard.current.id);
|
||||
WeakAuras.ReloadOptions2(clipboard.current.id, clipboard.current);
|
||||
WeakAuras.ClearAndUpdateOptions(clipboard.current.id);
|
||||
end
|
||||
}
|
||||
|
||||
@@ -304,16 +307,22 @@ local Actions = {
|
||||
WeakAuras.Add(source.data)
|
||||
WeakAuras.Add(group.data)
|
||||
WeakAuras.UpdateGroupOrders(group.data)
|
||||
WeakAuras.ReloadGroupRegionOptions(group.data)
|
||||
WeakAuras.ClearAndUpdateOptions(group.data.id)
|
||||
WeakAuras.ClearAndUpdateOptions(source.data.id)
|
||||
WeakAuras.UpdateDisplayButton(group.data)
|
||||
WeakAuras.FillOptions()
|
||||
group.callbacks.UpdateExpandButton();
|
||||
group:ReloadTooltip()
|
||||
else
|
||||
WeakAuras.Add(source.data)
|
||||
WeakAuras.ClearAndUpdateOptions(source.data.id)
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
else
|
||||
-- move source into the top-level list
|
||||
WeakAuras.Add(source.data)
|
||||
WeakAuras.ClearAndUpdateOptions(source.data.id)
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
else
|
||||
error("Calling 'Group' with invalid source. Reload your UI to fix the display list.")
|
||||
@@ -331,7 +340,7 @@ local Actions = {
|
||||
source.data.parent = nil
|
||||
WeakAuras.Add(parent);
|
||||
WeakAuras.UpdateGroupOrders(parent);
|
||||
WeakAuras.ReloadGroupRegionOptions(parent);
|
||||
WeakAuras.ClearAndUpdateOptions(parent.id);
|
||||
WeakAuras.UpdateDisplayButton(parent);
|
||||
local group = WeakAuras.GetDisplayButton(parent.id)
|
||||
group.callbacks.UpdateExpandButton();
|
||||
@@ -367,6 +376,8 @@ local Actions = {
|
||||
tinsert(children, 1, source.data.id)
|
||||
end
|
||||
WeakAuras.Add(parent)
|
||||
WeakAuras.ClearAndUpdateOptions(parent.id)
|
||||
WeakAuras.FillOptions()
|
||||
WeakAuras.UpdateGroupOrders(parent)
|
||||
WeakAuras.UpdateDisplayButton(parent)
|
||||
else
|
||||
@@ -572,6 +583,7 @@ local methods = {
|
||||
childButton:SetGroupOrder(#data.controlledChildren, #data.controlledChildren);
|
||||
childData.parent = data.id;
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.ClearAndUpdateOptions(childData.id)
|
||||
end
|
||||
else
|
||||
tinsert(data.controlledChildren, self.grouping.id);
|
||||
@@ -580,16 +592,19 @@ local methods = {
|
||||
childButton:SetGroupOrder(#data.controlledChildren, #data.controlledChildren);
|
||||
self.grouping.parent = data.id;
|
||||
WeakAuras.Add(self.grouping);
|
||||
WeakAuras.ClearAndUpdateOptions(self.grouping.id);
|
||||
end
|
||||
if (data.regionType == "dynamicgroup") then
|
||||
self.grouping.xOffset = 0;
|
||||
self.grouping.yOffset = 0;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
self.callbacks.UpdateExpandButton();
|
||||
WeakAuras.SetGrouping();
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.ReloadGroupRegionOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
WeakAuras.FillOptions();
|
||||
WeakAuras.UpdateGroupOrders(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
self:ReloadTooltip();
|
||||
@@ -670,6 +685,7 @@ local methods = {
|
||||
tremove(parentData.controlledChildren, index);
|
||||
tinsert(parentData.controlledChildren, index - 1, id);
|
||||
WeakAuras.Add(parentData);
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
self:SetGroupOrder(index - 1, #parentData.controlledChildren);
|
||||
local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]);
|
||||
otherbutton:SetGroupOrder(index, #parentData.controlledChildren);
|
||||
@@ -679,6 +695,7 @@ local methods = {
|
||||
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index-1]), "main", updata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
|
||||
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]), "main", downdata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
|
||||
WeakAuras.UpdateDisplayButton(parentData);
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
else
|
||||
error("Display thinks it is a member of a group which does not control it");
|
||||
@@ -707,6 +724,7 @@ local methods = {
|
||||
tremove(parentData.controlledChildren, index);
|
||||
tinsert(parentData.controlledChildren, index + 1, id);
|
||||
WeakAuras.Add(parentData);
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
self:SetGroupOrder(index + 1, #parentData.controlledChildren);
|
||||
local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]);
|
||||
otherbutton:SetGroupOrder(index, #parentData.controlledChildren);
|
||||
@@ -716,6 +734,7 @@ local methods = {
|
||||
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index+1]), "main", downdata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
|
||||
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]), "main", updata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
|
||||
WeakAuras.UpdateDisplayButton(parentData);
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
else
|
||||
error("Display thinks it is a member of a group which does not control it");
|
||||
@@ -788,13 +807,12 @@ local methods = {
|
||||
if not(newid == oldid) then
|
||||
|
||||
WeakAuras.Rename(data, newid);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.Add(data)
|
||||
|
||||
WeakAuras.displayButtons[newid] = WeakAuras.displayButtons[oldid];
|
||||
WeakAuras.displayButtons[newid]:SetData(data)
|
||||
WeakAuras.displayButtons[oldid] = nil;
|
||||
WeakAuras.displayOptions[oldid] = nil;
|
||||
WeakAuras.AddOption(newid, data);
|
||||
WeakAuras.ClearOptions(oldid)
|
||||
|
||||
WeakAuras.displayButtons[newid]:SetTitle(newid);
|
||||
|
||||
@@ -1156,13 +1174,14 @@ local methods = {
|
||||
if(index) then
|
||||
tremove(parentData.controlledChildren, index);
|
||||
WeakAuras.Add(parentData);
|
||||
WeakAuras.ReloadGroupRegionOptions(parentData);
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id);
|
||||
else
|
||||
error("Display thinks it is a member of a group which does not control it");
|
||||
end
|
||||
self:SetGroup();
|
||||
self.data.parent = nil;
|
||||
WeakAuras.Add(self.data);
|
||||
WeakAuras.ClearAndUpdateOptions(self.data.id);
|
||||
WeakAuras.UpdateGroupOrders(parentData);
|
||||
WeakAuras.UpdateDisplayButton(parentData);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
@@ -1521,13 +1540,11 @@ local methods = {
|
||||
-- no addon, or no data, or ignore flag
|
||||
return false, false, nil, nil
|
||||
end,
|
||||
-- TODO: remove this once legacy aura trigger is removed
|
||||
["RefreshBT2UpgradeIcon"] = function(self)
|
||||
if not self.data.controlledChildren and self.data.triggers then
|
||||
for index, t in ipairs(self.data.triggers) do
|
||||
if t.trigger and t.trigger.type == "aura" then
|
||||
self.bt2upgrade:SetScript("OnClick", function()
|
||||
WeakAuras.optionTriggerChoices[self.data.id] = index
|
||||
WeakAuras.PickDisplay(self.data.id, "trigger")
|
||||
end)
|
||||
self.bt2upgrade:Show()
|
||||
|
||||
@@ -2,11 +2,19 @@ if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
local removeFuncs = WeakAuras.commonOptions.removeFuncs
|
||||
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
|
||||
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
|
||||
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
|
||||
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("action")
|
||||
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("action")
|
||||
local getAll = WeakAuras.commonOptions.CreateGetAll("action")
|
||||
local setAll = WeakAuras.commonOptions.CreateSetAll("action", getAll)
|
||||
|
||||
local send_chat_message_types = WeakAuras.send_chat_message_types;
|
||||
local sound_types = WeakAuras.sound_types;
|
||||
|
||||
function WeakAuras.AddActionOption(id, data)
|
||||
function WeakAuras.GetActionOptions(data)
|
||||
local action = {
|
||||
type = "group",
|
||||
name = L["Actions"],
|
||||
@@ -52,7 +60,7 @@ function WeakAuras.AddActionOption(id, data)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if(value == "message") then
|
||||
WeakAuras.ReloadOptions(data.id)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end,
|
||||
args = {
|
||||
@@ -801,10 +809,10 @@ function WeakAuras.AddActionOption(id, data)
|
||||
|
||||
-- Text format option helpers
|
||||
|
||||
WeakAuras.AddCodeOption(action.args, data, L["Custom Code"], "init", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-init",
|
||||
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "init", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-init",
|
||||
0.011, function() return not data.actions.init.do_custom end, {"actions", "init", "custom"}, true);
|
||||
|
||||
WeakAuras.AddCodeOption(action.args, data, L["Custom Code"], "start_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
|
||||
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
|
||||
5, function() return not (data.actions.start.do_message and WeakAuras.ContainsCustomPlaceHolder(data.actions.start.message)) end, {"actions", "start", "message_custom"}, false);
|
||||
|
||||
local startHidden = function()
|
||||
@@ -834,7 +842,7 @@ function WeakAuras.AddActionOption(id, data)
|
||||
data.actions.start["message_format_" .. key] = v
|
||||
WeakAuras.Add(data)
|
||||
if reload then
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -861,10 +869,10 @@ function WeakAuras.AddActionOption(id, data)
|
||||
end
|
||||
|
||||
|
||||
WeakAuras.AddCodeOption(action.args, data, L["Custom Code"], "start", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-show",
|
||||
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-show",
|
||||
13, function() return not data.actions.start.do_custom end, {"actions", "start", "custom"}, true);
|
||||
|
||||
WeakAuras.AddCodeOption(action.args, data, L["Custom Code"], "finish_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
|
||||
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
|
||||
25, function() return not (data.actions.finish.do_message and WeakAuras.ContainsCustomPlaceHolder(data.actions.finish.message)) end, {"actions", "finish", "message_custom"}, false);
|
||||
|
||||
local finishHidden = function()
|
||||
@@ -893,7 +901,7 @@ function WeakAuras.AddActionOption(id, data)
|
||||
data.actions.finish["message_format_" .. key] = v
|
||||
WeakAuras.Add(data)
|
||||
if reload then
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -919,8 +927,27 @@ function WeakAuras.AddActionOption(id, data)
|
||||
WeakAuras.AddTextFormatOption(data.actions and data.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden)
|
||||
end
|
||||
|
||||
WeakAuras.AddCodeOption(action.args, data, L["Custom Code"], "finish", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide",
|
||||
WeakAuras.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide",
|
||||
32, function() return not data.actions.finish.do_custom end, {"actions", "finish", "custom"}, true);
|
||||
|
||||
if data.controlledChildren then
|
||||
removeFuncs(action)
|
||||
replaceNameDescFuncs(action, data, "action")
|
||||
replaceImageFuncs(action, data, "action")
|
||||
replaceValuesFuncs(action, data, "action")
|
||||
|
||||
action.get = function(info, ...) return getAll(data, info, ...); end;
|
||||
action.set = function(info, ...)
|
||||
setAll(data, info, ...);
|
||||
if(type(data.id) == "string") then
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end
|
||||
end
|
||||
action.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
|
||||
action.disabled = function(info, ...) return disabledAll(data, info, ...); end;
|
||||
end
|
||||
|
||||
return action;
|
||||
end
|
||||
|
||||
@@ -2,6 +2,15 @@ if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
local removeFuncs = WeakAuras.commonOptions.removeFuncs
|
||||
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
|
||||
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
|
||||
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
|
||||
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("animation")
|
||||
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("animation")
|
||||
local getAll = WeakAuras.commonOptions.CreateGetAll("animation")
|
||||
local setAll = WeakAuras.commonOptions.CreateSetAll("animation", getAll)
|
||||
|
||||
local anim_types = WeakAuras.anim_types;
|
||||
local anim_translate_types = WeakAuras.anim_translate_types;
|
||||
local anim_scale_types = WeakAuras.anim_scale_types;
|
||||
@@ -46,7 +55,8 @@ local function filterAnimPresetTypes(intable, id)
|
||||
return ret;
|
||||
end
|
||||
|
||||
function WeakAuras.AddAnimationOption(id, data)
|
||||
function WeakAuras.GetAnimationOptions(data)
|
||||
local id = data.id
|
||||
local animation = {
|
||||
type = "group",
|
||||
name = L["Animations"],
|
||||
@@ -846,94 +856,113 @@ function WeakAuras.AddAnimationOption(id, data)
|
||||
local function hideStartAlphaFunc()
|
||||
return data.animation.start.type ~= "custom" or data.animation.start.alphaType ~= "custom" or not data.animation.start.use_alpha
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
|
||||
35.3, hideStartAlphaFunc, {"animation", "start", "alphaFunc"}, false);
|
||||
|
||||
local function hideStartTranslate()
|
||||
return data.animation.start.type ~= "custom" or data.animation.start.translateType ~= "custom" or not data.animation.start.use_translate
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "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 WeakAuras.regions[id].region.Scale)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
|
||||
43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false);
|
||||
|
||||
local function hideStartRotateFunc()
|
||||
return data.animation.start.type ~= "custom" or data.animation.start.rotateType ~= "custom" or not (data.animation.start.use_rotate and WeakAuras.regions[id].region.Rotate)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "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 WeakAuras.regions[id].region.Color)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "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
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
|
||||
55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, nil, extraSetFunction);
|
||||
|
||||
local function hideMainTranslate()
|
||||
return data.animation.main.type ~= "custom" or data.animation.main.translateType ~= "custom" or not data.animation.main.use_translate
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
|
||||
59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, nil, extraSetFunction);
|
||||
|
||||
local function hideMainScale()
|
||||
return data.animation.main.type ~= "custom" or data.animation.main.scaleType ~= "custom" or not (data.animation.main.use_scale and WeakAuras.regions[id].region.Scale)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes",
|
||||
63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, nil, extraSetFunction);
|
||||
|
||||
local function hideMainRotateFunc()
|
||||
return data.animation.main.type ~= "custom" or data.animation.main.rotateType ~= "custom" or not (data.animation.main.use_rotate and WeakAuras.regions[id].region.Rotate)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
|
||||
67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, nil, extraSetFunction);
|
||||
|
||||
local function hideMainColorFunc()
|
||||
return data.animation.main.type ~= "custom" or data.animation.main.colorType ~= "custom" or not (data.animation.main.use_color and WeakAuras.regions[id].region.Color)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
|
||||
68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, nil, extraSetFunction);
|
||||
|
||||
-- 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
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "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
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "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 WeakAuras.regions[id].region.Scale)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
|
||||
83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false);
|
||||
|
||||
local function hideFinishRotateFunc()
|
||||
return data.animation.finish.type ~= "custom" or data.animation.finish.rotateType ~= "custom" or not (data.animation.finish.use_rotate and WeakAuras.regions[id].region.Rotate)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "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 WeakAuras.regions[id].region.Color)
|
||||
end
|
||||
WeakAuras.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
|
||||
WeakAuras.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
|
||||
88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false);
|
||||
|
||||
if(data.controlledChildren) then
|
||||
removeFuncs(animation);
|
||||
replaceNameDescFuncs(animation, data, "animation");
|
||||
replaceImageFuncs(animation, data, "animation");
|
||||
replaceValuesFuncs(animation, data, "animation");
|
||||
|
||||
animation.get = function(info, ...) return getAll(data, info, ...); end;
|
||||
animation.set = function(info, ...)
|
||||
setAll(data, info, ...);
|
||||
if(type(data.id) == "string") then
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end
|
||||
end
|
||||
animation.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
|
||||
animation.disabled = function(info, ...) return disabledAll(data, info, ...); end;
|
||||
end
|
||||
|
||||
return animation;
|
||||
end
|
||||
|
||||
@@ -407,7 +407,7 @@ local function set(data, option, key)
|
||||
childOption[key] = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -419,7 +419,7 @@ local function setUser(data, option)
|
||||
childConfig[option.key] = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -432,7 +432,7 @@ local function setStr(data, option, key)
|
||||
childOption[key] = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -457,7 +457,7 @@ local function setNum(data, option, key, required)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -472,7 +472,7 @@ local function setUserNum(data, option)
|
||||
childConfig[option.key] = num
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -486,7 +486,7 @@ local function setColor(data, option, key)
|
||||
childOption[key] = color
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -499,7 +499,7 @@ local function setUserColor(data, option)
|
||||
childConfig[option.key] = color
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -511,7 +511,7 @@ local function setSelectDefault(data, option, key)
|
||||
childOption.default = min(value, #childOption.values)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -524,7 +524,7 @@ local function setArrayStr(data, option, array, index)
|
||||
childOption[array][index] = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -553,7 +553,7 @@ typeControlAdders = {
|
||||
childOption.default = val
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
end,
|
||||
@@ -827,7 +827,7 @@ typeControlAdders = {
|
||||
end
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
args[prefix .. "valdelete" .. j] = {
|
||||
@@ -842,7 +842,7 @@ typeControlAdders = {
|
||||
tremove(childOption.values, j)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete",
|
||||
imageWidth = 24,
|
||||
@@ -880,7 +880,7 @@ typeControlAdders = {
|
||||
childOption.values[#childOption.values + 1] = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
end,
|
||||
@@ -963,7 +963,7 @@ typeControlAdders = {
|
||||
childOption.default[k] = v
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
for j, value in ipairs(values) do
|
||||
@@ -1006,7 +1006,7 @@ typeControlAdders = {
|
||||
end
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
args[prefix .. "valdelete" .. j] = {
|
||||
@@ -1022,7 +1022,7 @@ typeControlAdders = {
|
||||
tremove(childOption.default, j)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete",
|
||||
imageWidth = 24,
|
||||
@@ -1060,7 +1060,7 @@ typeControlAdders = {
|
||||
childOption.default[#childOption.default + 1] = false
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
end,
|
||||
@@ -1119,7 +1119,7 @@ typeControlAdders = {
|
||||
childOption.groupType = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
args[prefix .. "useCollapse"] = {
|
||||
@@ -1146,7 +1146,7 @@ typeControlAdders = {
|
||||
WeakAuras.SetCollapsed(id, "config", optionData.path, value)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function() return not option.useCollapse end
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ typeControlAdders = {
|
||||
childOption.limitType = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
}
|
||||
args[prefix .. "size"] = {
|
||||
@@ -1201,7 +1201,7 @@ typeControlAdders = {
|
||||
childOption.size = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function() return option.limitType == "none" end,
|
||||
}
|
||||
@@ -1270,7 +1270,7 @@ typeControlAdders = {
|
||||
end
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
}
|
||||
if option.nameSource == -1 then
|
||||
@@ -1322,7 +1322,7 @@ typeControlAdders = {
|
||||
WeakAuras.SetCollapsed(id, "author", path, false)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
args[prefix .. "groupEnd"] = {
|
||||
@@ -1352,7 +1352,7 @@ local function up(data, options, index)
|
||||
childOptions[optionID], childOptions[optionID - 1] = childOptions[optionID - 1], childOptions[optionID]
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1375,7 +1375,7 @@ local function down(data, options, index)
|
||||
childOptions[optionID], childOptions[optionID + 1] = childOptions[optionID + 1], childOptions[optionID]
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1407,7 +1407,7 @@ local function duplicate(data, options, index)
|
||||
tinsert(childOptions, optionID + 1, newOption)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1472,7 +1472,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
for id, optionData in pairs(option.references) do
|
||||
WeakAuras.SetCollapsed(id, "author", optionData.path, not collapsed)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or
|
||||
"Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse",
|
||||
@@ -1503,7 +1503,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\upright",
|
||||
imageWidth = 24,
|
||||
@@ -1532,7 +1532,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\downright",
|
||||
imageWidth = 24,
|
||||
@@ -1559,7 +1559,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.InsertCollapsed(id, "author", path)
|
||||
WeakAuras.Add(optionData.data)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\upleft",
|
||||
imageWidth = 24,
|
||||
@@ -1586,7 +1586,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.InsertCollapsed(id, "author", path)
|
||||
WeakAuras.Add(optionData.data)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\downleft",
|
||||
imageWidth = 24,
|
||||
@@ -1654,7 +1654,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
end
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete",
|
||||
imageWidth = 24,
|
||||
@@ -1730,7 +1730,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
|
||||
end
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
|
||||
@@ -1880,7 +1880,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
for id, optionData in pairs(option.references) do
|
||||
WeakAuras.SetCollapsed(id, "config", optionData.path, not collapsed)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or
|
||||
"Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse",
|
||||
@@ -1977,7 +1977,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
for id, optionData in pairs(option.references) do
|
||||
setPage(id, optionData.path, value) -- XXX: mergeOptions will reset this to the maximum value if it's too big
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
}
|
||||
args[prefix .. "resetEntry"] = {
|
||||
@@ -1993,7 +1993,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
childConfigList[childPage] = {}
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
width = 0.15,
|
||||
image = "Interface\\Addons\\WeakAuras\\Media\\Textures\\reset",
|
||||
@@ -2018,7 +2018,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function()
|
||||
if option.limitType == "none" then
|
||||
@@ -2055,7 +2055,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function()
|
||||
return skipSubOptions
|
||||
@@ -2084,7 +2084,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function()
|
||||
for id, optionData in pairs(option.references) do
|
||||
@@ -2115,7 +2115,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function()
|
||||
for id, optionData in pairs(option.references) do
|
||||
@@ -2189,7 +2189,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
optionData.config[option.key][k] = v
|
||||
WeakAuras.Add(optionData.data)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
elseif optionClass == "noninteractive" then
|
||||
@@ -2448,11 +2448,18 @@ local function createorder(startorder)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.GetAuthorOptions(data, args, startorder)
|
||||
function WeakAuras.GetAuthorOptions(data)
|
||||
-- initialize the process
|
||||
local authorOptions = {
|
||||
type = "group",
|
||||
name = L["Custom Options"],
|
||||
order = 100,
|
||||
args = {}
|
||||
}
|
||||
local args = authorOptions.args
|
||||
local isAuthorMode = true
|
||||
local options = {}
|
||||
local order = createorder(startorder)
|
||||
local order = createorder(1)
|
||||
if data.controlledChildren then
|
||||
-- merge options together
|
||||
for i = 1, #data.controlledChildren do
|
||||
@@ -2477,12 +2484,12 @@ function WeakAuras.GetAuthorOptions(data, args, startorder)
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(id)
|
||||
childData.authorMode = nil
|
||||
-- no need to add, author mode is picked up by ReloadTriggerOptions
|
||||
-- no need to add, author mode is picked up by ClearAndUpdateOptions
|
||||
end
|
||||
else
|
||||
data.authorMode = nil
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
args["enterUserModeSpacer"] = {
|
||||
@@ -2527,7 +2534,7 @@ function WeakAuras.GetAuthorOptions(data, args, startorder)
|
||||
WeakAuras.SetCollapsed(data.id, "author", i, false)
|
||||
WeakAuras.Add(data)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
else
|
||||
@@ -2558,7 +2565,7 @@ function WeakAuras.GetAuthorOptions(data, args, startorder)
|
||||
WeakAuras.ResetCollapsed(data.id, "config")
|
||||
WeakAuras.Add(data)
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
disabled = function()
|
||||
local path = {}
|
||||
@@ -2598,14 +2605,14 @@ function WeakAuras.GetAuthorOptions(data, args, startorder)
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(id)
|
||||
childData.authorMode = true
|
||||
-- no need to add, author mode is picked up by ReloadTriggerOptions
|
||||
-- no need to add, author mode is picked up by ClearAndUpdateOptions
|
||||
end
|
||||
else
|
||||
data.authorMode = true
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
}
|
||||
end
|
||||
return args
|
||||
return authorOptions
|
||||
end
|
||||
|
||||
@@ -55,15 +55,35 @@ local function getAuraMatchesList(name)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.GetBuffConversionOptions(data, optionTriggerChoices)
|
||||
local trigger;
|
||||
if (not data.controlledChildren) then
|
||||
local triggernum = optionTriggerChoices[data.id];
|
||||
if (triggernum) then
|
||||
trigger = data.triggers[triggernum].trigger;
|
||||
end
|
||||
end
|
||||
local function GetBuffTriggerOptions(data, triggernum)
|
||||
local trigger= data.triggers[triggernum].trigger
|
||||
local spellCache = WeakAuras.spellCache;
|
||||
local ValidateNumeric = WeakAuras.ValidateNumeric;
|
||||
local aura_options = {
|
||||
convertToBuffTrigger2SpaceBeforeDesc = {
|
||||
type = "description",
|
||||
width = 0.4,
|
||||
order = 8.1,
|
||||
name = "",
|
||||
},
|
||||
convertToBuffTrigger2Desc = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth - 0.8,
|
||||
order = 8.2,
|
||||
name = function()
|
||||
if (not WeakAuras.CanConvertBuffTrigger2) then
|
||||
return "";
|
||||
end
|
||||
local _, err = WeakAuras.CanConvertBuffTrigger2(trigger);
|
||||
return err or "";
|
||||
end,
|
||||
},
|
||||
convertToBuffTrigger2SpaceAfterDesc = {
|
||||
type = "description",
|
||||
width = 0.4,
|
||||
order = 8.3,
|
||||
name = "",
|
||||
},
|
||||
convertToBuffTrigger2SpaceBefore = {
|
||||
type = "description",
|
||||
width = 0.3,
|
||||
@@ -97,23 +117,10 @@ function WeakAuras.GetBuffConversionOptions(data, optionTriggerChoices)
|
||||
return err or ""
|
||||
end,
|
||||
func = function()
|
||||
if(data.controlledChildren) then
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
local trigger = childData.triggers[optionTriggerChoices[childId]] and childData.triggers[optionTriggerChoices[childId]].trigger;
|
||||
if (trigger) then
|
||||
WeakAuras.ConvertBuffTrigger2(trigger);
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.ReloadTriggerOptions(childData);
|
||||
end
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
else
|
||||
WeakAuras.ConvertBuffTrigger2(trigger);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
end
|
||||
WeakAuras.ConvertBuffTrigger2(trigger);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateDisplayButton(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
},
|
||||
convertToBuffTrigger2SpaceAfter = {
|
||||
@@ -121,63 +128,8 @@ function WeakAuras.GetBuffConversionOptions(data, optionTriggerChoices)
|
||||
width = 0.3,
|
||||
order = 8.6,
|
||||
name = "",
|
||||
hidden = function()
|
||||
-- For those that update without restarting
|
||||
return not WeakAuras.CanConvertBuffTrigger2
|
||||
end,
|
||||
},
|
||||
convertToBuffTrigger2SpaceBeforeDesc = {
|
||||
type = "description",
|
||||
width = 0.4,
|
||||
order = 8.1,
|
||||
name = "",
|
||||
hidden = function()
|
||||
-- For those that update without restarting
|
||||
return not WeakAuras.CanConvertBuffTrigger2
|
||||
end,
|
||||
},
|
||||
convertToBuffTrigger2Desc = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth - 0.8,
|
||||
order = 8.2,
|
||||
name = function()
|
||||
if (not WeakAuras.CanConvertBuffTrigger2) then
|
||||
return "";
|
||||
end
|
||||
local _, err = WeakAuras.CanConvertBuffTrigger2(trigger);
|
||||
return err or "";
|
||||
end,
|
||||
hidden = function()
|
||||
-- For those that update without restarting
|
||||
return not WeakAuras.CanConvertBuffTrigger2
|
||||
end,
|
||||
},
|
||||
convertToBuffTrigger2SpaceAfterDesc = {
|
||||
type = "description",
|
||||
width = 0.4,
|
||||
order = 8.3,
|
||||
name = "",
|
||||
hidden = function()
|
||||
-- For those that update without restarting
|
||||
return not WeakAuras.CanConvertBuffTrigger2
|
||||
end,
|
||||
},
|
||||
}
|
||||
return aura_options;
|
||||
end
|
||||
|
||||
local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
local trigger;
|
||||
if (not data.controlledChildren) then
|
||||
local triggernum = optionTriggerChoices[data.id];
|
||||
if (triggernum) then
|
||||
trigger = data.triggers[triggernum].trigger;
|
||||
end
|
||||
end
|
||||
|
||||
local spellCache = WeakAuras.spellCache;
|
||||
local ValidateNumeric = WeakAuras.ValidateNumeric;
|
||||
local aura_options = {
|
||||
fullscan = {
|
||||
type = "toggle",
|
||||
name = L["Use Full Scan (High CPU)"],
|
||||
@@ -240,7 +192,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -294,7 +245,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
else trigger.use_stealable = false end
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
end
|
||||
},
|
||||
use_spellId = {
|
||||
@@ -366,7 +316,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -402,7 +351,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -445,7 +393,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -488,7 +435,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -530,7 +476,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -573,7 +518,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -616,7 +560,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -659,7 +602,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -702,7 +644,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -745,7 +686,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
},
|
||||
@@ -839,7 +779,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
trigger.group_count = "";
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -1070,7 +1009,14 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
},
|
||||
|
||||
};
|
||||
return aura_options;
|
||||
|
||||
WeakAuras.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum)
|
||||
WeakAuras.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
|
||||
WeakAuras.AddTriggerMetaFunctions(aura_options, data, triggernum)
|
||||
|
||||
return {
|
||||
["trigger." .. triggernum .. ".legacy_aura_options"] = aura_options
|
||||
}
|
||||
end
|
||||
|
||||
WeakAuras.RegisterTriggerSystemOptions({"aura"}, GetBuffTriggerOptions);
|
||||
|
||||
@@ -8,7 +8,6 @@ local debuff_types = WeakAuras.debuff_types
|
||||
local function getAuraMatchesLabel(name)
|
||||
local ids = WeakAuras.spellCache.GetSpellsMatching(name)
|
||||
if ids then
|
||||
local descText = ""
|
||||
local numMatches = 0
|
||||
for id, _ in pairs(ids) do
|
||||
numMatches = numMatches + 1
|
||||
@@ -47,21 +46,11 @@ local function shiftTable(tbl, pos)
|
||||
end
|
||||
|
||||
-- Counts the Names or SpellIds in a aura, recursively.
|
||||
local function CountNames(data, optionTriggerChoices, name)
|
||||
local function CountNames(data, triggernum, name)
|
||||
local result = 0
|
||||
if data.controlledChildren then
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
local trigger = optionTriggerChoices[childId] and childData.triggers[optionTriggerChoices[childId]].trigger
|
||||
if trigger and trigger[name] then
|
||||
result = max(result, #trigger[name])
|
||||
end
|
||||
end
|
||||
else
|
||||
local trigger = optionTriggerChoices[data.id] and data.triggers[optionTriggerChoices[data.id]].trigger
|
||||
if trigger[name] then
|
||||
result = #trigger[name]
|
||||
end
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
if trigger[name] then
|
||||
result = #trigger[name]
|
||||
end
|
||||
return result
|
||||
end
|
||||
@@ -190,9 +179,8 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell
|
||||
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.UpdateThumbnail(data)
|
||||
WeakAuras.SetIconNames(data)
|
||||
WeakAuras.UpdateDisplayButton(data)
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end,
|
||||
validate = isExactSpellId and WeakAuras.ValidateNumeric or nil
|
||||
}
|
||||
@@ -200,16 +188,8 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell
|
||||
-- VALIDATE ?
|
||||
end
|
||||
|
||||
local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
local trigger
|
||||
if not data.controlledChildren then
|
||||
local triggernum = optionTriggerChoices[data.id]
|
||||
if triggernum then
|
||||
trigger = data.triggers[triggernum].trigger
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function GetBuffTriggerOptions(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
|
||||
local function HasMatchCount(trigger)
|
||||
if IsGroupTrigger(trigger) then
|
||||
@@ -601,7 +581,6 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
else trigger.use_stealable = false end
|
||||
end
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.SetIconNames(data)
|
||||
end
|
||||
},
|
||||
useAffected = {
|
||||
@@ -695,7 +674,7 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
},
|
||||
ignoreInvisible = {
|
||||
type = "toggle",
|
||||
name = WeakAuras.newFeatureString .. L["Ignore out of checking range."],
|
||||
name = WeakAuras.newFeatureString .. L["Ignore out of checking range"],
|
||||
desc = L["Uses UnitIsVisible() to check if in range. This is polled every second."],
|
||||
order = 68.9,
|
||||
width = WeakAuras.doubleWidth,
|
||||
@@ -733,6 +712,7 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
end
|
||||
},
|
||||
|
||||
|
||||
useGroup_count = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
@@ -943,10 +923,10 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
}
|
||||
|
||||
-- Names
|
||||
local nameOptionSize = CountNames(data, optionTriggerChoices, "auranames") + 1
|
||||
local spellOptionsSize = CountNames(data, optionTriggerChoices, "auraspellids") + 1
|
||||
local ignoreNameOptionSize = CountNames(data, optionTriggerChoices, "ignoreAuraNames") + 1
|
||||
local ignoreSpellOptionsSize = CountNames(data, optionTriggerChoices, "ignoreAuraSpellids") + 1
|
||||
local nameOptionSize = CountNames(data, triggernum, "auranames") + 1
|
||||
local spellOptionsSize = CountNames(data, triggernum, "auraspellids") + 1
|
||||
local ignoreNameOptionSize = CountNames(data, triggernum, "ignoreAuraNames") + 1
|
||||
local ignoreSpellOptionsSize = CountNames(data, triggernum, "ignoreAuraSpellids") + 1
|
||||
|
||||
CreateNameOptions(aura_options, data, trigger, nameOptionSize,
|
||||
false, false, "name", 12, "useName", "auranames",
|
||||
@@ -967,8 +947,14 @@ local function GetBuffTriggerOptions(data, optionTriggerChoices)
|
||||
true, true, "ignorespellid", 42, "useIgnoreExactSpellId", "ignoreAuraSpellids",
|
||||
L["Ignored Spell ID"], L["Enter a Spell ID"])
|
||||
|
||||
WeakAuras.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum)
|
||||
WeakAuras.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
|
||||
WeakAuras.AddTriggerMetaFunctions(aura_options, data, triggernum)
|
||||
|
||||
return aura_options
|
||||
|
||||
return {
|
||||
["trigger." .. triggernum .. ".aura_options"] = aura_options
|
||||
}
|
||||
end
|
||||
|
||||
WeakAuras.RegisterTriggerSystemOptions({"aura2"}, GetBuffTriggerOptions)
|
||||
|
||||
@@ -118,8 +118,9 @@ function spellCache.AddIcon(name, id, icon)
|
||||
if cache then
|
||||
if name then
|
||||
cache[name] = cache[name] or {}
|
||||
cache[name].spells = cache[name].spells or {}
|
||||
if id and icon then
|
||||
cache[name][id] = icon
|
||||
cache[name].spells[id] = icon
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -257,7 +257,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
elseif (property == "DELETE") then
|
||||
if (data.controlledChildren) then
|
||||
@@ -267,11 +267,11 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
tremove(auraData[conditionVariable][conditionIndex].changes, reference.changeIndex);
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
tremove(conditions[i].changes, j);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
return;
|
||||
end
|
||||
@@ -286,12 +286,12 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
conditions[i].changes[j].property = property;
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
conditions[i].changes[j].property = property;
|
||||
conditions[i].changes[j].value = default;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -310,7 +310,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
conditions[i].changes[j].value = v;
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
setValueColor = function(info, r, g, b, a)
|
||||
for id, reference in pairs(conditions[i].changes[j].references) do
|
||||
@@ -328,7 +328,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
conditions[i].changes[j].value[2] = g;
|
||||
conditions[i].changes[j].value[3] = b;
|
||||
conditions[i].changes[j].value[4] = a;
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
|
||||
setValueComplex = function(property, reloadOptions)
|
||||
@@ -346,10 +346,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
conditions[i].changes[j].value = {};
|
||||
end
|
||||
conditions[i].changes[j].value[property] = v;
|
||||
|
||||
if reloadOptions then
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
else
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -381,7 +380,7 @@ 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.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -406,7 +405,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
conditions[i].changes[j].value[property] = v;
|
||||
WeakAuras.Add(data);
|
||||
if reloadOptions then
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -696,6 +695,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
|
||||
local formatGet = function(key)
|
||||
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message_format_" .. key]
|
||||
end
|
||||
@@ -713,8 +713,10 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message_format_" .. key];
|
||||
end
|
||||
local originalName = option.name
|
||||
option.name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_format_" .. key, originalName, originalName)
|
||||
option.desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_format_" .. key, nil, option.values)
|
||||
if option.type ~= "header" then
|
||||
option.name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_format_" .. key, originalName, originalName)
|
||||
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
|
||||
@@ -722,14 +724,24 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
|
||||
args[fullKey] = option
|
||||
end
|
||||
|
||||
local hasTextFormatOption
|
||||
if data.controlledChildren then
|
||||
for id, reference in pairs(conditions[i].changes[j].references) do
|
||||
local input = reference.value and reference.value.message
|
||||
WeakAuras.AddTextFormatOption(input, false, formatGet, addOption)
|
||||
hasTextFormatOption = WeakAuras.AddTextFormatOption(input, true, formatGet, addOption)
|
||||
end
|
||||
else
|
||||
local input = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message"]
|
||||
WeakAuras.AddTextFormatOption(input, false, formatGet, addOption)
|
||||
hasTextFormatOption = WeakAuras.AddTextFormatOption(input, true, formatGet, addOption)
|
||||
end
|
||||
|
||||
if hasTextFormatOption then
|
||||
local footerOption = {
|
||||
type = "header",
|
||||
name = "",
|
||||
width = WeakAuras.doubleWidth
|
||||
}
|
||||
addOption("footer", footerOption)
|
||||
end
|
||||
|
||||
local function customHidden()
|
||||
@@ -1355,7 +1367,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -1368,7 +1380,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
else
|
||||
removeSubCheck(conditions[i].check, path);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -1387,7 +1399,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
childCheck.value = nil;
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
local oldType;
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
@@ -1403,7 +1415,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
check.value = nil;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end,
|
||||
get = function()
|
||||
@@ -1454,7 +1466,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
check.op = v;
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
setValue = function(info, v)
|
||||
check = getOrCreateSubCheck(conditions[i].check, path);
|
||||
@@ -1465,7 +1477,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
check.value = v;
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
else
|
||||
setOp = function(info, v)
|
||||
@@ -1667,7 +1679,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
else
|
||||
WeakAuras.SetCollapsed(data.id, "condition", i, not collapsed);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" ,
|
||||
imageWidth = 18,
|
||||
@@ -1705,14 +1717,14 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
if (i > 1) then
|
||||
local tmp = conditions[i];
|
||||
tremove(conditions, i);
|
||||
tinsert(conditions, i - 1, tmp);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
@@ -1754,7 +1766,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
else
|
||||
if (i < #conditions) then
|
||||
@@ -1762,7 +1774,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
tremove(conditions, i);
|
||||
tinsert(conditions, i + 1, tmp);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
end
|
||||
end
|
||||
@@ -1786,12 +1798,12 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
tremove(auraData[conditionVariable], reference.conditionIndex);
|
||||
WeakAuras.Add(auraData);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
else
|
||||
tremove(conditions, i);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
return;
|
||||
end
|
||||
end,
|
||||
@@ -1836,12 +1848,12 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
|
||||
tinsert(auradata[conditionVariable][reference.conditionIndex].changes, {})
|
||||
WeakAuras.Add(auradata);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
conditions[i].changes = conditions[i].changes or {};
|
||||
conditions[i].changes[#conditions[i].changes + 1] = {};
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -2313,7 +2325,19 @@ local function mergeConditions(all, aura, id, allConditionTemplates, propertyTyp
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.GetConditionOptions(data, args, conditionVariable, startorder, category)
|
||||
function WeakAuras.GetConditionOptions(data)
|
||||
local options = {
|
||||
type = "group",
|
||||
name = L["Conditions"],
|
||||
order = 25,
|
||||
args = {}
|
||||
}
|
||||
|
||||
local args = options.args
|
||||
|
||||
local conditionVariable = "conditions"
|
||||
local startorder = 0
|
||||
local category = nil
|
||||
-- Build potential Conditions Templates structure
|
||||
local conditionTemplates, conditionTemplateWithoutCombinations = createConditionTemplates(data);
|
||||
|
||||
@@ -2357,7 +2381,7 @@ function WeakAuras.GetConditionOptions(data, args, conditionVariable, startorder
|
||||
WeakAuras.SetCollapsed(id, "condition", #aura[conditionVariable], false);
|
||||
WeakAuras.Add(aura);
|
||||
end
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
else
|
||||
conditions[#conditions + 1] = {};
|
||||
conditions[#conditions].check = {};
|
||||
@@ -2366,11 +2390,11 @@ function WeakAuras.GetConditionOptions(data, args, conditionVariable, startorder
|
||||
conditions[#conditions].category = category;
|
||||
WeakAuras.SetCollapsed(data.id, "condition", #conditions, false);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadTriggerOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
return args;
|
||||
return options;
|
||||
end
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
local L = WeakAuras.L
|
||||
local regionOptions = WeakAuras.regionOptions
|
||||
|
||||
local flattenRegionOptions = WeakAuras.commonOptions.flattenRegionOptions
|
||||
local fixMetaOrders = WeakAuras.commonOptions.fixMetaOrders
|
||||
local parsePrefix = WeakAuras.commonOptions.parsePrefix
|
||||
local removeFuncs = WeakAuras.commonOptions.removeFuncs
|
||||
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
|
||||
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
|
||||
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
|
||||
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("region")
|
||||
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("region")
|
||||
local getAll = WeakAuras.commonOptions.CreateGetAll("region")
|
||||
local setAll = WeakAuras.commonOptions.CreateSetAll("region", getAll)
|
||||
|
||||
local function AddSubRegionImpl(data, subRegionName)
|
||||
data.subRegions = data.subRegions or {}
|
||||
if WeakAuras.subRegionTypes[subRegionName] and WeakAuras.subRegionTypes[subRegionName] then
|
||||
if WeakAuras.subRegionTypes[subRegionName].supports(data.regionType) then
|
||||
local default = WeakAuras.subRegionTypes[subRegionName].default
|
||||
local subRegionData = type(default) == "function" and default(data.regionType) or CopyTable(default)
|
||||
subRegionData.type = subRegionName
|
||||
tinsert(data.subRegions, subRegionData)
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function AddSubRegion(data, subRegionName)
|
||||
if (WeakAuras.ApplyToDataOrChildData(data, AddSubRegionImpl, subRegionName)) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
local function AddOptionsForSupportedSubRegion(regionOption, data, supported)
|
||||
if not next(supported) then
|
||||
return
|
||||
end
|
||||
local hasSubRegions = false
|
||||
|
||||
local result = {}
|
||||
local order = 1
|
||||
result.__order = 300
|
||||
result.__title = L["Add Extra Elements"]
|
||||
result.__topLine = true
|
||||
for subRegionType in pairs(supported) do
|
||||
if WeakAuras.subRegionTypes[subRegionType].supportsAdd then
|
||||
hasSubRegions = true
|
||||
result[subRegionType .. "space"] = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = "",
|
||||
order = order,
|
||||
}
|
||||
order = order + 1
|
||||
result[subRegionType] = {
|
||||
type = "execute",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = string.format(L["Add %s"], WeakAuras.subRegionTypes[subRegionType].displayName),
|
||||
order = order,
|
||||
func = function()
|
||||
AddSubRegion(data, subRegionType)
|
||||
end,
|
||||
}
|
||||
order = order + 1
|
||||
end
|
||||
end
|
||||
regionOption["sub"] = result;
|
||||
return hasSubRegions
|
||||
end
|
||||
|
||||
local function union(table1, table2)
|
||||
local meta = {};
|
||||
for i,v in pairs(table1) do
|
||||
meta[i] = v;
|
||||
end
|
||||
for i,v in pairs(table2) do
|
||||
meta[i] = v;
|
||||
end
|
||||
return meta;
|
||||
end
|
||||
|
||||
function WeakAuras.GetDisplayOptions(data)
|
||||
local id = data.id
|
||||
|
||||
if not data.controlledChildren then
|
||||
local regionOption;
|
||||
local commonOption = {};
|
||||
|
||||
local hasSubElements = false
|
||||
|
||||
if(regionOptions[data.regionType]) then
|
||||
regionOption = regionOptions[data.regionType].create(id, data);
|
||||
|
||||
if data.subRegions then
|
||||
local subIndex = {}
|
||||
for index, subRegionData in ipairs(data.subRegions) do
|
||||
local subRegionType = subRegionData.type
|
||||
if WeakAuras.subRegionOptions[subRegionType] then
|
||||
hasSubElements = true
|
||||
subIndex[subRegionType] = subIndex[subRegionType] and subIndex[subRegionType] + 1 or 1
|
||||
local options, common = WeakAuras.subRegionOptions[subRegionType].create(data, subRegionData, index, subIndex[subRegionType])
|
||||
options.__order = 200 + index
|
||||
regionOption["sub." .. index .. "." .. subRegionType] = options
|
||||
commonOption[subRegionType] = common
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local commonOptionIndex = 0
|
||||
for option, optionData in pairs(commonOption) do
|
||||
commonOptionIndex = commonOptionIndex + 1
|
||||
optionData.__order = 100 + commonOptionIndex
|
||||
regionOption[option] = optionData
|
||||
end
|
||||
|
||||
local supported = {}
|
||||
for subRegionName, subRegionType in pairs(WeakAuras.subRegionTypes) do
|
||||
if subRegionType.supports(data.regionType) then
|
||||
supported[subRegionName] = true
|
||||
end
|
||||
end
|
||||
hasSubElements = AddOptionsForSupportedSubRegion(regionOption, data, supported) or hasSubElements
|
||||
else
|
||||
regionOption = {
|
||||
[data.regionType] = {
|
||||
__title = "|cFFFFFF00" .. data.regionType,
|
||||
__order = 1,
|
||||
unsupported = {
|
||||
type = "description",
|
||||
name = L["This region of type \"%s\" is not supported."]:format(data.regionType),
|
||||
order = 2,
|
||||
}
|
||||
}
|
||||
};
|
||||
end
|
||||
|
||||
if hasSubElements then
|
||||
regionOption["SubElementsHeader"] = {
|
||||
__order = 100,
|
||||
__noHeader = true,
|
||||
header = {
|
||||
type = "header",
|
||||
name = L["Sub Elements"],
|
||||
order = 1
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
local options = flattenRegionOptions(regionOption, true)
|
||||
|
||||
local region = {
|
||||
type = "group",
|
||||
name = L["Display"],
|
||||
order = 10,
|
||||
get = function(info)
|
||||
local base, property = parsePrefix(info[#info], data);
|
||||
if not base then
|
||||
return nil
|
||||
end
|
||||
if(info.type == "color") then
|
||||
base[property] = base[property] or {};
|
||||
local c = base[property];
|
||||
return c[1], c[2], c[3], c[4];
|
||||
else
|
||||
return base[property];
|
||||
end
|
||||
end,
|
||||
set = function(info, v, g, b, a)
|
||||
local base, property = parsePrefix(info[#info], data, true);
|
||||
if(info.type == "color") then
|
||||
base[property] = base[property] or {};
|
||||
local c = base[property];
|
||||
c[1], c[2], c[3], c[4] = v, g, b, a;
|
||||
elseif(info.type == "toggle") then
|
||||
base[property] = v;
|
||||
else
|
||||
base[property] = (v ~= "" and v) or nil;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
if(data.parent) then
|
||||
local parentData = WeakAuras.GetData(data.parent);
|
||||
if(parentData) then
|
||||
WeakAuras.Add(parentData);
|
||||
end
|
||||
end
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end,
|
||||
args = options
|
||||
};
|
||||
return region
|
||||
else
|
||||
-- Multiple Auras
|
||||
-- We call the create functions of the relevant region types with
|
||||
-- the parentData once per region type
|
||||
-- For sub regions, the relevant create function is called with the parentData
|
||||
-- once per index/sub region type
|
||||
local handledRegionTypes = {}
|
||||
local handledSubRegionTypes = {}
|
||||
|
||||
local allOptions = {};
|
||||
local commonOption = {};
|
||||
local unsupportedCount = 0
|
||||
local supportedSubRegions = {}
|
||||
local hasSubElements = false
|
||||
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if childData and not handledRegionTypes[childData.regionType] then
|
||||
handledRegionTypes[childData.regionType] = true;
|
||||
if regionOptions[childData.regionType] then
|
||||
allOptions = union(allOptions, regionOptions[childData.regionType].create(id, data));
|
||||
else
|
||||
unsupportedCount = unsupportedCount + 1
|
||||
allOptions["__unsupported" .. unsupportedCount] = {
|
||||
__title = "|cFFFFFF00" .. childData.regionType,
|
||||
__order = 1,
|
||||
warning = {
|
||||
type = "description",
|
||||
name = L["Regions of type \"%s\" are not supported."]:format(childData.regionType),
|
||||
order = 1
|
||||
},
|
||||
}
|
||||
end
|
||||
for subRegionName, subRegionType in pairs(WeakAuras.subRegionTypes) do
|
||||
if subRegionType.supports(childData.regionType) then
|
||||
supportedSubRegions[subRegionName] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
if childData.subRegions then
|
||||
local subIndex = {}
|
||||
for index, subRegionData in ipairs(childData.subRegions) do
|
||||
local subRegionType = subRegionData.type
|
||||
local alreadyHandled = handledSubRegionTypes[index] and handledSubRegionTypes[index][subRegionType]
|
||||
if WeakAuras.subRegionOptions[subRegionType] and not alreadyHandled then
|
||||
handledSubRegionTypes[index] = handledSubRegionTypes[index] or {}
|
||||
handledSubRegionTypes[index][subRegionType] = true
|
||||
hasSubElements = true
|
||||
subIndex[subRegionType] = subIndex[subRegionType] and subIndex[subRegionType] + 1 or 1
|
||||
|
||||
local options, common = WeakAuras.subRegionOptions[subRegionType].create(data, nil, index, subIndex[subRegionType])
|
||||
options.__order = 200 + index
|
||||
|
||||
allOptions["sub." .. index .. "." .. subRegionType] = options
|
||||
commonOption[subRegionType] = common
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local commonOptionIndex = 0
|
||||
for option, optionData in pairs(commonOption) do
|
||||
commonOptionIndex = commonOptionIndex + 1
|
||||
optionData.__order = 100 + commonOptionIndex
|
||||
allOptions[option] = optionData
|
||||
end
|
||||
|
||||
hasSubElements = AddOptionsForSupportedSubRegion(allOptions, data, supportedSubRegions) or hasSubElements
|
||||
|
||||
if hasSubElements then
|
||||
allOptions["SubElementsHeader"] = {
|
||||
__order = 100,
|
||||
__noHeader = true,
|
||||
header = {
|
||||
order = 1,
|
||||
type = "header",
|
||||
name = L["Sub Elements"],
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
fixMetaOrders(allOptions);
|
||||
|
||||
local region = {
|
||||
type = "group",
|
||||
name = L["Display"],
|
||||
order = 10,
|
||||
args = flattenRegionOptions(allOptions, false);
|
||||
};
|
||||
|
||||
removeFuncs(region);
|
||||
replaceNameDescFuncs(region, data, "region");
|
||||
replaceImageFuncs(region, data, "region");
|
||||
replaceValuesFuncs(region, data, "region");
|
||||
|
||||
region.get = function(info, ...) return getAll(data, info, ...); end;
|
||||
region.set = function(info, ...)
|
||||
setAll(data, info, ...);
|
||||
if(type(data.id) == "string") then
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end
|
||||
end
|
||||
region.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
|
||||
region.disabled = function(info, ...) return disabledAll(data, info, ...); end;
|
||||
return region
|
||||
end
|
||||
|
||||
end
|
||||
@@ -69,7 +69,7 @@ function WeakAuras.CreateImportButtons()
|
||||
local button = WeakAuras.GetDisplayButton(groupId);
|
||||
button.callbacks.UpdateExpandButton();
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.ReloadGroupRegionOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -171,7 +171,7 @@ function WeakAuras.CreateImportButtons()
|
||||
local button = WeakAuras.GetDisplayButton(id);
|
||||
button.callbacks.UpdateExpandButton();
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.ReloadGroupRegionOptions(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
|
||||
WeakAuras.ScanForLoads();
|
||||
@@ -331,7 +331,7 @@ function WeakAuras.DisableAddonDisplay(id)
|
||||
end
|
||||
end
|
||||
WeakAuras.Add(parentData);
|
||||
WeakAuras.ReloadGroupRegionOptions(parentData);
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id);
|
||||
WeakAuras.UpdateDisplayButton(parentData);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,58 +11,23 @@ local subevent_suffix_types = WeakAuras.subevent_suffix_types;
|
||||
local custom_trigger_types = WeakAuras.custom_trigger_types;
|
||||
local eventend_types = WeakAuras.eventend_types;
|
||||
|
||||
local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
local function GetCustomTriggerOptions(data, triggernum)
|
||||
local id = data.id;
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
local function appendToTriggerPath(...)
|
||||
local ret = {...};
|
||||
tinsert(ret, 1, "trigger");
|
||||
tinsert(ret, 1, triggernum);
|
||||
tinsert(ret, 1, "triggers");
|
||||
return ret;
|
||||
end
|
||||
|
||||
local appendToTriggerPath, appendToUntriggerPath;
|
||||
|
||||
if (data.controlledChildren) then
|
||||
function appendToTriggerPath(...)
|
||||
local baseRet = {...};
|
||||
local result = {};
|
||||
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
local ret = {};
|
||||
WeakAuras.DeepCopy(baseRet, ret);
|
||||
local optionTriggerChoice = optionTriggerChoices[childId];
|
||||
tinsert(ret, 1, "trigger");
|
||||
tinsert(ret, 1, optionTriggerChoice)
|
||||
tinsert(ret, 1, "triggers")
|
||||
result[childId] = ret;
|
||||
end
|
||||
return result;
|
||||
end
|
||||
function appendToUntriggerPath(...)
|
||||
local baseRet = {...};
|
||||
local result = {};
|
||||
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
local ret = {};
|
||||
WeakAuras.DeepCopy(baseRet, ret);
|
||||
local optionTriggerChoice = optionTriggerChoices[childId];
|
||||
tinsert(ret, 1, "untrigger");
|
||||
tinsert(ret, 1, optionTriggerChoice);
|
||||
tinsert(ret, 1, "triggers");
|
||||
result[childId] = ret;
|
||||
end
|
||||
return result;
|
||||
end
|
||||
else
|
||||
function appendToTriggerPath(...)
|
||||
local ret = {...};
|
||||
tinsert(ret, 1, "trigger");
|
||||
tinsert(ret, 1, optionTriggerChoices[id]);
|
||||
tinsert(ret, 1, "triggers");
|
||||
return ret;
|
||||
end
|
||||
|
||||
function appendToUntriggerPath(...)
|
||||
local ret = {...};
|
||||
tinsert(ret, 1, "untrigger");
|
||||
tinsert(ret, 1, optionTriggerChoices[id]);
|
||||
tinsert(ret, 1, "triggers");
|
||||
return ret;
|
||||
end
|
||||
local function appendToUntriggerPath(...)
|
||||
local ret = {...};
|
||||
tinsert(ret, 1, "untrigger");
|
||||
tinsert(ret, 1, triggernum);
|
||||
tinsert(ret, 1, "triggers");
|
||||
return ret;
|
||||
end
|
||||
|
||||
local customOptions =
|
||||
@@ -74,12 +39,14 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
width = WeakAuras.doubleWidth,
|
||||
values = custom_trigger_types,
|
||||
hidden = function() return not (trigger.type == "custom") end,
|
||||
get = function(info)
|
||||
return trigger.custom_type
|
||||
end,
|
||||
set = function(info, v)
|
||||
trigger.custom_type = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.ReloadOptions(data.id);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
},
|
||||
check = {
|
||||
@@ -96,7 +63,6 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.check = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -114,7 +80,6 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.check = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -131,7 +96,6 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.events = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -146,7 +110,6 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.events = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -218,7 +181,6 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.custom_hide = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -233,7 +195,6 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.custom_hide = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
},
|
||||
@@ -246,9 +207,8 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
set = function(info, v)
|
||||
trigger.dynamicDuration = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.ReloadOptions(data.id);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
},
|
||||
duration = {
|
||||
@@ -279,57 +239,45 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
return true;
|
||||
end,
|
||||
func = function()
|
||||
if (data.controlledChildren) then
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
for i = 1, 7 do
|
||||
if (childData.trigger["customOverlay" .. i] == nil) then
|
||||
childData.trigger["customOverlay" .. i] = "";
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, 7 do
|
||||
if (trigger["customOverlay" .. i] == nil) then
|
||||
trigger["customOverlay" .. i] = "";
|
||||
break;
|
||||
end
|
||||
for i = 1, 7 do
|
||||
if (trigger["customOverlay" .. i] == nil) then
|
||||
trigger["customOverlay" .. i] = "";
|
||||
break;
|
||||
end
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
}
|
||||
};
|
||||
|
||||
local function extraSetFunction()
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end
|
||||
|
||||
local function extraSetFunctionReload()
|
||||
extraSetFunction();
|
||||
WeakAuras.ReloadOptions(data.id);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
|
||||
local function hideCustomTrigger()
|
||||
return not (trigger.type == "custom")
|
||||
end
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Custom Trigger"], "custom_trigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger",
|
||||
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Trigger"], "custom_trigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger",
|
||||
10, hideCustomTrigger, appendToTriggerPath("custom"), false, true, extraSetFunction, nil, true);
|
||||
|
||||
local function hideCustomVariables()
|
||||
return not (trigger.type == "custom" and trigger.custom_type == "stateupdate");
|
||||
end
|
||||
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Custom Variables"], "custom_variables", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables",
|
||||
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Variables"], "custom_variables", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables",
|
||||
11, hideCustomVariables, appendToTriggerPath("customVariables"), false, true, extraSetFunctionReload, nil, true);
|
||||
|
||||
local function hideCustomUntrigger()
|
||||
return not (trigger.type == "custom"
|
||||
and (trigger.custom_type == "status" or (trigger.custom_type == "event" and trigger.custom_hide == "custom")))
|
||||
end
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Custom Untrigger"], "custom_untrigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger",
|
||||
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Untrigger"], "custom_untrigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger",
|
||||
14, hideCustomUntrigger, appendToUntriggerPath("custom"), false, true, extraSetFunction);
|
||||
|
||||
local function hideCustomDuration()
|
||||
@@ -337,7 +285,7 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
and (trigger.custom_type == "status"
|
||||
or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration))))
|
||||
end
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Duration Info"], "custom_duration", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info",
|
||||
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Duration Info"], "custom_duration", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info",
|
||||
16, hideCustomDuration, appendToTriggerPath("customDuration"), false, true, extraSetFunctionReload);
|
||||
|
||||
local function hideIfTriggerStateUpdate()
|
||||
@@ -353,23 +301,11 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
end
|
||||
|
||||
local function removeOverlay()
|
||||
if (data.controlledChildren) then
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
for j = i, 7 do
|
||||
childData.trigger["customOverlay" .. j] = childData.trigger["customOverlay" .. (j +1)];
|
||||
end
|
||||
WeakAuras.ScheduleReloadOptions(childData);
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ScheduleReloadOptions(data);
|
||||
else
|
||||
for j = i, 7 do
|
||||
trigger["customOverlay" .. j] = trigger["customOverlay" .. (j +1)];
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ScheduleReloadOptions(data);
|
||||
for j = i, 7 do
|
||||
trigger["customOverlay" .. j] = trigger["customOverlay" .. (j +1)];
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
|
||||
local extraFunctions = {
|
||||
@@ -379,34 +315,27 @@ local function GetCustomTriggerOptions(data, optionTriggerChoices, trigger)
|
||||
}
|
||||
}
|
||||
|
||||
WeakAuras.AddCodeOption(customOptions, data, string.format(L["Overlay %s Info"], i), "custom_overlay" .. i, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#overlay-info",
|
||||
WeakAuras.commonOptions.AddCodeOption(customOptions, data, string.format(L["Overlay %s Info"], i), "custom_overlay" .. i, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#overlay-info",
|
||||
17 + i / 10, hideOverlay, appendToTriggerPath("customOverlay" .. i), false, true, extraSetFunctionReload, extraFunctions);
|
||||
end
|
||||
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info",
|
||||
WeakAuras.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, true, extraSetFunctionReload);
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info",
|
||||
WeakAuras.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, true, extraSetFunction);
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info",
|
||||
WeakAuras.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, true, extraSetFunction);
|
||||
WeakAuras.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info",
|
||||
WeakAuras.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, true, extraSetFunctionReload);
|
||||
|
||||
return customOptions;
|
||||
end
|
||||
|
||||
local function GetGenericTriggerOptions(data, optionTriggerChoices)
|
||||
local function GetGenericTriggerOptions(data, triggernum)
|
||||
local id = data.id;
|
||||
|
||||
local trigger;
|
||||
local triggerType;
|
||||
if (data.controlledChildren) then
|
||||
triggerType = WeakAuras.getAll(data, {"trigger", "type"});
|
||||
else
|
||||
local triggernum = optionTriggerChoices[id];
|
||||
trigger = data.triggers[triggernum].trigger;
|
||||
triggerType = trigger.type;
|
||||
end
|
||||
local trigger = data.triggers[triggernum].trigger;
|
||||
local triggerType = trigger.type;
|
||||
|
||||
local options = {
|
||||
event = {
|
||||
@@ -421,23 +350,37 @@ local function GetGenericTriggerOptions(data, optionTriggerChoices)
|
||||
order = 7,
|
||||
width = WeakAuras.doubleWidth,
|
||||
values = function()
|
||||
local type;
|
||||
if (data.controlledChildren) then
|
||||
type = WeakAuras.getAll(data, {"trigger", "type"});
|
||||
else
|
||||
type = trigger.type;
|
||||
end
|
||||
local type= trigger.type;
|
||||
if(type == "event") then
|
||||
return event_types;
|
||||
elseif(type == "status") then
|
||||
return status_types;
|
||||
end
|
||||
end,
|
||||
get = function(info)
|
||||
return trigger.event
|
||||
end,
|
||||
set = function(info, v)
|
||||
trigger.event = v
|
||||
local prototype = WeakAuras.event_prototypes[v];
|
||||
if(prototype) then
|
||||
if(prototype.automaticrequired) then
|
||||
trigger.unevent = "auto";
|
||||
else
|
||||
trigger.unevent = "timed";
|
||||
end
|
||||
end
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end,
|
||||
control = "WeakAurasSortedDropdown",
|
||||
hidden = function() return not (trigger.type == "event" or trigger.type == "status"); end
|
||||
},
|
||||
}
|
||||
|
||||
WeakAuras.commonOptions.AddCommonTriggerOptions(options, data, triggernum)
|
||||
WeakAuras.AddTriggerMetaFunctions(options, data, triggernum)
|
||||
|
||||
local combatLogOptions =
|
||||
{
|
||||
subeventPrefix = {
|
||||
@@ -447,7 +390,14 @@ local function GetGenericTriggerOptions(data, optionTriggerChoices)
|
||||
order = 8,
|
||||
values = subevent_prefix_types,
|
||||
control = "WeakAurasSortedDropdown",
|
||||
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log"); end
|
||||
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log"); end,
|
||||
get = function(info)
|
||||
return trigger.subeventPrefix
|
||||
end,
|
||||
set = function(info, v)
|
||||
trigger.subeventPrefix = v
|
||||
WeakAuras.Add(data)
|
||||
end
|
||||
},
|
||||
subeventSuffix = {
|
||||
type = "select",
|
||||
@@ -456,7 +406,10 @@ local function GetGenericTriggerOptions(data, optionTriggerChoices)
|
||||
order = 9,
|
||||
values = subevent_suffix_types,
|
||||
control = "WeakAurasSortedDropdown",
|
||||
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log" and subevent_actual_prefix_types[trigger.subeventPrefix]); end
|
||||
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log" and subevent_actual_prefix_types[trigger.subeventPrefix]); end,
|
||||
get = function(info)
|
||||
return trigger.subevent
|
||||
end
|
||||
},
|
||||
spacer_suffix = {
|
||||
type = "description",
|
||||
@@ -467,36 +420,27 @@ local function GetGenericTriggerOptions(data, optionTriggerChoices)
|
||||
}
|
||||
|
||||
if (triggerType == "custom") then
|
||||
WeakAuras:Mixin(options, GetCustomTriggerOptions(data, optionTriggerChoices, trigger));
|
||||
WeakAuras:Mixin(options, GetCustomTriggerOptions(data, triggernum, trigger));
|
||||
elseif (triggerType == "status" or triggerType == "event") then
|
||||
local prototypeOptions;
|
||||
if (data.controlledChildren) then
|
||||
local event = WeakAuras.getAll(data, {"trigger", "event"});
|
||||
local unevent = WeakAuras.getAll(data, {"trigger", "unevent"});
|
||||
if(event and WeakAuras.event_prototypes[event]) then
|
||||
prototypeOptions = WeakAuras.ConstructOptions(WeakAuras.event_prototypes[event], data, 10, optionTriggerChoices[id], nil, unevent);
|
||||
if (event == "Combat Log") then
|
||||
WeakAuras:Mixin(prototypeOptions, combatLogOptions);
|
||||
end
|
||||
local trigger, untrigger = data.triggers[triggernum].trigger, data.triggers[triggernum].untrigger;
|
||||
if(WeakAuras.event_prototypes[trigger.event]) then
|
||||
prototypeOptions = WeakAuras.ConstructOptions(WeakAuras.event_prototypes[trigger.event], data, 10, triggernum);
|
||||
if (trigger.event == "Combat Log") then
|
||||
WeakAuras:Mixin(prototypeOptions, combatLogOptions);
|
||||
end
|
||||
else
|
||||
local triggerNum = optionTriggerChoices[id];
|
||||
local trigger, untrigger = data.triggers[triggerNum].trigger, data.triggers[triggerNum].untrigger;
|
||||
if(WeakAuras.event_prototypes[trigger.event]) then
|
||||
prototypeOptions = WeakAuras.ConstructOptions(WeakAuras.event_prototypes[trigger.event], data, 10, optionTriggerChoices[id]);
|
||||
if (trigger.event == "Combat Log") then
|
||||
WeakAuras:Mixin(prototypeOptions, combatLogOptions);
|
||||
end
|
||||
else
|
||||
print("|cFF8800FFWeakAuras|r: No prototype for", trigger.event);
|
||||
end
|
||||
print("|cFF8800FFWeakAuras|r: No prototype for", trigger.event);
|
||||
end
|
||||
if (prototypeOptions) then
|
||||
WeakAuras:Mixin(options, prototypeOptions);
|
||||
end
|
||||
end
|
||||
|
||||
return options;
|
||||
|
||||
return {
|
||||
["trigger." .. triggernum .. "." .. (trigger.event or "unknown")] = options
|
||||
}
|
||||
end
|
||||
|
||||
WeakAuras.RegisterTriggerSystemOptions({"event", "status", "custom"}, GetGenericTriggerOptions);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
local L = WeakAuras.L
|
||||
local regionOptions = WeakAuras.regionOptions;
|
||||
local parsePrefix = WeakAuras.commonOptions.parsePrefix
|
||||
local flattenRegionOptions = WeakAuras.commonOptions.flattenRegionOptions
|
||||
|
||||
function WeakAuras.GetGroupOptions(data)
|
||||
local regionOption;
|
||||
local id = data.id
|
||||
if (regionOptions[data.regionType]) then
|
||||
regionOption = regionOptions[data.regionType].create(id, data);
|
||||
else
|
||||
regionOption = {
|
||||
[data.regionType] = {
|
||||
__title = "|cFFFFFF00" .. data.regionType,
|
||||
__order = 1,
|
||||
unsupported = {
|
||||
type = "description",
|
||||
name = L["This region of type \"%s\" is not supported."]:format(data.regionType)
|
||||
}
|
||||
};
|
||||
};
|
||||
end
|
||||
|
||||
local groupOptions = {
|
||||
type = "group",
|
||||
name = L["Group Options"],
|
||||
order = 0,
|
||||
get = function(info)
|
||||
local base, property = parsePrefix(info[#info], data);
|
||||
if not base then
|
||||
return nil
|
||||
end
|
||||
if(info.type == "color") then
|
||||
base[property] = base[property] or {};
|
||||
local c = base[property];
|
||||
return c[1], c[2], c[3], c[4];
|
||||
else
|
||||
return base[property];
|
||||
end
|
||||
end,
|
||||
set = function(info, v, g, b, a)
|
||||
local base, property = parsePrefix(info[#info], data, true);
|
||||
if(info.type == "color") then
|
||||
base[property] = base[property] or {};
|
||||
local c = base[property];
|
||||
c[1], c[2], c[3], c[4] = v, g, b, a;
|
||||
elseif(info.type == "toggle") then
|
||||
base[property] = v;
|
||||
else
|
||||
base[property] = (v ~= "" and v) or nil;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end,
|
||||
hidden = function() return false end,
|
||||
disabled = function() return false end,
|
||||
args = flattenRegionOptions(regionOption, true);
|
||||
}
|
||||
|
||||
return groupOptions
|
||||
end
|
||||
@@ -0,0 +1,893 @@
|
||||
local L = WeakAuras.L
|
||||
|
||||
local removeFuncs = WeakAuras.commonOptions.removeFuncs
|
||||
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
|
||||
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
|
||||
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
|
||||
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("load")
|
||||
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("load")
|
||||
local getAll = WeakAuras.commonOptions.CreateGetAll("load")
|
||||
local setAll = WeakAuras.commonOptions.CreateSetAll("load", getAll)
|
||||
|
||||
local operator_types = WeakAuras.operator_types;
|
||||
local operator_types_without_equal = WeakAuras.operator_types_without_equal;
|
||||
local string_operator_types = WeakAuras.string_operator_types;
|
||||
local ValidateNumeric = WeakAuras.ValidateNumeric;
|
||||
local eventend_types = WeakAuras.eventend_types;
|
||||
local timedeventend_types = WeakAuras.timedeventend_types;
|
||||
local autoeventend_types = WeakAuras.autoeventend_types;
|
||||
|
||||
|
||||
local spellCache = WeakAuras.spellCache;
|
||||
|
||||
local function union(table1, table2)
|
||||
local meta = {};
|
||||
for i,v in pairs(table1) do
|
||||
meta[i] = v;
|
||||
end
|
||||
for i,v in pairs(table2) do
|
||||
meta[i] = v;
|
||||
end
|
||||
return meta;
|
||||
end
|
||||
|
||||
-- Also used by the GenericTrigger
|
||||
function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, triggertype, unevent)
|
||||
local trigger, untrigger;
|
||||
if(data.controlledChildren) then
|
||||
trigger, untrigger = {}, {};
|
||||
elseif(triggertype == "load") then
|
||||
trigger = data.load;
|
||||
elseif data.triggers[triggernum] then
|
||||
if(triggertype == "untrigger") then
|
||||
trigger = data.triggers[triggernum].untrigger
|
||||
else
|
||||
trigger, untrigger = data.triggers[triggernum].trigger, data.triggers[triggernum].untrigger
|
||||
end
|
||||
else
|
||||
error("Improper argument to WeakAuras.ConstructOptions - trigger number not in range");
|
||||
end
|
||||
unevent = unevent or trigger.unevent;
|
||||
local options = {};
|
||||
local order = startorder or 10;
|
||||
|
||||
local isCollapsedFunctions;
|
||||
for index, arg in pairs(prototype.args) do
|
||||
local hidden = nil;
|
||||
if(arg.collapse and isCollapsedFunctions[arg.collapse] and type(arg.enable) == "function") then
|
||||
local isCollapsed = isCollapsedFunctions[arg.collapse]
|
||||
hidden = function()
|
||||
return isCollapsed() or not arg.enable(trigger)
|
||||
end
|
||||
elseif(type(arg.enable) == "function") then
|
||||
hidden = function() return not arg.enable(trigger) end;
|
||||
elseif(arg.collapse and isCollapsedFunctions[arg.collapse]) then
|
||||
hidden = isCollapsedFunctions[arg.collapse]
|
||||
end
|
||||
local name = arg.name;
|
||||
local validate = arg.validate;
|
||||
local reloadOptions = arg.reloadOptions;
|
||||
if (name and arg.type == "collapse") then
|
||||
options["summary_" .. arg.name] = {
|
||||
type = "execute",
|
||||
control = "WeakAurasExpandSmall",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = type(arg.display) == "function" and arg.display(trigger) or arg.display,
|
||||
order = order,
|
||||
image = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true)
|
||||
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
func = function(info, button, secondCall)
|
||||
if not secondCall then
|
||||
local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true)
|
||||
WeakAuras.SetCollapsed("trigger", name, "", not collapsed)
|
||||
end
|
||||
end,
|
||||
}
|
||||
order = order + 1;
|
||||
|
||||
isCollapsedFunctions = isCollapsedFunctions or {};
|
||||
isCollapsedFunctions[name] = function()
|
||||
return WeakAuras.IsCollapsed("trigger", name, "", true);
|
||||
end
|
||||
elseif(name and not arg.hidden) then
|
||||
local realname = name;
|
||||
if(triggertype == "untrigger") then
|
||||
name = "untrigger_"..name;
|
||||
end
|
||||
if (arg.type == "multiselect") then
|
||||
-- Ensure new line for non-toggle options
|
||||
options["spacer_"..name] = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = "",
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
}
|
||||
order = order + 1;
|
||||
end
|
||||
if(arg.type == "tristate" or arg.type == "tristatestring") then
|
||||
options["use_"..name] = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = function(input)
|
||||
local value = trigger["use_"..realname];
|
||||
if(value == nil) then return arg.display;
|
||||
elseif(value == false) then return "|cFFFF0000 "..L["Negator"].." "..arg.display;
|
||||
else return "|cFF00FF00"..arg.display; end
|
||||
end,
|
||||
desc = arg.desc,
|
||||
get = function()
|
||||
local value = trigger["use_"..realname];
|
||||
if(value == nil) then return false;
|
||||
elseif(value == false) then return "false";
|
||||
else return "true"; end
|
||||
end,
|
||||
set = function(info, v)
|
||||
if(v) then
|
||||
trigger["use_"..realname] = true;
|
||||
else
|
||||
local value = trigger["use_"..realname];
|
||||
if(value == false) then
|
||||
trigger["use_"..realname] = nil;
|
||||
else
|
||||
trigger["use_"..realname] = false
|
||||
end
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end,
|
||||
hidden = hidden,
|
||||
order = order
|
||||
};
|
||||
elseif(arg.type == "multiselect") then
|
||||
options["use_"..name] = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = arg.display,
|
||||
desc = function()
|
||||
local v = trigger["use_"..realname];
|
||||
if(v == true) then
|
||||
return L["Multiselect single tooltip"];
|
||||
elseif(v == false) then
|
||||
return L["Multiselect multiple tooltip"];
|
||||
else
|
||||
return L["Multiselect ignored tooltip"];
|
||||
end
|
||||
end,
|
||||
get = function()
|
||||
local value = trigger["use_"..realname];
|
||||
if(value == nil) then return false;
|
||||
elseif(value == false) then return "false";
|
||||
else return "true"; end
|
||||
end,
|
||||
set = function(info, v)
|
||||
if(v) then
|
||||
trigger["use_"..realname] = true;
|
||||
else
|
||||
local value = trigger["use_"..realname];
|
||||
if(value == false) then
|
||||
trigger["use_"..realname] = nil;
|
||||
else
|
||||
trigger["use_"..realname] = false
|
||||
trigger[realname] = trigger[realname] or {};
|
||||
if(trigger[realname].single) then
|
||||
trigger[realname].multi = trigger[realname].multi or {};
|
||||
trigger[realname].multi[trigger[realname].single] = true;
|
||||
end
|
||||
end
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end,
|
||||
hidden = hidden,
|
||||
order = order
|
||||
};
|
||||
elseif (arg.type == "description") then
|
||||
options["description_space_"..name] = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = "",
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
}
|
||||
options["description_title_"..name] = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
fontSize = "large",
|
||||
}
|
||||
order = order + 1;
|
||||
options["description_"..name] = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = arg.text,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
}
|
||||
order = order + 1;
|
||||
else
|
||||
options["use_"..name] = {
|
||||
type = "toggle",
|
||||
width = arg.width or WeakAuras.normalWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
desc = arg.desc,
|
||||
get = function() return trigger["use_"..realname]; end,
|
||||
set = function(info, v)
|
||||
trigger["use_"..realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
end
|
||||
if(arg.type == "toggle" or arg.type == "tristate") then
|
||||
options["use_"..name].width = arg.width or WeakAuras.doubleWidth;
|
||||
end
|
||||
if(arg.type == "toggle") then
|
||||
options["use_"..name].desc = arg.desc;
|
||||
end
|
||||
if(arg.required) then
|
||||
trigger["use_"..realname] = true;
|
||||
if not(triggertype) then
|
||||
options["use_"..name].disabled = true;
|
||||
else
|
||||
options["use_"..name] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
end
|
||||
order = order + 1;
|
||||
if(arg.type == "number") then
|
||||
if (not arg.noOperator) then
|
||||
options[name.."_operator"] = {
|
||||
type = "select",
|
||||
width = WeakAuras.halfWidth,
|
||||
name = L["Operator"],
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
values = arg.operator_types_without_equal and operator_types_without_equal or operator_types,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function() return trigger["use_"..realname] and trigger[realname.."_operator"] or nil; end,
|
||||
set = function(info, v)
|
||||
trigger[realname.."_operator"] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name.."_operator"].set = function(info, v)
|
||||
trigger[realname.."_operator"] = v;
|
||||
untrigger[realname.."_operator"] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
elseif(arg.required and triggertype == "untrigger") then
|
||||
options[name.."_operator"] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
order = order + 1;
|
||||
end
|
||||
options[name] = {
|
||||
type = "input",
|
||||
width = arg.noOperator and WeakAuras.normalWidth or WeakAuras.halfWidth,
|
||||
validate = ValidateNumeric,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
desc = arg.desc,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function() return trigger["use_"..realname] and trigger[realname] or nil; end,
|
||||
set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name].set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
untrigger[realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
elseif(arg.required and triggertype == "untrigger") then
|
||||
options[name] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
order = order + 1;
|
||||
elseif(arg.type == "string" or arg.type == "tristatestring") then
|
||||
options[name] = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
validate = validate,
|
||||
desc = arg.desc,
|
||||
set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
|
||||
if arg.type == "string" then
|
||||
options[name].disabled = function() return not trigger["use_"..realname] end
|
||||
options[name].get = function() return trigger["use_"..realname] and trigger[realname] or nil; end
|
||||
else
|
||||
options[name].disabled = function() return trigger["use_"..realname] == nil end
|
||||
options[name].get = function() return trigger["use_"..realname] ~= nil and trigger[realname] or nil; end
|
||||
end
|
||||
|
||||
if(arg.required and not triggertype) then
|
||||
options[name].set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
untrigger[realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
elseif(arg.required and triggertype == "untrigger") then
|
||||
options[name] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
order = order + 1;
|
||||
elseif(arg.type == "longstring") then
|
||||
options[name.."_operator"] = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Operator"],
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
values = string_operator_types,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function() return trigger["use_"..realname] and trigger[realname.."_operator"] or nil; end,
|
||||
set = function(info, v)
|
||||
trigger[realname.."_operator"] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name.."_operator"].set = function(info, v)
|
||||
trigger[realname.."_operator"] = v;
|
||||
untrigger[realname.."_operator"] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
elseif(arg.required and triggertype == "untrigger") then
|
||||
options[name.."_operator"] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
order = order + 1;
|
||||
options[name] = {
|
||||
type = "input",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
validate = validate,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function() return trigger["use_"..realname] and trigger[realname] or nil; end,
|
||||
set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name].set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
untrigger[realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
elseif(arg.required and triggertype == "untrigger") then
|
||||
options[name] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
order = order + 1;
|
||||
elseif(arg.type == "spell" or arg.type == "aura" or arg.type == "item") then
|
||||
if(not arg.required or triggertype ~= "untrigger") then
|
||||
if (arg.showExactOption) then
|
||||
options["exact"..name] = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth - 0.1,
|
||||
name = L["Exact Spell Match"],
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
get = function()
|
||||
return trigger["use_exact_"..realname];
|
||||
end,
|
||||
set = function(info, v)
|
||||
trigger["use_exact_"..realname] = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end,
|
||||
};
|
||||
order = order + 1;
|
||||
end
|
||||
options["icon"..name] = {
|
||||
type = "execute",
|
||||
width = 0.1,
|
||||
name = "",
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
image = function()
|
||||
if(trigger["use_"..realname] and trigger[realname]) then
|
||||
if(arg.type == "aura") then
|
||||
local icon = spellCache.GetIcon(trigger[realname]);
|
||||
return icon and tostring(icon) or "", 18, 18;
|
||||
elseif(arg.type == "spell") then
|
||||
local _, _, icon = GetSpellInfo(trigger[realname]);
|
||||
return icon and tostring(icon) or "", 18, 18;
|
||||
elseif(arg.type == "item") then
|
||||
local _, _, _, _, _, _, _, _, _, icon = GetItemInfo(trigger[realname]);
|
||||
return icon and tostring(icon) or "", 18, 18;
|
||||
end
|
||||
else
|
||||
return "", 18, 18;
|
||||
end
|
||||
end,
|
||||
disabled = function() return not ((arg.type == "aura" and trigger[realname] and spellCache.GetIcon(trigger[realname])) or (arg.type == "spell" and trigger[realname] and GetSpellInfo(trigger[realname])) or (arg.type == "item" and trigger[realname] and GetItemIcon(trigger[realname]))) end
|
||||
};
|
||||
order = order + 1;
|
||||
options[name] = {
|
||||
type = "input",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
validate = validate,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function()
|
||||
if(arg.type == "item") then
|
||||
if(trigger["use_"..realname] and trigger[realname] and trigger[realname] ~= "") then
|
||||
local name = GetItemInfo(trigger[realname]);
|
||||
if(name) then
|
||||
return name;
|
||||
else
|
||||
local itemId = tonumber(trigger[realname])
|
||||
if itemId and itemId ~= 0 then
|
||||
return tostring(trigger[realname])
|
||||
end
|
||||
return L["Invalid Item Name/ID/Link"];
|
||||
end
|
||||
else
|
||||
return nil;
|
||||
end
|
||||
elseif(arg.type == "spell") then
|
||||
local useExactSpellId = (arg.showExactOption and trigger["use_exact_"..realname]) or arg.forceExactOption
|
||||
if(trigger["use_"..realname]) then
|
||||
if (trigger[realname] and trigger[realname] ~= "") then
|
||||
if useExactSpellId then
|
||||
local spellId = tonumber(trigger[realname])
|
||||
if (spellId and spellId ~= 0) then
|
||||
return tostring(spellId);
|
||||
end
|
||||
else
|
||||
local name = GetSpellInfo(trigger[realname]);
|
||||
if(name) then
|
||||
return name;
|
||||
end
|
||||
end
|
||||
end
|
||||
return useExactSpellId and L["Invalid Spell ID"] or L["Invalid Spell Name/ID/Link"];
|
||||
else
|
||||
return nil;
|
||||
end
|
||||
else
|
||||
return trigger["use_"..realname] and trigger[realname] or nil;
|
||||
end
|
||||
end,
|
||||
set = function(info, v)
|
||||
local fixedInput = v;
|
||||
if(arg.type == "aura") then
|
||||
fixedInput = WeakAuras.spellCache.CorrectAuraName(v);
|
||||
elseif(arg.type == "spell") then
|
||||
fixedInput = WeakAuras.CorrectSpellName(v);
|
||||
elseif(arg.type == "item") then
|
||||
fixedInput = WeakAuras.CorrectItemName(v);
|
||||
end
|
||||
trigger[realname] = fixedInput;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
order = order + 1;
|
||||
end
|
||||
elseif(arg.type == "select" or arg.type == "unit") then
|
||||
local values;
|
||||
if(type(arg.values) == "function") then
|
||||
values = arg.values(trigger);
|
||||
else
|
||||
values = WeakAuras[arg.values];
|
||||
end
|
||||
options[name] = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
hidden = hidden,
|
||||
values = values,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function()
|
||||
if(arg.type == "unit" and trigger["use_specific_"..realname]) then
|
||||
return "member";
|
||||
end
|
||||
|
||||
if (not trigger["use_"..realname]) then
|
||||
return nil;
|
||||
end
|
||||
|
||||
if (arg.default and (not trigger[realname] or not values[trigger[realname]])) then
|
||||
trigger[realname] = arg.default;
|
||||
return arg.default;
|
||||
end
|
||||
|
||||
return trigger[realname] or nil;
|
||||
end,
|
||||
set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
if(arg.type == "unit" and v == "member") then
|
||||
trigger["use_specific_"..realname] = true;
|
||||
trigger[realname] = UnitName("player");
|
||||
else
|
||||
trigger["use_specific_"..realname] = nil;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name].set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
if(arg.type == "unit" and v == "member") then
|
||||
trigger["use_specific_"..realname] = true;
|
||||
else
|
||||
trigger["use_specific_"..realname] = nil;
|
||||
end
|
||||
untrigger[realname] = v;
|
||||
if(arg.type == "unit" and v == "member") then
|
||||
untrigger["use_specific_"..realname] = true;
|
||||
else
|
||||
untrigger["use_specific_"..realname] = nil;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
elseif(arg.required and triggertype == "untrigger") then
|
||||
options[name] = nil;
|
||||
order = order - 1;
|
||||
end
|
||||
if (arg.control) then
|
||||
options[name].control = arg.control;
|
||||
end
|
||||
order = order + 1;
|
||||
if(arg.type == "unit" and not (arg.required and triggertype == "untrigger")) then
|
||||
options["use_specific_"..name] = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Specific Unit"],
|
||||
order = order,
|
||||
hidden = function() return (not trigger["use_specific_"..realname] and trigger[realname] ~= "member") or (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) end,
|
||||
get = function() return true end,
|
||||
set = function(info, v)
|
||||
trigger["use_specific_"..realname] = nil;
|
||||
options[name].set(info, "player");
|
||||
end
|
||||
}
|
||||
order = order + 1;
|
||||
options["specific_"..name] = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Specific Unit"],
|
||||
desc = L["Can be a UID (e.g., party1)."],
|
||||
order = order,
|
||||
hidden = function() return (not trigger["use_specific_"..realname] and trigger[realname] ~= "member") or (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) end,
|
||||
get = function() return trigger[realname] end,
|
||||
set = function(info, v)
|
||||
trigger[realname] = v;
|
||||
if(arg.required and not triggertype) then
|
||||
untrigger[realname] = v;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
};
|
||||
order = order + 1;
|
||||
end
|
||||
elseif(arg.type == "multiselect") then
|
||||
local values;
|
||||
if(type(arg.values) == "function") then
|
||||
values = arg.values(trigger);
|
||||
else
|
||||
values = WeakAuras[arg.values];
|
||||
end
|
||||
options[name] = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = arg.display,
|
||||
order = order,
|
||||
values = values,
|
||||
control = arg.control,
|
||||
hidden = function()
|
||||
return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_"..realname] == false;
|
||||
end,
|
||||
disabled = function() return not trigger["use_"..realname]; end,
|
||||
get = function() return trigger["use_"..realname] and trigger[realname] and trigger[realname].single or nil; end,
|
||||
set = function(info, v)
|
||||
trigger[realname] = trigger[realname] or {};
|
||||
trigger[realname].single = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name].set = function(info, v)
|
||||
trigger[realname].single = v;
|
||||
untrigger[realname].single = v;
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
end
|
||||
|
||||
options["multiselect_"..name] = {
|
||||
type = "multiselect",
|
||||
name = arg.display,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = order,
|
||||
hidden = function() return (type(hidden) == "function" and hidden(trigger)) or (type(hidden) ~= "function" and hidden) or trigger["use_"..realname] ~= false; end,
|
||||
values = values,
|
||||
get = function(info, v)
|
||||
if(trigger["use_"..realname] == false and trigger[realname] and trigger[realname].multi) then
|
||||
return trigger[realname].multi[v];
|
||||
end
|
||||
end,
|
||||
set = function(info, v, calledFromSetAll)
|
||||
trigger[realname].multi = trigger[realname].multi or {};
|
||||
if (calledFromSetAll) then
|
||||
trigger[realname].multi[v] = calledFromSetAll;
|
||||
elseif(trigger[realname].multi[v]) then
|
||||
trigger[realname].multi[v] = nil;
|
||||
else
|
||||
trigger[realname].multi[v] = true;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
};
|
||||
if(arg.required and not triggertype) then
|
||||
options[name].set = function(info, v)
|
||||
if(trigger[realname].multi[v]) then
|
||||
trigger[realname].multi[v] = nil;
|
||||
else
|
||||
trigger[realname].multi[v] = true;
|
||||
end
|
||||
if(untrigger[realname].multi[v]) then
|
||||
untrigger[realname].multi[v] = nil;
|
||||
else
|
||||
untrigger[realname].multi[v] = true;
|
||||
end
|
||||
WeakAuras.Add(data);
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end
|
||||
end
|
||||
|
||||
if(arg.required and triggertype == "untrigger") then
|
||||
options[name] = nil;
|
||||
options["multiselect_"..name] = nil;
|
||||
else
|
||||
order = order + 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not(triggertype or prototype.automaticrequired) then
|
||||
options.unevent = {
|
||||
type = "select",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Hide"],
|
||||
order = order
|
||||
};
|
||||
order = order + 1;
|
||||
if(unevent == "timed") then
|
||||
options.unevent.width = WeakAuras.normalWidth;
|
||||
options.duration = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Duration (s)"],
|
||||
order = order
|
||||
}
|
||||
order = order + 1;
|
||||
else
|
||||
options.unevent.width = WeakAuras.doubleWidth;
|
||||
end
|
||||
|
||||
if(unevent == "custom") then
|
||||
local unevent_options = WeakAuras.ConstructOptions(prototype, data, order, triggernum, "untrigger");
|
||||
options = union(options, unevent_options);
|
||||
end
|
||||
if (prototype.timedrequired) then
|
||||
if (type(prototype.timedrequired) == "function") then
|
||||
local func = prototype.timedrequired
|
||||
options.unevent.values = function()
|
||||
if func(trigger) then
|
||||
return timedeventend_types
|
||||
else
|
||||
return eventend_types
|
||||
end
|
||||
end
|
||||
else
|
||||
options.unevent.values = timedeventend_types;
|
||||
end
|
||||
elseif (prototype.automatic) then
|
||||
options.unevent.values = autoeventend_types;
|
||||
else
|
||||
options.unevent.values = eventend_types;
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.option = options;
|
||||
return options;
|
||||
end
|
||||
|
||||
function WeakAuras.GetLoadOptions(data)
|
||||
local load = {
|
||||
type = "group",
|
||||
name = L["Load"],
|
||||
order = 0,
|
||||
get = function(info) return data.load[info[#info]] end,
|
||||
set = function(info, v)
|
||||
data.load[info[#info]] = (v ~= "" and v) or nil;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ScanForLoads({[data.id] = true});
|
||||
WeakAuras.SortDisplayButtons();
|
||||
end,
|
||||
args = {}
|
||||
}
|
||||
|
||||
load.args = WeakAuras.ConstructOptions(WeakAuras.load_prototype, data, 10, nil, "load");
|
||||
|
||||
if(data.controlledChildren) then
|
||||
removeFuncs(load);
|
||||
replaceNameDescFuncs(load, data, "load");
|
||||
replaceImageFuncs(load, data, "load");
|
||||
replaceValuesFuncs(load, data, "load");
|
||||
|
||||
load.get = function(info, ...) return getAll(data, info, ...); end;
|
||||
load.set = function(info, ...)
|
||||
setAll(data, info, ...);
|
||||
if(type(data.id) == "string") then
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end
|
||||
end
|
||||
load.hidden = function(info, ...) return hiddenAll(data, info, ...); end;
|
||||
load.disabled = function(info, ...) return disabledAll(data, info, ...); end;
|
||||
end
|
||||
return load
|
||||
end
|
||||
@@ -39,8 +39,8 @@ function WeakAuras.StartFrameChooser(data, path)
|
||||
frameChooserFrame:SetScript("OnUpdate", function()
|
||||
if(IsMouseButtonDown("RightButton")) then
|
||||
valueToPath(data, path, givenValue);
|
||||
AceConfigDialog:Open("WeakAuras", frame.container);
|
||||
WeakAuras.StopFrameChooser(data);
|
||||
WeakAuras.FillOptions()
|
||||
elseif(IsMouseButtonDown("LeftButton") and oldFocusName) then
|
||||
WeakAuras.StopFrameChooser(data);
|
||||
else
|
||||
@@ -76,7 +76,7 @@ function WeakAuras.StartFrameChooser(data, path)
|
||||
if(focusName ~= oldFocusName) then
|
||||
valueToPath(data, path, focusName);
|
||||
oldFocusName = focusName;
|
||||
AceConfigDialog:Open("WeakAuras", frame.container);
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
oldFocus = focus;
|
||||
end
|
||||
|
||||
@@ -126,14 +126,12 @@ local function ConstructIconPicker(frame)
|
||||
childData[self.field] = texturePath;
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.UpdateThumbnail(childData);
|
||||
WeakAuras.SetIconNames(childData);
|
||||
end
|
||||
end
|
||||
else
|
||||
self.data[self.field] = texturePath;
|
||||
WeakAuras.Add(self.data);
|
||||
WeakAuras.UpdateThumbnail(self.data);
|
||||
WeakAuras.SetIconNames(self.data);
|
||||
end
|
||||
local success = icon:SetTexture(texturePath) and texturePath;
|
||||
if(success) then
|
||||
@@ -167,7 +165,7 @@ local function ConstructIconPicker(frame)
|
||||
function group.Close()
|
||||
frame.window = "default";
|
||||
frame:UpdateFrameVisible()
|
||||
AceConfigDialog:Open("WeakAuras", frame.container);
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
|
||||
function group.CancelClose()
|
||||
@@ -178,7 +176,6 @@ local function ConstructIconPicker(frame)
|
||||
childData[group.field] = group.givenPath[childId] or childData[group.field];
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.UpdateThumbnail(childData);
|
||||
WeakAuras.SetIconNames(childData);
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -101,7 +101,6 @@ local function ConstructModelPicker(frame)
|
||||
childData.model_y = model_y;
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.UpdateThumbnail(childData);
|
||||
WeakAuras.SetIconNames(childData);
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -115,7 +114,6 @@ local function ConstructModelPicker(frame)
|
||||
else
|
||||
WeakAuras.Add(self.data);
|
||||
WeakAuras.UpdateThumbnail(self.data);
|
||||
WeakAuras.SetIconNames(self.data);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -166,7 +164,7 @@ local function ConstructModelPicker(frame)
|
||||
function group.Close()
|
||||
frame.window = "default"
|
||||
frame:UpdateFrameVisible()
|
||||
AceConfigDialog:Open("WeakAuras", frame.container);
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
|
||||
function group.CancelClose(self)
|
||||
@@ -180,7 +178,6 @@ local function ConstructModelPicker(frame)
|
||||
childData.model_y = group.givenY[childId];
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.UpdateThumbnail(childData);
|
||||
WeakAuras.SetIconNames(childData);
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -51,7 +51,7 @@ local function moveOnePxl(direction)
|
||||
WeakAuras.Add(parentData)
|
||||
end
|
||||
end
|
||||
WeakAuras.ReloadOptions(data.id)
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -614,7 +614,7 @@ local function ConstructMoverSizer(parent)
|
||||
WeakAuras.Add(parentData)
|
||||
end
|
||||
end
|
||||
AceConfigDialog:Open("WeakAuras", parent.container)
|
||||
WeakAuras.FillOptions()
|
||||
WeakAuras.Animate("display", data, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
|
||||
-- hide alignment lines
|
||||
frame.lineY:Hide()
|
||||
@@ -669,7 +669,7 @@ local function ConstructMoverSizer(parent)
|
||||
region:ResetPosition()
|
||||
WeakAuras.Add(data, nil, true)
|
||||
frame:ScaleCorners(region:GetWidth(), region:GetHeight())
|
||||
AceConfigDialog:Open("WeakAuras", parent.container)
|
||||
WeakAuras.FillOptions()
|
||||
end)
|
||||
|
||||
mover.align = BuildAlignLines(mover)
|
||||
@@ -734,7 +734,7 @@ local function ConstructMoverSizer(parent)
|
||||
end
|
||||
frame.text:Hide()
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
AceConfigDialog:Open("WeakAuras", parent.container)
|
||||
WeakAuras.FillOptions()
|
||||
WeakAuras.Animate("display", data, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
|
||||
-- hide alignment lines
|
||||
frame.lineY:Hide()
|
||||
|
||||
@@ -17,12 +17,12 @@ local WeakAuras = WeakAuras
|
||||
local L = WeakAuras.L
|
||||
|
||||
local displayButtons = WeakAuras.displayButtons
|
||||
local displayOptions = WeakAuras.displayOptions
|
||||
local loaded = WeakAuras.loaded
|
||||
local regionOptions = WeakAuras.regionOptions
|
||||
local savedVars = WeakAuras.savedVars
|
||||
local tempGroup = WeakAuras.tempGroup
|
||||
local prettyPrint = WeakAuras.prettyPrint
|
||||
local aceOptions = WeakAuras.aceOptions
|
||||
|
||||
local function CreateDecoration(frame)
|
||||
local deco = CreateFrame("Frame", nil, frame)
|
||||
@@ -726,14 +726,144 @@ function WeakAuras.CreateFrame()
|
||||
unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"])
|
||||
frame.unloadedButton = unloadedButton
|
||||
|
||||
frame.FillOptions = function(self, optionTable, selected)
|
||||
AceConfig:RegisterOptionsTable("WeakAuras", optionTable)
|
||||
AceConfigDialog:Open("WeakAuras", container)
|
||||
-- TODO: remove this once legacy aura trigger is removed
|
||||
if selected then
|
||||
container.content.obj.children[1]:SelectTab(selected)
|
||||
|
||||
frame.ClearOptions = function(self, id)
|
||||
aceOptions[id] = nil
|
||||
if type(id) == "string" then
|
||||
local data = WeakAuras.GetData(id)
|
||||
if data and data.parent then
|
||||
frame:ClearOptions(data.parent)
|
||||
end
|
||||
for _, tmpId in ipairs(tempGroup.controlledChildren) do
|
||||
if (id == tmpId) then
|
||||
frame:ClearOptions(tempGroup.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
container:SetTitle("")
|
||||
end
|
||||
|
||||
frame.ClearAndUpdateOptions = function(self, id, clearChildren)
|
||||
frame:ClearOptions(id)
|
||||
|
||||
if clearChildren then
|
||||
local data
|
||||
if type(id) == "string" then
|
||||
data = WeakAuras.GetData(id)
|
||||
elseif self.pickedDisplay then
|
||||
data = tempGroup
|
||||
end
|
||||
|
||||
if data.controlledChildren then
|
||||
for _, id in ipairs(data.controlledChildren) do
|
||||
frame:ClearOptions(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
if (type(self.pickedDisplay) == "string" and self.pickedDisplay == id)
|
||||
or (type(self.pickedDisplay == "table") and id == tempGroup.id)
|
||||
then
|
||||
frame:UpdateOptions()
|
||||
end
|
||||
end
|
||||
|
||||
frame.UpdateOptions = function(self)
|
||||
self.selectedTab = self.selectedTab or "region"
|
||||
local data
|
||||
if type(self.pickedDisplay) == "string" then
|
||||
data = WeakAuras.GetData(frame.pickedDisplay)
|
||||
elseif self.pickedDisplay then
|
||||
data = tempGroup
|
||||
end
|
||||
|
||||
if not data.controlledChildren or data == tempGroup then
|
||||
if self.selectedTab == "group" then
|
||||
self.selectedTab = "region"
|
||||
end
|
||||
end
|
||||
|
||||
local optionTable = self:EnsureOptions(data, self.selectedTab)
|
||||
if optionTable then
|
||||
AceConfig:RegisterOptionsTable("WeakAuras", optionTable)
|
||||
end
|
||||
end
|
||||
|
||||
frame.GetSubOptions = function(self, id, tab)
|
||||
return aceOptions[id] and aceOptions[id][tab]
|
||||
end
|
||||
|
||||
frame.EnsureOptions = function(self, data, tab)
|
||||
local id = data.id
|
||||
aceOptions[id] = aceOptions[id] or {}
|
||||
if not aceOptions[id][tab] then
|
||||
local optionsGenerator =
|
||||
{
|
||||
group = WeakAuras.GetGroupOptions,
|
||||
region = WeakAuras.GetDisplayOptions,
|
||||
trigger = WeakAuras.GetTriggerOptions,
|
||||
conditions = WeakAuras.GetConditionOptions,
|
||||
load = WeakAuras.GetLoadOptions,
|
||||
action = WeakAuras.GetActionOptions,
|
||||
animation = WeakAuras.GetAnimationOptions,
|
||||
authorOptions = WeakAuras.GetAuthorOptions
|
||||
}
|
||||
if optionsGenerator[tab] then
|
||||
aceOptions[id][tab] = optionsGenerator[tab](data)
|
||||
end
|
||||
end
|
||||
return aceOptions[id][tab]
|
||||
end
|
||||
|
||||
-- This function refills the options pane
|
||||
-- This is ONLY necessary if AceOptions doesn't know that it should do
|
||||
-- that automatically. That is any change that goes through the AceOptions
|
||||
-- doesn't need to call this
|
||||
-- Any changes to the options that go around that, e.g. drag/drop, group,
|
||||
-- texture pick, etc should call this
|
||||
frame.FillOptions = function(self)
|
||||
frame:UpdateOptions()
|
||||
|
||||
local data
|
||||
if type(self.pickedDisplay) == "string" then
|
||||
data = WeakAuras.GetData(frame.pickedDisplay)
|
||||
elseif self.pickedDisplay then
|
||||
data = tempGroup
|
||||
end
|
||||
|
||||
local tabsWidget
|
||||
|
||||
container:ReleaseChildren()
|
||||
container:SetLayout("Fill")
|
||||
tabsWidget = AceGUI:Create("TabGroup")
|
||||
|
||||
local tabs = {
|
||||
{ value = "region", text = L["Display"]},
|
||||
{ value = "trigger", text = L["Trigger"]},
|
||||
{ value = "conditions", text = L["Conditions"]},
|
||||
{ value = "load", text = L["Load"]},
|
||||
{ value = "action", text = L["Actions"]},
|
||||
{ value = "animation", text = L["Animations"]},
|
||||
{ value = "authorOptions", text = L["Custom Options"]}
|
||||
}
|
||||
-- Check if group and not the temp group
|
||||
if data.controlledChildren and type(data.id) == "string" then
|
||||
tinsert(tabs, 1, { value = "group", text = L["Group"]})
|
||||
end
|
||||
|
||||
tabsWidget:SetTabs(tabs)
|
||||
tabsWidget:SelectTab(self.selectedTab)
|
||||
tabsWidget:SetLayout("Fill")
|
||||
container:AddChild(tabsWidget)
|
||||
|
||||
local group = AceGUI:Create("WeakAurasInlineGroup")
|
||||
tabsWidget:AddChild(group)
|
||||
|
||||
tabsWidget:SetCallback("OnGroupSelected", function(self, event, tab)
|
||||
frame.selectedTab = tab
|
||||
frame:FillOptions()
|
||||
end)
|
||||
|
||||
AceConfigDialog:Open("WeakAuras", group)
|
||||
tabsWidget:SetTitle("")
|
||||
end
|
||||
|
||||
frame.ClearPick = function(self, id)
|
||||
@@ -748,8 +878,8 @@ function WeakAuras.CreateFrame()
|
||||
tremove(tempGroup.controlledChildren, index)
|
||||
displayButtons[id]:ClearPick()
|
||||
|
||||
WeakAuras.AddOption(tempGroup.id, tempGroup)
|
||||
self:FillOptions(displayOptions[tempGroup.id])
|
||||
self:ClearOptions(tempGroup.id)
|
||||
self:FillOptions()
|
||||
end
|
||||
|
||||
frame.ClearPicks = function(self, noHide)
|
||||
@@ -936,73 +1066,55 @@ function WeakAuras.CreateFrame()
|
||||
end
|
||||
end
|
||||
|
||||
frame.PickDisplay = function(self, id, tab, noHide) -- TODO: remove tab parametter once legacy aura trigger is removed
|
||||
frame.PickDisplay = function(self, id, tab, noHide)
|
||||
if self.pickedDisplay == id then
|
||||
return
|
||||
end
|
||||
self:ClearPicks(noHide)
|
||||
local data = WeakAuras.GetData(id)
|
||||
|
||||
local function finishPicking()
|
||||
displayButtons[id]:Pick()
|
||||
self.pickedDisplay = id
|
||||
local data = db.displays[id]
|
||||
-- Expand parent + loaded/unloaded if needed
|
||||
if data.parent then
|
||||
if not displayButtons[data.parent]:GetExpanded() then
|
||||
displayButtons[data.parent]:Expand()
|
||||
end
|
||||
end
|
||||
if loaded[id] ~= nil then
|
||||
-- Under loaded
|
||||
if not loadedButton:GetExpanded() then
|
||||
loadedButton:Expand()
|
||||
end
|
||||
else
|
||||
-- Under Unloaded
|
||||
if not unloadedButton:GetExpanded() then
|
||||
unloadedButton:Expand()
|
||||
end
|
||||
end
|
||||
displayButtons[id]:Pick()
|
||||
self.pickedDisplay = id
|
||||
|
||||
WeakAuras.AddOption(data.id, data)
|
||||
self:FillOptions(displayOptions[id], tab) -- TODO: remove tab parametter once legacy aura trigger is removed
|
||||
|
||||
WeakAuras.SetMoverSizer(id)
|
||||
|
||||
local _, _, _, _, yOffset = displayButtons[id].frame:GetPoint(1)
|
||||
if not yOffset then
|
||||
yOffset = displayButtons[id].frame.yOffset
|
||||
if data.parent then
|
||||
if not displayButtons[data.parent]:GetExpanded() then
|
||||
displayButtons[data.parent]:Expand()
|
||||
end
|
||||
if yOffset then
|
||||
self.buttonsScroll:SetScrollPos(yOffset, yOffset - 32)
|
||||
end
|
||||
if loaded[id] ~= nil then
|
||||
-- Under loaded
|
||||
if not loadedButton:GetExpanded() then
|
||||
loadedButton:Expand()
|
||||
end
|
||||
if data.controlledChildren then
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
displayButtons[childId]:PriorityShow(1)
|
||||
end
|
||||
else
|
||||
-- Under Unloaded
|
||||
if not unloadedButton:GetExpanded() then
|
||||
unloadedButton:Expand()
|
||||
end
|
||||
|
||||
WeakAuras.ResumeAllDynamicGroups()
|
||||
end
|
||||
|
||||
local list = {}
|
||||
local num = 0
|
||||
if tab then
|
||||
self.selectedTab = tab
|
||||
end
|
||||
self:FillOptions()
|
||||
|
||||
WeakAuras.SetMoverSizer(id)
|
||||
|
||||
local _, _, _, _, yOffset = displayButtons[id].frame:GetPoint(1)
|
||||
if not yOffset then
|
||||
yOffset = displayButtons[id].frame.yOffset
|
||||
end
|
||||
if yOffset then
|
||||
self.buttonsScroll:SetScrollPos(yOffset, yOffset - 32)
|
||||
end
|
||||
if data.controlledChildren then
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
if not displayOptions[childId] then
|
||||
list[childId] = WeakAuras.GetData(childId)
|
||||
num = num + 1
|
||||
end
|
||||
displayButtons[childId]:PriorityShow(1)
|
||||
end
|
||||
end
|
||||
WeakAuras.EnsureOptions(id)
|
||||
if num > 1 then
|
||||
WeakAuras.PauseAllDynamicGroups()
|
||||
WeakAuras.BuildOptions(list, finishPicking)
|
||||
else
|
||||
WeakAuras.PauseAllDynamicGroups()
|
||||
finishPicking()
|
||||
if data.controlledChildren and #data.controlledChildren == 0 then
|
||||
WeakAurasOptions:NewAura(true)
|
||||
end
|
||||
|
||||
if data.controlledChildren and #data.controlledChildren == 0 then
|
||||
WeakAurasOptions:NewAura(true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1038,11 +1150,10 @@ function WeakAuras.CreateFrame()
|
||||
self:PickDisplay(id)
|
||||
elseif not WeakAuras.IsDisplayPicked(id) then
|
||||
self.pickedDisplay = tempGroup
|
||||
WeakAuras.EnsureOptions(id)
|
||||
displayButtons[id]:Pick()
|
||||
tinsert(tempGroup.controlledChildren, id)
|
||||
WeakAuras.AddOption(tempGroup.id, tempGroup)
|
||||
self:FillOptions(displayOptions[tempGroup.id])
|
||||
WeakAuras.ClearOptions(tempGroup.id)
|
||||
self:FillOptions()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1057,32 +1168,13 @@ function WeakAuras.CreateFrame()
|
||||
end
|
||||
end
|
||||
if not alreadySelected then
|
||||
WeakAuras.EnsureOptions(id)
|
||||
displayButtons[id]:Pick()
|
||||
tinsert(tempGroup.controlledChildren, id)
|
||||
end
|
||||
end
|
||||
WeakAuras.AddOption(tempGroup.id, tempGroup)
|
||||
self:FillOptions(displayOptions[tempGroup.id])
|
||||
frame:ClearOptions(tempGroup.id)
|
||||
self.pickedDisplay = tempGroup
|
||||
end
|
||||
|
||||
frame.RefreshPick = function(self)
|
||||
if type(self.pickedDisplay) == "string" then
|
||||
WeakAuras.EnsureOptions(self.pickedDisplay)
|
||||
self:FillOptions(displayOptions[self.pickedDisplay])
|
||||
else
|
||||
WeakAuras.EnsureOptions(tempGroup.id)
|
||||
self:FillOptions(displayOptions[tempGroup.id])
|
||||
end
|
||||
end
|
||||
|
||||
frame.RefillOptions = function(self)
|
||||
if type(self.pickedDisplay) == "string" then
|
||||
self:FillOptions(displayOptions[frame.pickedDisplay])
|
||||
elseif self.pickedDisplay then
|
||||
self:FillOptions(displayOptions[frame.pickedDisplay.id])
|
||||
end
|
||||
self:FillOptions()
|
||||
end
|
||||
|
||||
frame:SetClampedToScreen(true)
|
||||
|
||||
@@ -727,22 +727,20 @@ local function ConstructTextEditor(frame)
|
||||
if (self.reloadOptions) then
|
||||
if (self.data.controlledChildren) then
|
||||
for index, childId in pairs(self.data.controlledChildren) do
|
||||
WeakAuras.ScheduleReloadOptions(WeakAuras.GetData(childId))
|
||||
WeakAuras.ClearAndUpdateOptions(childId)
|
||||
end
|
||||
WeakAuras.ScheduleReloadOptions(self.data)
|
||||
WeakAuras.ClearAndUpdateOptions(self.data.id)
|
||||
else
|
||||
WeakAuras.ScheduleReloadOptions(self.data)
|
||||
WeakAuras.ClearAndUpdateOptions(self.data.id)
|
||||
end
|
||||
else
|
||||
WeakAuras.ScheduleReloadOptions(self.data)
|
||||
WeakAuras.ClearAndUpdateOptions(self.data.id)
|
||||
end
|
||||
|
||||
editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged)
|
||||
editor:ClearFocus()
|
||||
frame.window = "default"
|
||||
frame:UpdateFrameVisible()
|
||||
|
||||
frame:RefreshPick()
|
||||
end
|
||||
WeakAuras.editor = editor
|
||||
|
||||
@@ -752,4 +750,4 @@ end
|
||||
function WeakAuras.TextEditor(frame)
|
||||
textEditor = textEditor or ConstructTextEditor(frame)
|
||||
return textEditor
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,8 +12,68 @@ local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
||||
|
||||
local WeakAuras = WeakAuras
|
||||
local L = WeakAuras.L
|
||||
local getAll = WeakAuras.getAll
|
||||
local setAll = WeakAuras.setAll
|
||||
|
||||
local function CompareValues(a, b)
|
||||
if type(a) ~= type(b) then
|
||||
return false
|
||||
end
|
||||
if type(a) == "table" then
|
||||
for k, v in pairs(a) do
|
||||
if v ~= b[k] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(b) do
|
||||
if v ~= a[k] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
else
|
||||
return a == b
|
||||
end
|
||||
end
|
||||
|
||||
local function GetAll(data, property, default)
|
||||
if data.controlledChildren then
|
||||
local result
|
||||
local first = true
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
if childData[property] ~= nil then
|
||||
if first then
|
||||
result = childData[property]
|
||||
first = false
|
||||
else
|
||||
if not CompareValues(result, childData[property]) then
|
||||
return default
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return result
|
||||
else
|
||||
if data[property] ~= nil then
|
||||
return data[property]
|
||||
end
|
||||
return default
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function SetAll(data, property, value)
|
||||
if data.controlledChildren then
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
childData[property] = value
|
||||
WeakAuras.Add(childData)
|
||||
end
|
||||
else
|
||||
data[property] = value
|
||||
end
|
||||
end
|
||||
|
||||
local texturePicker
|
||||
|
||||
@@ -100,14 +160,9 @@ local function ConstructTexturePicker(frame)
|
||||
pickedwidget:Pick();
|
||||
end
|
||||
|
||||
if(self.data.controlledChildren) then
|
||||
setAll(self.data, {"region", self.field}, texturePath);
|
||||
else
|
||||
self.data[self.field] = texturePath;
|
||||
end
|
||||
SetAll(self.data, self.field, texturePath);
|
||||
if(type(self.data.id) == "string") then
|
||||
WeakAuras.Add(self.data);
|
||||
WeakAuras.SetIconNames(self.data);
|
||||
WeakAuras.UpdateThumbnail(self.data);
|
||||
end
|
||||
group:UpdateList();
|
||||
@@ -128,17 +183,17 @@ local function ConstructTexturePicker(frame)
|
||||
self.givenPath[childId] = childData[field];
|
||||
end
|
||||
end
|
||||
local colorAll = getAll(data, {"region", "color"}) or {1, 1, 1, 1};
|
||||
local colorAll = GetAll(data, "color", {1, 1, 1, 1});
|
||||
self.textureData = {
|
||||
r = colorAll[1] or 1,
|
||||
g = colorAll[2] or 1,
|
||||
b = colorAll[3] or 1,
|
||||
a = colorAll[4] or 1,
|
||||
rotate = getAll(data, {"region", "rotate"}),
|
||||
discrete_rotation = getAll(data, {"region", "discrete_rotation"}) or 0,
|
||||
rotation = getAll(data, {"region", "rotation"}) or 0,
|
||||
mirror = getAll(data, {"region", "mirror"}),
|
||||
blendMode = getAll(data, {"region", "blendMode"}) or "ADD"
|
||||
rotate = GetAll(data, "rotate", false),
|
||||
discrete_rotation = GetAll(data, "discrete_rotation", 0),
|
||||
rotation = GetAll(data, "rotation", 0),
|
||||
mirror = GetAll(data, "mirror", false),
|
||||
blendMode = GetAll(data, "blendMode", "ADD")
|
||||
};
|
||||
else
|
||||
self.givenPath = data[field];
|
||||
@@ -188,7 +243,7 @@ local function ConstructTexturePicker(frame)
|
||||
function group.Close()
|
||||
frame.window = "default";
|
||||
frame:UpdateFrameVisible()
|
||||
AceConfigDialog:Open("WeakAuras", frame.container);
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
|
||||
function group.CancelClose()
|
||||
@@ -199,7 +254,6 @@ local function ConstructTexturePicker(frame)
|
||||
childData[group.field] = group.givenPath[childId];
|
||||
WeakAuras.Add(childData);
|
||||
WeakAuras.UpdateThumbnail(childData);
|
||||
WeakAuras.SetIconNames(childData);
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -63,7 +63,6 @@ local function createOptions(id, data)
|
||||
data.orientation = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end
|
||||
},
|
||||
@@ -144,7 +143,6 @@ local function createOptions(id, data)
|
||||
data.displayIcon = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
end
|
||||
},
|
||||
chooseIcon = {
|
||||
@@ -178,7 +176,6 @@ local function createOptions(id, data)
|
||||
data.icon_side = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
end
|
||||
},
|
||||
desaturate = {
|
||||
@@ -405,7 +402,7 @@ local function createOptions(id, data)
|
||||
|
||||
return {
|
||||
aurabar = options,
|
||||
position = WeakAuras.PositionOptions(id, data),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data),
|
||||
};
|
||||
end
|
||||
|
||||
@@ -744,12 +741,12 @@ local function subCreateOptions(parentData, data, index, subIndex)
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "aurabar_bar")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "aurabar_bar")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__nooptions = true
|
||||
|
||||
@@ -90,7 +90,6 @@ local function createOptions(id, data)
|
||||
data.groupIcon = v
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.UpdateThumbnail(data)
|
||||
WeakAuras.SetIconNames(data)
|
||||
end
|
||||
},
|
||||
chooseIcon = {
|
||||
@@ -115,7 +114,7 @@ local function createOptions(id, data)
|
||||
end
|
||||
data.selfPoint = selfPoint
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
WeakAuras.ResetMoverSizer()
|
||||
end,
|
||||
},
|
||||
@@ -159,7 +158,7 @@ local function createOptions(id, data)
|
||||
end
|
||||
data.selfPoint = selfPoint
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
WeakAuras.ResetMoverSizer()
|
||||
end,
|
||||
hidden = function() return (data.grow == "CUSTOM" or data.grow == "LEFT" or data.grow == "RIGHT" or data.grow == "HORIZONTAL" or data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE" or data.grow == "GRID") end,
|
||||
@@ -181,7 +180,7 @@ local function createOptions(id, data)
|
||||
end
|
||||
data.selfPoint = selfPoint
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadTriggerOptions(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
WeakAuras.ResetMoverSizer()
|
||||
end,
|
||||
},
|
||||
@@ -411,23 +410,23 @@ local function createOptions(id, data)
|
||||
},
|
||||
};
|
||||
|
||||
WeakAuras.AddCodeOption(options, data, L["Custom Grow"], "custom_grow", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Dynamic-Group",
|
||||
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Grow"], "custom_grow", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#grow",
|
||||
2, function() return data.grow ~= "CUSTOM" end, {"customGrow"}, nil, nil, nil, nil, nil, true)
|
||||
WeakAuras.AddCodeOption(options, data, L["Custom Sort"], "custom_sort", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Dynamic-Group",
|
||||
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Sort"], "custom_sort", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-sort",
|
||||
21, function() return data.sort ~= "custom" end, {"customSort"}, nil, nil, nil, nil, nil, true)
|
||||
WeakAuras.AddCodeOption(options, data, L["Custom Anchor"], "custom_anchor_per_unit", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Dynamic-Group",
|
||||
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Anchor"], "custom_anchor_per_unit", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#group-by-frame",
|
||||
1.7, function() return not(data.grow ~= "CUSTOM" and data.useAnchorPerUnit and data.anchorPerUnit == "CUSTOM") end, {"customAnchorPerUnit"}, nil, nil, nil, nil, nil, true)
|
||||
|
||||
local borderHideFunc = function() return data.useAnchorPerUnit or data.grow == "CUSTOM" end
|
||||
local disableSelfPoint = function() return data.grow ~= "CUSTOM" and data.grow ~= "GRID" and not data.useAnchorPerUnit end
|
||||
|
||||
for k, v in pairs(WeakAuras.BorderOptions(id, data, nil, borderHideFunc, 70)) do
|
||||
for k, v in pairs(WeakAuras.commonOptions.BorderOptions(id, data, nil, borderHideFunc, 70)) do
|
||||
options[k] = v
|
||||
end
|
||||
|
||||
return {
|
||||
dynamicgroup = options,
|
||||
position = WeakAuras.PositionOptions(id, data, nil, true, disableSelfPoint),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, true, disableSelfPoint),
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ local function createOptions(id, data)
|
||||
data.groupIcon = v
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.UpdateThumbnail(data)
|
||||
WeakAuras.SetIconNames(data)
|
||||
end
|
||||
},
|
||||
chooseIcon = {
|
||||
@@ -557,13 +556,13 @@ local function createOptions(id, data)
|
||||
},
|
||||
};
|
||||
|
||||
for k, v in pairs(WeakAuras.BorderOptions(id, data, nil, nil, 70)) do
|
||||
for k, v in pairs(WeakAuras.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
|
||||
options[k] = v
|
||||
end
|
||||
|
||||
return {
|
||||
group = options,
|
||||
position = WeakAuras.PositionOptions(id, data, nil, true, true),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, true, true),
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ local function createOptions(id, data)
|
||||
data.displayIcon = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
end
|
||||
},
|
||||
chooseIcon = {
|
||||
@@ -99,7 +98,7 @@ local function createOptions(id, data)
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
func = function()
|
||||
func = function(info, button)
|
||||
local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true);
|
||||
WeakAuras.SetCollapsed("icon", "icon", "iconextra", not collapsed);
|
||||
end,
|
||||
@@ -199,7 +198,7 @@ local function createOptions(id, data)
|
||||
|
||||
return {
|
||||
icon = options,
|
||||
position = WeakAuras.PositionOptions(id, data),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data),
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
@@ -115,13 +115,13 @@ local function createOptions(id, data)
|
||||
}
|
||||
end
|
||||
|
||||
for k, v in pairs(WeakAuras.BorderOptions(id, data, nil, nil, 70)) do
|
||||
for k, v in pairs(WeakAuras.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
|
||||
options[k] = v
|
||||
end
|
||||
|
||||
return {
|
||||
model = options,
|
||||
position = WeakAuras.PositionOptions(id, data, nil, nil, nil),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, nil, nil),
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
@@ -168,7 +168,6 @@ local function createOptions(id, data)
|
||||
data.crop_x = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
if(data.parent) then
|
||||
local parentData = WeakAuras.GetData(data.parent);
|
||||
if(parentData) then
|
||||
@@ -192,7 +191,6 @@ local function createOptions(id, data)
|
||||
data.crop_y = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
if(data.parent) then
|
||||
local parentData = WeakAuras.GetData(data.parent);
|
||||
if(parentData) then
|
||||
@@ -315,7 +313,7 @@ local function createOptions(id, data)
|
||||
|
||||
return {
|
||||
progresstexture = options,
|
||||
position = WeakAuras.PositionOptions(id, data),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data),
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
@@ -29,9 +29,8 @@ local function createOptions(id, data)
|
||||
set = function(info, v)
|
||||
data.displayText = WeakAuras.ReplaceLocalizedRaidMarkers(v);
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.SetIconNames(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
end,
|
||||
},
|
||||
@@ -105,7 +104,7 @@ local function createOptions(id, data)
|
||||
|
||||
return secondline
|
||||
end,
|
||||
func = function()
|
||||
func = function(info, button)
|
||||
local collapsed = WeakAuras.IsCollapsed("text", "text", "fontflags", true)
|
||||
WeakAuras.SetCollapsed("text", "text", "fontflags", not collapsed)
|
||||
end,
|
||||
@@ -240,7 +239,7 @@ local function createOptions(id, data)
|
||||
},
|
||||
};
|
||||
|
||||
WeakAuras.AddCodeOption(options, data, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
|
||||
WeakAuras.commonOptions.AddCodeOption(options, data, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
|
||||
37, function() return not WeakAuras.ContainsCustomPlaceHolder(data.displayText) end, {"customText"}, false);
|
||||
|
||||
-- Add Text Format Options
|
||||
@@ -266,7 +265,7 @@ local function createOptions(id, data)
|
||||
option.set = function(info, v)
|
||||
data["displayText_format_" .. key] = v
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
options["displayText_format_" .. key] = option
|
||||
@@ -282,7 +281,7 @@ local function createOptions(id, data)
|
||||
|
||||
return {
|
||||
text = options;
|
||||
position = WeakAuras.PositionOptions(id, data, nil, true);
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data, nil, true);
|
||||
};
|
||||
end
|
||||
|
||||
@@ -394,4 +393,4 @@ local templates = {
|
||||
}
|
||||
}
|
||||
|
||||
WeakAuras.RegisterRegionOptions("text", createOptions, createIcon, L["Text"], createThumbnail, modifyThumbnail, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], templates);
|
||||
WeakAuras.RegisterRegionOptions("text", createOptions, createIcon, L["Text"], createThumbnail, modifyThumbnail, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], templates);
|
||||
|
||||
@@ -100,7 +100,7 @@ local function createOptions(id, data)
|
||||
|
||||
return {
|
||||
texture = options,
|
||||
position = WeakAuras.PositionOptions(id, data),
|
||||
position = WeakAuras.commonOptions.PositionOptions(id, data),
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
@@ -9,22 +9,22 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
bar_model_visible = {
|
||||
|
||||
@@ -11,22 +11,22 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subborder")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subborder")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subborder")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
border_visible = {
|
||||
|
||||
@@ -20,22 +20,22 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
glow = {
|
||||
@@ -112,7 +112,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
func = function()
|
||||
func = function(info, button)
|
||||
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
|
||||
WeakAuras.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed);
|
||||
end,
|
||||
|
||||
@@ -29,7 +29,7 @@ function WeakAuras.DeleteSubRegion(data, index, regionType)
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType then
|
||||
tremove(data.subRegions, index)
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
|
||||
local replacements = {
|
||||
["sub." .. index .. "."] = deleteCondition
|
||||
@@ -50,7 +50,7 @@ function WeakAuras.MoveSubRegionUp(data, index, regionType)
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType then
|
||||
data.subRegions[index - 1], data.subRegions[index] = data.subRegions[index], data.subRegions[index - 1]
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
|
||||
local replacements = {
|
||||
["sub." .. (index -1) .. "."] = "sub." .. index .. ".",
|
||||
@@ -68,7 +68,7 @@ function WeakAuras.MoveSubRegionDown(data, index, regionType)
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType and data.subRegions[index + 1] then
|
||||
data.subRegions[index], data.subRegions[index + 1] = data.subRegions[index + 1], data.subRegions[index]
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
|
||||
local replacements = {
|
||||
["sub." .. index .. "."] = "sub." .. (index + 1) .. ".",
|
||||
@@ -86,7 +86,7 @@ function WeakAuras.DuplicateSubRegion(data, index, regionType)
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType then
|
||||
tinsert(data.subRegions, index, CopyTable(data.subRegions[index]))
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
|
||||
local replacements = {}
|
||||
for i = index + 1, #data.subRegions do
|
||||
|
||||
@@ -32,22 +32,22 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
text_visible = {
|
||||
@@ -74,7 +74,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
set = function(info, v)
|
||||
data.text_text = WeakAuras.ReplaceLocalizedRaidMarkers(v)
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
},
|
||||
text_font = {
|
||||
@@ -136,7 +136,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
end,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = 44,
|
||||
func = function()
|
||||
func = function(info, button)
|
||||
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
|
||||
WeakAuras.SetCollapsed("subtext", "subtext", "fontflags" .. index, not collapsed)
|
||||
end,
|
||||
@@ -325,7 +325,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
func = function()
|
||||
func = function(info, button)
|
||||
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
|
||||
WeakAuras.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
|
||||
end
|
||||
@@ -408,21 +408,6 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
return true
|
||||
end
|
||||
|
||||
local function CheckTextOptions(placeholders)
|
||||
return function()
|
||||
if not parentData.subRegions then
|
||||
return true
|
||||
end
|
||||
|
||||
for index, subRegion in ipairs(parentData.subRegions) do
|
||||
if subRegion.type == "subtext" and WeakAuras.ContainsPlaceHolders(subRegion.text_text, placeholders) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local commonTextOptions = {
|
||||
__title = L["Common Text"],
|
||||
__hidden = function() return hideCustomTextOption() end,
|
||||
@@ -437,16 +422,15 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
set = function(info, v)
|
||||
parentData.customTextUpdate = v
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
WeakAuras.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
|
||||
WeakAuras.commonOptions.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
|
||||
4, hideCustomTextOption, {"customText"}, false)
|
||||
|
||||
-- Add Text Format Options
|
||||
local input = data["text_text"]
|
||||
local hidden = function()
|
||||
return WeakAuras.IsCollapsed("format_option", "text", "text_text", true)
|
||||
end
|
||||
@@ -455,10 +439,6 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
WeakAuras.SetCollapsed("format_option", "text", "text_text", hidden)
|
||||
end
|
||||
|
||||
local get = function(key)
|
||||
return data["text_text_format_" .. key]
|
||||
end
|
||||
|
||||
local order = 12
|
||||
local function addOption(key, option)
|
||||
option.order = order
|
||||
@@ -468,13 +448,35 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
option.set = function(info, v)
|
||||
data["text_text_format_" .. key] = v
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id, true)
|
||||
end
|
||||
end
|
||||
options["text_text_format_" .. key] = option
|
||||
end
|
||||
|
||||
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
|
||||
if parentData.controlledChildren then
|
||||
for _, childId in pairs(parentData.controlledChildren) do
|
||||
local parentChildData = WeakAuras.GetData(childId)
|
||||
|
||||
if parentChildData.subRegions then
|
||||
local childData = parentChildData.subRegions[index]
|
||||
if childData then
|
||||
local get = function(key)
|
||||
return childData["text_text_format_" .. key]
|
||||
end
|
||||
local input = childData["text_text"]
|
||||
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local get = function(key)
|
||||
return data["text_text_format_" .. key]
|
||||
end
|
||||
local input = data["text_text"]
|
||||
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
|
||||
end
|
||||
|
||||
addOption("footer", {
|
||||
type = "description",
|
||||
name = "",
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
local removeFuncs = WeakAuras.commonOptions.removeFuncs
|
||||
local replaceNameDescFuncs = WeakAuras.commonOptions.replaceNameDescFuncs
|
||||
local replaceImageFuncs = WeakAuras.commonOptions.replaceImageFuncs
|
||||
local replaceValuesFuncs = WeakAuras.commonOptions.replaceValuesFuncs
|
||||
local disabledAll = WeakAuras.commonOptions.CreateDisabledAll("trigger")
|
||||
local hiddenAll = WeakAuras.commonOptions.CreateHiddenAll("trigger")
|
||||
local getAll = WeakAuras.commonOptions.CreateGetAll("trigger")
|
||||
local setAll = WeakAuras.commonOptions.CreateSetAll("trigger", getAll)
|
||||
local executeAll = WeakAuras.commonOptions.CreateExecuteAll("trigger")
|
||||
|
||||
local flattenRegionOptions = WeakAuras.commonOptions.flattenRegionOptions
|
||||
local fixMetaOrders = WeakAuras.commonOptions.fixMetaOrders
|
||||
|
||||
local subevent_actual_prefix_types = WeakAuras.subevent_actual_prefix_types;
|
||||
local spellCache = WeakAuras.spellCache
|
||||
|
||||
local function union(table1, table2)
|
||||
local meta = {};
|
||||
for i,v in pairs(table1) do
|
||||
meta[i] = v;
|
||||
end
|
||||
for i,v in pairs(table2) do
|
||||
meta[i] = v;
|
||||
end
|
||||
return meta;
|
||||
end
|
||||
|
||||
local function GetGlobalOptions(data)
|
||||
|
||||
local triggerCount = 0
|
||||
local globalTriggerOptions = {
|
||||
__title = L["Trigger Combination"],
|
||||
__order = 1,
|
||||
disjunctive = {
|
||||
type = "select",
|
||||
name = L["Required for Activation"],
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = 2,
|
||||
values = function()
|
||||
if #data.triggers > 1 then
|
||||
return WeakAuras.trigger_require_types;
|
||||
else
|
||||
return WeakAuras.trigger_require_types_one;
|
||||
end
|
||||
end,
|
||||
get = function()
|
||||
if #data.triggers > 1 then
|
||||
return data.triggers.disjunctive or "all";
|
||||
else
|
||||
return (data.triggers.disjunctive and data.triggers.disjunctive ~= "all") and data.triggers.disjunctive or "any";
|
||||
end
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.triggers.disjunctive = v;
|
||||
WeakAuras.Add(data);
|
||||
end
|
||||
},
|
||||
-- custom trigger combiner text editor added below
|
||||
activeTriggerMode = {
|
||||
type = "select",
|
||||
name = L["Dynamic Information"],
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = 2.3,
|
||||
values = function()
|
||||
local vals = {};
|
||||
vals[WeakAuras.trigger_modes.first_active] = L["Dynamic information from first active trigger"];
|
||||
for i = 1, #data.triggers do
|
||||
vals[i] = L["Dynamic information from Trigger %i"]:format(i);
|
||||
end
|
||||
return vals;
|
||||
end,
|
||||
get = function()
|
||||
return data.triggers.activeTriggerMode or WeakAuras.trigger_modes.first_active;
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.triggers.activeTriggerMode = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.UpdateDisplayButton(data);
|
||||
end,
|
||||
hidden = function() return #data.triggers <= 1 end
|
||||
}
|
||||
}
|
||||
|
||||
local function hideTriggerCombiner()
|
||||
return not (data.triggers.disjunctive == "custom")
|
||||
end
|
||||
WeakAuras.commonOptions.AddCodeOption(globalTriggerOptions, data, L["Custom"], "custom_trigger_combination", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-activation",
|
||||
2.4, hideTriggerCombiner, {"triggers", "customTriggerLogic"}, false);
|
||||
|
||||
return {
|
||||
global = globalTriggerOptions
|
||||
}
|
||||
end
|
||||
|
||||
local function AddOptions(allOptions, data)
|
||||
allOptions = union(allOptions, GetGlobalOptions(data))
|
||||
|
||||
local triggerOptions = {}
|
||||
for index, trigger in ipairs(data.triggers) do
|
||||
local triggerSystemOptionsFunction = trigger.trigger.type and WeakAuras.triggerTypesOptions[trigger.trigger.type]
|
||||
if (triggerSystemOptionsFunction) then
|
||||
triggerOptions = union(triggerOptions, triggerSystemOptionsFunction(data, index))
|
||||
end
|
||||
end
|
||||
|
||||
return union(allOptions, triggerOptions)
|
||||
end
|
||||
|
||||
function WeakAuras.GetTriggerOptions(data)
|
||||
local allOptions = {}
|
||||
if data.controlledChildren then
|
||||
for index, childId in pairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
allOptions = AddOptions(allOptions, childData)
|
||||
end
|
||||
else
|
||||
allOptions = AddOptions(allOptions, data)
|
||||
end
|
||||
|
||||
fixMetaOrders(allOptions)
|
||||
|
||||
local triggerOptions = {
|
||||
type = "group",
|
||||
name = L["Trigger"],
|
||||
order = 20,
|
||||
args = flattenRegionOptions(allOptions, false)
|
||||
}
|
||||
|
||||
if data.controlledChildren then
|
||||
removeFuncs(triggerOptions, true);
|
||||
replaceNameDescFuncs(triggerOptions, data, "trigger");
|
||||
replaceImageFuncs(triggerOptions, data, "trigger");
|
||||
replaceValuesFuncs(triggerOptions, data, "trigger");
|
||||
|
||||
triggerOptions.get = function(info, ...)
|
||||
return getAll(data, info, ...)
|
||||
end
|
||||
triggerOptions.set = function(info, ...)
|
||||
setAll(data, info, ...)
|
||||
end
|
||||
triggerOptions.hidden = function(info, ...)
|
||||
return hiddenAll(data, info, ...)
|
||||
end
|
||||
triggerOptions.disabled = function(info, ...)
|
||||
return disabledAll(data, info, ...)
|
||||
end
|
||||
|
||||
triggerOptions.func = function(info, ...)
|
||||
return executeAll(data, info, ...)
|
||||
end
|
||||
end
|
||||
|
||||
return triggerOptions
|
||||
end
|
||||
|
||||
local function DeleteConditionsForTriggerHandleSubChecks(checks, triggernum)
|
||||
for _, check in ipairs(checks) do
|
||||
if (check.trigger == triggernum) then
|
||||
check.trigger = nil;
|
||||
end
|
||||
|
||||
if (check.trigger and check.trigger > triggernum) then
|
||||
check.trigger = check.trigger - 1;
|
||||
end
|
||||
|
||||
if (checks.checks) then
|
||||
DeleteConditionsForTriggerHandleSubChecks(checks.checks, triggernum);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function DeleteConditionsForTrigger(data, triggernum)
|
||||
for _, condition in ipairs(data.conditions) do
|
||||
if (condition.check and condition.check.trigger == triggernum) then
|
||||
condition.check.trigger = nil;
|
||||
end
|
||||
|
||||
if (condition.check and condition.check.trigger and condition.check.trigger > triggernum) then
|
||||
condition.check.trigger = condition.check.trigger - 1;
|
||||
end
|
||||
|
||||
if (condition.check and condition.check.checks) then
|
||||
DeleteConditionsForTriggerHandleSubChecks(condition.check.checks, triggernum)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function moveTriggerDownConditionCheck(check, i)
|
||||
if (check.trigger == i) then
|
||||
check.trigger = i + 1;
|
||||
elseif (check.trigger == i + 1) then
|
||||
check.trigger = i;
|
||||
end
|
||||
if (check.checks) then
|
||||
for _, subCheck in ipairs(check.checks) do
|
||||
moveTriggerDownConditionCheck(subCheck, i);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function moveTriggerDownImpl(data, i)
|
||||
if (i < 1 or i >= #data.triggers) then
|
||||
return false;
|
||||
end
|
||||
data.triggers[i], data.triggers[i + 1] = data.triggers[i + 1], data.triggers[i]
|
||||
for _, condition in ipairs(data.conditions) do
|
||||
moveTriggerDownConditionCheck(condition.check, i);
|
||||
end
|
||||
|
||||
return true;
|
||||
end
|
||||
|
||||
function WeakAuras.AddTriggerMetaFunctions(options, data, triggernum)
|
||||
options.__title = L["Trigger %s"]:format(triggernum)
|
||||
options.__order = triggernum * 10
|
||||
options.__add = function()
|
||||
tinsert(data.triggers,
|
||||
{
|
||||
trigger =
|
||||
{
|
||||
type = "aura2"
|
||||
},
|
||||
untrigger = {
|
||||
}
|
||||
})
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
options.__up =
|
||||
{
|
||||
disabled = function()
|
||||
return triggernum < 2
|
||||
end,
|
||||
func = function()
|
||||
if (moveTriggerDownImpl(data, triggernum - 1)) then
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
end
|
||||
}
|
||||
options.__down =
|
||||
{
|
||||
disabled = function()
|
||||
return triggernum == #data.triggers
|
||||
end,
|
||||
func = function()
|
||||
if (moveTriggerDownImpl(data, triggernum)) then
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.ClearAndUpdateOptions(data.id);
|
||||
end
|
||||
end
|
||||
}
|
||||
options.__duplicate = function()
|
||||
local trigger = CopyTable(data.triggers[triggernum])
|
||||
tinsert(data.triggers, trigger)
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
options.__delete = {
|
||||
disabled = function()
|
||||
return #data.triggers == 1
|
||||
end,
|
||||
func = function()
|
||||
if #data.triggers > 1 then
|
||||
tremove(data.triggers, triggernum)
|
||||
DeleteConditionsForTrigger(data, triggernum);
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
end
|
||||
end
|
||||
}
|
||||
local _, _, _, enabled = GetAddOnInfo("WeakAurasTemplates")
|
||||
if enabled then
|
||||
options.__applyTemplate = function()
|
||||
WeakAuras.OpenTriggerTemplate(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,13 +31,19 @@ SubRegionOptions\SubRegionCommon.lua
|
||||
SubRegionOptions\SubText.lua
|
||||
SubRegionOptions\Border.lua
|
||||
SubRegionOptions\Glow.lua
|
||||
SubRegionOptions\BarModel.lua
|
||||
SubRegionOptions\Tick.lua
|
||||
SubRegionOptions\BarModel.lua
|
||||
|
||||
Cache.lua
|
||||
|
||||
CommonOptions.lua
|
||||
GroupOptions.lua
|
||||
DisplayOptions.lua
|
||||
TriggerOptions.lua
|
||||
LoadOptions.lua
|
||||
ActionOptions.lua
|
||||
AnimationOptions.lua
|
||||
|
||||
BuffTrigger.lua
|
||||
BuffTrigger2.lua
|
||||
GenericTrigger.lua
|
||||
@@ -73,5 +79,7 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasImportButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasSortedDropDown.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasToolbarButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasTwoColumnDropDown.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua
|
||||
AceGUI-Widgets\AceGUIContainer-WeakAurasTreeGroup.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua
|
||||
AceGUI-Widgets\AceGUIContainer-WeakAurasInlineGroup.lua
|
||||
|
||||
Reference in New Issue
Block a user