Skip to content

Commit

Permalink
Add "Not Item Equipped" load option, and make both Item Equipped opti…
Browse files Browse the repository at this point in the history
…on take multiple inputs

fixes WeakAuras#4663
  • Loading branch information
mrbuds committed Oct 22, 2023
1 parent 7ec034b commit a0a87cb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
17 changes: 11 additions & 6 deletions WeakAuras/Modernize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1734,13 +1734,14 @@ function Private.Modernize(data)
end
end

if data.internalVersion < 67 then
local function migrateToTable(tab, field)
local value = tab[field]
if value ~= nil and type(value) ~= "table" then
tab[field] = { value }
end
local function migrateToTable(tab, field)
local value = tab[field]
if value ~= nil and type(value) ~= "table" then
tab[field] = { value }
end
end

if data.internalVersion < 67 then
do
local trigger_migration = {
["Cast"] = {
Expand Down Expand Up @@ -1967,6 +1968,10 @@ function Private.Modernize(data)
end
end

if data.internalVersion < 69 then
migrateToTable(data.load, "itemequiped")
end

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

13 changes: 13 additions & 0 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1825,9 +1825,22 @@ Private.load_prototype = {
name = "itemequiped",
display = L["Item Equipped"],
type = "item",
multiEntry = {
operator = "or"
},
test = "IsEquippedItem(GetItemInfo(%s))",
events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED"}
},
{
name = "not_itemequiped",
display = WeakAuras.newFeatureString .. L["|cFFFF0000Not|r Item Equipped"],
type = "item",
multiEntry = {
operator = "or"
},
test = "not IsEquippedItem(GetItemInfo(%s))",
events = { "UNIT_INVENTORY_CHANGED", "PLAYER_EQUIPMENT_CHANGED"}
},
{
name = "itemtypeequipped",
display = L["Item Type Equipped"],
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 = 68
local internalVersion = 69

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

0 comments on commit a0a87cb

Please sign in to comment.