Module:Icones

local p = {} local iconTip = { -- Gameplay ["Clochette"]           = "Clochette", ["Miles Nook"]          = "Miles Nook", ["Kit de personnalisation"] = "Kit de personnalisation", -- Tailles ["Taille 0.5x1.0"]      = "Taille 0.5x1.0", ["Taille 1.0x0.5"]      = "Taille 1.0x0.5", ["Taille 1.0x1.0"]      = "Taille 1.0x1.0", ["Taille 1.0x1.5"]      = "Taille 1.0x1.5" } local gameIcon = { ["Clochette"]       = "Clochette.png", ["Miles Nook"]      = "Miles Nook.png", ["Kit de personnalisation"] = "NH-Icone-Kit de personnalisation.png", ["Taille 0.5x1.0"]  = "NH-Taille-0.5x1.0.jpg", ["Taille 1.0x0.5"]  = "NH-Taille-1.0x0.5.jpg", ["Taille 1.0x1.0"]  = "NH-Taille-1.0x1.0.jpg", ["Taille 1.0x1.5"]  = "NH-Taille-1.0x1.5.jpg" } local iconSize = { ["petit"]          = "x10px", ["medium"]         = "x14px", ["normal"]         = "x14px", ["gros"]           = "x20px" } function p.Icones(frame) local iconList = mw.text.split(frame.args[1], ",") local parserError = "" local iconSetting if frame.args[2] ~= nil and string.len(frame.args[2]) > 0 then iconSetting = tostring(frame.args[2]) else iconSetting = iconSize["medium"] end local iconLinks if frame.args[3] ~= nil then iconLinks = mw.text.split(frame.args[3], ",") end local tipOverride if frame.args[4] ~= nil then tipOverride = mw.text.split(frame.args[4], ",") end local n = 1 local result = "" while n <= table.getn(iconList) do       newIcon = iconList[n] if gameIcon[newIcon] ~= nil then currentIcon = gameIcon[newIcon] if tipOverride ~= nil and tipOverride[n] ~= nil then currentTip = tipOverride[n] else if iconLinks ~= nil and iconLinks[n] ~= nil then currentTip = iconLinks[n] else splitTip = mw.text.split(iconTip[newIcon], "|") currentTip = splitTip[1] end end else currentIcon = "Icon question.png" currentTip = "Unrecognized icon name" end result = result .. ' ' .. currentTip .. ' '       result = result .. ' '       result = result .. ' '       n = n + 1 end return result .. parserError

end

function p.documentation keys = {} for k in pairs(gameIcon) do       table.insert(keys, k)    end table.sort(keys) result = '{| class="va-table va-table-full"\n|-\n !prefix!!Icon!!prefix!!Icon!!prefix!!Icon\n|-\n' set = 1 for k,v in ipairs(keys) do       result = result .. "||'''" .. v .. "'''"       result = result .. "||"       if set == 3 then result = result .. "\n|-\n" end if set < 3 then set = set + 1 else set = 1 end end

result = result .. "\n|}" return result

end function p.plateformes(frame) local icons = mw.text.split(frame.args[1], ",") local iconCount = 1 local platformCheck = "" local result = "" while iconCount <= table.getn(icons) do       currentIcon = iconTip[icons[iconCount]] platformCheck = mw.text.split(currentIcon, "|") if platformCheck[2] ~= nil then result = result .. ' ' .. platformCheck[1] .. ' '           result = result .. '' result = result .. ""           result = result .. ' '           result = result .. " "       end iconCount = iconCount + 1 end if result == "" then result = '[Plateformes nécessaires]' end return result end function p.test(frame) return frame.args[1] end return p