Skip to content

Commit

Permalink
Alternate Power trigger: make power field a multiEntry
Browse files Browse the repository at this point in the history
This fix #4700 where a power trigger converted to alternate power have it's "power" field missmatch type
  • Loading branch information
mrbuds committed Nov 11, 2023
1 parent 1cf243a commit e855f4f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
18 changes: 18 additions & 0 deletions WeakAuras/Modernize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,24 @@ function Private.Modernize(data)
migrateToTable(data.load, "itemequiped")
end

if data.internalVersion < 70 then
local trigger_migration = {
Power = {
"power",
"power_operator"
}
}
for _, triggerData in ipairs(data.triggers) do
local t = triggerData.trigger
local fieldsToMigrate = trigger_migration[t.event]
if fieldsToMigrate then
for _, field in ipairs(fieldsToMigrate) do
migrateToTable(t, field)
end
end
end
end

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

6 changes: 5 additions & 1 deletion WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3753,7 +3753,11 @@ Private.event_prototypes = {
name = "power",
display = L["Alternate Power"],
type = "number",
init = "UnitPower(unit, 10)"
init = "UnitPower(unit, 10)",
multiEntry = {
operator = "and",
limit = 2
},
},
{
name = "value",
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- @type string, Private
local AddonName, Private = ...

local internalVersion = 69
local internalVersion = 70

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

0 comments on commit e855f4f

Please sign in to comment.