from retail
This commit is contained in:
@@ -23,6 +23,37 @@ local function AdjustConditions(data, replacements)
|
||||
end
|
||||
end
|
||||
|
||||
local function ReplacePrefix(hay, replacements)
|
||||
for old, new in pairs(replacements) do
|
||||
if hay:sub(1, #old) == old then
|
||||
return new .. hay:sub(#old + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function AdjustAnchors(data, replacements)
|
||||
if not data.subRegions then
|
||||
return
|
||||
end
|
||||
|
||||
for _, subRegionData in ipairs(data.subRegions) do
|
||||
local anchor_area = subRegionData.anchor_area
|
||||
if anchor_area then
|
||||
local replaced = ReplacePrefix(anchor_area, replacements)
|
||||
if replaced then
|
||||
subRegionData.anchor_area = replaced
|
||||
end
|
||||
end
|
||||
local anchor_point = subRegionData.anchor_point
|
||||
if anchor_point then
|
||||
local replaced = ReplacePrefix(anchor_point, replacements)
|
||||
if replaced then
|
||||
subRegionData.anchor_point = replaced
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OptionsPrivate.DeleteSubRegion(data, index, regionType)
|
||||
if not data.subRegions then
|
||||
return
|
||||
@@ -39,6 +70,7 @@ function OptionsPrivate.DeleteSubRegion(data, index, regionType)
|
||||
end
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
@@ -58,6 +90,7 @@ function OptionsPrivate.MoveSubRegionUp(data, index, regionType)
|
||||
}
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
@@ -77,6 +110,7 @@ function OptionsPrivate.MoveSubRegionDown(data, index, regionType)
|
||||
}
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
@@ -95,7 +129,8 @@ function OptionsPrivate.DuplicateSubRegion(data, index, regionType)
|
||||
for i = index + 1, #data.subRegions do
|
||||
replacements["sub." .. i .. "."] = "sub." .. (i + 1) .. "."
|
||||
end
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustConditions(data, replacements)
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
|
||||
Reference in New Issue
Block a user