Module:Contract

From Arknights Terra Wiki
Jump to navigation Jump to search

The Lua source code for the display of Contracts in Contingency Contract Operations through {{Contract}}.


local p = {}
local data = mw.loadData('Module:Contract/data')
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end
function p._main(args)
	local display = args.display or 'default'
	local name = args[1]
	local class = args[2]
	local val = data[name]
	if type(val) == 'table' then
		filename = val[class]
	else
		filename = val
	end
	local wrapper = mw.html.create('')
	if display == 'template' then
		return '<div style="display:inline-block; margin:5px; position:relative; text-align:center;">[[File:Contract-'..filename..'.png|60x60px|link=]]</div>'
	elseif display == 'default' then
		return '<span style="display:inline-block;">[[File:Contract-'..filename..'.png|20x20px|link=]]&#32;'..name..'</span>'
	end
end
return p