mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
correctly parse RegisterEvent & move handlers
This commit is contained in:
@@ -1,20 +1,19 @@
|
|||||||
package mhfpacket
|
package mhfpacket
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"erupe-ce/common/byteframe"
|
||||||
"erupe-ce/network"
|
"erupe-ce/network"
|
||||||
"erupe-ce/network/clientctx"
|
"erupe-ce/network/clientctx"
|
||||||
"erupe-ce/common/byteframe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MsgMhfRegisterEvent represents the MSG_MHF_REGISTER_EVENT
|
// MsgMhfRegisterEvent represents the MSG_MHF_REGISTER_EVENT
|
||||||
type MsgMhfRegisterEvent struct {
|
type MsgMhfRegisterEvent struct {
|
||||||
AckHandle uint32
|
AckHandle uint32
|
||||||
Unk0 uint16
|
Unk0 uint16
|
||||||
Unk1 uint8
|
WorldID uint16
|
||||||
Unk2 uint8
|
LandID uint16
|
||||||
Unk3 uint8
|
Unk3 uint8
|
||||||
Unk4 uint8
|
Unk4 uint8
|
||||||
Unk5 uint16
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opcode returns the ID associated with this packet type.
|
// Opcode returns the ID associated with this packet type.
|
||||||
@@ -26,11 +25,10 @@ func (m *MsgMhfRegisterEvent) Opcode() network.PacketID {
|
|||||||
func (m *MsgMhfRegisterEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
func (m *MsgMhfRegisterEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||||
m.AckHandle = bf.ReadUint32()
|
m.AckHandle = bf.ReadUint32()
|
||||||
m.Unk0 = bf.ReadUint16()
|
m.Unk0 = bf.ReadUint16()
|
||||||
m.Unk1 = bf.ReadUint8()
|
m.WorldID = bf.ReadUint16()
|
||||||
m.Unk2 = bf.ReadUint8()
|
m.LandID = bf.ReadUint16()
|
||||||
m.Unk3 = bf.ReadUint8()
|
m.Unk3 = bf.ReadUint8()
|
||||||
m.Unk4 = bf.ReadUint8()
|
m.Unk4 = bf.ReadUint8()
|
||||||
m.Unk5 = bf.ReadUint16()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,44 +10,6 @@ import (
|
|||||||
"erupe-ce/network/mhfpacket"
|
"erupe-ce/network/mhfpacket"
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleMsgMhfRegisterEvent(s *Session, p mhfpacket.MHFPacket) {
|
|
||||||
pkt := p.(*mhfpacket.MsgMhfRegisterEvent)
|
|
||||||
bf := byteframe.NewByteFrame()
|
|
||||||
bf.WriteUint8(pkt.Unk2)
|
|
||||||
bf.WriteUint8(pkt.Unk4)
|
|
||||||
bf.WriteUint16(0x1142)
|
|
||||||
doAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleMsgMhfReleaseEvent(s *Session, p mhfpacket.MHFPacket) {
|
|
||||||
pkt := p.(*mhfpacket.MsgMhfReleaseEvent)
|
|
||||||
|
|
||||||
// Do this ack manually because it uses a non-(0|1) error code
|
|
||||||
/*
|
|
||||||
_ACK_SUCCESS = 0
|
|
||||||
_ACK_ERROR = 1
|
|
||||||
|
|
||||||
_ACK_EINPROGRESS = 16
|
|
||||||
_ACK_ENOENT = 17
|
|
||||||
_ACK_ENOSPC = 18
|
|
||||||
_ACK_ETIMEOUT = 19
|
|
||||||
|
|
||||||
_ACK_EINVALID = 64
|
|
||||||
_ACK_EFAILED = 65
|
|
||||||
_ACK_ENOMEM = 66
|
|
||||||
_ACK_ENOTEXIT = 67
|
|
||||||
_ACK_ENOTREADY = 68
|
|
||||||
_ACK_EALREADY = 69
|
|
||||||
_ACK_DISABLE_WORK = 71
|
|
||||||
*/
|
|
||||||
s.QueueSendMHF(&mhfpacket.MsgSysAck{
|
|
||||||
AckHandle: pkt.AckHandle,
|
|
||||||
IsBufferResponse: false,
|
|
||||||
ErrorCode: 0x41,
|
|
||||||
AckData: []byte{0x00, 0x00, 0x00, 0x00},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
type Event struct {
|
type Event struct {
|
||||||
EventType uint16
|
EventType uint16
|
||||||
Unk1 uint16
|
Unk1 uint16
|
||||||
|
|||||||
@@ -6,6 +6,48 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func handleMsgMhfRegisterEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||||
|
pkt := p.(*mhfpacket.MsgMhfRegisterEvent)
|
||||||
|
bf := byteframe.NewByteFrame()
|
||||||
|
if pkt.Unk3 > 0 {
|
||||||
|
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bf.WriteUint8(uint8(pkt.WorldID))
|
||||||
|
bf.WriteUint8(uint8(pkt.LandID))
|
||||||
|
bf.WriteUint16(0x1142) // Probably random ID
|
||||||
|
doAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleMsgMhfReleaseEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||||
|
pkt := p.(*mhfpacket.MsgMhfReleaseEvent)
|
||||||
|
|
||||||
|
// Do this ack manually because it uses a non-(0|1) error code
|
||||||
|
/*
|
||||||
|
_ACK_SUCCESS = 0
|
||||||
|
_ACK_ERROR = 1
|
||||||
|
|
||||||
|
_ACK_EINPROGRESS = 16
|
||||||
|
_ACK_ENOENT = 17
|
||||||
|
_ACK_ENOSPC = 18
|
||||||
|
_ACK_ETIMEOUT = 19
|
||||||
|
|
||||||
|
_ACK_EINVALID = 64
|
||||||
|
_ACK_EFAILED = 65
|
||||||
|
_ACK_ENOMEM = 66
|
||||||
|
_ACK_ENOTEXIT = 67
|
||||||
|
_ACK_ENOTREADY = 68
|
||||||
|
_ACK_EALREADY = 69
|
||||||
|
_ACK_DISABLE_WORK = 71
|
||||||
|
*/
|
||||||
|
s.QueueSendMHF(&mhfpacket.MsgSysAck{
|
||||||
|
AckHandle: pkt.AckHandle,
|
||||||
|
IsBufferResponse: false,
|
||||||
|
ErrorCode: 0x41,
|
||||||
|
AckData: []byte{0x00, 0x00, 0x00, 0x00},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
type RaviUpdate struct {
|
type RaviUpdate struct {
|
||||||
Op uint8
|
Op uint8
|
||||||
Dest uint8
|
Dest uint8
|
||||||
|
|||||||
Reference in New Issue
Block a user