Leaguepedia | League of Legends Esports Wiki
[checked revision][checked revision]
No edit summary
(finalExtends)
(47 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local p = require('Module:EntityAbstract'):finalExtends()
local p = {}
 
   
  +
p.objectType = 'Champion'
function p.Champion ( frame )
 
  +
p.cssClass = 'champion-object'
local args = frame
 
  +
p.defaultlength = 'display'
if frame == mw.getCurrentFrame() then
 
  +
p.imagelength = 'link'
args = require( 'Module:ProcessArgs' ).merge( true )
 
  +
p.filePattern = '%sSquare.png'
else
 
  +
p.imagesizes = { default = 25, display = 25, inline = 20, }
frame = mw.getCurrentFrame()
 
end
 
 
local Styles = require('Module:Championstyles')
 
local Names = mw.loadData( 'Module:Championnames' )
 
 
local input = args[1] or 'Unknown'
 
local inputlc = string.lower(input)
 
local style = string.lower(args[2] or 'default')
 
 
local link = Names[inputlc] or input
 
local display = args.display or link
 
 
if args.size then
 
if string.sub(args.size,-2) ~= "px" then
 
args.size = args.size .. "px"
 
end
 
end
 
 
local text = Styles[style](link, display, args['size'])
 
 
return text
 
end
 
   
function p.name ( frame )
+
function p:name(opts)
  +
if not opts then opts = {} end
local args = frame
 
  +
return opts.display or self:get(opts.len or self.defaultlength)
if frame == mw.getCurrentFrame() then
 
args = require( 'Module:ProcessArgs').norm()
 
end
 
if not args[1] then
 
args[1] = ''
 
end
 
local names = mw.loadData( 'Module:Championnames' )
 
local output = names[mw.ustring.lower( args[1] )] or args[1]
 
return output
 
 
end
 
end
  +
 
return p
 
return p

Revision as of 05:40, 24 August 2020

Edit the documentation or categories for this module.

If you are an editor wanting to update the list of champions, see {{Championnames}}m


local p = require('Module:EntityAbstract'):finalExtends()

p.objectType = 'Champion'
p.cssClass = 'champion-object'
p.defaultlength = 'display'
p.imagelength = 'link'
p.filePattern = '%sSquare.png'
p.imagesizes = { default = 25, display = 25, inline = 20, }

function p:name(opts)
	if not opts then opts = {} end
	return opts.display or self:get(opts.len or self.defaultlength)
end

return p