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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user