From 619b0bf1666d4562d32658c39b62613c65ab2b60 Mon Sep 17 00:00:00 2001 From: wish Date: Mon, 17 Oct 2022 05:27:09 +1100 Subject: [PATCH] handle diva shop coins --- network/mhfpacket/msg_mhf_use_ud_shop_coin.go | 17 +++++++++++------ server/channelserver/handlers.go | 7 ++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/network/mhfpacket/msg_mhf_use_ud_shop_coin.go b/network/mhfpacket/msg_mhf_use_ud_shop_coin.go index 216a6896e..551d23b34 100644 --- a/network/mhfpacket/msg_mhf_use_ud_shop_coin.go +++ b/network/mhfpacket/msg_mhf_use_ud_shop_coin.go @@ -1,15 +1,18 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfUseUdShopCoin represents the MSG_MHF_USE_UD_SHOP_COIN -type MsgMhfUseUdShopCoin struct{} +type MsgMhfUseUdShopCoin struct { + AckHandle uint32 + Cost uint8 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfUseUdShopCoin) Opcode() network.PacketID { @@ -18,7 +21,9 @@ func (m *MsgMhfUseUdShopCoin) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfUseUdShopCoin) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Cost = bf.ReadUint8() + return nil } // Build builds a binary packet from the current data. diff --git a/server/channelserver/handlers.go b/server/channelserver/handlers.go index a198933ad..1eb014145 100644 --- a/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -1772,7 +1772,12 @@ func handleMsgMhfGetUdShopCoin(s *Session, p mhfpacket.MHFPacket) { doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) } -func handleMsgMhfUseUdShopCoin(s *Session, p mhfpacket.MHFPacket) {} +func handleMsgMhfUseUdShopCoin(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfUseUdShopCoin) + bf := byteframe.NewByteFrame() + bf.WriteUint32(0) + doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) +} func handleMsgMhfGetEnhancedMinidata(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfGetEnhancedMinidata)