Skip to content

Commit

Permalink
Merge pull request #67 from bmarley/assists
Browse files Browse the repository at this point in the history
Parse assists from match data - Fix ellipses for long names in match datapoints
  • Loading branch information
apazzolini authored Nov 4, 2020
2 parents f3632eb + 19cdece commit 7513821
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/MatchPlayer/Roster/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const PlayerItem = styled.li`
overflow: hidden;
cursor: pointer;
display: grid;
grid-template-columns: 1fr 15px 25px;
grid-template-columns: 75px .25fr .25fr .5fr;
grid-column-gap: 5px;
i {
Expand Down Expand Up @@ -87,6 +87,7 @@ const Roster = ({ match, telemetry, marks, rosters }) => {
<PlayerName>{p.name}</PlayerName>
</Tooltip>
<PlayerDatapoint>{p.kills}</PlayerDatapoint>
<PlayerDatapoint>{p.assists}</PlayerDatapoint>
<PlayerDatapoint>{Math.round(p.damageDealt)}</PlayerDatapoint>
</PlayerItem>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/MatchPlayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class MatchPlayer extends React.Component {
/>
</MapContainer>
<RosterContainer mapSize={mapSize}>
<RosterHeader>Name / Kills / Damage</RosterHeader>
<RosterHeader>Name / Kills / Assists / Damage</RosterHeader>
<Roster
match={match}
telemetry={currentTelemetry}
Expand Down
6 changes: 6 additions & 0 deletions src/models/Telemetry.parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function parseTelemetry(matchData, telemetry, focusedPlayerName)
teammates: [],
health: 100,
kills: 0,
assists: 0,
damageDealt: 0,
items: [],
}
Expand Down Expand Up @@ -94,6 +95,7 @@ export default function parseTelemetry(matchData, telemetry, focusedPlayerName)
teammates: teammates[p.name],
health: 100,
kills: 0,
assists: 0,
damageDealt: 0,
items: [],
}
Expand Down Expand Up @@ -210,6 +212,10 @@ export default function parseTelemetry(matchData, telemetry, focusedPlayerName)
incrementPlayerStateVal(d.killer.name, 'kills', 1)
}

if (d && d.assistant && d.assistant.name && d.assistant.name !== d.killer.name) {
incrementPlayerStateVal(d.assistant.name, 'assists', 1)
}

if (d && d.victim.name === focusedPlayerName) {
const killedBy = getKilledBy(d)

Expand Down

0 comments on commit 7513821

Please sign in to comment.