Anonymous

Module:Navboxes: Difference between revisions

From Melvor Idle
added farming navbox
mNo edit summary
(added farming navbox)
Line 9: Line 9:
local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')
function p.getFarmingNavbox(frame)
  local allotmentSeeds = {}
  local herbSeeds = {}
  local treeSeeds = {}
  local allotmentProduce = {}
  local herbProduce = {}
  local treeProduce = {}
  for i, item in Shared.skpairs(ItemData.Items) do
    if i == 2 or i == 3 or i == 5 or i == 6 or i == 8 then
      table.insert(treeProduce, Icons.Icon({item.name, type='item'}))
    elseif i >= 144 and i < 152 then
      table.insert(allotmentSeeds, Icons.Icon({item.name, type='item'}))
    elseif i >= 152 and i < 160 then
      table.insert(allotmentProduce, Icons.Icon({item.name, type='item'}))
    elseif i >= 161 and i < 166 then
      table.insert(treeSeeds, Icons.Icon({item.name, type='item'}))
    elseif i >= 520 and i < 528 then
      table.insert(herbProduce, Icons.Icon({item.name, type='item'}))
    elseif i >= 528 and i < 536 then
      table.insert(herbSeeds, Icons.Icon({item.name, type='item'}))
    end
  end
  table.insert(allotmentSeeds, Icons.Icon({'Carrot Seeds', type='item'}))
  table.insert(allotmentProduce, Icons.Icon({'Carrot', type='item'}))
  local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
  result = result..'\r\n!colspan="3"|'..Icons.Icon({'Farming', type='skill'})
  result = result..'\r\n|-\r\n!scope="row" rowspan="3"|Seeds'
  result = result..'\r\n|-\r\n!scope="row"|Allotment'
  result = result..'\r\n|style="text-align:center;|'..table.concat(allotmentSeeds, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Herb'
  result = result..'\r\n|style="text-align:center;|'..table.concat(herbSeeds, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Tree'
  result = result..'\r\n|style="text-align:center;|'..table.concat(treeSeeds, ' • ')
  result = result..'\r\n|-\r\n!scope="row" rowspan="3"|Produce'
  result = result..'\r\n|-\r\n!scope="row"|Allotment'
  result = result..'\r\n|style="text-align:center;|'..table.concat(allotmentProduce, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Herb'
  result = result..'\r\n|style="text-align:center;|'..table.concat(herbProduce, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Tree'
  result = result..'\r\n|style="text-align:center;|'..table.concat(treeProduce, ' • ')
  return result
end


function p.getFoodNavbox(frame)
function p.getFoodNavbox(frame)
444

edits