« Module:Infobox/Quête » : différence entre les versions

2 293 octets ajoutés ,  21 janvier 2023
Harmonisation des identifiants techniques
Kharmitch (discussion | contributions)
Première version de l'infobox quête
 
Kharmitch (discussion | contributions)
Harmonisation des identifiants techniques
 
(11 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
local localdata = require('Module:Infobox/Localdata')
local localdata = require('Module:Infobox/Localdata')


function buildSubject(arg)
 
local subject = 'Quête'
--------------------------------------------------------
local type = nil
-----        Calcul des champs à afficher        -----
--------------------------------------------------------
 
-- Succès
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
 
-- Sujet
function buildSubject(localdata)
local subject
local questType = localdata['type']
if arg then
if questType then
local types = {
local types = {
['principale']  = 'principale',
['principale']  = 'Quête principale',
['répétable']  = 'répétable',
['répétable']  = 'Quête répétable',
['annexe']      = 'annexe',
['annexe']      = 'Quête annexe',
['secondaire']  = 'secondaire',
['secondaire']  = 'Quête secondaire',
['quotidienne'] = 'quotidienne',
['quotidienne'] = 'Quête quotidienne',
['non marquée'] = 'non marquée',
['non marquée'] = 'Quête non marquée',
['aléatoire']  = 'aléatoire'
['aléatoire']  = 'Quête aléatoire',
-- Opération
['opération']  = 'Opération quotidienne',
-- Évènement
['évènement']  = 'Évènement',
['public']      = 'Évènement public',
['saisonnier']  = 'Évènement saisonnier'
}
}
type = types[arg:lower()]
subject = types[questType:lower()] or 'Quête'
else
subject = 'Quête'
end
end
if type then
return subject
subject = subject..' '..type
end
 
-- Lien
function buildLink(localdata)
local link = 'Quêtes'
local questType = localdata['type']
if questType then
questType = questType:lower()
if questType == 'opération' then
link = 'Opérations quotidiennes'
elseif questType == 'évènement' or questType == 'public'
or questType == 'saisonnier' then
link = 'Évènements'
end
end
end
return subject
return link
end
end
--------------------------------------------------------
-----          Construction de l'infobox          -----
--------------------------------------------------------


return {
return {
parts = {
parts = {
{ type = 'title', value = 'nom', subtitle = 'sous-titre', subhead = { games = 'jeux', subject = buildSubject(localdata['type']), link = 'Quêtes' }},
{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = buildSubject(localdata), link = buildLink(localdata) }},
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = 'légende' },
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }},
{ type = 'table', title = 'Informations', rows = {
{ type = 'table', title = 'Informations', rows = {
{ type = 'row', label = 'Lieu', value = 'lieu' },
{ type = 'row', label = 'Lieu', value = 'lieu' },
Ligne 36 : Ligne 100 :
{ type = 'row', label = 'Autres PNJ', value = { 'autres pnj', 'autres pnjs' } },
{ type = 'row', label = 'Autres PNJ', value = { 'autres pnj', 'autres pnjs' } },
{ type = 'row', label = 'Récompenses', value = 'récompenses' },
{ type = 'row', label = 'Récompenses', value = 'récompenses' },
{ type = 'row', label = 'Achèvement', value = 'achèvement' },
{ type = 'row', label = 'Succès', value = function (localdata) return buildSuccess(localdata) end },
}},
}},
{ type = 'table', title = 'Technique', rows = {
{ type = 'table', title = 'Technique', rows = {
{ type = 'row', label = 'Editor ID', value = 'editor id' },
{ type = 'row', label = 'Editor ID', value = 'editorid' },
{ type = 'row', label = '[[Form ID|Base ID]]', value = { 'base id', 'baseid' } }
{ type = 'row', label = '[[Form ID]]', value = 'formid' }
}},
}},
{ type = 'table', title = 'Quêtes associées', rows = {
{ type = 'table', title = 'Quêtes associées', rows = {
{ type = 'succession', value = {
{ type = 'succession', value = {
before = localdata['précédente'],
before = function(localdata) return localdata['précédente'] end,
after  = localdata['suivante']
after  = function(localdata) return localdata['suivante'] end
}},
}},
{ type = 'row1col', value = { 'relative', 'associée' } }
{ type = 'row1col', value = { 'relative', 'associée' } }
}}
}},
{ type = 'images', imageparameters = 'animation', defaultcaption = 'Animation de la quête' },
{ type = 'text', value = 'pied' }
}
}
}
}
Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications