Module:Skill

From Arknights Terra Wiki
Jump to navigation Jump to search

The Lua source code for the display of skills through {{Skill}}.


local p = {}
local data = mw.loadData('Module:Skill/data')
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end
function p._main(args)
	local name = args[1]
	local title = data[name]
	if not title then
		mw.log('Skill not found:', name)
		return '<i>Skill not found</i>'
	end
	local text = args[2] or name
	local gridview = yesno(args.gridview)
	if gridview then
		return '<div style="display:inline-block; position:relative; margin:5px 5px 0 5px; text-align:center;">[[File:Skill-'..title..'.png|50x50px|link=]]<div style="margin-top:2px;">'..text..'</div></div>'
	else
		return '<span style="display:inline-block;">[[File:Skill-'..title..'.png|20x20px|link=]]&#32;'..text..'</span>'
	end
end
return p