from retail
This commit is contained in:
@@ -1216,6 +1216,17 @@ function Private.Modernize(data)
|
|||||||
data.forceEvents = nil
|
data.forceEvents = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if data.internalVersion < 62 then
|
||||||
|
if data.regionType == "dynamicgroup" then
|
||||||
|
if data.sort == "CUSTOM" and type(data.sortOn) ~= "string" then
|
||||||
|
data.sortOn = "changed"
|
||||||
|
end
|
||||||
|
if data.grow == "CUSTOM" and type(data.growOn) ~= "string" then
|
||||||
|
data.growOn = "changed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if data.internalVersion < 67 or data.internalVersion > WeakAuras.InternalVersion() then
|
if data.internalVersion < 67 or data.internalVersion > WeakAuras.InternalVersion() then
|
||||||
local castMigrationNeeded = data.internalVersion < 67
|
local castMigrationNeeded = data.internalVersion < 67
|
||||||
data.internalVersion = WeakAuras.InternalVersion()
|
data.internalVersion = WeakAuras.InternalVersion()
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ local function create(parent)
|
|||||||
region.sortedChildren = {}
|
region.sortedChildren = {}
|
||||||
region.controlledChildren = {}
|
region.controlledChildren = {}
|
||||||
region.updatedChildren = {}
|
region.updatedChildren = {}
|
||||||
|
region.sortStates = {}
|
||||||
|
region.growStates = {}
|
||||||
local background = CreateFrame("Frame", nil, region)
|
local background = CreateFrame("Frame", nil, region)
|
||||||
region.background = background
|
region.background = background
|
||||||
region.selfPoint = "TOPLEFT"
|
region.selfPoint = "TOPLEFT"
|
||||||
@@ -272,7 +274,7 @@ local sorters = {
|
|||||||
return WeakAuras.ComposeSorts(
|
return WeakAuras.ComposeSorts(
|
||||||
WeakAuras.SortAscending({"dataIndex"}),
|
WeakAuras.SortAscending({"dataIndex"}),
|
||||||
WeakAuras.SortAscending({"region", "state", "index"})
|
WeakAuras.SortAscending({"region", "state", "index"})
|
||||||
)
|
), { index = true }
|
||||||
end,
|
end,
|
||||||
hybrid = function(data)
|
hybrid = function(data)
|
||||||
local sortHybridTable = data.sortHybridTable or {}
|
local sortHybridTable = data.sortHybridTable or {}
|
||||||
@@ -303,23 +305,31 @@ local sorters = {
|
|||||||
sortHybridStatus,
|
sortHybridStatus,
|
||||||
sortExpirationTime,
|
sortExpirationTime,
|
||||||
WeakAuras.SortAscending({"dataIndex"})
|
WeakAuras.SortAscending({"dataIndex"})
|
||||||
)
|
), {expirationTime = true}
|
||||||
end,
|
end,
|
||||||
ascending = function(data)
|
ascending = function(data)
|
||||||
return WeakAuras.ComposeSorts(
|
return WeakAuras.ComposeSorts(
|
||||||
WeakAuras.SortAscending({"region", "state", "expirationTime"}),
|
WeakAuras.SortAscending({"region", "state", "expirationTime"}),
|
||||||
WeakAuras.SortAscending({"dataIndex"})
|
WeakAuras.SortAscending({"dataIndex"})
|
||||||
)
|
), {expirationTime = true}
|
||||||
end,
|
end,
|
||||||
descending = function(data)
|
descending = function(data)
|
||||||
return WeakAuras.ComposeSorts(
|
return WeakAuras.ComposeSorts(
|
||||||
WeakAuras.SortDescending({"region", "state", "expirationTime"}),
|
WeakAuras.SortDescending({"region", "state", "expirationTime"}),
|
||||||
WeakAuras.SortAscending({"dataIndex"})
|
WeakAuras.SortAscending({"dataIndex"})
|
||||||
)
|
), {expirationTime = true}
|
||||||
end,
|
end,
|
||||||
custom = function(data)
|
custom = function(data)
|
||||||
local sortStr = data.customSort or ""
|
local sortStr = data.customSort or ""
|
||||||
local sortFunc = WeakAuras.LoadFunction("return " .. sortStr) or noop
|
local sortFunc = WeakAuras.LoadFunction("return " .. sortStr) or noop
|
||||||
|
local sortOn = nil
|
||||||
|
local events = WeakAuras.split(data.sortOn or "")
|
||||||
|
if #events > 0 then
|
||||||
|
sortOn = {}
|
||||||
|
for _, event in ipairs(events) do
|
||||||
|
events[event] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
return function(a, b)
|
return function(a, b)
|
||||||
Private.ActivateAuraEnvironment(data.id)
|
Private.ActivateAuraEnvironment(data.id)
|
||||||
local ok, result = pcall(sortFunc, a, b)
|
local ok, result = pcall(sortFunc, a, b)
|
||||||
@@ -329,7 +339,7 @@ local sorters = {
|
|||||||
else
|
else
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
end
|
end, sortOn
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
WeakAuras.SortFunctions = sorters
|
WeakAuras.SortFunctions = sorters
|
||||||
@@ -914,6 +924,14 @@ local growers = {
|
|||||||
CUSTOM = function(data)
|
CUSTOM = function(data)
|
||||||
local growStr = data.customGrow or ""
|
local growStr = data.customGrow or ""
|
||||||
local growFunc = WeakAuras.LoadFunction("return " .. growStr) or noop
|
local growFunc = WeakAuras.LoadFunction("return " .. growStr) or noop
|
||||||
|
local growOn = nil
|
||||||
|
local events = WeakAuras.split(data.growOn or "")
|
||||||
|
if #events > 0 then
|
||||||
|
growOn = {}
|
||||||
|
for _, event in ipairs(events) do
|
||||||
|
events[event] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
return function(newPositions, activeRegions)
|
return function(newPositions, activeRegions)
|
||||||
Private.ActivateAuraEnvironment(data.id)
|
Private.ActivateAuraEnvironment(data.id)
|
||||||
local ok, ret = pcall(growFunc, newPositions, activeRegions)
|
local ok, ret = pcall(growFunc, newPositions, activeRegions)
|
||||||
@@ -922,7 +940,7 @@ local growers = {
|
|||||||
Private.GetErrorHandlerId(data.id, L["Custom Grow"])
|
Private.GetErrorHandlerId(data.id, L["Custom Grow"])
|
||||||
wipe(newPositions)
|
wipe(newPositions)
|
||||||
end
|
end
|
||||||
end
|
end, growOn
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
WeakAuras.GrowFunctions = growers
|
WeakAuras.GrowFunctions = growers
|
||||||
@@ -939,6 +957,50 @@ local function SafeGetPos(region, func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function isDifferent(regionData, cache, events)
|
||||||
|
local id = regionData.id
|
||||||
|
local cloneId = regionData.cloneId or ""
|
||||||
|
local state = regionData.region.state
|
||||||
|
if not events then
|
||||||
|
return false
|
||||||
|
elseif events.changed then
|
||||||
|
return true -- escape hatch, not super recommended
|
||||||
|
else
|
||||||
|
local isDifferent = false
|
||||||
|
if not cache[id] then
|
||||||
|
isDifferent = true
|
||||||
|
local cachedState = {}
|
||||||
|
cache[id] = {[cloneId] = cachedState}
|
||||||
|
for event in pairs(events) do
|
||||||
|
cachedState[event] = state[event]
|
||||||
|
end
|
||||||
|
elseif not cache[id][cloneId] then
|
||||||
|
isDifferent = true
|
||||||
|
local cachedState = {}
|
||||||
|
cache[id][cloneId] = cachedState
|
||||||
|
for event in pairs(events) do
|
||||||
|
cachedState[event] = state[event]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local cachedState = cache[id][cloneId]
|
||||||
|
for event in pairs(events) do
|
||||||
|
if regionData.region.state[event] ~= cachedState[event] then
|
||||||
|
cachedState[event] = regionData.region.state[event]
|
||||||
|
isDifferent = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return isDifferent
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clearCache(cache, id, cloneId)
|
||||||
|
cloneId = cloneId or ""
|
||||||
|
if cache[id] then
|
||||||
|
cache[id][cloneId] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function modify(parent, region, data)
|
local function modify(parent, region, data)
|
||||||
Private.FixGroupChildrenOrderForGroup(data)
|
Private.FixGroupChildrenOrderForGroup(data)
|
||||||
region:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1)
|
region:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1)
|
||||||
@@ -1065,6 +1127,8 @@ local function modify(parent, region, data)
|
|||||||
Private.StartProfileAura(data.id)
|
Private.StartProfileAura(data.id)
|
||||||
self.needToReload = false
|
self.needToReload = false
|
||||||
self.sortedChildren = {}
|
self.sortedChildren = {}
|
||||||
|
self.sortStates = {}
|
||||||
|
self.growStates = {}
|
||||||
self.controlledChildren = {}
|
self.controlledChildren = {}
|
||||||
self.updatedChildren = {}
|
self.updatedChildren = {}
|
||||||
self.controlPoints:ReleaseAll()
|
self.controlPoints:ReleaseAll()
|
||||||
@@ -1128,9 +1192,14 @@ local function modify(parent, region, data)
|
|||||||
-- if it has been, then don't insert it again
|
-- if it has been, then don't insert it again
|
||||||
if not regionData.active and self.updatedChildren[regionData] == nil then
|
if not regionData.active and self.updatedChildren[regionData] == nil then
|
||||||
tinsert(self.sortedChildren, regionData)
|
tinsert(self.sortedChildren, regionData)
|
||||||
|
self.updatedChildren[regionData] = true
|
||||||
|
self:SortUpdatedChildren()
|
||||||
|
elseif isDifferent(regionData, self.sortStates, self.sortOn) then
|
||||||
|
self.updatedChildren[regionData] = true
|
||||||
|
self:SortUpdatedChildren()
|
||||||
|
elseif isDifferent(regionData, self.growStates, self.growOn) then
|
||||||
|
self:PositionChildren()
|
||||||
end
|
end
|
||||||
self.updatedChildren[regionData] = true
|
|
||||||
self:SortUpdatedChildren()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function region:RemoveChild(childID, cloneID)
|
function region:RemoveChild(childID, cloneID)
|
||||||
@@ -1140,6 +1209,8 @@ local function modify(parent, region, data)
|
|||||||
if not regionData then return end
|
if not regionData then return end
|
||||||
releaseRegionData(regionData)
|
releaseRegionData(regionData)
|
||||||
self.updatedChildren[regionData] = false
|
self.updatedChildren[regionData] = false
|
||||||
|
clearCache(self.sortStates, childID, cloneID)
|
||||||
|
clearCache(self.growStates, childID, cloneID)
|
||||||
self:SortUpdatedChildren()
|
self:SortUpdatedChildren()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1150,10 +1221,12 @@ local function modify(parent, region, data)
|
|||||||
if regionData and not regionData.region.toShow then
|
if regionData and not regionData.region.toShow then
|
||||||
self.updatedChildren[regionData] = false
|
self.updatedChildren[regionData] = false
|
||||||
end
|
end
|
||||||
|
clearCache(self.sortStates, childID, cloneID)
|
||||||
|
clearCache(self.growStates, childID, cloneID)
|
||||||
self:SortUpdatedChildren()
|
self:SortUpdatedChildren()
|
||||||
end
|
end
|
||||||
|
|
||||||
region.sortFunc = createSortFunc(data)
|
region.sortFunc, region.sortOn = createSortFunc(data)
|
||||||
|
|
||||||
function region:SortUpdatedChildren()
|
function region:SortUpdatedChildren()
|
||||||
-- iterates through cache to insert all updated children in the right spot
|
-- iterates through cache to insert all updated children in the right spot
|
||||||
@@ -1198,7 +1271,7 @@ local function modify(parent, region, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
region.growFunc = createGrowFunc(data)
|
region.growFunc, region.growOn = createGrowFunc(data)
|
||||||
region.anchorPerUnit = data.useAnchorPerUnit and data.anchorPerUnit
|
region.anchorPerUnit = data.useAnchorPerUnit and data.anchorPerUnit
|
||||||
|
|
||||||
local animate = data.animate
|
local animate = data.animate
|
||||||
|
|||||||
@@ -2,13 +2,8 @@ if not WeakAuras.IsLibsOK() then return end
|
|||||||
local AddonName, Private = ...
|
local AddonName, Private = ...
|
||||||
|
|
||||||
local LCG = LibStub("LibCustomGlow-1.0")
|
local LCG = LibStub("LibCustomGlow-1.0")
|
||||||
local MSQ, MSQ_Version = LibStub("Masque", true);
|
local MSQ = LibStub("Masque", true);
|
||||||
if MSQ then
|
local L = WeakAuras.L
|
||||||
if MSQ_Version <= 80100 then
|
|
||||||
MSQ = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local L = WeakAuras.L;
|
|
||||||
|
|
||||||
local default = function(parentType)
|
local default = function(parentType)
|
||||||
local options = {
|
local options = {
|
||||||
@@ -177,16 +172,16 @@ local funcs = {
|
|||||||
if (visible) then
|
if (visible) then
|
||||||
self.__MSQ_Shape = self:GetParent().button.__MSQ_Shape
|
self.__MSQ_Shape = self:GetParent().button.__MSQ_Shape
|
||||||
self:Show()
|
self:Show()
|
||||||
glowStart(self, self, color);
|
glowStart(self, self, color)
|
||||||
else
|
else
|
||||||
self.glowStop(self);
|
self.glowStop(self)
|
||||||
self:Hide()
|
self:Hide()
|
||||||
end
|
end
|
||||||
elseif (visible) then
|
elseif (visible) then
|
||||||
self:Show()
|
self:Show()
|
||||||
glowStart(self, self, color);
|
glowStart(self, self, color)
|
||||||
else
|
else
|
||||||
self.glowStop(self);
|
self.glowStop(self)
|
||||||
self:Hide()
|
self:Hide()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- a sound from each setter
|
||||||
|
local lastPlayedSoundFromSet
|
||||||
|
|
||||||
function OptionsPrivate.GetActionOptions(data)
|
function OptionsPrivate.GetActionOptions(data)
|
||||||
local action = {
|
local action = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@@ -63,9 +66,15 @@ function OptionsPrivate.GetActionOptions(data)
|
|||||||
data.actions[field][value] = v;
|
data.actions[field][value] = v;
|
||||||
end
|
end
|
||||||
if(value == "sound" or value == "sound_path") then
|
if(value == "sound" or value == "sound_path") then
|
||||||
pcall(PlaySoundFile, v, "Master");
|
if lastPlayedSoundFromSet ~= GetTime() then
|
||||||
|
pcall(PlaySoundFile, v, "Master")
|
||||||
|
lastPlayedSoundFromSet = GetTime()
|
||||||
|
end
|
||||||
elseif(value == "sound_kit_id") then
|
elseif(value == "sound_kit_id") then
|
||||||
pcall(PlaySound, v, "Master");
|
if lastPlayedSoundFromSet ~= GetTime() then
|
||||||
|
pcall(PlaySound, v, "Master")
|
||||||
|
lastPlayedSoundFromSet = GetTime()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
WeakAuras.Add(data);
|
WeakAuras.Add(data);
|
||||||
if(value == "message") then
|
if(value == "message") then
|
||||||
|
|||||||
@@ -2474,17 +2474,18 @@ local function valuesAreEqual(t1, t2)
|
|||||||
if ty1 ~= ty2 then
|
if ty1 ~= ty2 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
if ty1 == "number" then
|
||||||
|
return abs(t1 - t2) < 1e-9
|
||||||
|
end
|
||||||
if ty1 ~= "table" then
|
if ty1 ~= "table" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
for k1, v1 in pairs(t1) do
|
for k1, v1 in pairs(t1) do
|
||||||
local v2 = t2[k1]
|
local v2 = t2[k1]
|
||||||
if v2 == nil or not valuesAreEqual(v1, v2) then
|
if v2 == nil or not valuesAreEqual(v1, v2) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for k2, v2 in pairs(t2) do
|
for k2, v2 in pairs(t2) do
|
||||||
local v1 = t1[k2]
|
local v1 = t1[k2]
|
||||||
if v1 == nil or not valuesAreEqual(v1, v2) then
|
if v1 == nil or not valuesAreEqual(v1, v2) then
|
||||||
|
|||||||
@@ -187,13 +187,22 @@ local function filterUsedProperties(indexToProperty, allDisplays, usedProperties
|
|||||||
return filtered;
|
return filtered;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- a sound from each setter
|
||||||
|
local lastPlayedSoundFromSet
|
||||||
|
|
||||||
local function wrapWithPlaySound(func, kit)
|
local function wrapWithPlaySound(func, kit)
|
||||||
return function(info, v)
|
return function(info, v)
|
||||||
func(info, v);
|
func(info, v);
|
||||||
if (tonumber(v)) then
|
if (tonumber(v)) then
|
||||||
pcall(PlaySound, tonumber(v), "Master");
|
if lastPlayedSoundFromSet ~= GetTime() then
|
||||||
|
pcall(PlaySound, tonumber(v), "Master")
|
||||||
|
lastPlayedSoundFromSet = GetTime()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
pcall(PlaySoundFile, v, "Master");
|
if lastPlayedSoundFromSet ~= GetTime() then
|
||||||
|
pcall(PlaySoundFile, v, "Master")
|
||||||
|
lastPlayedSoundFromSet = GetTime()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -139,6 +139,23 @@ local function createOptions(id, data)
|
|||||||
OptionsPrivate.ResetMoverSizer()
|
OptionsPrivate.ResetMoverSizer()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
growOn = {
|
||||||
|
type = "input",
|
||||||
|
width = WeakAuras.doubleWidth,
|
||||||
|
name = L["Run on..."],
|
||||||
|
desc = L["You can add a comma-separated list of state values here that (when changed) WeakAuras should also run the Grow Code on.\n\nWeakAuras will always run custom grow code if you include 'changed' in this list, or when a region is added, removed, or re-ordered."],
|
||||||
|
order = 2 - 0.1,
|
||||||
|
get = function()
|
||||||
|
return data.growOn or ""
|
||||||
|
end,
|
||||||
|
hidden = function() return data.grow ~= "CUSTOM" end,
|
||||||
|
set = function(info, v)
|
||||||
|
data.growOn = v
|
||||||
|
WeakAuras.Add(data)
|
||||||
|
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||||
|
OptionsPrivate.ResetMoverSizer()
|
||||||
|
end
|
||||||
|
},
|
||||||
useAnchorPerUnit = {
|
useAnchorPerUnit = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
order = 1.5,
|
order = 1.5,
|
||||||
@@ -366,6 +383,23 @@ local function createOptions(id, data)
|
|||||||
order = 20,
|
order = 20,
|
||||||
values = OptionsPrivate.Private.group_sort_types
|
values = OptionsPrivate.Private.group_sort_types
|
||||||
},
|
},
|
||||||
|
sortOn = {
|
||||||
|
type = "input",
|
||||||
|
width = WeakAuras.doubleWidth,
|
||||||
|
name = L["Run on..."],
|
||||||
|
desc = L["You can add a comma-separated list of state values here that (when changed) WeakAuras should also run the sort code on.WeakAuras will always run custom sort code if you include 'changed' in this list, or when a region is added, removed."],
|
||||||
|
order = 21 - 0.1,
|
||||||
|
get = function()
|
||||||
|
return data.sortOn or ""
|
||||||
|
end,
|
||||||
|
hidden = function() return data.sort ~= "custom" end,
|
||||||
|
set = function(info, v)
|
||||||
|
data.sortOn = v
|
||||||
|
WeakAuras.Add(data)
|
||||||
|
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||||
|
OptionsPrivate.ResetMoverSizer()
|
||||||
|
end
|
||||||
|
},
|
||||||
-- custom sort option added below
|
-- custom sort option added below
|
||||||
hybridPosition = {
|
hybridPosition = {
|
||||||
type = "select",
|
type = "select",
|
||||||
|
|||||||
Reference in New Issue
Block a user