-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(match2): support ffa on warcraft (#5289)
* input processing? * ms (copy from sc2) * copy game summary from sc2 * heroes support in game display? * fix input processing * fix heroes display * looks better * as per feedback from contributors * as per review * lets have a try * unused * kick it since unused
- Loading branch information
Showing
3 changed files
with
383 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=warcraft | ||
-- page=Module:GameSummary | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local CustomGameSummary = {} | ||
|
||
local Array = require('Module:Array') | ||
local Logic = require('Module:Logic') | ||
local Lua = require('Module:Lua') | ||
|
||
local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom') | ||
|
||
local CustomMatchSummary = Lua.import('Module:MatchSummary') | ||
local SummaryHelper = Lua.import('Module:MatchSummary/Base/Ffa') | ||
|
||
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All') | ||
|
||
---@param props {bracketId: string, matchId: string, gameIdx: integer} | ||
---@return Html | ||
function CustomGameSummary.getGameByMatchId(props) | ||
local match = MatchGroupUtil.fetchMatchForBracketDisplay(props.bracketId, props.matchId) | ||
|
||
local game = match.games[props.gameIdx] | ||
assert(game, 'Error Game ID ' .. tostring(props.gameIdx) .. ' not found') | ||
|
||
game.stream = match.stream | ||
|
||
SummaryHelper.updateGameOpponents(match, game) | ||
|
||
return MatchSummaryWidgets.Tab{ | ||
matchId = match.matchId, | ||
idx = props.gameIdx, | ||
children = { | ||
MatchSummaryWidgets.GameDetails{game = game}, | ||
SummaryHelper.standardGame(game, CustomGameSummary) | ||
} | ||
} | ||
end | ||
|
||
---@param columns table[] | ||
---@param game table | ||
---@return table[] | ||
function CustomGameSummary.adjustGameStandingsColumns(columns, game) | ||
local customizedColumns = Array.map(columns, function(column) | ||
if column.id == 'totalPoints' and game.extradata.settings.noscore then | ||
return | ||
end | ||
|
||
return column | ||
end) | ||
|
||
---@param opponent table | ||
---@return boolean | ||
local opponnetHasPlayerWithHeroes = function(opponent) | ||
return Array.any(opponent.players, function(player) | ||
return Logic.isNotDeepEmpty(player.heroes) | ||
end) | ||
end | ||
|
||
return Array.append(customizedColumns, { | ||
id = 'heroes', | ||
sortable = false, | ||
class = 'cell--total-points', | ||
show = function(currentGame) | ||
return Array.any(currentGame.opponents, opponnetHasPlayerWithHeroes) | ||
end, | ||
header = { | ||
value = 'Heroes', | ||
}, | ||
row = { | ||
value = function (opponent, opponentIndex) | ||
return CustomMatchSummary.DisplayHeroes(opponent, {hasHeroes = opponnetHasPlayerWithHeroes(opponent)}) | ||
end, | ||
}, | ||
}) | ||
end | ||
|
||
return CustomGameSummary |
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.