VALORANT Esports Wiki
Advertisement

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

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 m_country = require('Module:Country')
local i18n = require('Module:i18nUtil')
local Country = require('Module:Country').main
local social = require('Module:Infobox/Social')

local InfoboxData = require('Module:InfoboxDataClass')
local InfoboxMap = InfoboxData:extends()

local lang = mw.getLanguage('en')

local h = {}
local p = {}

function p.main(args)
	i18n.init('Infobox/Map')
	args._title = args.name
	return InfoboxMap:init(args)
end

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

InfoboxMap.type = 'Map'


function InfoboxMap: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 tbl
end

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

function InfoboxMap:getCargo(args, processed)
	util_cargo.setStoreNamespace('')
	local cargo = self:super('getCargo', args, processed)
	local tbl = {
		{
		_table = 'Maps',
		--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 InfoboxMap:getCategories(args, processed)
	local tbl = {
		'Maps'
	}
	return tbl
end

return p
Advertisement