Module:Echo
Documentation for this module may be created at Module:Echo/doc
local p = {} local utils = require("Module:Utils") local constant = mw.loadJsonData("Module:Data/constant.json") 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.type, 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 function p.createEchoList(frame) local str = "" local whitelist = constant["Echo Whitelist"] for k, v in pairs(whitelist) do local item = data[v] local stats = item.type == "Rush" and item.description or string.gsub(item.description, ", ", "@") local filter = item.type == "Rush" and "special" or string.gsub(string.gsub(item.description, " ", ""), ",", " "):lower() local template = { type = item.type, name = v, stats = stats, filter = filter } str = str .. frame:expandTemplate{title = 'Echo list', args = template} end return str end return p