From 238d63a431410b84f5be58296e23e4b4cbf8ee1e Mon Sep 17 00:00:00 2001 From: Corsaka Date: Mon, 31 Aug 2026 10:10:16 +0100 Subject: [PATCH 1/6] Reduce ban size to 2 By default, deadlock drafting only has 2 bans (and rarely, 3). 6 is excessive by default. --- lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua index fe04e833e7b..da5c887e79e 100644 --- a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua @@ -47,10 +47,10 @@ function WikiCopyPaste._getMapCode(mapIndex, bans) INDENT .. '|map' .. mapIndex .. '={{Map', INDENT .. INDENT .. '|team1side=', INDENT .. INDENT .. '|t1h1=|t1h2=|t1h3=|t1h4=|t1h5=|t1h6=', - bans and (INDENT .. INDENT .. '|t1b1=|t1b2=|t1b3=|t1b4=|t1b5=|t1b6=') or nil, + bans and (INDENT .. INDENT .. '|t1b1=|t1b2=') or nil, INDENT .. INDENT .. '|team2side=', INDENT .. INDENT .. '|t2h1=|t2h2=|t2h3=|t2h4=|t2h5=|t2h6=', - bans and (INDENT .. INDENT .. '|t2b1=|t2b2=|t2b3=|t2b4=|t2b5=|t2b6=') or nil, + bans and (INDENT .. INDENT .. '|t2b1=|t2b2=') or nil, INDENT .. INDENT .. '|length=|winner=|matchid=|vod=', INDENT .. '}}' ), '\n') From 0b4793f95f4d8bbff883e69b4accd447bf386559 Mon Sep 17 00:00:00 2001 From: Corsaka Date: Tue, 1 Sep 2026 18:38:23 +0100 Subject: [PATCH 2/6] feat(match2): customizable ban number in deadlock copypaste --- .../deadlock/GetMatchGroupCopyPaste/wiki.lua | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua index da5c887e79e..1d62b41bb1c 100644 --- a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua @@ -20,7 +20,7 @@ local INDENT = WikiCopyPaste.Indent function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) local showScore = Logic.nilOr(Logic.readBoolOrNil, bestof == 0) - local bans = Logic.readBool(args.bans) + local bans = args.bans local lines = Array.extend( '{{Match|bestof=' .. (bestof ~= 0 and bestof or ''), @@ -40,20 +40,32 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) end ---@param mapIndex integer ----@param bans boolean +---@param bans integer ---@return string function WikiCopyPaste._getMapCode(mapIndex, bans) + banBool = true + ban1Text = "" + ban2Text = "" + if bans == 0 then + banBool = false + else + for ban = 1, bans do + ban1Text = ban1Text .. "|t1b" .. ban .. "=" + ban2Text = ban2Text .. "|t2b" .. ban .. "=" + end + end return table.concat(Array.extend( INDENT .. '|map' .. mapIndex .. '={{Map', INDENT .. INDENT .. '|team1side=', INDENT .. INDENT .. '|t1h1=|t1h2=|t1h3=|t1h4=|t1h5=|t1h6=', - bans and (INDENT .. INDENT .. '|t1b1=|t1b2=') or nil, + banBool and (INDENT .. INDENT .. ban1Text) or nil, INDENT .. INDENT .. '|team2side=', INDENT .. INDENT .. '|t2h1=|t2h2=|t2h3=|t2h4=|t2h5=|t2h6=', - bans and (INDENT .. INDENT .. '|t2b1=|t2b2=') or nil, + banBool and (INDENT .. INDENT .. ban2Text) or nil, INDENT .. INDENT .. '|length=|winner=|matchid=|vod=', INDENT .. '}}' ), '\n') end return WikiCopyPaste + From 504e8c7a5f714acc38b960da39a9cf1f60bcb474 Mon Sep 17 00:00:00 2001 From: Corsaka Date: Tue, 1 Sep 2026 18:48:11 +0100 Subject: [PATCH 3/6] @Corsaka feat(match2): fix zero case in deadlock copypaste --- lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua index 1d62b41bb1c..2d194ad5021 100644 --- a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua @@ -20,7 +20,7 @@ local INDENT = WikiCopyPaste.Indent function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) local showScore = Logic.nilOr(Logic.readBoolOrNil, bestof == 0) - local bans = args.bans + local bans = tonumber(args.bans) local lines = Array.extend( '{{Match|bestof=' .. (bestof ~= 0 and bestof or ''), @@ -43,12 +43,11 @@ end ---@param bans integer ---@return string function WikiCopyPaste._getMapCode(mapIndex, bans) - banBool = true + banBool = false ban1Text = "" ban2Text = "" - if bans == 0 then - banBool = false - else + if bans > 0 then + banBool = true for ban = 1, bans do ban1Text = ban1Text .. "|t1b" .. ban .. "=" ban2Text = ban2Text .. "|t2b" .. ban .. "=" @@ -68,4 +67,3 @@ function WikiCopyPaste._getMapCode(mapIndex, bans) end return WikiCopyPaste - From 75aa8e6efefe60cffa00cc490bc34fa0b7df1687 Mon Sep 17 00:00:00 2001 From: Corsaka Date: Wed, 9 Sep 2026 23:30:46 +0100 Subject: [PATCH 4/6] feat(match2): refactor ban changes as functions through implementation of hjpalpha's suggested changes, this increasingly complicated minor change is finally in a good state --- .../deadlock/GetMatchGroupCopyPaste/wiki.lua | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua index 2d194ad5021..fcb76ce256d 100644 --- a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua @@ -43,24 +43,24 @@ end ---@param bans integer ---@return string function WikiCopyPaste._getMapCode(mapIndex, bans) - banBool = false - ban1Text = "" - ban2Text = "" - if bans > 0 then - banBool = true - for ban = 1, bans do - ban1Text = ban1Text .. "|t1b" .. ban .. "=" - ban2Text = ban2Text .. "|t2b" .. ban .. "=" + ---@param opponentIndex integer + ---@return string? + local banText = function(opponentIndex) + if bans <= 0 then + return end + return INDENT .. INDENT .. table.concat(Array.mapRange(1, bans, function(banIndex) + return '|t' .. opponentIndex .. 'b' .. banIndex .. '=' + end)) end return table.concat(Array.extend( INDENT .. '|map' .. mapIndex .. '={{Map', INDENT .. INDENT .. '|team1side=', INDENT .. INDENT .. '|t1h1=|t1h2=|t1h3=|t1h4=|t1h5=|t1h6=', - banBool and (INDENT .. INDENT .. ban1Text) or nil, + banText(1), INDENT .. INDENT .. '|team2side=', INDENT .. INDENT .. '|t2h1=|t2h2=|t2h3=|t2h4=|t2h5=|t2h6=', - banBool and (INDENT .. INDENT .. ban2Text) or nil, + banText(2), INDENT .. INDENT .. '|length=|winner=|matchid=|vod=', INDENT .. '}}' ), '\n') From 6abfa13a71ec6f7fd96badaf4036a7e46a9d1f1e Mon Sep 17 00:00:00 2001 From: Corsaka Date: Thu, 10 Sep 2026 18:11:16 +0100 Subject: [PATCH 5/6] feat(match2): linting type correction i've never seen this in lua before so i'm just gonna hope it works this way --- lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua index fcb76ce256d..29855216b15 100644 --- a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua @@ -40,7 +40,7 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) end ---@param mapIndex integer ----@param bans integer +---@param bans number? ---@return string function WikiCopyPaste._getMapCode(mapIndex, bans) ---@param opponentIndex integer From e13eebe1a59bc3629bb71c177157b185fa6c7030 Mon Sep 17 00:00:00 2001 From: Corsaka Date: Sat, 12 Sep 2026 16:24:22 +0100 Subject: [PATCH 6/6] feat2(match2): apply batched suggestions from code review linter. perish Co-authored-by: hjpalpha <75081997+hjpalpha@users.noreply.github.com> --- lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua index 29855216b15..42bfc12a715 100644 --- a/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua +++ b/lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua @@ -20,7 +20,7 @@ local INDENT = WikiCopyPaste.Indent function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) local showScore = Logic.nilOr(Logic.readBoolOrNil, bestof == 0) - local bans = tonumber(args.bans) + local bans = tonumber(args.bans) or 0 local lines = Array.extend( '{{Match|bestof=' .. (bestof ~= 0 and bestof or ''), @@ -40,7 +40,7 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) end ---@param mapIndex integer ----@param bans number? +---@param bans integer ---@return string function WikiCopyPaste._getMapCode(mapIndex, bans) ---@param opponentIndex integer