Skip to content

Commit

Permalink
feat(match2): Add caster support for OW & AOE (#4545)
Browse files Browse the repository at this point in the history
* OW Caster support

* Update match_group_input_custom.lua

* AOE MatchSummary

* AOE MatchGroup

* OW Copy/Paste

* Add casters to aoe copypaste

* Make linter happy

---------

Co-authored-by: mbergen <[email protected]>
  • Loading branch information
FenrirWulf and mbergen authored Aug 16, 2024
1 parent 20ba232 commit 1d0cf57
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

local Array = require('Module:Array')
local Class = require('Module:Class')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')

local OpponentLibraries = require('Module:OpponentLibraries')
Expand Down Expand Up @@ -35,6 +36,7 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args)
INDENT .. '|bestof=' .. bestof,
INDENT .. '|twitch=|vod=',
INDENT .. '|mapdraft=|civdraft=',
Logic.readBool(args.casters) and (INDENT .. '|caster1= |caster2=') or nil,
Array.map(Array.range(1, opponents), function(opponentIndex)
return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste._getOpponent(mode)
end),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function CustomMatchGroupInput._getExtraData(match)
headtohead = match.headtohead,
civdraft = match.civdraft,
mapdraft = match.mapdraft,
casters = MatchGroupInput.readCasters(match, {noSort = true}),
}
end

Expand Down
3 changes: 3 additions & 0 deletions components/match2/wikis/ageofempires/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ function CustomMatchSummary.createBody(match)
body:addRow(row)
end)

-- casters
body:addRow(MatchSummary.makeCastersRow(match.extradata.casters))

return body
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ local INDENT = WikiCopyPaste.Indent
---@param args table
---@return string
function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args)
local casters = Logic.readBool(args.casters)
local showScore = Logic.nilOr(Logic.readBool(args.score), bestof == 0)
local streams = Logic.readBool(args.streams)
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,
streams and (INDENT .. '|twitch=|youtube=|vod=') or nil,
casters and (INDENT .. '|caster1=|caster2=') or nil,
Array.map(Array.range(1, opponents), function(opponentIndex)
return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent
end),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ end
function matchFunctions.getExtraData(match)
match.extradata = {
mvp = MatchGroupInput.readMvp(match),
casters = MatchGroupInput.readCasters(match, {noSort = true}),
}
return match
end
Expand Down
3 changes: 3 additions & 0 deletions components/match2/wikis/overwatch/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ function CustomMatchSummary.createBody(match)

end

-- casters
body:addRow(MatchSummary.makeCastersRow(match.extradata.casters))

return body
end

Expand Down

0 comments on commit 1d0cf57

Please sign in to comment.