-
Notifications
You must be signed in to change notification settings - Fork 2
/
GuildUpdate.go
44 lines (34 loc) · 841 Bytes
/
GuildUpdate.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package eqStruct
import (
"github.com/nomoresecretz/ghoeq-common/proto/eqstruct"
"google.golang.org/protobuf/proto"
)
type GuildUpdate struct {
GuildID uint32
Guild *GuildEntry
bPointer int
}
func (p *GuildUpdate) EQType() EQType { return EQT_GuildUpdate }
func (p *GuildUpdate) bp() *int { return &p.bPointer }
func (p *GuildUpdate) Unmarshal(b []byte) (int, error) {
p.bPointer = 0
if err := EQRead(b, p, &p.GuildID, 0); err != nil {
return 0, err
}
p.Guild = &GuildEntry{}
bp, err := p.Guild.Unmarshal(b[p.bPointer:])
if err != nil {
return 0, err
}
p.bPointer += bp
return p.bPointer, nil
}
func (p *GuildUpdate) Proto() *eqstruct.GuildUpdate {
return &eqstruct.GuildUpdate{
GuildId: p.GuildID,
Guild: p.Guild.Proto(),
}
}
func (p *GuildUpdate) ProtoMess() proto.Message {
return p.Proto()
}