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
42 changes: 40 additions & 2 deletions lua/wikis/tarkovarena/GetMatchGroupCopyPaste/wiki.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,27 @@ local INDENT = WikiCopyPaste.Indent
---@param args table
---@return string
function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args)
local showScore = bestof == 0
if opponents > 2 then
return WikiCopyPaste.getFfaMatchCode(bestof, mode, index, opponents, args)
else
return WikiCopyPaste.getStandardMatchCode(bestof, mode, index, opponents, args)
end
end

---@param bestof integer
---@param mode string
---@param index integer
---@param opponents integer
---@param args table
---@return string
function WikiCopyPaste.getStandardMatchCode(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',
showScore and (INDENT .. '|finished=') or nil,
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)
Expand All @@ -46,4 +61,27 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args)
return table.concat(lines, '\n')
end

---@param bestof integer
---@param mode string
---@param index integer
---@param opponents integer
---@param args table
---@return string
function WikiCopyPaste.getFfaMatchCode(bestof, mode, index, opponents, args)
local lines = Array.extend(
'{{Match|finished=',
INDENT .. '|p_kill=1 |p1=12 |p2=9 |p3=7 |p4=5 |p5=4 |p6=3 |p7=3 |p8=2 |p9=2 |p10=2 ' ..
INDENT .. '|twitch=|youtube=',
Array.map(Array.range(1, bestof), function(mapIndex)
return INDENT .. '|map' .. mapIndex .. '={{Map|map=|date=|finished=|vod=}}'
end),
Array.map(Array.range(1, opponents), function(opponentIndex)
return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste.getFfaOpponent(mode, bestof)
end),
'}}'
)

return table.concat(lines, '\n')
end

return WikiCopyPaste
41 changes: 37 additions & 4 deletions lua/wikis/tarkovarena/MatchGroup/Input/Custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@

local Lua = require('Module:Lua')

local Array = Lua.import('Module:Array')
local FnUtil = Lua.import('Module:FnUtil')
local Operator = Lua.import('Module:Operator')

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

local CustomMatchGroupInput = {}

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

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

---@class TarkovArenaFfaMatchParser: FfaMatchParserInterface
local FfaMatchFunctions = {
DEFAULT_MODE = 'team',
}

---@class TarkovArenaFfaMapParser: FfaMapParserInterface
local FfaMapFunctions = {}

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

--
-- match related functions
--
-- "Normal" match
---@param match table
---@param opponents MGIParsedOpponent[]
---@return table[]
Expand All @@ -41,4 +53,25 @@ function MatchFunctions.calculateMatchScore(maps)
return FnUtil.curry(MatchGroupInputUtil.computeMatchScoreFromMapWinners, maps)
end

--- FFA Match

---@param match table
---@param opponents MGIParsedOpponent[]
---@param scoreSettings table
---@return table[]
function FfaMatchFunctions.extractMaps(match, opponents, scoreSettings)
return MatchGroupInputUtil.standardProcessFfaMaps(match, opponents, scoreSettings, FfaMapFunctions)
end

---@param opponents MGIParsedOpponent[]
---@param maps table[]
---@return fun(opponentIndex: integer): integer?
function FfaMatchFunctions.calculateMatchScore(opponents, maps)
return function(opponentIndex)
return Array.reduce(Array.map(maps, function(map)
return map.opponents[opponentIndex].score or 0
end), Operator.add, 0) + (opponents[opponentIndex].extradata.startingpoints or 0)
end
end

return CustomMatchGroupInput
4 changes: 0 additions & 4 deletions lua/wikis/tarkovarena/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ end
---@param gameIndex integer
---@return Widget?
function CustomMatchSummary.createGame(date, game, gameIndex)
if not game.map then
return
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this change intended?

@Hesketh2 Hesketh2 Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure why it wasnt in the original setup (lab dont have it, and it seems to not change anything visually, but if its a more recommended to not remove this I will add itback)


local function makeTeamSection(opponentIndex)
return {
MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex},
Expand Down
42 changes: 42 additions & 0 deletions lua/wikis/tarkovarena/MatchSummary/Ffa.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
-- @Liquipedia
-- page=Module:MatchSummary/Ffa
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local CustomMatchSummary = {}

local Lua = require('Module:Lua')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom')
local SummaryHelper = Lua.import('Module:MatchSummary/Base/Ffa')

local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local Html = Lua.import('Module:Widget/Html')
local WidgetUtil = Lua.import('Module:Widget/Util')

---@param props {bracketId: string, matchId: string}
---@return Widget
function CustomMatchSummary.getByMatchId(props)
---@class FFAMatchGroupUtilMatch
local match = MatchGroupUtil.fetchMatchForBracketDisplay(props.bracketId, props.matchId)
SummaryHelper.updateMatchOpponents(match)
local scoringData = SummaryHelper.createScoringData(match)

return Html.Fragment{children = {
MatchSummaryWidgets.Header{matchId = match.matchId, games = match.games},
MatchSummaryWidgets.Tab{
matchId = match.matchId,
idx = 0,
children = WidgetUtil.collect(
MatchSummaryWidgets.GamesSchedule{match = match},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
MatchSummaryWidgets.MatchInformation(match),
SummaryHelper.standardMatch(match)
)
}
}}
end

return CustomMatchSummary
Loading