diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 0dff27b491..f17aeb84ad 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -1083,7 +1083,8 @@ local function AddFakeInformation(data, triggernum, state, eventData) state.progressType = "timed" end if state.progressType == "timed" then - if state.expirationTime and state.expirationTime ~= math.huge and state.expirationTime > GetTime() then + local expirationTime = state.expirationTime + if expirationTime and type(expirationTime) == "number" and expirationTime ~= math.huge and expirationTime > GetTime() then return end state.progressType = "timed" diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 4e20726916..8144d50d12 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -2430,9 +2430,6 @@ Private.event_prototypes = { values = "role_types", store = true, conditionType = "select", - enable = function(trigger) - return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end }, { name = "raid_role", diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index 817e367568..03c85b7b9f 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -463,6 +463,9 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource end local duration = totalProperty and state[totalProperty] or 0 + if type(duration) ~= "number" then + duration = 0 + end local modRate = modRateProperty and state[modRateProperty] or nil local adjustMin if minMaxConfig.adjustedMin then @@ -521,6 +524,7 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource else max = duration end + self.minProgress, self.maxProgress = adjustMin, max self.progressType = "timed" self.duration = max - adjustMin diff --git a/WeakAuras/SubRegionTypes/CircularProgressTexture.lua b/WeakAuras/SubRegionTypes/CircularProgressTexture.lua index 3a041a5984..1e77aa9422 100644 --- a/WeakAuras/SubRegionTypes/CircularProgressTexture.lua +++ b/WeakAuras/SubRegionTypes/CircularProgressTexture.lua @@ -55,6 +55,11 @@ local properties = { setter = "SetDesaturated", type = "bool", }, + circularTextureInverse = { + display = L["Inverse"], + setter = "SetInverse", + type = "bool", + }, circularTextureColor = { display = L["Color"], setter = "SetColor", @@ -195,15 +200,24 @@ local funcs = { if progressData.total ~= 0 then progress = progressData.value / progressData.total end + if self.inverse then + progress = 1 - progress + end self.circularTexture:SetProgress(self:ProgressToAngles(progress)) elseif progressData.progressType == "timed" then if progressData.paused then local remaining = self.progressData.remaining local progress = remaining / self.progressData.duration + if self.inverse then + progress = 1 - progress + end self.circularTexture:SetProgress(self:ProgressToAngles(progress)) else local remaining = self.progressData.expirationTime - GetTime() local progress = remaining / self.progressData.duration + if self.inverse then + progress = 1 - progress + end self.circularTexture:SetProgress(self:ProgressToAngles(progress)) end end @@ -220,6 +234,10 @@ local funcs = { self.circularTexture:SetHeight(h) self.circularTexture:UpdateTextures() end, + SetInverse = function(self, inverse) + self.inverse = inverse + self:UpdateFrame() + end } local function create() @@ -265,6 +283,8 @@ local function modify(parent, region, parentData, data, first) region:OnSizeChanged() end + region.inverse = data.circularTextureInverse + Private.CircularProgressTextureBase.modify(region.circularTexture, { crop_x = 1 + data.circularTextureCrop_x, crop_y = 1 + data.circularTextureCrop_y, diff --git a/WeakAuras/SubRegionTypes/LinearProgressTexture.lua b/WeakAuras/SubRegionTypes/LinearProgressTexture.lua index ed1174972e..d0bb8696ec 100644 --- a/WeakAuras/SubRegionTypes/LinearProgressTexture.lua +++ b/WeakAuras/SubRegionTypes/LinearProgressTexture.lua @@ -55,6 +55,11 @@ local properties = { setter = "SetDesaturated", type = "bool", }, + linearTextureInverse = { + display = L["Inverse"], + setter = "SetInverse", + type = "bool", + }, linearTextureColor = { display = L["Color"], setter = "SetColor", @@ -160,15 +165,24 @@ local funcs = { if progressData.total ~= 0 then progress = progressData.value / progressData.total end + if self.inverse then + progress = 1 - progress + end self.linearTexture:SetValue(0, progress) elseif progressData.progressType == "timed" then if progressData.paused then local remaining = self.progressData.remaining local progress = remaining / self.progressData.duration + if self.inverse then + progress = 1 - progress + end self.linearTexture:SetValue(0, progress) else local remaining = self.progressData.expirationTime - GetTime() local progress = remaining / self.progressData.duration + if self.inverse then + progress = 1 - progress + end self.linearTexture:SetValue(0, progress) end end @@ -185,6 +199,10 @@ local funcs = { self.linearTexture:SetHeight(h) self.linearTexture:UpdateTextures() end, + SetInverse = function(self, inverse) + self.inverse = inverse + self:UpdateFrame() + end } local function create() @@ -223,6 +241,7 @@ local function modify(parent, region, parentData, data, first) region:SetSize(data.width or 0, data.height or 0) end + region.inverse = data.linearTextureInverse region.Anchor = function() region:ClearAllPoints() diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 8923e52303..dbd6394c90 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -4574,10 +4574,16 @@ do local changed = false for triggernum, triggerData in ipairs(triggers) do for id, state in pairs(triggerData) do - if state.progressType == "timed" and state.expirationTime and state.expirationTime < t and state.duration and state.duration > 0 then - state.expirationTime = t + state.duration - state.changed = true - changed = true + if state.progressType == "timed" then + local expirationTime = state.expirationTime + local duration = state.duration + if expirationTime and type(expirationTime) == "number" and expirationTime < t + and duration and type(duration) == "number" and duration > 0 + then + state.expirationTime = t + state.duration + state.changed = true + changed = true + end end end end @@ -4701,7 +4707,7 @@ local function startStopTimers(id, cloneId, triggernum, state) timer:CancelTimer(record.handle); end - if expirationTime then + if expirationTime and type(expirationTime) == "number" then record.handle = timer:ScheduleTimerFixed( function() if (state.show ~= false and state.show ~= nil) then @@ -4712,7 +4718,6 @@ local function startStopTimers(id, cloneId, triggernum, state) if Private.watched_trigger_events[id] and Private.watched_trigger_events[id][triggernum] then Private.AddToWatchedTriggerDelay(id, triggernum) end - Private.UpdatedTriggerState(id); end end, diff --git a/WeakAurasOptions/SubRegionOptions/Border.lua b/WeakAurasOptions/SubRegionOptions/Border.lua index f56ba3ef38..75cb3a81db 100644 --- a/WeakAurasOptions/SubRegionOptions/Border.lua +++ b/WeakAurasOptions/SubRegionOptions/Border.lua @@ -59,6 +59,7 @@ local function createOptions(parentData, data, index, subIndex) anchor_area = { type = "select", width = WeakAuras.normalWidth, + control = "WeakAurasTwoColumnDropdown", name = L["Border Anchor"], order = 7, values = areaAnchors, diff --git a/WeakAurasOptions/SubRegionOptions/CircularProgressTexture.lua b/WeakAurasOptions/SubRegionOptions/CircularProgressTexture.lua index 2a1b20e211..edee31f64f 100644 --- a/WeakAurasOptions/SubRegionOptions/CircularProgressTexture.lua +++ b/WeakAurasOptions/SubRegionOptions/CircularProgressTexture.lua @@ -83,11 +83,11 @@ local function createOptions(parentData, data, index, subIndex) order = 8, values = OptionsPrivate.Private.blend_types }, - space = { - type = "description", - name = "", - order = 8.5, + circularTextureInverse = { + type = "toggle", width = WeakAuras.normalWidth, + name = L["Inverse"], + order = 8.5, }, circularTextureStartAngle = { type = "range", diff --git a/WeakAurasOptions/SubRegionOptions/Glow.lua b/WeakAurasOptions/SubRegionOptions/Glow.lua index 46150a6115..d41cbbfb74 100644 --- a/WeakAurasOptions/SubRegionOptions/Glow.lua +++ b/WeakAurasOptions/SubRegionOptions/Glow.lua @@ -36,6 +36,7 @@ local function createOptions(parentData, data, index, subIndex) anchor_area = { type = "select", width = WeakAuras.normalWidth, + control = "WeakAurasTwoColumnDropdown", name = L["Glow Anchor"], order = 3, values = areaAnchors, diff --git a/WeakAurasOptions/SubRegionOptions/LinearProgressTexture.lua b/WeakAurasOptions/SubRegionOptions/LinearProgressTexture.lua index f9aabe4a1c..de6e156651 100644 --- a/WeakAurasOptions/SubRegionOptions/LinearProgressTexture.lua +++ b/WeakAurasOptions/SubRegionOptions/LinearProgressTexture.lua @@ -65,6 +65,12 @@ local function createOptions(parentData, data, index, subIndex) order = 5, values = OptionsPrivate.Private.texture_wrap_types }, + linearTextureInverse = { + type = "toggle", + width = WeakAuras.normalWidth, + name = L["Inverse"], + order = 5.5, + }, linearTextureMirror = { type = "toggle", width = WeakAuras.normalWidth,