decode various diva packets

This commit is contained in:
wish
2023-10-25 22:50:17 +11:00
parent 1e37b3c348
commit 625b58375f
7 changed files with 118 additions and 53 deletions

View File

@@ -13,7 +13,7 @@ type MsgMhfAcquireUdItem struct {
AckHandle uint32
Freeze bool
RewardType uint8
Count int
Count uint8
RewardIDs []uint32
}
@@ -27,8 +27,8 @@ func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
m.AckHandle = bf.ReadUint32()
m.Freeze = bf.ReadBool()
m.RewardType = bf.ReadUint8()
m.Count = int(bf.ReadUint8())
for i := 0; i < m.Count; i++ {
m.Count = bf.ReadUint8()
for i := uint8(0); i < m.Count; i++ {
m.RewardIDs = append(m.RewardIDs, bf.ReadUint32())
}
return nil

View File

@@ -11,8 +11,10 @@ import (
// MsgMhfAddRewardSongCount represents the MSG_MHF_ADD_REWARD_SONG_COUNT
type MsgMhfAddRewardSongCount struct {
AckHandle uint32
Unk0 uint32
Unk1 []byte
PrayerID uint32
Unk1 uint16
Unk2 uint8
Unk3 []uint16
}
// Opcode returns the ID associated with this packet type.
@@ -23,8 +25,12 @@ func (m *MsgMhfAddRewardSongCount) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfAddRewardSongCount) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadBytes(5)
m.PrayerID = bf.ReadUint32()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint8()
for i := uint8(0); i < m.Unk2; i++ {
m.Unk3 = append(m.Unk3, bf.ReadUint16())
}
return nil
}

View File

@@ -1,17 +1,17 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfGetUdRanking represents the MSG_MHF_GET_UD_RANKING
type MsgMhfGetUdRanking struct{
type MsgMhfGetUdRanking struct {
AckHandle uint32
Unk0 uint8
RankType uint8
}
// Opcode returns the ID associated with this packet type.
@@ -22,7 +22,7 @@ func (m *MsgMhfGetUdRanking) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfGetUdRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.RankType = bf.ReadUint8()
return nil
}

View File

@@ -1,15 +1,21 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfSetUdTacticsFollower represents the MSG_MHF_SET_UD_TACTICS_FOLLOWER
type MsgMhfSetUdTacticsFollower struct{}
type MsgMhfSetUdTacticsFollower struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
Unk2 uint16
Unk3 uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfSetUdTacticsFollower) Opcode() network.PacketID {
@@ -18,7 +24,12 @@ func (m *MsgMhfSetUdTacticsFollower) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfSetUdTacticsFollower) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16()
m.Unk3 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.