-
Notifications
You must be signed in to change notification settings - Fork 2
/
DoorClick.go
49 lines (38 loc) · 974 Bytes
/
DoorClick.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
package eqStruct
import (
"github.com/nomoresecretz/ghoeq-common/proto/eqstruct"
"google.golang.org/protobuf/proto"
)
type DoorClick struct {
DoorID uint8
ItemID uint16
PlayerID uint16
bPointer int
}
func (p *DoorClick) EQType() EQType { return EQT_DoorClick }
func (p *DoorClick) bp() *int { return &p.bPointer }
func (p *DoorClick) SetPointer(i int) { p.bPointer = i }
func (p *DoorClick) Unmarshal(b []byte) (int, error) {
p.bPointer = 0
if err := EQRead(b, p, &p.DoorID, 0); err != nil {
return 0, err
}
p.bPointer = 3
if err := EQRead(b, p, &p.ItemID, 0); err != nil {
return 0, err
}
if err := EQRead(b, p, &p.PlayerID, 0); err != nil {
return 0, err
}
return p.bPointer, nil
}
func (p *DoorClick) Proto() *eqstruct.ClickDoor {
return &eqstruct.ClickDoor{
DoorId: uint32(p.DoorID),
ItemId: uint32(p.ItemID),
PlayerId: uint32(p.PlayerID),
}
}
func (p *DoorClick) ProtoMess() proto.Message {
return p.Proto()
}