Module:Echo

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

local p = {}
local utils = require("Module:Utils")
local data = mw.loadJsonData("Module:Data/echo.json")
local enemy = mw.loadJsonData("Module:Data/enemy.json")

function p.createInfobox(frame)
	local name = frame.args.name
	if name == nil or name == "" then name = mw.title.getCurrentTitle().subpageText end
	local image = frame.args.image
	local item = data[name]
	
	local str = { 
		image = image,
		type = item.echoSlot,
		cost = frame.args.cost,
	}
	
	return frame:expandTemplate{title = 'Infobox echo', args = str}
end

function p.getStats(frame)
	local name = frame.args.name
	if name == nil or name == "" then name = mw.title.getCurrentTitle().subpageText end
	
	return data[name].description
end

function p.getEnemyDrop(frame)
	local name = frame.args.name
	if name == nil or name == "" then name = mw.title.getCurrentTitle().subpageText end
	local str = ""

	str = str .. "{| class='table' style='width:auto'\n"
	str = str .. "! Name !! Echo level\n"
	for k, v in pairs(enemy) do
		if v.echo == name then
			str = str .. "|-\n"
			str = str .. "| [[" .. k .. "]]\n"
			str = str .. "| " .. v.echoLevel .. "\n"
		end
	end
	str = str .. "|}"

	return str
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.