from retail

This commit is contained in:
Bunny67
2020-07-16 23:23:54 +03:00
parent 85345af8a2
commit f9dab14beb
41 changed files with 3843 additions and 3869 deletions
@@ -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