diff --git a/components/match2/commons/match_group_input.lua b/components/match2/commons/match_group_input.lua index ac0656b80bd..f3e5f9476d3 100644 --- a/components/match2/commons/match_group_input.lua +++ b/components/match2/commons/match_group_input.lua @@ -45,7 +45,7 @@ local VALID_GSL_GROUP_STYLES = { ---@param match table function MatchGroupInput._applyTournamentVarsToMaps(match) for _, map in ipairs(MatchGroupUtil.normalizeSubtype(match, 'map')) do - MatchGroupInputUtil.getCommonTournamentVars(map, match) + Table.mergeInto(map, MatchGroupInputUtil.getTournamentContext(map, match)) end end diff --git a/components/match2/commons/match_group_input_util.lua b/components/match2/commons/match_group_input_util.lua index 94098f197e3..52e823b3c7e 100644 --- a/components/match2/commons/match_group_input_util.lua +++ b/components/match2/commons/match_group_input_util.lua @@ -292,36 +292,38 @@ end ---@param obj table ---@param parent table? ---@return table -function MatchGroupInputUtil.getCommonTournamentVars(obj, parent) +---@nodiscard +function MatchGroupInputUtil.getTournamentContext(obj, parent) parent = parent or {} - obj.game = Logic.emptyOr(obj.game, parent.game, globalVars:get('tournament_game')) - obj.icon = Logic.emptyOr(obj.icon, parent.icon, globalVars:get('tournament_icon')) - obj.icondark = Logic.emptyOr(obj.iconDark, parent.icondark, globalVars:get('tournament_icondark')) - obj.liquipediatier = Logic.emptyOr( + local vars = {} + vars.game = Logic.emptyOr(obj.game, parent.game, globalVars:get('tournament_game')) + vars.icon = Logic.emptyOr(obj.icon, parent.icon, globalVars:get('tournament_icon')) + vars.icondark = Logic.emptyOr(obj.iconDark, parent.icondark, globalVars:get('tournament_icondark')) + vars.liquipediatier = Logic.emptyOr( obj.liquipediatier, parent.liquipediatier, globalVars:get('tournament_liquipediatier') ) - obj.liquipediatiertype = Logic.emptyOr( + vars.liquipediatiertype = Logic.emptyOr( obj.liquipediatiertype, parent.liquipediatiertype, globalVars:get('tournament_liquipediatiertype') ) - obj.publishertier = Logic.emptyOr( + vars.publishertier = Logic.emptyOr( obj.publishertier, parent.publishertier, globalVars:get('tournament_publishertier') ) - obj.series = Logic.emptyOr(obj.series, parent.series, globalVars:get('tournament_series')) - obj.shortname = Logic.emptyOr(obj.shortname, parent.shortname, globalVars:get('tournament_shortname')) - obj.tickername = Logic.emptyOr(obj.tickername, parent.tickername, globalVars:get('tournament_tickername')) - obj.tournament = Logic.emptyOr(obj.tournament, parent.tournament, globalVars:get('tournament_name')) - obj.type = Logic.emptyOr(obj.type, parent.type, globalVars:get('tournament_type')) - obj.patch = Logic.emptyOr(obj.patch, parent.patch, globalVars:get('tournament_patch')) - obj.date = Logic.emptyOr(obj.date, parent.date) - obj.mode = Logic.emptyOr(obj.mode, parent.mode) - - return obj + vars.series = Logic.emptyOr(obj.series, parent.series, globalVars:get('tournament_series')) + vars.shortname = Logic.emptyOr(obj.shortname, parent.shortname, globalVars:get('tournament_shortname')) + vars.tickername = Logic.emptyOr(obj.tickername, parent.tickername, globalVars:get('tournament_tickername')) + vars.tournament = Logic.emptyOr(obj.tournament, parent.tournament, globalVars:get('tournament_name')) + vars.type = Logic.emptyOr(obj.type, parent.type, globalVars:get('tournament_type')) + vars.patch = Logic.emptyOr(obj.patch, parent.patch, globalVars:get('tournament_patch')) + vars.date = Logic.emptyOr(obj.date, parent.date) + vars.mode = Logic.emptyOr(obj.mode, parent.mode) + + return vars 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 63d751a4285..9b66d1b7a61 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua @@ -84,7 +84,7 @@ function StarcraftMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.vod = Logic.nilIfEmpty(match.vod) diff --git a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft_ffa.lua b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft_ffa.lua index 7748294c364..adbb63257cb 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft_ffa.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft_ffa.lua @@ -50,7 +50,7 @@ function StarcraftFfaMatchGroupInput.processMatch(match, options) match.vod = Logic.nilIfEmpty(match.vod) match.links = BaseMatchFunctions.getLinks(match) - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) local opponents = BaseMatchFunctions.readOpponents(match) diff --git a/components/match2/wikis/ageofempires/match_group_input_custom.lua b/components/match2/wikis/ageofempires/match_group_input_custom.lua index 3b11d4a8ec2..103a5e0b4bd 100644 --- a/components/match2/wikis/ageofempires/match_group_input_custom.lua +++ b/components/match2/wikis/ageofempires/match_group_input_custom.lua @@ -34,7 +34,7 @@ local OPPONENT_CONFIG = { ---@return table function CustomMatchGroupInput.processMatch(match, options) assert(not Logic.readBool(match.ffa), 'FFA is not yet supported in AoE match2.') - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.game, match.mapsInfo = CustomMatchGroupInput._getMapsAndGame(match) Table.mergeInto(match, MatchGroupInputUtil.readDate(match.date)) @@ -154,7 +154,7 @@ function CustomMatchGroupInput.extractMaps(match, opponents) map.map, map.extradata.displayname = CustomMatchGroupInput._getMapName(map, match.mapsInfo) map.extradata.mapmode = Table.extract(map, 'mode') - MatchGroupInputUtil.getCommonTournamentVars(map, match) + Table.mergeInto(map, MatchGroupInputUtil.getTournamentContext(map, match)) map.opponents = CustomMatchGroupInput.processPlayerMapData(map, opponents) diff --git a/components/match2/wikis/apexlegends/match_group_input_custom.lua b/components/match2/wikis/apexlegends/match_group_input_custom.lua index 57ecabff642..999a87cc89a 100644 --- a/components/match2/wikis/apexlegends/match_group_input_custom.lua +++ b/components/match2/wikis/apexlegends/match_group_input_custom.lua @@ -78,7 +78,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchFunctions.setBgForOpponents(opponents, settings.status) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -231,12 +232,6 @@ function MatchFunctions.parseSetting(match) } end ----@param match table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param settings table ---@return table function MatchFunctions.getExtraData(settings) diff --git a/components/match2/wikis/arenafps/match_group_input_custom.lua b/components/match2/wikis/arenafps/match_group_input_custom.lua index bc9b291eea8..8f3df0f363d 100644 --- a/components/match2/wikis/arenafps/match_group_input_custom.lua +++ b/components/match2/wikis/arenafps/match_group_input_custom.lua @@ -65,7 +65,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -131,13 +132,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/battlerite/match_group_input_custom.lua b/components/match2/wikis/battlerite/match_group_input_custom.lua index ea4c039ce2c..1e16b90b04d 100644 --- a/components/match2/wikis/battlerite/match_group_input_custom.lua +++ b/components/match2/wikis/battlerite/match_group_input_custom.lua @@ -67,7 +67,7 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/brawlhalla/match_group_input_custom.lua b/components/match2/wikis/brawlhalla/match_group_input_custom.lua index 14f75d7bd50..dfcd85003c7 100644 --- a/components/match2/wikis/brawlhalla/match_group_input_custom.lua +++ b/components/match2/wikis/brawlhalla/match_group_input_custom.lua @@ -62,7 +62,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - CustomMatchGroupInput.getTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) + match.mode = Variables.varDefault('tournament_mode', 'singles') match.stream = Streams.processStreams(match) @@ -74,12 +75,6 @@ end CustomMatchGroupInput.processMap = FnUtil.identity ----@param match table -function CustomMatchGroupInput.getTournamentVars(match) - match = MatchGroupInputUtil.getCommonTournamentVars(match) - match.mode = Variables.varDefault('tournament_mode', 'singles') -end - ---@param match table ---@param matchOpponents table[] ---@return table[] diff --git a/components/match2/wikis/brawlstars/match_group_input_custom.lua b/components/match2/wikis/brawlstars/match_group_input_custom.lua index 04de09f5ef3..cf29345a9c6 100644 --- a/components/match2/wikis/brawlstars/match_group_input_custom.lua +++ b/components/match2/wikis/brawlstars/match_group_input_custom.lua @@ -71,7 +71,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -146,13 +147,6 @@ function MatchFunctions.getBestOf(match) return bestof or DEFAULT_BESTOF_MATCH end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getExtraData(match) diff --git a/components/match2/wikis/callofduty/match_group_input_custom.lua b/components/match2/wikis/callofduty/match_group_input_custom.lua index 6876b6b77b4..309b04e965f 100644 --- a/components/match2/wikis/callofduty/match_group_input_custom.lua +++ b/components/match2/wikis/callofduty/match_group_input_custom.lua @@ -61,7 +61,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -133,13 +134,6 @@ function MatchFunctions.getBestOf(match) return bestof or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/clashofclans/match_group_input_custom.lua b/components/match2/wikis/clashofclans/match_group_input_custom.lua index d8c38229d9c..47ad466e392 100644 --- a/components/match2/wikis/clashofclans/match_group_input_custom.lua +++ b/components/match2/wikis/clashofclans/match_group_input_custom.lua @@ -70,7 +70,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -154,13 +155,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/clashroyale/match_group_input_custom.lua b/components/match2/wikis/clashroyale/match_group_input_custom.lua index 73a038968f1..ed24a5cfe4b 100644 --- a/components/match2/wikis/clashroyale/match_group_input_custom.lua +++ b/components/match2/wikis/clashroyale/match_group_input_custom.lua @@ -70,7 +70,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -91,13 +92,6 @@ function MatchFunctions.getLinks(match) } end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@param opponents table[] ---@return table[] diff --git a/components/match2/wikis/counterstrike/match_group_input_custom.lua b/components/match2/wikis/counterstrike/match_group_input_custom.lua index 7bd8df8a933..0a0e01db1cb 100644 --- a/components/match2/wikis/counterstrike/match_group_input_custom.lua +++ b/components/match2/wikis/counterstrike/match_group_input_custom.lua @@ -247,7 +247,7 @@ function matchFunctions.getTournamentVars(match) match.publishertier = Logic.emptyOr(match.publishertier, Variables.varDefault('tournament_valve_tier')) match.status = Logic.emptyOr(match.status, Variables.varDefault('tournament_status')) - return MatchGroupInput.getCommonTournamentVars(match) + return MatchGroupInput.getTournamentContext(match) end ---@param match table diff --git a/components/match2/wikis/criticalops/match_group_input_custom.lua b/components/match2/wikis/criticalops/match_group_input_custom.lua index 62e83d59027..f77961a9576 100644 --- a/components/match2/wikis/criticalops/match_group_input_custom.lua +++ b/components/match2/wikis/criticalops/match_group_input_custom.lua @@ -70,7 +70,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -136,13 +137,6 @@ function MatchFunctions.extractMaps(match, opponentCount) return maps end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/crossfire/match_group_input_custom.lua b/components/match2/wikis/crossfire/match_group_input_custom.lua index 236b0d57978..29d4f5fd54b 100644 --- a/components/match2/wikis/crossfire/match_group_input_custom.lua +++ b/components/match2/wikis/crossfire/match_group_input_custom.lua @@ -70,7 +70,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -138,13 +139,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/deadlock/match_group_input_custom.lua b/components/match2/wikis/deadlock/match_group_input_custom.lua index c23a296bad1..fa1cdc4ad96 100644 --- a/components/match2/wikis/deadlock/match_group_input_custom.lua +++ b/components/match2/wikis/deadlock/match_group_input_custom.lua @@ -63,7 +63,7 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) diff --git a/components/match2/wikis/dota2/match_group_input_custom.lua b/components/match2/wikis/dota2/match_group_input_custom.lua index adcfa4c2e73..1c131c319b4 100644 --- a/components/match2/wikis/dota2/match_group_input_custom.lua +++ b/components/match2/wikis/dota2/match_group_input_custom.lua @@ -104,7 +104,8 @@ function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match, games) @@ -173,14 +174,6 @@ function MatchFunctions.calculateMatchScore(maps) end end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.headtohead = Logic.emptyOr(match.headtohead, Variables.varDefault('headtohead')) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@param games table[] ---@return table @@ -210,7 +203,7 @@ end function MatchFunctions.getExtraData(match) return { mvp = MatchGroupInputUtil.readMvp(match), - headtohead = match.headtohead, + headtohead = Logic.emptyOr(match.headtohead, Variables.varDefault('headtohead')), casters = MatchGroupInputUtil.readCasters(match, {noSort = true}), } end diff --git a/components/match2/wikis/easportsfc/match_group_input_custom.lua b/components/match2/wikis/easportsfc/match_group_input_custom.lua index c5a88620ce9..81481d52bbe 100644 --- a/components/match2/wikis/easportsfc/match_group_input_custom.lua +++ b/components/match2/wikis/easportsfc/match_group_input_custom.lua @@ -58,7 +58,7 @@ function CustomMatchGroupInput._getTournamentVars(match) match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) match.publishertier = Logic.emptyOr(match.publishertier, Variables.varDefault('tournament_publishertier')) - MatchGroupInput.getCommonTournamentVars(match) + MatchGroupInput.getTournamentContext(match) end ---@param match table diff --git a/components/match2/wikis/fighters/match_group_input_custom.lua b/components/match2/wikis/fighters/match_group_input_custom.lua index b0fd58158ed..c8ea24e3ee7 100644 --- a/components/match2/wikis/fighters/match_group_input_custom.lua +++ b/components/match2/wikis/fighters/match_group_input_custom.lua @@ -68,7 +68,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - CustomMatchGroupInput.getTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) + match.mode = Variables.varDefault('tournament_mode', 'singles') match.stream = Streams.processStreams(match) @@ -135,12 +136,6 @@ function CustomMatchGroupInput.calculateMatchScore(maps) end end ----@param match table -function CustomMatchGroupInput.getTournamentVars(match) - MatchGroupInputUtil.getCommonTournamentVars(match) - match.mode = Variables.varDefault('tournament_mode', 'singles') -end - ---@param map table ---@param opponent table ---@param opponentIndex integer diff --git a/components/match2/wikis/geoguessr/match_group_input_custom.lua b/components/match2/wikis/geoguessr/match_group_input_custom.lua index 4e77e84a1e5..0bc8661c0d5 100644 --- a/components/match2/wikis/geoguessr/match_group_input_custom.lua +++ b/components/match2/wikis/geoguessr/match_group_input_custom.lua @@ -62,7 +62,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.games = games @@ -121,13 +122,6 @@ function MatchFunctions.calculateMatchScore(maps) end end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - -- -- map related functions -- diff --git a/components/match2/wikis/halo/match_group_input_custom.lua b/components/match2/wikis/halo/match_group_input_custom.lua index 4704983e743..aec66a5a30f 100644 --- a/components/match2/wikis/halo/match_group_input_custom.lua +++ b/components/match2/wikis/halo/match_group_input_custom.lua @@ -65,7 +65,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -133,13 +134,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/heroes/match_group_input_custom.lua b/components/match2/wikis/heroes/match_group_input_custom.lua index 250c8dfcd0f..7d0689a6af1 100644 --- a/components/match2/wikis/heroes/match_group_input_custom.lua +++ b/components/match2/wikis/heroes/match_group_input_custom.lua @@ -69,7 +69,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -145,13 +146,6 @@ function MatchFunctions.getBestOf(match) return bestOf or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/honorofkings/match_group_input_custom.lua b/components/match2/wikis/honorofkings/match_group_input_custom.lua index c56ec521396..1694f135769 100644 --- a/components/match2/wikis/honorofkings/match_group_input_custom.lua +++ b/components/match2/wikis/honorofkings/match_group_input_custom.lua @@ -75,7 +75,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -150,13 +151,6 @@ function MatchFunctions.getBestOf(match) return bestOf or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/leagueoflegends/match_group_input_custom.lua b/components/match2/wikis/leagueoflegends/match_group_input_custom.lua index e86e79d7660..eefb3333264 100644 --- a/components/match2/wikis/leagueoflegends/match_group_input_custom.lua +++ b/components/match2/wikis/leagueoflegends/match_group_input_custom.lua @@ -104,7 +104,8 @@ function CustomMatchGroupInput.processMatchWithoutStandalone(MatchParser, match) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -172,13 +173,6 @@ function MatchFunctions.calculateMatchScore(maps) end end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/magic/match_group_input_custom.lua b/components/match2/wikis/magic/match_group_input_custom.lua index e60b89156c8..5b71e38ce13 100644 --- a/components/match2/wikis/magic/match_group_input_custom.lua +++ b/components/match2/wikis/magic/match_group_input_custom.lua @@ -72,7 +72,8 @@ function CustomMatchGroupInput.processMatch(match) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - CustomMatchGroupInput.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -140,12 +141,6 @@ function CustomMatchGroupInput.getBestOf(match) return bestOf or DEFAULT_BESTOF end ----@param match table -function CustomMatchGroupInput.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) - MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return boolean function CustomMatchGroupInput._hasTeamOpponent(match) diff --git a/components/match2/wikis/mobilelegends/match_group_input_custom.lua b/components/match2/wikis/mobilelegends/match_group_input_custom.lua index dd2145f8ddd..bb475894948 100644 --- a/components/match2/wikis/mobilelegends/match_group_input_custom.lua +++ b/components/match2/wikis/mobilelegends/match_group_input_custom.lua @@ -63,7 +63,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -137,13 +138,6 @@ function MatchFunctions.getBestOf(match) return bestof or DEFAULT_BESTOF_MATCH end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getExtraData(match) diff --git a/components/match2/wikis/omegastrikers/match_group_input_custom.lua b/components/match2/wikis/omegastrikers/match_group_input_custom.lua index 672cc4c804d..c798a3f8482 100644 --- a/components/match2/wikis/omegastrikers/match_group_input_custom.lua +++ b/components/match2/wikis/omegastrikers/match_group_input_custom.lua @@ -63,7 +63,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -135,13 +136,6 @@ function MatchFunctions.getBestOf(match) return bestof or DEFAULT_BESTOF_MATCH end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - -- -- map related functions -- diff --git a/components/match2/wikis/osu/match_group_input_custom.lua b/components/match2/wikis/osu/match_group_input_custom.lua index ab93687078b..75e0336ac41 100644 --- a/components/match2/wikis/osu/match_group_input_custom.lua +++ b/components/match2/wikis/osu/match_group_input_custom.lua @@ -66,7 +66,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -139,13 +140,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/overwatch/match_group_input_custom.lua b/components/match2/wikis/overwatch/match_group_input_custom.lua index ab8f6c21665..c10a5af2a80 100644 --- a/components/match2/wikis/overwatch/match_group_input_custom.lua +++ b/components/match2/wikis/overwatch/match_group_input_custom.lua @@ -61,7 +61,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -137,13 +138,6 @@ function MatchFunctions.getBestOf(match) return bestof or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'team')) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/pokemon/match_group_input_custom.lua b/components/match2/wikis/pokemon/match_group_input_custom.lua index 436bb9a2e7b..98e700a5036 100644 --- a/components/match2/wikis/pokemon/match_group_input_custom.lua +++ b/components/match2/wikis/pokemon/match_group_input_custom.lua @@ -73,7 +73,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -145,12 +146,6 @@ function MatchFunctions.getBestOf(match) return bestOf or DEFAULT_BESTOF end ----@param match table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getExtraData(match) diff --git a/components/match2/wikis/rainbowsix/match_group_input_custom.lua b/components/match2/wikis/rainbowsix/match_group_input_custom.lua index 276d578b48a..d95359308b2 100644 --- a/components/match2/wikis/rainbowsix/match_group_input_custom.lua +++ b/components/match2/wikis/rainbowsix/match_group_input_custom.lua @@ -66,7 +66,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -121,14 +122,6 @@ function MatchFunctions.extractMaps(match, opponentCount) return maps end ---- Fetch information about the tournament ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - -- Template:Map sets a default map name so we can count the number of maps. -- These maps however shouldn't be stored -- The keepMap function will check if a map should be kept diff --git a/components/match2/wikis/rocketleague/match_group_input_custom.lua b/components/match2/wikis/rocketleague/match_group_input_custom.lua index 9008f59d059..a3542280876 100644 --- a/components/match2/wikis/rocketleague/match_group_input_custom.lua +++ b/components/match2/wikis/rocketleague/match_group_input_custom.lua @@ -68,7 +68,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -157,13 +158,6 @@ end -- match related functions -- ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@param opponents table[] ---@return table diff --git a/components/match2/wikis/sideswipe/match_group_input_custom.lua b/components/match2/wikis/sideswipe/match_group_input_custom.lua index 0a5c956d4f8..6f75be945fb 100644 --- a/components/match2/wikis/sideswipe/match_group_input_custom.lua +++ b/components/match2/wikis/sideswipe/match_group_input_custom.lua @@ -58,7 +58,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -112,13 +113,6 @@ CustomMatchGroupInput.processMap = FnUtil.identity -- match related functions -- ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@param opponents table[] ---@return table diff --git a/components/match2/wikis/smite/match_group_input_custom.lua b/components/match2/wikis/smite/match_group_input_custom.lua index e3e7da0ae8a..aebb6d169c3 100644 --- a/components/match2/wikis/smite/match_group_input_custom.lua +++ b/components/match2/wikis/smite/match_group_input_custom.lua @@ -72,7 +72,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -118,13 +119,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/splatoon/match_group_input_custom.lua b/components/match2/wikis/splatoon/match_group_input_custom.lua index 56d1366ddee..d3f8c22dcd2 100644 --- a/components/match2/wikis/splatoon/match_group_input_custom.lua +++ b/components/match2/wikis/splatoon/match_group_input_custom.lua @@ -64,7 +64,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -135,12 +136,6 @@ function MatchFunctions.calculateMatchScore(maps) end end ----@param match table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getExtraData(match) diff --git a/components/match2/wikis/splitgate/match_group_input_custom.lua b/components/match2/wikis/splitgate/match_group_input_custom.lua index 5853fb78fe2..115d51d8e1d 100644 --- a/components/match2/wikis/splitgate/match_group_input_custom.lua +++ b/components/match2/wikis/splitgate/match_group_input_custom.lua @@ -65,7 +65,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -133,13 +134,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/stormgate/match_group_input_custom.lua b/components/match2/wikis/stormgate/match_group_input_custom.lua index 09a77c32bfe..9a9475304f9 100644 --- a/components/match2/wikis/stormgate/match_group_input_custom.lua +++ b/components/match2/wikis/stormgate/match_group_input_custom.lua @@ -99,7 +99,7 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.vod = Logic.nilIfEmpty(match.vod) diff --git a/components/match2/wikis/teamfortress/match_group_input_custom.lua b/components/match2/wikis/teamfortress/match_group_input_custom.lua index 0c3eb99b981..297fbf6e7c1 100644 --- a/components/match2/wikis/teamfortress/match_group_input_custom.lua +++ b/components/match2/wikis/teamfortress/match_group_input_custom.lua @@ -62,7 +62,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match, games) @@ -122,13 +123,6 @@ function MatchFunctions.calculateMatchScore(maps) end end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@param games table[] ---@return table diff --git a/components/match2/wikis/tetris/match_group_input_custom.lua b/components/match2/wikis/tetris/match_group_input_custom.lua index c0c3f7cb643..0dd01ba84be 100644 --- a/components/match2/wikis/tetris/match_group_input_custom.lua +++ b/components/match2/wikis/tetris/match_group_input_custom.lua @@ -72,7 +72,8 @@ function CustomMatchGroupInput.processMatch(match) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - CustomMatchGroupInput.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -142,12 +143,6 @@ function CustomMatchGroupInput.getBestOf(match) return bestOf or DEFAULT_BESTOF end ----@param match table -function CustomMatchGroupInput.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', 'solo')) - MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function CustomMatchGroupInput.getExtraData(match) diff --git a/components/match2/wikis/trackmania/match_group_input_custom.lua b/components/match2/wikis/trackmania/match_group_input_custom.lua index f3d27467d07..0ab9dfd4e59 100644 --- a/components/match2/wikis/trackmania/match_group_input_custom.lua +++ b/components/match2/wikis/trackmania/match_group_input_custom.lua @@ -61,7 +61,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', '2v2')) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) @@ -138,13 +139,6 @@ function CustomMatchGroupInput._getSetWins(opponent) return setWin(1) + setWin(2) + setWin(3) end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', '2v2')) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return boolean function MatchFunctions.isFeatured(match) diff --git a/components/match2/wikis/valorant/match_group_input_custom.lua b/components/match2/wikis/valorant/match_group_input_custom.lua index feee8cf6fb7..e1e6f21796a 100644 --- a/components/match2/wikis/valorant/match_group_input_custom.lua +++ b/components/match2/wikis/valorant/match_group_input_custom.lua @@ -65,7 +65,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -143,15 +144,6 @@ function MatchFunctions.calculateMatchScore(maps, bestOf) end end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - match.patch = Logic.emptyOr(match.patch, Variables.varDefault('patch')) - - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/warcraft/match_group_input_custom.lua b/components/match2/wikis/warcraft/match_group_input_custom.lua index 99211ed5167..5574335d52b 100644 --- a/components/match2/wikis/warcraft/match_group_input_custom.lua +++ b/components/match2/wikis/warcraft/match_group_input_custom.lua @@ -103,7 +103,7 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchGroupInputUtil.getCommonTournamentVars(match) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.vod = Logic.nilIfEmpty(match.vod) diff --git a/components/match2/wikis/wildrift/match_group_input_custom.lua b/components/match2/wikis/wildrift/match_group_input_custom.lua index b6c43287b0d..b1a9b311d68 100644 --- a/components/match2/wikis/wildrift/match_group_input_custom.lua +++ b/components/match2/wikis/wildrift/match_group_input_custom.lua @@ -74,7 +74,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -149,13 +150,6 @@ function MatchFunctions.getBestOf(match) return bestOf or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode', DEFAULT_MODE)) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param match table ---@return table function MatchFunctions.getLinks(match) diff --git a/components/match2/wikis/worldoftanks/match_group_input_custom.lua b/components/match2/wikis/worldoftanks/match_group_input_custom.lua index 5366fcdcbe4..b3ec8b6bcb5 100644 --- a/components/match2/wikis/worldoftanks/match_group_input_custom.lua +++ b/components/match2/wikis/worldoftanks/match_group_input_custom.lua @@ -66,7 +66,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -134,13 +135,6 @@ function MatchFunctions.getBestOf(bestofInput) return tonumber(Variables.varDefault('bestof')) or DEFAULT_BESTOF end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) diff --git a/components/match2/wikis/zula/match_group_input_custom.lua b/components/match2/wikis/zula/match_group_input_custom.lua index f9e3a7a4d1b..84c7ba913e4 100644 --- a/components/match2/wikis/zula/match_group_input_custom.lua +++ b/components/match2/wikis/zula/match_group_input_custom.lua @@ -67,7 +67,8 @@ function CustomMatchGroupInput.processMatch(match, options) MatchGroupInputUtil.setPlacement(opponents, match.winner, 1, 2, match.resulttype) end - MatchFunctions.getTournamentVars(match) + match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) + Table.mergeInto(match, MatchGroupInputUtil.getTournamentContext(match)) match.stream = Streams.processStreams(match) match.links = MatchFunctions.getLinks(match) @@ -122,13 +123,6 @@ function MatchFunctions.extractMaps(match, opponentCount) return maps end ----@param match table ----@return table -function MatchFunctions.getTournamentVars(match) - match.mode = Logic.emptyOr(match.mode, Variables.varDefault('tournament_mode'), DEFAULT_MODE) - return MatchGroupInputUtil.getCommonTournamentVars(match) -end - -- Template:Map sets a default map name so we can count the number of maps. -- These maps however shouldn't be stored -- The keepMap function will check if a map should be kept