[9681] Add config to decide whether character stats should only be saved on logout.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2010-04-06 16:28:30 +02:00
parent 145182a53d
commit dd2dda62a5
5 changed files with 17 additions and 6 deletions

View file

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

View file

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

View file

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

View file

@ -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"

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9680"
#define REVISION_NR "9681"
#endif // __REVISION_NR_H__