This module is NOT able to be synced with code from other esports wikis!
The code has been significantly customized in accordance with the needs of this particular wiki. DO NOT OVERWRITE IT!!! |
local util_args = require('Module:ArgsUtil')
local util_footnote = require('Module:FootnoteUtil')
local util_table = require('Module:TableUtil')
local util_text = require('Module:TextUtil')
local i18n = require('Module:i18nUtil')
local m_champion = require('Module:Champion')
local h = {}
local p = {
players_per_team = 5,
side_names = {
'Blue', 'Red',
['1'] = 'Blue',
['2'] = 'Red'
},
years = { 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 },
store_player_league_history = true, -- do we store to PlayerLeagueHistory from InfoboxPlayer? will prevent needing to sync a normally-unneeded dependency
}
function p.linkPatch(str)
return util_text.intLink(('Patch %s'):format(str), str)
end
---------------------------------------------------------
------------------ MatchList hooks ---------------------
---------------------------------------------------------
function p.onProcessMatchListTabRow(row, i, j, args, tab)
-- add patch as a table caption
util_table.initTable(tab, 'patchinfo', { patches = {}, hotfixes = {}, disabled = {}, footnotes = {} })
if not row.Patch then return true end
MATCH_LIST_HAS_PATCH = true
util_table.initDict(tab.patchinfo.patches, row.Patch)
if row.Hotfix then
util_table.initDict(tab.patchinfo.hotfixes, row.Hotfix)
end
if row.PatchFootnote then
util_table.initDict(tab.patchinfo.footnotes, row.PatchFootnote)
end
util_table.merge(tab.patchinfo.disabled, util_text.split(row.Disabled))
return true
end
function p.onMatchListPrintCaption(tbl, tab)
if not MATCH_LIST_HAS_PATCH then return true end
local caption = {
i18n.print('patchCaption', h.getPatchText(tab.patchinfo.patches)),
h.getDisabledText(tab.patchinfo.disabled),
}
local caption = tbl
:tag('caption')
:wikitext(util_table.concat(caption, ', '))
util_footnote.tagFootnotes(caption, tab.patchinfo.footnotes)
return true
end
function h.getPatchText(patches)
return util_table.concatNonempty(patches, ', ', p.linkPatch) or i18n.print('tbd')
end
function h.getDisabledText(disabled)
if not next(disabled) then return nil end
return i18n.print('patchDisabled', util_table.concat(disabled, '', m_champion.onlyimagelinked))
end
return p