fix(player): restore missing additional save timer and reduce autosave interval

The m_additionalSaveTimer was never processed in the update loop, so quick
partial saves after important events (rare+ item pickups, quest completions)
never fired. This caused players to lose progress on disconnect/crash since
only the 15-minute full autosave protected them.

- Add m_additionalSaveTimer tick logic to Player::Update
- Reduce default PlayerSaveInterval from 900000 (15 min) to 300000 (5 min)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Docker Build
2026-05-11 21:20:47 -05:00
parent 87219cb4eb
commit a64279ed7e
3 changed files with 25 additions and 3 deletions
@@ -1753,9 +1753,9 @@ InstantLogout = 1
#
# PlayerSaveInterval
# Description: Time (in milliseconds) for player save interval.
# Default: 900000 - (15 min)
# Default: 300000 - (5 min)
PlayerSaveInterval = 900000
PlayerSaveInterval = 300000
#
# PlayerSave.Stats.MinLevel
@@ -332,6 +332,28 @@ void Player::Update(uint32 p_time)
}
}
if (m_additionalSaveTimer)
{
if (p_time >= m_additionalSaveTimer)
{
m_additionalSaveTimer = 0;
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
if (m_additionalSaveMask & ADDITIONAL_SAVING_INVENTORY_AND_GOLD)
SaveInventoryAndGoldToDB(trans);
if (m_additionalSaveMask & ADDITIONAL_SAVING_QUEST_STATUS)
_SaveQuestStatus(trans);
CharacterDatabase.CommitTransaction(trans);
m_additionalSaveMask = 0;
}
else
{
m_additionalSaveTimer -= p_time;
}
}
// Handle Water/drowning
HandleDrowning(p_time);
+1 -1
View File
@@ -163,7 +163,7 @@ void WorldConfig::BuildConfigCache()
SetConfigValue<bool>(CONFIG_ALLOW_PLAYER_COMMANDS, "AllowPlayerCommands", 1);
SetConfigValue<bool>(CONFIG_PRESERVE_CUSTOM_CHANNELS, "PreserveCustomChannels", false);
SetConfigValue<uint32>(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION, "PreserveCustomChannelDuration", 14);
SetConfigValue<uint32>(CONFIG_INTERVAL_SAVE, "PlayerSaveInterval", 900000);
SetConfigValue<uint32>(CONFIG_INTERVAL_SAVE, "PlayerSaveInterval", 300000);
SetConfigValue<uint32>(CONFIG_INTERVAL_DISCONNECT_TOLERANCE, "DisconnectToleranceInterval", 0);
SetConfigValue<bool>(CONFIG_STATS_SAVE_ONLY_ON_LOGOUT, "PlayerSave.Stats.SaveOnlyOnLogout", true);
SetConfigValue<bool>(CONFIG_VALIDATE_SKILL_LEARNED_BY_SPELLS, "ValidateSkillLearnedBySpells", true);