FGO reader JP server
Not fetchingIdle — 233676 wiki requests so far, 696 failed

Module:Seffect

Cached copy of the original page · revision 1391294 · refresh

Documentation icon Module documentation
For Template, see Template:Seffect.
local p = {}

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		parentFirst = true,
		wrapper = { 'Template:Seffect' }
	})
	return p._main(args)
end

function p._main(args)
	local data = require('Module:Seffect/data')
	local yesno = require('Module:Yesno')
	local effectName = args.name or args[1] or ""
	local effect = data[effectName:lower()] or data['transparent']
	if effect.redirect ~= nil then
		effect = data[effect.redirect] or data['transparent']
	end
	
	local size = args.size or args[2] or 25

	local link = args.link or ""
	local textLine = args.textline or nil
	local isUnremovable = args.unremovable or "no"
	local filePath = '[[File:' .. effect.fileName .. '.png|' .. size .. 'px|'
	if textLine ~= nil then
		filePath = filePath .. textLine	.. '|'
	end
	filePath = filePath .. 'link=' .. link .. ']]'
	
	local node_result = mw.html.create()
	if yesno(isUnremovable) then
		node_result
			:tag('span')
			:addClass("UnremovableStatusFrame")
				-- preprocess(): expand template
				:wikitext(mw.getCurrentFrame():preprocess('{{Tooltip|This effect is unremovable.|' .. filePath .. '|noline = 1}}'))
			:done()
	else
		node_result
				:wikitext(filePath)
			:done()
	end
		
	return node_result
end

return p;