Module:Infobox/Modpack

From ATLauncher Wiki
Jump to: navigation, search
Name Parameter
Name Parameter
Your Ad Caption Here
Name Name Parameter
Creator Myself
Launcher Nooblauncher 3
Latest Version 1.3.3.7
Minecraft Version Beta 1.6
Private Pack Code AW350m3P4CK
Website Official Site
Mod count Number of Mods
Custom Row working
Lua Logo.svg This is the Lua module for Template:Infobox/Modpack. Below is the documentation for that template.

Parameters[edit]

  • name: Modpack name and infobox title. Should only be used if actual name differs from page title. Default: {{PAGENAME}}.
  • img: Modpack image (without File: or square brackets). Replaces {{{image}}}.
  • imgwidth: Width of the image. Ignored if {{{image}}} is used. Default: 250px.
  • caption: Caption that appears under the image. May also be displayed if no image is present. Default: Hidden.
  • creator: Creator of the pack. Entering either "FTB", "FTB Team" or "The FTB Team" will output "The FTB Team", everything else will be displayed literally. Default: Unknown.
  • launcher: The launcher via which the pack is distributed. Various short names may be used for the Feed The Beast Launcher and ATLauncher. Default: Unknown.
  • version: Latest available version of the modpack. Default: Unknown.
  • mcversion: Version of Minecraft used by the latest version of the modpack. Default: Unknown.
  • code: Private pack code, only for private packs listed on the Private Packs list. Default: Hidden.
  • url: Pack website, forum, post, changelog or other related URL. Default: Hidden.
  • modcount: Shows the number of mods that are in a modpack.
  • rows: Additional info rows besides Name. Consists of multiple {{Infobox/Row}}s, separated by single line breaks. Default: Hidden.

local p = {}

local g = require("Module:Common")
local box = require("Module:Infobox")

-- wrapper for modpack, can be called correctly from MW code
function p.main(frame)
	local frame, args = g.getFrameAndArgs(frame)
	local l = ""
	
	-- special handling for FTB as creator
	local cl = string.lower(args.creator or "")
	if cl == "ftb" or cl == "ftbteam"
	or cl == "ftb team" or cl == "the ftb team" then
		args.creator = "The FTB Team"
	end
	
	-- special handling for launcher names
	local ll = string.lower(args.launcher or "")
	if ll == "at" or ll == "atl"
	or ll == "atlauncher" or ll == "at launcher" then
		args.launcher = "ATLauncher"
	elseif ll == "ftb" or ll == "ftblauncher"
	    or ll == "ftb launcher" or ll == "feedthebeast"
	    or ll == "feed the beast" or ll == "feed the beast launcher" then
		args.launcher = "Feed The Beast Launcher"
	elseif ll == "app" then
		args.launcher = "FTB App"
	end
	
	if g.isGiven(args.creator) then
		local devstr = ""
		for dev in string.gmatch(args.creator, "[^,;]+") do
			devstr = devstr .. "[[Created by::" .. dev .. "]], "
		end
		l = l .. box.row("Creator", string.sub(devstr, 1, -3))
	else
		l = l .. box.row("Creator", "Unknown")
	end
	if g.isGiven(args.launcher) then
		l = l .. box.row("Launcher", "[[Is on launcher::" .. args.launcher .. "]]")
	else
		l = l .. box.row("Launcher", "Unknown")
	end
	if g.isGiven(args.version) then
		l = l .. box.row("Latest Version", "[[Version::" .. args.version .. "]]")
	else
		l = l .. box.row("Latest Version", "Unknown")
	end
	if g.isGiven(args.mcversion) then
		l = l .. box.row("[[Minecraft]] Version", "[[Minecraft version::" .. args.mcversion .. "]]")
	else
		l = l .. box.row("[[Minecraft]] Version", "Unknown")
	end
	l = l .. box.condRow("Private Pack Code", args.code)
	l = l .. box.condRow("Website", args.url)
	l = l .. box.condRow("Changelog", args.changelog)
	l = l .. box.condRow("Replaces", args.prevpack)
	l = l .. box.condRow("Replaced by", args.nextpack)
	l = l .. box.condRow("Mod count", args.modcount)
	
	if g.isGiven(args.rows) then
		l = l .. args.rows
	end
	
	args.rows = l
	frame.args = args
	
	return box.main(frame)
end

return p