İçeriğe atla

Modül:ACT

Deltarune Wiki sitesinden

Error from Modül:ACT: Missing Lua documentation! Check other modules to see examples how to write Lua module documentation. Please check the linked documentation for expected input and examples.

local act = {}

local util = require('Module:Util')
local title = mw.title.getCurrentTitle()

function act.header(frame)
	local name = frame.args[1]
	local level = frame.args[2]
	local icons = {}
	for _, member in ipairs(util.parseCommaList(frame.args[3])) do
		if member ~= '' then
			table.insert(icons, string.format(
				'[[File:%s face battlemenu.png|24x24px|link=|ACT performed with %s]]',
				member, member
			))
		end
	end
	local class = ''
	if name == 'S-Action' then
		class = 'violet'
	elseif name == 'R-Action' then
		class = 'lightgreen'
	elseif name == 'N-Action' then
		class = 'lightyellow'
	end
	return string.format(
		'<h%s class="%s">%s%s</h%s>',
		level, class, table.concat(icons), name, level
	)
end

function act.image(frame)
	local name = frame.args[1]
	local image = frame.args[2]
	if image == '' then
		local subject = title.text
		if title:inNamespace(2) and title.isSubpage then
			subject = title.subpageText
		end
		for _, file in ipairs(mw.title.newBatch{
			string.format('File:%s act %s.gif', subject, name),
			string.format('File:%s act %s.png', subject, name)
		}:lookupExistence():getTitles()) do
			if file.exists then
				image = file.text
				break
			end
		end
	end
	if image == '' then
		return
	end
	return string.format(
		'<p>[[File:%s|320px|Performing the %s ACT.]]</p>',
		image, name
	)
end

return act
Konu ekle