« Module:Infobox/Compétence » : différence entre les versions
mAucun résumé des modifications |
Couleurs plus fidèles à la réalité du jeu |
||
(7 versions intermédiaires par 3 utilisateurs non affichées) | |||
Ligne 11 : | Ligne 11 : | ||
end | end | ||
local FAMILIES = { | local FAMILIES = { | ||
physique = {" | physique = {"PHYSIQUE", "#450E40"}, | ||
social = {" | social = {"SOCIAL", "#B08B42"}, | ||
combat = {" | combat = {"COMBAT", "#A7312D"}, | ||
science = {" | science = {"SCIENCE", "#236A8D"}, | ||
tech = {" | tech = {"TECH", "#6F558A"}, | ||
} | } | ||
local family_config = FAMILIES[family:lower()] | local family_config = FAMILIES[family:lower()] | ||
Ligne 25 : | Ligne 25 : | ||
end | end | ||
return tostring(mw.html.create("div") | return tostring(mw.html.create("div") | ||
:css("background-color", | :css("background-color", family_config[2]) | ||
:css("color", "white") | :css("color", "white") | ||
:css("font-weight", "bold") | :css("font-weight", "bold") | ||
:css("text-align", "center") | :css("text-align", "center") | ||
:wikitext( | :wikitext(family_config[1]) | ||
:done() | :done() | ||
) | ) | ||
Ligne 44 : | Ligne 44 : | ||
{type = "row", label = "Famille", value = family}, | {type = "row", label = "Famille", value = family}, | ||
{type = "row", label = "Effets", value = "effets"}, | {type = "row", label = "Effets", value = "effets"}, | ||
{type = "row", label = "Rang", value = "rang"}, | |||
}, | }, | ||
}, | }, |
Dernière version du 21 septembre 2023 à 00:31
Paramétrage du modèle {{Infobox Compétence}}.
local general = require("Module:Infobox/Fonctions")
local localdata = require("Module:Infobox/Localdata")
-- Famille de compétences
-- TODO: Revoir pour la couleur de Tech, qui n'apparaît pas
-- clairement dans la bande-annonce
family = function(localdata)
local family = localdata["famille"]
if family == nil then
error("Paramètre « famille » absent")
end
local FAMILIES = {
physique = {"PHYSIQUE", "#450E40"},
social = {"SOCIAL", "#B08B42"},
combat = {"COMBAT", "#A7312D"},
science = {"SCIENCE", "#236A8D"},
tech = {"TECH", "#6F558A"},
}
local family_config = FAMILIES[family:lower()]
if family_config == nil then
error(string.format(
"Valeur inconnue du paramètre « famille » : « %s »",
family
))
end
return tostring(mw.html.create("div")
:css("background-color", family_config[2])
:css("color", "white")
:css("font-weight", "bold")
:css("text-align", "center")
:wikitext(family_config[1])
:done()
)
end
return {
parts = {
general.title(),
general.image(),
{
type = "table",
title = "Caractéristiques",
rows = {
{type = "row", label = "Famille", value = family},
{type = "row", label = "Effets", value = "effets"},
{type = "row", label = "Rang", value = "rang"},
},
},
general.creation_kit(),
}
}