Module:Ability

De Inkipédia

Displays an inline gear ability icon with a text link.

Usage

{{Ability|<game>|<name>|<size>|<icononly>}}

Parameters

Parameter Type Status Description
game Unnamed Required The game that the ability belongs to. Must be one of the following:
  • S for Splatoon
  • S2 for Splatoon 2
  • S3 for Splatoon 3
name Unnamed Required The English name of the ability.
  • ? can be used to get the no-ability question mark.
size Unnamed Optional The pixel width for the icon. The default size is 24. Required if icononly is specified.
icononly Unnamed Optional. If present, the text label will be omitted.

Examples

Markup

* {{Ability|S|?}}
* {{Ability|S|Ink Saver (Main)}}
* {{Ability|S|Ink Saver (Main)|32}}
* {{Ability|S2|Ink Saver (Main)|32|icononly}}
* {{Ability|S3|Ink Saver (Main)|32|icononly}}

Output


local p = {}
local gameShortened = require("Module:GameShortened")
local francais = require("Module:Français")

function p.main(frame)
    local args = frame:getParent().args
    local game = args["game"] or args[1]
    local name = args["name"] or args[2]
    local size = args["size"] or args[3]
    local icononly = args["icononly"] ~= nil or args[3] == "icononly" or args[4] == "icononly"

    local translatedBonus = {
--Nom
["Abilities"] = "Bonus",
["Gear abilities"] = "Bonus d'équipement",
["Ability"] = "Bonus",
["Gear ability"] = "Bonus d'équipement",
["Primary abilities"] = "Bonus principaux",
["Primary ability"] = "Bonus principal",
["Main"] = "Principal",
["Secondary abilities"] = "Bonus additionnels",
["Secondary ability"] = "Bonus additionnel",
["Sub"] = "Secondaire",

--Bonus
["Bomb Range Up"] = "Bras long",
["Bomb Sniffer"] = "Chasse-pièges",
["Cold-Blooded"] = "Furtivité",
["Comeback"] = "Come-back",
["Damage Up"] = "Force de frappe",
["Defense Up"] = "Buvard",
["Haunt"] = "Revanche",
["Ink Recovery Up"] = "Levée d'encre",
["Ink Resistance Up"] = "Pieds au sec",
["Ink Saver (Main)"] = "Encrémenteur (pr.)",
["Ink Saver (Sub)"] = "Encrémenteur (sec.)",
["Last-Ditch Effort"] = "Ultime sursaut",
["Ninja Squid"] = "Ninjalamar",
["Opening Gambit"] = "Chapeaux de roue",
["Quick Respawn"] = "Sans temps morts",
["Quick Super Jump"] = "Aérodynamisme",
["Recon"] = "Radar de départ",
["Recon (ability)"] = "Radar de départ (bonus)",
["Run Speed Up"] = "Couse à pied",
["Special Charge Up"] = "Jauge spéciale +",
["Special Duration Up"] = "Durée spéciale +",
["Special Saver"] = "Baisse spéciale -",
["Stealth Jump"] = "Réception réussie",
["Swim Speed Up"] = "Turbo-calamar",
["Tenacity"] = "Justice",
["Ability Doubler"] = "Bonus ×2",
["Bomb Defense Up"] = "Filtre à explosions",
["Bomb Defense Up DX"] = "Filtre à explosions II",
["Drop Roller"] = "Super roulade",
["Main Power Up"] = "Arme principale +",
["Object Shredder"] = "Démolition",
["Respawn Punisher"] = "Retour perdant",
["Special Power Up"] = "Arme spéciale +",
["Sub Power Up"] = "Arme secondaire +",
["Thermal Ink"] = "Encre thermique",
["Cold Blooded"] = "Furtivité",
["Intensify Action"] = "Feu de l'action",
["Sub Resistance Up"] = "Filtre à secondaires",
[""] = "",
["?"] = "?",
    }

    game = gameShortened.getGame(game)
    if name == nil then name = "" end
    if size == nil then size = "24" end

    if name == "?" then
        linkText = "Gear ability"
        result = "[[File:" .. game .. "_Ability_Locked.png|" .. size .. "px|link=" .. linkText .. "]]"
    elseif name ~= "Neutral" then
        local translatedName = translatedBonus[name] or name -- Try to find the translation, otherwise use the original name

        result = "[[File:" .. game .. "_Ability_" .. name .. ".png|" .. size .. "px|link=" .. translatedName .. "]]"

        if not icononly then
            result = result .. "&#32;[[" .. translatedName .. "]]"
        end
    elseif name == "Neutral" then
        result = result .. " [[Category:Neutral gear ability call]]"
    end

    return result
end

return p