본문으로 이동

모듈:TFTUnitData

게임세상 위키

이 모듈에 대한 설명문서는 모듈:TFTUnitData/설명문서에서 만들 수 있습니다

-- <pre>
local p         	= {}
local lib       	= require('Module:Feature')
local userError 	= require('Module:Dev:User error')
local get   		= require('Module:TFTUnitData/getter')
local getIcon		= require('Module:TFTTraitData/getter')
local getChamp		= require('Module:ChampionData/getter')
local getChampWR	= require('Module:ChampionDataWR/getter')
local getSkin		= require('Module:SkinData/getter')
local getSkinWR		= require('Module:SkinDataWR')

function p.getIcon(frame)
    local args = lib.frameArguments(frame)
    
    args['traitname'] = args['traitname']	or args[1]
    args['set']       = tonumber(args['set']) or tonumber(args[2])
    args['datatype']  = args['datatype']	or args[3]
    
    local result = getIcon[args['datatype']](args['traitname'], args['set'])
    
    if (args['datatype'] == "innate" or args['datatype'] == "synergy") and result ~= nil then
        if args['datatype'] == "synergy" then
            result = result .. synergy(args['traitname'], args['set'])
        end
        
        return frame:preprocess(result)
    elseif result == nil then
        return ""
    else
        return result
    end
end

-- wrapper template Template:Current_champion_data / Template:Ccd
function p.getChamp(frame)
    local args = lib.frameArguments(frame)
    
    local getChamp    = require ('Module:ChampionData/getter')
    args['champname'] = args['champname'] or args[1]
    args['datatype']  = args['datatype']  or args[2]
    args['output']    = args['output']    or args[3] or nil
    
    args['champname'] = lib.validateName(args['champname']) --corrects for acceptable misspellings (e.g. Nunu -> Nunu & Willump)
    
    local resultGet = getChamp[args['datatype']]
    local result
    if resultGet then
    	result = resultGet(args['champname'])
    end

    if args['output'] ~= nil and type(result) == "table" then
        if args['output'] == "csv" then
            return lib.tbl_concat{result}
        elseif args['output'] == "custom" then 
            return frame:preprocess(lib.tbl_concat{result, prepend = args['prepend'], append = args['append'], separator = args['separator'], index = args["index"]})
        elseif args['output'] == "template" then 
            return frame:preprocess(lib.tbl_concat{result, prepend = "{{" .. args['t_name'] .. "|", append = "}}", separator = args['separator']})
        elseif args['output'] == "category" then 
            return frame:preprocess(lib.tbl_concat{result, prepend = "[[Category:" .. (args['prepend'] or ""), append = (args['append'] or "") .. "]]", separator = args['separator'] or " "})
        end
    elseif result == nil then
        return ""
    else
        return result
    end
end

-- wrapper template Template:TFT champion data / Template:TFTcd
function p.get(frame)
    local args = lib.frameArguments(frame)
    
    args['champname'] = args['champname']     or args[1]
    args['set']       = tonumber(args['set']) or tonumber(args[2])
    args['datatype']  = args['datatype']      or args[3]
    
    args['champname'] = lib.validateName(args['champname'])
    
    local result = get[args['datatype']](args['champname'], args['set'])
    
    if (args['datatype'] == "active" or args['datatype'] == "passive") and result ~= nil then
        return frame:preprocess(result)
    elseif result == nil then
        return ""
    else
        return result
    end
end

function p.getFirstSet(frame)
    local args = lib.frameArguments(frame)
    
    args['champname'] = args['champname'] or args[1]
    args['champname'] = lib.validateName(args['champname'])
    
    local get    = require ('Module:TFTUnitData/getter')
    return get['firstset'](args['champname'], nil)
end

function p.getLastSet(frame)
    local args = lib.frameArguments(frame)
    
    args['champname'] = args['champname'] or args[1]
    args['champname'] = lib.validateName(args['champname'])
    
    local get    = require ('Module:TFTUnitData/getter')
    return get['lastset'](args['champname'], nil)
end

function p.getTooltipSets(frame)
    local args = lib.frameArguments(frame)
    
    args['champname'] = args['champname'] or args[1]
    args['champname'] = lib.validateName(args['champname'])
    
    local datatable = require('Module:TFTUnitData/data')
    local s         = ""
    
    for setnumber in pairs(datatable[args['champname']]) do
        if s ~= "" then s = s .. "," end
        s = s .. "TFT" .. setnumber
    end
    
    return s
end

-- wrapper template Template:TFT_total_champions
function p.getChampionCount(frame)
	local args = lib.frameArguments(frame)
		
    local data		= require('Module:TFTUnitData/data')
	args['set']	    = tonumber(args['set']) or tonumber(args[1])
    local i = 0
    for k, v in pairs(data) do
    	if args['set'] == nil or v[args['set']] then
    		i = i + 1
        end
    end
    return i
end

function p.checkRoster(frame)
    local args = lib.frameArguments(frame)
    
    args['champname'] = args['champname'] or args[1]
    args['champname'] = lib.validateName(args['champname'])
    
    local datatable  = require('Module:TFTUnitData/data')
    
    for champname in pairs(datatable) do
        if champname == args['champname'] then
            return true
        end
    end
    
    return false
end

-- wrapper template Template:Teamfight_Tactics/Champions
function p.getRoster(frame)
    local args = lib.frameArguments(frame)
    
    local IL         = require('Module:ImageLink')
    local datatable  = require('Module:TFTUnitData/data')
    local cmd        = require('Module:Maintenance data')
    local champtable = {}
    local roster     = ""
    
    args['set']      = tonumber(args['set']) or tonumber(args[1]) or tonumber(cmd.main{'TFTSet'})
    
    for champname in pairs(datatable) do
        if datatable[champname][args['set']] then
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)
    
    for _, champname in pairs(champtable) do
        roster = roster .. tostring(IL.TFTchampion{
            ["champion"] = champname,
            ["set"]      = args['set'],
            ["size"]     = tonumber(args['size']) or tonumber(args[2]) or 46,
            ["text"]     = "*none*",
            ["link"]	 = champname .. '/TFT#Set ' .. tostring(args['set']),
            ["display"]  = "inline-block"
        })
    end
    
    return roster
end

-- generates list with all champions and the sets these champions appear in
function p.Listofchampionsandsets(frame)
    local args = lib.frameArguments(frame)
    
    local builder    = require("Module:SimpleHTMLBuilder")
    local datatable  = require('Module:TFTUnitData/data')
    local cmd        = mw.loadData('Module:Maintenance data/data')
	local sets       = cmd['AllTFTSets']

	local champsets = {}
	for champion,_ in pairs(datatable) do
		temp_set = {}
		counter = 0
		for _,set in pairs(sets) do
			if datatable[champion][tonumber(set)] then
				temp_set[#temp_set+1] = '<span style="color:green;  font-size:x-large; vertical-align:text-top">✔</span>'
				counter = counter + 1
			else
				temp_set[#temp_set+1] = '<span style="color:red;    font-size:x-large; vertical-align:text-top;>✘</span>'
			end
		end
		champsets[#champsets+1] = {}
		champsets[#champsets][1] = champion
		champsets[#champsets][2] = temp_set
		champsets[#champsets][3] = counter
	end
	table.sort(champsets, function(a,b) return a[1] < b[1] end)


	rows = {"Champion"}
	for _,set in pairs(sets) do
		rows[#rows+1] = set
	end
	rows[#rows+1] = "Appearances"
	
	
	local tablenode  = builder.create('table')
    tablenode
	    :addClass('sortable article-table sticky-header')
	    :css('text-align', 'center')
	    :css('white-space', 'nowrap')
	    :newline()
	
	tablenode
	    :tag('tr')
		for _,row in pairs(rows) do
			tablenode
			:tag('th')
	       		:wikitext(row)
	   		:done()
		end
		tablenode
		:newline()

    for _,data in pairs(champsets) do
        local tablerow  = builder.create('tr')
        champion = data[1]
        thischampionsets = data[2]
        thischampioncounter = data[3]
        
        --Creates one row of stuff
        tablerow
            :tag('td')
            	:css('text-align', 'left')
                :wikitext("[["..champion.."/TFT|"..champion.."]]")
            :done()
            for k in ipairs(sets) do
            	local tablefield = builder.create('td')
            	tablefield
            		:css('text-align', 'left')
                	:wikitext(thischampionsets[k])
                tablerow
                	:node(tablefield)
	        end
        tablerow    
            :tag('td')
                :wikitext(thischampioncounter)
            :done()
        --done with one row

        -- Add row to table
        tablenode
            :node(tablerow)
            :newline()
    end

	tablenode:allDone()
	return tostring(tablenode)
end

-- TFT main page
function p.getRenderRoster(frame)
    local args = lib.frameArguments(frame)
    
    local IL         = require('Module:ImageLink')
    local datatable  = require('Module:TFTUnitData/data')
    local cmd        = require('Module:Maintenance data')
    local champtable = {}
    local roster     = ""
    local s          = ""
    
    args['set']      = tonumber(args['set']) or tonumber(args[1]) or tonumber(cmd.main{'TFTSet'})
    
    for champname in pairs(datatable) do
        if datatable[champname][args['set']] then
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)

    -- [[File:' .. (datatable[champname][args["set"]]["render"] or 'Champion Render.png') ..'|x100px|link=' .. champname .. '/TFT|'.. champname..'(Teamfight Tactics)]]
    for _, champname in pairs(champtable) do
        roster = roster .. '<div class="centered-grid-icon tft-icon" style="padding:0.5em; width:100px; display:flex; flex-direction: column;" data-param="'.. lib.validateName(champname) ..'" data-type="champion" data-set="'.. args["set"] ..'"> [[File:' .. (champname) .. ' ' .. (datatable[champname][args["set"]]["skin"]:gsub("%s+", "")) .. 'Square.png' .. '|x50px|link=' .. champname .. '/TFT#Set ' .. tostring(args["set"]) .. '|' .. champname..'(Teamfight Tactics)]] [['.. champname ..'/TFT#Set ' .. tostring(args["set"]) .. '|' .. champname ..']]</div>'
    end
    
    s = s .. "<div style='display: flex; flex-direction: column; margin: 0 auto; padding: 5px; text-align: center;'><div class='centered-grid>"
    s = s .. roster
    s = s .. "</div></div>"
    
    return s
end

function p.getGroup(frame)
    local args = lib.frameArguments(frame)
    
    local IL         = require('Module:ImageLink')
    local datatable  = require('Module:TFTUnitData/data')
    local champtable = {}
    local roster     = ""
    local count      = 0
    
    args['synergy'] = args['synergy']       or args[1]
    args['set']     = tonumber(args['set']) or tonumber(args[2])
    args['count']   = args['count']         or 'false'
    
    -- Fixing Tooltip/TFT/Trait issue due to the page always capturing the {{{1}}}} value as '<trait name> (Teamfight Tactics)'
    if args['synergy']:find(" %(Teamfight Tactics%)") then
    	args['synergy'] = args['synergy']:gsub(" %(Teamfight Tactics%)", "")
	end
    
    for champname in pairs(datatable) do
        table.insert(champtable, champname)
    end
    table.sort(champtable)
    
    for _, champname in pairs(champtable) do
    	rosterParams = {
            ["champion"] = champname,
            ["set"]      = args['set'],
            ["size"]     = 46,
            ["text"]     = "*none*",
            ["icononly"] = true,
            ["display"]  = args['display']
        }
        if champname == args['champion'] then
        	rosterParams['style'] = "white-space:pre;" -- Default style
        	rosterParams['style'] = rosterParams['style'] .. "border:1px solid cornsilk;"
        end
        for dataset, v in pairs(datatable[champname]) do
            if dataset == args['set'] then
            	if v.class == nil then
            		error("TFTUnitData/data champion `" .. champname .. "` index `"..dataset .. "` class is nil.")
                end
                for _, classname in pairs(v.class) do
                    if classname == args['synergy'] then
                        roster = roster .. tostring(IL.TFTchampion(rosterParams))
                    count = count + 1
                    end
                end
                for _, originname in pairs(v.origin) do
                    if originname == args['synergy'] then
                        roster = roster .. tostring(IL.TFTchampion(rosterParams))
                    count = count + 1
                    end
                end
            end
        end
    end
    
    if args['count'] == 'true' then
        return roster, count
    else
        return roster
    end
end

function p.championlist(frame)
    local args = lib.frameArguments(frame)
    local lang = mw.language.new( "en" )
    local IL   = require('Module:ImageLink')
    local builder = require("Module:SimpleHTMLBuilder")
    local list = builder.create('table')

    list
        :addClass('sortable article-table sticky-header')
        :css('width', '100%')
        :css('text-align', 'left')
        :newline()
        
        --TABLE HEADER    
        :tag('tr')
            :tag('th')
                :wikitext('Champion')
            :done()
            :tag('th')
                :wikitext('Tier')
            :done()
            :tag('th')
                :wikitext('Origin')
            :done()
            :tag('th')
                :wikitext('Class')
            :done()
            :tag('th')
                :addClass('unsortable')
                :wikitext('Ability')
            :done()
        :done()
        :newline()
        
        
        -- TABLE ENTRIES
        local datatable  = require('Module:TFTUnitData/data')
        local champtable = {}
        local tierimage  = {
            [1] = "",
            [2] = "&nbsp;[[File:Standard Skin.png|20px|link=]]",
            [3] = "&nbsp;[[File:Epic Skin.png|20px|link=]]",
            [4] = "&nbsp;[[File:Mythic Skin.png|20px|link=]]",
            [5] = "&nbsp;[[File:Ultimate Skin.png|20px|link=]]",
            [6] = "&nbsp;[[File:China Skin Tier 9.png|20px|link=]]",
            [7] = "&nbsp;[[File:China Skin Tier 9.png|20px|link=]]",
            [8] = "&nbsp;[[File:Mythic Skin.png|20px|link=]]",
            [9] = "&nbsp;[[File:China Skin Tier 9.png|20px|link=]]",
            [10] = "&nbsp;[[File:China Skin Tier 9.png|20px|link=]]"
        }
        
        args['set'] = tonumber(args['set']) or tonumber(args[1]) 
        
        for champname in pairs(datatable) do
            table.insert(champtable, champname)
        end
        table.sort(champtable)
        
        for _, champname in pairs(champtable) do
            if datatable[champname][args['set']] then
                local listentry = builder.create('tr')
                local tier      = datatable[champname][args['set']]['tier']
                local origin    = datatable[champname][args['set']]['origin']
                local class     = datatable[champname][args['set']]['class']
                local s         = ''
                
                -- Champion
                listentry
                    :tag('td')
                        :attr('data-sort-value', champname)
                        :wikitext(tostring(IL.TFTchampion{
                            ["champion"] = champname,
                            ["set"]      = args['set'],
                            ["link"]	 = champname .. '/TFT#Set ' .. tostring(args['set']),
                        }))
                    :done()
                
                -- Tier
                listentry
                    :tag('td')
                        :attr('data-sort-value', 'tier')
                        :wikitext(tier .. tierimage[tier])
                    :done()
                
                -- Origin
                if origin[1] then
	                s = tostring(IL.TFTtrait{
	                    ["trait"]  = origin[1],
	                    ["set"]    = args['set'],
	                    ['image']  = getIcon['icon'](get['origin1'](champname, tonumber(args['set'])), tonumber(args['set'])),
	                    ["border"] = 'false'
	                })
	                if origin[2] then
	                    s = s .. '<br />' .. tostring(IL.TFTtrait{
	                        ["trait"]  = origin[2],
	                        ["set"]    = args['set'],
	                        ['image']  = getIcon['icon'](get['origin2'](champname, tonumber(args['set'])), tonumber(args['set'])),
	                        ["border"] = 'false'
	                    })
	                end
	                listentry
	                    :tag('td')
	                        :attr('data-sort-value', lib.ternary(origin[2], '!Multi', origin[1]))
	                        :wikitext(s)
	                    :done()
	            else
	            	listentry
	            		:tag('td')
	            		:done()
	            end
	            
                -- Class
                if class[1] and class[1] ~= "" then
	                s = tostring(IL.TFTtrait{
	                    ["trait"]  = class[1],
	                    ["set"]    = args['set'],
	                    ['image']  = getIcon['icon'](get['class1'](champname, tonumber(args['set'])), tonumber(args['set'])),
	                    ["border"] = 'false',
	                })
	                if class[2] and class[2] ~= "" then
	                    s = s .. '<br />' .. tostring(IL.TFTtrait{
	                        ["trait"]  = class[2],
	                        ["set"]    = args['set'],
	                        ['image']	= getIcon['icon'](get['class2'](champname, tonumber(args['set'])), tonumber(args['set'])),
	                        ["border"] = 'false',
	                    })
	                end
	                listentry
	                    :tag('td')
	                        :attr('data-sort-value', lib.ternary(class[2], '!Multi', class[1]))
	                        :wikitext(s)
	                    :done()
                else
	            	listentry
	            		:tag('td')
	            		:done()
	            end
	            
                
                --Ability
                local p = lib.ternary(datatable[champname][args['set']]['passive'], datatable[champname][args['set']]['passive'], '')
                local a = lib.ternary(datatable[champname][args['set']]['active'], datatable[champname][args['set']]['active'], '')
                
                if (p ~= "") and (a ~= "") then 
                    s = '{{sbc|Passive:}}<br/>' .. p .. '<br/>{{sbc|Active:}}<br/>' .. a
                elseif p == "" then 
                    s = '{{sbc|Active:}}<br/>' .. a
                elseif a == "" then
                	s = '{{sbc|Passive:}}<br/>' .. p
                end    
                
                listentry
                    :tag('td')
                        :addClass('mw-collapsible mw-collapsed')
                        :attr('data-expandtext', 'Show')
                        :attr('data-collapsetext', 'Hide')
                        :tag('span')
                            :css('white-space', 'nowrap')
                            :wikitext('[[File:' .. datatable[champname][args['set']]['abilityicon'] .. '|border|20px|link=]] ' .. datatable[champname][args['set']]['abilityname'])
                        :done()
                        :tag('div')
                            :addClass('mw-collapsible-content')
                            :wikitext(s)
                        :done()
                    :done()
                
                list
                    :node(listentry)
                    :newline()
            end
        end
        -- TABLE END
    
    list:allDone()
    return frame:preprocess(tostring(list))
end

-- wrapper template Template:TFT champion summary
function p.championSummary(frame)
    local args = lib.mergeArguments(frame)
    
    local IL         = require('Module:ImageLink')
    local builder    = require("Module:SimpleHTMLBuilder")
    local datatable  = require('Module:TFTUnitData/data')
    local champtable = {}
    local result     = builder.create('ul')
    
    args['set']      = tonumber(args['set']) or tonumber(args[1])
    
    for champname in pairs(datatable) do
        if datatable[champname][args['set']] then
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)
    
    for _, champname in pairs(champtable) do
    	result
    		:tag('li')
    			:node(IL.TFTchampion{
		            ["champion"] = champname,
		            ["set"]      = args['set'],
		            ["size"]     = 46,
		            ["text"]     = champname,
		            ["link"]	 = champname .. '/TFT#Set ' .. tostring(args['set']),
		        })
    end
    
    return tostring(result)
end


function p.BaseStatTable(frame)
    local args = lib.frameArguments(frame)
    
    local datatable  = mw.loadData('Module:TFTUnitData/data')
    local builder    = require("Module:SimpleHTMLBuilder")
    local tablenode  = builder.create('table')
    local cmd        = mw.loadData('Module:Maintenance data/data')
    local justthisset = args['set']
    local sets       = cmd['AllTFTSets']
    local justthisstarlevel		 = tonumber(args['star'])
    

    tablenode
        :addClass('sortable wikitable sticky-header')
        :css('width', '100%')
        :css('text-align', 'right')
        :css('white-space', 'nowrap')
        :newline()
        :tag('tr')
            :tag('th')
                :wikitext('Champions')
            :done()
            :tag('th')
                :wikitext('Cost')
            :done()
            :tag('th')
                :wikitext('Set')
            :done()
            :tag('th')
                :wikitext('Star')
            :done()
            :tag('th')
                :wikitext('HP')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('DPS')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('AD')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('AS')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('AR')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('MR')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('SMP')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('MP')
                :css('width', '4em')
            :done()
            :tag('th')
                :wikitext('Range')
                :css('width', '4em')
            :done()
        :done()
        :newline()

    unittable = {}
    temp_sets = {}

	for _,set in pairs(sets) do
    	if justthisset then
    		if justthisset == set then
    			temp_sets = {set}
    		end
    	else
    		temp_sets[#temp_sets+1] = set
    	end
    end
    
	for champname in pairs(datatable) do
    	for _,set in pairs(temp_sets) do
    		set = tonumber(set)
    		if datatable[champname][set] then
    			stars = 1
    			if (((champname == "Aphelios") or (champname == "Diana") or (champname == "Lissandra") or (champname == "Sylas")) and set == 4) or (((champname == "Heimerdinger") or (champname == "Kled") or (champname == "Poppy") or (champname == "Teemo") or (champname == "Tristana")) and set == 9) or (champname == "Heimerdinger" and set == 9.5) or (champname == "Jhin" and set == 10) then
    				max_stars = 4
				else
					max_stars = 3
    			end
    			if justthisstarlevel ~= nil and justthisstarlevel >= 1 and (((set == 4 or set == 9 or set == 9.5 or set == 10) and justthisstarlevel <= 4) or (justthisstarlevel <= 3)) then
    				stars = justthisstarlevel
    				if max_stars > justthisstarlevel then
    					max_stars = justthisstarlevel
    				end
    			end
		    	while stars <= max_stars do
		    		if stars == 1 then
		    			starsmultiplier = 1
		    		elseif stars == 2 then
		    			starsmultiplier = 1.8
		    		elseif stars == 3 then
		    			starsmultiplier = 3.24
		    		elseif stars == 4 then
		    			starsmultiplier = 5.832
		    		end
			    	unittable[#unittable+1] = {}
			    	unittable[#unittable][1] = champname
			    	unittable[#unittable][2] = set
			    	unittable[#unittable][3] = stars
			    	unittable[#unittable][4] = {
			    		["cost"] = datatable[champname][set]["tier"],
			    		["hp"] = datatable[champname][set]["hp"]*starsmultiplier,
			    		["dps"] = datatable[champname][set]["ad"]*starsmultiplier*datatable[champname][set]["as"],
			    		["ad"] = datatable[champname][set]["ad"]*starsmultiplier,
			    		["as"] = datatable[champname][set]["as"],
			    		["arm"] = datatable[champname][set]["arm"],
			    		["mr"] = datatable[champname][set]["mr"],
			    		["smp"] = datatable[champname][set]["startmana"],
			    		["mp"] = datatable[champname][set]["mana"],
			    		["range"] = datatable[champname][set]["range"],
			    	}
			    	stars = stars + 1
			    end
		    end
    	end
    end
	
	local function sort_on_values(t,a,b,c)
	    table.sort(t, function (u,v)
	        return
	             u[a]<v[a] or
	            (u[a]==v[a] and u[b]<v[b]) or
	            (u[a]==v[a] and u[b]==v[b] and u[c]<v[c])
	    end)
	end
	sort_on_values(unittable, 2, 1, 3)
    
    for i,_ in ipairs(unittable) do
    	local champname = unittable[i][1]
    	local set       = unittable[i][2]
    	local stars     = unittable[i][3]
    	starstext = ""
    	for var=1,stars do
    		starstext = starstext.."⭐"
    	end
    	
    	local stats     = unittable[i][4]
        local tablerow  = builder.create('tr')
        
        tablerow
            :tag('td')
                :css('text-align', 'left')
                :attr('data-sort-value', champname)
                :wikitext("[["..champname.."/TFT#Set "..tostring(set).."|"..champname.."]]")
            :done()
            :tag('td')
            	:css('text-align', 'center')
            	:attr('data-sort-value', stats["cost"])
                :wikitext(stats["cost"].."💰")
            :done()
            :tag('td')
            	:css('text-align', 'center')
                :wikitext(set)
            :done()
            :tag('td')
            	:attr('data-sort-value', stars)
                :wikitext(starstext)
            :done()
            :tag('td')
                :wikitext(stats["hp"])
            :done()
            :tag('td')
                :wikitext(stats["dps"])
            :done()
            :tag('td')
                :wikitext(stats["ad"])
            :done()
            :tag('td')
                :wikitext(stats["as"])
            :done()
            :tag('td')
                :wikitext(stats["arm"])
            :done()
            :tag('td')
                :wikitext(stats["mr"])
            :done()
            :tag('td')
                :wikitext(stats["smp"])
            :done()
            :tag('td')
                :wikitext(stats["mp"])
            :done()
            :tag('td')
                :wikitext(stats["range"])
            :done()
        :done()

        -- Add row to table
        if tablerow ~= nil then
            tablenode
                :node(tablerow)
                :newline()
        end
    end
    
    tablenode:allDone()
    
    return tostring(tablenode)
end

function p.ListPhysicalDamageAbilitiesChampion(frame)
    local args							= lib.frameArguments(frame)
    args['set']							= tonumber(args['set']) or tonumber(args[1])
    local set							= args['set']
    if not set then
        return error("Error: Set number is not provided or invalid.")
    end
	local datatable 			= require('Module:TFTUnitData/data')
	local IL					= require('Module:ImageLink')
    local result				= ""
	
    local championsWithPhysicalDamage	= {}
    local champtable					= {}

    for champname in pairs(datatable) do
        if datatable[champname][set] then
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)

    for _, champname in pairs(champtable) do
        local abilityDescriptions = {
            datatable[champname][set]["active"],
            datatable[champname][set]["passive"]
        }
        for _, description in pairs(abilityDescriptions) do
            if description and (description:match("physical damage") or description:match("Physical damage") or description:match("Physical Damage")) then
				table.insert(championsWithPhysicalDamage, champname)
				break
            end
        end
    end

    if #championsWithPhysicalDamage == 0 then
        return "No champions with physical damage abilities found for Set " .. tostring(set) .. "."
    end
	
	result = result .. '<div class="columntemplate" style="-moz-column-count:2; -webkit-column-count:2; column-count:2;">'
    for _, champion in ipairs(championsWithPhysicalDamage) do
        result = result .. "<li>" .. tostring(IL.TFTchampion{
	            ["champion"] = champion,
	            ["set"]      = set,
	            ["size"]     = 20,
	            ["text"]     = champion,
	            ["link"]	 = champion .. '/TFT#Set ' .. tostring(set)
	        }) .. "</li>"
    end
	result = result .. '</div>'
    return result
end

-- Function to list champions that are "manaless" in LoL but use mana in TFT
function p.ListLoLManalessTFTMana(frame)
    local args						= lib.frameArguments(frame)
    args['set']						= tonumber(args['set']) or tonumber(args[1])
    local set						= args['set']
    if not set then
        return error("Error: Set number is not provided or invalid.")
    end
	local result = ""
	local datatable 				= require('Module:TFTUnitData/data')
	local IL						= require('Module:ImageLink')
    local championsWithManaInTFT	= {}
    local champtable = {}

    for champname in pairs(datatable) do
        if datatable[champname][set] then
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)

    for _, champname in pairs(champtable) do
        local lolResource = getChamp["resource"](champname)
        local tftMana = get["mana"](champname, set)
        local checkRoster = getChamp["id"](champname)
        
        if lolResource ~= "Mana" and tftMana and tftMana > 10 then
            if checkRoster ~= nil then
                table.insert(championsWithManaInTFT, champname)
            end
        end
    end

    if #championsWithManaInTFT == 0 then
        return "No champions that are <b>manaless</b> in <i>League of Legends</i> but use <b>mana</b> in <i>Teamfight Tactics</i> found for Set " .. tostring(set) .. "."
    end
	
	result = result .. '<div class="columntemplate" style="-moz-column-count:2; -webkit-column-count:2; column-count:2;"><ul>'
    for _, champion in ipairs(championsWithManaInTFT) do
        result = result .. "<li>" .. tostring(IL.TFTchampion{
	            ["champion"] = champion,
	            ["set"]      = set,
	            ["size"]     = 20,
	            ["text"]     = champion,
	            ["link"]	 = champion .. '/TFT#Set ' .. tostring(set)
	        }) .. "</li>"
    end
	result = result .. '</ul></div>'
    return result
end

-- Function to list champions that use mana in LoL but are "manaless" in TFT
function p.ListLoLManaTFTManaless(frame)
    local args = lib.frameArguments(frame)
    local set = tonumber(args['set']) or tonumber(args[1])
    if not set then
        return error("Error: Set number is not provided or invalid.")
    end
	local result = ""
	local datatable 				= require('Module:TFTUnitData/data')
	local IL						= require('Module:ImageLink')
    local championsManalessInTFT	= {}
    local champtable = {}

    for champname in pairs(datatable) do
        if datatable[champname][set] then
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)

    for _, champname in pairs(champtable) do
        local lolResource = getChamp["resource"](champname)
        local tftMana = get["mana"](champname, set)
        local checkRoster = getChamp["id"](champname)
        
        if lolResource == "Mana" and (tftMana and tftMana < 10) then
            if checkRoster ~= nil then
                table.insert(championsManalessInTFT, {champion = champname, mana = tonumber(tftMana)})
            end
        end
    end

    if #championsManalessInTFT == 0 then
        return "No champions that use <b>mana</b> in <i>League of Legends</i> but are <b>manaless</b> in <i>Teamfight Tactics</i> found for Set " .. tostring(set) .. "."
    end
	result = result .. '<div class="columntemplate" style="-moz-column-count:2; -webkit-column-count:2; column-count:2;"><ul>'
	    for _, entry in ipairs(championsManalessInTFT) do
	    	if entry.mana == 0 then
	        	result = result .. "<li>" .. tostring(IL.TFTchampion{
	            ["champion"] = entry.champion,
	            ["set"]      = set,
	            ["size"]     = 20,
	            ["text"]     = entry.champion,
	            ["link"]	 = entry.champion .. '/TFT#Set ' .. tostring(set)
	        }) .. "</li>"
	    	else
	    		result = result .. "<li>" .. tostring(IL.TFTchampion{
	            ["champion"] = entry.champion,
	            ["set"]      = set,
	            ["size"]     = 20,
	            ["text"]     = entry.champion,
	            ["link"]	 = entry.champion .. '/TFT#Set ' .. tostring(set)
	        }) .. " (Mana is purely cosmetic)</li>"
		    end
	    end
    result = result .. '</ul></div>'
	return result
end

-- Helper function to split strings
local function splitString(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t = {}
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        table.insert(t, str)
    end
    return t
end

-- Helper function to format skin names
local function formatSkinName(skin)
    -- Remove "TFT" suffix
    skin = skin:gsub(" TFT", "")
    skin = skin:gsub("TFT", "")
    -- Replace specific skin names
    local skinReplacements = {
        ["KDASuperfan"] = "KDA Superfan",
        ["KDAALLOUTRisingStar"] = "KDA ALL OUT Rising Star",
        ["Championship"] = "Worlds 2018",
        ["TyrantDragon"] = "Dragon Master",
        ["GuardianoftheSands"] = "Guardian of the Sands",
        ["DissonanceofPentakill"] = "Dissonance of Pentakill",
        ["Nunu&Beelump"] = "Nunu & Beelump"
    }
    if skinReplacements[skin] then
        skin = skinReplacements[skin]
    end
    -- Replace "AbiAbi" with "Abi Abi" except for specific skins
    if skin ~= "iBlitzcrank" and skin ~= "AstroNautilus" and skin ~= "iG" and skin ~= "PsyOps" then
        skin = skin:gsub("(%l)(%u)", "%1 %2")
    end
    return skin
end
-- getFormatSkinName

function p.getFormatSkinName(frame)
	local args = lib.frameArguments(frame)
	args[1] = tostring(args['skin']) or tostring(args[1])
	local skin = args[1]
	local result = ""
	result = result .. formatSkinName(skin)
	return result
end

-- Helper function to verify the skin content correctly
local function skinExists(skinList, skin)
    for _, existingSkin in ipairs(skinList) do
        if existingSkin == skin then
            return true
        end
    end
    return false
end

-- Function to count champions and skins in a set
function p.AmountSkinPool(frame)
    local args = lib.frameArguments(frame)
    local set = tonumber(args['set']) or tonumber(args[1])
    if not set then
        return error("Error: Set number is not provided or invalid.")
    end

    local datatable = require('Module:TFTUnitData/data')
    local IL = require('Module:ImageLink')
    local builder	= require("Module:SimpleHTMLBuilder")
    local result = ""
    
    local LoLSkin = {}
    local WRSkin = {}
    local isExclusiveSkin = true
    local isWRSkin = false
    local totalChampions = 0
    local customSkinCount = 0
    local customSkinChampions = {}
    local champtable = {}

    for champname in pairs(datatable) do
    	local checkRoster = getChamp["id"](champname)
        if datatable[champname][set] and checkRoster ~= nil then
        	totalChampions = totalChampions + 1
            table.insert(champtable, champname)
        elseif datatable[champname][set] and (champname == "Akali K/DA" or champname == "Akali True Damage" or champname == "Ultimate Ezreal") then
        	totalChampions = totalChampions + 1
            table.insert(champtable, champname)
        end
    end
    table.sort(champtable)

    for _, champname in pairs(champtable) do
        local skin = datatable[champname][set]["skin"]
        if (champname == "Jayce" and set == 1) then
        	customSkinCount = customSkinCount + 1
            table.insert(customSkinChampions, {champion = champname, skin = formatSkinName(skin)})
        elseif skin ~= nil and skin ~= "Original" and skin ~= "Original TFT" and skin ~= "OriginalTFT" then
            if not (champname == "Alune" and set == 11) then
                customSkinCount = customSkinCount + 1
                table.insert(customSkinChampions, {champion = champname, skin = formatSkinName(skin)})
            end
        end
    end

    if customSkinCount == 0 then
        return "There are no champions with skin in Set " .. tostring(set) .. "."
    end

    local percentage = math.floor((customSkinCount / totalChampions) * 100)
    if percentage == 100 then
        result = result .. "In Set " .. tostring(set) .. ", all " .. tostring(totalChampions) .. " champions are in one of their custom skins, and cannot be seen without that skin.</br>"
    elseif set == 11 then
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin (with the exception of ".. tostring(IL.TFTchampion{["champion"] = 'Alune', ["set"] = set, ["size"] = 20, ["text"] = 'Alune', ["link"] = 'Alune' .. '/TFT#Set ' .. tostring(set)}) .. ", an exclusive champion, debuts with the skin of ".. tostring(IL.basic{["image"] = 'Spirit Blossom 2020 profileicon.png', ["text"] = 'Spirit Blossom', ["size"] = 20, ["link"] = "Spirit Blossom (Universe)"}) .. ").</br>"
    elseif set == 10 then
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin. Only the " .. tostring(IL.TFTtrait{["trait"] = 'K/DA', ["set"] = 10, ["image"] = 'K/DA TFT icon.svg', ["border"] = 'false'}) .. " trait, with the exception of " .. tostring(IL.TFTchampion{["champion"] = 'Lillia', ["set"] = set, ["size"] = 20, ["text"] = 'Lillia', ["link"] = 'Lillia' .. '/TFT#Set ' .. tostring(set)}) .. " and " .. tostring(IL.TFTchampion{["champion"] = 'Neeko', ["set"] = set, ["size"] = 20, ["text"] = 'Neeko', ["link"] = 'Neeko' .. '/TFT#Set ' .. tostring(set)}) .. ", has two aspects according to its active form of the same trait.</br>"
    elseif set == 6.5 then
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin. Only champions with the " .. tostring(IL.TFTtrait{["trait"] = 'Clockwork', ["set"] = 6.5, ["image"] = 'Clockwork TFT icon.svg', ["border"] = 'false'}) .. " and " .. tostring(IL.TFTtrait{["trait"] = 'Mutant', ["set"] = 6.5, ["image"] = 'Mutant TFT icon.svg', ["border"] = 'false'}) .." origins appear in their default skin.</br>"
    elseif set == 6 then
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin. Only champions with the " .. tostring(IL.TFTtrait{["trait"] = 'Clockwork', ["set"] = 6, ["image"] = 'Clockwork TFT icon.svg', ["border"] = 'false'}) .. ", " .. tostring(IL.TFTtrait{["trait"] = 'Imperial', ["set"] = 6, ["image"] = 'Imperial TFT icon.svg', ["border"] = 'false'}) .. ", and " .. tostring(IL.TFTtrait{["trait"] = 'Yordle', ["set"] = 6, ["image"] = 'Yordle TFT icon old.svg', ["border"] = 'false'}) .. " origins appear in their default skin.</br>"
    elseif set == 3 then
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin. Only champions with the ".. tostring(IL.TFTtrait{["trait"] = 'Void', ["set"] = 3, ["image"] = 'Void TFT icon old.svg', ["border"] = 'false'}) .." origin appear in their default skin.</br>"
    elseif set == 1 then
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin (with the exception of " .. tostring(IL.TFTchampion{["champion"] = 'Jayce', ["set"] = set, ["size"] = 20, ["text"] = 'Jayce', ["link"] = 'Jayce' .. '/TFT#Set ' .. tostring(set)}) .. " and ".. tostring(IL.TFTchampion{["champion"] = 'Katarina', ["set"] = set, ["size"] = 20, ["text"] = 'Katarina', ["link"] = 'Katarina' .. '/TFT#Set ' .. tostring(set)}) .. ").</br>"
    else
        result = result .. "In Set " .. tostring(set) .. ", " .. tostring(customSkinCount) .. "/" .. tostring(totalChampions) .. " (about " .. tostring(percentage) .. "% of the LoL champion pool) champions are in one of their custom skins, and cannot be seen without that skin.</br>"
    end
	result = result .. "<ul>"
    for _, entry in ipairs(customSkinChampions) do
		isExclusiveSkin = true
		isWRSkin = false
		local checkRoster = getChamp["id"](entry.champion)
		if checkRoster ~= nil then
        	LoLSkin = getSkin["championSkin"](entry.champion)
		end
		local checkRosterWR = getChampWR["title"](entry.champion)
		if checkRosterWR ~= nil then
			WRSkin = getSkinWR["championSkinWR"](entry.champion)
			local filteredWRSkin = {}
			for _, wrSkin in ipairs(WRSkin) do
				if not skinExists(LoLSkin, wrSkin) then
					table.insert(filteredWRSkin, wrSkin)
				end
			end
			WRSkin = filteredWRSkin
		end
		if next(LoLSkin) then
			if skinExists(LoLSkin, entry.skin) then
				isExclusiveSkin = false
			else
            -- Buscar el skin en la lista de WR, ignorando si es el mismo skin de LoL
				if next(WRSkin) then
					if skinExists(WRSkin, entry.skin) then
						isExclusiveSkin = false
						isWRSkin = true
					end
				end
			end
		else
        -- Si no existe la lista de LoL, buscar solo en WR
			if next(WRSkin) then
				if skinExists(WRSkin, entry.skin) then
					isExclusiveSkin = false
					isWRSkin = true
				end
			end
		end
    	--Exceptions according to the set (duplicate champion, exception champions in a specific set, WR/exclusive skins or double skin in a single unit)
        if entry.champion == "Ultimate Ezreal" then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = 'Ezreal/TFT#Set ' .. tostring(set) .. ' (Ultimate)'
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = 'Ezreal',
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = 'Ezreal/LoL/Cosmetics'
            }) .. ".</li>"
        elseif entry.champion == "Akali True Damage" then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = 'Akali/TFT#Set ' .. tostring(set) .. ' (True Damage)'
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = 'Akali',
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = 'Akali/LoL/Cosmetics'
            }) .. ".</li>"
        elseif entry.champion == "Akali K/DA" then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = 'Akali/TFT#Set ' .. tostring(set) .. ' (K/DA)'
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = 'Akali',
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = 'Akali/LoL/Cosmetics'
            }) .. " in her normal form and ".. 
            tostring(IL.skin{
                ["champion"] = 'Akali',
                ["skin"]     = entry.skin .. ' ALL OUT',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = 'Akali/LoL/Cosmetics'
            }) .." in her transformation.</li>"
        elseif entry.champion ~= "Akali K/DA" and entry.skin == "KDA" and set == 10 then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .. " in her normal form and ".. 
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin .. ' ALL OUT',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .." in her transformation.</li>"
        elseif entry.champion == "Seraphine" and entry.skin == "KDA ALL OUT Rising Star" and set == 10 then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .. " in her normal form and ".. 
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = 'KDA ALL OUT Superstar',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .." in her transformation.</li>"
        elseif entry.champion == "Ezreal" and set == 8.5 then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set) .. ' (Underground)'
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = 'Original',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .. ".</li>"
        elseif entry.champion == "Swain" and set == 7.5 then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = 'Tyrant Dragon ' .. entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .." with the " ..
            tostring(IL.ability{
                ["champion"] = entry.champion,
                ["ability"]	 = 'Demonic Ascension',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL'
            }) .. "'s form.</li>"
        elseif entry.champion == "Jayce" and set == 1 then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = 'Original',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .. " in his normal form and ".. 
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = 'Full Metal',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .." in his transformation.</li>"
        elseif entry.champion == "Katarina" and set == 1 then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .. ", however, her shop card uses ".. 
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = 'Original',
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .." splash art instead.</li>"
        --elseif entry.champion == "Zoe" and entry.skin == "Mythmaker" then
        elseif isWRSkin == true then
			result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.WRskin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/WR/Cosmetics'
            }) ..' (ported from <span class="glossary" style="white-space:pre; position:relative;" data-game="lol" data-tip="Wild rift">'.. tostring(IL.basic{
				["image"]	= 'Wild Rift icon.png',
				["text"]	= 'Wild Rift',
				["size"]	= 20,
				["border"]	= true,
				["link"]	= 'League of Legends: Wild Rift'
            }) .. '</span>).</li>'
        elseif isExclusiveSkin == true then
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["circle"]   = 'true',
                ["text"]     = entry.skin .. " " .. entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " (exclusive skin).</li>"
        else
            result = result .. "<li>" .. tostring(IL.TFTchampion{
                ["champion"] = entry.champion,
                ["set"]      = set,
                ["size"]     = 20,
                ["text"]     = entry.champion,
                ["link"]     = entry.champion .. '/TFT#Set ' .. tostring(set)
            }) .. " appears as " ..
            tostring(IL.skin{
                ["champion"] = entry.champion,
                ["skin"]     = entry.skin,
                ["circle"]   = 'true',
                ["size"]     = 20,
                ["link"]     = entry.champion .. '/LoL/Cosmetics'
            }) .. ".</li>"
        end
        LoLSkin = {}
        WRSkin = {}
    end
	result = result .. "</ul>"
    return result
end


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