RuneScape Wiki
Advertisement

Documentation for this module may be created at Module:SCTable/doc

--
-- <pre>
--

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 [[' .. sc_type .. ' (Stealing Creation)|' ..
							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..')'
		if sc_type == 'arrow' then
			local file_name = sc_type..' (class '..i..') 5'
		else
			local file_name = sc_type..' (class '..i..')'
		end
		ret_table:tag('tr')
				:tag('td')
					:wikitext('[[File:'..file_name..'.png|link='..item_name..']]')
				:done()
				:tag('td')
					:wikitext('[['..item_name..'|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
Advertisement