-
Notifications
You must be signed in to change notification settings - Fork 2
/
PetCommands.go
42 lines (32 loc) · 836 Bytes
/
PetCommands.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
package eqStruct
import (
"github.com/nomoresecretz/ghoeq-common/proto/eqstruct"
"google.golang.org/protobuf/proto"
)
type PetCommand struct {
Command uint32
TargetID uint32
bPointer int
}
func (p *PetCommand) EQType() EQType { return EQT_PetCommand }
func (p *PetCommand) bp() *int { return &p.bPointer }
func (p *PetCommand) SetPointer(i int) { p.bPointer = i }
func (p *PetCommand) Unmarshal(b []byte) (int, error) {
p.bPointer = 0
if err := EQRead(b, p, &p.Command, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.TargetID, 0); err != nil {
return 0, err
}
return p.bPointer, nil
}
func (p *PetCommand) Proto() *eqstruct.PetCommand {
return &eqstruct.PetCommand{
Command: p.Command,
TargetId: p.TargetID,
}
}
func (p *PetCommand) ProtoMess() proto.Message {
return p.Proto()
}