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

From Halopedia, the Halo wiki

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