aboutsummaryrefslogtreecommitdiff
path: root/pkg/messages/types/svcServerInfo.go
blob: c699eca13b0a2e4a1422021015a81d3cf7a36c03 (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     int16
	ServerCount  int32
	IsHltv       bool
	IsDedicated  bool
	ClientCrc    int32
	MaxClasses   int16
	MapCrc       int32
	PlayerSlot   int8
	MaxClients   int8
	Unk          int32
	TickInterval int32
	COs          int8
	GameDir      string
	MapName      string
	SkyName      string
	HostName     string
}

func ParseSvcServerInfo(reader *bitreader.Reader) SvcServerInfo {
	return SvcServerInfo{
		Protocol:     int16(reader.TryReadBits(16)),
		ServerCount:  int32(reader.TryReadBits(32)),
		IsHltv:       reader.TryReadBool(),
		IsDedicated:  reader.TryReadBool(),
		ClientCrc:    int32(reader.TryReadBits(32)),
		MaxClasses:   int16(reader.TryReadBits(16)),
		MapCrc:       int32(reader.TryReadBits(32)),
		PlayerSlot:   int8(reader.TryReadBits(8)),
		MaxClients:   int8(reader.TryReadBits(8)),
		Unk:          int32(reader.TryReadBits(32)),
		TickInterval: int32(reader.TryReadBits(32)),
		COs:          int8(reader.TryReadBits(8)),
		GameDir:      reader.TryReadString(),
		MapName:      reader.TryReadString(),
		SkyName:      reader.TryReadString(),
		HostName:     reader.TryReadString(),
	}
}