mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 08:33:47 +00:00
refactor(Core/World): Create WorldSessionMgr to split session logic out of World (#21400)
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "WorldSessionMgr.h"
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
Player* ChatHandler::GetPlayer() const
|
||||
@@ -188,7 +189,7 @@ void ChatHandler::SendGlobalSysMessage(const char* str)
|
||||
for (std::string_view line : Acore::Tokenize(str, '\n', true))
|
||||
{
|
||||
BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
sWorldSessionMgr->SendGlobalMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ void ChatHandler::SendGlobalGMSysMessage(const char* str)
|
||||
for (std::string_view line : Acore::Tokenize(str, '\n', true))
|
||||
{
|
||||
BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
|
||||
sWorld->SendGlobalGMMessage(&data);
|
||||
sWorldSessionMgr->SendGlobalGMMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,8 +443,8 @@ bool ChatHandler::HasSession() const
|
||||
|
||||
void ChatHandler::DoForAllValidSessions(std::function<void(Player*)> exec)
|
||||
{
|
||||
SessionMap::const_iterator itr;
|
||||
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
||||
WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
|
||||
for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
|
||||
if (Player* player = itr->second->GetPlayer())
|
||||
if (player->IsInWorld())
|
||||
exec(player);
|
||||
|
||||
Reference in New Issue
Block a user