Anonymous

Module:Navboxes: Difference between revisions

From Melvor Idle
added food
(Fixed an omitted reference to Module:Skills/data)
(added food)
Line 3: Line 3:
local p = {}
local p = {}


local SkillData = mw.loadData('Module:Skills/data')
local MagicData = mw.loadData('Module:Magic/data')
local MagicData = mw.loadData('Module:Magic/data')
local ItemData = mw.loadData('Module:Items/data')
local ItemData = mw.loadData('Module:Items/data')
Line 9: Line 8:
local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')
function p.getFoodNavbox(frame)
  local cookedFish = {}
  local harvestedFood = {}
  for i, item in pairs(ItemData.Items) do
    if i >= 22 and i < 34 then
    table.insert(cookedFish, Icons.Icon({item.name, type='item'}))
    elseif i >= 152 and i < 160 then
    table.insert(harvestedFood, Icons.Icon({item.name, type='item'}))
    end
  end
  table.insert(harvestedFood, Icons.Icon({'Carrot', type='item'}))
  local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
  result = result..'\r\n!colspan="2"|[[File:Carrot_(item).svg|25px|link=Food]] [[Food]]'
  result = result..'\r\n|-\r\n!scope="row"|Cooked Fish'
  result = result..'\r\n|style="text-align:center;|'..table.concat(cookedFish, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Harvested Food'
  result = result..'\r\n|style="text-align:center;|'..table.concat(harvestedFood, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Special'
  result = result..'\r\n|style="text-align:center;|{{ItemIcon|Raw Magic Fish|size=25}} • {{ItemIcon|Lemonade|size=25}}'
  result = result..'\r\n|}'
  return result
end


function p.getPrayerNavbox(frame)
function p.getPrayerNavbox(frame)
Line 23: Line 45:


function p.getRuneNavbox(frame)
function p.getRuneNavbox(frame)
    local standardRunes = {}
  local standardRunes = {}
    local combinationRunes = {}
  local combinationRunes = {}
 
  for i, item in pairs(ItemData.Items) do
    for i, item in pairs(ItemData.Items) do
    if (i >= 389 and i < 399) or (i >= 820 and i < 823) then
      if (i >= 390 and i < 400) or (i >= 821 and i < 825) then
    table.insert(standardRunes, Icons.Icon({item.name, type='item'}))
      table.insert(standardRunes, Icons.Icon({item.name, type='item'}))
    elseif i >= 823 and i < 830 then
      elseif i >= 824 and i < 831 then
    table.insert(combinationRunes, Icons.Icon({item.name, type='item'}))
      table.insert(combinationRunes, Icons.Icon({item.name, type='item'}))
      end
     end
     end
    local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
  end
    result = result..'\r\n!colspan="2"|[[File:Air_Rune_(item).svg|25px|link=Runes]] [[Runes]]'
  local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
    result = result..'\r\n|-\r\n!scope="row"|Standard Runes'
  result = result..'\r\n!colspan="2"|[[File:Air_Rune_(item).svg|25px|link=Runes]] [[Runes]]'
    result = result..'\r\n|style="text-align:center;|'..table.concat(standardRunes, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Standard Runes'
    result = result..'\r\n|-\r\n!scope="row"|Combination Runes'
  result = result..'\r\n|style="text-align:center;"|'..table.concat(standardRunes, ' • ')
    result = result..'\r\n|style="text-align:center;|'..table.concat(combinationRunes, ' • ')
  result = result..'\r\n|-\r\n!scope="row"|Combination Runes'
    result = result..'\r\n|}'
  result = result..'\r\n|style="text-align:center;"|'..table.concat(combinationRunes, ' • ')
    return result
  result = result..'\r\n|}'
  return result
end
end


444

edits