📄 guildserversession.cpp
字号:
#include "stdafx.h"
#include <PacketStruct.h>
#include <PacketStruct_MZ.h>
#include <Protocol_MZ.h>
#include <const.h>
#include "GuildServerSession.h"
#include "MasterServer.h"
#include "PacketHandler.h"
#include "ServerInfoManager.h"
GuildServerSession::GuildServerSession()
{
}
GuildServerSession::~GuildServerSession()
{
}
VOID GuildServerSession::Init()
{
ServerSession::Init();
}
VOID GuildServerSession::Release()
{
ServerSession::Release();
}
VOID GuildServerSession::Update()
{
ServerSession::Update();
}
VOID GuildServerSession::OnRedirect()
{
MessageOut( eCRITICAL_LOG, "Guild server connected.(%s)", GetIP() );
// 辨靛 辑滚俊 鞘夸茄 辑滚 沥焊甫 焊郴霖促.
SERVER_KEY key = GetServerKey();
//BYTE byWorldID = key.GetWorldID();
//BYTE byChannelID = key.GetChannelID();
SERVER_INFO * pMyServerInfo = ServerInfoManager::Instance()->GetServerInfo(key);
ASSERT(pMyServerInfo);
//SERVER_INFO agentServerInfo;
//ServerInfoManager::Instance()->GetAgentServerInfo( byWorldID, byChannelID, &agentServerInfo );
BYTE byWorldId = key.GetWorldID();
SERVER_INFO gameDBProxyInfo;
ServerInfoManager::Instance()->GetGameDBProxyInfo( byWorldId, &gameDBProxyInfo );
SERVER_INFO worldServerInfo;
ServerInfoManager::Instance()->GetWorldServerInfo( byWorldId, &worldServerInfo );
SERVER_INFO GuildServerInfo;
ServerInfoManager::Instance()->GetGuildServerInfo( byWorldId, &GuildServerInfo );
MSG_MZ_SERVER_INFO_CMD sendMsg;
sendMsg.ServerKey = key;
sendMsg.m_dwServerGUID = pMyServerInfo->dwServerGUID;
strncpy( sendMsg.m_szGuildServerInnerIP, GuildServerInfo.szInnerIP, MAX_IP_STRING_LEN - 1 );
sendMsg.m_wGuildServerServerInnerPort = GuildServerInfo.wInnerPort;
strncpy( sendMsg.m_szDBProxyServerIP, gameDBProxyInfo.szInnerIP, MAX_IP_STRING_LEN );
sendMsg.m_wDBProxyServerPort = gameDBProxyInfo.wInnerPort;
strncpy( sendMsg.m_szWorldServerIP, worldServerInfo.szInnerIP, MAX_IP_STRING_LEN );
sendMsg.m_wWorldServerPort = worldServerInfo.wInnerPort;
//strncpy( sendMsg.szAgentServerIP, agentServerInfo.szInnerIP, MAX_IP_STRING_LEN );
//sendMsg.wAgentServerPort = agentServerInfo.wInnerPort;
Send( (BYTE*)&sendMsg, sizeof(sendMsg) );
}
VOID GuildServerSession::OnConnect( BOOL bSuccess, DWORD dwNetworkIndex )
{
ServerSession::OnConnect( bSuccess, dwNetworkIndex );
}
VOID GuildServerSession::OnDisconnect()
{
ServerSession::OnDisconnect();
SERVER_KEY key = GetServerKey();
MessageOut( eCRITICAL_LOG, "Guild server disconnected.[%u]", key.GetWorldID() );
}
VOID GuildServerSession::OnRecv( BYTE *pMsg, WORD wSize )
{
MSG_BASE *pBaseMsg = (MSG_BASE*)pMsg;
PacketHandler::Instance()->ParsePacket_MZ( this, (MSG_BASE*)pMsg, wSize );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -