From 0af03955e8836c5e403dd040016edde208ff9026 Mon Sep 17 00:00:00 2001 From: wishu Date: Mon, 11 Jul 2022 06:58:10 +1000 Subject: [PATCH] parse festa packets --- .../mhfpacket/msg_mhf_acquire_festa.go | 17 +++++++++++---- ...sg_mhf_acquire_festa_intermediate_prize.go | 9 ++++++-- .../msg_mhf_acquire_festa_personal_prize.go | 13 ++++++++---- .../network/mhfpacket/msg_mhf_charge_festa.go | 21 +++++++++++++++---- .../network/mhfpacket/msg_mhf_entry_festa.go | 16 ++++++++++---- .../msg_mhf_enumerate_festa_member.go | 16 ++++++++++---- .../mhfpacket/msg_mhf_state_festa_g.go | 16 +++++++------- .../mhfpacket/msg_mhf_state_festa_u.go | 16 ++++++++++---- Erupe/network/mhfpacket/msg_mhf_vote_festa.go | 17 +++++++++++---- 9 files changed, 102 insertions(+), 39 deletions(-) diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_festa.go b/Erupe/network/mhfpacket/msg_mhf_acquire_festa.go index 9744f72c4..aab8fbda2 100644 --- a/Erupe/network/mhfpacket/msg_mhf_acquire_festa.go +++ b/Erupe/network/mhfpacket/msg_mhf_acquire_festa.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,12 @@ import ( ) // MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA -type MsgMhfAcquireFesta struct{} +type MsgMhfAcquireFesta struct { + AckHandle uint32 + FestaID uint32 + GuildID uint32 + Unk uint16 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfAcquireFesta) Opcode() network.PacketID { @@ -18,7 +23,11 @@ func (m *MsgMhfAcquireFesta) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.FestaID = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + m.Unk = bf.ReadUint16() + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go b/Erupe/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go index f126c10d2..376c3ee70 100644 --- a/Erupe/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go +++ b/Erupe/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go @@ -9,7 +9,10 @@ import ( ) // MsgMhfAcquireFestaIntermediatePrize represents the MSG_MHF_ACQUIRE_FESTA_INTERMEDIATE_PRIZE -type MsgMhfAcquireFestaIntermediatePrize struct{} +type MsgMhfAcquireFestaIntermediatePrize struct { + AckHandle uint32 + PrizeID uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID { @@ -18,7 +21,9 @@ func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.PrizeID = bf.ReadUint32() + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go b/Erupe/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go index 2fb082c0a..ffcc40698 100644 --- a/Erupe/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go +++ b/Erupe/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,10 @@ import ( ) // MsgMhfAcquireFestaPersonalPrize represents the MSG_MHF_ACQUIRE_FESTA_PERSONAL_PRIZE -type MsgMhfAcquireFestaPersonalPrize struct{} +type MsgMhfAcquireFestaPersonalPrize struct { + AckHandle uint32 + PrizeID uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID { @@ -18,7 +21,9 @@ func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.PrizeID = bf.ReadUint32() + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_charge_festa.go b/Erupe/network/mhfpacket/msg_mhf_charge_festa.go index 38e5fcb48..94d3dd698 100644 --- a/Erupe/network/mhfpacket/msg_mhf_charge_festa.go +++ b/Erupe/network/mhfpacket/msg_mhf_charge_festa.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,12 @@ import ( ) // MsgMhfChargeFesta represents the MSG_MHF_CHARGE_FESTA -type MsgMhfChargeFesta struct{} +type MsgMhfChargeFesta struct { + AckHandle uint32 + FestaID uint32 + GuildID uint32 + Souls int +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfChargeFesta) Opcode() network.PacketID { @@ -18,7 +23,15 @@ func (m *MsgMhfChargeFesta) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.FestaID = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + m.Souls = 0 + for i := bf.ReadUint16(); i > 0; i-- { + m.Souls += int(bf.ReadUint16()) + } + _ = bf.ReadUint8() // Unk + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_entry_festa.go b/Erupe/network/mhfpacket/msg_mhf_entry_festa.go index 86ccc3801..a2416d30e 100644 --- a/Erupe/network/mhfpacket/msg_mhf_entry_festa.go +++ b/Erupe/network/mhfpacket/msg_mhf_entry_festa.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,11 @@ import ( ) // MsgMhfEntryFesta represents the MSG_MHF_ENTRY_FESTA -type MsgMhfEntryFesta struct{} +type MsgMhfEntryFesta struct { + AckHandle uint32 + FestaID uint32 + GuildID uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfEntryFesta) Opcode() network.PacketID { @@ -18,7 +22,11 @@ func (m *MsgMhfEntryFesta) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.FestaID = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + _ = bf.ReadUint16() // Always 0 + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_member.go b/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_member.go index 17c67e6b2..627f4119b 100644 --- a/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_member.go +++ b/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_member.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,11 @@ import ( ) // MsgMhfEnumerateFestaMember represents the MSG_MHF_ENUMERATE_FESTA_MEMBER -type MsgMhfEnumerateFestaMember struct{} +type MsgMhfEnumerateFestaMember struct { + AckHandle uint32 + FestaID uint32 + GuildID uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID { @@ -18,7 +22,11 @@ func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.FestaID = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + _ = bf.ReadUint16() // Hardcoded 0 in the binary. + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_state_festa_g.go b/Erupe/network/mhfpacket/msg_mhf_state_festa_g.go index eefa9d785..50b63ecc8 100644 --- a/Erupe/network/mhfpacket/msg_mhf_state_festa_g.go +++ b/Erupe/network/mhfpacket/msg_mhf_state_festa_g.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -11,9 +11,8 @@ import ( // MsgMhfStateFestaG represents the MSG_MHF_STATE_FESTA_G type MsgMhfStateFestaG struct { AckHandle uint32 - Unk0 uint32 // Shared ID of something. - Unk1 uint32 - Unk2 uint16 // Hardcoded 0 in the binary. + FestaID uint32 + GuildID uint32 } // Opcode returns the ID associated with this packet type. @@ -24,10 +23,9 @@ func (m *MsgMhfStateFestaG) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfStateFestaG) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() - m.Unk0 = bf.ReadUint32() - m.Unk1 = bf.ReadUint32() - m.Unk2 = bf.ReadUint16() - + m.FestaID = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + _ = bf.ReadUint16() // Hardcoded 0 in the binary. return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_state_festa_u.go b/Erupe/network/mhfpacket/msg_mhf_state_festa_u.go index 78e3570c2..841ca6d63 100644 --- a/Erupe/network/mhfpacket/msg_mhf_state_festa_u.go +++ b/Erupe/network/mhfpacket/msg_mhf_state_festa_u.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,11 @@ import ( ) // MsgMhfStateFestaU represents the MSG_MHF_STATE_FESTA_U -type MsgMhfStateFestaU struct{} +type MsgMhfStateFestaU struct { + AckHandle uint32 + FestaID uint32 + GuildID uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfStateFestaU) Opcode() network.PacketID { @@ -18,7 +22,11 @@ func (m *MsgMhfStateFestaU) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfStateFestaU) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.FestaID = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + _ = bf.ReadUint16() // Hardcoded 0 in the binary. + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_vote_festa.go b/Erupe/network/mhfpacket/msg_mhf_vote_festa.go index 882f4ba36..e0a8e2c72 100644 --- a/Erupe/network/mhfpacket/msg_mhf_vote_festa.go +++ b/Erupe/network/mhfpacket/msg_mhf_vote_festa.go @@ -1,7 +1,7 @@ package mhfpacket -import ( - "errors" +import ( + "errors" "erupe-ce/network/clientctx" "erupe-ce/network" @@ -9,7 +9,12 @@ import ( ) // MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA -type MsgMhfVoteFesta struct{} +type MsgMhfVoteFesta struct { + AckHandle uint32 + Unk uint32 + GuildID uint32 + TrialID uint32 +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfVoteFesta) Opcode() network.PacketID { @@ -18,7 +23,11 @@ func (m *MsgMhfVoteFesta) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfVoteFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + m.TrialID = bf.ReadUint32() + return nil } // Build builds a binary packet from the current data.