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

import "github.com/pektezol/bitreader"

type SvcSounds struct {
	ReliableSound bool
	Size          int8
	Data          []byte
}

func ParseSvcSounds(reader *bitreader.ReaderType) SvcSounds {
	reliablesound := reader.TryReadBool()
	var size int8
	var length int16
	if reliablesound {
		size = 1
	} else {
		size = int8(reader.TryReadInt8())
	}
	if reliablesound {
		length = int16(reader.TryReadInt8())
	} else {
		length = int16(reader.TryReadInt16())
	}
	return SvcSounds{
		ReliableSound: reliablesound,
		Size:          size,
		Data:          reader.TryReadBitsToSlice(int(length)),
	}
}