This commit is contained in:
Bunny67
2020-09-14 10:12:22 +03:00
parent 6c3f9d925e
commit 0f4f16b6f0
71 changed files with 2302 additions and 2431 deletions
+28 -37
View File
@@ -3,15 +3,6 @@ local AddonName, OptionsPrivate = ...
local L = WeakAuras.L;
local event_types = WeakAuras.event_types;
local status_types = WeakAuras.status_types;
local check_types = WeakAuras.check_types;
local subevent_prefix_types = WeakAuras.subevent_prefix_types;
local subevent_actual_prefix_types = WeakAuras.subevent_actual_prefix_types;
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, triggernum)
local id = data.id;
local trigger = data.triggers[triggernum].trigger
@@ -38,7 +29,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Event Type"],
order = 7,
width = WeakAuras.doubleWidth,
values = custom_trigger_types,
values = OptionsPrivate.Private.custom_trigger_types,
hidden = function() return not (trigger.type == "custom") end,
get = function(info)
return trigger.custom_type
@@ -55,7 +46,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Check On..."],
width = WeakAuras.doubleWidth / 3,
order = 8,
values = check_types,
values = OptionsPrivate.Private.check_types,
hidden = function() return not (trigger.type == "custom"
and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate")
and trigger.check ~= "update")
@@ -72,7 +63,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Check On..."],
order = 9,
width = WeakAuras.doubleWidth,
values = check_types,
values = OptionsPrivate.Private.check_types,
hidden = function() return not (trigger.type == "custom"
and (trigger.custom_type == "status" or trigger.custom_type == "stateupdate")
and trigger.check == "update")
@@ -125,12 +116,12 @@ local function GetCustomTriggerOptions(data, triggernum)
trueEvent = string.upper(i)
elseif trueEvent == "CLEU" or trueEvent == "COMBAT_LOG_EVENT_UNFILTERED" then
local subevent = string.upper(i)
if not WeakAuras.IsCLEUSubevent(subevent) then
if not OptionsPrivate.Private.IsCLEUSubevent(subevent) then
return "|cFFFF0000"..L["%s is not a valid SubEvent for COMBAT_LOG_EVENT_UNFILTERED"]:format(subevent)
end
elseif trueEvent:match("^UNIT_") then
local unit = string.lower(i)
if not WeakAuras.baseUnitId[unit] and not WeakAuras.multiUnitId[unit] then
if not OptionsPrivate.Private.baseUnitId[unit] and not OptionsPrivate.Private.multiUnitId[unit] then
return "|cFFFF0000"..L["Unit %s is not a valid unit for RegisterUnitEvent"]:format(unit)
end
end
@@ -156,12 +147,12 @@ local function GetCustomTriggerOptions(data, triggernum)
if not trueEvent then
trueEvent = string.upper(i)
elseif trueEvent == "CLEU" or trueEvent == "COMBAT_LOG_EVENT_UNFILTERED" then
if not WeakAuras.IsCLEUSubevent(string.upper(i)) then
if not OptionsPrivate.Private.IsCLEUSubevent(string.upper(i)) then
return false
end
elseif trueEvent:match("^UNIT_") then
local unit = string.lower(i)
if not WeakAuras.baseUnitId[unit] then
if not OptionsPrivate.Private.baseUnitId[unit] then
return false
end
end
@@ -177,7 +168,7 @@ local function GetCustomTriggerOptions(data, triggernum)
name = L["Hide"],
order = 12,
hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide ~= "custom") end,
values = eventend_types,
values = OptionsPrivate.Private.eventend_types,
get = function() trigger.custom_hide = trigger.custom_hide or "timed"; return trigger.custom_hide end,
set = function(info, v)
trigger.custom_hide = v;
@@ -191,7 +182,7 @@ local function GetCustomTriggerOptions(data, triggernum)
order = 12,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "custom" and trigger.custom_type == "event" and trigger.custom_hide == "custom") end,
values = eventend_types,
values = OptionsPrivate.Private.eventend_types,
get = function() return trigger.custom_hide end,
set = function(info, v)
trigger.custom_hide = v;
@@ -275,21 +266,21 @@ local function GetCustomTriggerOptions(data, triggernum)
local function hideCustomTrigger()
return not (trigger.type == "custom")
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Custom Trigger"], "custom_trigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-trigger",
OptionsPrivate.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.commonOptions.AddCodeOption(customOptions, data, L["Custom Variables"], "custom_variables", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-variables",
OptionsPrivate.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.commonOptions.AddCodeOption(customOptions, data, L["Custom Untrigger"], "custom_untrigger", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-untrigger",
OptionsPrivate.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()
@@ -297,7 +288,7 @@ local function GetCustomTriggerOptions(data, triggernum)
and (trigger.custom_type == "status"
or (trigger.custom_type == "event" and (trigger.custom_hide ~= "timed" or trigger.dynamicDuration))))
end
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Duration Info"], "custom_duration", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#duration-info",
OptionsPrivate.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()
@@ -328,17 +319,17 @@ local function GetCustomTriggerOptions(data, triggernum)
}
}
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",
OptionsPrivate.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.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Name Info"], "custom_name", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#name-info",
18, hideIfTriggerStateUpdate, appendToTriggerPath("customName"), false, true, extraSetFunctionReload);
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Icon Info"], "custom_icon", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#icon-info",
20, hideIfTriggerStateUpdate, appendToTriggerPath("customIcon"), false, true, extraSetFunction);
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Texture Info"], "custom_texture", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#texture-info",
22, hideIfTriggerStateUpdate, appendToTriggerPath("customTexture"), false, true, extraSetFunction);
WeakAuras.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info",
OptionsPrivate.commonOptions.AddCodeOption(customOptions, data, L["Stack Info"], "custom_stacks", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#stack-info",
23, hideIfTriggerStateUpdate, appendToTriggerPath("customStacks"), false, true, extraSetFunctionReload);
return customOptions;
@@ -365,9 +356,9 @@ local function GetGenericTriggerOptions(data, triggernum)
values = function()
local type= trigger.type;
if(type == "event") then
return event_types;
return OptionsPrivate.Private.event_types;
elseif(type == "status") then
return status_types;
return OptionsPrivate.Private.status_types;
end
end,
get = function(info)
@@ -375,7 +366,7 @@ local function GetGenericTriggerOptions(data, triggernum)
end,
set = function(info, v)
trigger.event = v
local prototype = WeakAuras.event_prototypes[v];
local prototype = OptionsPrivate.Private.event_prototypes[v];
if(prototype) then
if(prototype.automaticrequired) then
trigger.unevent = "auto";
@@ -391,8 +382,8 @@ local function GetGenericTriggerOptions(data, triggernum)
},
}
WeakAuras.commonOptions.AddCommonTriggerOptions(options, data, triggernum)
WeakAuras.AddTriggerMetaFunctions(options, data, triggernum)
OptionsPrivate.commonOptions.AddCommonTriggerOptions(options, data, triggernum)
OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
local combatLogOptions =
{
@@ -401,7 +392,7 @@ local function GetGenericTriggerOptions(data, triggernum)
name = L["Message Prefix"],
width = WeakAuras.normalWidth,
order = 8,
values = subevent_prefix_types,
values = OptionsPrivate.Private.subevent_prefix_types,
control = "WeakAurasSortedDropdown",
hidden = function() return not (trigger.type == "event" and trigger.event == "Combat Log"); end,
get = function(info)
@@ -417,9 +408,9 @@ local function GetGenericTriggerOptions(data, triggernum)
width = WeakAuras.normalWidth,
name = L["Message Suffix"],
order = 9,
values = subevent_suffix_types,
values = OptionsPrivate.Private.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 OptionsPrivate.Private.subevent_actual_prefix_types[trigger.subeventPrefix]); end,
get = function(info)
return trigger.subeventSuffix
end,
@@ -441,8 +432,8 @@ local function GetGenericTriggerOptions(data, triggernum)
elseif (triggerType == "status" or triggerType == "event") then
local prototypeOptions;
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(OptionsPrivate.Private.event_prototypes[trigger.event]) then
prototypeOptions = OptionsPrivate.ConstructOptions(OptionsPrivate.Private.event_prototypes[trigger.event], data, 10, triggernum);
if (trigger.event == "Combat Log") then
WeakAuras.Mixin(prototypeOptions, combatLogOptions);
end