Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions lua/wikis/eva/GetMatchGroupCopyPaste/wiki.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
-- @Liquipedia
-- page=Module:GetMatchGroupCopyPaste/wiki
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Lua = require('Module:Lua')

local Array = Lua.import('Module:Array')
local Class = Lua.import('Module:Class')
local Logic = Lua.import('Module:Logic')

local BaseCopyPaste = Lua.import('Module:GetMatchGroupCopyPaste/wiki/Base')

---@class EvaMatch2CopyPaste: 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
51 changes: 51 additions & 0 deletions lua/wikis/eva/MatchGroup/Input/Custom.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
-- @Liquipedia
-- page=Module:MatchGroup/Input/Custom
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Lua = require('Module:Lua')
local FnUtil = Lua.import('Module:FnUtil')
Comment on lines +8 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local Lua = require('Module:Lua')
local FnUtil = Lua.import('Module:FnUtil')
local Lua = require('Module:Lua')
local FnUtil = Lua.import('Module:FnUtil')

local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util')
local CustomMatchGroupInput = {}

---@class EvaMatchParser: MatchParserInterface
local MatchFunctions = {
DEFAULT_MODE = 'team',
getBestOf = MatchGroupInputUtil.getBestOf,
}

---@class EvaMapParser: MapParserInterface
local MapFunctions = {}

---@param match table
---@param options table?
---@return table
function CustomMatchGroupInput.processMatch(match, options)
return MatchGroupInputUtil.standardProcessMatch(match, MatchFunctions)
end

-- "Normal" match
---@param match table
---@param opponents MGIParsedOpponent[]
---@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 FnUtil.curry(MatchGroupInputUtil.computeMatchScoreFromMapWinners, maps)
end

---@param match table
---@return table
function MatchFunctions.getExtraData(match)
return {
mapveto = MatchGroupInputUtil.getMapVeto(match),
}
end

return CustomMatchGroupInput
46 changes: 46 additions & 0 deletions lua/wikis/eva/MatchSummary.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
-- @Liquipedia
-- 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 Widget
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)
local function makeTeamSection(opponentIndex)
return {
MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex},
DisplayHelper.MapScore(game.opponents[opponentIndex], game.status)
}
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
Loading