Documentation du module

Ce module contient le paramétrage de l'infobox {{Infobox quête}}.

Documentation transclues de Module:Infobox/Quête/doc.
local localdata = require('Module:Infobox/Localdata')

function buildSuccess(localdata)
	local success = nil
	local icon = require('Module:Icône')
	
	if localdata['achèvement'] then
		success = localdata['achèvement']
	end

	if localdata['gamerscore'] or localdata['type trophée'] then
		if success == nil then
			success = mw.title.getCurrentTitle().text
		end
		
		success = success ..'<div style="float:right;padding-left:15px;position:relative;white-space:nowrap;">'
		
		if localdata['gamerscore'] then
			success = success ..'<span style="padding-left:4px;">'.. icon._build({ 'gamerscore' }) ..'</span>'
			success = success ..'<span style="padding-left: 2px;position:relative;top:1px;">'.. localdata['gamerscore'] ..'</span>'
		end
		
		if localdata['type trophée'] then
			success = success ..'<span style="padding-left:4px;">'.. icon._build({ 'trophéeps3' }) ..'</span>'
			success = success ..'<span style="padding-left: 2px;position:relative;top:1px;">'.. localdata['type trophée'] ..'</span>'
		end
		
		success = success..'</div>'
	end
	
	return success
end

function buildSubject(arg)
	local subject = 'Quête'
	local type = nil
	
	if arg then
		local types = {
			['principale']  = 'principale',
			['répétable']   = 'répétable',
			['annexe']      = 'annexe',
			['secondaire']  = 'secondaire',
			['quotidienne'] = 'quotidienne',
			['non marquée'] = 'non marquée',
			['aléatoire']   = 'aléatoire'
		}
		type = types[arg:lower()]
	end
	
	if type then
		subject = subject..' '..type
	end
	
	return subject
end

return {
	parts = {
		{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = buildSubject(localdata['type']), link = 'Quêtes' }},
		{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
		{ type = 'table', title = 'Informations', rows = {
			{ type = 'row', label = 'Lieu', value = 'lieu' },
			{ type = 'row', label = 'Lieu de fin', value = 'lieu de fin' },
			{ type = 'row', label = 'Donnée par', value = 'donneur' },
			{ type = 'row', label = 'Faction', value = 'faction' },
			{ type = 'row', label = 'Autres PNJ', value = { 'autres pnj', 'autres pnjs' } },
			{ type = 'row', label = 'Récompenses', value = 'récompenses' },
			{ type = 'row', label = 'Succès', value = function (localdata) return buildSuccess(localdata) end },
		}},
		{ type = 'table', title = 'Technique', rows = {
			{ type = 'row', label = 'Editor ID', value = 'editor id' },
			{ type = 'row', label = '[[Form ID|Base ID]]', value = { 'base id', 'baseid' } }
		}},
		{ type = 'table', title = 'Quêtes associées', rows = {
			{ type = 'succession', value = {
				before = function(localdata) return localdata['précédente'] end,
				after  = function(localdata) return localdata['suivante'] end
			}},
			{ type = 'row1col', value = { 'relative', 'associée' } }
		}},
		{ type = 'text', value = 'pied' }
	}
}