/
RaidCreate.go
47 lines (36 loc) · 913 Bytes
/
RaidCreate.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
45
46
47
package eqStruct
import (
"github.com/nomoresecretz/ghoeq-common/proto/eqstruct"
"google.golang.org/protobuf/proto"
)
type RaidCreate struct {
Action uint32
LeaderName string // MAX64
LeaderID uint32
bPointer int
}
func (p *RaidCreate) EQType() EQType { return EQT_RaidCreate }
func (p *RaidCreate) bp() *int { return &p.bPointer }
func (p *RaidCreate) Unmarshal(b []byte) (int, error) {
p.bPointer = 0
if err := EQRead(b, p, &p.Action, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.LeaderName, 64); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.LeaderID, 0); err != nil {
return 0, err
}
return p.bPointer, nil
}
func (p *RaidCreate) Proto() *eqstruct.RaidCreate {
return &eqstruct.RaidCreate{
Action: p.Action,
LeaderName: p.LeaderName,
LeaderId: p.LeaderID,
}
}
func (p *RaidCreate) ProtoMess() proto.Message {
return p.Proto()
}