aboutsummaryrefslogtreecommitdiff
path: root/packets/messages/types/SvcPacketEntities.go
diff options
context:
space:
mode:
Diffstat (limited to 'packets/messages/types/SvcPacketEntities.go')
-rw-r--r--packets/messages/types/SvcPacketEntities.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/packets/messages/types/SvcPacketEntities.go b/packets/messages/types/SvcPacketEntities.go
new file mode 100644
index 0000000..bc4c41a
--- /dev/null
+++ b/packets/messages/types/SvcPacketEntities.go
@@ -0,0 +1,39 @@
1package types
2
3import (
4 "fmt"
5
6 "github.com/pektezol/bitreader"
7)
8
9type SvcPacketEntities struct {
10 MaxEntries uint16
11 IsDelta bool
12 DeltaFrom int32
13 BaseLine bool
14 UpdatedEntries uint16
15 UpdateBaseline bool
16 Data []byte
17}
18
19func ParseSvcPacketEntities(reader *bitreader.ReaderType) SvcPacketEntities {
20 maxentries := reader.TryReadBits(11)
21 isdelta := reader.TryReadBool()
22 var deltafrom int32
23 if isdelta {
24 deltafrom = int32(reader.TryReadInt32())
25 }
26 baseline := reader.TryReadBool()
27 updatedentries := reader.TryReadBits(11)
28 length := reader.TryReadBits(20)
29 fmt.Println(length)
30 return SvcPacketEntities{
31 MaxEntries: uint16(maxentries),
32 IsDelta: isdelta,
33 DeltaFrom: deltafrom,
34 BaseLine: baseline,
35 UpdatedEntries: uint16(updatedentries),
36 UpdateBaseline: reader.TryReadBool(),
37 Data: reader.TryReadBytesToSlice(int(length / 8)),
38 }
39}