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" "github.com/Andoryuuta/byteframe"
) )
// MsgMhfGetCaUniqueId represents the MSG_MHF_GET_CA_UNIQUE_ID // MsgMhfGetCaUniqueID represents the MSG_MHF_GET_CA_UNIQUE_ID
type MsgMhfGetCaUniqueId struct{} type MsgMhfGetCaUniqueID struct{}
// Opcode returns the ID associated with this packet type. // 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 return network.MSG_MHF_GET_CA_UNIQUE_ID
} }
// Parse parses the packet from binary // 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") panic("Not implemented")
} }
// Build builds a binary packet from the current data. // 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") panic("Not implemented")
} }

View File

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

View File

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

View File

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

View File

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