Module:Season rewards

p = {}

rarityHtml = require('Module:Rarity')

p.rewardType = function (f) local args = f	if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else f = mw.getCurrentFrame end local types = { item = { name = args['id'] }, coin = { name = 'Carl Coins' }, ticket = { name = 'SAR Tickets x3', custom_name = 'Tickets' }, serum = { name = 'Super Serum' }} return types[args['type']] end

p.generateRewards = function (f) -- Takes one argument which is a number of the battle pass local args = f	if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else f = mw.getCurrentFrame end local version = mw.loadData('Module:Season_' .. args[1] .. '_data') local content = '' local i = 1 for v in pairs( version ) do		local item = version[v] local reward = p.rewardType(item) local full_div = mw.html.create('div') local tiernumber = mw.html.create('p') tiernumber:wikitext( 'Tier ' .. i ) i = i + 1 tiernumber:cssText( 'text-align: center;font-weight: bold;' ) full_div:node(tiernumber) if item["free"] then freebox = mw.html.create( 'div' ) freebox:addClass('sar-season-free-box') local freetext = mw.html.create( 'p' ) freetext:addClass('sar-season-free-text') freetext:wikitext('free') freebox:node(freetext) else freebox = mw.html.create('div') freebox:addClass('sar-season-notfree-box') end full_div:node(freebox) content = content .. rarityHtml.createImage({reward['name'], add_to_desc = ' ' .. tostring(item["xp"]) .. ' XP required', append_before = full_div, amount = item["amount"], custom_name = reward["custom_name"]}) end return content end return p