Core/Scripts: Add OnPlayerLogin, OnPlayerLogout, OnPlayerCreate and OnPlayerDelete

--HG--
branch : trunk
This commit is contained in:
Spp
2010-09-15 13:23:07 +02:00
parent 9d9f18f9d2
commit cc3d4cc823
4 changed files with 39 additions and 3 deletions
@@ -471,8 +471,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
SendPacket(&data);
std::string IP_str = GetRemoteAddress();
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());
sLog.outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());
sLog.outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());
sScriptMgr.OnPlayerCreate(pNewChar);
delete pNewChar; // created only to call SaveToDB()
}
@@ -522,6 +523,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
std::string IP_str = GetRemoteAddress();
sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sScriptMgr.OnPlayerDelete(guid);
if (sLog.IsOutCharDump()) // optimize GetPlayerDump call
{
@@ -801,6 +803,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
m_playerLoading = false;
sScriptMgr.OnPlayerLogin(pCurrChar);
delete holder;
}
+1
View File
@@ -479,6 +479,7 @@ void WorldSession::LogoutPlayer(bool Save)
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'",
GetAccountId());
sLog.outDebug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
sScriptMgr.OnPlayerLogout(GetPlayer());
}
m_playerLogout = false;