Module:Infobox/Map

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_html = require('Module:HtmlUtil') local util_infobox = require('Module:InfoboxUtil') local util_news = require("Module:NewsUtil") local util_table = require('Module:TableUtil') local util_text = require("Module:TextUtil") local util_title = require("Module:TitleUtil") local util_vars = require("Module:VarsUtil")

local lang = mw.getLanguage('en') local m_country = require('Module:Country') local i18n = require('Module:i18nUtil') local Country = require('Module:Country').main

local Infobox = require('Module:Infobox'):extends

Infobox.type = 'Map'

Infobox.LAYOUT = { --tabs = 'MapTabsHeader', sections = { 'General Information', 'Developer', 'Map' }, contents = { { 'Location', 'Bombsites', 'ReleaseDate', 'Description' }, { 'KeyDdragon', 'KeyInt' }, { 'MiniMap' }, }, }

local h = {} local p = {}

function p.main(frame) local args = util_args.merge return Infobox(args):run end

function Infobox:validateArgs(args) end

function Infobox:getProcessed(args) local tbl = { pagename = args.pagename or mw.title.getCurrentTitle.text, }	return tbl end

function Infobox:getDisplay(args, processed) local display = self:super('getDisplay', args, processed) local tbl = { title = args.name, image = args.image or ('Map %s.png'):format(args.name), imagesize = not (args.image and not args.imagesize) and (args.imagesize or '300px'), Location = args.location and m_country.rightlong(args.location), Bombsites = args.bombsites, ReleaseDate = args.releasedate, Description = args.desc,

KeyDdragon = args.key_ddragon, KeyInt = args.key_int, --MiniMap = args.minimap or ('Map %s Minimap'):format(args.name), }	return Infobox.mergeDisplay(display, tbl) end

function h.stat(base, level) return base and ('%s (+ %s)'):format(base, level) end

function Infobox:getCargo(args, processed) local cargo = self:super('getCargo', args, processed) if util_args.castAsBool(args.nocargo) then return cargo end local tbl = { {		_table = 'Maps', Name = args.name, Image = args.image or ('Map %s.png'):format(args.name), Location = args.location and m_country.rightlong(args.location), Bombsites = args.bombsites, ReleaseDate = args.releasedate, Description = args.desc, KeyDdragon = args.key_ddragon, KeyInt = args.key_int, },	}	tbl[#tbl+1] = h.getNewsLine(args, processed) return util_table.mergeArrays(cargo, tbl) end

function h.getNewsLine(args, processed) if util_args.castAsBool(args.notreleased) then return end util_news.setId args.date = lang:formatDate('Y-m-d', args.releasedate) args.Sentence = i18n.default(		'NewsSentence',		util_text.intLinkOrText(args.name)	) local tbl = { Subject = 'Riot', SubjectLink = 'Portal:Maps', SubjectType = 'Tournament', Region = 'International', }	util_table.mergeDontOverwrite(tbl, util_news.getNewsCargoFieldsFromArgs(args)) return tbl end

function Infobox:getCategories(args, processed) local categories = self:super('getCategories', args, processed) local tbl = { 'Maps' }	return util_table.mergeArrays(categories, tbl) end

function Infobox:getVariables(args, processed) local variables = self:super('getVariables', args, processed) local tbl = { }	return util_table.merge(variables, tbl) end

return p