mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
feat(Core/Config): CONFIG_INTERVAL_SAVE (#3171)
This commit is contained in:
@@ -1085,9 +1085,32 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSaveCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
||||
static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
// pussywizard: fully disabled on 28.12.2011, but disabled it "silently"
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
// save GM account without delay and output message
|
||||
if (handler->GetSession()->GetSecurity() >= SEC_GAMEMASTER)
|
||||
{
|
||||
if (Player* target = handler->getSelectedPlayer())
|
||||
{
|
||||
target->SaveToDB(true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->SaveToDB(true, false);
|
||||
}
|
||||
handler->SendSysMessage(LANG_PLAYER_SAVED);
|
||||
return true;
|
||||
}
|
||||
|
||||
// save if the player has last been saved over 20 seconds ago
|
||||
uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
|
||||
if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
|
||||
{
|
||||
player->SaveToDB(true, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user