From dd0a06be370c84a39d1360139ca0d71ce40a0828 Mon Sep 17 00:00:00 2001 From: Allen Faure Date: Sun, 8 Dec 2024 02:04:15 -0600 Subject: [PATCH] upgrade Unit Characteristics - Ignore Dead, and add Summon/Resurrect Pending properties Fixes #5569 --- WeakAuras/Modernize.lua | 13 +++++++++++++ WeakAuras/Prototypes.lua | 39 +++++++++++++++++++++++++++++---------- WeakAuras/WeakAuras.lua | 2 +- 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/WeakAuras/Modernize.lua b/WeakAuras/Modernize.lua index b2cf938b2b..3c68e43374 100644 --- a/WeakAuras/Modernize.lua +++ b/WeakAuras/Modernize.lua @@ -2293,6 +2293,19 @@ function Private.Modernize(data, oldSnapshot) end end + if data.internalVersion < 79 then + if data.triggers then + for triggerId, triggerData in ipairs(data.triggers) do + local trigger = triggerData.trigger + if trigger and trigger.type == "unit" and trigger.event == "Unit Characteristics" then + if trigger.use_ignoreDead then + trigger.use_ignoreDead = false + end + end + end + end + end + data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion()) end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 1431a2ad5f..ccfa6eec05 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -2284,6 +2284,8 @@ Private.event_prototypes = { AddUnitEventForEvents(result, unit, "UNIT_NAME_UPDATE") AddUnitEventForEvents(result, unit, "UNIT_FLAGS") AddUnitEventForEvents(result, unit, "PLAYER_FLAGS_CHANGED") + AddUnitEventForEvents(result, unit, "INCOMING_RESURRECT_CHANGED") + AddUnitEventForEvents(result, unit, "INCOMING_SUMMON_CHANGED") if trigger.use_inRange then AddUnitEventForEvents(result, unit, "UNIT_IN_RANGE_UPDATE") end @@ -2451,6 +2453,33 @@ Private.event_prototypes = { test = "true", init = "raidMarkIndex > 0 and '{rt'..raidMarkIndex..'}' or ''" }, + { + name = "dead", + display = L["Dead"], + type = "tristate", + width = WeakAuras.doubleWidth, + init = "UnitIsDeadOrGhost(unit)", + store = true, + conditionType = "bool", + }, + { + name = "resurrectPending", + display = L["Resurrect Pending"], + type = "tristate", + width = WeakAuras.doubleWidth, + init = "UnitHasIncomingResurrection(unit)", + store = true, + conditionType = "bool", + }, + { + name = "summonPending", + display = L["Summon Pending"], + type = "tristate", + width = WeakAuras.doubleWidth, + init = "C_IncomingSummon.HasIncomingSummon(unit)", + store = true, + conditionType = "bool", + }, { name = "ignoreSelf", display = L["Ignore Self"], @@ -2461,16 +2490,6 @@ Private.event_prototypes = { end, init = "not UnitIsUnit(\"player\", unit)" }, - { - name = "ignoreDead", - display = L["Ignore Dead"], - type = "toggle", - width = WeakAuras.doubleWidth, - enable = function(trigger) - return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end, - init = "not UnitIsDeadOrGhost(unit)" - }, { name = "ignoreDisconnected", display = L["Ignore Disconnected"], diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 58e37a8262..3ffc16f537 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -3,7 +3,7 @@ local AddonName = ... ---@class Private local Private = select(2, ...) -local internalVersion = 78 +local internalVersion = 79 -- Lua APIs local insert = table.insert