beta
This commit is contained in:
+27
-12
@@ -302,9 +302,7 @@ local function Update(data, diff)
|
||||
WeakAuras.Add(data)
|
||||
return
|
||||
end
|
||||
if data then
|
||||
WeakAuras.DeleteOption(data)
|
||||
else
|
||||
if not data then
|
||||
return
|
||||
end
|
||||
recurseUpdate(data, diff)
|
||||
@@ -345,7 +343,7 @@ local function install(data, oldData, patch, mode, isParent)
|
||||
elseif not data then
|
||||
-- this is an old thing
|
||||
if checkButtons.oldchildren:GetChecked() then
|
||||
WeakAuras.DeleteOption(oldData)
|
||||
WeakAuras.Delete(oldData)
|
||||
return
|
||||
else
|
||||
-- user has chosen to not delete obsolete auras, so do nothing
|
||||
@@ -367,6 +365,7 @@ local function install(data, oldData, patch, mode, isParent)
|
||||
patch.id = WeakAuras.FindUnusedId(patch.id)
|
||||
end
|
||||
end
|
||||
WeakAuras.Delete(oldData)
|
||||
if data.uid and data.uid ~= oldData.uid then
|
||||
oldData.uid = data.uid
|
||||
end
|
||||
@@ -395,7 +394,9 @@ local function importPendingData()
|
||||
thumbnailAnchor.currentThumbnail = nil
|
||||
end
|
||||
if imports and Private.LoadOptions() then
|
||||
WeakAuras.ShowOptions()
|
||||
if not WeakAuras.IsOptionsOpen() then
|
||||
WeakAuras.OpenOptions()
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
@@ -547,7 +548,7 @@ local function importPendingData()
|
||||
local oldToNew = indexMap.oldToNew
|
||||
for oldIndex, oldData in ipairs(old) do
|
||||
if not oldToNew[oldIndex] and WeakAuras.GetData(oldData.id) then
|
||||
WeakAuras.DeleteOption(oldData)
|
||||
WeakAuras.Delete(oldData)
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
@@ -1210,7 +1211,6 @@ local function diff(ours, theirs)
|
||||
end
|
||||
|
||||
local function findMatch(data, children)
|
||||
|
||||
local function isParentMatch(old, new)
|
||||
if old.parent then return end
|
||||
if old.uid and new.uid then
|
||||
@@ -1252,10 +1252,22 @@ local function findMatch(data, children)
|
||||
return oldParent
|
||||
end
|
||||
|
||||
local function MatchInfo(data, children, target)
|
||||
-- match the parent/single aura (if no children)
|
||||
local oldParent = target or findMatch(data, children)
|
||||
if not oldParent then return nil end
|
||||
local function MatchInfo(data, children, oldParent)
|
||||
if oldParent then
|
||||
-- Either both have children, or both don't have
|
||||
if type(children) ~= type(oldParent.controlledChildren) then
|
||||
return nil
|
||||
end
|
||||
else
|
||||
-- match the parent/single aura (if no children)
|
||||
oldParent = findMatch(data, children)
|
||||
end
|
||||
|
||||
if not oldParent then
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
-- setup
|
||||
local info = {
|
||||
mode = 1,
|
||||
@@ -1615,7 +1627,7 @@ local function ShowDisplayTooltip(data, children, matchInfo, icon, icons, import
|
||||
if regionOptions[regionType] then
|
||||
local ok, thumbnail = pcall(regionOptions[regionType].acquireThumbnail, thumbnailAnchor, data);
|
||||
if not ok then
|
||||
error("Error creating thumbnail", 2)
|
||||
error(string.format("Error creating thumbnail for %s %s", regionType, thumbnail), 2)
|
||||
end
|
||||
thumbnailAnchor.currentThumbnail = thumbnail
|
||||
thumbnailAnchor.currentThumbnailType = regionType
|
||||
@@ -1692,6 +1704,9 @@ function WeakAuras.Import(inData, target)
|
||||
end
|
||||
tooltipLoading = nil;
|
||||
local matchInfo = MatchInfo(data, children, target)
|
||||
if matchInfo == nil and target then
|
||||
return false, "Import data did not match to target"
|
||||
end
|
||||
ShowDisplayTooltip(data, children, matchInfo, icon, icons, "unknown")
|
||||
return status, msg
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user