diff --git a/components/match2/wikis/dota2/match_summary.lua b/components/match2/wikis/dota2/match_summary.lua
index 1ccb6fa3c02..720bbdf56b5 100644
--- a/components/match2/wikis/dota2/match_summary.lua
+++ b/components/match2/wikis/dota2/match_summary.lua
@@ -15,21 +15,19 @@ local HeroIcon = require('Module:HeroIcon')
local Table = require('Module:Table')
local String = require('Module:StringUtils')
local Array = require('Module:Array')
-local VodLink = require('Module:VodLink')
local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper', {requireDevIfEnabled = true})
-local MatchGroupUtil = Lua.import('Module:MatchGroup/Util', {requireDevIfEnabled = true})
-local MatchSummary = Lua.import('Module:MatchSummary/Base', {requireDevIfEnabled = true})
+local MatchSummary = Lua.import('Module:MatchSummary/Base/temp', {requireDevIfEnabled = true})
local Opponent = Lua.import('Module:Opponent', {requireDevIfEnabled = true})
-local _MAX_NUM_BANS = 7
-local _NUM_HEROES_PICK_TEAM = 5
-local _NUM_HEROES_PICK_SOLO = 1
-local _SIZE_HERO = '57x32px'
-local _GREEN_CHECK = '[[File:GreenCheck.png|14x14px|link=]]'
-local _NO_CHECK = '[[File:NoCheck.png|link=]]'
+local MAX_NUM_BANS = 7
+local NUM_HEROES_PICK_TEAM = 5
+local NUM_HEROES_PICK_SOLO = 1
+local SIZE_HERO = '57x32px'
+local GREEN_CHECK = '[[File:GreenCheck.png|14x14px|link=]]'
+local NO_CHECK = '[[File:NoCheck.png|link=]]'
-- Normal links, from input/lpdb
-local _LINK_DATA = {
+local LINK_DATA = {
vod = {icon = 'File:VOD Icon.png', text = 'Watch VOD'},
preview = {icon = 'File:Preview Icon32.png', text = 'Preview'},
lrthread = {icon = 'File:LiveReport32.png', text = 'Live Report Thread'},
@@ -38,7 +36,7 @@ local _LINK_DATA = {
faceit = {icon = 'File:FACEIT-icon.png', text = 'FACEIT match room'},
}
-- Auto generated links from Publisher ID
-local _AUTO_LINKS = {
+local AUTO_LINKS = {
{icon = 'File:DOTABUFF-icon.png', url = 'https://www.dotabuff.com/matches/', name = 'DOTABUFF'},
{icon = 'File:DatDota-icon.png', url = 'https://www.datdota.com/matches/', name = 'datDota'},
{
@@ -49,10 +47,14 @@ local _AUTO_LINKS = {
},
}
-local _EPOCH_TIME = '1970-01-01 00:00:00'
-local _EPOCH_TIME_EXTENDED = '1970-01-01T00:00:00+00:00'
+local EPOCH_TIME = '1970-01-01 00:00:00'
+local EPOCH_TIME_EXTENDED = '1970-01-01T00:00:00+00:00'
-- Hero Ban Class
+---@class DotaHeroBan: MatchSummaryRowInterface
+---@operator call: DotaHeroBan
+---@field root Html
+---@field table Html
local HeroBan = Class.new(
function(self)
self.root = mw.html.create('div'):addClass('brkts-popup-mapveto')
@@ -62,6 +64,7 @@ local HeroBan = Class.new(
end
)
+---@return self
function HeroBan:createHeader()
self.table:tag('tr')
:tag('th'):css('width','35%'):wikitext(''):done()
@@ -70,6 +73,10 @@ function HeroBan:createHeader()
return self
end
+---@param banData {numberOfBans: integer, [1]: table, [2]: table}
+---@param gameNumber integer
+---@param numberOfBans integer
+---@return self
function HeroBan:banRow(banData, gameNumber, numberOfBans)
self.table:tag('tr')
:tag('td'):attr('rowspan', '2'):node(mw.html.create('div')
@@ -88,36 +95,23 @@ function HeroBan:banRow(banData, gameNumber, numberOfBans)
return self
end
+---@return Html
function HeroBan:create()
return self.root
end
-
+---@param args table
+---@return Html
function CustomMatchSummary.getByMatchId(args)
- local match = MatchGroupUtil.fetchMatchForBracketDisplay(args.bracketId, args.matchId)
-
- local matchSummary = MatchSummary():init('400px')
-
- matchSummary:header(CustomMatchSummary._createHeader(match))
- :body(CustomMatchSummary._createBody(match))
-
- if match.comment then
- local comment = MatchSummary.Comment():content(match.comment)
- matchSummary:comment(comment)
- end
+ return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px'})
+end
- local vods = {}
- local publisherids = {}
- for index, game in ipairs(match.games) do
- if not Logic.isEmpty(game.vod) then
- vods[index] = game.vod
- end
- if not String.isEmpty(game.extradata.publisherid) then
- publisherids[index] = game.extradata.publisherid
- end
- end
+---@param match MatchGroupUtilMatch
+---@param footer MatchSummaryFooter
+---@return MatchSummaryFooter
+function CustomMatchSummary.addToFooter(match, footer)
+ footer = MatchSummary.addVodsToFooter(match, footer)
- match.links.vod = match.vod
if
Logic.readBool(match.extradata.headtohead) and
match.opponents[1].type == Opponent.team and
@@ -128,49 +122,29 @@ function CustomMatchSummary.getByMatchId(args)
'?pfRunQueryFormName=Match+history&Head_to_head_query%5Bplayer%5D=' .. team1 ..
'&Head_to_head_query%5Bopponent%5D=' .. team2 .. '&wpRunQuery=Run+query'
end
- if not Table.isEmpty(vods) or not Table.isEmpty(publisherids) or not Table.isEmpty(match.links) then
- local footer = MatchSummary.Footer()
-
- -- Game Vods
- for index, vod in pairs(vods) do
- footer:addElement(VodLink.display{
- gamenum = index,
- vod = vod,
- source = vod.url
- })
- end
-
- for _, site in ipairs(_AUTO_LINKS) do
- for index, publisherid in pairs(publisherids) do
- local link = site.url .. publisherid
- local text = 'Game '..index..' on '.. site.name
- footer:addLink(link, site.icon, site.iconDark, text)
- end
- end
-
- footer:addLinks(_LINK_DATA, match.links)
-
- matchSummary:footer(footer)
- end
- return matchSummary:create()
-end
+ local publisherIds = {}
+ Array.forEach(match.games, function(game, gameIndex)
+ publisherIds[gameIndex] = Logic.emptyOr(game.extradata.publisherid)
+ end)
-function CustomMatchSummary._createHeader(match)
- local header = MatchSummary.Header()
-
- header:leftOpponent(header:createOpponent(match.opponents[1], 'left', 'bracket'))
- :leftScore(header:createScore(match.opponents[1]))
- :rightScore(header:createScore(match.opponents[2]))
- :rightOpponent(header:createOpponent(match.opponents[2], 'right', 'bracket'))
+ Array.forEach(AUTO_LINKS, function(siteData)
+ for index, publisherId in pairs(publisherIds) do
+ local link = siteData.url .. publisherId
+ local text = 'Game ' .. index .. ' on ' .. siteData.name
+ footer:addLink(link, siteData.icon, siteData.iconDark, text)
+ end
+ end)
- return header
+ return footer:addLinks(LINK_DATA, match.links)
end
-function CustomMatchSummary._createBody(match)
+---@param match MatchGroupUtilMatch
+---@return MatchSummaryBody
+function CustomMatchSummary.createBody(match)
local body = MatchSummary.Body()
- if match.dateIsExact or (match.date ~= _EPOCH_TIME_EXTENDED and match.date ~= _EPOCH_TIME) then
+ if match.dateIsExact or (match.date ~= EPOCH_TIME_EXTENDED and match.date ~= EPOCH_TIME) then
-- dateIsExact means we have both date and time. Show countdown
-- if match is not epoch=0, we have a date, so display the date
body:addRow(MatchSummary.Row():addElement(
@@ -202,10 +176,10 @@ function CustomMatchSummary._createBody(match)
-- Pre-Process Hero Ban Data
local showGameBans = {}
for gameIndex, game in ipairs(match.games) do
- local extradata = game.extradata
+ local extradata = game.extradata or {}
local banData = {{}, {}}
local numberOfBans = 0
- for index = 1, _MAX_NUM_BANS do
+ for index = 1, MAX_NUM_BANS do
if String.isNotEmpty(extradata['team1ban' .. index]) then
numberOfBans = index
banData[1][index] = extradata['team1ban' .. index]
@@ -241,13 +215,16 @@ function CustomMatchSummary._createBody(match)
return body
end
+---@param game MatchGroupUtilGame
+---@param gameIndex integer
+---@return MatchSummaryRow
function CustomMatchSummary._createGame(game, gameIndex)
local row = MatchSummary.Row()
local extradata = game.extradata or {}
- local numberOfHeroes = _NUM_HEROES_PICK_TEAM
+ local numberOfHeroes = NUM_HEROES_PICK_TEAM
if game.mode == Opponent.solo then
- numberOfHeroes = _NUM_HEROES_PICK_SOLO
+ numberOfHeroes = NUM_HEROES_PICK_SOLO
end
local heroesData = {{}, {}}
for heroIndex = 1, numberOfHeroes do
@@ -270,8 +247,8 @@ function CustomMatchSummary._createGame(game, gameIndex)
row:addElement(mw.html.create('div')
:addClass('brkts-popup-body-element-vertical-centered')
:wikitext(CustomMatchSummary._createAbbreviation{
- title = String.isEmpty(game.length) and ('Game ' .. gameIndex .. ' picks') or 'Match Length',
- text = String.isEmpty(game.length) and ('Game ' .. gameIndex) or game.length,
+ title = Logic.isEmpty(game.length) and ('Game ' .. gameIndex .. ' picks') or 'Match Length',
+ text = Logic.isEmpty(game.length) and ('Game ' .. gameIndex) or game.length,
})
)
row:addElement(CustomMatchSummary._createCheckMark(game.winner == 2))
@@ -289,6 +266,8 @@ function CustomMatchSummary._createGame(game, gameIndex)
return row
end
+---@param isWinner boolean?
+---@return Html
function CustomMatchSummary._createCheckMark(isWinner)
local container = mw.html.create('div')
:addClass('brkts-popup-spaced')
@@ -297,18 +276,25 @@ function CustomMatchSummary._createCheckMark(isWinner)
:css('margin-right', '1%')
if Logic.readBool(isWinner) then
- container:node(_GREEN_CHECK)
+ container:node(GREEN_CHECK)
else
- container:node(_NO_CHECK)
+ container:node(NO_CHECK)
end
return container
end
+---@param args table
+---@return string
function CustomMatchSummary._createAbbreviation(args)
return '' .. args.text .. ''
end
+---@param opponentHeroesData table
+---@param numberOfHeroes integer
+---@param flip boolean?
+---@param isBan boolean?
+---@return Html
function CustomMatchSummary._opponentHeroesDisplay(opponentHeroesData, numberOfHeroes, flip, isBan)
local opponentHeroesDisplay = {}
local color = opponentHeroesData.side or ''
@@ -320,9 +306,9 @@ function CustomMatchSummary._opponentHeroesDisplay(opponentHeroesData, numberOfH
:addClass('brkts-popup-side-hero-hover')
:node(HeroIcon._getImage{
hero = opponentHeroesData[index],
- size = _SIZE_HERO,
+ size = SIZE_HERO,
})
- if numberOfHeroes == _NUM_HEROES_PICK_SOLO then
+ if numberOfHeroes == NUM_HEROES_PICK_SOLO then
if flip then
heroDisplay:css('margin-right', '70px')
else
diff --git a/components/match2/wikis/leagueoflegends/match_summary.lua b/components/match2/wikis/leagueoflegends/match_summary.lua
index d27cc961588..46c7b39c4c2 100644
--- a/components/match2/wikis/leagueoflegends/match_summary.lua
+++ b/components/match2/wikis/leagueoflegends/match_summary.lua
@@ -8,30 +8,33 @@
local CustomMatchSummary = {}
+local Array = require('Module:Array')
local Class = require('Module:Class')
local DateExt = require('Module:Date/Ext')
+local HeroIcon = require('Module:ChampionIcon')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
-local HeroIcon = require('Module:ChampionIcon')
local MatchLinks = mw.loadData('Module:MatchLinks')
-local Table = require('Module:Table')
local String = require('Module:StringUtils')
-local Array = require('Module:Array')
-local VodLink = require('Module:VodLink')
+local Table = require('Module:Table')
local BigMatch = Lua.import('Module:BigMatch', {requireDevIfEnabled = true})
local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper', {requireDevIfEnabled = true})
-local MatchGroupUtil = Lua.import('Module:MatchGroup/Util', {requireDevIfEnabled = true})
-local MatchSummary = Lua.import('Module:MatchSummary/Base', {requireDevIfEnabled = true})
+local MatchSummary = Lua.import('Module:MatchSummary/Base/temp', {requireDevIfEnabled = true})
local Opponent = Lua.import('Module:Opponent', {requireDevIfEnabled = true})
-local _MAX_NUM_BANS = 7
-local _NUM_HEROES_PICK_TEAM = 5
-local _NUM_HEROES_PICK_SOLO = 1
-local _GREEN_CHECK = '[[File:GreenCheck.png|14x14px|link=]]'
-local _NO_CHECK = '[[File:NoCheck.png|link=]]'
+local MAX_NUM_BANS = 7
+local NUM_HEROES_PICK_TEAM = 5
+local NUM_HEROES_PICK_SOLO = 1
+local GREEN_CHECK = '[[File:GreenCheck.png|14x14px|link=]]'
+local NO_CHECK = '[[File:NoCheck.png|link=]]'
-- Hero Ban Class
+---@class LeagueoOfLegendsHeroBan: MatchSummaryRowInterface
+---@operator call: LeagueoOfLegendsHeroBan
+---@field root Html
+---@field table Html
+---@field date string
local HeroBan = Class.new(
function(self, date)
self.root = mw.html.create('div'):addClass('brkts-popup-mapveto')
@@ -42,6 +45,7 @@ local HeroBan = Class.new(
end
)
+---@return self
function HeroBan:createHeader()
self.table:tag('tr')
:tag('th'):css('width', '40%'):wikitext(''):done()
@@ -50,6 +54,10 @@ function HeroBan:createHeader()
return self
end
+---@param banData {numberOfBans: integer, [1]: table, [2]: table}
+---@param gameNumber integer
+---@param numberOfBans integer
+---@return self
function HeroBan:banRow(banData, gameNumber, numberOfBans)
self.table:tag('tr')
:tag('td'):css('float', 'left')
@@ -65,75 +73,29 @@ function HeroBan:banRow(banData, gameNumber, numberOfBans)
return self
end
+---@return Html
function HeroBan:create()
return self.root
end
-
+---@param args table
+---@return Html
function CustomMatchSummary.getByMatchId(args)
- local match = MatchGroupUtil.fetchMatchForBracketDisplay(args.bracketId, args.matchId)
-
- local matchSummary = MatchSummary():init('400px')
-
- matchSummary:header(CustomMatchSummary._createHeader(match))
- :body(CustomMatchSummary._createBody(match))
-
- if match.comment then
- local comment = MatchSummary.Comment():content(match.comment)
- matchSummary:comment(comment)
- end
-
- local vods = {}
- for index, game in ipairs(match.games) do
- if not Logic.isEmpty(game.vod) then
- vods[index] = game.vod
- end
- end
- match.links.vod = match.vod
-
- if not Table.isEmpty(vods) or not Table.isEmpty(match.links) then
- local footer = MatchSummary.Footer()
-
- -- Match Vod + other links
- local buildLink = function (link, icon, text)
- return '[[File:'..icon..'|link='..link..'|15px|'..text..']]'
- end
-
- for linkType, link in pairs(match.links) do
- if not MatchLinks[linkType] then
- mw.log('Unknown link: ' .. linkType)
- else
- footer:addElement(buildLink(link, MatchLinks[linkType].icon, MatchLinks[linkType].text))
- end
- end
-
- -- Game Vods
- for index, vod in pairs(vods) do
- footer:addElement(VodLink.display{
- gamenum = index,
- vod = vod,
- source = vod.url
- })
- end
-
- matchSummary:footer(footer)
- end
-
- return matchSummary:create()
+ return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px'})
end
-function CustomMatchSummary._createHeader(match)
- local header = MatchSummary.Header()
-
- header:leftOpponent(header:createOpponent(match.opponents[1], 'left', 'bracket'))
- :leftScore(header:createScore(match.opponents[1]))
- :rightScore(header:createScore(match.opponents[2]))
- :rightOpponent(header:createOpponent(match.opponents[2], 'right', 'bracket'))
+---@param match MatchGroupUtilMatch
+---@param footer MatchSummaryFooter
+---@return MatchSummaryFooter
+function CustomMatchSummary.addToFooter(match, footer)
+ footer = MatchSummary.addVodsToFooter(match, footer)
- return header
+ return footer:addLinks(MatchLinks, match.links)
end
-function CustomMatchSummary._createBody(match)
+---@param match MatchGroupUtilMatch
+---@return MatchSummaryBody
+function CustomMatchSummary.createBody(match)
local body = MatchSummary.Body()
if match.dateIsExact or match.timestamp ~= DateExt.epochZero then
@@ -176,10 +138,10 @@ function CustomMatchSummary._createBody(match)
-- Pre-Process Hero Ban Data
local showGameBans = {}
for gameIndex, game in ipairs(match.games) do
- local extradata = game.extradata
+ local extradata = game.extradata or {}
local banData = {{}, {}}
local numberOfBans = 0
- for index = 1, _MAX_NUM_BANS do
+ for index = 1, MAX_NUM_BANS do
if String.isNotEmpty(extradata['team1ban' .. index]) then
numberOfBans = index
banData[1][index] = extradata['team1ban' .. index]
@@ -215,13 +177,17 @@ function CustomMatchSummary._createBody(match)
return body
end
+---@param game MatchGroupUtilGame
+---@param gameIndex integer
+---@param date string
+---@return MatchSummaryRow
function CustomMatchSummary._createGame(game, gameIndex, date)
local row = MatchSummary.Row()
local extradata = game.extradata or {}
- local numberOfHeroes = _NUM_HEROES_PICK_TEAM
+ local numberOfHeroes = NUM_HEROES_PICK_TEAM
if game.mode == Opponent.solo then
- numberOfHeroes = _NUM_HEROES_PICK_SOLO
+ numberOfHeroes = NUM_HEROES_PICK_SOLO
end
local heroesData = {{}, {}}
@@ -246,8 +212,8 @@ function CustomMatchSummary._createGame(game, gameIndex, date)
row:addElement(mw.html.create('div')
:addClass('brkts-popup-body-element-vertical-centered')
:wikitext(CustomMatchSummary._createAbbreviation{
- title = String.isEmpty(game.length) and ('Game ' .. gameIndex .. ' picks') or 'Match Length',
- text = String.isEmpty(game.length) and ('Game ' .. gameIndex) or game.length,
+ title = Logic.isEmpty(game.length) and ('Game ' .. gameIndex .. ' picks') or 'Match Length',
+ text = Logic.isEmpty(game.length) and ('Game ' .. gameIndex) or game.length,
})
)
row:addElement(CustomMatchSummary._createCheckMark(game.winner == 2))
@@ -265,6 +231,8 @@ function CustomMatchSummary._createGame(game, gameIndex, date)
return row
end
+---@param isWinner boolean?
+---@return Html
function CustomMatchSummary._createCheckMark(isWinner)
local container = mw.html.create('div')
:addClass('brkts-popup-body-element-vertical-centered')
@@ -273,18 +241,25 @@ function CustomMatchSummary._createCheckMark(isWinner)
:css('margin-right', '1%')
if Logic.readBool(isWinner) then
- container:node(_GREEN_CHECK)
+ container:node(GREEN_CHECK)
else
- container:node(_NO_CHECK)
+ container:node(NO_CHECK)
end
return container
end
+---@param args table
+---@return string
function CustomMatchSummary._createAbbreviation(args)
return '' .. args.text .. ''
end
+---@param opponentHeroesData table
+---@param numberOfHeroes integer
+---@param flip boolean?
+---@param date string
+---@return Html
function CustomMatchSummary._opponentHeroesDisplay(opponentHeroesData, numberOfHeroes, flip, date)
local opponentHeroesDisplay = {}
local color = opponentHeroesData.side or ''
@@ -293,7 +268,7 @@ function CustomMatchSummary._opponentHeroesDisplay(opponentHeroesData, numberOfH
local heroDisplay = mw.html.create('div')
:addClass('brkts-popup-side-color-' .. color)
:node(HeroIcon._getImage{opponentHeroesData[index], date = date})
- if numberOfHeroes == _NUM_HEROES_PICK_SOLO then
+ if numberOfHeroes == NUM_HEROES_PICK_SOLO then
if flip then
heroDisplay:css('margin-right', '70px')
else
diff --git a/components/match2/wikis/splatoon/match_summary.lua b/components/match2/wikis/splatoon/match_summary.lua
index d4f97d7e400..c492c6b1978 100644
--- a/components/match2/wikis/splatoon/match_summary.lua
+++ b/components/match2/wikis/splatoon/match_summary.lua
@@ -16,12 +16,10 @@ local Lua = require('Module:Lua')
local MapTypeIcon = require('Module:MapType')
local String = require('Module:StringUtils')
local Table = require('Module:Table')
-local VodLink = require('Module:VodLink')
local WeaponIcon = require('Module:WeaponIcon')
local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper', {requireDevIfEnabled = true})
-local MatchGroupUtil = Lua.import('Module:MatchGroup/Util', {requireDevIfEnabled = true})
-local MatchSummary = Lua.import('Module:MatchSummary/Base', {requireDevIfEnabled = true})
+local MatchSummary = Lua.import('Module:MatchSummary/Base/temp', {requireDevIfEnabled = true})
local NUM_OPPONENTS = 2
local GREEN_CHECK = '[[File:GreenCheck.png|14x14px|link=]]'
@@ -37,6 +35,10 @@ local LINK_DATA = {
local NON_BREAKING_SPACE = ' '
-- Map Veto Class
+---@class SplatoonMapVeto: MatchSummaryRowInterface
+---@operator call: SplatoonMapVeto
+---@field root Html
+---@field table Html
local MapVeto = Class.new(
function(self)
self.root = mw.html.create('div'):addClass('brkts-popup-mapveto')
@@ -46,6 +48,7 @@ local MapVeto = Class.new(
end
)
+---@return self
function MapVeto:createHeader()
self.table:tag('tr')
:tag('th'):css('width','33%'):done()
@@ -54,6 +57,8 @@ function MapVeto:createHeader()
return self
end
+---@param firstVeto number?
+---@return self
function MapVeto:vetoStart(firstVeto)
local textLeft
local textCenter
@@ -72,6 +77,8 @@ function MapVeto:vetoStart(firstVeto)
return self
end
+---@param map string?
+---@return string
function MapVeto._displayMap(map)
if Logic.isEmpty(map) then
map = TBD
@@ -82,6 +89,8 @@ function MapVeto._displayMap(map)
return map
end
+---@param map string?
+---@return self
function MapVeto:addDecider(map)
map = MapVeto._displayMap(map)
local row = mw.html.create('tr'):addClass('brkts-popup-mapveto-vetoround')
@@ -94,6 +103,10 @@ function MapVeto:addDecider(map)
return self
end
+---@param vetotype string?
+---@param map1 string?
+---@param map2 string?
+---@return self
function MapVeto:addRound(vetotype, map1, map2)
map1 = MapVeto._displayMap(map1)
map2 = MapVeto._displayMap(map2)
@@ -123,6 +136,10 @@ function MapVeto:addRound(vetotype, map1, map2)
return self
end
+---@param row Html
+---@param styleClass string
+---@param vetoText string
+---@return self
function MapVeto:addColumnVetoType(row, styleClass, vetoText)
row:tag('td')
:tag('span')
@@ -132,79 +149,37 @@ function MapVeto:addColumnVetoType(row, styleClass, vetoText)
return self
end
+---@param row Html
+---@param map string
+---@return self
function MapVeto:addColumnVetoMap(row, map)
row:tag('td'):wikitext(map):done()
return self
end
+---@return Html
function MapVeto:create()
return self.root
end
-
+---@param args table
+---@return Html
function CustomMatchSummary.getByMatchId(args)
- local match = MatchGroupUtil.fetchMatchForBracketDisplay(args.bracketId, args.matchId)
-
- local matchSummary = MatchSummary():init('490px')
- matchSummary:header(CustomMatchSummary._createHeader(match))
- :body(CustomMatchSummary._createBody(match))
-
- if match.comment then
- local comment = MatchSummary.Comment():content(match.comment)
- matchSummary:comment(comment)
- end
-
- local vods = {}
- for index, game in ipairs(match.games) do
- if not Logic.isEmpty(game.vod) then
- vods[index] = game.vod
- end
- end
- match.links.vod = match.vod
-
- if not Table.isEmpty(vods) or not Table.isEmpty(match.links) then
- local footer = MatchSummary.Footer()
-
- -- Match Vod + other links
- local buildLink = function (link, icon, text)
- return '[['..icon..'|link='..link..'|15px|'..text..']]'
- end
-
- for linkType, link in pairs(match.links) do
- if not LINK_DATA[linkType] then
- mw.log('Unknown link: ' .. linkType)
- else
- footer:addElement(buildLink(link, LINK_DATA[linkType].icon, LINK_DATA[linkType].text))
- end
- end
-
- -- Game Vods
- for index, vod in pairs(vods) do
- footer:addElement(VodLink.display{
- gamenum = index,
- vod = vod,
- source = vod.url
- })
- end
-
- matchSummary:footer(footer)
- end
-
- return matchSummary:create()
+ return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '490px'})
end
-function CustomMatchSummary._createHeader(match)
- local header = MatchSummary.Header()
-
- header:leftOpponent(header:createOpponent(match.opponents[1], 'left', 'bracket'))
- :leftScore(header:createScore(match.opponents[1]))
- :rightScore(header:createScore(match.opponents[2]))
- :rightOpponent(header:createOpponent(match.opponents[2], 'right', 'bracket'))
+---@param match MatchGroupUtilMatch
+---@param footer MatchSummaryFooter
+---@return MatchSummaryFooter
+function CustomMatchSummary.addToFooter(match, footer)
+ footer = MatchSummary.addVodsToFooter(match, footer)
- return header
+ return footer:addLinks(LINK_DATA, match.links)
end
-function CustomMatchSummary._createBody(match)
+---@param match MatchGroupUtilMatch
+---@return MatchSummaryBody
+function CustomMatchSummary.createBody(match)
local body = MatchSummary.Body()
if match.dateIsExact or match.timestamp ~= DateExt.epochZero then
@@ -260,7 +235,9 @@ function CustomMatchSummary._createBody(match)
return body
end
-function CustomMatchSummary._createGame(game, gameIndex)
+---@param game MatchGroupUtilGame
+---@return MatchSummaryRow
+function CustomMatchSummary._createGame(game)
local row = MatchSummary.Row()
if Logic.isNotEmpty(game.header) then
@@ -329,6 +306,8 @@ function CustomMatchSummary._createGame(game, gameIndex)
return row
end
+---@param game MatchGroupUtilGame
+---@return string
function CustomMatchSummary._getMapDisplay(game)
local mapDisplay = '[[' .. game.map .. ']]'
@@ -339,6 +318,10 @@ function CustomMatchSummary._getMapDisplay(game)
return mapDisplay
end
+---@param game MatchGroupUtilGame
+---@param opponentIndex integer
+---@param flip boolean?
+---@return Html
function CustomMatchSummary._gameScore(game, opponentIndex, flip)
return mw.html.create('div')
:addClass('brkts-popup-body-element-vertical-centered')
@@ -349,6 +332,8 @@ function CustomMatchSummary._gameScore(game, opponentIndex, flip)
)
end
+---@param showIcon boolean?
+---@return Html
function CustomMatchSummary._createCheckMark(showIcon)
local container = mw.html.create('div')
:addClass('brkts-popup-body-element-vertical-centered')
@@ -364,6 +349,8 @@ function CustomMatchSummary._createCheckMark(showIcon)
return container
end
+---@param props {data: string[], flip: boolean, game: string}
+---@return Html
function CustomMatchSummary._opponentWeaponsDisplay(props)
local flip = props.flip