Skip to content

Commit a2ec66e

Browse files
committed
events.RankUpdate: add utility func SteamID64()
1 parent 8959323 commit a2ec66e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pkg/demoinfocs/events/events.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@ type RankUpdate struct {
417417
WinCount int
418418
}
419419

420+
// SteamID64 converts SteamID32 from the 32-bit SteamID to a 64-bit variant
421+
func (ru RankUpdate) SteamID64() uint64 {
422+
return common.ConvertSteamID32To64(uint32(ru.SteamID32))
423+
}
424+
420425
// ItemEquip signals an item was equipped.
421426
// This event is not available in all demos.
422427
type ItemEquip struct {

pkg/demoinfocs/events/events_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ func TestBombEvents(t *testing.T) {
4343
}
4444
}
4545

46+
func TestRankUpdate_SteamID64(t *testing.T) {
47+
event := RankUpdate{SteamID32: 52686539}
48+
49+
assert.Equal(t, uint64(76561198012952267), event.SteamID64())
50+
}
51+
4652
type demoInfoProviderMock struct {
4753
}
4854

0 commit comments

Comments
 (0)