mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 23:44:52 +01:00
add option to flag corruption attempted saves as deleted
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
"PatchServerManifest": "",
|
"PatchServerManifest": "",
|
||||||
"PatchServerFile": "",
|
"PatchServerFile": "",
|
||||||
"ScreenshotAPIURL": "",
|
"ScreenshotAPIURL": "",
|
||||||
|
"DeleteOnSaveCorruption": false,
|
||||||
"DevMode": true,
|
"DevMode": true,
|
||||||
"DevModeOptions": {
|
"DevModeOptions": {
|
||||||
"AutoCreateAccount": true,
|
"AutoCreateAccount": true,
|
||||||
|
|||||||
@@ -12,17 +12,18 @@ import (
|
|||||||
|
|
||||||
// Config holds the global server-wide config.
|
// Config holds the global server-wide config.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string `mapstructure:"Host"`
|
Host string `mapstructure:"Host"`
|
||||||
BinPath string `mapstructure:"BinPath"`
|
BinPath string `mapstructure:"BinPath"`
|
||||||
Language string
|
Language string
|
||||||
DisableSoftCrash bool // Disables the 'Press Return to exit' dialog allowing scripts to reboot the server automatically
|
DisableSoftCrash bool // Disables the 'Press Return to exit' dialog allowing scripts to reboot the server automatically
|
||||||
FeaturedWeapons int // Number of Active Feature weapons to generate daily
|
FeaturedWeapons int // Number of Active Feature weapons to generate daily
|
||||||
HideLoginNotice bool // Hide the Erupe notice on login
|
HideLoginNotice bool // Hide the Erupe notice on login
|
||||||
LoginNotice string // MHFML string of the login notice displayed
|
LoginNotice string // MHFML string of the login notice displayed
|
||||||
PatchServerManifest string // Manifest patch server override
|
PatchServerManifest string // Manifest patch server override
|
||||||
PatchServerFile string // File patch server override
|
PatchServerFile string // File patch server override
|
||||||
ScreenshotAPIURL string // Destination for screenshots uploaded to BBS
|
ScreenshotAPIURL string // Destination for screenshots uploaded to BBS
|
||||||
DevMode bool
|
DeleteOnSaveCorruption bool // Attempts to save corrupted data will flag the save for deletion
|
||||||
|
DevMode bool
|
||||||
|
|
||||||
DevModeOptions DevModeOptions
|
DevModeOptions DevModeOptions
|
||||||
Discord Discord
|
Discord Discord
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ func handleMsgMhfSavedata(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
characterSaveData.Save(s)
|
characterSaveData.Save(s)
|
||||||
s.logger.Info("Wrote recompressed savedata back to DB.")
|
s.logger.Info("Wrote recompressed savedata back to DB.")
|
||||||
} else {
|
} else {
|
||||||
s.logger.Warn("Save cancelled due to corruption.")
|
|
||||||
s.rawConn.Close()
|
s.rawConn.Close()
|
||||||
|
s.logger.Warn("Save cancelled due to corruption.")
|
||||||
|
if s.server.erupeConfig.DeleteOnSaveCorruption {
|
||||||
|
s.server.db.Exec("UPDATE characters SET deleted=true WHERE id=$1", s.charID)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = s.server.db.Exec("UPDATE characters SET name=$1 WHERE id=$2", characterSaveData.Name, s.charID)
|
_, err = s.server.db.Exec("UPDATE characters SET name=$1 WHERE id=$2", characterSaveData.Name, s.charID)
|
||||||
|
|||||||
Reference in New Issue
Block a user