mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 07:25:03 +01:00
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package mhfpacket
|
|
|
|
import (
|
|
"errors"
|
|
"erupe-ce/common/byteframe"
|
|
"erupe-ce/network"
|
|
"erupe-ce/network/clientctx"
|
|
)
|
|
|
|
type Goocoo struct {
|
|
Index uint32
|
|
Data []byte
|
|
Name []byte
|
|
}
|
|
|
|
// MsgMhfUpdateGuacot represents the MSG_MHF_UPDATE_GUACOT
|
|
type MsgMhfUpdateGuacot struct {
|
|
AckHandle uint32
|
|
EntryCount uint16
|
|
Goocoos []Goocoo
|
|
}
|
|
|
|
// Opcode returns the ID associated with this packet type.
|
|
func (m *MsgMhfUpdateGuacot) Opcode() network.PacketID {
|
|
return network.MSG_MHF_UPDATE_GUACOT
|
|
}
|
|
|
|
// Parse parses the packet from binary
|
|
func (m *MsgMhfUpdateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
|
m.AckHandle = bf.ReadUint32()
|
|
m.EntryCount = bf.ReadUint16()
|
|
bf.ReadUint16() // Zeroed
|
|
var temp Goocoo
|
|
for i := 0; i < int(m.EntryCount); i++ {
|
|
temp.Index = bf.ReadUint32()
|
|
temp.Data = bf.ReadBytes(52)
|
|
temp.Name = bf.ReadBytes(uint(bf.ReadUint8()))
|
|
m.Goocoos = append(m.Goocoos, temp)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Build builds a binary packet from the current data.
|
|
func (m *MsgMhfUpdateGuacot) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
|
return errors.New("NOT IMPLEMENTED")
|
|
}
|