From c89005b32e23deaff2b52e5478835613cd4ac590 Mon Sep 17 00:00:00 2001 From: Knoxider Date: Sat, 20 Jun 2026 00:15:30 +0500 Subject: [PATCH 1/6] Update MatchSummary.lua Adding global bans --- lua/wikis/brawlstars/MatchSummary.lua | 58 +++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/lua/wikis/brawlstars/MatchSummary.lua b/lua/wikis/brawlstars/MatchSummary.lua index 969a1124077..e9dc7c67b2f 100644 --- a/lua/wikis/brawlstars/MatchSummary.lua +++ b/lua/wikis/brawlstars/MatchSummary.lua @@ -1,4 +1,3 @@ ---- -- @Liquipedia -- page=Module:MatchSummary -- @@ -22,7 +21,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util') local CustomMatchSummary = {} ---@param args table ----@return Widget +---@return Html function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px', teamStyle = 'bracket'}) end @@ -30,17 +29,60 @@ end ---@param match MatchGroupUtilMatch ---@return Widget[] function CustomMatchSummary.createBody(match) - local characterBansData = Array.map(match.games, function (game) + + local characterBansData = {} + + if match.games[1] then + local extradata = match.games[1].extradata or {} + local bans = extradata.bans or {} + + if #((bans.global) or {}) > 0 then +local global = bans.global or {} + +local left = {} +local right = {} + +local split = math.ceil(#global / 2) + +for i, character in ipairs(global) do + if i <= split then + table.insert(left, character) + else + table.insert(right, character) + end +end + +table.insert(characterBansData,{ + left, + right, + label = 'Global Bans' +}) + end + end + + Array.forEach(match.games, function(game) local extradata = game.extradata or {} local bans = extradata.bans or {} - return {bans.team1 or {}, bans.team2 or {}} - end) + table.insert(characterBansData, { + bans.team1 or {}, + bans.team2 or {} + }) + end) +mw.logObject(characterBansData) return WidgetUtil.collect( Array.map(match.games, CustomMatchSummary._createMapRow), - MatchSummaryWidgets.Mvp(match.extradata.mvp), - MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto)), - MatchSummaryWidgets.CharacterBanTable{bans = characterBansData, date = match.date} + + MatchSummaryWidgets.MapVeto( + MatchSummary.preProcessMapVeto(match.extradata.mapveto) + ), + + MatchSummaryWidgets.CharacterBanTable{ + bans = characterBansData, + date = match.date + }, + + MatchSummaryWidgets.Mvp(match.extradata.mvp) ) end From 830e26a9ec7d25ea0683eb9e6128ddc062f3f731 Mon Sep 17 00:00:00 2001 From: Knoxider Date: Sat, 20 Jun 2026 13:42:03 +0500 Subject: [PATCH 2/6] Apply suggestion from @hjpalpha Co-authored-by: hjpalpha <75081997+hjpalpha@users.noreply.github.com> --- lua/wikis/brawlstars/MatchSummary.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/brawlstars/MatchSummary.lua b/lua/wikis/brawlstars/MatchSummary.lua index e9dc7c67b2f..aaca0885016 100644 --- a/lua/wikis/brawlstars/MatchSummary.lua +++ b/lua/wikis/brawlstars/MatchSummary.lua @@ -21,7 +21,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util') local CustomMatchSummary = {} ---@param args table ----@return Html +---@return Renderable function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px', teamStyle = 'bracket'}) end From b6aedb19ea4296aa7ebed9a36e3cd642e9cbefc2 Mon Sep 17 00:00:00 2001 From: Knoxider Date: Sat, 20 Jun 2026 14:07:14 +0500 Subject: [PATCH 3/6] Update MatchSummary.lua --- lua/wikis/brawlstars/MatchSummary.lua | 78 ++++++++------------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/lua/wikis/brawlstars/MatchSummary.lua b/lua/wikis/brawlstars/MatchSummary.lua index aaca0885016..f6375ece06e 100644 --- a/lua/wikis/brawlstars/MatchSummary.lua +++ b/lua/wikis/brawlstars/MatchSummary.lua @@ -1,3 +1,4 @@ +--- -- @Liquipedia -- page=Module:MatchSummary -- @@ -8,11 +9,12 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') +local Logic = Lua.import('Module:Logic') local MapTypeIcon = Lua.import('Module:MapType') local Operator = Lua.import('Module:Operator') local String = Lua.import('Module:StringUtils') -local HtmlWidgets = Lua.import('Module:Widget/Html/All') +local Html = Lua.import('Module:Widget/Html') local LinkWidget = Lua.import('Module:Widget/Basic/Link') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -27,67 +29,29 @@ function CustomMatchSummary.getByMatchId(args) end ---@param match MatchGroupUtilMatch ----@return Widget[] +---@return Renderable[] function CustomMatchSummary.createBody(match) + local globalBans = (match.extradata or {}).globalbans + local characterBansData = Array.extend( + Logic.isNotDeepEmpty(globalBans) and {globalBans.team1 or {}, globalBans.team2 or {}, label = 'Global Bans'} or nil, + Array.map(match.games, function(game, gameIndex) + local extradata = game.extradata or {} + local bans = extradata.bans or {} + if Logic.isDeepEmpty(bans) then return end + return {bans.team1 or {}, bans.team2 or {}, label = 'Game ' .. gameIndex} + end) + ) - local characterBansData = {} - - if match.games[1] then - local extradata = match.games[1].extradata or {} - local bans = extradata.bans or {} - - if #((bans.global) or {}) > 0 then -local global = bans.global or {} - -local left = {} -local right = {} - -local split = math.ceil(#global / 2) - -for i, character in ipairs(global) do - if i <= split then - table.insert(left, character) - else - table.insert(right, character) - end -end - -table.insert(characterBansData,{ - left, - right, - label = 'Global Bans' -}) - end - end - - Array.forEach(match.games, function(game) - local extradata = game.extradata or {} - local bans = extradata.bans or {} - - table.insert(characterBansData, { - bans.team1 or {}, - bans.team2 or {} - }) - end) -mw.logObject(characterBansData) return WidgetUtil.collect( Array.map(match.games, CustomMatchSummary._createMapRow), - - MatchSummaryWidgets.MapVeto( - MatchSummary.preProcessMapVeto(match.extradata.mapveto) - ), - - MatchSummaryWidgets.CharacterBanTable{ - bans = characterBansData, - date = match.date - }, - - MatchSummaryWidgets.Mvp(match.extradata.mvp) + MatchSummaryWidgets.Mvp(match.extradata.mvp), + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto)), + MatchSummaryWidgets.CharacterBanTable{bans = characterBansData, date = match.date} ) end ---@param game MatchGroupUtilGame ----@return Widget? +---@return Renderable? function CustomMatchSummary._createMapRow(game) if not game.map then return @@ -119,13 +83,13 @@ function CustomMatchSummary._createMapRow(game) end ---@param game MatchGroupUtilGame ----@return Widget +---@return Renderable function CustomMatchSummary._getMapDisplay(game) local mapDisplay = LinkWidget{link = game.map} - return HtmlWidgets.Fragment{children = WidgetUtil.collect( + return Html.Fragment{children = WidgetUtil.collect( String.isNotEmpty(game.extradata.maptype) and MapTypeIcon.display(game.extradata.maptype) or nil, - game.status == 'notplayed' and HtmlWidgets.S{children = mapDisplay} or mapDisplay + game.status == 'notplayed' and Html.S{children = mapDisplay} or mapDisplay )} end From 21477b8d047bcbb48a36d3a638e0fbcb20bedebf Mon Sep 17 00:00:00 2001 From: Knoxider Date: Sat, 20 Jun 2026 14:08:14 +0500 Subject: [PATCH 4/6] Update Custom.lua --- .../brawlstars/MatchGroup/Input/Custom.lua | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua b/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua index 1efec503f96..30a5b78e2ee 100644 --- a/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua +++ b/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua @@ -42,6 +42,24 @@ MatchFunctions.DATE_FALLBACKS = { local CustomMatchGroupInput = {} +---@param obj table #match or game +---@param numberOfOpponents integer +---@return {string[], string[]} +local getBans = function(obj, numberOfOpponents) + local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, BrawlerNames) + + local bans = {} + for opponentIndex = 1, numberOfOpponents do + bans['team' .. opponentIndex] = {} + for _, ban in Table.iter.pairsByPrefix(obj, 't' .. opponentIndex .. 'b') do + ban = getCharacterName(ban) + table.insert(bans['team' .. opponentIndex], ban) + end + end + + return bans +end + ---@param match table ---@param options table? ---@return table @@ -86,6 +104,7 @@ function MatchFunctions.getExtraData(match, games, opponents) return { mapveto = MatchGroupInputUtil.getMapVeto(match), mvp = MatchGroupInputUtil.readMvp(match, opponents), + globalbans = getBans(match, #opponents), } end @@ -106,25 +125,12 @@ end ---@param opponents MGIParsedOpponent[] ---@return table function MapFunctions.getExtraData(match, map, opponents) - local extradata = { + return { bestof = map.bestof, maptype = map.maptype, - firstpick = FIRST_PICK_CONVERSION[string.lower(map.firstpick or '')] + firstpick = FIRST_PICK_CONVERSION[string.lower(map.firstpick or '')], + bans = getBans(map, #opponents), } - - local bans = {} - local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, BrawlerNames) - for opponentIndex = 1, #opponents do - bans['team' .. opponentIndex] = {} - for _, ban in Table.iter.pairsByPrefix(map, 't' .. opponentIndex .. 'b') do - ban = getCharacterName(ban) - table.insert(bans['team' .. opponentIndex], ban) - end - end - - extradata.bans = bans - - return extradata end ---@param map table From 03a916c4739f72171aef1852e54962b4d8d8e971 Mon Sep 17 00:00:00 2001 From: Knoxider Date: Sat, 20 Jun 2026 14:08:59 +0500 Subject: [PATCH 5/6] Update CharacterBanTable.lua --- lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua b/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua index d301bb421e2..03d22865dab 100644 --- a/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua +++ b/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua @@ -29,7 +29,7 @@ local ICONS = { empty = Html.Span{}, } ----@param props {bans: {[1]: string[]?, [2]: string[]?, start: integer?}[], date: string?} +---@param props {bans: {[1]: string[]?, [2]: string[]?, start: integer?, label: string?}[], date: string?} ---@return VNode? local function MatchSummaryCharacterBanTable(props) if Logic.isDeepEmpty(props.bans) then @@ -70,7 +70,7 @@ local function MatchSummaryCharacterBanTable(props) classes = hasStartIndicator and {'brkts-popup-veto-row-indicator'} or nil, children = WidgetUtil.collect( hasStartIndicator and startIndicator(1, banData.start) or nil, - 'Game ' .. gameNumber, + banData.label or 'Game ' .. gameNumber, hasStartIndicator and startIndicator(2, banData.start) or nil ) }, From 5ad6c0cec0b45e2ad6252806cec2cd1cdc998656 Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Sat, 20 Jun 2026 11:13:30 +0200 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: hjpalpha <75081997+hjpalpha@users.noreply.github.com> --- lua/wikis/brawlstars/MatchGroup/Input/Custom.lua | 2 +- lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua b/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua index 30a5b78e2ee..836bd96d14c 100644 --- a/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua +++ b/lua/wikis/brawlstars/MatchGroup/Input/Custom.lua @@ -44,7 +44,7 @@ local CustomMatchGroupInput = {} ---@param obj table #match or game ---@param numberOfOpponents integer ----@return {string[], string[]} +---@return table local getBans = function(obj, numberOfOpponents) local getCharacterName = FnUtil.curry(MatchGroupInputUtil.getCharacterName, BrawlerNames) diff --git a/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua b/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua index 03d22865dab..8e084909acb 100644 --- a/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua +++ b/lua/wikis/commons/Widget/Match/Summary/CharacterBanTable.lua @@ -70,7 +70,7 @@ local function MatchSummaryCharacterBanTable(props) classes = hasStartIndicator and {'brkts-popup-veto-row-indicator'} or nil, children = WidgetUtil.collect( hasStartIndicator and startIndicator(1, banData.start) or nil, - banData.label or 'Game ' .. gameNumber, + banData.label or ('Game ' .. gameNumber), hasStartIndicator and startIndicator(2, banData.start) or nil ) },