From ef7d46ba2e53d58b27b7a549893b5776779bc93e Mon Sep 17 00:00:00 2001 From: wish Date: Mon, 4 Dec 2023 22:29:58 +1100 Subject: [PATCH] revert UpdateGuacot parsing --- network/mhfpacket/msg_mhf_update_guacot.go | 10 ++++++++-- server/channelserver/handlers.go | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/network/mhfpacket/msg_mhf_update_guacot.go b/network/mhfpacket/msg_mhf_update_guacot.go index 3295d1251..729c84547 100644 --- a/network/mhfpacket/msg_mhf_update_guacot.go +++ b/network/mhfpacket/msg_mhf_update_guacot.go @@ -9,7 +9,8 @@ import ( type Goocoo struct { Index uint32 - Data []byte + Data1 []int16 + Data2 []uint32 Name []byte } @@ -33,7 +34,12 @@ func (m *MsgMhfUpdateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien var temp Goocoo for i := 0; i < int(m.EntryCount); i++ { temp.Index = bf.ReadUint32() - temp.Data = bf.ReadBytes(52) + for j := 0; j < 22; j++ { + temp.Data1 = append(temp.Data1, bf.ReadInt16()) + } + for j := 0; j < 2; j++ { + temp.Data2 = append(temp.Data2, bf.ReadUint32()) + } temp.Name = bf.ReadBytes(uint(bf.ReadUint8())) m.Goocoos = append(m.Goocoos, temp) } diff --git a/server/channelserver/handlers.go b/server/channelserver/handlers.go index fe26d0d6b..441c4a307 100644 --- a/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -991,12 +991,17 @@ func handleMsgMhfUpdateGuacot(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfUpdateGuacot) for _, goocoo := range pkt.Goocoos { // TODO: This doesn't seem to indicate deletion? - if goocoo.Data[0] == 0 && goocoo.Data[1] == 0 { + if goocoo.Data1[0] == 0 { s.server.db.Exec(fmt.Sprintf("UPDATE goocoo SET goocoo%d=NULL WHERE id=$1", goocoo.Index), s.charID) } else { bf := byteframe.NewByteFrame() bf.WriteUint32(goocoo.Index) - bf.WriteBytes(goocoo.Data) + for i := range goocoo.Data1 { + bf.WriteInt16(goocoo.Data1[i]) + } + for i := range goocoo.Data2 { + bf.WriteUint32(goocoo.Data2[i]) + } bf.WriteUint8(uint8(len(goocoo.Name))) bf.WriteBytes(goocoo.Name) s.server.db.Exec(fmt.Sprintf("UPDATE goocoo SET goocoo%d=$1 WHERE id=$2", goocoo.Index), bf.Data(), s.charID)