Implement MsgSysReserveStage

This commit is contained in:
Andrew Gutekanst
2020-01-23 14:46:15 -05:00
parent a92b5b0b93
commit ea13520ca9
2 changed files with 19 additions and 4 deletions

View File

@@ -6,7 +6,12 @@ import (
)
// MsgSysReserveStage represents the MSG_SYS_RESERVE_STAGE
type MsgSysReserveStage struct{}
type MsgSysReserveStage struct {
AckHandle uint32
Unk0 uint8 // Made with: `16 * x | 1;`, unknown `x` values.
StageIDLength uint8
StageID string // NULL terminated string.
}
// Opcode returns the ID associated with this packet type.
func (m *MsgSysReserveStage) Opcode() network.PacketID {
@@ -15,10 +20,14 @@ func (m *MsgSysReserveStage) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysReserveStage) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.StageIDLength = bf.ReadUint8()
m.StageID = string(bf.ReadBytes(uint(m.StageIDLength)))
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgSysReserveStage) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}

View File

@@ -287,7 +287,13 @@ func handleMsgSysLockStage(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgSysUnlockStage(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysReserveStage)
fmt.Printf("Got reserve stage req, Unk0:%v, StageID:%q\n", pkt.Unk0, pkt.StageID)
s.QueueAck(pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
}
func handleMsgSysUnreserveStage(s *Session, p mhfpacket.MHFPacket) {}