This commit is contained in:
Bunny67
2020-09-22 17:50:02 +03:00
parent e455eaa4a9
commit ce5da4dc3e
17 changed files with 357 additions and 197 deletions
+27 -8
View File
@@ -1,6 +1,6 @@
local AddonName, Private = ...
local internalVersion = 33;
local internalVersion = 36
-- Lua APIs
local insert = table.insert
@@ -1657,6 +1657,21 @@ function Private.Convert(data, newType)
end
end
-- The default mixin doesn't recurse, this does
function WeakAuras.DeepMixin(dest, source)
local function recurse(source, dest)
for i,v in pairs(source) do
if(type(v) == "table") then
dest[i] = type(dest[i]) == "table" and dest[i] or {};
recurse(v, dest[i]);
else
dest[i] = v;
end
end
end
recurse(source, dest);
end
function WeakAuras.RegisterAddon(addon, displayName, description, icon)
if(addons[addon]) then
addons[addon].displayName = displayName;
@@ -2371,7 +2386,7 @@ local function pAdd(data, simpleChange)
if simpleChange then
db.displays[id] = data
Private.SetRegion(data)
WeakAuras.SetRegion(data)
Private.UpdatedTriggerState(id)
else
if (data.controlledChildren) then
@@ -2380,7 +2395,7 @@ local function pAdd(data, simpleChange)
Private.ClearAuraEnvironment(data.parent);
end
db.displays[id] = data;
Private.SetRegion(data);
WeakAuras.SetRegion(data);
else
local visible
if (WeakAuras.IsOptionsOpen()) then
@@ -2446,7 +2461,7 @@ local function pAdd(data, simpleChange)
timers[id] = nil;
end
local region = Private.SetRegion(data);
local region = WeakAuras.SetRegion(data);
triggerState[id] = {
disjunctive = data.triggers.disjunctive or "all",
@@ -2485,10 +2500,10 @@ function WeakAuras.Add(data, takeSnapshot, simpleChange)
end
end
function Private.SetRegion(data, cloneId)
function WeakAuras.SetRegion(data, cloneId)
local regionType = data.regionType;
if not(regionType) then
error("Improper arguments to Private.SetRegion - regionType not defined");
error("Improper arguments to WeakAuras.SetRegion - regionType not defined");
else
if(not regionTypes[regionType]) then
regionType = "fallback";
@@ -2497,7 +2512,7 @@ function Private.SetRegion(data, cloneId)
local id = data.id;
if not(id) then
error("Improper arguments to Private.SetRegion - id not defined");
error("Improper arguments to WeakAuras.SetRegion - id not defined");
else
local region;
if(cloneId) then
@@ -2585,7 +2600,7 @@ local function EnsureClone(id, cloneId)
clones[id] = clones[id] or {};
if not(clones[id][cloneId]) then
local data = WeakAuras.GetData(id);
Private.SetRegion(data, cloneId);
WeakAuras.SetRegion(data, cloneId);
clones[id][cloneId].justCreated = true;
end
return clones[id][cloneId];
@@ -4588,3 +4603,7 @@ function WeakAuras.ParseNameCheck(name)
return matches
end
function WeakAuras.IsAuraLoaded(id)
return Private.loaded[id]
end