Anonymous

Module:Items/UseTables: Difference between revisions

From Melvor Idle
(Hopefully) fixed issue with items not including Agility Obstacles as a use if no other uses existed
(Tweaked how UseTables figure out shop purchase uses)
((Hopefully) fixed issue with items not including Agility Obstacles as a use if no other uses existed)
Line 413: Line 413:
                           return a.item.name < b.item.name
                           return a.item.name < b.item.name
                         end end)
                         end end)
  local obstacles = Agility.getObstaclesForItem(item.id)


   local spellUseTable = p._getSpellUseTable(item)
   local spellUseTable = p._getSpellUseTable(item)
   local result = ''
   local result = ''
   if Shared.tableCount(useArray) == 0 then
   if Shared.tableCount(useArray) == 0 and Shared.tableCount(obstacles) == 0 then
     if string.len(spellUseTable) > 0 then
     if string.len(spellUseTable) > 0 then
       return '==Uses==\r\n==='..Icons.Icon({'Magic', type='skill', size='30'})..'===\r\n'..spellUseTable
       return '==Uses==\r\n==='..Icons.Icon({'Magic', type='skill', size='30'})..'===\r\n'..spellUseTable
Line 463: Line 465:


   --Agility obstacles are weird and get their own section
   --Agility obstacles are weird and get their own section
  local obstacles = Agility.getObstaclesForItem(item.id)
   for i, obst in Shared.skpairs(obstacles) do
   for i, obst in Shared.skpairs(obstacles) do
     result = result..'\r\n|-\r\n|'
     result = result..'\r\n|-\r\n|'