File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -420,6 +420,7 @@ type RankUpdate struct {
420420 RankOld int
421421 RankNew int
422422 WinCount int
423+ Player * common.Player // may be nil if the player has already disconnected
423424}
424425
425426// SteamID64 converts SteamID32 to the 64-bit SteamID variant and returns the result.
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ package demoinfocs
33import (
44 "fmt"
55
6- "github.com/markus-wa/go-unassert"
6+ unassert "github.com/markus-wa/go-unassert"
77
8+ common "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/common"
89 events "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/events"
910 msg "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/msg"
1011)
@@ -123,12 +124,21 @@ func (umh userMessageHandler) rankUpdate(um *msg.CSVCMsg_UserMessage) {
123124 }
124125
125126 for _ , v := range st .RankUpdate {
127+ // find player (if he hasn't disconnected already)
128+ var player * common.Player
129+ for _ , pl := range umh .parser .gameState .playersByUserID { //nolint:wsl
130+ if pl .SteamID32 () == uint32 (v .AccountId ) {
131+ player = pl
132+ }
133+ }
134+
126135 umh .dispatch (events.RankUpdate {
127136 SteamID32 : v .AccountId ,
128137 RankOld : int (v .RankOld ),
129138 RankNew : int (v .RankNew ),
130139 WinCount : int (v .NumWins ),
131140 RankChange : v .RankChange ,
141+ Player : player ,
132142 })
133143 }
134144}
You can’t perform that action at this time.
0 commit comments