FANDOM


-- <pre>
local p = {}
 
local skinData  = mw.loadData('Módulo:SkinData/data')
local lib       = require('Módulo:Feature')
local color     = require('Módulo:Color')
local FN        = require('Módulo:Filename')
local IL        = require('Módulo:ImageLink')
local userError = require('Dev:User error')
 
function p.splashartistpage()
    local searchstring = mw.title.getCurrentTitle().text
 
    local championtable = {}
    for x in pairs(skinData) do
        table.insert(championtable, x)
    end
    table.sort(championtable)
 
    local resulttable = {}
    for _, championname in pairs(championtable) do
        local skintable  = {}
        for championname in pairs(skinData[championname]["skins"]) do
            table.insert(skintable, championname)
        end
        table.sort(skintable)
 
        for _, skinname in pairs(skintable) do
            local t = skinData[championname]["skins"][skinname]
 
            if t.splashartist ~= nil then
                for _, splashartistname in pairs(t.splashartist) do
                    if splashartistname == searchstring then
                        table.insert(resulttable, {championname, skinname, t.formatname, t.splashartist})
                    end
                end
            end
        end
    end
 
    if #resulttable == 0 then
        return userError("No results for " .. searchstring, "LuaError")
    end
 
    -- Three random images of work examples
    math.randomseed(os.time())
    local hash = {}
    local rnd  = 0
    local s1   = ""
 
    for i = 1, 3 do
        rnd = math.random(#resulttable)
        if hash[rnd] ~= true then
            s1 = s1 .. "[[File:" .. FN.skin({resulttable[rnd][1], resulttable[rnd][2]}) .. "|thumb|200px|Work example.]]"
        end
        hash[rnd] = true
    end
 
    -- Splash Art list
    local s2 = "<dl><dt>Splash Art</dt></dl><ul><li>"
    local tempval = ""
    for i, val in pairs(resulttable) do
        local championname = val[1]
        local skinname     = val[2]
        local formatname   = val[3]
        local splashartist = val[4]
 
        if tempval == championname then
            s2 = s2 .. ", "
        else
            if i ~= 1 then
                s2 = s2 .. "</li>\n<li>"
            end
            tempval = championname
        end
        s2 = s2 .. tostring(IL.skin({
            ["champion"] = championname,
            ["skin"] = skinname,
            ["link"] = championname .. "/Skins",
            ["text"] = lib.ternary(formatname, formatname, skinname .. " " .. championname),
            ["circle"] = "true"
        }))
 
        count = 0
        for i, val in pairs (splashartist) do
            if val ~= searchstring then
                if count == 0 then
                    s2 = s2 .. " <small>(Collaboration with "
                else
                    s2 = s2 .. ", "
                end
                s2 = s2 .. splashartist[i]
                count = count + 1
            end
        end
        if count ~= 0 then
            s2 = s2 .. ")</small>"
        end
    end
    s2 = s2 .. "</li></ul>"
 
    return s1 .. s2
end
 
 
function p.chromagallery(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local t = skinData[args[1]].skins[args[2] or "Original"]
    if t == nil or t.chromas == nil then
        return userError("No chromas specified for skin ''" .. args[2] .. "'' in Module:SkinData/data", "LuaError")
    end
    t = t.chromas
 
    local header = "- Chromas"
    local frame = mw.getCurrentFrame()
 
    if skinData[args[1]].skins[args[2] or "Original"].forms ~= nil then
        header = "forms"
    end
 
    local chromatable  = {}
    local chromastring = args['chromas'] or "true"
    if chromastring == "true" then
        for chromaname in pairs(t) do
            table.insert(chromatable, chromaname)
        end
    else
        chromatable = mw.text.split(chromastring, ",")
    end
    table.sort(chromatable)
 
    local champname  = args[1]
    local skinname   = args[2] or "Original"
    local formatname = skinData[champname].skins[skinname].formatname
    local key        = args["key"] or "true" 
    local imagewidth = "100px"
    local s = ''
    s = s .. '<div id="chromaexhibition" style="position:relative">\n<b>' .. lib.ternary(formatname, formatname, skinname .. " " .. champname) .. " " .. header .. "</b>"
 
    if key == "true" then
        s = s .. "<div style='position:absolute; top:5px; right: 5px; z-index:20;' title='Clave:{{return}}• Sin Borde - En la tienda{{return}}• Borde rojo - Raro{{return}}• Borde verde - Programa de Partners {{return}}• Borde dorado - Edición Limitada {{return}}Tenga en cuenta que las cromas para skins del Baúl de legado solo están disponibles cuando el aspecto está en la tienda.'>[[File:Information.svg|30px|link=]]</div>\n"
    end
 
    if #chromatable > 8 then
        imagewidth = "80px"
        s = s .. '<div class="chroma-gallery-large" style="width:718px; text-align:center">'
    else
        s = s .. '<div class="chroma-gallery" style="width:718px; text-align:center">'
    end
 
    s = s .. '<div class="base">[[File:' .. FN.chroma({champname, skinname, "Base"}) .. '|183px]]</div>'
 
    for i, chromaname in pairs(chromatable) do
        if skinData[champname].skins[skinname].chromas[chromaname] == nil then
            return userError("Chroma ''" .. chromaname .. "'' not specified in Module:SkinData/data for " .. lib.ternary(formatname, formatname, skinname .. " " .. champname), "LuaError")
        end
 
        local availability = skinData[champname].skins[skinname].chromas[chromaname].availability or "Disponible"
 
        if availability ~= "Cancelado" then
            s = s .. "<div><div class='chroma " .. string.lower(availability) .. "-border'>[[File:" .. FN.chroma({champname, skinname, chromaname}) .."{{!}}" .. "|" .. imagewidth .. "|border]]</div> <div class='chroma-caption'>" .. chromaname .. "</div></div>\n"
        end
    end
 
    s = s .. '</div>'
 
    return frame:preprocess(s)
end
 
function p.skinpage(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local champname = args[1] or mw.title.getCurrentTitle().rootText
 
    if skinData[champname] == nil then
        return userError("El campeón ''" .. champname .. "'' no existe en Módulo:SkinData/Data", "LuaError")
    end
 
    local t = skinData[champname]["skins"]
 
    local availabletable = {}
    local legacytable    = {}
    local limitedtable   = {}
    local upcomingtable  = {}
    local canceledtable  = {}
 
    for skinname in pairs(t) do
        if t[skinname].availability == "Disponible" then
            table.insert(availabletable, {skinname, t[skinname]})
        end
        if t[skinname].availability == "Legado" then
            table.insert(legacytable,    {skinname, t[skinname]})
        end
        if t[skinname].availability == "Limitado" or t[skinname].availability == "Raro" then
            table.insert(limitedtable,   {skinname, t[skinname]})
        end
        if t[skinname].availability == "Próximo" then
            table.insert(upcomingtable,  {skinname, t[skinname]})
        end
        if t[skinname].availability == "Cancelado" then
            table.insert(canceledtable,  {skinname, t[skinname]})
        end
    end
 
    function skinitem(data)
        local lang = mw.language.new("es")
        local skinname     = data[1]
        local formatname   = data[2].formatname or skinname .. ' ' .. champname
        local champid      = skinData[champname]["id"]
        local skinid       = data[2].id
        local cost         = data[2].cost
        local release      = data[2].release
        local distribution = data[2].distribution
 
        if release ~= "N/A" then
            release  = lang:formatDate("d-M-Y", data[2].release)
        end
 
        local s = ""
 
        s = s .. '<div style="display:inline-block; margin:5px; width:342px"><div class="skin-icon" data-champion="' .. champname .. '" data-skin="' .. skinname .. '">[[Archivo:' .. FN.skin({champname, skinname}) .. '|340px|border]]</div><div><div style="float:left">' .. formatname
 
        if skinid ~= nil then
            standardizedname = string.lower(champname:gsub("[' ]", ""))
            if standardizedname == "wukong" then
                standardizedname = "monkeyking"
            end
            teemogg_skinid = standardizedname .. '-' .. skinid
            s = s .. ' <span class="plainlinks">[https://teemo.gg/model-viewer?model-type=champions&skinid=' .. teemogg_skinid .. ' <span class="button" title="Ver en 3D" style="text-align:center; border-radius: 2px;"><b>Ver en 3D</b></span>]</span>'
        end
 
        s = s .. '</div><div style="float:right">'
 
        if cost == 'N/A' then
            -- skip
        elseif cost == 150000 then
            s = s .. tostring(IL.basic{["link"] = "Esencia Azul", ["text"] = cost, ["alttext"] = cost .. " de Esencia Azul", ["image"] = "BE icon.png", ["border"] = "false", ["labellink"] = "false"}) .. ' / ' 
        elseif cost == 100 then
            s = s .. tostring(IL.basic{["link"] = "Punto de prestigio", ["text"] = cost, ["alttext"] = cost .. " Puntos de Prestigio", ["image"] = "Hextech Crafting Prestige token.png", ["border"] = "false", ["labellink"] = "false"}) .. ' / ' 
        elseif cost == 10 then
            s = s .. tostring(IL.basic{["link"] = "Gemas", ["text"] = cost, ["alttext"] = cost .. " Gemas Raras", ["image"] = "Rare Gem.png", ["border"] = "false", ["labellink"] = "false"}) .. ' / ' 
        elseif cost == "special" then
            s = s .. "Precio especial" .. ' / ' 
        else
            s = s .. tostring(IL.basic{["link"] = "Riot Points", ["text"] = cost, ["alttext"] = cost .. " de RP", ["image"] = "RP icon.png", ["border"] = "false", ["labellink"] = "false"}) .. ' / ' 
        end
 
        s = s .. lib.ternary(release == 'N/A', 'N/A', release) .. '  </div></div></div>'
 
        return s
    end
 
    function chroma(chromatable)
        s = ""
        if #chromatable > 0 then
            for i in ipairs(chromatable) do
                s = s .. '<div style="clear:both"></div>' .. p.chromagallery{champname, chromatable[i]}
            end
        end
        return s
    end
 
    function comp(a, b)
        local a = a[2].id or -1
        local b = b[2].id or -1
 
        if a < b then
            return true
        end
    end
 
    local skintable = {
            {availabletable, text = 'Disponibles'},
            {legacytable,    text = 'Baúl de legado'},
            {limitedtable,   text = 'Raros y limitados'},
            {upcomingtable,  text = 'Próximos'},
            {canceledtable,  text = 'Cancelados'}
        }
    local s = ''
    for i, value in ipairs(skintable) do
        table.sort(skintable[i][1], comp)
        local chromatable = {}
        if #value[1] > 0 then
            s = s .. ('<div style="clear:both"></div>\n==' .. value.text .. '==\n<div style="font-size:small">\n  ')
            for i in pairs(value[1]) do
                s = s .. skinitem(value[1][i])
                if value[1][i][2].chromas then
                    table.insert(chromatable, value[1][i][1])
                end
            end
            s = s .. '</div>\n\n'
            table.sort(chromatable)
 
            s = s .. chroma(chromatable)
        end
    end
 
    s = s .. '<div style="clear:both"></div>'
    return s
end
 
function p.getAllchampionskins(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]]
end
 
function p.getChampionskin(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"]
end
 
function p.getFormatname(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].formatname
end
 
function p.getAvailability(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].availability
end
 
function p.getDistribution(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].distribution
end
 
function p.getCost(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].cost
end
 
function p.getRelease(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].release
end
 
function p.getRetired(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].retired
end
 
function p.getEarlysale(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].earlysale
end
 
function p.getSet(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].set
end
 
function p.getSetlist(frame)
    local championtable = {}
    local sets = {}
    local hash = {}
    local setList = mw.html.create('ul')
 
    setList:newline()
 
    for x in pairs(skinData) do
        table.insert(championtable, x)
    end
    table.sort(championtable)
 
    for _, championname in pairs(championtable) do
        local skintable  = {}
        for championname in pairs(skinData[championname]["skins"]) do
            table.insert(skintable, championname)
        end
        table.sort(skintable)
 
        for _, skinname in pairs(skintable) do
            local t = skinData[championname]["skins"][skinname]
 
            if t.set ~= nil then
                if type(t.set) == "table" then
                    for _, value in pairs(t.set) do
                        if (not hash[value]) then
                            table.insert(sets, value)
                            hash[value] = true
                        end
                    end
                else
                    if (not hash[t.set]) then
                        table.insert(sets, t.set)
                        hash[t.set] = true
                    end
                end
            end
        end
    end
 
    table.sort(sets)
 
    for _, setname in pairs(sets) do
        setList
            :tag('li')
                :wikitext('[[' .. setname .. ']]')
                :done()
            :done()
            :newline()
    end
 
    return setList
end
 
function p.getSetskins(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local skinList = mw.html.create('ul')
    local championtable = {}
    local result = false
 
    skinList:newline()
 
    for x in pairs(skinData) do
        table.insert(championtable, x)
    end
    table.sort(championtable)
 
    for _, championname in pairs(championtable) do
        local skintable  = {}
 
        for championname in pairs(skinData[championname]["skins"]) do
            table.insert(skintable, championname)
        end
        table.sort(skintable)
 
        for _, skinname in pairs(skintable) do
            local hit = false
            local t = skinData[championname]["skins"][skinname]
 
            if t.set ~= nil then
                if type(t.set) == "table" then
                    for _, subset in pairs(t.set) do
                        if subset == args[1] then
                            hit = true
                            result = true
                        end
                    end
                else
                    if t.set == args[1] then
                        hit = true
                        result = true
                    end
                end
            end
            if hit == true then
                skinList
                    :tag('li')
                        :tag('div')
                            :addClass('skin-icon')
                            :attr('data-champion', championname)
                            :attr('data-skin', skinname)
                            :wikitext('[[File:' .. FN.championcircle({championname, skinname}) .. '|20px|link=' .. championname .. ']] [[' .. championname .. '|' .. lib.ternary(t["formatname"] ~= nil, t["formatname"], skinname .. " " .. championname) .. ']]')
                        :done()
                    :done()
                    :newline()
            end
        end
    end
 
    if result == false then 
        skinList
            :tag('li')
                :wikitext('No match found for ' .. args[1] .. '.')
            :done()
            :newline()
    end
 
    return skinList
end
 
function p.getNeweffects(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].neweffects
end
 
function p.getNewanimations(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].newanimations
end
 
function p.getTransforming(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].transforming
end
 
function p.getFilter(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].filter
end
 
function p.getNewquotes(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].newquotes
end
 
function p.getNewvoice(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].newvoice
end
 
function p.getExtras(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].extras
end
 
function p.getLore(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].lore
end
 
function p.getChromas(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].chromas
end
 
function p.getChromacount(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    local t = skinData[args[1]].skins[args[2] or "Original"].chromas
    local s = ""
 
    local chromatable  = {}
    for chromaname in pairs(t) do
        table.insert(chromatable, chromaname)
    end
 
    return #chromatable or "N/A"
end
 
function p.getChromanames(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local t = skinData[args[1]].skins[args[2] or "Original"]
    if t == nil or t.chromas == nil then
        return userError("")
    end
    t = t.chromas
 
    local chromatable  = {}
    for chromaname in pairs(t) do
        table.insert(chromatable, chromaname)
    end
    table.sort(chromatable)
 
    local s = ""
    for i, chromaname in pairs(chromatable) do
        if i ~= 1 then
            s = s  .. ", " .. chromaname
        else
            s = s .. chromaname
        end
    end
 
    return s
end
 
function p.getForms(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].forms
end
 
function p.getFormnames(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    local t = skinData[args[1]].skins[args[2] or "Original"].forms
    local s = ""
 
    local formtable  = {}
    for formname in pairs(t) do
        table.insert(formtable, formname)
    end
    table.sort(formtable)
 
    for i, formname in pairs(formtable) do
        if i ~= 1 then
            s = s  .. ", " .. formname
        else
            s = s .. formname
        end
    end
 
    return s
end
 
function p.getFormicon(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].formicon
end
 
function p.getVu(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    return skinData[args[1]].skins[args[2] or "Original"].vu
end
 
function p.getSplashartist(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    local t = skinData[args[1]].skins[args[2] or "Original"].splashartist
    local s = ""
 
    if t == nil then
        return "Artista desconocido"
    end
 
    for i, splashartistname in ipairs(t) do
        if i ~= 1 then
            s = s .. ", " .. splashartistname:gsub("% ", "&nbsp;")
        else
            s = splashartistname
        end
    end
    return s
end
 
function p.getArtistlist(frame)
    local championtable = {}
    local artists = {}
    local hash = {}
    local artistList = mw.html.create('ul')
 
    artistList:newline()
 
    for x in pairs(skinData) do
        table.insert(championtable, x)
    end
    table.sort(championtable)
 
    for _, championname in pairs(championtable) do
        local skintable  = {}
        for championname in pairs(skinData[championname]["skins"]) do
            table.insert(skintable, championname)
        end
        table.sort(skintable)
 
        for _, skinname in pairs(skintable) do
            local t = skinData[championname]["skins"][skinname]
 
            if t.splashartist ~= nil then
                if type(t.splashartist) == "table" then
                    for _, value in pairs(t.splashartist) do
                        if (not hash[value]) then
                            table.insert(artists, value)
                            hash[value] = true
                        end
                    end
                else
                    if (not hash[t.splashartist]) then
                        table.insert(artists, t.splashartist)
                        hash[t.splashartist] = true
                    end
                end
            end
        end
    end
    table.sort(artists)
 
    for _, artist in pairs(artists) do
        artistList
            :tag('li')
                :wikitext('[[' .. artist .. ']]')
                :done()
            :done()
            :newline()
    end
 
    return artistList
end
 
function p.getVariant(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    local searchid = skinData[args[1]].skins[args[2] or "Original"].variant
    local skintable = {}
 
    if searchid == nil then
        return nil
    end
 
    for skinname, data in pairs(skinData[args[1]]["skins"]) do
        if data.id == searchid then
            return skinname
        end
    end
 
    return nil
end
 
function p.getVoiceactor(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    local t = skinData[args[1]].skins[args[2] or "Original"].voiceactor
    local s = ""
 
    if t == nil then
        return "Actor de voz desconocido"
    end
 
    for i, voiceactorname in ipairs(t) do
        if i ~= 1 then
            s = s .. ", " .. voiceactorname:gsub("% ", "&nbsp;")
        else
            s = voiceactorname
        end
    end
 
    return s
end
 
function p.skinlist(frame)
    local lang = mw.language.new( "es" )
    local sdtable = mw.html.create('table')
 
    sdtable
        :addClass('sortable article-table nopadding sticky-header')
        :css('width','100%')
        :css('text-align','center')
        :newline()
        :tag('tr')
            :tag('th')
                :css('width','26px')
            :done()
            :newline()
            :tag('th')
                :wikitext('Aspecto')
            :done()
            :newline()
            :tag('th')
                :tag('span')
                    :attr('title','Disponibilidad')
                    :wikitext('[[File:Availability.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :tag('span')
                    :attr('title','Lanzamiento')
                    :wikitext('[[File:Release.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :tag('span')
                    :attr('title','Costo')
                    :wikitext('[[File:RP icon.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Filtro de voz')
                    :wikitext('[[File:Voice filter.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Frases adicionales o únicas')
                    :wikitext('[[File:Additional quotes.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Nuevo doblaje')
                    :wikitext('[[File:New voice.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Nuevos efectos visuales o de sonido')
                    :wikitext('[[File:New effects.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Nuevas animaciones o nueva animación de retirada')
                    :wikitext('[[File:New animations.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','La apariencia se puede alternar en la partida [p. ej. Ctrl + 5] o el aspecto "evoluciona" en el transcurso de la partida, pero no forma parte de las mecánicas básicas del campeón.')
                    :wikitext('[[File:Transforming.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Parte de una colección')
                    :wikitext('[[File:Set piece.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('span')
                    :attr('title','Cuenta con historia')
                    :wikitext('[[File:Mission icon.png|40px|link=|]]')
                :done()
            :done()
            :newline()
            :tag('th')
                :css('width','40px')
                :tag('div')
                    :attr('title','Chromas')
                    :css('width','30px')
                    :css('height','30px')
                    :css('padding','5px')
                    :wikitext('[[File:Chromaskins.png|30px|link=|]]')
                :done()
            :done()
        :done()
        :newline()
 
 
        -- START
        local championtable = {}
        for x in pairs(skinData) do
            table.insert(championtable, x)
        end
        table.sort(championtable)
 
        local availablenode = mw.html.create('span')
        availablenode
            :css('color', 'green')
            :css('font-size', 'x-large')
            :css('vertical-align', 'text-top')
            :wikitext("✔")
 
        local legacynode = mw.html.create('span')
        legacynode
            :css('color', 'yellow')
            :css('font-size', 'x-large')
            :css('font-weight', '600')
            :css('vertical-align', 'text-top')
            :wikitext("‒")
 
        local limitednode = mw.html.create('span')
        limitednode
            :css('color', 'red')
            :css('font-size', 'x-large')
            :css('vertical-align', 'text-top')
            :wikitext("✘")
        local rarenode = mw.html.create('span')
        rarenode
            :css('color', 'orange')
            :css('font-size', 'x-large')
            :css('vertical-align', 'text-top')
            :wikitext("⭐")
 
 
        for _, championname in pairs(championtable) do
            local skintable  = {}
            for championname in pairs(skinData[championname]["skins"]) do
                table.insert(skintable, championname)
            end
            table.sort(skintable)
 
            for _, skinname in pairs(skintable) do
                if (
                    championname == "Akali"      and skinname == "Crimson" 
                    or 
                    championname == "Amumu"      and skinname == "SewnChaos"
                    or
                    championname == "Blitzcrank" and skinname == "SewnChaos"
                    or
                    championname == "Ryze"       and skinname == "Human"
                ) then
                    -- skip
                else
                    local t = skinData[championname]["skins"][skinname]
                    local sdnode = mw.html.create('tr')
                    local temp = ""
 
                    -- Skincircle
                    if (skinname == "Original") then
                        temp = "!" .. t["release"]
                    else 
                        temp = t["release"]
                    end
 
                    sdnode
                        :tag('td')
                            :addClass('champion-icon')
                            :attr('data-sort-value', championname .. temp)
                            :attr('data-champion', championname)
                            :attr('data-skin', skinname)
                            :wikitext('[[File:' .. FN.championcircle({championname, skinname}) .. '|20px|link=' .. championname .. ']]')
                        :done()
 
                    -- Skinname
                    sdnode
                        :tag('td')
                            :addClass('skin-icon')
                            :attr('data-champion', championname)
                            :attr('data-skin', skinname)
                            :css('text-align', 'left')
                            :wikitext(lib.ternary(t["formatname"] ~= nil, t["formatname"], skinname .. " " .. championname))
                        :done()
 
                    -- Availability
                    astring = '<span style="color: cornflowerblue;font-size: large;font-weight: 600;">⭘</span>'
                    if (t["availability"] == "Disponible") then
                        astring = tostring(availablenode)
                    end
                    if (t["availability"] == "Legado") then
                        astring = tostring(legacynode)
                    end
                    if (t["availability"] == "Limitado") then
                        astring = tostring(limitednode)
                    end
                    if (t["availability"] == "Raro") then
                        astring = tostring(rarenode)
                    end
                    sdnode
                        :tag('td')
                            :tag('span')
                                :attr('title', t["availability"] or 'Próximo')
                                :wikitext(astring)
                        :done()
 
                    -- Release
                    local y, m, d = t["release"]:match("(%d+)-(%d+)-(%d+)")
                    if y == nil or m == nil or d == nil then
                        sdnode
                            :tag('td')
                                :attr('data-sort-value', t["release"])
                                :wikitext(t["release"])
                            :done()
                    else
                        sdnode
                            :tag('td')
                                :attr('data-sort-value', t["release"])
                                :wikitext(lang:formatDate('d-M-Y', t["release"]))
                            :done()
                    end
 
                    -- Cost
                    local image = ""
                    if (tostring(t["cost"]) == "150000") then
                        image = "[[File:BE icon.png|20px|link=]]"
                    end 
                    if (tostring(t["cost"]) == "10") then
                        image = "[[File:Rare_Gem.png|20px|link=]]"
                    end
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(tostring(t["cost"]) == "10", "2450", t["cost"]))
                            :tag('span')
                                :css('color', color.skin({t["cost"] .. ""}))
                                :wikitext(image .. t["cost"])
                            :done()
                        :done()
 
                    -- Filter
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["filter"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["filter"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Newquotes
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["newquotes"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["newquotes"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Newvoice
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["newvoice"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["newvoice"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Neweffects
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["neweffects"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["neweffects"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Newanimations
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["newanimations"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["newanimations"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Transforming
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["transforming"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["transforming"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Set
                    if (type(t["set"]) ~= "nil") then
                        if (type(t["set"]) == "table") then
                            local multisets = ""
                            for i, current in pairs(t["set"]) do
                                if i ~= 1 then
                                    multisets = multisets  .. ", " .. current
                                else
                                    multisets = multisets .. current
                                end
                            end
                            sdnode
                                :tag('td')
                                    :attr('data-sort-value', 'Multiple')
                                    :tag('span')
                                        :attr('title', multisets)
                                        :wikitext(tostring(availablenode))
                                    :done()
                                :done()
                        else
                            sdnode
                                :tag('td')
                                    :attr('data-sort-value', t["set"])
                                    :tag('span')
                                        :attr('title', t["set"])
                                        :wikitext(tostring(availablenode))
                                    :done()
                                :done()
                        end
                    else
                        sdnode
                            :tag('td')
                                :attr('data-sort-value', 0)
                            :done()
                    end
 
                    -- Transforming
                    sdnode
                        :tag('td')
                            :attr('data-sort-value', lib.ternary(type(t["lore"]) ~= "nil", 1, 0))
                            :wikitext(lib.ternary(type(t["lore"]) ~= "nil", tostring(availablenode), ""))
                        :done()
 
                    -- Chromas
                    if (type(t["chromas"]) == "table") then
                        sdnode
                            :tag('td')
                                :addClass('chroma-icon')
                                :attr('data-sort-value', 1)
                                :attr('data-champion', championname)
                                :attr('data-skin', skinname)
                                :wikitext(tostring(availablenode))
                            :done()
                    else
                        sdnode
                            :tag('td')
                                :attr('data-sort-value', 0)
                            :done()
                    end
 
                    -- Add skin row to the table
                    sdtable
                        :newline()
                        :node(sdnode)
                end
            end
        end
        -- END
 
    sdtable:allDone()
    return tostring(sdtable)
end
 
function p.newestSkins(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local championtable = {}
    local releasetable = {}
 
    for x in pairs(skinData) do
        table.insert(championtable, x)
    end
    table.sort(championtable)
 
    for _, championname in pairs(championtable) do
        local skintable  = {}
 
        for championname in pairs(skinData[championname]["skins"]) do
            table.insert(skintable, championname)
        end
 
        for _, skinname in pairs(skintable) do
            table.insert(releasetable, {championname, skinname, skinData[championname]["skins"][skinname].release})
        end
    end
 
    function comp(a, b)
        if a[3] == "Próximo" or b[3] == "Próximo" then return false end
        if a[3] > b[3] then
            return true
        end
    end
 
    table.sort(releasetable, function(a, b) return a[2] > b[2] end)
    table.sort(releasetable, comp)
 
    local lang = mw.language.new("es")
    local count = tonumber(args[1]) or 7
    local s = ""
 
    for i in pairs(releasetable) do
        local champ      = releasetable[i][1]
        local skin       = releasetable[i][2]
        local formatname = releasetable[i][4]
        local cost       = p.getCost({champ, skin})
        local release    = releasetable[i][3]
 
        if release > lang:formatDate("Y-m-d") then
            -- skip if releasedate is in the future
        else
            if skin == "Original" then
                -- skip
            else 
                if count >= 1 then
                    count = count - 1
                    s = s .. "{{Skin portrait|" ..champ .. "|" .. skin
                    if     cost == 10  then s = s .. "|gems="
                    elseif cost == 100 then s = s .. "|prestige="
                    else                    s = s .. "|rp="
                    end
                    s = s .. cost .. "|date=" .. lang:formatDate("d-M-Y", release) .. "}}\n"
                end
            end
        end
    end
 
    return frame:preprocess(s)
end
 
function p.skinCatalog(frame)
    local dlib          = require("Dev:Datecalc")
    local lang          = mw.language.new( "es" )
    local championtable = {}
    local sdtable       = mw.html.create('table')
 
    sdtable
        :addClass('sortable article-table novpadding hcpadding sticky-header')
        :css('width','100%')
        :css('text-align','center')
        :css('font-size','12px')
        :newline()
        :tag('tr')
            :tag('th')
                :css('font-size','12px')
                :css('width','140x')
                :wikitext('Campeón')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "number")
                :wikitext('<div title="Disponible en la tienda o mediante Artesanía Hextech.">Disponibles</div>')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "number")
                :wikitext('<div title="Disponible a través de Artesanía Hextech o ventas limitadas..">Baúl de legado</div>')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "number")
                :wikitext('<div title="Solo periódicamente disponible o adquirido a través de medios especiales.">Raros</div>')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "number")
                :wikitext('No disponibles')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "number")
                :wikitext('Total')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "isoDate")
                :wikitext('Último aspecto')
            :done()
            :newline()
            :tag('th')
                :css('font-size','12px')
                :attr('data-sort-type', "number")
                :wikitext('Días')
            :done()
            :newline()
        :done()
        :newline()
 
    for x in pairs(skinData) do
        table.insert(championtable, x)
    end
    table.sort(championtable)
 
    for _, championname in pairs(championtable) do
        local t              = skinData[championname]["skins"]
        local availablecount = 0
	    local availablecircles = ""
        local legacycount    = 0
	    local legacycircles = ""
        local limitedcount   = 0
	    local rarecircles = ""
        local rarecount   = 0
	    local limitedcircles = ""
        local result         = {"","",""}
        local sdnode         = mw.html.create('tr')
        local border         = ""
        local skintable      = {}
 
        for skinname in pairs(t) do
            if (                                 skinname == "Original"
                or
                championname == "Akali"      and skinname == "Crimson" 
                or 
                championname == "Amumu"      and skinname == "Sewn Chaos"
                or
                championname == "Blitzcrank" and skinname == "Sewn Chaos"
                or
                championname == "Ryze"       and skinname == "Human"
            ) then
                -- skip
            else
                table.insert(skintable, skinname)
            end
        end
        table.sort(skintable, function(a, b) return t[a].release<t[b].release end)
 
        for i, skinname in pairs(skintable) do
            if i == #skintable then
                border = "border-radius:13px; width:26px; height:26px; box-shadow: 0 0 2px 2px #70fff2, 0 0 4px #111;"
            end
 
            if t[skinname].availability == "Disponible" then
                availablecount = availablecount + 1
                availablecircles = availablecircles .. '<li class="skin-icon" data-champion="' .. championname ..'" data-skin="' .. skinname .. '" style="'.. border ..'">[[File:' .. FN.championcircle({championname, skinname}) .. '|26px|link=]]'
            end
            if t[skinname].availability == "Legado" then
                legacycount    = legacycount    + 1
                legacycircles = legacycircles .. '<li class="skin-icon" data-champion="' .. championname ..'" data-skin="' .. skinname .. '" style="'.. border ..'">[[File:' .. FN.championcircle({championname, skinname}) .. '|26px|link=]]'
            end
            if t[skinname].availability == "Limitado" then
                rarecount    = rarecount    + 1
                rarecircles = rarecircles .. '<li class="skin-icon" data-champion="' .. championname ..'" data-skin="' .. skinname .. '" style="'.. border ..'">[[File:' .. FN.championcircle({championname, skinname}) .. '|26px|link=]]'
            end
            if t[skinname].availability == "Raro" then
                limitedcount   = limitedcount   + 1
                limitedcircles = limitedcircles .. '<li class="skin-icon" data-champion="' .. championname ..'" data-skin="' .. skinname .. '" style="'.. border ..'">[[File:' .. FN.championcircle({championname, skinname}) .. '|26px|link=]]'
            end
 
            if t[skinname].release ~= "N/A" then
                if t[skinname].release > result[2] then
                    result[1] = skinname
                    result[2] = t[skinname].release
                    result[3] = t[skinname].formatname
                end
            end
        end
 
        sdnode
            :tag('td')
                :addClass('skin-icon')
                :attr('data-sort-value', championname)
                :attr('data-champion', championname)
                :attr('data-skin', "Original")
                :css('text-align', 'left')
                :wikitext('[[File:' .. FN.championcircle({championname, "Original"}) .. '|26px|link=' .. championname .. ']] ' .. championname)
            :done()
 
        -- Aspectos disponibles
        sdnode
            :tag('td')
                :addClass('icon_list')
                :attr('data-sort-value', availablecount)
                :css('text-align', 'left')
                :css('background-color', '#0a1827')
                :wikitext(availablecircles)
            :done()
 
        -- Aspectos de legado
        sdnode
            :tag('td')
                :addClass('icon_list')
                :attr('data-sort-value', legacycount)
                :css('text-align', 'left')
                :wikitext(legacycircles)
            :done()
 
        -- Raro skins
        sdnode
            :tag('td')
                :addClass('icon_list')
                :attr('data-sort-value', rarecount)
                :css('text-align', 'left')
                :css('background-color', '#0a1827')
                :wikitext(rarecircles)
            :done()
 
        -- Aspectos limitados
        sdnode
            :tag('td')
                :addClass('icon_list')
                :attr('data-sort-value', limitedcount)
                :css('text-align', 'left')
                :wikitext(limitedcircles)
            :done()   
 
        -- Total
 
        sdnode
            :tag('td')
                :wikitext(availablecount + legacycount + rarecount + limitedcount)
            :done()
 
        -- Last Skin
        local y, m, d = result[2]:match("(%d+)-(%d+)-(%d+)")
        if y == nil or m == nil or d == nil then
            sdnode
                :tag('td')
                    :addClass('skin-icon')
                    :css('white-space', 'nowrap')
                    :attr('data-sort-value', result[2])
                    :attr('data-champion', championname)
                    :attr('data-skin', result[1])
                    :wikitext(result[2])
                :done()
                :tag('td')
                    :wikitext(result[2])
                :done()
        else
            sdnode
                :tag('td')
                    :addClass('skin-icon')
                    :css('white-space', 'nowrap')
                    :attr('data-sort-value', result[2])
                    :attr('data-champion', championname)
                    :attr('data-skin', result[1])
                    :wikitext(lang:formatDate('d-M-Y', result[2]))
                :done()
                :tag('td')
                    :wikitext(dlib.main{"diff", lang:formatDate('Y-m-d'), result[2]})
                :done()
        end
 
        -- Add skin row to the table
        sdtable
            :newline()
            :node(sdnode)
    end
 
    return sdtable
end
 
return p
 
-- </pre>
-- [[Category:Lua]]
El contenido de la comunidad está disponible bajo CC-BY-SA a menos que se indique lo contrario.