-
Notifications
You must be signed in to change notification settings - Fork 2
/
Buff.go
84 lines (67 loc) · 1.73 KB
/
Buff.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package eqStruct
import (
"github.com/nomoresecretz/ghoeq-common/proto/eqstruct"
"google.golang.org/protobuf/proto"
)
type BuffFade struct {
EntityID uint16
BuffType uint8
Level uint8
BardModifier uint8
Activated uint8
SpellID uint16
Duration uint16
Counters uint16
SlotNumber uint16
bPointer int
}
func (p *BuffFade) EQType() EQType { return EQT_BuffFade }
func (p *BuffFade) bp() *int { return &p.bPointer }
func (p *BuffFade) SetPointer(i int) { p.bPointer = i }
func (p *BuffFade) Unmarshal(b []byte) (int, error) {
p.bPointer = 0
if err := EQRead(b, p, &p.EntityID, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.BuffType, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Level, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.BardModifier, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Activated, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.SpellID, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Duration, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.Counters, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.SlotNumber, 0); err != nil {
return 0, err
}
return p.bPointer, nil
}
func (p *BuffFade) Proto() *eqstruct.BuffFade {
return &eqstruct.BuffFade{
EntityId: uint32(p.EntityID),
BuffType: uint32(p.BuffType),
Level: uint32(p.Level),
BardModifier: uint32(p.BardModifier),
Activated: uint32(p.Activated),
SpellId: uint32(p.SpellID),
Duration: uint32(p.Duration),
Counters: uint32(p.Counters),
SlotNumber: uint32(p.SlotNumber),
}
}
func (p *BuffFade) ProtoMess() proto.Message {
return p.Proto()
}