« Module:Monnaie » : différence entre les versions
De Inkipédia
mAucun résumé des modifications |
mAucun résumé des modifications |
||
Ligne 42 : | Ligne 42 : | ||
local taille = args[4] or args["taille"] or 24 | local taille = args[4] or args["taille"] or 24 | ||
-- Normalizar el nombre del | -- Normalizar el nombre del game | ||
game = require('Module:GameShortened').getGame(game) | game = require('Module:GameShortened').getGame(game) | ||
-- Normalizar el tipo de | -- Normalizar el tipo de monnaie | ||
monnaie = genericType(monnaie) | monnaie = genericType(monnaie) | ||
Ligne 55 : | Ligne 55 : | ||
end | end | ||
-- Lógica para determinar el enlace de la imagen basado en el tipo de | -- Lógica para determinar el enlace de la imagen basado en el tipo de monnaie y estado | ||
if monnaie == "monnaie" then | if monnaie == "monnaie" then | ||
return string.format("[[File:%s Icon Cash.png|%dpx|link=Monnaie]]", game, taille) | return string.format("[[File:%s Icon Cash.png|%dpx|link=Monnaie]]", game, taille) | ||
elseif monnaie== "oeufdepoisson" or monnaie== "oeuf" then | elseif monnaie== "oeufdepoisson" or monnaie== "oeuf" then | ||
return string.format("[[File:%s Icon Power Egg.png|%dpx|link=Œuf de poisson]]", game, taille) | return string.format("[[File:%s Icon Power Egg.png|%dpx|link=Œuf de poisson]]", game, taille) | ||
elseif | elseif monnaie == "supercoquillage" or monnaie == "coquillage" then | ||
return string.format("[[File:%s Icon Super Sea Snail.png|%dpx|link= | return string.format("[[File:%s Icon Super Sea Snail.png|%dpx|link=Super coquillage]]", game, taille) | ||
elseif | elseif monnaie == "oeufdoré" then | ||
if | if game == "S3" then | ||
return string.format("[[File:S2 Icon Golden Egg.png|%dpx|link= | return string.format("[[File:S2 Icon Golden Egg.png|%dpx|link=Oeuf doré]]", taille) | ||
elseif | elseif game == "S2" then | ||
return string.format("[[File:S2 Icon Golden Egg.png|%dpx|link= | return string.format("[[File:S2 Icon Golden Egg.png|%dpx|link=Oeuf doré]]", taille) | ||
end | end | ||
elseif | elseif monnaie == "sardinium" then | ||
if | if game == "S3" then | ||
return string.format("[[File:S2 Icon Sardinium Shadow.png|%dpx|link= | return string.format("[[File:S2 Icon Sardinium Shadow.png|%dpx|link=Sardinium]]", taille) | ||
elseif | elseif game == "S2" then | ||
return string.format("[[File:S2 Icon Sardinium Shadow.png|%dpx|link= | return string.format("[[File:S2 Icon Sardinium Shadow.png|%dpx|link=Sardinium]]", taille) | ||
end | end | ||
elseif | elseif monnaie == "fragment" or monnaie == "fragmentbonus" or monnaie == "fragmentdebonus" or monnaie == "fragments" or monnaie == "fragmentsbonus" or monnaie == "fragmentsdebonus" then | ||
return string.format("[[File:%s Icon Ability Chunk Generic.png|%dpx|link= | return string.format("[[File:%s Icon Ability Chunk Generic.png|%dpx|link=Fragment de bonus]]", game, taille) | ||
elseif | elseif monnaie == "coupon" or monnaie == "ticket" then | ||
if estado == " | if estado == "nourriture" then | ||
return string.format("[[File:%s Ticket Food Random.png|%dpx|link= | return string.format("[[File:%s Ticket Food Random.png|%dpx|link=Ticket]]", game, taille) | ||
elseif estado == " | elseif estado == "boisson" then | ||
return string.format("[[File:%s Ticket Drink Random.png|%dpx|link= | return string.format("[[File:%s Ticket Drink Random.png|%dpx|link=Ticket]]", game, taille) | ||
end | end | ||
elseif | elseif monnaie == "pointcurbit" or monnaie == "pointscurbit" then | ||
return string.format("[[File:%s Icon CQ Points.png|%dpx|link= | return string.format("[[File:%s Icon CQ Points.png|%dpx|link=CQ-80#Pointcurbit]]", game, taille) | ||
elseif | elseif monnaie == "brevet" or monnaie == "brevetcartouche" or monnaie == "brevetdecartouche" then | ||
if estado == nil then | if estado == nil then | ||
return string.format("[[File:%s Icon Sheldon License.png|%dpx|link= | return string.format("[[File:%s Icon Sheldon License.png|%dpx|link=Brevet Cartouche]]", game, taille) | ||
elseif estado == " | elseif estado == "or" then | ||
return string.format("[[File:%s Icon Gold Sheldon License.png|%dpx|link= | return string.format("[[File:%s Icon Gold Sheldon License.png|%dpx|link=Brevet Cartouche]]", game, taille) | ||
end | end | ||
elseif | elseif monnaie == "ecaille" then | ||
if estado == " | if estado == "bronze" then | ||
return string.format("[[File:%s Icon Bronze Fish Scale.png|%dpx|link= | return string.format("[[File:%s Icon Bronze Fish Scale.png|%dpx|link=Ecaille]]", game, taille) | ||
elseif estado == " | elseif estado == "argent" or estado == "argentee" then | ||
return string.format("[[File:%s Icon Silver Fish Scale.png|%dpx|link= | return string.format("[[File:%s Icon Silver Fish Scale.png|%dpx|link=Ecaille]]", game, taille) | ||
elseif estado == " | elseif estado == "doree" or estado == "or" then | ||
return string.format("[[File:%s Icon Gold Fish Scale.png|%dpx|link= | return string.format("[[File:%s Icon Gold Fish Scale.png|%dpx|link=Ecaille]]", game, taille) | ||
end | end | ||
elseif | elseif monnaie == "conque" then | ||
return string.format("[[File:%s icon conch shell.png|%dpx|link= | return string.format("[[File:%s icon conch shell.png|%dpx|link=Conque]]", game, taille) | ||
else | else | ||
return string.format("[[File:Not found.png|%dpx|link=]]", | return string.format("[[File:Not found.png|%dpx|link=]]", taille) | ||
end | end | ||
end | end | ||
return m | return m |
Version du 7 mai 2024 à 19:19
La documentation pour ce module peut être créée à Module:Monnaie/doc
local m = {} -- Función para normalizar el tipo de traducción local function genericType(input) if input == nil then return nil end -- Convertir a minúsculas input = input:lower() -- Tabla de mapeo para reemplazar letras con tildes y diéresis local mapping = { ["á"] = "a", ["é"] = "e", ["í"] = "i", ["ó"] = "o", ["ú"] = "u", ["à"] = "a", ["è"] = "e", ["ì"] = "i", ["ò"] = "o", ["ù"] = "u", ["ä"] = "a", ["ë"] = "e", ["ï"] = "i", ["ö"] = "o", ["ü"] = "u", ["ã"] = "a", ["ẽ"] = "e", ["ĩ"] = "i", ["õ"] = "o", ["ũ"] = "u", ["ñ"] = "n", ["ç"] = "c", ["Á"] = "a", ["É"] = "e", ["Í"] = "i", ["Ó"] = "o", ["Ú"] = "u", ["À"] = "a", ["È"] = "e", ["Ì"] = "i", ["Ò"] = "o", ["Ù"] = "u", ["Ä"] = "a", ["Ë"] = "e", ["Ï"] = "i", ["Ö"] = "o", ["Ü"] = "u", ["Ã"] = "a", ["Ẽ"] = "e", ["Ĩ"] = "i", ["Õ"] = "o", ["Ũ"] = "u", ["Ñ"] = "n", ["Ç"] = "c" } -- Reemplazar letras con tilde y diéresis según la tabla de mapeo for k, v in pairs(mapping) do input = input:gsub(k, v) end -- Eliminar caracteres especiales y espacios input = input:gsub("[%s%p%c]", "") return input end function m.main(frame) local args = frame:getParent().args local game = args["type"] or args[1] local monnaie = args["monnaie"] or args[2] local etat = args["etat"] or args[3] local taille = args[4] or args["taille"] or 24 -- Normalizar el nombre del game game = require('Module:GameShortened').getGame(game) -- Normalizar el tipo de monnaie monnaie = genericType(monnaie) if estado ~= nil and not tonumber(estado) then etat = genericType(etat) else taille = tonumber(etat) or taille etat = nil end -- Lógica para determinar el enlace de la imagen basado en el tipo de monnaie y estado if monnaie == "monnaie" then return string.format("[[File:%s Icon Cash.png|%dpx|link=Monnaie]]", game, taille) elseif monnaie== "oeufdepoisson" or monnaie== "oeuf" then return string.format("[[File:%s Icon Power Egg.png|%dpx|link=Œuf de poisson]]", game, taille) elseif monnaie == "supercoquillage" or monnaie == "coquillage" then return string.format("[[File:%s Icon Super Sea Snail.png|%dpx|link=Super coquillage]]", game, taille) elseif monnaie == "oeufdoré" then if game == "S3" then return string.format("[[File:S2 Icon Golden Egg.png|%dpx|link=Oeuf doré]]", taille) elseif game == "S2" then return string.format("[[File:S2 Icon Golden Egg.png|%dpx|link=Oeuf doré]]", taille) end elseif monnaie == "sardinium" then if game == "S3" then return string.format("[[File:S2 Icon Sardinium Shadow.png|%dpx|link=Sardinium]]", taille) elseif game == "S2" then return string.format("[[File:S2 Icon Sardinium Shadow.png|%dpx|link=Sardinium]]", taille) end elseif monnaie == "fragment" or monnaie == "fragmentbonus" or monnaie == "fragmentdebonus" or monnaie == "fragments" or monnaie == "fragmentsbonus" or monnaie == "fragmentsdebonus" then return string.format("[[File:%s Icon Ability Chunk Generic.png|%dpx|link=Fragment de bonus]]", game, taille) elseif monnaie == "coupon" or monnaie == "ticket" then if estado == "nourriture" then return string.format("[[File:%s Ticket Food Random.png|%dpx|link=Ticket]]", game, taille) elseif estado == "boisson" then return string.format("[[File:%s Ticket Drink Random.png|%dpx|link=Ticket]]", game, taille) end elseif monnaie == "pointcurbit" or monnaie == "pointscurbit" then return string.format("[[File:%s Icon CQ Points.png|%dpx|link=CQ-80#Pointcurbit]]", game, taille) elseif monnaie == "brevet" or monnaie == "brevetcartouche" or monnaie == "brevetdecartouche" then if estado == nil then return string.format("[[File:%s Icon Sheldon License.png|%dpx|link=Brevet Cartouche]]", game, taille) elseif estado == "or" then return string.format("[[File:%s Icon Gold Sheldon License.png|%dpx|link=Brevet Cartouche]]", game, taille) end elseif monnaie == "ecaille" then if estado == "bronze" then return string.format("[[File:%s Icon Bronze Fish Scale.png|%dpx|link=Ecaille]]", game, taille) elseif estado == "argent" or estado == "argentee" then return string.format("[[File:%s Icon Silver Fish Scale.png|%dpx|link=Ecaille]]", game, taille) elseif estado == "doree" or estado == "or" then return string.format("[[File:%s Icon Gold Fish Scale.png|%dpx|link=Ecaille]]", game, taille) end elseif monnaie == "conque" then return string.format("[[File:%s icon conch shell.png|%dpx|link=Conque]]", game, taille) else return string.format("[[File:Not found.png|%dpx|link=]]", taille) end end return m