From 0d2affe95dee6e675496e802cbfc2d43652faf1f Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:22:21 +0700 Subject: [PATCH 01/13] feat(match2): Support for Marvel Rivals --- .../marvelrivals/match_group_input_custom.lua | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 components/match2/wikis/marvelrivals/match_group_input_custom.lua diff --git a/components/match2/wikis/marvelrivals/match_group_input_custom.lua b/components/match2/wikis/marvelrivals/match_group_input_custom.lua new file mode 100644 index 0000000000..d5a6621dff --- /dev/null +++ b/components/match2/wikis/marvelrivals/match_group_input_custom.lua @@ -0,0 +1,89 @@ +--- +-- @Liquipedia +-- wiki=marvelrivals +-- page=Module:MatchGroup/Input/Custom +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Array = require('Module:Array') +local Logic = require('Module:Logic') +local Lua = require('Module:Lua') +local Variables = require('Module:Variables') + +local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') + +local DEFAULT_BESTOF = 3 + +local CustomMatchGroupInput = {} +local MatchFunctions = {} +local MapFunctions = {} + +MatchFunctions.DEFAULT_MODE = 'team' + +---@param match table +---@param options table? +---@return table +function CustomMatchGroupInput.processMatch(match, options) + return MatchGroupInputUtil.standardProcessMatch(match, MatchFunctions) +end + +-- +-- match related functions +-- +---@param match table +---@param opponents table[] +---@return table[] +function MatchFunctions.extractMaps(match, opponents) + return MatchGroupInputUtil.standardProcessMaps(match, opponents, MapFunctions) +end + +---@param games table[] +---@return table[] +function MatchFunctions.removeUnsetMaps(games) + return Array.filter(games, function(map) + return map.map ~= nil + end) +end + +---@param maps table[] +---@return fun(opponentIndex: integer): integer? +function MatchFunctions.calculateMatchScore(maps) + return function(opponentIndex) + return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex) + end +end + +---@param bestofInput string|integer? +---@return integer? +function MatchFunctions.getBestOf(bestofInput) + local bestof = tonumber(Logic.emptyOr(bestofInput, Variables.varDefault('bestof'))) + Variables.varDefine('bestof', bestof) + return bestof or DEFAULT_BESTOF +end + +---@param match table +---@param games table[] +---@param opponents table[] +---@return table +function MatchFunctions.getExtraData(match, games, opponents) + return { + mvp = MatchGroupInputUtil.readMvp(match, opponents), + } +end + +-- +-- map related functions +-- + +---@param match table +---@param map table +---@param opponents table[] +---@return table +function MapFunctions.getExtraData(match, map, opponents) + return { + comment = map.comment, + } +end + +return CustomMatchGroupInput From 6e4519873f41fff88c108ec31f1bffde69a26baa Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:24:32 +0700 Subject: [PATCH 02/13] add Generator --- .../get_match_group_copy_paste_wiki.lua | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua diff --git a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua new file mode 100644 index 0000000000..6b3da54a08 --- /dev/null +++ b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua @@ -0,0 +1,50 @@ +--- +-- @Liquipedia +-- wiki=marvelrivals +-- page=Module:GetMatchGroupCopyPaste/wiki +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Array = require('Module:Array') +local Class = require('Module:Class') +local Logic = require('Module:Logic') +local Lua = require('Module:Lua') + +local BaseCopyPaste = Lua.import('Module:GetMatchGroupCopyPaste/wiki/Base') + +---@class MarvelRivalsMatch2CopyPaste: Match2CopyPasteBase +local WikiCopyPaste = Class.new(BaseCopyPaste) + +local INDENT = WikiCopyPaste.Indent + +--returns the Code for a Match, depending on the input +---@param bestof integer +---@param mode string +---@param index integer +---@param opponents integer +---@param args table +---@return string +function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) + local showScore = Logic.nilOr(Logic.readBool(args.score), bestof == 0) + local opponent = WikiCopyPaste.getOpponent(mode, showScore) + + local lines = Array.extendWith({}, + '{{Match', + index == 1 and (INDENT .. '|bestof=' .. (bestof ~= 0 and bestof or '')) or nil, + Logic.readBool(args.needsWinner) and (INDENT .. '|winner=') or nil, + INDENT .. '|date=', + Logic.readBool(args.streams) and (INDENT .. '|twitch=|youtube=|vod=') or nil, + Array.map(Array.range(1, opponents), function(opponentIndex) + return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent + end), + bestof ~= 0 and Array.map(Array.range(1, bestof), function(mapIndex) + return INDENT .. '|map' .. mapIndex .. '={{Map|map=|mode=|score1=|score2=|winner=}}' + end) or nil, + INDENT .. '}}' + ) + + return table.concat(lines, '\n') +end + +return WikiCopyPaste From 8fc08ac93be7acbe2ee5951af58545fa14aa0977 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:24:46 +0700 Subject: [PATCH 03/13] add summary --- .../wikis/marvelrivals/match_summary.lua | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 components/match2/wikis/marvelrivals/match_summary.lua diff --git a/components/match2/wikis/marvelrivals/match_summary.lua b/components/match2/wikis/marvelrivals/match_summary.lua new file mode 100644 index 0000000000..b27fa09f5a --- /dev/null +++ b/components/match2/wikis/marvelrivals/match_summary.lua @@ -0,0 +1,51 @@ +--- +-- @Liquipedia +-- wiki=marvelrivals +-- page=Module:MatchSummary +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Lua = require('Module:Lua') + +local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') +local MatchSummary = Lua.import('Module:MatchSummary/Base') +local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') +local WidgetUtil = Lua.import('Module:Widget/Util') + +local CustomMatchSummary = {} + +---@param args table +---@return Html +function CustomMatchSummary.getByMatchId(args) + return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args) +end + +---@param date string +---@param game MatchGroupUtilGame +---@param gameIndex integer +---@return Widget? +function CustomMatchSummary.createGame(date, game, gameIndex) + if not game.map then + return + end + + local function makeTeamSection(opponentIndex) + return { + MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, + DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner) + } + end + + return MatchSummaryWidgets.Row{ + classes = {'brkts-popup-body-game'}, + children = WidgetUtil.collect( + MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(1)}, + MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game)}, + MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(2), flipped = true}, + MatchSummaryWidgets.GameComment{children = game.comment} + ) + } +end + +return CustomMatchSummary From 93e5e541fe5ed5d4d367ed6c0c7443a12b9c50c0 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:25:18 +0700 Subject: [PATCH 04/13] add Info set position to true to match Overwatch --- standard/info/wikis/marvelrivals/info.lua | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 standard/info/wikis/marvelrivals/info.lua diff --git a/standard/info/wikis/marvelrivals/info.lua b/standard/info/wikis/marvelrivals/info.lua new file mode 100644 index 0000000000..d1b2f27d1b --- /dev/null +++ b/standard/info/wikis/marvelrivals/info.lua @@ -0,0 +1,40 @@ +--- +-- @Liquipedia +-- wiki=marvelrivals +-- page=Module:Info +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +return { + startYear = 2024, + wikiName = 'marvelrivals', + name = 'Marvel Rivals', + defaultGame = 'Marvel Rivals', + games = { + ['Marvel Rivals'] = { + abbreviation = 'Marvel Rivals', + name = 'Marvel Rivals', + link = 'Marvel Rivals', + logo = { + darkMode = 'Marvel Rivals darkmode.png', + lightMode = 'Marvel Rivals lightmode.png', + }, + defaultTeamLogo = { + darkMode = 'Marvel Rivals darkmode.png', + lightMode = 'Marvel Rivals lightmode.png', + }, + }, + }, + config = { + squads = { + hasPosition = true, + hasSpecialTeam = false, + allowManual = false, + }, + match2 = { + status = 0, + }, + }, + defaultRoundPrecision = 0, +} From 0c9c4cffd560f22de561f6f21218d264c90eaaf9 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:39:11 +0700 Subject: [PATCH 05/13] adjust game name and add matchWidth --- standard/info/wikis/marvelrivals/info.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/standard/info/wikis/marvelrivals/info.lua b/standard/info/wikis/marvelrivals/info.lua index d1b2f27d1b..e5eb854622 100644 --- a/standard/info/wikis/marvelrivals/info.lua +++ b/standard/info/wikis/marvelrivals/info.lua @@ -12,7 +12,7 @@ return { name = 'Marvel Rivals', defaultGame = 'Marvel Rivals', games = { - ['Marvel Rivals'] = { + marvelrivals = { abbreviation = 'Marvel Rivals', name = 'Marvel Rivals', link = 'Marvel Rivals', @@ -34,6 +34,7 @@ return { }, match2 = { status = 0, + matchWidth = 180, }, }, defaultRoundPrecision = 0, From 71ae920bc01ebd8030c22aa095d112775c08deec Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:41:28 +0700 Subject: [PATCH 06/13] match2 status --- standard/info/wikis/marvelrivals/info.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/info/wikis/marvelrivals/info.lua b/standard/info/wikis/marvelrivals/info.lua index e5eb854622..dd92b55624 100644 --- a/standard/info/wikis/marvelrivals/info.lua +++ b/standard/info/wikis/marvelrivals/info.lua @@ -33,7 +33,7 @@ return { allowManual = false, }, match2 = { - status = 0, + status = 2, matchWidth = 180, }, }, From 32dafd3bd6a55f55c6e7798c42fba11d2b294679 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:44:22 +0700 Subject: [PATCH 07/13] Commons Bestof, remove mvp and unsetmaps --- .../marvelrivals/match_group_input_custom.lua | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/components/match2/wikis/marvelrivals/match_group_input_custom.lua b/components/match2/wikis/marvelrivals/match_group_input_custom.lua index d5a6621dff..aebfa449d0 100644 --- a/components/match2/wikis/marvelrivals/match_group_input_custom.lua +++ b/components/match2/wikis/marvelrivals/match_group_input_custom.lua @@ -20,6 +20,7 @@ local MatchFunctions = {} local MapFunctions = {} MatchFunctions.DEFAULT_MODE = 'team' +MatchFunctions.getBestOf = MatchGroupInputUtil.getBestOf ---@param match table ---@param options table? @@ -38,14 +39,6 @@ function MatchFunctions.extractMaps(match, opponents) return MatchGroupInputUtil.standardProcessMaps(match, opponents, MapFunctions) end ----@param games table[] ----@return table[] -function MatchFunctions.removeUnsetMaps(games) - return Array.filter(games, function(map) - return map.map ~= nil - end) -end - ---@param maps table[] ---@return fun(opponentIndex: integer): integer? function MatchFunctions.calculateMatchScore(maps) @@ -54,24 +47,6 @@ function MatchFunctions.calculateMatchScore(maps) end end ----@param bestofInput string|integer? ----@return integer? -function MatchFunctions.getBestOf(bestofInput) - local bestof = tonumber(Logic.emptyOr(bestofInput, Variables.varDefault('bestof'))) - Variables.varDefine('bestof', bestof) - return bestof or DEFAULT_BESTOF -end - ----@param match table ----@param games table[] ----@param opponents table[] ----@return table -function MatchFunctions.getExtraData(match, games, opponents) - return { - mvp = MatchGroupInputUtil.readMvp(match, opponents), - } -end - -- -- map related functions -- From 251c2519e68ee1bc9b0a68c30186cb5e4d42abb4 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:46:11 +0700 Subject: [PATCH 08/13] Adjust generator --- .../wikis/marvelrivals/get_match_group_copy_paste_wiki.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua index 6b3da54a08..b39ab54ad3 100644 --- a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua +++ b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua @@ -31,7 +31,6 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) local lines = Array.extendWith({}, '{{Match', - index == 1 and (INDENT .. '|bestof=' .. (bestof ~= 0 and bestof or '')) or nil, Logic.readBool(args.needsWinner) and (INDENT .. '|winner=') or nil, INDENT .. '|date=', Logic.readBool(args.streams) and (INDENT .. '|twitch=|youtube=|vod=') or nil, @@ -39,7 +38,7 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent end), bestof ~= 0 and Array.map(Array.range(1, bestof), function(mapIndex) - return INDENT .. '|map' .. mapIndex .. '={{Map|map=|mode=|score1=|score2=|winner=}}' + return INDENT .. '|map' .. mapIndex .. '={{Map|map=|score1=|score2=|winner=}}' end) or nil, INDENT .. '}}' ) From a8525ffd2b9a10e88a5de36ffafa8dc31fbbc38b Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:47:19 +0700 Subject: [PATCH 09/13] Update match_group_input_custom.lua --- .../match2/wikis/marvelrivals/match_group_input_custom.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/match2/wikis/marvelrivals/match_group_input_custom.lua b/components/match2/wikis/marvelrivals/match_group_input_custom.lua index aebfa449d0..2733c5541e 100644 --- a/components/match2/wikis/marvelrivals/match_group_input_custom.lua +++ b/components/match2/wikis/marvelrivals/match_group_input_custom.lua @@ -6,15 +6,10 @@ -- Please see https://github.com/Liquipedia/Lua-Modules to contribute -- -local Array = require('Module:Array') -local Logic = require('Module:Logic') local Lua = require('Module:Lua') -local Variables = require('Module:Variables') local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') -local DEFAULT_BESTOF = 3 - local CustomMatchGroupInput = {} local MatchFunctions = {} local MapFunctions = {} From 95fc4ca32a036b4650941d7118b0b405d771b7d3 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:50:18 +0700 Subject: [PATCH 10/13] Update match_group_input_custom.lua --- .../wikis/marvelrivals/match_group_input_custom.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/match2/wikis/marvelrivals/match_group_input_custom.lua b/components/match2/wikis/marvelrivals/match_group_input_custom.lua index 2733c5541e..d965d3e717 100644 --- a/components/match2/wikis/marvelrivals/match_group_input_custom.lua +++ b/components/match2/wikis/marvelrivals/match_group_input_custom.lua @@ -11,12 +11,12 @@ local Lua = require('Module:Lua') local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') local CustomMatchGroupInput = {} -local MatchFunctions = {} +local MatchFunctions = { + DEFAULT_MODE = 'team', + getBestOf = MatchGroupInputUtil.getBestOf, +} local MapFunctions = {} -MatchFunctions.DEFAULT_MODE = 'team' -MatchFunctions.getBestOf = MatchGroupInputUtil.getBestOf - ---@param match table ---@param options table? ---@return table From b697aa08b352d61d452f02efc4b725b05263c1e6 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:00:14 +0700 Subject: [PATCH 11/13] Add generator changes, outside the obvious of winner vs finished, the rest of input still works just fine --- .../wikis/marvelrivals/get_match_group_copy_paste_wiki.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua index b39ab54ad3..e37917fc83 100644 --- a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua +++ b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua @@ -26,12 +26,12 @@ local INDENT = WikiCopyPaste.Indent ---@param args table ---@return string function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) - local showScore = Logic.nilOr(Logic.readBool(args.score), bestof == 0) + local showScore = Logic.readBool(args.score), bestof == 0 local opponent = WikiCopyPaste.getOpponent(mode, showScore) local lines = Array.extendWith({}, '{{Match', - Logic.readBool(args.needsWinner) and (INDENT .. '|winner=') or nil, + Logic.readBool(args.isFinished) and (INDENT .. '|finished=') or nil, INDENT .. '|date=', Logic.readBool(args.streams) and (INDENT .. '|twitch=|youtube=|vod=') or nil, Array.map(Array.range(1, opponents), function(opponentIndex) From 90d8a00ccaf115c58c6d1acf7fde06eaba123b51 Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Thu, 12 Dec 2024 22:30:19 +0700 Subject: [PATCH 12/13] Update get_match_group_copy_paste_wiki.lua --- .../wikis/marvelrivals/get_match_group_copy_paste_wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua index e37917fc83..eb508d7f88 100644 --- a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua +++ b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua @@ -26,7 +26,7 @@ local INDENT = WikiCopyPaste.Indent ---@param args table ---@return string function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) - local showScore = Logic.readBool(args.score), bestof == 0 + local showScore = bestof == 0 local opponent = WikiCopyPaste.getOpponent(mode, showScore) local lines = Array.extendWith({}, From 20e7d8f1bd927a10ad35b9801067e41ae47d45fd Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 17 Dec 2024 02:24:35 +0700 Subject: [PATCH 13/13] Update get_match_group_copy_paste_wiki.lua --- .../wikis/marvelrivals/get_match_group_copy_paste_wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua index eb508d7f88..49555c1ccc 100644 --- a/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua +++ b/components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua @@ -31,7 +31,7 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) local lines = Array.extendWith({}, '{{Match', - Logic.readBool(args.isFinished) and (INDENT .. '|finished=') or nil, + showScore and (INDENT .. '|finished=') or nil, INDENT .. '|date=', Logic.readBool(args.streams) and (INDENT .. '|twitch=|youtube=|vod=') or nil, Array.map(Array.range(1, opponents), function(opponentIndex)