Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(match2) Add map points input to Halo #4793

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions components/match2/wikis/halo/match_group_input_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ end
function MapFunctions.getExtraData(map, opponentCount)
return {
comment = map.comment,
points1 = map.points1,
hjpalpha marked this conversation as resolved.
Show resolved Hide resolved
points2 = map.points2,
}
end

Expand Down
25 changes: 23 additions & 2 deletions components/match2/wikis/halo/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,35 @@ function CustomMatchSummary._createMapRow(game)
centerNode:addClass('brkts-popup-spaced-map-skip')
end

local getScoreValue = function(opponentIndex)
hjpalpha marked this conversation as resolved.
Show resolved Hide resolved
local score = game.scores[opponentIndex]
Comment on lines +147 to +148
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 getScoreValue = function(opponentIndex)
local score = game.scores[opponentIndex]
local displayScore = function(opponentIndex)
local score = DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner)

if not score then
return
end
Comment on lines +149 to +151
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
if not score then
return
end

Not needed with the other changes

local points = game.extradata['points' .. opponentIndex]
if not points then
return score
end
if opponentIndex == 2 then
mbergen marked this conversation as resolved.
Show resolved Hide resolved
return '(' .. points .. ') ' .. score
end
return score .. ' (' .. points .. ')'
mbergen marked this conversation as resolved.
Show resolved Hide resolved
end

local leftNode = mw.html.create('div')
:addClass('brkts-popup-spaced')
:node(CustomMatchSummary._addCheckmark(game.winner == 1))
:node(DisplayHelper.MapScore(game.scores[1], 1, game.resultType, game.walkover, game.winner))
:node(DisplayHelper.MapScore(
getScoreValue(1),
1, game.resultType, game.walkover, game.winner
))
Comment on lines +166 to +169
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
:node(DisplayHelper.MapScore(
getScoreValue(1),
1, game.resultType, game.walkover, game.winner
))
:node(displayScore(1))


local rightNode = mw.html.create('div')
:addClass('brkts-popup-spaced')
:node(DisplayHelper.MapScore(game.scores[2], 2, game.resultType, game.walkover, game.winner))
:node(DisplayHelper.MapScore(
getScoreValue(2),
2, game.resultType, game.walkover, game.winner
))
Comment on lines +173 to +176
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
:node(DisplayHelper.MapScore(
getScoreValue(2),
2, game.resultType, game.walkover, game.winner
))
:node(displayScore(2))

:node(CustomMatchSummary._addCheckmark(game.winner == 2))

row:addElement(leftNode)
Expand Down
Loading