From 76fe663ee1c71f95328a0e6b0955d9053fc3381c Mon Sep 17 00:00:00 2001 From: Andrew Gutekanst Date: Tue, 21 Jan 2020 20:01:32 -0500 Subject: [PATCH] Add MsgSysReserve203/IsUpdateGuildMsgBoard --- network/mhfpacket/msg_sys_reserve203.go | 15 ++++-- server/channelserver/handlers.go | 69 +++++++++++++++---------- 2 files changed, 55 insertions(+), 29 deletions(-) diff --git a/network/mhfpacket/msg_sys_reserve203.go b/network/mhfpacket/msg_sys_reserve203.go index 5059a54f2..62f9e528c 100644 --- a/network/mhfpacket/msg_sys_reserve203.go +++ b/network/mhfpacket/msg_sys_reserve203.go @@ -5,8 +5,14 @@ import ( "github.com/Andoryuuta/byteframe" ) +// TODO(Andoryuuta): Make up a name for this packet, not reserved anymore. Called "Is_update_guild_msg_board" + // MsgSysReserve203 represents the MSG_SYS_reserve203 -type MsgSysReserve203 struct{} +type MsgSysReserve203 struct { + AckHandle uint32 + Unk0 uint16 // Hardcoded 0x0000 in the binary + Unk1 uint16 // Hardcoded 0x0500 in the binary. +} // Opcode returns the ID associated with this packet type. func (m *MsgSysReserve203) Opcode() network.PacketID { @@ -15,10 +21,13 @@ func (m *MsgSysReserve203) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgSysReserve203) Parse(bf *byteframe.ByteFrame) error { - panic("Not implemented") + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint16() + m.Unk1 = bf.ReadUint16() + return nil } // Build builds a binary packet from the current data. func (m *MsgSysReserve203) Build(bf *byteframe.ByteFrame) error { panic("Not implemented") -} \ No newline at end of file +} diff --git a/server/channelserver/handlers.go b/server/channelserver/handlers.go index 4455367b9..88ed4d6ce 100644 --- a/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -46,6 +46,33 @@ func doSizedAckResp(s *Session, ackHandle uint32, data []byte) { s.QueueAck(ackHandle, bfw.Data()) } +func updateRights(s *Session) { + update := &mhfpacket.MsgSysUpdateRight{ + Unk0: 0, + Unk1: 0x4E, + Rights: []mhfpacket.ClientRight{ + { + ID: 1, + Timestamp: 0, + }, + { + ID: 2, + Timestamp: 0x5dfa14c0, + }, + { + ID: 3, + Timestamp: 0x5dfa14c0, + }, + { + ID: 6, + Timestamp: 0x5de70510, + }, + }, + UnkSize: 0, + } + s.QueueSendMHF(update) +} + func fixedSizeShiftJIS(text string, size int) []byte { r := bytes.NewBuffer([]byte(text)) encoded, err := ioutil.ReadAll(transform.NewReader(r, japanese.ShiftJIS.NewEncoder())) @@ -522,6 +549,9 @@ func handleMsgMhfEntryRookieGuild(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfEnumerateQuest) stubEnumerateNoResults(s, pkt.AckHandle) + + // Update the client's rights as well: + updateRights(s) } func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) { @@ -537,6 +567,9 @@ func handleMsgMhfEnumeratePrice(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfEnumerateRanking) stubEnumerateNoResults(s, pkt.AckHandle) + + // Update the client's rights as well: + updateRights(s) } func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) { @@ -1012,30 +1045,7 @@ func handleMsgMhfGetBoostTime(s *Session, p mhfpacket.MHFPacket) { doSizedAckResp(s, pkt.AckHandle, []byte{}) // Update the client's rights as well: - update := &mhfpacket.MsgSysUpdateRight{ - Unk0: 0, - Unk1: 0x4E, - Rights: []mhfpacket.ClientRight{ - { - ID: 1, - Timestamp: 0, - }, - { - ID: 2, - Timestamp: 0x5dfa14c0, - }, - { - ID: 3, - Timestamp: 0x5dfa14c0, - }, - { - ID: 6, - Timestamp: 0x5de70510, - }, - }, - UnkSize: 0, - } - s.QueueSendMHF(update) + updateRights(s) } func handleMsgMhfPostBoostTime(s *Session, p mhfpacket.MHFPacket) {} @@ -1608,9 +1618,16 @@ func handleMsgMhfUpdateForceGuildRank(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfResetTitle(s *Session, p mhfpacket.MHFPacket) {} -func handleMsgSysReserve202(s *Session, p mhfpacket.MHFPacket) {} +// "Enumrate_guild_msg_board" +func handleMsgSysReserve202(s *Session, p mhfpacket.MHFPacket) { +} -func handleMsgSysReserve203(s *Session, p mhfpacket.MHFPacket) {} +// "Is_update_guild_msg_board" +func handleMsgSysReserve203(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgSysReserve203) + resp := make([]byte, 8) // Unk resp. + s.QueueAck(pkt.AckHandle, resp) +} func handleMsgSysReserve204(s *Session, p mhfpacket.MHFPacket) {}