From 4f2a94cc50934fa6ec79f27e2e12df94e6d1d4fb Mon Sep 17 00:00:00 2001 From: wish Date: Thu, 6 Oct 2022 02:23:01 +1100 Subject: [PATCH] partially decode TerminalLog --- network/mhfpacket/msg_sys_terminal_log.go | 29 +++++++++++------------ server/channelserver/handlers.go | 9 +++++-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/network/mhfpacket/msg_sys_terminal_log.go b/network/mhfpacket/msg_sys_terminal_log.go index 862462e59..536d35f18 100644 --- a/network/mhfpacket/msg_sys_terminal_log.go +++ b/network/mhfpacket/msg_sys_terminal_log.go @@ -1,17 +1,19 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // TerminalLogEntry represents an entry in the MSG_SYS_TERMINAL_LOG packet. type TerminalLogEntry struct { - // Unknown fields - U0, U1, U2, U3, U4, U5, U6, U7, U8 uint32 + Index uint32 + Type1 uint8 + Type2 uint8 + Data []int16 } // MsgSysTerminalLog represents the MSG_SYS_TERMINAL_LOG @@ -37,15 +39,12 @@ func (m *MsgSysTerminalLog) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client for i := 0; i < int(m.EntryCount); i++ { e := &TerminalLogEntry{} - e.U0 = bf.ReadUint32() - e.U1 = bf.ReadUint32() - e.U2 = bf.ReadUint32() - e.U3 = bf.ReadUint32() - e.U4 = bf.ReadUint32() - e.U5 = bf.ReadUint32() - e.U6 = bf.ReadUint32() - e.U7 = bf.ReadUint32() - e.U8 = bf.ReadUint32() + e.Index = bf.ReadUint32() + e.Type1 = bf.ReadUint8() + e.Type2 = bf.ReadUint8() + for j := 0; j < 15; j++ { + e.Data = append(e.Data, bf.ReadInt16()) + } m.Entries = append(m.Entries, e) } diff --git a/server/channelserver/handlers.go b/server/channelserver/handlers.go index 2e348c138..3bde5d2bf 100644 --- a/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -118,9 +118,14 @@ func handleMsgSysAck(s *Session, p mhfpacket.MHFPacket) {} func handleMsgSysTerminalLog(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysTerminalLog) + for i := range pkt.Entries { + s.server.logger.Info("SysTerminalLog", + zap.Uint8("Type1", pkt.Entries[i].Type1), + zap.Uint8("Type2", pkt.Entries[i].Type2), + zap.Int16s("Data", pkt.Entries[i].Data)) + } resp := byteframe.NewByteFrame() - - resp.WriteUint32(0x98bd51a9) // LogID to use for requests after this. + resp.WriteUint32(pkt.LogID + 1) // LogID to use for requests after this. doAckSimpleSucceed(s, pkt.AckHandle, resp.Data()) }