Module:Infobox Bounty

From Brighter Shores Wiki
Jump to navigation Jump to search

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

local p = {}

local Infobox = require('Module:Infobox')
local parse = require('Module:Param Parse')

function p.main(frame)
	local args = frame:getParent().args
	
	local config = {
		infobox_name = 'Bounty',
		class = {Infobox.smw_param('episode')},
	}
	
	local params = {
		parse.name_with_variant_category,
		parse.image,
		parse.release,
		parse.premium,
		parse.episode,
		parse.value,
		parse.description,
		parse.variant,
		parse.profession_bubble_a,
		-- Include these next params just to export data to smw
		parse.variant_name,
		parse.profession_a_smw,
		parse.profession_a_level_smw,
	}
	
	local infobox = Infobox.new(config, params, args)
	infobox
		:add_row{
			{tag='th', content=Infobox.param('name'), class='infobox-header', colspan='20'},
		}
		:add_row{
			{tag='td', content=Infobox.param('image'), class='infobox-image', colspan='20'},
		}
		:add_row{
			{tag='th', content='Release', colspan="6"},
			{tag='td', content=Infobox.param('release'), colspan="14"},
		}
		:add_row{
			{tag='th', content='[[Episode]]', colspan="6"},
			{tag='td', content=Infobox.param('episode'), colspan="14"},
		}
		:add_row{
			{tag='th', content='[[Premium Pass|Premium]]', colspan="6"},
			{tag='td', content=Infobox.param('premium'), colspan="14"},
		}
	if infobox:is_param_defined(Infobox.param('value')) > 0  then
		infobox:add_row{
			{tag='th', content='Value', colspan="6"},
			{tag='td', content=Infobox.param('value'), colspan="14"},
		}
	end
	infobox:add_row{
			{tag='th', content='Description', colspan="6"},
			{tag='td', content=Infobox.param('description'), colspan="14"}
		}
	if infobox:is_param_defined(Infobox.param('variant')) > 0 and infobox:get_param(Infobox.param('variant'), 0) ~= 'N/A' then
		infobox:add_row{
			{tag='th', content='[[Variant]] of', colspan="6"},
			{tag='td', content=Infobox.param('variant'), colspan="14"},
		}
	end
	local bubble_a = infobox:is_param_defined(Infobox.param('profession_bubble_a')) > 0
	if bubble_a then
		infobox:add_row{
			{tag='td', content=Infobox.param('profession_bubble_a'), class='infobox-bubble-item', colspan="20"},
			addClass = 'infobox-bubble-row'
		}
	else
		infobox:pad('20')
	end
	
	return infobox
end

return p