This becomes increasingly heavier the more we add to it that has to iterate an inventory repeatedly.
For example we have three approaches:
Method 1:
Capture all items you're looking to use/apply
Iterate inventory and compare every item found to the entire set of items you specified, the longer this list the more intensive this becomes.
Method 2:
Capture each item in the list 1 at a time
This then requires every item in the list iterates over the entire inventory to see if any match.
Method 3:
Json capture the data set
Compare the entire inventory data dump page by page for any values in the Json set, then somehow activate these in the desired order.
Matching an items properties for method 1 and 2 requires several more grabs of data so it's not just "oh a wand of X" it's:
A wand
With a spell property
The spell property matches the data
All of this is valid but depending on the size of input it is also inefficient.