Skip to content

Commit

Permalink
Merge pull request #116 from redraskal/fix/trades
Browse files Browse the repository at this point in the history
fix: trades
  • Loading branch information
redraskal authored Feb 6, 2025
2 parents b7ed1e5 + 410afd2 commit 40065ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dissect/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ func (m *MatchReader) WriteExcel(out io.Writer) error {
trades := r.Trades()

for _, trade := range trades {
c.Down(1).Left(3).Str(trade[0].Username)
c.Down(1).Left(2).Str(trade[0].Username)
c.Right(1).Str(trade[0].Target)
c.Right(1).Str(trade[0].Time)
c.Right(1).Str(trade[1].Time)
}
}

Expand Down
5 changes: 4 additions & 1 deletion dissect/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ func (r *Reader) Trades() [][]MatchUpdate {
trades := make([][]MatchUpdate, 0)
var previous = MatchUpdate{}
for _, a := range r.MatchFeedback {
if a.Type == Kill && previous.Target == a.Username {
var samePlayers = (previous.Target == a.Username || previous.Username == a.Target)
var withinThreshold = (previous.TimeInSeconds - a.TimeInSeconds) <= 3
if a.Type == Kill && samePlayers && withinThreshold {
trades = append(trades, []MatchUpdate{previous, a})
}
previous = a
}
return trades
}
Expand Down

0 comments on commit 40065ab

Please sign in to comment.