mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
add S6 Savedata compatibility
This commit is contained in:
@@ -2,10 +2,11 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
_config "erupe-ce/config"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
)
|
||||
|
||||
// MsgMhfSavedata represents the MSG_MHF_SAVEDATA
|
||||
@@ -29,7 +30,9 @@ func (m *MsgMhfSavedata) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon
|
||||
m.AllocMemSize = bf.ReadUint32()
|
||||
m.SaveType = bf.ReadUint8()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G1 {
|
||||
m.DataSize = bf.ReadUint32()
|
||||
}
|
||||
if m.DataSize == 0 { // seems to be used when DataSize = 0 rather than on savetype?
|
||||
m.RawDataPayload = bf.ReadBytes(uint(m.AllocMemSize))
|
||||
} else {
|
||||
|
||||
@@ -133,13 +133,18 @@ func (save *CharacterSaveData) Save(s *Session) {
|
||||
|
||||
save.updateSaveDataWithStruct()
|
||||
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G1 {
|
||||
err := save.Compress()
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to compress savedata", zap.Error(err))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// Saves were not compressed
|
||||
save.compSave = save.decompSave
|
||||
}
|
||||
|
||||
_, err = s.server.db.Exec(`UPDATE characters SET savedata=$1, is_new_character=false, hrp=$2, gr=$3, is_female=$4, weapon_type=$5, weapon_id=$6 WHERE id=$7
|
||||
_, err := s.server.db.Exec(`UPDATE characters SET savedata=$1, is_new_character=false, hrp=$2, gr=$3, is_female=$4, weapon_type=$5, weapon_id=$6 WHERE id=$7
|
||||
`, save.compSave, save.HRP, save.GR, save.Gender, save.WeaponType, save.WeaponID, save.CharID)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to update savedata", zap.Error(err), zap.Uint32("charID", save.CharID))
|
||||
|
||||
Reference in New Issue
Block a user