from retail
This commit is contained in:
@@ -780,12 +780,17 @@ function GenericTrigger.CreateFakeStates(id, triggernum)
|
|||||||
local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum);
|
local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum);
|
||||||
RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, "OPTIONS")
|
RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, "OPTIONS")
|
||||||
|
|
||||||
|
local canHaveDuration = events[id][triggernum].prototype and events[id][triggernum].prototype.canHaveDuration == "timed"
|
||||||
|
|
||||||
local shown = 0
|
local shown = 0
|
||||||
for id, state in pairs(allStates) do
|
for id, state in pairs(allStates) do
|
||||||
if state.show then
|
if state.show then
|
||||||
shown = shown + 1
|
shown = shown + 1
|
||||||
end
|
end
|
||||||
state.autoHide = false
|
state.autoHide = false
|
||||||
|
if canHaveDuration and state.expirationTime == nil then
|
||||||
|
state.progressType = "timed"
|
||||||
|
end
|
||||||
AddFakeTime(state)
|
AddFakeTime(state)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -794,6 +799,9 @@ function GenericTrigger.CreateFakeStates(id, triggernum)
|
|||||||
GenericTrigger.CreateFallbackState(data, triggernum, state)
|
GenericTrigger.CreateFallbackState(data, triggernum, state)
|
||||||
allStates[""] = state
|
allStates[""] = state
|
||||||
state.autoHide = false
|
state.autoHide = false
|
||||||
|
if canHaveDuration and state.expirationTime == nil then
|
||||||
|
state.progressType = "timed"
|
||||||
|
end
|
||||||
AddFakeTime(state)
|
AddFakeTime(state)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1135,6 +1143,7 @@ function GenericTrigger.Add(data, region)
|
|||||||
local force_events = false;
|
local force_events = false;
|
||||||
local durationFunc, overlayFuncs, nameFunc, iconFunc, textureFunc, stacksFunc, loadFunc;
|
local durationFunc, overlayFuncs, nameFunc, iconFunc, textureFunc, stacksFunc, loadFunc;
|
||||||
local tsuConditionVariables;
|
local tsuConditionVariables;
|
||||||
|
local prototype = nil
|
||||||
if(triggerType == "status" or triggerType == "event") then
|
if(triggerType == "status" or triggerType == "event") then
|
||||||
if not(trigger.event) then
|
if not(trigger.event) then
|
||||||
error("Improper arguments to WeakAuras.Add - trigger type is \"event\" but event is not defined");
|
error("Improper arguments to WeakAuras.Add - trigger type is \"event\" but event is not defined");
|
||||||
@@ -1157,24 +1166,25 @@ function GenericTrigger.Add(data, region)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
triggerFuncStr = ConstructFunction(event_prototypes[trigger.event], trigger);
|
prototype = event_prototypes[trigger.event]
|
||||||
|
triggerFuncStr = ConstructFunction(prototype, trigger);
|
||||||
|
|
||||||
statesParameter = event_prototypes[trigger.event].statesParameter;
|
statesParameter = prototype.statesParameter;
|
||||||
WeakAuras.debug(id.." - "..triggernum.." - Trigger", 1);
|
WeakAuras.debug(id.." - "..triggernum.." - Trigger", 1);
|
||||||
WeakAuras.debug(triggerFuncStr);
|
WeakAuras.debug(triggerFuncStr);
|
||||||
triggerFunc = WeakAuras.LoadFunction(triggerFuncStr, id);
|
triggerFunc = WeakAuras.LoadFunction(triggerFuncStr, id);
|
||||||
|
|
||||||
durationFunc = event_prototypes[trigger.event].durationFunc;
|
durationFunc = prototype.durationFunc;
|
||||||
nameFunc = event_prototypes[trigger.event].nameFunc;
|
nameFunc = prototype.nameFunc;
|
||||||
iconFunc = event_prototypes[trigger.event].iconFunc;
|
iconFunc = prototype.iconFunc;
|
||||||
textureFunc = event_prototypes[trigger.event].textureFunc;
|
textureFunc = prototype.textureFunc;
|
||||||
stacksFunc = event_prototypes[trigger.event].stacksFunc;
|
stacksFunc = prototype.stacksFunc;
|
||||||
loadFunc = event_prototypes[trigger.event].loadFunc;
|
loadFunc = prototype.loadFunc;
|
||||||
|
|
||||||
if (event_prototypes[trigger.event].overlayFuncs) then
|
if (prototype.overlayFuncs) then
|
||||||
overlayFuncs = {};
|
overlayFuncs = {};
|
||||||
local dest = 1;
|
local dest = 1;
|
||||||
for i, v in ipairs(event_prototypes[trigger.event].overlayFuncs) do
|
for i, v in ipairs(prototype.overlayFuncs) do
|
||||||
if (v.enable(trigger)) then
|
if (v.enable(trigger)) then
|
||||||
overlayFuncs[dest] = v.func;
|
overlayFuncs[dest] = v.func;
|
||||||
dest = dest + 1;
|
dest = dest + 1;
|
||||||
@@ -1182,11 +1192,11 @@ function GenericTrigger.Add(data, region)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (event_prototypes[trigger.event].automaticrequired) then
|
if (prototype.automaticrequired) then
|
||||||
trigger.unevent = "auto";
|
trigger.unevent = "auto";
|
||||||
elseif event_prototypes[trigger.event].timedrequired then
|
elseif prototype.timedrequired then
|
||||||
if type(event_prototypes[trigger.event].timedrequired) == "function" then
|
if type(prototype.timedrequired) == "function" then
|
||||||
if event_prototypes[trigger.event].timedrequired(trigger) then
|
if prototype.timedrequired(trigger) then
|
||||||
trigger.unevent = "timed"
|
trigger.unevent = "timed"
|
||||||
else
|
else
|
||||||
if not(WeakAuras.eventend_types[trigger.unevent]) then
|
if not(WeakAuras.eventend_types[trigger.unevent]) then
|
||||||
@@ -1196,7 +1206,7 @@ function GenericTrigger.Add(data, region)
|
|||||||
else
|
else
|
||||||
trigger.unevent = "timed"
|
trigger.unevent = "timed"
|
||||||
end
|
end
|
||||||
elseif event_prototypes[trigger.event].automatic then
|
elseif prototype.automatic then
|
||||||
if not(WeakAuras.autoeventend_types[trigger.unevent]) then
|
if not(WeakAuras.autoeventend_types[trigger.unevent]) then
|
||||||
trigger.unevent = "auto"
|
trigger.unevent = "auto"
|
||||||
end
|
end
|
||||||
@@ -1208,9 +1218,9 @@ function GenericTrigger.Add(data, region)
|
|||||||
trigger.duration = trigger.duration or "1"
|
trigger.duration = trigger.duration or "1"
|
||||||
|
|
||||||
if(trigger.unevent == "custom") then
|
if(trigger.unevent == "custom") then
|
||||||
untriggerFuncStr = ConstructFunction(event_prototypes[trigger.event], untrigger);
|
untriggerFuncStr = ConstructFunction(prototype, untrigger);
|
||||||
elseif(trigger.unevent == "auto") then
|
elseif(trigger.unevent == "auto") then
|
||||||
untriggerFuncStr = ConstructFunction(event_prototypes[trigger.event], trigger, true);
|
untriggerFuncStr = ConstructFunction(prototype, trigger, true);
|
||||||
end
|
end
|
||||||
|
|
||||||
if(untriggerFuncStr) then
|
if(untriggerFuncStr) then
|
||||||
@@ -1219,7 +1229,7 @@ function GenericTrigger.Add(data, region)
|
|||||||
untriggerFunc = WeakAuras.LoadFunction(untriggerFuncStr, id);
|
untriggerFunc = WeakAuras.LoadFunction(untriggerFuncStr, id);
|
||||||
end
|
end
|
||||||
|
|
||||||
local prototype = event_prototypes[trigger.event];
|
|
||||||
if(prototype) then
|
if(prototype) then
|
||||||
local trigger_all_events = prototype.events;
|
local trigger_all_events = prototype.events;
|
||||||
internal_events = prototype.internal_events;
|
internal_events = prototype.internal_events;
|
||||||
@@ -1380,7 +1390,8 @@ function GenericTrigger.Add(data, region)
|
|||||||
loadFunc = loadFunc,
|
loadFunc = loadFunc,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
automaticAutoHide = automaticAutoHide,
|
automaticAutoHide = automaticAutoHide,
|
||||||
tsuConditionVariables = tsuConditionVariables
|
tsuConditionVariables = tsuConditionVariables,
|
||||||
|
prototype = prototype
|
||||||
};
|
};
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ local function CreateDisabledAll(subOption)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function disabeldOrHiddenChild(childOptionTable, info)
|
local function disabledOrHiddenChild(childOptionTable, info)
|
||||||
return hiddenChild(childOptionTable, info) or disabledChild(childOptionTable, info);
|
return hiddenChild(childOptionTable, info) or disabledChild(childOptionTable, info);
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -404,7 +404,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
|||||||
childOptionTable[i] = options;
|
childOptionTable[i] = options;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (hiddenChild(childOptionTable, info)) then
|
if (disabledOrHiddenChild(childOptionTable, info)) then
|
||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -776,12 +776,54 @@ local function replaceValuesFuncs(intable, data, subOption)
|
|||||||
recurse(intable);
|
recurse(intable);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local getHelper = {
|
||||||
|
first = true,
|
||||||
|
combinedValues = {},
|
||||||
|
same = true,
|
||||||
|
Set = function(self, values)
|
||||||
|
if self.same == false then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if(self.first) then
|
||||||
|
self.combinedValues = values;
|
||||||
|
self.first = false;
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
if(#self.combinedValues == #values) then
|
||||||
|
for j=1,#self.combinedValues do
|
||||||
|
if(type(self.combinedValues[j]) == "number" and type(values[j]) == "number") then
|
||||||
|
if((math.floor(self.combinedValues[j] * 100) / 100) ~= (math.floor(values[j] * 100) / 100)) then
|
||||||
|
self.same = false;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if(self.combinedValues[j] ~= values[j]) then
|
||||||
|
self.same = false;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.same = false;
|
||||||
|
end
|
||||||
|
return self.same
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
Get = function(self)
|
||||||
|
return self.combinedValues
|
||||||
|
end,
|
||||||
|
HasValue = function(self)
|
||||||
|
return not self.first
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
local function CreateGetAll(subOption)
|
local function CreateGetAll(subOption)
|
||||||
return function(data, info, ...)
|
return function(data, info, ...)
|
||||||
local combinedValues = {};
|
|
||||||
local first = true;
|
|
||||||
local debug = false;
|
|
||||||
local isToggle = nil
|
local isToggle = nil
|
||||||
|
|
||||||
|
local allChildren = CopyTable(getHelper)
|
||||||
|
local enabledChildren = CopyTable(getHelper)
|
||||||
|
|
||||||
for index, childId in ipairs(data.controlledChildren) do
|
for index, childId in ipairs(data.controlledChildren) do
|
||||||
if isToggle == nil then
|
if isToggle == nil then
|
||||||
local childData = WeakAuras.GetData(childId)
|
local childData = WeakAuras.GetData(childId)
|
||||||
@@ -800,38 +842,19 @@ local function CreateGetAll(subOption)
|
|||||||
childOptionTable[i] = childOption;
|
childOptionTable[i] = childOption;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (childOption and not hiddenChild(childOptionTable, info)) then
|
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
|
||||||
for i=#childOptionTable,0,-1 do
|
for i=#childOptionTable,0,-1 do
|
||||||
if(childOptionTable[i].get) then
|
if(childOptionTable[i].get) then
|
||||||
local values = {childOptionTable[i].get(info, ...)};
|
local values = {childOptionTable[i].get(info, ...)};
|
||||||
if isToggle and values[1] == nil then
|
if isToggle and values[1] == nil then
|
||||||
values[1] = false
|
values[1] = false
|
||||||
end
|
end
|
||||||
if(first) then
|
|
||||||
combinedValues = values;
|
local sameAllChildren = allChildren:Set(values)
|
||||||
first = false;
|
local sameEnabledChildren = enabledChildren:Set(values)
|
||||||
else
|
|
||||||
local same = true;
|
if not sameAllChildren and not sameEnabledChildren then
|
||||||
if(#combinedValues == #values) then
|
return nil;
|
||||||
for j=1,#combinedValues do
|
|
||||||
if(type(combinedValues[j]) == "number" and type(values[j]) == "number") then
|
|
||||||
if((math.floor(combinedValues[j] * 100) / 100) ~= (math.floor(values[j] * 100) / 100)) then
|
|
||||||
same = false;
|
|
||||||
break;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if(combinedValues[j] ~= values[j]) then
|
|
||||||
same = false;
|
|
||||||
break;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
same = false;
|
|
||||||
end
|
|
||||||
if not(same) then
|
|
||||||
return nil;
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
@@ -839,7 +862,13 @@ local function CreateGetAll(subOption)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return unpack(combinedValues);
|
|
||||||
|
if enabledChildren:HasValue() then
|
||||||
|
return unpack(enabledChildren:Get())
|
||||||
|
else
|
||||||
|
-- This can happen if all children are disabled
|
||||||
|
return unpack(allChildren:Get())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -859,7 +888,7 @@ local function CreateSetAll(subOption, getAll)
|
|||||||
childOptionTable[i] = childOption;
|
childOptionTable[i] = childOption;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (childOption and not disabeldOrHiddenChild(childOptionTable, info)) then
|
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
|
||||||
for i=#childOptionTable,0,-1 do
|
for i=#childOptionTable,0,-1 do
|
||||||
if(childOptionTable[i].set) then
|
if(childOptionTable[i].set) then
|
||||||
if (childOptionTable[i].type == "multiselect") then
|
if (childOptionTable[i].type == "multiselect") then
|
||||||
@@ -896,7 +925,7 @@ local function CreateExecuteAll(subOption)
|
|||||||
childOptionTable[i] = childOption;
|
childOptionTable[i] = childOption;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (childOption and not disabeldOrHiddenChild(childOptionTable, info)) then
|
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
|
||||||
-- Some functions, that is the expand/collapse functions need to be
|
-- Some functions, that is the expand/collapse functions need to be
|
||||||
-- effectively called only once. Passing in the secondCall parameter allows
|
-- effectively called only once. Passing in the secondCall parameter allows
|
||||||
-- them to distinguish between the first and every other call
|
-- them to distinguish between the first and every other call
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ local function GetCustomTriggerOptions(data, triggernum)
|
|||||||
end,
|
end,
|
||||||
set = function(info, v)
|
set = function(info, v)
|
||||||
trigger.duration = v
|
trigger.duration = v
|
||||||
|
WeakAuras.Add(data)
|
||||||
|
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
addOverlayFunction = {
|
addOverlayFunction = {
|
||||||
@@ -256,7 +258,6 @@ local function GetCustomTriggerOptions(data, triggernum)
|
|||||||
end
|
end
|
||||||
WeakAuras.Add(data);
|
WeakAuras.Add(data);
|
||||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||||
WeakAuras.FillOptions()
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -316,6 +317,7 @@ local function GetCustomTriggerOptions(data, triggernum)
|
|||||||
end
|
end
|
||||||
WeakAuras.Add(data);
|
WeakAuras.Add(data);
|
||||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||||
|
WeakAuras.FillOptions()
|
||||||
end
|
end
|
||||||
|
|
||||||
local extraFunctions = {
|
local extraFunctions = {
|
||||||
|
|||||||
@@ -104,6 +104,13 @@ local function AddOptions(allOptions, data)
|
|||||||
local triggerSystemOptionsFunction = trigger.trigger.type and WeakAuras.triggerTypesOptions[trigger.trigger.type]
|
local triggerSystemOptionsFunction = trigger.trigger.type and WeakAuras.triggerTypesOptions[trigger.trigger.type]
|
||||||
if (triggerSystemOptionsFunction) then
|
if (triggerSystemOptionsFunction) then
|
||||||
triggerOptions = union(triggerOptions, triggerSystemOptionsFunction(data, index))
|
triggerOptions = union(triggerOptions, triggerSystemOptionsFunction(data, index))
|
||||||
|
else
|
||||||
|
local options = {};
|
||||||
|
WeakAuras.commonOptions.AddCommonTriggerOptions(options, data, index)
|
||||||
|
WeakAuras.AddTriggerMetaFunctions(options, data, index)
|
||||||
|
triggerOptions = union(triggerOptions, {
|
||||||
|
["trigger." .. index .. ".unknown"] = options
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user