parse enumerate title further

This commit is contained in:
wish
2022-07-24 15:54:56 +10:00
parent b8f5aa87a2
commit d073a72826
2 changed files with 20 additions and 17 deletions

View File

@@ -1,17 +1,17 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateTitle represents the MSG_MHF_ENUMERATE_TITLE
type MsgMhfEnumerateTitle struct {
AckHandle uint32
Unk0 uint32
AckHandle uint32
CharID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -21,9 +21,9 @@ func (m *MsgMhfEnumerateTitle) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfEnumerateTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
return nil
m.AckHandle = bf.ReadUint32()
m.CharID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -154,7 +154,6 @@ func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) {
bf.WriteBytes(data)
case 4: // Bookshelf
// Hunting log
// Street names/Aliases
bf.WriteBytes(make([]byte, 5576))
case 5: // Gallery
// Furniture placement
@@ -279,14 +278,18 @@ func handleMsgMhfSaveDecoMyset(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfEnumerateTitle(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumerateTitle)
bf := byteframe.NewByteFrame()
titleCount := 114 // all titles unlocked
bf.WriteUint16(uint16(titleCount)) // title count
bf.WriteUint16(0) // unk
for i := 0; i < titleCount; i++ {
bf.WriteUint16(uint16(i))
bf.WriteUint16(0) // unk
bf.WriteUint32(0) // timestamp acquired
bf.WriteUint32(0) // timestamp updated
if pkt.CharID == s.charID {
titleCount := 114 // all titles unlocked
bf.WriteUint16(uint16(titleCount)) // title count
bf.WriteUint16(0) // unk
for i := 0; i < titleCount; i++ {
bf.WriteUint16(uint16(i))
bf.WriteUint16(0) // unk
bf.WriteUint32(0) // timestamp acquired
bf.WriteUint32(0) // timestamp updated
}
} else {
bf.WriteUint16(0)
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}