Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade Unit Characteristics trigger #5572

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WeakAuras/Conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ end
function Private.RunConditions(region, uid, hideRegion)
if (checkConditions[uid]) then
Private.ActivateAuraEnvironmentForRegion(region)
checkConditions[uid](region, hideRegion);
xpcall(checkConditions[uid], Private.GetErrorHandlerUid(uid, L["Execute Conditions"]), region, hideRegion);
Private.ActivateAuraEnvironment()
end
end
Expand Down
20 changes: 20 additions & 0 deletions WeakAuras/Modernize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,26 @@ 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
trigger.use_ignoreDead = nil
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
Loading