PC Gaming Shelter
An archive dedicated to preserving PC Gaming history and more

Module:Game

From PC Gaming Shelter

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

local utils = require( 'Module:Utils' )

local p = {}

local function propertiesPlan()
	-- ['Form field name'] = { 'Semantic property', 'delimiter' }
	local propMap = {
		['Release date']        = {'Has release date' },
		['Developer']           = {'Has developer', ',' },
		['Publisher']           = {'Has publisher' },
		['Series']              = {'Has series', ',' },
		['Image']               = {'Image', 'file' },
		['Current version']     = {'Has version' },
		['Genre']               = {'Has genre', ',' },
		['Setting']             = {'Has setting', ',' },
		['Has game mode']       = {'Has game mode', ',' },
		['Platform']            = {'Has platform', ',' },
		['Multiplayer tools']   = {'Has multiplayer tools', ',' }
	}
	return propMap
end

local function infoboxSectionPlan()
	local sectionMap = {
		['Game Info'] = {
			heading = 'Game Info',
			template = 'Infobox/Game Info',
			order = '1',
			rows = {
				'Developer',
				'Publisher',
				'Genre',
				'Setting',
				'Has game mode',
				'Platform',
				'Release date',	
				'System requirements'
			}
		},
		['These days'] = {
			heading = 'These days',
			template = 'Infobox/These days',
			order = '2',
			rows = {
				'Community links',
				'Multiplayer tools',
				'Current version',
				'Store links'
			}
		}
	}
	return sectionMap
end

function p.infobox(frame)
	local category   = 'Games'
	local properties = propertiesPlan()
	local sections   = infoboxSectionPlan()
	local footer     = 'Game footer'
	local infobox    = utils.createInfobox(frame, category, properties, sections, footer)
	return infobox
end

return p