Leaguepedia | League of Legends Esports Wiki
Advertisement
Leaguepedia | League of Legends Esports Wiki

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_form = require('Module:FormUtil')
local util_game = require('Module:GameUtil')
local util_esports = require('Module:EsportsUtil')
local util_map = require('Module:MapUtil')
local util_table = require('Module:TableUtil')
local util_text = require("Module:TextUtil")
local util_vars = require('Module:VarsUtil')
local i18n = require('Module:i18nUtil')
local m_team = require('Module:Team')

local PBHF = require('Module:PickBanHistoryFormatterAbstract'):extends()

local h = {}

function PBHF:concatRoleHeaders(OUTRO_COLUMNS, ROLE_COLUMNS)
	return util_table.mergeArrays(
		util_table.shallowClone(ROLE_COLUMNS),
		OUTRO_COLUMNS
	)
end

function PBHF:formatRow(row)
	row.data = {
		Phase = row.Tab and ('[[%s#%s|%s]]'):format(row._pageName,row.Tab,row.Tab) or '',
		Blue = row.Team1,
		Red = row.Team2,
		Score = self:getScore(row),
		Winner = row.Winner,
		Patch = row.Patch or '',
		SB = util_text.intLink(row.ScoreboardPage, 'SB'),
		MH = row.MatchHistory,
		VOD = row.VOD,
	}
	row.classes = self:initColumnClasses(row.Winner)
	row.attrs = {}
	for label, cellPreload in pairs(self.CELLORDER) do
		local col = #row.data+1
		local c1 = h.getChampionText(cellPreload[1], row[cellPreload[1]])
		local c2 = h.getChampionText(cellPreload[2], row[cellPreload[2]])
		row.data[label] = ((c1 or '') .. (c2 and string.format(', %s',c2) or ''))
		self:initCellClasses(row.classes, label)
		util_table.mergeArrays(row.classes[label], cellPreload.classes)
	end
	local k = 1
	for i = 1,2 do
		for j = 1,5 do
			row.data[self.ROLE_COLUMNS[k]] = row[('Team%sRole%s'):format(i,j)] or 'MISSING DATA'
			k = k + 1
		end
	end
end

function h.getChampionText(preloadValue, rowValue)
	if preloadValue and rowValue then
		return rowValue
	elseif preloadValue then
		return 'MISSING DATA'
	end
end

return PBHF
Advertisement