📄 mssystem.cpp
字号:
msg.Category = MP_MORNITORSERVER;
msg.Protocol = MP_MORNITORSERVER_QUERYUSERCOUNT_SYN;
msg.dwConnectionIdxMC = dwConnectionIndex;
MNETWORK->SendToMSAll((char*)&msg, sizeof(msg));
}
yCASE(MP_MORNITORTOOL_QUERY_CHANNELINFO_SYN)
{
MSGROOT Msg;
Msg.Category = MP_MORNITORSERVER;
Msg.Protocol = MP_MORNITORSERVER_QUERY_CHANNELINFO_SYN;
MNETWORK->SendToMSAll( (char*)&Msg, sizeof(MSGROOT) );
}
yCASE(MP_MORNITORTOOL_EXECUTE_MAPSERVER_SYN)
{
MSGEXECUTESERVER * pmsg = (MSGEXECUTESERVER *)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_EXECUTE_MAPSERVER_SYN;
pmsg->dwConnectionIdxMC = dwConnectionIndex;
// map¼¹ö Æ÷Æ®·Î mapÀÌ ¼Ò¼ÓµÈ ms¸¦ ã¾Æ¼ ms·Î º¸³½´Ù.
MSERVERINFO * pInfo = MServerTable->GetMSServerInfoForIP(pmsg->ServerIP);
if(pInfo)
{
MNETWORK->SendToMS(pInfo->dwConnectionIndex, pMsg, dwLength);
LogConsole("sendEXEMsg To MS(CON:%d, IP:%s, PORT:%d)", pInfo->dwConnectionIndex, pInfo->szIPForServer, pInfo->wPortForServer);
}
}
yCASE(MP_MORNITORTOOL_SHUTDOWN_MAPSERVER_SYN) // Msg·Î ¼¹ö ²û.
{
MSGSHUTDOWNSERVER * pmsg = (MSGSHUTDOWNSERVER *)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_SHUTDOWN_MAPSERVER_SYN;
pmsg->dwConnectionIdxMC = dwConnectionIndex;
// map¼¹ö Æ÷Æ®·Î mapÀÌ ¼Ò¼ÓµÈ ms¸¦ ã¾Æ¼ ms·Î º¸³½´Ù.
MSERVERINFO * pInfo = MServerTable->GetMSServerInfoForIP(pmsg->ServerIP);
if(pInfo)
MNETWORK->SendToMS(pInfo->dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_MORNITORTOOL_KILL_SERVER_SYN) // °Á¦ Á¾·á(abnormal)
{
MSGSHUTDOWNSERVER* pmsg = (MSGSHUTDOWNSERVER*)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_KILL_SERVER_SYN;
pmsg->dwConnectionIdxMC = dwConnectionIndex;
// map¼¹ö Æ÷Æ®·Î mapÀÌ ¼Ò¼ÓµÈ ms¸¦ ã¾Æ¼ ms·Î º¸³½´Ù.
MSERVERINFO * pInfo = MServerTable->GetMSServerInfoForIP(pmsg->ServerIP);
if(pInfo)
MNETWORK->SendToMS(pInfo->dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_MORNITORTOOL_NOTICESEND_SYN)
{
MSGNOTICE * pmsg = (MSGNOTICE *)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_NOTICESEND_SYN;
pmsg->dwConnectionIdxMC = dwConnectionIndex;
MNETWORK->SendToMSAll(pMsg, dwLength);
}
yCASE(MP_MORNITORTOOL_MAPSERVERSTATE_SYN)
{
// Request
//¼¹ö »óÅÂ ACK
MASMGR->SendServerStateAllToMC(dwConnectionIndex);
}
yCASE(MP_MORNITORTOOL_EXECUTE_AUTOPATCH_SYN) // AutoPatch
{
MSGROOT msg;
msg.Category = MP_MORNITORSERVER;
msg.Protocol = MP_MORNITORSERVER_EXECUTE_AUTOPATCH_SYN;
MNETWORK->SendToMSAll( (char*)&msg, sizeof(msg));
}
yCASE(MP_MORNITORTOOL_CHANGE_USERLEVEL_SYN) // UserLevel
{
MSGROOT* msg = (MSGROOT*)pMsg;
msg->Category = MP_MORNITORSERVER;
msg->Protocol = MP_MORNITORSERVER_CHANGE_USERLEVEL_SYN;
MNETWORK->SendToMSAll( (char*)msg, dwLength );
}
yCASE(MP_MORNITORTOOL_ASSERTMSGBOX_SYN)
{
MSG_MCDWORD* msg = (MSG_MCDWORD*)pMsg;
msg->Category = MP_MORNITORSERVER;
msg->Protocol = MP_MORNITORSERVER_ASSERTMSGBOX_SYN;
MNETWORK->SendToMSAll( (char*)msg, dwLength );
}
yCASE(MP_MORNITORTOOL_DISCONNECT_ALLUSER_SYN)
{
MSGEXECUTESERVER* pmsg = (MSGSHUTDOWNSERVER *)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_DISCONNECT_ALLUSER_SYN;
pmsg->dwConnectionIdxMC = dwConnectionIndex;
// map¼¹ö Æ÷Æ®·Î mapÀÌ ¼Ò¼ÓµÈ ms¸¦ ã¾Æ¼ ms·Î º¸³½´Ù.
MSERVERINFO * pInfo = MServerTable->GetMSServerInfoForIP(pmsg->ServerIP);
if(pInfo)
MNETWORK->SendToMS(pInfo->dwConnectionIndex, pMsg, dwLength);
// MNETWORK->SendToMSAll( (char*)pmsg, dwLength );
}
yCASE(MP_MORNITORTOOL_QUERY_VERSION_SYN)
{
MSGROOT* pmsg = (MSGROOT*)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_QUERY_VERSION_SYN;
MNETWORK->SendToMSAll( (char*)pmsg, dwLength );
}
yCASE(MP_MORNITORTOOL_CHANGE_VERSION_SYN)
{
MSGNOTICE* pmsg = (MSGNOTICE*)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_CHANGE_VERSION_SYN;
MNETWORK->SendToMSAll( (char*)pmsg, dwLength );
}
yCASE(MP_MORNITORTOOL_QUERY_MAXUSER_SYN)
{
MSGROOT* pmsg = (MSGROOT*)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_QUERY_MAXUSER_SYN;
MNETWORK->SendToMSAll( (char*)pmsg, dwLength );
}
yCASE(MP_MORNITORTOOL_CHANGE_MAXUSER_SYN)
{
MSG_MCDWORD* pmsg = (MSG_MCDWORD*)pMsg;
pmsg->Category = MP_MORNITORSERVER;
pmsg->Protocol = MP_MORNITORSERVER_CHANGE_MAXUSER_SYN;
MNETWORK->SendToMSAll( (char*)pmsg, dwLength );
}
yCASE(MP_MORNITORTOOL_MSSTATEALL_SYN)
{
MSERVERINFO* info = NULL;
MSGMSSTATEALL Msg;
MServerTable->SetPositionHeadInfo();
while( info = (MSERVERINFO*)MServerTable->GetDataInfo() )
{
MSSTATE state;
strcpy( state.sServerIP, info->szIPForServer );
state.wServerPort = info->wPortForServer;
Msg.AddMSServerState( &state );
}
Msg.Category = MP_MORNITORTOOL;
Msg.Protocol = MP_MORNITORTOOL_MSSTATEALL_ACK;
MNETWORK->SendToMC( dwConnectionIndex, (char*)&Msg, Msg.GetSize() );
}
yCASE(MP_MORNITORTOOL_QUERY_AUTOPATCHVERSION_SYN)
{
MSGROOT Msg;
Msg.Category = MP_MORNITORSERVER;
Msg.Protocol = MP_MORNITORSERVER_QUERY_AUTOPATCHVERSION_SYN;
MNETWORK->SendToMSAll( (char*)&Msg, sizeof(MSGROOT) );
}
yENDSWITCH
}
/* yCASE(MP_RMTOOL_CONNECT)
{
ConnentMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_USER)
{
UserMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_MUNPA)
{
MunpaMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_GAMELOG)
{
GameLogMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_OPERLOG)
{
OperLogMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_STATISTICS)
{
StatisticsMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_ADMIN)
{
AdminMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_CHARACTER)
{
CharacterMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE( MP_RMTOOL_ITEM )
{
ItemMsgParse(dwConnectionIndex, pMsg, dwLength);
}
*/
yENDSWITCH
}
void CMSSystem::OnAcceptUser(DWORD dwConnectionIndex)
{
// mcÁ¢¼ÓÇØ ¿È
LogConsole("McÁ¢¼Ó");
MCINFO Info;
Info.dwConnectionIndex = dwConnectionIndex;
MUserTable->AddUser(&Info, dwConnectionIndex);
// sendserverstate all
// MASMGR->SendServerStateAllToMC(dwConnectionIndex);
}
void CMSSystem::OnDisconnectUser(DWORD dwConnectionIndex)
{
// nothing
LogConsole("Mc²÷¾îÁü");
MUserTable->RemoveUser(dwConnectionIndex);
}
/////////////////////////////////////////////////////////////////////////////////////
// MR_TOOL only
void CMSSystem::ReceivedMsgFromRMTool( DWORD dwConnectionIndex,char* pMsg,DWORD dwLength )
{
MSGROOT* pTempMsg = (MSGROOT*)pMsg;
if( pTempMsg->Category == MP_RMTOOL_CONNECT )
{
ConnentMsgParse(dwConnectionIndex, pMsg, dwLength);
return;
}
if( !IPCHECKMGR->CheckIP( dwConnectionIndex ) )
return;
ySWITCH(pTempMsg->Category)
// yCASE(MP_RMTOOL_CONNECT)
// {
// ConnentMsgParse(dwConnectionIndex, pMsg, dwLength);
// }
yCASE(MP_RMTOOL_USER)
{
UserMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_MUNPA)
{
MunpaMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_GAMELOG)
{
GameLogMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_OPERLOG)
{
OperLogMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_STATISTICS)
{
StatisticsMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_ADMIN)
{
AdminMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE(MP_RMTOOL_CHARACTER)
{
CharacterMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yCASE( MP_RMTOOL_ITEM )
{
ItemMsgParse(dwConnectionIndex, pMsg, dwLength);
}
yENDSWITCH
}
void CMSSystem::ConnentMsgParse(DWORD dwConnectionIndex,char* pMsg,DWORD dwLength)
{
MSGROOT* pTempMsg = (MSGROOT*)pMsg;
ySWITCH(pTempMsg->Protocol)
{
yCASE(MP_RMTOOL_CONNECT_SYN)
{
TMSG_OPERATOR_LOGIN* msg = (TMSG_OPERATOR_LOGIN*)pMsg;
// Id/Pwd °Ë»ç Ip checking µîµî..
char strIP[20] = {0,};
WORD wPort;
MNETWORK->GetUserAddress(dwConnectionIndex, strIP, &wPort);
/*
if( strcmp(msg->sIP.strIP, strIP) != 0 )
{
TMSG_WORD msg;
msg.Category = MP_RMTOOL_CONNECT;
msg.Protocol = MP_RMTOOL_CONNECT_NACK;
msg.dwTemplateIdx = 0;
msg.wData = 1;
MNETWORK->SendToMC(dwConnectionIndex, (char*)&msg, sizeof(msg));
return;
}
*/
// version check
if( strcmp(msg->sOper.strRegDate,"mastertjdeoekt!") == 0 )
{
TMSG_OPERATOR_LOGIN Msg;
Msg.Category = MP_RMTOOL_CONNECT;
Msg.Protocol = MP_RMTOOL_CONNECT_ACK;
Msg.sOper.wOperPower = eOperPower_Master;
MNETWORK->SendToMC(dwConnectionIndex, (char*)&Msg, sizeof(Msg));
IPCHECKMGR->RegistIP( strIP );
// OperatorLoginCheck(dwConnectionIndex, msg->sOper.strOperID, msg->sOper.strOperPWD, strIP);
}
else
{
TMSG_WORD Msg;
Msg.Category = MP_RMTOOL_CONNECT;
Msg.Protocol = MP_RMTOOL_CONNECT_NACK;
Msg.dwTemplateIdx = 0;
Msg.wData = 4;
if( g_pMSSystem->m_wServerType == TYPE_MAS )
{
if( strcmp(msg->sOper.strRegDate, SERVERTOOLVERSION) != 0 )
{
MNETWORK->SendToMC(dwConnectionIndex, (char*)&Msg, sizeof(Msg));
return;
}
}
else if( g_pMSSystem->m_wServerType == TYPE_RMS )
{
if( strcmp(msg->sOper.strRegDate, RMTOOLVERSION) != 0 )
{
MNETWORK->SendToMC(dwConnectionIndex, (char*)&Msg, sizeof(Msg));
return;
}
}
OperatorLoginCheck(dwConnectionIndex, msg->sOper.strOperID, msg->sOper.strOperPWD, strIP);
}
}
}
yENDSWITCH
}
void CMSSystem::UserMsgParse(DWORD dwConnectionIndex,char* pMsg,DWORD dwLength)
{
OPERID* pData = IPCHECKMGR->GetID( dwConnectionIndex );
if( strcmp(pData->sID, "") == 0 )
return;
MSGROOT* pTempMsg = (MSGROOT*)pMsg;
ySWITCH(pTempMsg->Protocol)
{
yCASE(MP_RMTOOL_USERSEARCH_SYN)
{
TMSG_DWORD2* pmsg = (TMSG_DWORD2*)pMsg;
SearchUserInfoFromMemberNum( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->dwData1, (WORD)pmsg->dwData2 );
}
yCASE(MP_RMTOOL_SIMPLECHARACTER_SYN)
{
TMSG_SIMPLECHARACTERINFO* pmsg = (TMSG_SIMPLECHARACTERINFO*)pMsg;
SimpleCharacterInfoFromMN( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->dwMemberNo );
CharacterCreateInfoFromMN( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->dwMemberNo );
}
yCASE(MP_RMTOOL_QUERY_MEMBERNUM_SYN)
{
TMSG_QUERYMEMBERNUM* pmsg = (TMSG_QUERYMEMBERNUM*)pMsg;
switch( pmsg->wType )
{
case 0:
SearchMemberNumFromID( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->strSearch );
break;
case 1:
SearchMemberNumFromCharName( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->strSearch );
break;
}
}
yCASE(MP_RMTOOL_CHECKNAME_SYN)
{
TMSG_CHECKNAME* pmsg = (TMSG_CHECKNAME*)pMsg;
CheckCharacterName( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->sName );
}
yCASE(MP_RMTOOL_CHARACTER_RECOVER_SYN)
{
TMSG_CHARACTERRECOVER* pmsg = (TMSG_CHARACTERRECOVER*)pMsg;
CharacterRecover( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->dwChrIdx, pmsg->sName );
// log
InsertLogTool( eToolLog_RM, eRMLog_RecoverCharacter, pData->dwIdx, pData->sID, pmsg->dwChrIdx, pmsg->sName,
0, 0, 0, 0 );
}
yCASE(MP_RMTOOL_CHANGE_USERLEVEL_SYN)
{
TMSG_NAME_DWORD* pmsg = (TMSG_NAME_DWORD*)pMsg;
ChangeUserLevel( (WORD)dwConnectionIndex, (WORD)pmsg->dwTemplateIdx, pmsg->dwChrIdx, pmsg->dwData );
// log
InsertLogTool( eToolLog_RM, eRMLog_ChangeUserLevel, pData->dwIdx, pData->sID, pmsg->dwChrIdx, pmsg->sName,
pmsg->dwData, 0, 0, 0 );
}
}
yENDSWITCH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -