aboutsummaryrefslogtreecommitdiff
path: root/packets/messages/types/SvcSounds.go
diff options
context:
space:
mode:
Diffstat (limited to 'packets/messages/types/SvcSounds.go')
-rw-r--r--packets/messages/types/SvcSounds.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/packets/messages/types/SvcSounds.go b/packets/messages/types/SvcSounds.go
new file mode 100644
index 0000000..1f76a03
--- /dev/null
+++ b/packets/messages/types/SvcSounds.go
@@ -0,0 +1,31 @@
1package types
2
3import "github.com/pektezol/bitreader"
4
5type SvcSounds struct {
6 ReliableSound bool
7 Size int8
8 Data []byte
9}
10
11func ParseSvcSounds(reader *bitreader.ReaderType) SvcSounds {
12 reliablesound := reader.TryReadBool()
13 var size int8
14 var length int16
15 if reliablesound {
16 size = 1
17 } else {
18 size = int8(reader.TryReadInt8())
19 }
20 if reliablesound {
21 length = int16(reader.TryReadInt8())
22 } else {
23 length = int16(reader.TryReadInt16())
24 }
25 data := reader.TryReadBytesToSlice(int(length / 8))
26 return SvcSounds{
27 ReliableSound: reliablesound,
28 Size: size,
29 Data: data,
30 }
31}