diff --git a/components/match2/commons/match_group_input_util.lua b/components/match2/commons/match_group_input_util.lua index ddb7ee1f6c6..29ed9aa5350 100644 --- a/components/match2/commons/match_group_input_util.lua +++ b/components/match2/commons/match_group_input_util.lua @@ -845,50 +845,25 @@ function MatchGroupInputUtil.getDefaultWinner(opponents) return idx > 0 and idx or -1 end --- Set the field 'placement' for the two participants in the opponenets list. --- Set the placementWinner field to the winner, and placementLoser to the other team --- Special cases: --- If Winner = 0, that means draw, and placementLoser isn't used. Both teams will get placementWinner --- If Winner = -1, that mean no team won, and placementWinner isn't used. Both teams will get placementLoser ----@param opponents MGIParsedOpponent[] ----@param winner integer? ----@param placementWinner integer ----@param placementLoser integer + +--- Calculate the correct value of the 'placement' for the two-opponent matches/games. +--- Cases: +--- If Winner = OpponentIndex, return 1 +--- If Winner = 0, means it was a draw, return 1 +--- If Winner = -1, means that mean no team won, returns 2 +--- Otherwise return 2 ---@param resultType string? ----@return MGIParsedOpponent[] -function MatchGroupInputUtil.setPlacement(opponents, winner, placementWinner, placementLoser, resultType) - if not opponents or #opponents ~= 2 or resultType == MatchGroupInputUtil.RESULT_TYPE.NOT_PLAYED then - return opponents +---@param winner integer? +---@param opponentIndex integer +---@return integer? +function MatchGroupInputUtil.placementFromWinner(resultType, winner, opponentIndex) + if resultType == MatchGroupInputUtil.RESULT_TYPE.NOT_PLAYED then + return nil end - - local loserIdx - local winnerIdx - if winner == 1 then - winnerIdx = 1 - loserIdx = 2 - elseif winner == 2 then - winnerIdx = 2 - loserIdx = 1 - elseif winner == 0 then - -- Draw; idx of winner/loser doesn't matter - -- since loser and winner gets the same placement - placementLoser = placementWinner - winnerIdx = 1 - loserIdx = 2 - elseif winner == -1 then - -- No Winner (both loses). For example if both teams DQ. - -- idx's doesn't matter - placementWinner = placementLoser - winnerIdx = 1 - loserIdx = 2 - else - error('setPlacement: Unexpected winner: ' .. tostring(winner)) - return opponents + if winner == 0 or winner == opponentIndex then + return 1 end - opponents[winnerIdx].placement = placementWinner - opponents[loserIdx].placement = placementLoser - - return opponents + return 2 end ---@param match table diff --git a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua index 9b66d1b7a61..9c569dee0d3 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua @@ -81,7 +81,9 @@ function StarcraftMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/ageofempires/match_group_input_custom.lua b/components/match2/wikis/ageofempires/match_group_input_custom.lua index 103a5e0b4bd..7eee3fdcb87 100644 --- a/components/match2/wikis/ageofempires/match_group_input_custom.lua +++ b/components/match2/wikis/ageofempires/match_group_input_custom.lua @@ -67,7 +67,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Opponent.toLegacyMode(opponents[1].type, opponents[2].type) diff --git a/components/match2/wikis/arenafps/match_group_input_custom.lua b/components/match2/wikis/arenafps/match_group_input_custom.lua index b261b433d68..b09263f59b4 100644 --- a/components/match2/wikis/arenafps/match_group_input_custom.lua +++ b/components/match2/wikis/arenafps/match_group_input_custom.lua @@ -61,7 +61,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/battlerite/match_group_input_custom.lua b/components/match2/wikis/battlerite/match_group_input_custom.lua index 712d0b903a5..8a59cabec7a 100644 --- a/components/match2/wikis/battlerite/match_group_input_custom.lua +++ b/components/match2/wikis/battlerite/match_group_input_custom.lua @@ -63,7 +63,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/brawlhalla/match_group_input_custom.lua b/components/match2/wikis/brawlhalla/match_group_input_custom.lua index 4cf0b03840e..4048f09a218 100644 --- a/components/match2/wikis/brawlhalla/match_group_input_custom.lua +++ b/components/match2/wikis/brawlhalla/match_group_input_custom.lua @@ -58,7 +58,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/brawlstars/match_group_input_custom.lua b/components/match2/wikis/brawlstars/match_group_input_custom.lua index 200165ec368..d000668db81 100644 --- a/components/match2/wikis/brawlstars/match_group_input_custom.lua +++ b/components/match2/wikis/brawlstars/match_group_input_custom.lua @@ -68,7 +68,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) diff --git a/components/match2/wikis/callofduty/match_group_input_custom.lua b/components/match2/wikis/callofduty/match_group_input_custom.lua index 9efb8ad9df7..213ad9a0693 100644 --- a/components/match2/wikis/callofduty/match_group_input_custom.lua +++ b/components/match2/wikis/callofduty/match_group_input_custom.lua @@ -57,7 +57,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) diff --git a/components/match2/wikis/clashofclans/match_group_input_custom.lua b/components/match2/wikis/clashofclans/match_group_input_custom.lua index e23dc6516c3..b2684350ec7 100644 --- a/components/match2/wikis/clashofclans/match_group_input_custom.lua +++ b/components/match2/wikis/clashofclans/match_group_input_custom.lua @@ -66,7 +66,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/clashroyale/match_group_input_custom.lua b/components/match2/wikis/clashroyale/match_group_input_custom.lua index ed24a5cfe4b..658599320ef 100644 --- a/components/match2/wikis/clashroyale/match_group_input_custom.lua +++ b/components/match2/wikis/clashroyale/match_group_input_custom.lua @@ -67,7 +67,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/counterstrike/match_group_input_custom.lua b/components/match2/wikis/counterstrike/match_group_input_custom.lua index 7ea55243ab1..7d9861a6a9c 100644 --- a/components/match2/wikis/counterstrike/match_group_input_custom.lua +++ b/components/match2/wikis/counterstrike/match_group_input_custom.lua @@ -71,7 +71,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) diff --git a/components/match2/wikis/criticalops/match_group_input_custom.lua b/components/match2/wikis/criticalops/match_group_input_custom.lua index 59ac2e1917f..ec687ed3c2d 100644 --- a/components/match2/wikis/criticalops/match_group_input_custom.lua +++ b/components/match2/wikis/criticalops/match_group_input_custom.lua @@ -66,7 +66,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/crossfire/match_group_input_custom.lua b/components/match2/wikis/crossfire/match_group_input_custom.lua index bb92e3ced09..204bba242c7 100644 --- a/components/match2/wikis/crossfire/match_group_input_custom.lua +++ b/components/match2/wikis/crossfire/match_group_input_custom.lua @@ -66,7 +66,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/deadlock/match_group_input_custom.lua b/components/match2/wikis/deadlock/match_group_input_custom.lua index 17a6fe2abcf..eecc27df3ec 100644 --- a/components/match2/wikis/deadlock/match_group_input_custom.lua +++ b/components/match2/wikis/deadlock/match_group_input_custom.lua @@ -60,7 +60,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/dota2/match_group_input_custom.lua b/components/match2/wikis/dota2/match_group_input_custom.lua index 64269a3a4dc..f4f2053e25d 100644 --- a/components/match2/wikis/dota2/match_group_input_custom.lua +++ b/components/match2/wikis/dota2/match_group_input_custom.lua @@ -101,7 +101,9 @@ function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/easportsfc/match_group_input_custom.lua b/components/match2/wikis/easportsfc/match_group_input_custom.lua index 244f1b15bab..b693b69540a 100644 --- a/components/match2/wikis/easportsfc/match_group_input_custom.lua +++ b/components/match2/wikis/easportsfc/match_group_input_custom.lua @@ -62,7 +62,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) diff --git a/components/match2/wikis/fighters/match_group_input_custom.lua b/components/match2/wikis/fighters/match_group_input_custom.lua index 17e41b8592d..cfdc7dcb36e 100644 --- a/components/match2/wikis/fighters/match_group_input_custom.lua +++ b/components/match2/wikis/fighters/match_group_input_custom.lua @@ -64,7 +64,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/geoguessr/match_group_input_custom.lua b/components/match2/wikis/geoguessr/match_group_input_custom.lua index d1b7d25090b..6b059cf1599 100644 --- a/components/match2/wikis/geoguessr/match_group_input_custom.lua +++ b/components/match2/wikis/geoguessr/match_group_input_custom.lua @@ -58,7 +58,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/halo/match_group_input_custom.lua b/components/match2/wikis/halo/match_group_input_custom.lua index 3108d9133d2..c382b6c5257 100644 --- a/components/match2/wikis/halo/match_group_input_custom.lua +++ b/components/match2/wikis/halo/match_group_input_custom.lua @@ -61,7 +61,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/heroes/match_group_input_custom.lua b/components/match2/wikis/heroes/match_group_input_custom.lua index b1b7e0e2989..fc926d3fde7 100644 --- a/components/match2/wikis/heroes/match_group_input_custom.lua +++ b/components/match2/wikis/heroes/match_group_input_custom.lua @@ -66,7 +66,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/honorofkings/match_group_input_custom.lua b/components/match2/wikis/honorofkings/match_group_input_custom.lua index 83245c8c56b..3f0f951293b 100644 --- a/components/match2/wikis/honorofkings/match_group_input_custom.lua +++ b/components/match2/wikis/honorofkings/match_group_input_custom.lua @@ -72,7 +72,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/leagueoflegends/match_group_input_custom.lua b/components/match2/wikis/leagueoflegends/match_group_input_custom.lua index 63d58b3b71b..fcb5758cc06 100644 --- a/components/match2/wikis/leagueoflegends/match_group_input_custom.lua +++ b/components/match2/wikis/leagueoflegends/match_group_input_custom.lua @@ -101,7 +101,9 @@ function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/magic/match_group_input_custom.lua b/components/match2/wikis/magic/match_group_input_custom.lua index 3842b61bf0d..4e76a23d1df 100644 --- a/components/match2/wikis/magic/match_group_input_custom.lua +++ b/components/match2/wikis/magic/match_group_input_custom.lua @@ -68,7 +68,9 @@ function CustomMatchGroupInput.processMatch(match) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) diff --git a/components/match2/wikis/mobilelegends/match_group_input_custom.lua b/components/match2/wikis/mobilelegends/match_group_input_custom.lua index a7f85bf950e..1752c8b6f99 100644 --- a/components/match2/wikis/mobilelegends/match_group_input_custom.lua +++ b/components/match2/wikis/mobilelegends/match_group_input_custom.lua @@ -60,7 +60,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) diff --git a/components/match2/wikis/omegastrikers/match_group_input_custom.lua b/components/match2/wikis/omegastrikers/match_group_input_custom.lua index 97d589b99d4..67af7edb5b7 100644 --- a/components/match2/wikis/omegastrikers/match_group_input_custom.lua +++ b/components/match2/wikis/omegastrikers/match_group_input_custom.lua @@ -60,7 +60,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) diff --git a/components/match2/wikis/osu/match_group_input_custom.lua b/components/match2/wikis/osu/match_group_input_custom.lua index 8b00e5cba5e..0e5c495ea40 100644 --- a/components/match2/wikis/osu/match_group_input_custom.lua +++ b/components/match2/wikis/osu/match_group_input_custom.lua @@ -62,7 +62,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/overwatch/match_group_input_custom.lua b/components/match2/wikis/overwatch/match_group_input_custom.lua index 6666057c8e8..3c74cca9578 100644 --- a/components/match2/wikis/overwatch/match_group_input_custom.lua +++ b/components/match2/wikis/overwatch/match_group_input_custom.lua @@ -57,7 +57,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) diff --git a/components/match2/wikis/pokemon/match_group_input_custom.lua b/components/match2/wikis/pokemon/match_group_input_custom.lua index 98e700a5036..871e331baae 100644 --- a/components/match2/wikis/pokemon/match_group_input_custom.lua +++ b/components/match2/wikis/pokemon/match_group_input_custom.lua @@ -70,7 +70,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/rainbowsix/match_group_input_custom.lua b/components/match2/wikis/rainbowsix/match_group_input_custom.lua index 8505d1cb8da..5813bb15873 100644 --- a/components/match2/wikis/rainbowsix/match_group_input_custom.lua +++ b/components/match2/wikis/rainbowsix/match_group_input_custom.lua @@ -63,7 +63,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/rocketleague/match_group_input_custom.lua b/components/match2/wikis/rocketleague/match_group_input_custom.lua index 0132d22f908..cea307f58f5 100644 --- a/components/match2/wikis/rocketleague/match_group_input_custom.lua +++ b/components/match2/wikis/rocketleague/match_group_input_custom.lua @@ -64,7 +64,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/sideswipe/match_group_input_custom.lua b/components/match2/wikis/sideswipe/match_group_input_custom.lua index 1ea8782f8ea..1c0f323133e 100644 --- a/components/match2/wikis/sideswipe/match_group_input_custom.lua +++ b/components/match2/wikis/sideswipe/match_group_input_custom.lua @@ -54,7 +54,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/smite/match_group_input_custom.lua b/components/match2/wikis/smite/match_group_input_custom.lua index 1f2e7a3ea8a..58be5882859 100644 --- a/components/match2/wikis/smite/match_group_input_custom.lua +++ b/components/match2/wikis/smite/match_group_input_custom.lua @@ -69,7 +69,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/splatoon/match_group_input_custom.lua b/components/match2/wikis/splatoon/match_group_input_custom.lua index 2dee94f7bcf..ea331bb5e09 100644 --- a/components/match2/wikis/splatoon/match_group_input_custom.lua +++ b/components/match2/wikis/splatoon/match_group_input_custom.lua @@ -60,7 +60,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/splitgate/match_group_input_custom.lua b/components/match2/wikis/splitgate/match_group_input_custom.lua index 91ceb42aedd..d4ec37977dd 100644 --- a/components/match2/wikis/splitgate/match_group_input_custom.lua +++ b/components/match2/wikis/splitgate/match_group_input_custom.lua @@ -61,7 +61,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/stormgate/match_group_input_custom.lua b/components/match2/wikis/stormgate/match_group_input_custom.lua index 9a9475304f9..62046d13b1e 100644 --- a/components/match2/wikis/stormgate/match_group_input_custom.lua +++ b/components/match2/wikis/stormgate/match_group_input_custom.lua @@ -96,7 +96,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/teamfortress/match_group_input_custom.lua b/components/match2/wikis/teamfortress/match_group_input_custom.lua index d18db788421..94dfc58dc22 100644 --- a/components/match2/wikis/teamfortress/match_group_input_custom.lua +++ b/components/match2/wikis/teamfortress/match_group_input_custom.lua @@ -58,7 +58,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/tetris/match_group_input_custom.lua b/components/match2/wikis/tetris/match_group_input_custom.lua index 6f10d28a17f..12926f2f5b5 100644 --- a/components/match2/wikis/tetris/match_group_input_custom.lua +++ b/components/match2/wikis/tetris/match_group_input_custom.lua @@ -68,7 +68,9 @@ function CustomMatchGroupInput.processMatch(match) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) diff --git a/components/match2/wikis/tft/match_group_input_custom.lua b/components/match2/wikis/tft/match_group_input_custom.lua index 537fc4ba4a2..1cf4cea0c79 100644 --- a/components/match2/wikis/tft/match_group_input_custom.lua +++ b/components/match2/wikis/tft/match_group_input_custom.lua @@ -56,7 +56,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/trackmania/match_group_input_custom.lua b/components/match2/wikis/trackmania/match_group_input_custom.lua index 6995e7f6a6b..ccf9fb42e20 100644 --- a/components/match2/wikis/trackmania/match_group_input_custom.lua +++ b/components/match2/wikis/trackmania/match_group_input_custom.lua @@ -57,7 +57,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', '2v2')) diff --git a/components/match2/wikis/valorant/match_group_input_custom.lua b/components/match2/wikis/valorant/match_group_input_custom.lua index 6ff61262d51..5c83f8bf3a1 100644 --- a/components/match2/wikis/valorant/match_group_input_custom.lua +++ b/components/match2/wikis/valorant/match_group_input_custom.lua @@ -62,7 +62,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/warcraft/match_group_input_custom.lua b/components/match2/wikis/warcraft/match_group_input_custom.lua index 5574335d52b..59f522ce665 100644 --- a/components/match2/wikis/warcraft/match_group_input_custom.lua +++ b/components/match2/wikis/warcraft/match_group_input_custom.lua @@ -100,7 +100,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) diff --git a/components/match2/wikis/wildrift/match_group_input_custom.lua b/components/match2/wikis/wildrift/match_group_input_custom.lua index 4a6abb8b3ac..b95713d67db 100644 --- a/components/match2/wikis/wildrift/match_group_input_custom.lua +++ b/components/match2/wikis/wildrift/match_group_input_custom.lua @@ -71,7 +71,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) diff --git a/components/match2/wikis/worldoftanks/match_group_input_custom.lua b/components/match2/wikis/worldoftanks/match_group_input_custom.lua index b665907c111..3b362330d89 100644 --- a/components/match2/wikis/worldoftanks/match_group_input_custom.lua +++ b/components/match2/wikis/worldoftanks/match_group_input_custom.lua @@ -62,7 +62,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) diff --git a/components/match2/wikis/zula/match_group_input_custom.lua b/components/match2/wikis/zula/match_group_input_custom.lua index 91b228ea4f4..f28280c61e1 100644 --- a/components/match2/wikis/zula/match_group_input_custom.lua +++ b/components/match2/wikis/zula/match_group_input_custom.lua @@ -63,7 +63,9 @@ function CustomMatchGroupInput.processMatch(match, options) match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) + Array.forEach(opponents, function(opponent, opponentIndex) + opponent.placement = MatchGroupInputUtil.placementFromWinner(match.resulttype, match.winner, opponentIndex) + end) end match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE)