FANDOM


-- <pre>
local p         = {}
local lib       = require('Módulo:Feature')
local userError = require('Dev:User error')
 
function p.get(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local get       = require ('Módulo:TFTUnitData/getter')
    local champname = args['champname']     or args[1]
    local set       = tonumber(args['set']) or tonumber(args[2])
    local datatype  = args['datatype']      or args[3]
 
    local result = get[datatype](champname, set)
 
    if (datatype == "active" or dataype == "passive ") and result ~= nil then
        return frame:preprocess(result)
    elseif result == nil then
        return ""
    else
        return result
    end
end
 
function p.getSets(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local get       = require ('Módulo:TFTUnitData/getter')
    local champname = args['champname'] or args[1]
 
    return get["sets"](champname)
end
 
function p.getFirstSet(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local datatable = require('Módulo:TFTUnitData/data')
    local champname = args['champname'] or args[1]
 
    for setnumber in pairs(datatable[champname]) do
        firstSet = setnumber
        break;
    end
 
    return firstSet
end
 
function p.getLastSet(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local datatable = require('Módulo:TFTUnitData/data')
    local champname = args['champname'] or args[1]
 
    for setnumber in pairs(datatable[champname]) do
        lastSet = setnumber
    end
 
    return lastSet
end
 
function p.getTooltipSets(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local datatable = require('Módulo:TFTUnitData/data')
    local champname = args['champname'] or args[1]
    local s         = ""
 
    for setnumber in pairs(datatable[champname]) do
        s = s .. "TFT" .. setnumber .. ","
    end
 
    return s
end
 
function p.checkRoster(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local datatable  = require('Módulo:TFTUnitData/data')
    local search     = args['champname'] or args[1]
 
    for champname in pairs(datatable) do
        if champname == search then
            return true
        end
    end
 
    return false
end
 
function p.getRoster(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local datatable  = require('Módulo:TFTUnitData/data')
    local set        = tonumber(args['set']) or tonumber(args[1]) 
    local champtable = {}
    local roster     = ""
 
    for champname in pairs(datatable) do
        table.insert(champtable, champname)
    end
    table.sort(champtable)
 
    for _, champname in pairs(champtable) do
        for dataset in pairs(datatable[champname]) do
            if dataset == set then
                roster = roster .. "{{TFT champion|" .. champname .. "|" .. set .. "|size=46px|icononly=true}}"
            end
        end
    end
 
    return frame:preprocess(roster)
end
 
function p.getGroup(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local datatable  = require('Módulo:TFTUnitData/data')
    local synergy    = args['synergy']       or args[1]
    local set        = tonumber(args['set']) or tonumber(args[2])
    local champtable = {}
    local roster     = ""
 
    for champname in pairs(datatable) do
        table.insert(champtable, champname)
    end
    table.sort(champtable)
 
    for _, champname in pairs(champtable) do
        for dataset, v in pairs(datatable[champname]) do
            if dataset == set then
                for _, classname in pairs(v.class) do
                    if classname == synergy then
                        roster = roster .. "{{TFT champion|" .. champname .. "|" .. set .. "|size=46px|icononly=true}}"
                    end
                end
                for _, originname in pairs(v.origin) do
                    if originname == synergy then
                        roster = roster .. "{{TFT champion|" .. champname .. "|" .. set .. "|size=46px|icononly=true}}"
                    end
                end
            end
        end
    end
 
    return frame:preprocess(roster)
end
 
return p
-- </pre>
-- [[Category:Lua]]
El contenido de la comunidad está disponible bajo CC-BY-SA a menos que se indique lo contrario.