diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 4080426d8..2dda13f03 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1761,6 +1761,11 @@ void ScriptMgr::OnAccountLogin(uint32 accountId) FOREACH_SCRIPT(AccountScript)->OnAccountLogin(accountId); } +void ScriptMgr::OnLastIpUpdate(uint32 accountId, std::string ip) +{ + FOREACH_SCRIPT(AccountScript)->OnLastIpUpdate(accountId, ip); +} + void ScriptMgr::OnFailedAccountLogin(uint32 accountId) { FOREACH_SCRIPT(AccountScript)->OnFailedAccountLogin(accountId); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 63c774fbf..54703587e 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -967,6 +967,9 @@ public: // Called when an account logged in successfully virtual void OnAccountLogin(uint32 /*accountId*/) { } + // Called when an ip logged in successfully + virtual void OnLastIpUpdate(uint32 /*accountId*/, std::string /*ip*/) { } + // Called when an account login failed virtual void OnFailedAccountLogin(uint32 /*accountId*/) { } @@ -1412,6 +1415,7 @@ public: /* PlayerScript */ public: /* AccountScript */ void OnAccountLogin(uint32 accountId); + void OnLastIpUpdate(uint32 accountId, std::string ip); void OnFailedAccountLogin(uint32 accountId); void OnEmailChange(uint32 accountId); void OnFailedEmailChange(uint32 accountId); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index be0b66c9c..2360b4d32 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -979,6 +979,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) LoginDatabase.Execute(stmt); + sScriptMgr->OnLastIpUpdate(id, address); + // NOTE ATM the socket is single-threaded, have this in mind ... ACE_NEW_RETURN(m_Session, WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter, skipQueue, TotalTime), -1);