Skip to content

Commit

Permalink
upgrade Unit Characteristics - Ignore Dead, and add Summon/Resurrect …
Browse files Browse the repository at this point in the history
…Pending properties

Fixes #5569
  • Loading branch information
emptyrivers committed Dec 8, 2024
1 parent eae0ac2 commit 5719c5e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
19 changes: 19 additions & 0 deletions WeakAuras/Modernize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,25 @@ function Private.Modernize(data, oldSnapshot)
end
end

if data.internalVersion < 79 then
if data.triggers then
for _, 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
if trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" then
trigger.use_dead = false
else
-- since this option was previously only available for group units,
-- nil it out if the unit isn't group to avoid surprises from vestigial data
trigger.use_dead = nil
end
end
end
end
end
end

data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion())
end

Expand Down
39 changes: 29 additions & 10 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local AddonName = ...
---@class Private
local Private = select(2, ...)

local internalVersion = 78
local internalVersion = 79

-- Lua APIs
local insert = table.insert
Expand Down

0 comments on commit 5719c5e

Please sign in to comment.