Module:Items/UseTables: Difference between revisions

_getItemUses: Only iterate over slayer areas for equipment
(Update for v0.21)
(_getItemUses: Only iterate over slayer areas for equipment)
Line 106: Line 106:
   -- Check if the item is an entry requirement for any Slayer area
   -- Check if the item is an entry requirement for any Slayer area
   local isSlayerAreaReq = false
   local isSlayerAreaReq = false
   local slayerAreas = Areas.getAreas(function(area) return area.type == 'slayer' end)
   if item.isEquipment then
  for i, area in pairs(slayerAreas) do
    local slayerAreas = Areas.getAreas(function(area) return area.type == 'slayer' end)
    if area.entryRequirements ~= nil and type(area.entryRequirements) == 'table' then
    for i, area in pairs(slayerAreas) do
      for j, req in pairs(area.entryRequirements) do
      if area.entryRequirements ~= nil and type(area.entryRequirements) == 'table' then
        if req.type == "SlayerItem" and req.itemID == item.id then
        for j, req in pairs(area.entryRequirements) do
          isSlayerAreaReq = true
          if req.type == "SlayerItem" and req.itemID == item.id then
           break
            isSlayerAreaReq = true
            break
           end
         end
         end
        if isSlayerAreaReq then break end
       end
       end
      if isSlayerAreaReq then break end
     end
     end
   end
   end