aboutsummaryrefslogtreecommitdiff
path: root/packets/messages/types/NetSetConVar.go
blob: b50295341c8c2214110209ad25a74621ec424005 (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
package types

import "github.com/pektezol/bitreader"

type NetSetConVar struct {
	Length  uint8
	ConVars []ConVar
}

type ConVar struct {
	Name  string
	Value string
}

func ParseNetSetConVar(reader *bitreader.ReaderType) NetSetConVar {
	var convars []ConVar
	netsetconvar := NetSetConVar{
		Length: reader.TryReadInt8(),
	}
	for i := 0; i < int(netsetconvar.Length); i++ {
		convars = append(convars, ConVar{
			Name:  reader.TryReadString(),
			Value: reader.TryReadString(),
		})
	}
	netsetconvar.ConVars = convars
	return netsetconvar
}