Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
Tweaked getCombatPassiveSlotItems to sort by item id
(_getItemLootSourceTable: Add secondary sort on average quantity descending)
(Tweaked getCombatPassiveSlotItems to sort by item id)
Line 924: Line 924:


function p.getCombatPassiveSlotItems(frame)
function p.getCombatPassiveSlotItems(frame)
   local table = '{| class="wikitable"\r\n'
   local result = '{| class="wikitable"\r\n'
   table = table..'|-\r\n'
   result = result..'|-\r\n'
   table = table..'!colspan="2"|Item\r\n! Passive\r\n'
   result = result..'!colspan="2"|Item\r\n! Passive\r\n'


   local itemArray = Items.getItems(function(item) return item.isPassiveItem and true or false end)
   local itemArray = Items.getItems(function(item) return item.isPassiveItem and true or false end)
  table.sort(itemArray, function(a, b) return a.id < b.id end)


   for i, item in Shared.skpairs(itemArray) do
   for i, item in Shared.skpairs(itemArray) do
     table = table..'|-\r\n'
     result = result..'|-\r\n'
     table = table..'! '..Icons.Icon({item.name, type='item', notext='true'})..'\r\n! [['..item.name..']]\r\n'
     result = result..'! '..Icons.Icon({item.name, type='item', notext='true'})..'\r\n! [['..item.name..']]\r\n'
     table = table..'| '..item.description..'\r\n'
     result = result..'| '..item.description..'\r\n'
   end
   end
    
    
   table = table..'|}'
   result = result..'|}'


   return table
   return result
end
end


return p
return p