Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lua/wikis/deadlock/GetMatchGroupCopyPaste/wiki.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = tonumber(args.bans) or 0

local lines = Array.extend(
'{{Match|bestof=' .. (bestof ~= 0 and bestof or ''),
Expand All @@ -40,17 +40,27 @@ 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)
---@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
Comment thread
Corsaka marked this conversation as resolved.
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=|t1b3=|t1b4=|t1b5=|t1b6=') or nil,
banText(1),
INDENT .. INDENT .. '|team2side=',
INDENT .. INDENT .. '|t2h1=|t2h2=|t2h3=|t2h4=|t2h5=|t2h6=',
bans and (INDENT .. INDENT .. '|t2b1=|t2b2=|t2b3=|t2b4=|t2b5=|t2b6=') or nil,
banText(2),
INDENT .. INDENT .. '|length=|winner=|matchid=|vod=',
INDENT .. '}}'
), '\n')
Expand Down
Loading