zarillion / handynotes-plugins

A collection of HandyNotes plugins for World of Warcraft.
Other
46 stars 34 forks source link

Suggestion/Feature Request: "ns.requirement.ItemAny" #403

Open pepedressingroom opened 7 months ago

pepedressingroom commented 7 months ago

Hi developers, how about adding a requirement that hints requiring any of several items?

There are some examples:

-- DISTURBED DIRT -- SMELLY TREASURE CHEST ns.requirement.Item(191294) -- Small Expedition Shovel ns.requirement.ItemAny(L['expedition_shovel'], 191294, 191304) -- Small/Sturdy Expedition Shovel

-- ELUSIVE CREATURES ns.requirement.Item(193906) -- Elusive Creature Bait ns.requirement.ItemAny(L['creature_bait'], 193906, 198804, 198805, 198806, 198807) -- Elusive /Frost-/Earth-/Decay-/Titan-Infused Creature Bait

-- DREAMSEED SOIL ns.requirement.Item(208066) -- Small Dreamseed ns.requirement.ItemAny('{spell:429182}', 208066, 208067, 208047) -- Small/Plump/Gigantic Dreamseed

-- RICH SOIL ns.requirement.ItemAny('{item:200506}', 200506, 200508, 200507, 200509) -- Roused Seedling, Propagating /Decayed / Agitated Roused Seedling

It requires common strings of names to be set, and sometimes you have to localize the common strings. Do you think it reasonable and necessary?

----------------------------------- ITEMANY -----------------------------------

local ItemAny = Class('ItemAny', Requirement, {type = L['item']})

function ItemAny:Initialize(name, ...)
    self.text, self.ids = name, {...}
end

function ItemAny:IsMet()
    local x = false
    for i = 1, #self.ids do
        x = x or ns.PlayerHasItem(self.ids[i])
    end
    return x
end
Ioney commented 1 month ago

cant we just add a any = true feature to the existing Item Requirement?

ns.requirement.Item({123, 456, 789}, any = true) something like that?