Anonymous

Module:ItemsTable: Difference between revisions

From Melvor Idle
m
no edit summary
No edit summary
mNo edit summary
Line 18: Line 18:
   while i < numberOfItems do
   while i < numberOfItems do
     result = result..'\r\n{{#invoke:ItemsTable|getItemsTable|'..i..'}}'
     result = result..'\r\n{{#invoke:ItemsTable|getItemsTable|'..i..'}}'
     i = i + 150
     i = i + 100
   end
   end
   result = result..'\r\n|}'
   result = result..'\r\n|}'
Line 25: Line 25:


function p.getItemsTable(frame)
function p.getItemsTable(frame)
  local allItems = ItemData.Items
   local itemList = {}
   local itemList = {}
   local i = tonumber(frame.args[1])
   local i = tonumber(frame.args[1])
   local iend = i + 150
   local iend = i + 100
   while i < iend do
   while i < iend do
     local item = Items.getItemByID(i)
     local item = allItems[i]
     local itemRow = '\r\n|-'
     if item then
    itemRow = itemRow..'\r\n|style="text-align:left;"|'..Icons.Icon({item.name, type='item', notext=true, size=50})
      local itemRow = '\r\n|-'
    itemRow = itemRow..'||style="text-align:left;"|'..item.name..'||style="text-align:left;"|'..item.id
      itemRow = itemRow..'\r\n|'..Icons.Icon({item.name, type='item', notext=true, size=50})
    itemRow = itemRow..'||style="text-align:left;"|'..item.category..'||style="text-align:left;"|'..item.type
      itemRow = itemRow..'||'..item.name..'||'..(i - 1)..'||'..item.category..'||'..item.type
    itemRow = itemRow..'||style="text-align:right;" data-sort-value="'..item.sellsFor
      itemRow = itemRow..'||data-sort-value="'..item.sellsFor..'"|[[File:Coins.svg|20px]] '..item.sellsFor
    itemRow = itemRow..'"|[[File:Coins.svg|20px]] '..item.sellsFor
      itemRow = itemRow..'||style="text-align:right;"|'..SourceTables.getItemSources(item.name)
    itemRow = itemRow..'||style="text-align:right;"|'..SourceTables.getItemSources(item.name)
      itemRow = itemRow..'||style="text-align:right;"|'..UseTables.getItemUses(item.name)
    itemRow = itemRow..'||style="text-align:right;"|'..UseTables.getItemUses(item.name)
      table.insert(itemList, itemRow)
    table.insert(itemList, itemRow)
    end
     i = i + 1
     i = i + 1
   end
   end
444

edits