parse festa packets

This commit is contained in:
wishu
2022-07-11 06:58:10 +10:00
parent 9d1a22afb6
commit 0af03955e8
9 changed files with 102 additions and 39 deletions

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,12 @@ import (
) )
// MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireFesta) Opcode() network.PacketID { func (m *MsgMhfAcquireFesta) Opcode() network.PacketID {
@@ -18,7 +23,11 @@ func (m *MsgMhfAcquireFesta) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -9,7 +9,10 @@ import (
) )
// MsgMhfAcquireFestaIntermediatePrize represents the MSG_MHF_ACQUIRE_FESTA_INTERMEDIATE_PRIZE // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID { func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID {
@@ -18,7 +21,9 @@ func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,10 @@ import (
) )
// MsgMhfAcquireFestaPersonalPrize represents the MSG_MHF_ACQUIRE_FESTA_PERSONAL_PRIZE // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID { func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID {
@@ -18,7 +21,9 @@ func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,12 @@ import (
) )
// MsgMhfChargeFesta represents the MSG_MHF_CHARGE_FESTA // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfChargeFesta) Opcode() network.PacketID { func (m *MsgMhfChargeFesta) Opcode() network.PacketID {
@@ -18,7 +23,15 @@ func (m *MsgMhfChargeFesta) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,11 @@ import (
) )
// MsgMhfEntryFesta represents the MSG_MHF_ENTRY_FESTA // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfEntryFesta) Opcode() network.PacketID { func (m *MsgMhfEntryFesta) Opcode() network.PacketID {
@@ -18,7 +22,11 @@ func (m *MsgMhfEntryFesta) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,11 @@ import (
) )
// MsgMhfEnumerateFestaMember represents the MSG_MHF_ENUMERATE_FESTA_MEMBER // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID { func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID {
@@ -18,7 +22,11 @@ func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -11,9 +11,8 @@ import (
// MsgMhfStateFestaG represents the MSG_MHF_STATE_FESTA_G // MsgMhfStateFestaG represents the MSG_MHF_STATE_FESTA_G
type MsgMhfStateFestaG struct { type MsgMhfStateFestaG struct {
AckHandle uint32 AckHandle uint32
Unk0 uint32 // Shared ID of something. FestaID uint32
Unk1 uint32 GuildID uint32
Unk2 uint16 // Hardcoded 0 in the binary.
} }
// Opcode returns the ID associated with this packet type. // 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 // Parse parses the packet from binary
func (m *MsgMhfStateFestaG) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfStateFestaG) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32() m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32() m.FestaID = bf.ReadUint32()
m.Unk1 = bf.ReadUint32() m.GuildID = bf.ReadUint32()
m.Unk2 = bf.ReadUint16() _ = bf.ReadUint16() // Hardcoded 0 in the binary.
return nil return nil
} }

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,11 @@ import (
) )
// MsgMhfStateFestaU represents the MSG_MHF_STATE_FESTA_U // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfStateFestaU) Opcode() network.PacketID { func (m *MsgMhfStateFestaU) Opcode() network.PacketID {
@@ -18,7 +22,11 @@ func (m *MsgMhfStateFestaU) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfStateFestaU) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.

View File

@@ -1,7 +1,7 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx" "erupe-ce/network/clientctx"
"erupe-ce/network" "erupe-ce/network"
@@ -9,7 +9,12 @@ import (
) )
// MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA // 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. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfVoteFesta) Opcode() network.PacketID { func (m *MsgMhfVoteFesta) Opcode() network.PacketID {
@@ -18,7 +23,11 @@ func (m *MsgMhfVoteFesta) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfVoteFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { 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. // Build builds a binary packet from the current data.