Skip to content

Commit

Permalink
Add new type of glow called "Proc Glow"
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbuds authored and InfusOnWoW committed Jul 10, 2023
1 parent 1a92c0e commit d89697f
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 3 deletions.
51 changes: 50 additions & 1 deletion WeakAuras/SubRegionTypes/Glow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local default = function(parentType)
glowType = "buttonOverlay",
glowLines = 8,
glowFrequency = 0.25,
glowDuration = 1,
glowLength = 10,
glowThickness = 1,
glowScale = 1,
Expand Down Expand Up @@ -70,6 +71,15 @@ local properties = {
bigStep = 0.1,
default = 0.25
},
glowDuration = {
display = L["Duration"],
setter = "SetGlowDuration",
type = "number",
softMin = 0.01,
softMax = 3,
bigStep = 0.1,
default = 1
},
glowLength = {
display = L["Length"],
setter = "SetGlowLength",
Expand Down Expand Up @@ -121,6 +131,11 @@ local properties = {
bigStep = 1,
default = 0
},
glowStartAnim = {
display = L["Start Animation"],
setter = "SetGlowStartAnim",
type = "bool",
},
}

local function glowStart(self, frame, color)
Expand Down Expand Up @@ -158,6 +173,15 @@ local function glowStart(self, frame, color)
nil,
0
)
elseif self.glowType == "Proc" then
self.glowStart(frame, {
color = color,
startAnim = self.glowStartAnim and true or false,
duration = self.glowDuration,
xOffset = self.glowXOffset,
yOffset = self.glowYOffset,
frameLevel = 0
})
end
end

Expand Down Expand Up @@ -223,6 +247,15 @@ local funcs = {
if self.parentRegionType ~= "aurabar" then
self.parent:AnchorSubRegion(self, "area")
end
elseif newType == "Proc" then
self.glowStart = LCG.ProcGlow_Start
self.glowStop = LCG.ProcGlow_Stop
if self.parentRegionType ~= "aurabar" then
self.parent:AnchorSubRegion(self, "area", "region")
end
else -- noop function in case of unsuported glow
self.glowStart = function() end
self.glowStop = function() end
end
self.glowType = newType
if isGlowing then
Expand Down Expand Up @@ -256,6 +289,12 @@ local funcs = {
self:SetVisible(true)
end
end,
SetGlowDuration = function(self, duration)
self.glowDuration = duration
if self.glow then
self:SetVisible(true)
end
end,
SetGlowLength = function(self, length)
self.glowLength = length
if self.glow then
Expand All @@ -280,6 +319,12 @@ local funcs = {
self:SetVisible(true)
end
end,
SetGlowStartAnim = function(self, enable)
self.glowStartAnim = enable
if self.glow then
self:SetVisible(true)
end
end,
SetGlowXOffset = function(self, xoffset)
self.glowXOffset = xoffset
if self.glow then
Expand Down Expand Up @@ -329,7 +374,7 @@ local function modify(parent, region, parentData, data, first)
if parentData.regionType == "aurabar" then
parent:AnchorSubRegion(region, "area", data.glow_anchor)
else
parent:AnchorSubRegion(region, "area", data.glowType == "buttonOverlay" and "region")
parent:AnchorSubRegion(region, "area", (data.glowType == "buttonOverlay" or data.glowType == "Proc") and "region")
end

region.parent = parent
Expand All @@ -345,6 +390,8 @@ local function modify(parent, region, parentData, data, first)
region.glowBorder = data.glowBorder
region.glowXOffset = data.glowXOffset
region.glowYOffset = data.glowYOffset
region.glowStartAnim = data.glowStartAnim
region.glowDuration = data.glowDuration

region:SetGlowType(data.glowType)
region:SetVisible(data.glow)
Expand All @@ -363,6 +410,7 @@ function Private.getDefaultGlow(regionType)
glowType = "Pixel",
glowLines = 8,
glowFrequency = 0.25,
glowDuration = 1,
glowLength = 10,
glowThickness = 1,
glowScale = 1,
Expand All @@ -380,6 +428,7 @@ function Private.getDefaultGlow(regionType)
glowType = "buttonOverlay",
glowLines = 8,
glowFrequency = 0.25,
glowDuration = 1,
glowLength = 10,
glowThickness = 1,
glowScale = 1,
Expand Down
7 changes: 7 additions & 0 deletions WeakAuras/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3330,6 +3330,13 @@ Private.glow_types = {
buttonOverlay = L["Action Button Glow"],
}

if WeakAuras.IsRetail() then
local build = select(4, GetBuildInfo())
if build >= 100105 then
Private.glow_types.Proc = L["Proc Glow"]
end
end

Private.font_sizes = {
small = L["Small"],
medium = L["Medium"],
Expand Down
4 changes: 4 additions & 0 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3371,6 +3371,8 @@ local function actionGlowStop(actions, frame, id)
LCG.PixelGlow_Stop(frame.__WAGlowFrame, id)
elseif actions.glow_type == "ACShine" then
LCG.AutoCastGlow_Stop(frame.__WAGlowFrame, id)
elseif actions.glow_type == "Proc" then
LCG.ProcGlow_Stop(frame.__WAGlowFrame, id)
end
end

Expand Down Expand Up @@ -3412,6 +3414,8 @@ local function actionGlowStart(actions, frame, id)
actions.glow_YOffset,
id
)
elseif actions.glow_type == "Proc" then
LCG.ProcGlow_Start(glow_frame, actions.startAnim)
end
end

Expand Down
8 changes: 8 additions & 0 deletions WeakAurasOptions/ActionOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ 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 @@ -404,6 +405,7 @@ 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 @@ -459,6 +461,7 @@ 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 @@ -476,6 +479,7 @@ 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 @@ -785,6 +789,7 @@ 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 @@ -805,6 +810,7 @@ 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 Expand Up @@ -860,6 +866,7 @@ 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 @@ -877,6 +884,7 @@ 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
1 change: 1 addition & 0 deletions WeakAurasOptions/ConditionOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA

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

args["condition" .. i .. "value" .. j .. "glow_action"] = {
type = "select",
Expand Down
30 changes: 28 additions & 2 deletions WeakAurasOptions/SubRegionOptions/Glow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ local function createOptions(parentData, data, index, subIndex)
if data.glowBorder then
line = L["%s, Border"]:format(line)
end
elseif data.glowType == "Proc" then
line = ("%s %s, Duration: %d"):format(line, color, data.glowDuration)
if data.glowStartAnim then
line = L["%s, Start Animation"]:format(line)
end
if data.glowXOffset ~= 0 or data.glowYOffset ~= 0 then
line = L["%s, offset: %0.2f;%0.2f"]:format(line, data.glowXOffset, data.glowYOffset)
end
end
return line
end,
Expand Down Expand Up @@ -126,6 +134,13 @@ local function createOptions(parentData, data, index, subIndex)
order = 8,
hidden = hiddenGlowExtra,
},
glowStartAnim = {
type = "toggle",
width = WeakAuras.normalWidth - indentWidth,
name = L["Start Animation"],
order = 8.5,
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Proc" end
},
glowLines = {
type = "range",
control = "WeakAurasSpinBox",
Expand All @@ -135,7 +150,7 @@ local function createOptions(parentData, data, index, subIndex)
min = 1,
softMax = 30,
step = 1,
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end,
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" or data.glowType == "Proc" end,
},
glowFrequency = {
type = "range",
Expand All @@ -146,7 +161,18 @@ local function createOptions(parentData, data, index, subIndex)
softMin = -2,
softMax = 2,
step = 0.05,
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end,
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" or data.glowType == "Proc" end,
},
glowDuration = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Duration"],
order = 10,
softMin = 0.01,
softMax = 3,
step = 0.05,
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Proc" end,
},
glow_space3 = {
type = "description",
Expand Down

0 comments on commit d89697f

Please sign in to comment.