Module:Stats/REQ/H5G/TEMPLATES

From Halopedia, the Halo wiki

< Module:Stats‎ | REQ
Revision as of 08:40, September 24, 2022 by Dab1001 (talk | contribs)

Documentation for this module may be created at ModuleDoc:Stats/REQ/H5G/TEMPLATES

local strings = require( 'Module:Stats/REQ/H5G/STRINGS' )

function rarity( card )
	-- Build the rarity string
	local rarity = strings.rarity( data[ 'rarity' ] )
	if data[ 'mythic' ] then
		rarity = rarity .. ', ' .. strings.rarity( 'mythic' )
	end
	return rarity
end

function consumable( card, data )
	-- Add the fields to the infocard
	card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) )
		.withField( strings.field( 'rarity' ), rarity( card ) )
		.withField( strings.field( 'energy' ), '{{Energy|' .. data[ 'energy' ] .. '}}' )
		.withField( strings.field( 'rp' ), '{{RP|' .. data[ 'rp' ] .. '}}')
	return
end

function permanent( card, data )
	-- Add the fields to the infocard
	card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) )
		.withField( strings.field( 'rarity' ), rarity( card ) )
	return
end

function certification( card, data )
	-- Add the fields to the infocard
	card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) )
		.withField( strings.field( 'rarity' ), rarity( card ) )
	return
end

local p = {}

function p.announcer( card, data )
	permanent( card, data )
	return
end

function p.armor( card, data )
	permanent( card, data )
	return
end

function p.assassination( card, data )
	permanent( card, data )
	return
end

function p.boost( card, data )
	consumable( card, data )
	return
end

function p.certpowerup( card, data )
	certification( card, data )
	return
end

function p.certpowerwep( card, data )
	certification( card, data )
	return
end

function p.certvehicle( card, data )
	certification( card, data )
	return
end

function p.emblem( card, data )
	permanent( card, data )
	return
end

function p.helmet( card, data )
	permanent( card, data )
	return
end

function p.loadout( card, data )
	permanent( card, data )
	return
end

function p.powerup( card, data )
	consumable( card, data )
	return
end

function p.powerwep( card, data )
	consumable( card, data )
	return
end

function p.skin( card, data )
	permanent( card, data )
	return
end

function p.stance( card, data )
	permanent( card, data )
	return
end

function p.vehicle( card, data )
	consumable( card, data )
	return
end

function p.visor( card, data )
	permanent( card, data )
	return
end

return p