Module:Stats/REQ/H5G/TEMPLATES: Difference between revisions
From Halopedia, the Halo wiki
< Module:Stats | REQ
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local strings = require( 'Module:Stats/REQ/H5G/STRINGS' ) | local strings = require( 'Module:Stats/REQ/H5G/STRINGS' ) | ||
function rarity( | function rarity( data ) | ||
-- Build the rarity string | -- Build the rarity string | ||
local rarity = strings.rarity( data[ 'rarity' ] ) | local rarity = strings.rarity( data[ 'rarity' ] ) | ||
Line 13: | Line 13: | ||
-- Add the fields to the infocard | -- Add the fields to the infocard | ||
card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) ) | card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) ) | ||
.withField( strings.field( 'rarity' ), rarity( | .withField( strings.field( 'rarity' ), rarity( data ) ) | ||
.withField( strings.field( 'energy' ), '{{Energy|' .. data[ 'energy' ] .. '}}' ) | .withField( strings.field( 'energy' ), '{{Energy|' .. data[ 'energy' ] .. '}}' ) | ||
.withField( strings.field( 'rp' ), '{{RP|' .. data[ 'rp' ] .. '}}') | .withField( strings.field( 'rp' ), '{{RP|' .. data[ 'rp' ] .. '}}') | ||
Line 22: | Line 22: | ||
-- Add the fields to the infocard | -- Add the fields to the infocard | ||
card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) ) | card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) ) | ||
.withField( strings.field( 'rarity' ), rarity( | .withField( strings.field( 'rarity' ), rarity( data ) ) | ||
return | return | ||
end | end | ||
Line 29: | Line 29: | ||
-- Add the fields to the infocard | -- Add the fields to the infocard | ||
card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) ) | card.withField( strings.field( 'category' ), strings.category( data[ 'category' ] ) ) | ||
.withField( strings.field( 'rarity' ), rarity( | .withField( strings.field( 'rarity' ), rarity( data ) ) | ||
return | return | ||
end | end |
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