Fortnite Esports Wiki

Power Rankings of Brazil and Oceania at the moment are not updated to the last two competitive seasons, so the current positions of the players are not 100% accurate.

READ MORE

Fortnite Esports Wiki
Advertisement

To edit the documentation or categories for this module, click here.


local util_args = require("Module:ArgsUtil")
local util_cargo = require('Module:CargoUtil')
local util_vars = require('Module:VarsUtil')

local h = {}
local p = {}
function p.navbox(tabstype)
	if tabstype ~= 'Player' and tabstype ~= 'Team' then
		return nil
	end
	local teamAndSystem = h.getTeamAndSystem(
		tabstype,
		mw.title.getCurrentTitle().rootText
	)
	local ret = {
		h.clpnArgs(teamAndSystem, tabstype),
		h.orgNavboxArgs(teamAndSystem, tabstype)
	}
	return ret
end

function h.getTeamAndSystem(tabstype, title)
	if tabstype == 'Team' then
		return { Team = title }
	end
	return h.getTeamFromPlayer(title)
end

function h.getTeamFromPlayer(title)
	local query = {
		tables = 'Players',
		fields = { 'Team', 'TeamSystem=System' },
		where = string.format('_pageName="%s"', title)
	}
	return util_cargo.getOneRow(query) or {}
end

function h.orgNavboxArgs(teamAndSystem, tabstype)
	return {
		title = 'OrgNavbox',
		events = { showAll = true },
		args = {
			teamAndSystem.Team,
			system = teamAndSystem.System,
			suffix = util_args.boolToStringYN(true),
			from_player = tabstype == 'Player'
		},
	}
end

function h.clpnArgs(teamAndSystem, tabstype)
	return {
		title = 'CurrentLeagueParticipantNavbox',
		events = { showAll = true },
		args = { teamAndSystem.Team, suffix = util_args.boolToStringYN(true) },
		pagetype = tabstype
	}
end

return p
Advertisement