Module:Stats/REQ/H5G/TEMPLATES: Difference between revisions

From Halopedia, the Halo wiki

No edit summary
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
return {
local strings = require( 'Module:Stats/REQ/H5G/STRINGS' )
[ 'powerwep' ] = {
 
'category',
function rarity( data )
'rarity',
-- Build the rarity string
'energy',
local rarity = strings.rarity( data[ 'rarity' ] )
'rp'
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( data ) )
.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( data ) )
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( data ) )
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

Latest revision as of 08:46, September 24, 2022

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

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

function rarity( data )
	-- 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( data ) )
		.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( data ) )
	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( data ) )
	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