aboutsummaryrefslogtreecommitdiff
path: root/pkg/messages/types/svcServerInfo.go
blob: 7d44569d57fdee58869dc9af1216a41ff4a13bb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package messages

import "github.com/pektezol/bitreader"

type SvcServerInfo struct {
	Protocol         uint16
	ServerCount      uint32
	IsHltv           bool
	IsDedicated      bool
	ClientCrc        int32
	StringTableCrc   uint32
	MaxServerClasses uint16
	MapCrc           uint32
	PlayerCount      uint8
	MaxClients       uint8
	TickInterval     float32
	Platform         string
	GameDir          string
	MapName          string
	SkyName          string
	HostName         string
}

func ParseSvcServerInfo(reader *bitreader.Reader) SvcServerInfo {
	return SvcServerInfo{
		Protocol:         reader.TryReadUInt16(),
		ServerCount:      reader.TryReadUInt32(),
		IsHltv:           reader.TryReadBool(),
		IsDedicated:      reader.TryReadBool(),
		ClientCrc:        reader.TryReadSInt32(),
		StringTableCrc:   reader.TryReadUInt32(),
		MaxServerClasses: reader.TryReadUInt16(),
		MapCrc:           reader.TryReadUInt32(),
		PlayerCount:      reader.TryReadUInt8(),
		MaxClients:       reader.TryReadUInt8(),
		TickInterval:     reader.TryReadFloat32(),
		Platform:         reader.TryReadStringLength(1),
		GameDir:          reader.TryReadString(),
		MapName:          reader.TryReadString(),
		SkyName:          reader.TryReadString(),
		HostName:         reader.TryReadString(),
	}
}