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
@@ -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);