mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[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:
parent
145182a53d
commit
dd2dda62a5
5 changed files with 17 additions and 6 deletions
|
|
@ -15951,7 +15951,7 @@ void Player::_LoadTalents(QueryResult *result)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
|
|
||||||
uint32 talent_id = fields[0].GetUInt32();
|
uint32 talent_id = fields[0].GetUInt32();
|
||||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id );
|
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id );
|
||||||
|
|
||||||
|
|
@ -16511,11 +16511,14 @@ void Player::SaveToDB()
|
||||||
GetSession()->SaveTutorialsData(); // changed only while character in game
|
GetSession()->SaveTutorialsData(); // changed only while character in game
|
||||||
_SaveGlyphs();
|
_SaveGlyphs();
|
||||||
_SaveTalents();
|
_SaveTalents();
|
||||||
if(m_session->isLogingOut()) // only save stats on logout
|
|
||||||
_SaveStats();
|
|
||||||
|
|
||||||
CharacterDatabase.CommitTransaction();
|
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).
|
// save pet (hunter pet level and experience and all type pets health/mana).
|
||||||
if(Pet* pet = GetPet())
|
if(Pet* pet = GetPet())
|
||||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
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)
|
for(PlayerTalentMap::iterator iter = m_talents[specIdx].begin(); iter != m_talents[specIdx].end(); ++iter)
|
||||||
{
|
{
|
||||||
PlayerTalent talent = (*iter).second;
|
PlayerTalent talent = (*iter).second;
|
||||||
|
|
||||||
if (talent.state == PLAYERSPELL_REMOVED)
|
if (talent.state == PLAYERSPELL_REMOVED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -21617,7 +21620,7 @@ void Player::ActivateSpec(uint8 specNum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++specIter;
|
++specIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now new spec data have only talents (maybe different rank) as in temp spec data, sync ranks then.
|
// 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)
|
for (PlayerTalentMap::const_iterator tempIter = tempSpec.begin(); tempIter != tempSpec.end(); ++tempIter)
|
||||||
|
|
|
||||||
|
|
@ -518,6 +518,7 @@ void World::LoadConfigSettings(bool reload)
|
||||||
setConfig(CONFIG_BOOL_GRID_UNLOAD, "GridUnload", true);
|
setConfig(CONFIG_BOOL_GRID_UNLOAD, "GridUnload", true);
|
||||||
setConfigPos(CONFIG_UINT32_INTERVAL_SAVE, "PlayerSave.Interval", 15 * MINUTE * IN_MILLISECONDS);
|
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);
|
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);
|
setConfigMin(CONFIG_UINT32_INTERVAL_GRIDCLEAN, "GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS, MIN_GRID_DELAY);
|
||||||
if (reload)
|
if (reload)
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,7 @@ enum eConfigBoolValues
|
||||||
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
|
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
|
||||||
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
|
CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
|
||||||
CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
|
CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
|
||||||
|
CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT,
|
||||||
CONFIG_BOOL_VALUE_COUNT
|
CONFIG_BOOL_VALUE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,11 @@ BindIP = "0.0.0.0"
|
||||||
# Default: 0 (do not save character stats)
|
# Default: 0 (do not save character stats)
|
||||||
# 1+ (save stats for characters with level 1+)
|
# 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.enableLOS
|
||||||
# vmap.enableHeight
|
# vmap.enableHeight
|
||||||
# Enable/Disable VMmap support for line of sight and height calculation
|
# Enable/Disable VMmap support for line of sight and height calculation
|
||||||
|
|
@ -180,6 +185,7 @@ MapUpdateInterval = 100
|
||||||
ChangeWeatherInterval = 600000
|
ChangeWeatherInterval = 600000
|
||||||
PlayerSave.Interval = 900000
|
PlayerSave.Interval = 900000
|
||||||
PlayerSave.Stats.MinLevel = 0
|
PlayerSave.Stats.MinLevel = 0
|
||||||
|
PlayerSave.Stats.SaveOnlyOnLogout = 1
|
||||||
vmap.enableLOS = 0
|
vmap.enableLOS = 0
|
||||||
vmap.enableHeight = 0
|
vmap.enableHeight = 0
|
||||||
vmap.ignoreMapIds = "369"
|
vmap.ignoreMapIds = "369"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9680"
|
#define REVISION_NR "9681"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue