[9767] Add the posibility to keep deleted characters in the database for a while and also add related commands.

Added commands:
* .character deleted list [$guid|$name]
* .character deleted restore $guid|$name [$newname]
* .character deleted delete $guid|$name
* .character deleted old [$keepdays]

Command .character delete renamed to .character erase

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
DasBlub 2010-04-19 22:00:55 +04:00 committed by VladimirMangos
parent c9ac685f04
commit 492ce567d2
22 changed files with 701 additions and 151 deletions

View file

@ -827,6 +827,11 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInFlight = MAX_VISIBILITY_DISTANCE - m_VisibleObjectGreyDistance;
}
///- Load the CharDelete related config options
setConfigMinMax(CONFIG_UINT32_CHARDELETE_METHOD, "CharDelete.Method", 0, 0, 1);
setConfigMinMax(CONFIG_UINT32_CHARDELETE_MIN_LEVEL, "CharDelete.MinLevel", 0, 0, getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
setConfigPos(CONFIG_UINT32_CHARDELETE_KEEP_DAYS, "CharDelete.KeepDays", 30);
///- Read the "Data" directory from the config file
std::string dataPath = sConfig.GetStringDefault("DataDir","./");
if( dataPath.at(dataPath.length()-1)!='/' && dataPath.at(dataPath.length()-1)!='\\' )
@ -1237,6 +1242,7 @@ void World::SetInitialWorldSettings()
m_timers[WUPDATE_UPTIME].SetInterval(m_configUint32Values[CONFIG_UINT32_UPTIME_UPDATE]*MINUTE*IN_MILLISECONDS);
//Update "uptime" table based on configuration entry in minutes.
m_timers[WUPDATE_CORPSES].SetInterval(3*HOUR*IN_MILLISECONDS);
m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
//to set mailtimer to return mails every day between 4 and 5 am
//mailtimer is increased when updating auctions
@ -1279,6 +1285,9 @@ void World::SetInitialWorldSettings()
uint32 nextGameEvent = sGameEventMgr.Initialize();
m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
// Delete all characters which have been deleted X days before
Player::DeleteOldCharacters();
sLog.outString( "WORLD: World initialized" );
uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());
@ -1423,6 +1432,13 @@ void World::Update(uint32 diff)
sBattleGroundMgr.Update(diff);
}
///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed())
{
m_timers[WUPDATE_DELETECHARS].Reset();
Player::DeleteOldCharacters();
}
// execute callbacks from sql queries that were queued recently
UpdateResultQueue();