diff --git a/components/match2/commons/match_group_display_helper.lua b/components/match2/commons/match_group_display_helper.lua index 9d0ac82a390..82bb0532597 100644 --- a/components/match2/commons/match_group_display_helper.lua +++ b/components/match2/commons/match_group_display_helper.lua @@ -177,19 +177,16 @@ function DisplayHelper.Map(game, config) return mapText end ----@param score string|number|nil ----@param opponentIndex integer ----@param resultType string? ----@param walkover string? ----@param winner integer? +---@param opponent table +---@param status string? ---@return string -function DisplayHelper.MapScore(score, opponentIndex, resultType, walkover, winner) - if resultType == 'np' then +function DisplayHelper.MapScore(opponent, gameStatus) + if gameStatus == 'notplayed' then return '' - elseif resultType == 'default' then - return opponentIndex == winner and 'W' or string.upper(walkover or '') + elseif opponent.status and opponent.status ~= 'S' then + return opponent.status end - return score and tostring(score) or '' + return opponent.score and tostring(opponent.score) or '' end --[[ diff --git a/components/match2/wikis/arenafps/match_summary.lua b/components/match2/wikis/arenafps/match_summary.lua index cecaf3f0656..c5483da788f 100644 --- a/components/match2/wikis/arenafps/match_summary.lua +++ b/components/match2/wikis/arenafps/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/artifact/match_summary.lua b/components/match2/wikis/artifact/match_summary.lua index 22991d8ad85..7b9ce0c5871 100644 --- a/components/match2/wikis/artifact/match_summary.lua +++ b/components/match2/wikis/artifact/match_summary.lua @@ -54,7 +54,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) end local scoreOfOpponnent = function(opponentIndex) - return DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + return DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) end local scoreDisplay = (scoreOfOpponnent(1) or '') .. ' - ' .. (scoreOfOpponnent(2) or '') diff --git a/components/match2/wikis/battalion/match_summary.lua b/components/match2/wikis/battalion/match_summary.lua index be05d94053f..cf492abe717 100644 --- a/components/match2/wikis/battalion/match_summary.lua +++ b/components/match2/wikis/battalion/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/brawlstars/match_summary.lua b/components/match2/wikis/brawlstars/match_summary.lua index ec2eec9468d..f6c6dac296a 100644 --- a/components/match2/wikis/brawlstars/match_summary.lua +++ b/components/match2/wikis/brawlstars/match_summary.lua @@ -61,7 +61,7 @@ function CustomMatchSummary._createMapRow(game) bg = 'brkts-popup-side-color-' .. teamColor, }, MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/callofduty/match_summary.lua b/components/match2/wikis/callofduty/match_summary.lua index a42d82785af..72ec3c5a85d 100644 --- a/components/match2/wikis/callofduty/match_summary.lua +++ b/components/match2/wikis/callofduty/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/clashofclans/match_summary.lua b/components/match2/wikis/clashofclans/match_summary.lua index c97f7119632..09a29e10bc9 100644 --- a/components/match2/wikis/clashofclans/match_summary.lua +++ b/components/match2/wikis/clashofclans/match_summary.lua @@ -49,13 +49,7 @@ end function CustomMatchSummary._gameScore(game, opponentIndex) return mw.html.create('div') :css('width', '16px') - :wikitext(DisplayHelper.MapScore( - game.scores[opponentIndex], - opponentIndex, - game.resultType, - game.walkover, - game.winner - )) + :wikitext(DisplayHelper.MapScore(game.opponents[opponentIndex], game.status)) end function CustomMatchSummary._percentage(game, opponentIndex) diff --git a/components/match2/wikis/counterstrike/match_summary.lua b/components/match2/wikis/counterstrike/match_summary.lua index a3dc504f105..e37c99771f1 100644 --- a/components/match2/wikis/counterstrike/match_summary.lua +++ b/components/match2/wikis/counterstrike/match_summary.lua @@ -199,7 +199,7 @@ function CustomMatchSummary._createMap(game) end local function score(oppIdx) - return DisplayHelper.MapScore(game.scores[oppIdx], oppIdx, game.resultType, game.walkover, game.winner) + return DisplayHelper.MapScore(game.opponents[oppIdx], game.status) end -- Teams scores diff --git a/components/match2/wikis/criticalops/match_summary.lua b/components/match2/wikis/criticalops/match_summary.lua index 96b7a692911..b8cb578cd51 100644 --- a/components/match2/wikis/criticalops/match_summary.lua +++ b/components/match2/wikis/criticalops/match_summary.lua @@ -31,7 +31,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) end local function score(oppIdx) - return DisplayHelper.MapScore(game.scores[oppIdx], oppIdx, game.resultType, game.walkover, game.winner) + return DisplayHelper.MapScore(game.opponents[oppIdx], game.status) end -- Teams scores diff --git a/components/match2/wikis/crossfire/match_summary.lua b/components/match2/wikis/crossfire/match_summary.lua index 635350ceb03..e1de77b379a 100644 --- a/components/match2/wikis/crossfire/match_summary.lua +++ b/components/match2/wikis/crossfire/match_summary.lua @@ -32,7 +32,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/easportsfc/match_summary.lua b/components/match2/wikis/easportsfc/match_summary.lua index b685c74b005..231d65e8487 100644 --- a/components/match2/wikis/easportsfc/match_summary.lua +++ b/components/match2/wikis/easportsfc/match_summary.lua @@ -58,9 +58,9 @@ function CustomMatchSummary._createGame(game) css = {['font-size'] = '84%', padding = '4px'}, children = WidgetUtil.collect( MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 1}, - DisplayHelper.MapScore(game.scores[1], 2, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[1], game.status), MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game)}, - DisplayHelper.MapScore(game.scores[2], 2, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[2], game.status), MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 2}, MatchSummaryWidgets.GameComment{children = game.comment} ) @@ -78,11 +78,11 @@ function CustomMatchSummary._createSubMatch(game, match) css = {['font-size'] = '84%', padding = '4px'}, children = WidgetUtil.collect( CustomMatchSummary._players(players[1], 1, game.winner), - DisplayHelper.MapScore(game.scores[1], 2, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[1], game.status), CustomMatchSummary._score(CustomMatchSummary._subMatchPenaltyScore(game, 1)), MatchSummaryWidgets.GameCenter{children = ' vs '}, CustomMatchSummary._score(CustomMatchSummary._subMatchPenaltyScore(game, 2)), - DisplayHelper.MapScore(game.scores[2], 2, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[2], game.status), CustomMatchSummary._players(players[2], 2, game.winner), MatchSummaryWidgets.GameComment{children = game.comment} ) diff --git a/components/match2/wikis/geoguessr/match_summary.lua b/components/match2/wikis/geoguessr/match_summary.lua index aa3128511d0..ebad3b8f4c5 100644 --- a/components/match2/wikis/geoguessr/match_summary.lua +++ b/components/match2/wikis/geoguessr/match_summary.lua @@ -21,15 +21,6 @@ function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args) end ----@param game MatchGroupUtilGame ----@param opponentIndex integer ----@return Html -function CustomMatchSummary._gameScore(game, opponentIndex) - local score = game.scores[opponentIndex] - local scoreDisplay = DisplayHelper.MapScore(score, opponentIndex, game.resultType, game.walkover, game.winner) - return mw.html.create('div'):wikitext(scoreDisplay) -end - ---@param date string ---@param game MatchGroupUtilGame ---@param gameIndex integer @@ -38,7 +29,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/goals/match_summary.lua b/components/match2/wikis/goals/match_summary.lua index 35376ab103b..4bfda21040d 100644 --- a/components/match2/wikis/goals/match_summary.lua +++ b/components/match2/wikis/goals/match_summary.lua @@ -31,9 +31,9 @@ function CustomMatchSummary.createGame(date, game, gameIndex) css = {['font-size'] = '80%', padding = '4px'}, children = WidgetUtil.collect( MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 1}, - DisplayHelper.MapScore(game.scores[1], 1, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[1], game.status), MatchSummaryWidgets.GameCenter{children = ('Game ' .. gameIndex)}, - DisplayHelper.MapScore(game.scores[2], 2, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[2], game.status), MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 2}, MatchSummaryWidgets.GameComment{children = game.comment} ) diff --git a/components/match2/wikis/halo/match_summary.lua b/components/match2/wikis/halo/match_summary.lua index 557a5efd304..ffab6b4e662 100644 --- a/components/match2/wikis/halo/match_summary.lua +++ b/components/match2/wikis/halo/match_summary.lua @@ -31,13 +31,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) end local displayScore = function(opponentIndex) - local score = DisplayHelper.MapScore( - game.scores[opponentIndex], - opponentIndex, - game.resultType, - game.walkover, - game.winner - ) + local score = DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) local points = game.extradata['points' .. opponentIndex] if not points then return score diff --git a/components/match2/wikis/marvelrivals/match_summary.lua b/components/match2/wikis/marvelrivals/match_summary.lua index b27fa09f5a5..715e3d0f52f 100644 --- a/components/match2/wikis/marvelrivals/match_summary.lua +++ b/components/match2/wikis/marvelrivals/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/omegastrikers/match_summary.lua b/components/match2/wikis/omegastrikers/match_summary.lua index 450f1423894..5d78493db17 100644 --- a/components/match2/wikis/omegastrikers/match_summary.lua +++ b/components/match2/wikis/omegastrikers/match_summary.lua @@ -57,7 +57,7 @@ function CustomMatchSummary._createMapRow(game) bg = opponentIndex == 1 and 'brkts-popup-side-color-blue' or 'brkts-popup-side-color-red', }, MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/osu/match_summary.lua b/components/match2/wikis/osu/match_summary.lua index f88b6178b02..11384cee089 100644 --- a/components/match2/wikis/osu/match_summary.lua +++ b/components/match2/wikis/osu/match_summary.lua @@ -60,7 +60,7 @@ function CustomMatchSummary._createMapRow(game) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, displayNumericScore( - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) ) } end diff --git a/components/match2/wikis/overwatch/match_summary.lua b/components/match2/wikis/overwatch/match_summary.lua index 2555fce56aa..6c44c82b72a 100644 --- a/components/match2/wikis/overwatch/match_summary.lua +++ b/components/match2/wikis/overwatch/match_summary.lua @@ -7,6 +7,7 @@ -- local Lua = require('Module:Lua') +local Table = require('Module:Table') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -52,11 +53,12 @@ end ---@param opponentIndex integer ---@return Html function CustomMatchSummary._gameScore(game, opponentIndex) - local score = game.scores[opponentIndex] --[[@as number|string?]] - if score and game.mode == 'Push' then - score = score .. 'm' + local opponentCopy = Table.deepCopy(game.opponents[opponentIndex]) + if opponentCopy.score and game.mode == 'Push' then + opponentCopy.score = opponentCopy.score .. 'm' end - local scoreDisplay = DisplayHelper.MapScore(score, opponentIndex, game.resultType, game.walkover, game.winner) + + local scoreDisplay = DisplayHelper.MapScore(opponentCopy, game.status) return mw.html.create('div'):wikitext(scoreDisplay) end diff --git a/components/match2/wikis/paladins/match_summary.lua b/components/match2/wikis/paladins/match_summary.lua index a99187275d4..4011d976c4f 100644 --- a/components/match2/wikis/paladins/match_summary.lua +++ b/components/match2/wikis/paladins/match_summary.lua @@ -43,7 +43,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, MatchSummaryWidgets.Characters{characters = characterData[opponentIndex], flipped = flipped}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status), } end diff --git a/components/match2/wikis/rainbowsix/match_summary.lua b/components/match2/wikis/rainbowsix/match_summary.lua index 0982d4be597..4502b47d02d 100644 --- a/components/match2/wikis/rainbowsix/match_summary.lua +++ b/components/match2/wikis/rainbowsix/match_summary.lua @@ -41,7 +41,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local extradata = game.extradata or {} local function scoreDisplay(oppIdx) - return DisplayHelper.MapScore(game.scores[oppIdx], oppIdx, game.resultType, game.walkover, game.winner) + return DisplayHelper.MapScore(game.opponents[oppIdx], game.status) end local function operatorDisplay(operators) diff --git a/components/match2/wikis/rocketleague/match_summary.lua b/components/match2/wikis/rocketleague/match_summary.lua index 36773b6e3f8..f1dd42802e0 100644 --- a/components/match2/wikis/rocketleague/match_summary.lua +++ b/components/match2/wikis/rocketleague/match_summary.lua @@ -205,7 +205,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status), MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, } end diff --git a/components/match2/wikis/sideswipe/match_summary.lua b/components/match2/wikis/sideswipe/match_summary.lua index fb2338e5c38..928460d5960 100644 --- a/components/match2/wikis/sideswipe/match_summary.lua +++ b/components/match2/wikis/sideswipe/match_summary.lua @@ -173,7 +173,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner), + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status), MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, } end diff --git a/components/match2/wikis/splatoon/match_summary.lua b/components/match2/wikis/splatoon/match_summary.lua index 05d5089ba46..9e9f97c1c68 100644 --- a/components/match2/wikis/splatoon/match_summary.lua +++ b/components/match2/wikis/splatoon/match_summary.lua @@ -13,6 +13,7 @@ local Lua = require('Module:Lua') local MapTypeIcon = require('Module:MapType') local Operator = require('Module:Operator') local String = require('Module:StringUtils') +local Table = require('Module:Table') local WeaponIcon = require('Module:WeaponIcon') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') @@ -77,11 +78,11 @@ end ---@param opponentIndex integer ---@return Html function CustomMatchSummary._gameScore(game, opponentIndex) - local score = game.scores[opponentIndex] --[[@as number|string?]] - if score and game.mode == 'Turf War' then - score = score .. '%' + local opponentCopy = Table.deepCopy(game.opponents[opponentIndex]) + if opponentCopy.score and game.mode == 'Turf War' then + opponentCopy.score = opponentCopy.score .. '%' end - local scoreDisplay = DisplayHelper.MapScore(score, opponentIndex, game.resultType, game.walkover, game.winner) + local scoreDisplay = DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) return mw.html.create('div') :addClass('brkts-popup-body-element-vertical-centered') :css('min-width', '24px') diff --git a/components/match2/wikis/splitgate/match_summary.lua b/components/match2/wikis/splitgate/match_summary.lua index e88761ad0e6..98c23cc54b0 100644 --- a/components/match2/wikis/splitgate/match_summary.lua +++ b/components/match2/wikis/splitgate/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/teamfortress/match_summary.lua b/components/match2/wikis/teamfortress/match_summary.lua index bf3b614952e..936469cbf9e 100644 --- a/components/match2/wikis/teamfortress/match_summary.lua +++ b/components/match2/wikis/teamfortress/match_summary.lua @@ -29,7 +29,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/tetris/match_summary.lua b/components/match2/wikis/tetris/match_summary.lua index 98b994a806f..30cca3b24be 100644 --- a/components/match2/wikis/tetris/match_summary.lua +++ b/components/match2/wikis/tetris/match_summary.lua @@ -29,7 +29,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/tft/match_summary.lua b/components/match2/wikis/tft/match_summary.lua index c17ae163549..8f21c1ac8cd 100644 --- a/components/match2/wikis/tft/match_summary.lua +++ b/components/match2/wikis/tft/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end diff --git a/components/match2/wikis/trackmania/match_summary.lua b/components/match2/wikis/trackmania/match_summary.lua index 6e7857e9d4b..2f8a3c1d134 100644 --- a/components/match2/wikis/trackmania/match_summary.lua +++ b/components/match2/wikis/trackmania/match_summary.lua @@ -10,6 +10,7 @@ local Abbreviation = require('Module:Abbreviation') local Class = require('Module:Class') local Lua = require('Module:Lua') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') @@ -155,9 +156,11 @@ function CustomMatchSummary.createGame(date, game, gameIndex) classes = {'brkts-popup-body-game'}, children = WidgetUtil.collect( MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 1}, + DisplayHelper.MapScore(game.opponents[1], game.status), extradata.overtime and CustomMatchSummary._iconDisplay(OVERTIME, 'Overtime') or nil, - MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game)}, + MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game, {noLink = true})}, extradata.overtime and CustomMatchSummary._iconDisplay(OVERTIME, 'Overtime') or nil, + DisplayHelper.MapScore(game.opponents[2], game.status), MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 2}, MatchSummaryWidgets.GameComment{children = game.comment} ) @@ -168,10 +171,11 @@ end ---@param hoverText string|number|nil ---@return Html function CustomMatchSummary._iconDisplay(icon, hoverText) - return mw.html.create('div') - :addClass('brkts-popup-spaced') - :node(icon) - :attr('title', hoverText) + return HtmlWidgets.Div{ + classes = {'brkts-popup-spaced'}, + attributes = {title = hoverText}, + children = {icon}, + } end return CustomMatchSummary diff --git a/components/match2/wikis/valorant/match_summary.lua b/components/match2/wikis/valorant/match_summary.lua index db4d465fb5f..fe2ec19eb81 100644 --- a/components/match2/wikis/valorant/match_summary.lua +++ b/components/match2/wikis/valorant/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) end local function scoreDisplay(oppIdx) - return DisplayHelper.MapScore(game.scores[oppIdx], oppIdx, game.resultType, game.walkover, game.winner) + return DisplayHelper.MapScore(game.opponents[oppIdx], game.status) end local function makePartialScores(halves, firstSide) diff --git a/components/match2/wikis/worldoftanks/match_summary.lua b/components/match2/wikis/worldoftanks/match_summary.lua index 5f44caea7a4..7f146af310d 100644 --- a/components/match2/wikis/worldoftanks/match_summary.lua +++ b/components/match2/wikis/worldoftanks/match_summary.lua @@ -33,7 +33,7 @@ function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end