League of Legends Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!
You can even turn off ads in your preferences.

Come join the LoL Wiki community Discord server!

READ MORE

League of Legends Wiki
No edit summary
No edit summary
Line 113: Line 113:
 
:wikitext("[[File:" .. _icon .. "|46px|link=]]")
 
:wikitext("[[File:" .. _icon .. "|46px|link=]]")
 
:done()
 
:done()
 
if _type == "Quality" or "Rework" or "Relaunch" or "Original" or "Adopted" or "Imported" or "Unspecified" then
 
_type = fulltype[_type]
 
else
 
_type = "Unhandled type"
 
end
 
 
if _status == "Concept" or "Draft" or "Published" or "Outdated" or "Retired" or "Unspecified" then
 
_status = statusflag[_status]
 
else
 
_status = "Unhandled status"
 
end
 
 
s = s .. "<infobox>"
 
--s = s .. "<header><div style='width:100%; text-align:center;'>".. _type .. " " .. _status .. "</div></header>"
 
s = s .. "<title><default>" .. champion .. "</default></title>"
 
s = s .. "<data><default>[[File:" .. _image .. "|250px]]</default></data>"
 
s = s .. "<data><default>" .. _title .. "</default></data>"
 
s = s .. "<data><label>Range</label><default>{{tip|" .. _range .. "}}</default></data>"
 
s = s .. "<data><label>Classes</label><default>" .. _class .. "</default></data>"
 
s = s .. "<data><label>Contributors</label><default>" .. _cont .. "</default></data>"
 
s = s .. "</infobox>"
 
 
 
 
if t == "" then
 
if t == "" then
Line 141: Line 119:
 
:newline()
 
:newline()
 
else
 
else
 
s = s .. "<infobox>"
 
s = s .. "<header><div style='width:100%; text-align:center;'>".. (fulltype[_type] or "Unhandled type") .. " " .. (statusflag[_status] or "Unhandled status") .. "</div></header>"
 
s = s .. "<title><default>" .. champion .. "</default></title>"
 
s = s .. "<data><default>[[File:" .. _image .. "|250px]]</default></data>"
 
s = s .. "<data><default>" .. _title .. "</default></data>"
 
s = s .. "<data><label>Range</label><default>{{tip|" .. _range .. "}}</default></data>"
 
s = s .. "<data><label>Classes</label><default>" .. _class .. "</default></data>"
 
s = s .. "<data><label>Contributors</label><default>" .. _cont .. "</default></data>"
 
s = s .. "</infobox>"
 
 
grid
 
grid
 
:node(gridnode)
 
:node(gridnode)

Revision as of 03:38, 28 December 2019

-- <pre>
local p         = {}
local lib       = require('Module:Feature')
local json      = require('Module:JSON')
local userError = require('Dev:User error')
local FN        = require('Module:Filename')

local superclass   = {
    ["Enforcer"]    = "Fighter",
    ["Juggernaut"]  = "Fighter",
    ["Skirmisher"]  = "Fighter",
    
    ["Artillery"]   = "Slayer",
    ["Mage"]        = "Slayer",
    ["Ranger"]      = "Slayer",
    ["Rogue"]       = "Slayer",
    
    ["Disruptor"]   = "Support",
    ["Enchanter"]   = "Support",
    ["Warden"]      = "Support",
    
    ["Specialist"]  = "Specialist",
    ["Unspecified"] = "Unspecified",
}

local fulltype   = {
    ["Quality"]     = "Quality of life",
    ["Rework"]      = "Champion rework",
    ["Relaunch"]    = "Champion relaunch",
    ["Original"]    = "Original character",
    ["Imported"]    = "Imported character",
    ["Adopted"]     = "Adopted character",
    ["Unspecified"] = "Unspecified",
}

local statusflag   = {
    ["Concept"]     = "<span style='font-size: 75%; padding: 4px; border-radius: 4px; margin-left:1em; line-height: 18px;'>EARLY CONEPT</span>",
    ["Draft"]      = "<span style='font-size: 75%; padding: 4px; border-radius: 4px; margin-left:1em; line-height: 18px;'>WORK IN PROGRESS</span>",
    ["Published"]    = "<span style='font-size: 75%; background-color: darkgreen; padding: 4px; border-radius: 4px; margin-left:1em; line-height: 18px;'>COMPLETED</span>",
    ["Outdated"]    = "<span style='font-size: 75%; background-color: darkorange; padding: 4px; border-radius: 4px; margin-left:1em; line-height: 18px;'>OUTDATED</span>",
    ["Retired"]     = "<span style='font-size: 75%; background-color: darkred; padding: 4px; border-radius: 4px; margin-left:1em; line-height: 18px;'>RETIRED</span>",
    ["Unspecified"] = "Unspecified",
}

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 ('Module:Sandbox/Emptylord/Patch/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.getRoster(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    local champData     = require('Module:Sandbox/Emptylord/Patch/data')
    local champTable    = {}
    local filter        = args['2'] or "None"
    local s             = ""
    
    for champname in pairs(champData) do
        table.insert(champTable, champname)
    end
    table.sort(champTable)
    
    local grid = mw.html.create('div')
    
    grid
        :attr('id', 'emptylord-grid')
        :addClass('centered-grid')
        :css('clear', 'both')
    
    for _, champion in pairs(champTable) do
        if filter == "None" or champData[champion]["type"] == filter then
            local gridnode = mw.html.create('div')
            local _title = champData[champion]["title"] or ""
            local _icon = champData[champion]["icon"] or "ChampionSquare.png"
            local _image = champData[champion]["image"] or "ChampionBanner.png"
            local _range = champData[champion]["range"] or "Unspecified"
            local _classlist = champData[champion]["class"] or "Unspecified"
            local _class = ""
            local _type = champData[champion]["projtype"] or "Unspecified"
            local _status = champData[champion]["projstatus"] or "Unspecified"
            local _cont = champData[champion]["contributors"] or ""
            local opacity = 1
            local s = ""
            
            for i in string.gmatch(_classlist, ",") do
                _class = _class .. "{{tip|Emptylord" .. i .. "|" .. i .. "}} "
            end
            
            if t == "" then opacity = 0.15 end
            
            gridnode
                :addClass('grid-icon emptylord-icon roster-icon')
                :attr('data-range', _range)
                :attr('data-class', _class)
                :attr('data-status', _status)
                :attr('data-type', _type)
                :attr('data-search', _title)
                :css('opacity', opacity)
                :wikitext("[[File:" .. _icon .. "|46px|link=]]")
                :done()
            
            if t == "" then 
                grid
                    :node(gridnode)
                    :newline()
            else
                s = s .. "<infobox>"
                    s = s .. "<header><div style='width:100%; text-align:center;'>".. (fulltype[_type] or "Unhandled type") .. " " .. (statusflag[_status] or "Unhandled status") .. "</div></header>"
                	s = s .. "<title><default>" .. champion .. "</default></title>"
                	s = s .. "<data><default>[[File:" .. _image .. "|250px]]</default></data>"
                	s = s .. "<data><default>" .. _title .. "</default></data>"
                	s = s .. "<data><label>Range</label><default>{{tip|" .. _range .. "}}</default></data>"
                	s = s .. "<data><label>Classes</label><default>" .. _class .. "</default></data>"
                	s = s .. "<data><label>Contributors</label><default>" .. _cont .. "</default></data>"
                s = s .. "</infobox>"
                
                grid
                    :node(gridnode)
                    :newline()
                    :wikitext(frame:preprocess("<div class='roster-info'>" .. s .. "</div>"))
            end
        else
            --skip champion
        end
    end
    
    return grid
end

return p
-- </pre>
-- [[Category:Lua]]