mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Core/Config): CONFIG_INTERVAL_SAVE (#3171)
This commit is contained in:
@@ -715,6 +715,8 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
m_zoneUpdateId = uint32(-1);
|
||||
m_zoneUpdateTimer = 0;
|
||||
|
||||
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
|
||||
|
||||
m_areaUpdateId = 0;
|
||||
m_team = TEAM_NEUTRAL;
|
||||
|
||||
@@ -18116,6 +18118,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
// since last logout (in seconds)
|
||||
uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
|
||||
|
||||
// randomize first save time in range [CONFIG_INTERVAL_SAVE] around [CONFIG_INTERVAL_SAVE]
|
||||
// this must help in case next save after mass player load after server startup
|
||||
m_nextSave = urand(m_nextSave / 2, m_nextSave * 3 / 2);
|
||||
|
||||
// set value, including drunk invisibility detection
|
||||
// calculate sobering. after 15 minutes logged out, the player will be sober again
|
||||
uint8 newDrunkValue = 0;
|
||||
@@ -19657,6 +19663,9 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
|
||||
void Player::SaveToDB(bool create, bool logout)
|
||||
{
|
||||
// delay auto save at any saves (manual, in code, or autosave)
|
||||
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
|
||||
|
||||
//lets allow only players in world to be saved
|
||||
if (IsBeingTeleportedFar())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user