diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 250acb593d1..103f6f0f7b9 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15951,7 +15951,7 @@ void Player::_LoadTalents(QueryResult *result) do { Field *fields = result->Fetch(); - + uint32 talent_id = fields[0].GetUInt32(); TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id ); @@ -16511,11 +16511,14 @@ void Player::SaveToDB() GetSession()->SaveTutorialsData(); // changed only while character in game _SaveGlyphs(); _SaveTalents(); - if(m_session->isLogingOut()) // only save stats on logout - _SaveStats(); CharacterDatabase.CommitTransaction(); + // check if stats should only be saved on logout + // save stats can be out of transaction + if(m_session->isLogingOut() || !sWorld.getConfig(CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT)) + _SaveStats(); + // save pet (hunter pet level and experience and all type pets health/mana). if(Pet* pet = GetPet()) pet->SavePetToDB(PET_SAVE_AS_CURRENT); @@ -21295,7 +21298,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data) for(PlayerTalentMap::iterator iter = m_talents[specIdx].begin(); iter != m_talents[specIdx].end(); ++iter) { PlayerTalent talent = (*iter).second; - + if (talent.state == PLAYERSPELL_REMOVED) continue; @@ -21617,7 +21620,7 @@ void Player::ActivateSpec(uint8 specNum) } else ++specIter; - } + } // now new spec data have only talents (maybe different rank) as in temp spec data, sync ranks then. for (PlayerTalentMap::const_iterator tempIter = tempSpec.begin(); tempIter != tempSpec.end(); ++tempIter) diff --git a/src/game/World.cpp b/src/game/World.cpp index e89de4def6b..2beea483bff 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -518,6 +518,7 @@ void World::LoadConfigSettings(bool reload) setConfig(CONFIG_BOOL_GRID_UNLOAD, "GridUnload", true); setConfigPos(CONFIG_UINT32_INTERVAL_SAVE, "PlayerSave.Interval", 15 * MINUTE * IN_MILLISECONDS); setConfigMinMax(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE, "PlayerSave.Stats.MinLevel", 0, 0, MAX_LEVEL); + setConfig(CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT, "PlayerSave.Stats.SaveOnlyOnLogout", true); setConfigMin(CONFIG_UINT32_INTERVAL_GRIDCLEAN, "GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS, MIN_GRID_DELAY); if (reload) diff --git a/src/game/World.h b/src/game/World.h index 7c72395e86d..8c15233a1c3 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -303,6 +303,7 @@ enum eConfigBoolValues CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN, CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT, CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET, + CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT, CONFIG_BOOL_VALUE_COUNT }; diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 131132d9ff8..2ad2a2f3a0b 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -121,6 +121,11 @@ BindIP = "0.0.0.0" # Default: 0 (do not save character stats) # 1+ (save stats for characters with level 1+) # +# PlayerSave.Stats.SaveOnlyOnLogout +# Enable/Disable saving of character stats only on logout +# Default: 1 (only save on logout) +# 0 (save on every player save) +# # vmap.enableLOS # vmap.enableHeight # Enable/Disable VMmap support for line of sight and height calculation @@ -180,6 +185,7 @@ MapUpdateInterval = 100 ChangeWeatherInterval = 600000 PlayerSave.Interval = 900000 PlayerSave.Stats.MinLevel = 0 +PlayerSave.Stats.SaveOnlyOnLogout = 1 vmap.enableLOS = 0 vmap.enableHeight = 0 vmap.ignoreMapIds = "369" diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e4efc3cdd15..f0df59f383a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9680" + #define REVISION_NR "9681" #endif // __REVISION_NR_H__