mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
revert UpdateGuacot parsing
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user