From 05c910347027b39c8136641186e7106ae6b5a334 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:13:44 +0700 Subject: [PATCH] Update match_group_input_custom.lua --- .../wikis/goals/match_group_input_custom.lua | 48 ++----------------- 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/components/match2/wikis/goals/match_group_input_custom.lua b/components/match2/wikis/goals/match_group_input_custom.lua index 7d97a4b56b..19fc59c75b 100644 --- a/components/match2/wikis/goals/match_group_input_custom.lua +++ b/components/match2/wikis/goals/match_group_input_custom.lua @@ -17,57 +17,15 @@ local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') local Streams = Lua.import('Module:Links/Stream') local CustomMatchGroupInput = {} +CustomMatchGroupInput.DEFAULT_MODE = 'solo' +CustomMatchGroupInput.getBestOf = MatchGroupInputUtil.getBestOf -- called from Module:MatchGroup ---@param match table ---@param options table? ---@return table function CustomMatchGroupInput.processMatch(match, options) - local winnerInput = match.winner --[[@as string?]] - local finishedInput = match.finished --[[@as string?]] - - Table.mergeInto(match, MatchGroupInputUtil.readDate(match.date)) - - local opponents = Array.mapIndexes(function(opponentIndex) - return MatchGroupInputUtil.readOpponent(match, opponentIndex, {}) - end) - - local games = CustomMatchGroupInput.extractMaps(match, opponents) - - local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) - and CustomMatchGroupInput.calculateMatchScore(games) - or nil - - Array.forEach(opponents, function(opponent, opponentIndex) - opponent.score, opponent.status = MatchGroupInputUtil.computeOpponentScore({ - walkover = match.walkover, - winner = winnerInput, - opponentIndex = opponentIndex, - score = opponent.score, - }, autoScoreFunction) - end) - - match.bestof = MatchGroupInputUtil.getBestOf(match.bestof, games) - match.finished = MatchGroupInputUtil.matchIsFinished(match, opponents) - - if match.finished then - match.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponents) - match.walkover = MatchGroupInputUtil.getWalkover(match.resulttype, opponents) - match.winner = MatchGroupInputUtil.getWinner(match.resulttype, winnerInput, opponents) - 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')) - Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) - - match.stream = Streams.processStreams(match) - - match.games = games - match.opponents = opponents - - return match + return MatchGroupInputUtil.standardProcessMatch(match, CustomMatchGroupInput) end ---@param match table