Module:Figurine

-- This modules serves as the code for Template:Figurine local File = require("Module:File") local Franchise = require("Module:Franchise") local utilsArg = require("Module:UtilsArg") local utilsMarkup = require("Module:UtilsMarkup") local utilsTable = require("Module:UtilsTable")

local cache = mw.loadData("Module:Figurine/Cache")

local p = {}

function p.Main(frame) local args, err = utilsArg.parse(frame:getParent.args, p.Templates.Figurine) if err then return utilsMarkup.categories(err.categories) end return p.printFigurine(args.game, args.name) end

function p.printFigurine(game, name) local figurine = cache.figurines[game][name] local figurinesPageLink = "Figurine" local headerCell = string.format("%s (%s from %s)", name, figurinesPageLink, Franchise.link(game)) local imageType = Franchise.graphics(game) == "2D" and "Sprite" or "Model" local figurineImage = File.gameImage(game, name .. " Figurine", imageType, {		size = "x120px"	}) local figurineCell = figurineImage .. " '''" .. name .. "'''"	local result = "" result = " " return result end

p.Templates = { Figurine = { purpose = "Displays data on a Figurine.", usesData = {"Figurines in The Wind Waker", "Figurines in The Minish Cap"}, format = "inline", params = { [1] = {				name = "game", type = "string", required = true, enum = {"TWW", "TMC"}, desc = "Game of the desired figurine.", },			[2] = {				name = "name", type = "wiki-page-name", desc = "Name of the desired figurine.", enumDependsOn = "game", enum = function(game) local gameName = Franchise.shortName(game) if not gameName then return {} end return utilsTable.merge({}, cache.figurineNames[game], {						reference = "Figurines in " .. gameName .. ""					}) end, }		},		examples = { {"TWW", "Link & the King of Red Lions"}, {"TMC", "Ezlo and Link"}, {"foo", "bar"}, {"TWW", "foo"} }	} }

return p