Update parsers

This commit is contained in:
Andrew Gutekanst
2019-12-27 04:41:05 +09:00
parent d4dddf01dd
commit 6a23130772
6 changed files with 21 additions and 13 deletions

View File

@@ -5,20 +5,20 @@ import (
"github.com/Andoryuuta/byteframe"
)
// MsgMhfGetCaUniqueId represents the MSG_MHF_GET_CA_UNIQUE_ID
type MsgMhfGetCaUniqueId struct{}
// MsgMhfGetCaUniqueID represents the MSG_MHF_GET_CA_UNIQUE_ID
type MsgMhfGetCaUniqueID struct{}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfGetCaUniqueId) Opcode() network.PacketID {
func (m *MsgMhfGetCaUniqueID) Opcode() network.PacketID {
return network.MSG_MHF_GET_CA_UNIQUE_ID
}
// Parse parses the packet from binary
func (m *MsgMhfGetCaUniqueId) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfGetCaUniqueID) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfGetCaUniqueId) Build(bf *byteframe.ByteFrame) error {
func (m *MsgMhfGetCaUniqueID) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}

View File

@@ -6,7 +6,9 @@ import (
)
// MsgMhfGetEtcPoints represents the MSG_MHF_GET_ETC_POINTS
type MsgMhfGetEtcPoints struct{}
type MsgMhfGetEtcPoints struct {
AckHandle uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfGetEtcPoints) Opcode() network.PacketID {
@@ -15,6 +17,7 @@ func (m *MsgMhfGetEtcPoints) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfGetEtcPoints) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
return nil
}

View File

@@ -6,7 +6,9 @@ import (
)
// MsgMhfReadGuildcard represents the MSG_MHF_READ_GUILDCARD
type MsgMhfReadGuildcard struct{}
type MsgMhfReadGuildcard struct {
AckHandle uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfReadGuildcard) Opcode() network.PacketID {
@@ -15,10 +17,11 @@ func (m *MsgMhfReadGuildcard) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfReadGuildcard) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfReadGuildcard) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}

View File

@@ -24,6 +24,7 @@ func (m *MsgMhfReadMercenaryW) Parse(bf *byteframe.ByteFrame) error {
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -22,6 +22,7 @@ func (m *MsgMhfUpdateEtcPoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -2,8 +2,8 @@ package mhfpacket
import "github.com/Andoryuuta/Erupe/network"
// MHFPacketFromOpcode gets a packet struct that fulfills the MHFPacket interface by it's opcode.
func MHFPacketFromOpcode(opcode network.PacketID) MHFPacket {
// FromOpcode gets a packet struct that fulfills the MHFPacket interface by it's opcode.
func FromOpcode(opcode network.PacketID) MHFPacket {
switch opcode {
case network.MSG_HEAD:
return &MsgHead{}
@@ -284,7 +284,7 @@ func MHFPacketFromOpcode(opcode network.PacketID) MHFPacket {
case network.MSG_SYS_INFOKYSERVER:
return &MsgSysInfokyserver{}
case network.MSG_MHF_GET_CA_UNIQUE_ID:
return &MsgMhfGetCaUniqueId{}
return &MsgMhfGetCaUniqueID{}
case network.MSG_MHF_SET_CA_ACHIEVEMENT:
return &MsgMhfSetCaAchievement{}
case network.MSG_MHF_CARAVAN_MY_SCORE: