parse house packets

This commit is contained in:
wish
2022-07-23 09:55:12 +10:00
parent 863e8fc860
commit d32f51a2e1
2 changed files with 36 additions and 21 deletions

View File

@@ -1,18 +1,20 @@
package mhfpacket package mhfpacket
import ( import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network" "erupe-ce/network"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
) )
// MsgMhfEnumerateHouse represents the MSG_MHF_ENUMERATE_HOUSE // MsgMhfEnumerateHouse represents the MSG_MHF_ENUMERATE_HOUSE
type MsgMhfEnumerateHouse struct { type MsgMhfEnumerateHouse struct {
AckHandle uint32 AckHandle uint32
Unk0 uint8 CharID uint32
Unk1 uint32 Method uint8
Player uint8 Unk uint16
Unk2 uint16 Name []byte
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -23,19 +25,15 @@ func (m *MsgMhfEnumerateHouse) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() m.CharID = bf.ReadUint32()
m.Unk1 = bf.ReadUint32() m.Method = bf.ReadUint8()
m.Player = bf.ReadUint8() m.Unk = bf.ReadUint16()
m.Unk2 = bf.ReadUint16() _ = bf.ReadUint8() // len
m.Name = bf.ReadNullTerminatedBytes()
return nil return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateHouse) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfEnumerateHouse) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle) return errors.New("NOT IMPLEMENTED")
bf.WriteUint8(m.Unk0)
bf.WriteUint32(m.Unk1)
bf.WriteUint8(m.Player)
bf.WriteUint16(m.Unk2)
return nil
} }

View File

@@ -1,15 +1,26 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// MsgMhfUpdateHouse represents the MSG_MHF_UPDATE_HOUSE // MsgMhfUpdateHouse represents the MSG_MHF_UPDATE_HOUSE
type MsgMhfUpdateHouse struct{} type MsgMhfUpdateHouse struct {
AckHandle uint32
// 01 = closed
// 02 = open anyone
// 03 = open friends
// 04 = open guild
// 05 = open friends guild
State uint8
Unk1 uint8 // Always 0x01
Unk2 uint16 // Always 0x0000
Password string
}
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfUpdateHouse) Opcode() network.PacketID { func (m *MsgMhfUpdateHouse) Opcode() network.PacketID {
@@ -18,7 +29,13 @@ func (m *MsgMhfUpdateHouse) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfUpdateHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUpdateHouse) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED") m.AckHandle = bf.ReadUint32()
m.State = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint16()
_ = bf.ReadUint8()
m.Password = string(bf.ReadNullTerminatedBytes())
return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.