Apex Legends Esports Wiki

READ MORE

Apex Legends Esports Wiki
[checked revision][checked revision]
(Syncing content across wikis, if something seems broken as a result let me know)
 
Esen (talk | contribs)
 
Line 21: Line 21:
 
function h.getTeamFromPlayer(title)
 
function h.getTeamFromPlayer(title)
 
local query = {
 
local query = {
tables = 'InfoboxPlayer',
+
tables = 'Players',
 
fields = 'Team',
 
fields = 'Team',
 
where = string.format('_pageName="%s"', title)
 
where = string.format('_pageName="%s"', title)

Latest revision as of 15:41, 8 July 2019

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


local util_cargo = require('Module:CargoUtil')

local h = {}
function h.orgNavboxArgs(team)
	return {
		title = 'OrgNavbox',
		events = { showAll = true },
		args = { team, suffix = 'Yes' },
	}
end

function h.clpnArgs(team, tabstype)
	return {
		title = 'CurrentLeagueParticipantNavbox',
		events = { showAll = true },
		args = { team, suffix = 'Yes' },
		pagetype = tabstype
	}
end

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

local p = {}
function p.navbox(tabstype, title)
	if tabstype ~= 'Player' and tabstype ~= 'Team' then
		return nil
	end
	local team = (tabstype == 'Team') and title or h.getTeamFromPlayer(title)
	local clpnavbox = h.clpnArgs(team, tabstype)
	local orgnavbox = h.orgNavboxArgs(team)
	local navboxes = { clpnavbox, orgnavbox }
	return navboxes
end
return p