Anonymous

Module:Items/UseTables: Difference between revisions

From Melvor Idle
Adding missing categories to the itemUseArray
((Hopefully) fixed issue with items not including Agility Obstacles as a use if no other uses existed)
(Adding missing categories to the itemUseArray)
(One intermediate revision by the same user not shown)
Line 26: Line 26:
   Fletching = {'Crown of Rhaelyx'},
   Fletching = {'Crown of Rhaelyx'},
   Herblore = {'Crown of Rhaelyx'},
   Herblore = {'Crown of Rhaelyx'},
  Magic = {},
   Mining = {'Mining Gloves', 'Gem Gloves'},
   Mining = {'Mining Gloves', 'Gem Gloves'},
   Prayer = {},
   Prayer = {},
  Ranged = {},
   Runecrafting = {'Crown of Rhaelyx'},
   Runecrafting = {'Crown of Rhaelyx'},
   Slayer = {},
   Slayer = {},
Line 71: Line 73:
   if item.herbloreMasteryID ~= nil then
   if item.herbloreMasteryID ~= nil then
     table.insert(itemUseArray[potionUseArray[item.herbloreMasteryID]], item.name)
     table.insert(itemUseArray[potionUseArray[item.herbloreMasteryID]], item.name)
  end
  --If the item has any modifiers that affect a given skill, add it to those lists
  if item.modifiers ~= nil then
    local skillArray = Constants.getModifierSkills(item.modifiers)
    for i, skillName in Shared.skpairs(skillArray) do
      table.insert(itemUseArray[skillName], item.name)
    end
   end
   end


   --First things added to the list are non-skill things that are easy to check
   --First things added to the list are non-skill things that are easy to check
   if item.equipmentSlot ~= nil or Shared.contains(itemUseArray.Combat, item.name) then
   if Items.hasCombatStats(item) or Shared.contains(itemUseArray.Combat, item.name) then
    if item.equipmentSlot ~= nil then
      --table.insert(categoryArray, '[[Category:'..Items.getEquipmentSlotName(item.equipmentSlot)..' Slot Items]]')
    end
     table.insert(useArray, chr..Icons.Icon({'Combat'}))
     table.insert(useArray, chr..Icons.Icon({'Combat'}))
   end
   end
   if item.healsFor ~= nil then
   if item.healsFor ~= nil then
     table.insert(categoryArray, '[[Category:Food Items]]')
     table.insert(categoryArray, '[[Category:Food Items]]')
     table.insert(useArray, chr..'[[Food]]')
     table.insert(useArray, chr..'[[Food]]')
   end
   end
   if item.dropTable ~= nil then
   if item.dropTable ~= nil then
     table.insert(categoryArray, '[[Category:Openable Items]]')
     table.insert(categoryArray, '[[Category:Openable Items]]')