From 78d93c7c67056c0c6f33364924f9970941deb0bc Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:35:15 +0700 Subject: [PATCH 1/7] feat(match2): Delta Force wiki-specific setup --- .../deltaforce/MatchGroup/Input/Custom.lua | 65 +++++++++++++++++-- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua b/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua index d1aeb41c537..36007978bf9 100644 --- a/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua +++ b/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua @@ -9,27 +9,36 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local FnUtil = Lua.import('Module:FnUtil') +local Logic = Lua.import('Module:Logic') local Operator = Lua.import('Module:Operator') +local Variables = Lua.import('Module:Variables') local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') +local DEFAULT_BESTOF = 3 +local SIDE_ALIASES = { + atk = 'ATK', + def = 'DEF', +} + local CustomMatchGroupInput = {} ----@class DeltaForceMatchParser: MatchParserInterface +---@class DeltaforceMatchParser: MatchParserInterface local MatchFunctions = { DEFAULT_MODE = 'team', - getBestOf = MatchGroupInputUtil.getBestOf, } ----@class DeltaForceMapParser: MapParserInterface -local MapFunctions = {} +---@class DeltaforceMapParser: MapParserInterface +local MapFunctions = { + BREAK_ON_EMPTY = true, +} ----@class DeltaForceFfaMatchParser: FfaMatchParserInterface +---@class DeltaforceFfaMatchParser: FfaMatchParserInterface local FfaMatchFunctions = { DEFAULT_MODE = 'team', } ----@class DeltaForceFfaMapParser: FfaMapParserInterface +---@class DeltaforceFfaMapParser: FfaMapParserInterface local FfaMapFunctions = {} ---@param match table @@ -47,12 +56,56 @@ function MatchFunctions.extractMaps(match, opponents) return MatchGroupInputUtil.standardProcessMaps(match, opponents, MapFunctions) end +---@param bestofInput string|integer? +---@return integer? +function MatchFunctions.getBestOf(bestofInput) + local bestof = tonumber(bestofInput) or tonumber(Variables.varDefault('bestof')) + + if bestof then + Variables.varDefine('bestof', bestof) + end + + return bestof +end + ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) return FnUtil.curry(MatchGroupInputUtil.computeMatchScoreFromMapWinners, maps) end +---@param match table +---@param games table[] +---@param opponents MGIParsedOpponent[] +---@return table +function MatchFunctions.getExtraData(match, games, opponents) + return { + mapveto = MatchGroupInputUtil.getMapVeto(match), + mvp = MatchGroupInputUtil.readMvp(match, opponents), + } +end + +-- Parse extradata information, particularally info about halfs and operator bans +---@param match table +---@param map table +---@param opponents MGIParsedOpponent[] +---@return table +function MapFunctions.getExtraData(match, map, opponents) + if Logic.isEmpty(map.team1side) then + return {} + end + + local t1side = map.team1side:upper() + + return t1side == 'ATK' and { + t1side = 'ATK', + t2side = 'DEF', + } or t1side == 'DEF' and { + t1side = 'DEF', + t2side = 'ATK', + } or error('Invalid side specified: "' .. map.team1side .. '"') +end + --- FFA Match ---@param match table From 577027a92a94b77d04c5cba3556a79d71044ef3d Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:37:49 +0700 Subject: [PATCH 2/7] Update MatchSummary.lua --- lua/wikis/deltaforce/MatchSummary.lua | 56 +++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/lua/wikis/deltaforce/MatchSummary.lua b/lua/wikis/deltaforce/MatchSummary.lua index 60911d3df58..647e3a4e67d 100644 --- a/lua/wikis/deltaforce/MatchSummary.lua +++ b/lua/wikis/deltaforce/MatchSummary.lua @@ -9,13 +9,27 @@ local Lua = require('Module:Lua') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') + +local Html = Lua.import('Module:Widget/Html') +local Image = Lua.import('Module:Widget/Image/Icon/Image') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') local WidgetUtil = Lua.import('Module:Widget/Util') +local SIDE_ICONS = { + ATK = { + light = 'DF Attacker icon lightmode.png', + dark = 'DF Attacker icon darkmode.png', + }, + DEF = { + light = 'DF Defender icon lightmode.png', + dark = 'DF Defender icon darkmode.png', + }, +} + local CustomMatchSummary = {} ---@param args table ----@return Widget +---@return Renderable function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args) end @@ -23,8 +37,10 @@ end ---@param date string ---@param game MatchGroupUtilGame ---@param gameIndex integer ----@return Widget? +---@return Renderable? function CustomMatchSummary.createGame(date, game, gameIndex) + ---@param opponentIndex integer + ---@return Renderable[] local function makeTeamSection(opponentIndex) return { MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, @@ -32,12 +48,44 @@ function CustomMatchSummary.createGame(date, game, gameIndex) } end + ---@param opponentIndex integer + ---@return Renderable[]? + local function sideIndicator(opponentIndex) + local iconData = SIDE_ICONS[game.extradata['t' .. opponentIndex .. 'side']] + if not iconData then return end + return { + Html.Span{ + classes = {'brkts-popup-spaced'}, + children = Image{ + imageLight = iconData.light, + imageDark = iconData.dark, + size = '16px', + } + }, + Html.Span{ + css = { + ['font-size'] = '8px', + ['font-weight'] = 'bold', + margin = '0 -2px', + ['white-space'] = 'nowrap', + }, + children = game.extradata['t' .. opponentIndex .. 'side'], + } + } + end + return MatchSummaryWidgets.Row{ classes = {'brkts-popup-body-game'}, children = WidgetUtil.collect( - MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(1)}, + MatchSummaryWidgets.GameTeamWrapper{children = WidgetUtil.collect( + makeTeamSection(1), + sideIndicator(1) + )}, MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game)}, - MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(2), flipped = true}, + MatchSummaryWidgets.GameTeamWrapper{children = WidgetUtil.collect( + makeTeamSection(2), + sideIndicator(2) + ), flipped = true}, MatchSummaryWidgets.GameComment{children = game.comment} ) } From 52379c77d15d916603b234386f982709f1559dd3 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:38:54 +0700 Subject: [PATCH 3/7] Copypaste update to include sides --- lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua index 2a5d831db7d..4d256b6f45b 100644 --- a/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua @@ -73,7 +73,7 @@ function WikiCopyPaste.getFfaMatchCode(bestof, mode, index, opponents, args) INDENT .. '|p_kill=1' .. INDENT .. '|twitch=|youtube=', Array.map(Array.range(1, bestof), function(mapIndex) - return INDENT .. '|map' .. mapIndex .. '={{Map|map=|date=|finished=|vod=}}' + return INDENT .. '|map' .. mapIndex .. '={{Map|map=|team1side=|team2side= |date=|finished=|vod=}}' end), Array.map(Array.range(1, opponents), function(opponentIndex) return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste.getFfaOpponent(mode, bestof) From fe87f3661ee3621524552ffbefdacc075cc03cfa Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Sun, 5 Jul 2026 19:19:38 +0700 Subject: [PATCH 4/7] Fix Copypaste --- lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua index 4d256b6f45b..998215dcb00 100644 --- a/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua @@ -53,7 +53,7 @@ function WikiCopyPaste.getStandardMatchCode(bestof, mode, index, opponents, args return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent end), bestof ~= 0 and Array.map(Array.range(1, bestof), function(mapIndex) - return INDENT .. '|map' .. mapIndex .. '={{Map|map=|score1=|score2=|winner=}}' + return INDENT .. '|map' .. mapIndex .. '={{Map|map=|team1side=|team2side= |date=|finished=|vod=}}' end) or nil, INDENT .. '}}' ) @@ -73,7 +73,7 @@ function WikiCopyPaste.getFfaMatchCode(bestof, mode, index, opponents, args) INDENT .. '|p_kill=1' .. INDENT .. '|twitch=|youtube=', Array.map(Array.range(1, bestof), function(mapIndex) - return INDENT .. '|map' .. mapIndex .. '={{Map|map=|team1side=|team2side= |date=|finished=|vod=}}' + return INDENT .. '|map' .. mapIndex .. '={{Map|map=|date=|finished=|vod=}}' end), Array.map(Array.range(1, opponents), function(opponentIndex) return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste.getFfaOpponent(mode, bestof) From 7eff6227d54480913633f1d651355ec3de81bdb0 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Sun, 5 Jul 2026 19:26:00 +0700 Subject: [PATCH 5/7] Various fixes --- lua/wikis/deltaforce/MatchGroup/Input/Custom.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua b/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua index 36007978bf9..b68dfb7aed8 100644 --- a/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua +++ b/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua @@ -16,10 +16,6 @@ local Variables = Lua.import('Module:Variables') local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') local DEFAULT_BESTOF = 3 -local SIDE_ALIASES = { - atk = 'ATK', - def = 'DEF', -} local CustomMatchGroupInput = {} @@ -57,15 +53,17 @@ function MatchFunctions.extractMaps(match, opponents) end ---@param bestofInput string|integer? +---@param games table[] ---@return integer? -function MatchFunctions.getBestOf(bestofInput) - local bestof = tonumber(bestofInput) or tonumber(Variables.varDefault('bestof')) +function MatchFunctions.getBestOf(bestofInput, games) + local bestof = tonumber(bestofInput) if bestof then Variables.varDefine('bestof', bestof) + return bestof end - return bestof + return tonumber(Variables.varDefault('bestof')) or (games and #games) or DEFAULT_BESTOF end ---@param maps table[] @@ -85,7 +83,7 @@ function MatchFunctions.getExtraData(match, games, opponents) } end --- Parse extradata information, particularally info about halfs and operator bans +-- Parse extradata information, particularly info about halfs and operator bans ---@param match table ---@param map table ---@param opponents MGIParsedOpponent[] From eeb0a29e0d486741a71f6d7973c5654f62046668 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Fri, 10 Jul 2026 22:26:04 +0700 Subject: [PATCH 6/7] Update Custom.lua --- lua/wikis/deltaforce/MatchGroup/Input/Custom.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua b/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua index b68dfb7aed8..ba057fb5b2c 100644 --- a/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua +++ b/lua/wikis/deltaforce/MatchGroup/Input/Custom.lua @@ -63,7 +63,7 @@ function MatchFunctions.getBestOf(bestofInput, games) return bestof end - return tonumber(Variables.varDefault('bestof')) or (games and #games) or DEFAULT_BESTOF + return tonumber(Variables.varDefault('bestof')) or ((games and #games > 0) and #games) or DEFAULT_BESTOF end ---@param maps table[] @@ -83,7 +83,7 @@ function MatchFunctions.getExtraData(match, games, opponents) } end --- Parse extradata information, particularly info about halfs and operator bans + -- Parse map-side extradata (Attack/Defense) for use in MatchSummary ---@param match table ---@param map table ---@param opponents MGIParsedOpponent[] @@ -101,7 +101,7 @@ function MapFunctions.getExtraData(match, map, opponents) } or t1side == 'DEF' and { t1side = 'DEF', t2side = 'ATK', - } or error('Invalid side specified: "' .. map.team1side .. '"') + } or error('Invalid side specified: "' .. map.team1side .. '" (expected ATK or DEF)') end --- FFA Match From 15230cfdc03aa3f46619a13b026d42b6e0ac3846 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Fri, 10 Jul 2026 22:27:16 +0700 Subject: [PATCH 7/7] Update wiki.lua --- lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua index 998215dcb00..48de5cdd652 100644 --- a/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deltaforce/GetMatchGroupCopyPaste/wiki.lua @@ -53,7 +53,7 @@ function WikiCopyPaste.getStandardMatchCode(bestof, mode, index, opponents, args return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent end), bestof ~= 0 and Array.map(Array.range(1, bestof), function(mapIndex) - return INDENT .. '|map' .. mapIndex .. '={{Map|map=|team1side=|team2side= |date=|finished=|vod=}}' + return INDENT .. '|map' .. mapIndex .. '={{Map|map=|team1side=|team2side=|winner=|vod=}}' end) or nil, INDENT .. '}}' )