📄 handler_mo.cpp
字号:
#include "StdAfx.h"
#include ".\handler_mo.h"
#include "OpServerSession.h"
#include "ServerInfoManager.h"
#include "ServerSessionManager.h"
#include <vector>
#include <PacketStruct_MO.h>
#include <Protocol_MO.h>
#include <PacketStruct_MW.h>
#include <Protocol_MW.h>
#include <PacketStruct_GM.h>
#include <Protocol_GM.h>
#include "MasterServer.h"
/*
VOID Handler_MO::OnMO_RELOAD_DATA_SYN( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
MSG_MO_RELOAD_DATA_SYN *pRecvMsg = (MSG_MO_RELOAD_DATA_SYN*)pMsg;
// 府肺靛 窍绊磊 窍绰 辑滚甫 茫绰促.
SERVER_KEY findingServerKey;
findingServerKey.Set( pRecvMsg->byWorldID, pRecvMsg->byChannelID, pRecvMsg->byServerType, pRecvMsg->byServerID );
ServerSession *pGameServer = ServerSessionManager::Instance()->FindServer( findingServerKey );
// 秦寸 霸烙 辑滚啊 立加吝捞 酒聪搁 府畔
if( !pGameServer )
{
MessageOut( eCRITICAL_LOG, "霸烙辑滚(%d, %d, %d, %d)啊 立加吝捞 酒聪骨肺 傍瘤甫 焊尘 荐 绝嚼聪促.\n",
pRecvMsg->byWorldID,
pRecvMsg->byChannelID,
pRecvMsg->byServerType,
pRecvMsg->byServerID );
return;
}
// 霸烙 辑滚肺 单捞磐 府肺靛 疙飞
MSG_GM_RELOAD_DATA_CMD reloadMsg;
reloadMsg.m_byCategory = GM_OPERATION;
reloadMsg.m_byProtocol = GM_RELOAD_DATA_CMD;
pGameServer->Send( (BYTE*)&reloadMsg, sizeof(reloadMsg) );
}
*/
VOID Handler_MO::OnMO_RTTG_CERTIFY_ANS( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
__asm nop;
}
VOID Handler_MO::OnMO_RTTG_GAMENOTICE_REQ( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
MSG_MO_RTTG_GAMENOTICE_REQ *pRecvMsg = (MSG_MO_RTTG_GAMENOTICE_REQ*)pMsg;
SERVER_KEY serverKey = pRecvMsg->dwServerUID;
BYTE byWorldID = serverKey.GetWorldID();
BYTE byChannelID = serverKey.GetChannelID();
std::vector<ServerSession*> worldList;
if( pRecvMsg->dwNoticeLength > MAX_NOTICE_LEN )
{
MessageOut( eCRITICAL_LOG, "傍瘤 辨捞 捞惑!(%d)", pRecvMsg->dwNoticeLength );
return;
}
if( byWorldID == 0 )
{
// 傈眉 岿靛俊 傍瘤
worldList = ServerSessionManager::Instance()->GetWorldServerList();
}
else
{
// 窜老 岿靛俊 傍瘤
SERVER_INFO worldServerInfo;
ServerInfoManager::Instance()->GetWorldServerInfo( byWorldID, &worldServerInfo );
ServerSession *pWorldServer = ServerSessionManager::Instance()->FindServer( worldServerInfo.ServerKey );
if( pWorldServer )
{
worldList.push_back( pWorldServer );
}
}
if( !worldList.empty() )
{
// 岿靛 辑滚肺 傍瘤 疙飞 傈价
MSG_MW_NOTICE_CMD noticeMsg;
noticeMsg.m_byCategory = MW_OPERATION;
noticeMsg.m_byProtocol = MW_NOTICE_CMD;
noticeMsg.dwServerUID = pRecvMsg->dwServerUID;
noticeMsg.dwTickPerLine = pRecvMsg->dwTickPerLine;
noticeMsg.dwNoticeLength = pRecvMsg->dwNoticeLength;
strncpy( noticeMsg.szNotice, pRecvMsg->szNotice, pRecvMsg->dwNoticeLength );
std::vector<ServerSession*>::iterator it;
for( it = worldList.begin(); it != worldList.end(); ++it )
{
(*it)->Send( (BYTE*)¬iceMsg, noticeMsg.GetSize() );
MessageOut( eCRITICAL_LOG, "%d锅 岿靛俊 傍瘤", (*it)->GetServerKey().GetWorldID() );
}
}
}
VOID Handler_MO::OnMO_RTTG_GAMEADMINLIST_ANS( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
MSG_MO_RTTG_GAMEADMINLIST_ANS *pRecvMsg = (MSG_MO_RTTG_GAMEADMINLIST_ANS*)pMsg;
GM_INFO gmInfo;
typedef struct
{
char szAccount[ID_MAX_LEN];
char szIP[IP_MAX_LEN];
DWORD dwAttr;
} _GMDATA;
_GMDATA *pRecvGMData;
for( DWORD i = 0; i < pRecvMsg->dwCount; ++i )
{
pRecvGMData = (_GMDATA*)( (BYTE*)pMsg + sizeof(MSG_MO_RTTG_GAMEADMINLIST_ANS) + ( i * sizeof(_GMDATA) ) );
strncpy( gmInfo.m_szID, pRecvGMData->szAccount, ID_MAX_LEN );
strncpy( gmInfo.m_szIP, pRecvGMData->szIP, IP_MAX_LEN );
gmInfo.m_byGrade = (BYTE)pRecvGMData->dwAttr;
GMList::Instance()->AddGM( &gmInfo );
MessageOut( eCRITICAL_LOG, "GM阑 眠啊钦聪促(%s)", pRecvGMData->szAccount );
}
}
VOID Handler_MO::OnMO_RTTG_BATTLEZONEINFO_REQ( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
std::vector<ServerSession*> worldList;
std::vector<ServerSession*>::iterator iter;
// 岿靛 辑滚 茫酒辑 拱绢夯促
worldList = ServerSessionManager::Instance()->GetWorldServerList();
if( worldList.empty() )
{
// 厚绢 乐栏搁 临 蔼捞 绝促
return;
}
MSG_MW_BATTLEZONEINFO_REQ sendMsg;
for( iter = worldList.begin(); iter < worldList.end(); iter++ )
{
ServerSession *pWorldServer = (*iter);
pWorldServer->Send( (BYTE*)&sendMsg, sendMsg.GetSize() );
}
}
// 烹拳樊 笼拌
VOID Handler_MO::OnMO_RTTG_USERMONEY_REQ( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
// 葛电 霸烙辑滚俊 傈崔~
std::vector<ServerSession*> gameList;
std::vector<ServerSession*>::iterator iter;
gameList = ServerSessionManager::Instance()->GetGameServerList();
if( gameList.empty() )
{
// 厚绢 乐栏搁 临 蔼捞 绝促
return;
}
MSG_GM_OPERATION_USERMONEY_REQ sendMsg;
for( iter = gameList.begin(); iter < gameList.end(); iter++ )
{
// 傈崔~
ServerSession *pGameServer = (*iter);
pGameServer->Send( (BYTE*)&sendMsg, sizeof(sendMsg) );
}
}
// 辑滚 沥惑辆丰 夸没
VOID Handler_MO::OnMO_RTTG_SERVERSHUTDOWN_REQ( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize )
{
MSG_MO_RTTG_SERVERSHUTDOWN_REQ* pRecvMsg = (MSG_MO_RTTG_SERVERSHUTDOWN_REQ*)pMsg;
//辑滚 辆丰绰 鉴瞒利栏肺(鞘靛/硅撇/俊捞傈飘->DB橇遏矫) 捞风绢廉具 窍骨肺, 辑滚 辆丰 葛靛肺 甸绢啊辑 贸府秦具 茄促
MessageOut( eFULL_LOG, "沥惑 辆丰 橇肺配妮 荐脚[W:%u/C:%u]", pRecvMsg->dwWorldID, pRecvMsg->dwChannelID );
MasterServer::Instance()->SetExitServer(); // 辆丰 葛靛 倒涝!
MasterServer::Instance()->SetExitKey( pRecvMsg->dwKey );
SERVER_KEY ServerKey;
ServerKey.Set( pRecvMsg->dwWorldID, pRecvMsg->dwChannelID, 0, 0 );
// 泅犁 秦寸窍绰 葛电 辑滚甫 茫酒扼
SERVER_SESSION_VEC serverList = ServerSessionManager::Instance()->GetServerList( ServerKey );
if( serverList.empty() )
{
// 捞固 辆丰等 惑怕
return;
}
SERVER_SESSION_VEC::iterator iter;
for( iter = serverList.begin(); iter != serverList.end(); iter++ )
{
//辆丰且 辑滚 府胶飘俊 鉴辑措肺 持绰促
MasterServer::Instance()->AddExitServer( (*iter)->GetServerKey() );
}
MessageOut( eFULL_LOG, "辆丰且 老馆 辑滚 府胶飘 累己");
// DB 橇遏矫绰 亲惑 付瘤阜俊 焊辰促
serverList = ServerSessionManager::Instance()->GetDBProxyList( ServerKey );
if( serverList.empty() )
{
// 捞固 辆丰等 惑怕
return;
}
for( iter = serverList.begin(); iter != serverList.end(); iter++ )
{
//辆丰且 辑滚 府胶飘俊 鉴辑措肺 持绰促
MasterServer::Instance()->AddExitServer( (*iter)->GetServerKey() );
}
MessageOut( eFULL_LOG, "辆丰且 Game DB Proxy 府胶飘 累己");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -