from retail

This commit is contained in:
NoM0Re
2025-01-11 16:33:30 +01:00
parent 49d0fa5f38
commit d7233fe5d7
7 changed files with 159 additions and 27 deletions
+11 -2
View File
@@ -23,6 +23,9 @@ else
end
end
--- a sound from each setter
local lastPlayedSoundFromSet
function OptionsPrivate.GetActionOptions(data)
local action = {
type = "group",
@@ -63,9 +66,15 @@ function OptionsPrivate.GetActionOptions(data)
data.actions[field][value] = v;
end
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
pcall(PlaySound, v, "Master");
if lastPlayedSoundFromSet ~= GetTime() then
pcall(PlaySound, v, "Master")
lastPlayedSoundFromSet = GetTime()
end
end
WeakAuras.Add(data);
if(value == "message") then
+3 -2
View File
@@ -2474,17 +2474,18 @@ local function valuesAreEqual(t1, t2)
if ty1 ~= ty2 then
return false
end
if ty1 == "number" then
return abs(t1 - t2) < 1e-9
end
if ty1 ~= "table" then
return false
end
for k1, v1 in pairs(t1) do
local v2 = t2[k1]
if v2 == nil or not valuesAreEqual(v1, v2) then
return false
end
end
for k2, v2 in pairs(t2) do
local v1 = t1[k2]
if v1 == nil or not valuesAreEqual(v1, v2) then
+11 -2
View File
@@ -187,13 +187,22 @@ local function filterUsedProperties(indexToProperty, allDisplays, usedProperties
return filtered;
end
--- a sound from each setter
local lastPlayedSoundFromSet
local function wrapWithPlaySound(func, kit)
return function(info, v)
func(info, v);
if (tonumber(v)) then
pcall(PlaySound, tonumber(v), "Master");
if lastPlayedSoundFromSet ~= GetTime() then
pcall(PlaySound, tonumber(v), "Master")
lastPlayedSoundFromSet = GetTime()
end
else
pcall(PlaySoundFile, v, "Master");
if lastPlayedSoundFromSet ~= GetTime() then
pcall(PlaySoundFile, v, "Master")
lastPlayedSoundFromSet = GetTime()
end
end
end
end
@@ -139,6 +139,23 @@ local function createOptions(id, data)
OptionsPrivate.ResetMoverSizer()
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 = {
type = "toggle",
order = 1.5,
@@ -366,6 +383,23 @@ local function createOptions(id, data)
order = 20,
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
hybridPosition = {
type = "select",