Module:Skill List: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 50: Line 50:
if getSkill.skill[input].cost and getSkill.skill[input].costtype then
if getSkill.skill[input].cost and getSkill.skill[input].costtype then
cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost .. getSkill.skill[input].costtype
cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost .. ' ' .. getSkill.skill[input].costtype
elseif getSkill.skill[input].cost then
elseif getSkill.skill[input].cost then
cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost
cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost

Revision as of 01:08, 17 June 2024

Documentation for this module may be created at Module:Skill List/doc

local getArgument = require('Module:Arguments').getArgument

local p = {}


function p.Main(frame)
	local args = frame.args
	local game = args[1]:lower()
	local input = args[2]:lower()
	local getSkill = require('Module:Data/Skill/' .. game)
	local iconPage = mw.title.makeTitle('Module', 'Data/Icon/' .. game)
	
	if getSkill.skill[input] and getSkill.skill[input].link then -- Check if an alternate link for a page is set in skill data
		name = '[[' .. getSkill.skill[input].link .. '|' .. getSkill.skill[input].name .. ']]'
	else	
		name = '[[' .. getSkill.skill[input].name .. ']]'
	end
	
	if getSkill.skill[input] and getSkill.skill[input].name_note then
		namenote = frame:expandTemplate{ title = 'exp', args = { getSkill.skill[input].name_note } }
	else
		namenote = ''
	end
	
	if game == 'desum' then
		name = '\n|style="text-align:left;"|' .. require('Module:Data/Icon/desum').icon[getSkill.skill[input].desumicon] .. ' ' .. name .. namenote
	else
		if getSkill.skill[input].attribute then
			attribute = getSkill.skill[input].attribute:lower()
		else
			attribute = ''
		end
		if iconPage.exists == true then
			getIcon = require('Module:Data/Icon/' .. game)
			if getIcon.icon[attribute] then -- Check if attribute is set in icon data
				name = '\n|style="text-align:left;"|' .. getIcon.icon[attribute] .. ' ' .. name .. namenote -- Set icon
			else
				name = '\n|style="text-align:center;"|' .. name .. namenote
			end
		else
			name = '\n|style="text-align:center;"|' .. name .. namenote
		end
	end

	if game == 'mip' and getSkill.skill[input] and getSkill.skill[input].rpname then
		rpname = '\n|style="text-align:center;"|' .. getSkill.skill[input].rpname
	else
		rpname = ''
	end
	
	if getSkill.skill[input].cost and getSkill.skill[input].costtype then
		cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost .. ' ' .. getSkill.skill[input].costtype
	elseif getSkill.skill[input].cost then
		cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost
	end
	
	local output = name .. rpname .. cost .. '\n|-'
	return output
end

return p