From 6a231307729f46765809488f8f7682e153a93ce1 Mon Sep 17 00:00:00 2001 From: Andrew Gutekanst Date: Fri, 27 Dec 2019 04:41:05 +0900 Subject: [PATCH] Update parsers --- network/mhfpacket/msg_mhf_get_ca_unique_id.go | 12 ++++++------ network/mhfpacket/msg_mhf_get_etc_points.go | 5 ++++- network/mhfpacket/msg_mhf_read_guildcard.go | 9 ++++++--- network/mhfpacket/msg_mhf_read_mercenary_w.go | 1 + network/mhfpacket/msg_mhf_update_etc_point.go | 1 + network/mhfpacket/opcode_to_packet.go | 6 +++--- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/network/mhfpacket/msg_mhf_get_ca_unique_id.go b/network/mhfpacket/msg_mhf_get_ca_unique_id.go index 7305bf0a6..78a546e14 100644 --- a/network/mhfpacket/msg_mhf_get_ca_unique_id.go +++ b/network/mhfpacket/msg_mhf_get_ca_unique_id.go @@ -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") -} \ No newline at end of file +} diff --git a/network/mhfpacket/msg_mhf_get_etc_points.go b/network/mhfpacket/msg_mhf_get_etc_points.go index a6ece865b..eb7230c4d 100644 --- a/network/mhfpacket/msg_mhf_get_etc_points.go +++ b/network/mhfpacket/msg_mhf_get_etc_points.go @@ -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 } diff --git a/network/mhfpacket/msg_mhf_read_guildcard.go b/network/mhfpacket/msg_mhf_read_guildcard.go index b0eabb7e9..00e903b63 100644 --- a/network/mhfpacket/msg_mhf_read_guildcard.go +++ b/network/mhfpacket/msg_mhf_read_guildcard.go @@ -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") -} \ No newline at end of file +} diff --git a/network/mhfpacket/msg_mhf_read_mercenary_w.go b/network/mhfpacket/msg_mhf_read_mercenary_w.go index 27fe39eab..89aa4a530 100644 --- a/network/mhfpacket/msg_mhf_read_mercenary_w.go +++ b/network/mhfpacket/msg_mhf_read_mercenary_w.go @@ -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. diff --git a/network/mhfpacket/msg_mhf_update_etc_point.go b/network/mhfpacket/msg_mhf_update_etc_point.go index 30ba76d69..4696a26c5 100644 --- a/network/mhfpacket/msg_mhf_update_etc_point.go +++ b/network/mhfpacket/msg_mhf_update_etc_point.go @@ -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. diff --git a/network/mhfpacket/opcode_to_packet.go b/network/mhfpacket/opcode_to_packet.go index df0453107..379230e12 100644 --- a/network/mhfpacket/opcode_to_packet.go +++ b/network/mhfpacket/opcode_to_packet.go @@ -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: