Module:JobEquipmentList

local cargo = require('Module:CargoUtil') local render_item_icon = require('Module:Render/Item')._icon

local p = {} local h = {}

local maxEquipSlots = 6

function p.jobEquipmentList(frame) local iname = frame.args[1] return p._jobEquipmentList(iname) end

function p._jobEquipmentList(iname) if iname == nil then return 'Invalid parameter' end local jobs = cargo.query{ tables = 'JobRank', fields = 'idx, eqid1, eqid2, eqid3, eqid4, eqid5, eqid6, learn1, learn2', where = 'job_iname = "'.. iname ..'" AND server = "gl"', }   if #jobs == 0 then return 'Equipment data not found for '..iname end local output = {} table.insert(output, '{| class="wikitable jobEquipmentList"') for _,entry in pairs( jobs ) do   	local level = tonumber(entry.idx) table.insert(output, h.convertRankToJobLevelRow(entry, level)) end table.insert(output, '|}') return table.concat(output, "\n") end

function h.convertRankToJobLevelRow(rank, level) local pieces = {'|-'}

local jobLevel = 'Level '..(level - 1) if (level == 1) then jobLevel = 'Unlock Job' end table.insert(pieces, '|'..jobLevel) for r = 1, maxEquipSlots do       local tempKey = 'eqid'..r        table.insert(pieces, '|'..render_item_icon({rank[tempKey]})) end

return table.concat(pieces, "\n") end

return p