Module:SCTable

-- -- --

local p = {}

local ucfirst = require('Module:Paramtest').ucfirst local skillpic = require('Module:Skill clickpic')._main local clay_items = { ['dagger'] = {'Attack','Smithing'}, ['scimitar'] = {'Attack','Smithing'}, ['warhammer'] = {'Attack','Smithing'}, ['off-hand scimitar'] = {'Attack','Smithing'}, ['off-hand dagger'] = {'Attack','Smithing'}, ['off-hand warhammer'] = {'Attack','Smithing'}, ['platebody'] = {'Defence','Smithing'}, ['platelegs'] = {'Defence','Smithing'}, ['helm'] = {'Defence','Smithing'}, ['leather body'] = {'Ranged','Crafting'}, ['chaps'] = {'Ranged','Crafting'}, ['coif'] = {'Ranged','Crafting'}, ['bow'] = {'Ranged','Fletching'}, ['arrows'] = {'Ranged','Fletching'}, ['robe bottom'] = {'Magic','Crafting'}, ['robe top'] = {'Magic','Crafting'}, ['staff'] = {'Magic','Crafting'}, ['hat'] = {'Magic','Crafting'}, ['butterfly net'] = {'Hunter','Crafting'}, ['harpoon'] = {'Fishing','Crafting'}, ['hatchet'] = {'Woodcutting','Smithing'}, ['pickaxe'] = {'Mining','Smithing'} }

local plurals = { ['arrows'] = 'arrows', ['platebody'] = 'platebodies', ['platelegs'] = 'platelegs', ['staff'] = 'staves', ['leather body'] = 'leather bodies' }

local tier_levels = { 1,	20,	40,	60,	80 }

function p.main(frame) local args = frame:getParent.args local sc_type = string.lower(args[1] or '') if not clay_items[sc_type] then error('Invalid item type: ' .. sc_type) end local sc_attr = clay_items[sc_type] local level_use = sc_attr[1] local level_make = sc_attr[2] return p._main(sc_type,level_use,level_make) end

function p._main(sc_type,level_use,level_make) local item_pl = plurals[sc_type] or (sc_type .. 's') local ret_table = mw.html.create('table') :addClass('wikitable') :tag('caption') :wikitext('Table of ' ..							item_pl .. '') :done :tag('tr') :tag('th') :wikitext('Icon') :done :tag('th') :wikitext('Class') :done :tag('th') :wikitext('Level to use') :done :tag('th') :wikitext('Level to make') :done :done for i=1,5 do		local item_name = sc_type..' (class '..i..')' local file_name = item_name if sc_type == 'arrows' then file_name = item_name..' 5' end ret_table:tag('tr') :tag('td') :wikitext('') :done :tag('td') :wikitext('Class '..i..'') :done :tag('td') :wikitext(tier_levels[i] .. ' ' .. skillpic(level_use) ..  .. level_use .. ) :done :tag('td') :wikitext(tier_levels[i] .. ' ' .. skillpic(level_make) ..  .. level_make .. ) :done :done end return ret_table end

return p