Module:Skill List: Difference between revisions

Jump to navigation Jump to search
No edit summary
m (Adding notes section)
 
(18 intermediate revisions by 2 users not shown)
Line 10: Line 10:
local getSkill = require('Module:Data/Skill/' .. game)
local getSkill = require('Module:Data/Skill/' .. game)
local iconPage = mw.title.makeTitle('Module', 'Data/Icon/' .. game)
local iconPage = mw.title.makeTitle('Module', 'Data/Icon/' .. game)
if not getSkill.skill[input] then
error("Skill \"" .. input .. "\" not defined for " .. game)
end
if getSkill.skill[input] and getSkill.skill[input].link then -- Check if an alternate link for a page is set in skill data
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 .. ']]'
name = '[[' .. getSkill.skill[input].link .. '|' .. getSkill.skill[input].name .. ']]'
Line 42: Line 44:
end
end
end
end
 
if getSkill.skill[input].battlename then --For Shin Megami Tensei: Devil Summoner and Shin Megami Tensei: Nine
battlename = '\n|style="text-align:center;"|' .. getSkill.skill[input].battlename
else
battlename = ''
end
if getSkill.skill[input].skilltype then --Magic vs. Extra
skilltype = '\n|style="text-align:center;"|' .. getSkill.skill[input].skilltype
else
skilltype = ''
end
if getSkill.skill[input].damagetype then --Magical vs. Physical
damagetype = '\n|style="text-align:center;"|' .. getSkill.skill[input].damagetype
else
damagetype = ''
end
if game == 'mip' and getSkill.skill[input] and getSkill.skill[input].rpname then
if game == 'mip' and getSkill.skill[input] and getSkill.skill[input].rpname then
rpname = '\n|style="text-align:center;"|' .. getSkill.skill[input].rpname
rpname = '\n|style="text-align:center;"|' .. getSkill.skill[input].rpname
Line 49: Line 69:
end
end
if getSkill.skill[input].cost and getSkill.skill[input].costtype then
if getSkill.skill[input].attribute ~= 'passive' and 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].attribute ~= 'passive' and 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
else
cost = ''
end
if getSkill.skill[input].powerlvl then
powerlvl = '\n|style="text-align:center;"|' .. getSkill.skill[input].powerlvl
else
powerlvl = ''
end
if getSkill.skill[input].target then
target = '\n|style="text-align:center;"|' .. getSkill.skill[input].target
else
target = ''
end
if getSkill.skill[input].range then
range = '\n|style="text-align:center;"|' .. getSkill.skill[input].range
else
range = ''
end
if getSkill.skill[input].hit then
hit = '\n|style="text-align:center;"|' .. getSkill.skill[input].hit
else
hit = ''
end
end
Line 61: Line 107:
end
end


if getSkill.skill[input].range then
if getSkill.skill[input].crit then
power = '\n|style="text-align:center;"|' .. getSkill.skill[input].range
crit = '\n|style="text-align:center;"|' .. getSkill.skill[input].crit
else
crit = ''
end
if getSkill.skill[input].acc then
acc = '\n|style="text-align:center;"|' .. getSkill.skill[input].acc
else
acc = ''
end
 
if getSkill.skill[input].rank then
rank = '\n|style="text-align:center;"|' .. getSkill.skill[input].rank
else
rank = ''
end
if getSkill.skill[input].description and getSkill.skill[input].description_ja and getSkill.skill[input].description_ja ~= "—" then
description = '\n|style="text-align:center;"|' .. frame:expandTemplate{ title = 'DescTransl', args = { getSkill.skill[input].description_ja, getSkill.skill[input].description } }
elseif getSkill.skill[input].description then
description = '\n|style="text-align:center;"|' .. getSkill.skill[input].description
else
description = ''
end
if getSkill.skill[input].rpdescription then
rpdescription = '\n|style="text-align:center;"|' .. getSkill.skill[input].rpdescription
else
rpdescription = ''
end
if getSkill.skill[input].effect then
effect = '\n|style="text-align:center;"|' .. getSkill.skill[input].effect
else
effect = ''
end
 
if getSkill.skill[input].notes then
notes = '\n|style="text-align:center;"|' .. getSkill.skill[input].notes
else
else
power = ''
notes = ''
end
end
local output = name .. rpname .. cost .. power .. range .. '\n|-'
local output = name .. rpname .. battlename .. skilltype .. damagetype .. cost .. powerlvl .. target .. range .. hit .. power .. crit .. acc .. rank .. description .. rpdescription .. effect .. notes .. '\n|-'
return output
return output
end
end


return p
return p

Latest revision as of 18:11, 15 November 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 not getSkill.skill[input] then
		error("Skill \"" .. input .. "\" not defined for " .. game)
	end
	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 getSkill.skill[input].battlename then --For Shin Megami Tensei: Devil Summoner and Shin Megami Tensei: Nine
		battlename = '\n|style="text-align:center;"|' .. getSkill.skill[input].battlename
	else
		battlename = ''
	end
	
	if getSkill.skill[input].skilltype then --Magic vs. Extra
		skilltype = '\n|style="text-align:center;"|' .. getSkill.skill[input].skilltype
	else
		skilltype = ''
	end
	
	if getSkill.skill[input].damagetype then --Magical vs. Physical
		damagetype = '\n|style="text-align:center;"|' .. getSkill.skill[input].damagetype
	else
		damagetype = ''
	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].attribute ~= 'passive' and 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].attribute ~= 'passive' and getSkill.skill[input].cost then
		cost = '\n|style="text-align:center;"|' .. getSkill.skill[input].cost
	else
		cost = ''
	end
	
	if getSkill.skill[input].powerlvl then
		powerlvl = '\n|style="text-align:center;"|' .. getSkill.skill[input].powerlvl
	else
		powerlvl = ''
	end
	
	if getSkill.skill[input].target then
		target = '\n|style="text-align:center;"|' .. getSkill.skill[input].target
	else
		target = ''
	end
	
	if getSkill.skill[input].range then
		range = '\n|style="text-align:center;"|' .. getSkill.skill[input].range
	else
		range = ''
	end
	
	if getSkill.skill[input].hit then
		hit = '\n|style="text-align:center;"|' .. getSkill.skill[input].hit
	else
		hit = ''
	end
	
	if getSkill.skill[input].power then
		power = '\n|style="text-align:center;"|' .. getSkill.skill[input].power
	else
		power = ''
	end

	if getSkill.skill[input].crit then
		crit = '\n|style="text-align:center;"|' .. getSkill.skill[input].crit
	else
		crit = ''
	end
	
	if getSkill.skill[input].acc then
		acc = '\n|style="text-align:center;"|' .. getSkill.skill[input].acc
	else
		acc = ''
	end

	if getSkill.skill[input].rank then
		rank = '\n|style="text-align:center;"|' .. getSkill.skill[input].rank
	else
		rank = ''
	end
	
	if getSkill.skill[input].description and getSkill.skill[input].description_ja and getSkill.skill[input].description_ja ~= "—" then
		description = '\n|style="text-align:center;"|' .. frame:expandTemplate{ title = 'DescTransl', args = { getSkill.skill[input].description_ja, getSkill.skill[input].description } }
	elseif getSkill.skill[input].description then
		description = '\n|style="text-align:center;"|' .. getSkill.skill[input].description
	else
		description = ''
	end
	
	if getSkill.skill[input].rpdescription then
		rpdescription = '\n|style="text-align:center;"|' .. getSkill.skill[input].rpdescription
	else
		rpdescription = ''
	end
	
	if getSkill.skill[input].effect then
		effect = '\n|style="text-align:center;"|' .. getSkill.skill[input].effect
	else
		effect = ''
	end

	if getSkill.skill[input].notes then
		notes = '\n|style="text-align:center;"|' .. getSkill.skill[input].notes
	else
		notes = ''
	end
	
	local output = name .. rpname .. battlename .. skilltype .. damagetype .. cost .. powerlvl .. target .. range .. hit .. power .. crit .. acc .. rank .. description .. rpdescription .. effect .. notes .. '\n|-'
	return output
end

return p