1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Chat connection is actually reaching the handler now

This commit is contained in:
Mordred 2017-08-20 20:48:55 +02:00
parent b5d4e6385d
commit c5a06f7f21
5 changed files with 31 additions and 6 deletions

View file

@ -226,6 +226,8 @@ namespace Packets {
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
TellChatHandler = 0x0064,// updated for sb
PingHandler = 0x0065,// updated for sb
InitHandler = 0x0066,// updated for sb
ChatHandler = 0x0067,// updated for sb

View file

@ -297,16 +297,16 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
m_pSession = session;
// main connection, assinging it to the session
if( ipcHeader.connectionType == 1 )
if( ipcHeader.connectionType == ConnectionType::Zone )
{
g_log.info( "[" + std::string( id ) + "] Setting session for zone connection" );
session->setZoneConnection( pCon );
}
// chat connection, assinging it to the session
else if( ipcHeader.connectionType == 2 )
else if( ipcHeader.connectionType == ConnectionType::Chat )
{
g_log.info( "[" + std::string( id ) + "] Setting session for chat connection" );
// session->setClientChatConnection( pCon );
session->setChatConnection( pCon );
}
GamePacket pPe( 0x00, 0x18, 0, 0, 0x07 );

View file

@ -17,10 +17,11 @@
namespace Core {
namespace Network {
enum struct ConnectionType : uint8_t
enum ConnectionType : uint8_t
{
Zone,
Chat,
Zone = 1,
Chat = 2,
Lobby = 3,
None
};

View file

@ -27,11 +27,23 @@ void Core::Session::setZoneConnection( Core::Network::GameConnectionPtr pZoneCon
m_pZoneConnection = pZoneCon;
}
void Core::Session::setChatConnection( Core::Network::GameConnectionPtr pChatCon )
{
pChatCon->m_conType = Network::ConnectionType::Chat;
m_pChatConnection = pChatCon;
}
Core::Network::GameConnectionPtr Core::Session::getZoneConnection() const
{
return m_pZoneConnection;
}
Core::Network::GameConnectionPtr Core::Session::getChatConnection() const
{
return m_pChatConnection;
}
bool Core::Session::loadPlayer()
{
@ -84,6 +96,12 @@ void Core::Session::update()
m_pZoneConnection->processOutQueue();
}
if( m_pZoneConnection )
{
m_pChatConnection->processInQueue();
m_pChatConnection->processOutQueue();
}
}
Core::Entity::PlayerPtr Core::Session::getPlayer() const

View file

@ -18,7 +18,10 @@ namespace Core {
void setZoneConnection( Network::GameConnectionPtr zoneCon );
void setChatConnection( Network::GameConnectionPtr chatCon );
Network::GameConnectionPtr getZoneConnection() const;
Network::GameConnectionPtr getChatConnection() const;
uint32_t getLastDataTime() const;
@ -42,6 +45,7 @@ namespace Core {
uint32_t m_lastDataTime;
Network::GameConnectionPtr m_pZoneConnection;
Network::GameConnectionPtr m_pChatConnection;
};