Module:Elven worker

local p = {}

local _data = { Amlodd = { level = 94, xp = 140, vos = 168 }, Cadarn = { level = 93, xp = 135, vos = 162 }, Crwys = { level = 97, xp = 155, vos = 186 }, Hefin = { level = 96, xp = 150, vos = 180 }, Iorwerth = { level = 91, xp = 125, vos = 150 }, Ithell = { level = 92, xp = 130, vos = 156 }, Meilyr = { level = 98, xp = 170, vos = 204 }, Trahaearn = { level = 95, xp = 145, vos = 174 }, }

function p.main(frame) local args = frame:getParent.args

local vos = { args['vos1'], args['vos2'] } local level = tonumber(args.level) local boost = tostring(args.boost) == 'Yes' if level < 98 and boost then level = level + 4 boost = true else boost = false end

if level < 91 then return 'You do not have a high enough thieving level to pickpocket any worker.' end

local xptable = {}

for w, v in pairs(_data) do		if level >= v.level then local _add = {} _add.n = w			_add.level = v.level if vos[1] == w or vos[2] == w then _add.xp = v.vos _add.vos = true else _add.xp = v.xp			end table.insert(xptable,_add) end end

xptable = table.sort(xptable, function(a,b) return a.xp < b.xp end)

local ret = mw.html.create('table') :addClass('wikitable') :tag('tr') :tag('th') :wikitext('Clan') :done :tag('th') :wikitext('Level') :done :tag('th') :wikitext('XP') :done :done for _, v in ipairs(xptable) do		local row = ret:tag('tr')

if v.vos then row:css('background','#afafaf') end

row	:tag('td') :wikitext(v.n)			:done :tag('td') :wikitext(v.level) :done :tag('td') :wiktiext(v.xp) :done :done end

ret:done if boost then ret:wikitext('To thieve from every clan listed, you will need the Abyssal lurker\'s +4 thieving boost from its scroll.') end

return ret end

return p