aboutsummaryrefslogtreecommitdiff
path: root/packets/messages/types/SvcServerInfo.go
blob: 9d2648b88ca2450c09daca18f9c69c54b143a5c3 (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 types

import "github.com/pektezol/bitreader"

type SvcServerInfo struct {
	Protocol     uint16
	ServerCount  uint32
	IsHltv       bool
	IsDedicated  bool
	ClientCrc    int32
	MaxClasses   uint16
	MapCrc       uint32
	PlayerSlot   uint8
	MaxClients   uint8
	Unk          uint32
	TickInterval float32
	COs          byte
	GameDir      string
	MapName      string
	SkyName      string
	HostName     string
}

func ParseSvcServerInfo(reader *bitreader.ReaderType) SvcServerInfo {
	return SvcServerInfo{
		Protocol:     reader.TryReadInt16(),
		ServerCount:  reader.TryReadInt32(),
		IsHltv:       reader.TryReadBool(),
		IsDedicated:  reader.TryReadBool(),
		ClientCrc:    int32(reader.TryReadInt32()),
		MaxClasses:   reader.TryReadInt16(),
		MapCrc:       reader.TryReadInt32(),
		PlayerSlot:   reader.TryReadInt8(),
		MaxClients:   reader.TryReadInt8(),
		Unk:          reader.TryReadInt32(),
		TickInterval: reader.TryReadFloat32(),
		COs:          reader.TryReadInt8(),
		GameDir:      reader.TryReadString(),
		MapName:      reader.TryReadString(),
		SkyName:      reader.TryReadString(),
		HostName:     reader.TryReadString(),
	}
}