Module:Items: Difference between revisions

Added getItems function
(Added special loot source exceptions for the Fire Cape and ensured that chest source tables specify completing dungeons rather than defeating bosses.)
(Added getItems function)
Line 80: Line 80:
       result = Shared.clone(item)
       result = Shared.clone(item)
       --Make sure every item has an id, and account for Lua being 1-index
       --Make sure every item has an id, and account for Lua being 1-index
       result.id = i -1
       result.id = i - 1
       break
       break
    end
  end
  return result
end
function p.getItems(checkFunc)
  local result = {}
  for i, item in pairs(ItemData.Items) do
    if checkFunc(item) then
      local newItem = Shared.clone(item)
      newItem.id = i - 1
      table.insert(result, newItem)
     end
     end
   end
   end