aboutsummaryrefslogtreecommitdiff
path: root/pkg/messages/types/netSetConVar.go
blob: f04f564d7a2090a57d9e42d3d47efbb80fd64fcf (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
package messages

import "github.com/pektezol/bitreader"

type NetSetConVar struct {
	Length  int8
	ConVars []conVar
}

type conVar struct {
	Name  string
	Value string
}

func ParseNetSetConVar(reader *bitreader.Reader) NetSetConVar {
	length := reader.TryReadBits(8)
	convars := []conVar{}
	for count := 0; count < int(length); count++ {
		convar := conVar{
			Name:  reader.TryReadString(),
			Value: reader.TryReadString(),
		}
		convars = append(convars, convar)
	}
	return NetSetConVar{
		Length:  int8(length),
		ConVars: convars,
	}
}