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

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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.

View File

@@ -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.