diff --git a/components/match2/wikis/goals/get_match_group_copy_paste_wiki.lua b/components/match2/wikis/goals/get_match_group_copy_paste_wiki.lua new file mode 100644 index 00000000000..e4006c797ec --- /dev/null +++ b/components/match2/wikis/goals/get_match_group_copy_paste_wiki.lua @@ -0,0 +1,48 @@ +--- +-- @Liquipedia +-- wiki=goals +-- 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 GoalsMatch2CopyPaste: 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.readBool(args.score) + local streams = Logic.readBool(args.streams) + + local lines = Array.extend({}, + '{{Match', + Array.map(Array.range(1, opponents), function(opponentIndex) + return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste.getOpponent(mode, showScore) + end), + INDENT .. '|date= |finished=', + streams and (INDENT .. '|twitch=|vod=') or nil, + Array.map(Array.range(1, bestof), function(mapIndex) + return INDENT .. '|map' .. mapIndex .. '={{Map|score1=|score2=|finished=}}' + end), + '}}' + ) + + return table.concat(lines, '\n') +end + +return WikiCopyPaste diff --git a/components/match2/wikis/goals/match_group_input_custom.lua b/components/match2/wikis/goals/match_group_input_custom.lua new file mode 100644 index 00000000000..9f7c787040f --- /dev/null +++ b/components/match2/wikis/goals/match_group_input_custom.lua @@ -0,0 +1,72 @@ +--- +-- @Liquipedia +-- wiki=goals +-- page=Module:MatchGroup/Input/Custom +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Array = require('Module:Array') +local Lua = require('Module:Lua') +local Operator = require('Module:Operator') +local Table = require('Module:Table') + +local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') + +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) + return MatchGroupInputUtil.standardProcessMatch(match, CustomMatchGroupInput) +end + +---@param match table +---@param opponents table[] +---@return table[] +function CustomMatchGroupInput.extractMaps(match, opponents) + local maps = {} + for mapKey, map in Table.iter.pairsByPrefix(match, 'map', {requireIndex = true}) do + if Table.isEmpty(map) then + break + end + local finishedInput = map.finished --[[@as string?]] + local winnerInput = map.winner --[[@as string?]] + + map.finished = MatchGroupInputUtil.mapIsFinished(map) + local opponentInfo = Array.map(opponents, function(_, opponentIndex) + local score, status = MatchGroupInputUtil.computeOpponentScore({ + walkover = map.walkover, + winner = map.winner, + opponentIndex = opponentIndex, + score = map['score' .. opponentIndex], + }) + return {score = score, status = status} + end) + + map.scores = Array.map(opponentInfo, Operator.property('score')) + if map.finished then + map.resulttype = MatchGroupInputUtil.getResultType(winnerInput, finishedInput, opponentInfo) + map.walkover = MatchGroupInputUtil.getWalkover(map.resulttype, opponentInfo) + map.winner = MatchGroupInputUtil.getWinner(map.resulttype, winnerInput, opponentInfo) + end + + table.insert(maps, map) + match[mapKey] = nil + end + + return maps +end + +---@return fun(opponentIndex: integer): integer +function CustomMatchGroupInput.calculateMatchScore(maps) + return function(opponentIndex) + return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex) + end +end + +return CustomMatchGroupInput diff --git a/components/match2/wikis/goals/match_summary.lua b/components/match2/wikis/goals/match_summary.lua new file mode 100644 index 00000000000..abf594d3f46 --- /dev/null +++ b/components/match2/wikis/goals/match_summary.lua @@ -0,0 +1,40 @@ +--- +-- @Liquipedia +-- wiki=goals +-- page=Module:MatchSummary +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local CustomMatchSummary = {} + +local Lua = require('Module:Lua') + +local MatchSummary = Lua.import('Module:MatchSummary/Base') +local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') +local WidgetUtil = Lua.import('Module:Widget/Util') + +---@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 MatchSummaryRow +function CustomMatchSummary.createGame(date, game, gameIndex) + return MatchSummaryWidgets.Row{ + classes = {'brkts-popup-body-game'}, + css = {['font-size'] = '80%', padding = '4px'}, + children = WidgetUtil.collect( + MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 1}, + MatchSummaryWidgets.GameCenter{children = ('Game ' .. gameIndex)}, + MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = 2}, + MatchSummaryWidgets.GameComment{children = game.comment} + ) + } +end + +return CustomMatchSummary diff --git a/standard/info/wikis/goals/info.lua b/standard/info/wikis/goals/info.lua index f4fdc545239..1024fa8ad9c 100644 --- a/standard/info/wikis/goals/info.lua +++ b/standard/info/wikis/goals/info.lua @@ -33,7 +33,8 @@ return { allowManual = true, }, match2 = { - status = 0, + status = 1, + gameScoresIfBo1 = true, }, }, }