-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into aoe-mgi-custom-map-parsing-to-standard
- Loading branch information
Showing
27 changed files
with
269 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
components/match2/wikis/marvelrivals/get_match_group_copy_paste_wiki.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
-- @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 = bestof == 0 | ||
local opponent = WikiCopyPaste.getOpponent(mode, showScore) | ||
|
||
local lines = Array.extendWith({}, | ||
'{{Match', | ||
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) | ||
return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent | ||
end), | ||
bestof ~= 0 and Array.map(Array.range(1, bestof), function(mapIndex) | ||
return INDENT .. '|map' .. mapIndex .. '={{Map|map=|score1=|score2=|winner=}}' | ||
end) or nil, | ||
INDENT .. '}}' | ||
) | ||
|
||
return table.concat(lines, '\n') | ||
end | ||
|
||
return WikiCopyPaste |
59 changes: 59 additions & 0 deletions
59
components/match2/wikis/marvelrivals/match_group_input_custom.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=marvelrivals | ||
-- page=Module:MatchGroup/Input/Custom | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local Lua = require('Module:Lua') | ||
|
||
local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') | ||
|
||
local CustomMatchGroupInput = {} | ||
local MatchFunctions = { | ||
DEFAULT_MODE = 'team', | ||
getBestOf = MatchGroupInputUtil.getBestOf, | ||
} | ||
local MapFunctions = {} | ||
|
||
---@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 maps table[] | ||
---@return fun(opponentIndex: integer): integer? | ||
function MatchFunctions.calculateMatchScore(maps) | ||
return function(opponentIndex) | ||
return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex) | ||
end | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.