mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 08:25:09 +01:00
Fix hunter navi saving
This commit is contained in:
@@ -1933,7 +1933,6 @@ func handleMsgMhfLoadHunterNavi(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
|
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
doSizedAckResp(s, pkt.AckHandle, data)
|
doSizedAckResp(s, pkt.AckHandle, data)
|
||||||
//doSizedAckResp(s, pkt.AckHandle, data)
|
|
||||||
} else {
|
} else {
|
||||||
// set first byte to 1 to avoid pop up every time without save
|
// set first byte to 1 to avoid pop up every time without save
|
||||||
body := make([]byte, 0x226)
|
body := make([]byte, 0x226)
|
||||||
@@ -1958,19 +1957,15 @@ func handleMsgMhfSaveHunterNavi(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
s.logger.Fatal("Failed to get hunternavi savedata from db", zap.Error(err))
|
s.logger.Fatal("Failed to get hunternavi savedata from db", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decompress
|
// Check if we actually had any hunternavi data, using a blank buffer if not.
|
||||||
s.logger.Info("Decompressing...")
|
// This is requried as the client will try to send a diff after character creation without a prior MsgMhfSaveHunterNavi packet.
|
||||||
data, err = nullcomp.Decompress(data)
|
if len(data) == 0 {
|
||||||
if err != nil {
|
data = make([]byte, 0x226)
|
||||||
s.logger.Fatal("Failed to decompress hunternavi from db", zap.Error(err))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform diff and compress it to write back to db
|
// Perform diff and compress it to write back to db
|
||||||
s.logger.Info("Diffing...")
|
s.logger.Info("Diffing...")
|
||||||
saveOutput, err := nullcomp.Compress(deltacomp.ApplyDataDiff(pkt.RawDataPayload, data))
|
saveOutput := deltacomp.ApplyDataDiff(pkt.RawDataPayload, data)
|
||||||
if err != nil {
|
|
||||||
s.logger.Fatal("Failed to diff and compress hunternavi savedata", zap.Error(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = s.server.db.Exec("UPDATE characters SET hunternavi=$1 WHERE id=$2", saveOutput, s.charID)
|
_, err = s.server.db.Exec("UPDATE characters SET hunternavi=$1 WHERE id=$2", saveOutput, s.charID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user