handynotes-plugins icon indicating copy to clipboard operation
handynotes-plugins copied to clipboard

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

Open pepedressingroom opened this issue 1 year ago • 1 comments

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

pepedressingroom avatar Jan 31 '24 12:01 pepedressingroom

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

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

Ioney avatar Aug 03 '24 08:08 Ioney

I agree with Ioney here. If we need this feature we would probably enhance the existing Item() class. I'm going to close this for now but if this comes up as we put more nodes into the plugins we'll have an idea of where to start on this feature.

zarillion avatar Sep 15 '24 03:09 zarillion