mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
refactor(Core/World): Create WorldSessionMgr to split session logic out of World (#21400)
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "WorldSessionMgr.h"
|
||||
|
||||
class LoginQueryHolder : public CharacterDatabaseQueryHolder
|
||||
{
|
||||
@@ -612,7 +613,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
uint32 initAccountId = GetAccountId();
|
||||
|
||||
// can't delete loaded character
|
||||
if (ObjectAccessor::FindConnectedPlayer(guid) || sWorld->FindOfflineSessionForCharacterGUID(guid.GetCounter()))
|
||||
if (ObjectAccessor::FindConnectedPlayer(guid) || sWorldSessionMgr->FindOfflineSessionForCharacterGUID(guid.GetCounter()))
|
||||
{
|
||||
sScriptMgr->OnPlayerFailedDelete(guid, initAccountId);
|
||||
return;
|
||||
@@ -698,14 +699,14 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
};
|
||||
|
||||
// pussywizard:
|
||||
if (WorldSession* sess = sWorld->FindOfflineSessionForCharacterGUID(playerGuid.GetCounter()))
|
||||
if (WorldSession* sess = sWorldSessionMgr->FindOfflineSessionForCharacterGUID(playerGuid.GetCounter()))
|
||||
if (sess->GetAccountId() != GetAccountId())
|
||||
{
|
||||
SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER);
|
||||
return;
|
||||
}
|
||||
// pussywizard:
|
||||
if (WorldSession* sess = sWorld->FindOfflineSession(GetAccountId()))
|
||||
if (WorldSession* sess = sWorldSessionMgr->FindOfflineSession(GetAccountId()))
|
||||
{
|
||||
Player* p = sess->GetPlayer();
|
||||
if (!p || sess->IsKicked())
|
||||
@@ -1101,7 +1102,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
{
|
||||
bool isReferrer = pCurrChar->GetSession()->IsARecruiter();
|
||||
|
||||
for (auto const& [accID, session] : sWorld->GetAllSessions())
|
||||
for (auto const& [accID, session] : sWorldSessionMgr->GetAllSessions())
|
||||
{
|
||||
if (!session->GetRecruiterId() && !session->IsARecruiter())
|
||||
continue;
|
||||
@@ -1390,7 +1391,7 @@ void WorldSession::HandleCharRenameCallBack(std::shared_ptr<CharacterRenameInfo>
|
||||
atLoginFlags &= ~AT_LOGIN_RENAME;
|
||||
|
||||
// pussywizard:
|
||||
if (ObjectAccessor::FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(guidLow)) || sWorld->FindOfflineSessionForCharacterGUID(guidLow))
|
||||
if (ObjectAccessor::FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(guidLow)) || sWorldSessionMgr->FindOfflineSessionForCharacterGUID(guidLow))
|
||||
{
|
||||
SendCharRename(CHAR_CREATE_ERROR, renameInfo.get());
|
||||
return;
|
||||
@@ -1626,7 +1627,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// pussywizard:
|
||||
if (ObjectAccessor::FindConnectedPlayer(customizeInfo->Guid) || sWorld->FindOfflineSessionForCharacterGUID(customizeInfo->Guid.GetCounter()))
|
||||
if (ObjectAccessor::FindConnectedPlayer(customizeInfo->Guid) || sWorldSessionMgr->FindOfflineSessionForCharacterGUID(customizeInfo->Guid.GetCounter()))
|
||||
{
|
||||
recvData.rfinish();
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
|
||||
@@ -1928,7 +1929,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
>> factionChangeInfo->Race;
|
||||
|
||||
// pussywizard:
|
||||
if (ObjectAccessor::FindConnectedPlayer(factionChangeInfo->Guid) || sWorld->FindOfflineSessionForCharacterGUID(factionChangeInfo->Guid.GetCounter()))
|
||||
if (ObjectAccessor::FindConnectedPlayer(factionChangeInfo->Guid) || sWorldSessionMgr->FindOfflineSessionForCharacterGUID(factionChangeInfo->Guid.GetCounter()))
|
||||
{
|
||||
SendCharFactionChange(CHAR_CREATE_ERROR, factionChangeInfo.get());
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user