decode AcquireUdItem

This commit is contained in:
wish
2023-02-19 22:45:44 +11:00
parent 7b694c2ce1
commit 543f5c129c
2 changed files with 27 additions and 25 deletions

View File

@@ -1,30 +1,20 @@
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"
) )
// MsgMhfAcquireUdItem represents the MSG_MHF_ACQUIRE_UD_ITEM // MsgMhfAcquireUdItem represents the MSG_MHF_ACQUIRE_UD_ITEM
type MsgMhfAcquireUdItem struct { type MsgMhfAcquireUdItem struct {
AckHandle uint32 AckHandle uint32
Unk0 uint8 Freeze bool
// from gal RewardType uint8
// daily = 0 Count int
// personal = 1 RewardIDs []uint32
// personal rank = 2
// guild rank = 3
// gcp = 4
// from cat
// treasure achievement = 5
// personal achievement = 6
// guild achievement = 7
RewardType uint8
Unk2 uint8 // Number of uint32s to read?
Unk3 []byte
} }
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
@@ -34,13 +24,13 @@ func (m *MsgMhfAcquireUdItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8() m.Freeze = bf.ReadBool()
m.RewardType = bf.ReadUint8() m.RewardType = bf.ReadUint8()
m.Unk2 = bf.ReadUint8() m.Count = int(bf.ReadUint8())
for i := uint8(0); i < m.Unk2; i++ { for i := 0; i < m.Count; i++ {
bf.ReadUint32() m.RewardIDs = append(m.RewardIDs, bf.ReadUint32())
} }
return nil return nil
} }

View File

@@ -361,7 +361,19 @@ func handleMsgMhfGetUdNormaPresentList(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfAcquireUdItem(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfAcquireUdItem(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfAcquireUdItem) pkt := p.(*mhfpacket.MsgMhfAcquireUdItem)
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) // from gal
// daily = 0
// personal = 1
// personal rank = 2
// guild rank = 3
// gcp = 4
// from cat
// treasure achievement = 5
// personal achievement = 6
// guild achievement = 7
bf := byteframe.NewByteFrame()
bf.WriteUint16(0) // NumRewards
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
} }
func handleMsgMhfGetUdRanking(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfGetUdRanking(s *Session, p mhfpacket.MHFPacket) {