-
Notifications
You must be signed in to change notification settings - Fork 2
/
Animation.go
54 lines (42 loc) · 1.04 KB
/
Animation.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
48
49
50
51
52
53
54
package eqStruct
import (
"github.com/nomoresecretz/ghoeq-common/proto/eqstruct"
"google.golang.org/protobuf/proto"
)
type Animation struct {
SpawnID uint16
Target uint16
Action uint8
Value uint8
bPointer int
}
func (p *Animation) EQType() EQType { return EQT_Animation }
func (p *Animation) bp() *int { return &p.bPointer }
func (p *Animation) SetPointer(i int) { p.bPointer = i }
func (p *Animation) Unmarshal(b []byte) (int, error) {
p.bPointer = 0
if err := EQRead(b, p, &p.SpawnID, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Target, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Action, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Value, 0); err != nil {
return 0, err
}
return p.bPointer, nil
}
func (p *Animation) Proto() *eqstruct.Animation {
return &eqstruct.Animation{
SpawnId: uint32(p.SpawnID),
TargetId: uint32(p.Target),
Action: uint32(p.Action),
Value: uint32(p.Value),
}
}
func (p *Animation) ProtoMess() proto.Message {
return p.Proto()
}