Skip to content

Commit

Permalink
Proc Glow: add more options in actions & external glow conditions, and
Browse files Browse the repository at this point in the history
…fixes #4532
  • Loading branch information
mrbuds authored and Stanzilla committed Jul 17, 2023
1 parent a1e3faa commit acbc065
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 11 deletions.
4 changes: 3 additions & 1 deletion WeakAuras/Conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ local function formatValueForAssignment(vType, value, pathToCustomFunction, path
if (value and type(value) == "table") then
return ([[{ glow_action = %q, glow_frame_type = %q, glow_type = %q,
glow_frame = %q, use_glow_color = %s, glow_color = {%s, %s, %s, %s},
glow_lines = %d, glow_frequency = %f, glow_length = %f, glow_thickness = %f, glow_XOffset = %f, glow_YOffset = %f,
glow_startAnim = %s, glow_duration = %f, glow_lines = %d, glow_frequency = %f, glow_length = %f, glow_thickness = %f, glow_XOffset = %f, glow_YOffset = %f,
glow_scale = %f, glow_border = %s }]]):format(
value.glow_action or "",
value.glow_frame_type or "",
Expand All @@ -110,6 +110,8 @@ local function formatValueForAssignment(vType, value, pathToCustomFunction, path
type(value.glow_color) == "table" and tostring(value.glow_color[2]) or "1",
type(value.glow_color) == "table" and tostring(value.glow_color[3]) or "1",
type(value.glow_color) == "table" and tostring(value.glow_color[4]) or "1",
value.glow_startAnim and "true" or "false",
value.glow_duration or 1,
value.glow_lines or 8,
value.glow_frequency or 0.25,
value.glow_length or 10,
Expand Down
9 changes: 8 additions & 1 deletion WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3415,7 +3415,14 @@ local function actionGlowStart(actions, frame, id)
id
)
elseif actions.glow_type == "Proc" then
LCG.ProcGlow_Start(glow_frame, actions.startAnim)
LCG.ProcGlow_Start(glow_frame, {
color = color,
startAnim = actions.glow_startAnim and true or false,
xOffset = actions.glow_XOffset,
yOffset = actions.glow_YOffset,
duration = actions.glow_duration or 1,
key = id
})
end
end

Expand Down
72 changes: 68 additions & 4 deletions WeakAurasOptions/ActionOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,40 @@ function OptionsPrivate.GetActionOptions(data)
end,
disabled = function() return not data.actions.start.use_glow_color end,
},
start_glow_startAnim = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Start Animation"],
order = 10.801,
get = function()
return data.actions.start.glow_startAnim and true or false
end,
hidden = function()
return not data.actions.start.do_glow
or data.actions.start.glow_action ~= "show"
or data.actions.start.glow_frame_type == nil
or data.actions.start.glow_type ~= "Proc"
end,
},
start_glow_duration = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Duration"],
order = 10.802,
softMin = 0.01,
softMax = 3,
step = 0.05,
get = function()
return data.actions.start.glow_duration or 1
end,
hidden = function()
return not data.actions.start.do_glow
or data.actions.start.glow_action ~= "show"
or data.actions.start.glow_frame_type == nil
or data.actions.start.glow_type ~= "Proc"
end,
},
start_glow_lines = {
type = "range",
control = "WeakAurasSpinBox",
Expand Down Expand Up @@ -461,7 +495,6 @@ function OptionsPrivate.GetActionOptions(data)
or data.actions.start.glow_action ~= "show"
or not data.actions.start.glow_type
or data.actions.start.glow_type == "buttonOverlay"
or data.actions.start.glow_type == "Proc"
or data.actions.start.glow_frame_type == nil
end,
},
Expand All @@ -479,7 +512,6 @@ function OptionsPrivate.GetActionOptions(data)
or data.actions.start.glow_action ~= "show"
or not data.actions.start.glow_type
or data.actions.start.glow_type == "buttonOverlay"
or data.actions.start.glow_type == "Proc"
or data.actions.start.glow_frame_type == nil
end,
},
Expand Down Expand Up @@ -772,6 +804,40 @@ function OptionsPrivate.GetActionOptions(data)
end,
disabled = function() return not data.actions.finish.use_glow_color end,
},
finish_glow_startAnim = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Start Animation"],
order = 10.801,
get = function()
return data.actions.finish.glow_startAnim and true or false
end,
hidden = function()
return not data.actions.finish.do_glow
or data.actions.finish.glow_action ~= "show"
or data.actions.finish.glow_frame_type == nil
or data.actions.finish.glow_type ~= "Proc"
end,
},
finish_glow_duration = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Duration"],
order = 10.802,
softMin = 0.01,
softMax = 3,
step = 0.05,
get = function()
return data.actions.finish.glow_duration or 1
end,
hidden = function()
return not data.actions.finish.do_glow
or data.actions.finish.glow_action ~= "show"
or data.actions.finish.glow_frame_type == nil
or data.actions.finish.glow_type ~= "Proc"
end,
},
finish_glow_lines = {
type = "range",
control = "WeakAurasSpinBox",
Expand Down Expand Up @@ -866,7 +932,6 @@ function OptionsPrivate.GetActionOptions(data)
or data.actions.finish.glow_action ~= "show"
or not data.actions.finish.glow_type
or data.actions.finish.glow_type == "buttonOverlay"
or data.actions.start.glow_type == "Proc"
or data.actions.finish.glow_frame_type == nil
end,
},
Expand All @@ -884,7 +949,6 @@ function OptionsPrivate.GetActionOptions(data)
or data.actions.finish.glow_action ~= "show"
or not data.actions.finish.glow_type
or data.actions.finish.glow_type == "buttonOverlay"
or data.actions.start.glow_type == "Proc"
or data.actions.finish.glow_frame_type == nil
end,
},
Expand Down
46 changes: 41 additions & 5 deletions WeakAurasOptions/ConditionOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,9 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA

local glowTypesExcepButtonOverlay = CopyTable(OptionsPrivate.Private.glow_types)
glowTypesExcepButtonOverlay["buttonOverlay"] = nil
glowTypesExcepButtonOverlay["Proc"] = nil
local glowTypesExcepButtonOverlayAndProc = CopyTable(OptionsPrivate.Private.glow_types)
glowTypesExcepButtonOverlayAndProc["buttonOverlay"] = nil
glowTypesExcepButtonOverlayAndProc["Proc"] = nil

args["condition" .. i .. "value" .. j .. "glow_action"] = {
type = "select",
Expand Down Expand Up @@ -1180,6 +1182,40 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
disabled = function() return not anyGlowExternal("use_glow_color", true) end
}
order = order + 1
args["condition" .. i .. "value" .. j .. "glow_startAnim"] = {
type = "toggle",
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_startAnim", L["Start Animation"], L["Start Animation"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_startAnim", propertyType),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_startAnim;
end,
set = setValueComplex("glow_startAnim"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", "Proc"))
end
}
order = order + 1
args["condition" .. i .. "value" .. j .. "glow_duration"] = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_duration", L["Duration"], L["Duration"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_duration", propertyType),
order = order,
softMin = 0.01,
softMax = 3,
step = 0.05,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.glow_duration or 1;
end,
set = setValueComplex("glow_duration"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", "Proc"))
end,
}
order = order + 1
args["condition" .. i .. "value" .. j .. "glow_lines"] = {
type = "range",
control = "WeakAurasSpinBox",
Expand All @@ -1195,7 +1231,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
end,
set = setValueComplex("glow_lines"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", glowTypesExcepButtonOverlay))
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", glowTypesExcepButtonOverlayAndProc))
end,
}
order = order + 1
Expand All @@ -1214,7 +1250,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
end,
set = setValueComplex("glow_frequency"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", glowTypesExcepButtonOverlay))
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", glowTypesExcepButtonOverlayAndProc))
end,
}
order = order + 1
Expand Down Expand Up @@ -1290,7 +1326,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
end,
set = setValueComplex("glow_YOffset"),
hidden = function()
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", "Pixel"))
return not (anyGlowExternal("glow_action", "show") and anyGlowExternal("glow_type", glowTypesExcepButtonOverlay))
end,
}
order = order + 1
Expand Down Expand Up @@ -2624,7 +2660,7 @@ local function SubPropertiesForChange(change)
"glow_action", "glow_frame_type", "glow_type",
"glow_frame", "choose_glow_frame",
"use_glow_color", "glow_color",
"glow_lines", "glow_frequency", "glow_length", "glow_thickness", "glow_XOffset", "glow_YOffset",
"glow_startAnim", "glow_duration", "glow_lines", "glow_frequency", "glow_length", "glow_thickness", "glow_XOffset", "glow_YOffset",
"glow_scale", "glow_border"
}
elseif change.property == "chat" then
Expand Down

0 comments on commit acbc065

Please sign in to comment.