diff options
Diffstat (limited to 'pkg/messages/types/netSetConVar.go')
| -rw-r--r-- | pkg/messages/types/netSetConVar.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/messages/types/netSetConVar.go b/pkg/messages/types/netSetConVar.go new file mode 100644 index 0000000..08042ae --- /dev/null +++ b/pkg/messages/types/netSetConVar.go | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | package messages | ||
| 2 | |||
| 3 | import "github.com/pektezol/bitreader" | ||
| 4 | |||
| 5 | type NetSetConVar struct { | ||
| 6 | Length int8 | ||
| 7 | ConVars []conVar | ||
| 8 | } | ||
| 9 | |||
| 10 | type conVar struct { | ||
| 11 | Name string | ||
| 12 | Value string | ||
| 13 | } | ||
| 14 | |||
| 15 | func ParseNetSetConVar(reader *bitreader.ReaderType) NetSetConVar { | ||
| 16 | length := reader.TryReadBits(8) | ||
| 17 | convars := []conVar{} | ||
| 18 | for count := 0; count < int(length); count++ { | ||
| 19 | convar := conVar{ | ||
| 20 | Name: reader.TryReadString(), | ||
| 21 | Value: reader.TryReadString(), | ||
| 22 | } | ||
| 23 | convars = append(convars, convar) | ||
| 24 | } | ||
| 25 | return NetSetConVar{ | ||
| 26 | Length: int8(length), | ||
| 27 | ConVars: convars, | ||
| 28 | } | ||
| 29 | } | ||