251 lines
7.5 KiB
C++
251 lines
7.5 KiB
C++
#include "StdAfx.h"
|
|
#include ".\worldserverscript.h"
|
|
#include "InfoManager.h"
|
|
#include "WorldServerInfo.h"
|
|
#include "WorldInfo.h"
|
|
#include "WorldInfoManager.h"
|
|
|
|
WorldServerScript::WorldServerScript(void)
|
|
{
|
|
}
|
|
|
|
WorldServerScript::~WorldServerScript(void)
|
|
{
|
|
}
|
|
|
|
|
|
BOOL WorldServerScript::Create( CString& strFilePath, _BaseInfo* pBaseInfo, WORLD_LIST& WorldList )
|
|
{
|
|
if( !MakeScriptFile( strFilePath ) )
|
|
return FALSE;
|
|
|
|
CreateCommonInfo( pBaseInfo );
|
|
CreateClientInfo( pBaseInfo, WorldList );
|
|
CreateServerInfo( pBaseInfo, WorldList );
|
|
CreateConnectInfo( pBaseInfo, WorldList );
|
|
CreateNoWorldInfo();
|
|
CreateLogInfo();
|
|
CreateChatInfo();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
//_BaseInfo : 현재 만드려는 해당 월드, 채널, 월드서버의 정보
|
|
void WorldServerScript::CreateCommonInfo( _BaseInfo* pBaseInfo )
|
|
{
|
|
CString strMsg, strTemp;
|
|
WorldServerInfo* pInfo = (WorldServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() );
|
|
if( !pInfo ) return;
|
|
|
|
_COMMON* pCommon = pInfo->GetCommonInfo();
|
|
if( !pCommon ) return;
|
|
|
|
strTemp = "[COMMON]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "GET_SERVERINFO_FROM_FILE = %d \r\n", pCommon->m_nCommonFile );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "WORLD_ID = %d \r\n", pBaseInfo->m_wWorld );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "CRYPTOGRAPHY_ENABLED = %d \r\n", pCommon->m_nCommonCryptoGraphy );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
|
|
strTemp = "[SERVICE]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SERVICE_MODE = %d \r\n", pCommon->m_nCommonService );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
|
|
strTemp = "[INTERVAL]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "STATISTICS = %d \r\n", pCommon->m_nCommonStatistics );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SHOUT = %d \r\n", pCommon->m_nCommonShout );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
|
|
WriteMessge( strMsg );
|
|
}
|
|
|
|
void WorldServerScript::CreateLogInfo()
|
|
{
|
|
CString strMsg, strTemp;
|
|
WorldServerInfo* pInfo = (WorldServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() );
|
|
if( !pInfo ) return;
|
|
|
|
_LOGFILE* pLogFile = pInfo->GetLogfileInfo();
|
|
if( !pLogFile ) return;
|
|
|
|
strTemp = "[LOGFILE]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "WOPS_LOGFILE_PATH = %s \r\n", pLogFile->m_strWopsLogPath );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "WOPS_LOGFILE_OPTION = %d \r\n", pLogFile->m_nWopsLogOption );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SUN_LOGFILE_OPTION = %d \r\n", pLogFile->m_nSunLogOption );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SUN_LOGFILE_LEVEL = %d \r\n", pLogFile->m_nSunLogLevel );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SUN_LOGFILE_PATH = %s \r\n", pLogFile->m_strSunLogPath );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
WriteMessge( strMsg );
|
|
|
|
}
|
|
|
|
void WorldServerScript::CreateServerInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList )
|
|
{
|
|
CString strMsg, strTemp;
|
|
WorldServerInfo* pInfo = (WorldServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() );
|
|
if( !pInfo ) return;
|
|
|
|
_IOHANDLER* pHandler = pInfo->GetServerInfo();
|
|
if( !pHandler ) return;
|
|
|
|
strTemp = "[SERVER_IO]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "IP = %s \r\n", pBaseInfo->m_szPrivateIP );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "PORT = %d \r\n", pBaseInfo->m_wPrivatePort );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "MAX_ACCEPT_SESSION = %d \r\n", pHandler->m_nAccept );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "MAX_CONNECT_SESSION = %d \r\n", pHandler->m_nConnect );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SEND_BUFFER_SIZE = %d \r\n", pHandler->m_nSendBuf );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "RECV_BUFFER_SIZE = %d \r\n", pHandler->m_nRecvBuf );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "TIME_OUT = %d \r\n", pHandler->m_nTimeOut );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "MAX_PACKET_SIZE = %d \r\n", pHandler->m_nPacketSize );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "NUMBER_OF_ACCEPT_THREADs = %d \r\n", pHandler->m_nAcceptThread );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "NUMBER_OF_CONNECT_THREADS = %d \r\n", pHandler->m_nConnectThread );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "NUMBER_OF_IO_THREADS = %d \r\n", pHandler->m_nIoThread );
|
|
strMsg += strTemp;
|
|
|
|
strMsg += "\r\n";
|
|
WriteMessge( strMsg );
|
|
}
|
|
|
|
void WorldServerScript::CreateClientInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList )
|
|
{
|
|
CString strMsg, strTemp;
|
|
WorldServerInfo* pInfo = (WorldServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() );
|
|
if( !pInfo ) return;
|
|
|
|
_IOHANDLER* pHandler = pInfo->GetClientInfo();
|
|
if( !pHandler ) return;
|
|
|
|
strTemp = "[CLIENT_IO]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "IP = %s \r\n", pBaseInfo->m_szPublicIP );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "PORT = %d \r\n", pBaseInfo->m_wPublicPort );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "MAX_ACCEPT_SESSION = %d \r\n", pHandler->m_nAccept );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "MAX_CONNECT_SESSION = %d \r\n", pHandler->m_nConnect );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "SEND_BUFFER_SIZE = %d \r\n", pHandler->m_nSendBuf );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "RECV_BUFFER_SIZE = %d \r\n", pHandler->m_nRecvBuf );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "TIME_OUT = %d \r\n", pHandler->m_nTimeOut );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "MAX_PACKET_SIZE = %d \r\n", pHandler->m_nPacketSize );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "NUMBER_OF_ACCEPT_THREADs = %d \r\n", pHandler->m_nAcceptThread );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "NUMBER_OF_CONNECT_THREADS = %d \r\n", pHandler->m_nConnectThread );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "NUMBER_OF_IO_THREADS = %d \r\n", pHandler->m_nIoThread );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
|
|
WriteMessge( strMsg );
|
|
}
|
|
|
|
void WorldServerScript::CreateConnectInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList )
|
|
{
|
|
CString strMsg, strTemp;
|
|
|
|
_BaseInfo* pInfo = FindBaseInfo( WorldList, GAME_DBPROXY );
|
|
if( !pInfo ) return;
|
|
|
|
strTemp = "[GAMEDBPROXY]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format( "IP = %s \r\n", pInfo->m_szPrivateIP );
|
|
strMsg += strTemp;
|
|
strTemp.Format( "PORT = %d \r\n", pInfo->m_wPrivatePort );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
|
|
WriteMessge( strMsg );
|
|
|
|
}
|
|
|
|
//월드에 속하지 않은 전체에 포함되는 정보
|
|
void WorldServerScript::CreateNoWorldInfo()
|
|
{
|
|
// 0번 월드에 속한 모든 서버의 정보를 가져온다.
|
|
WORLD_LIST TotalList;
|
|
WorldInfo* pWorldInfo = WorldInfoManager::GetInstance()->GetWorldInfo();
|
|
if( !pWorldInfo ) return;
|
|
|
|
pWorldInfo->GetBaseInfo( 0, TotalList );
|
|
|
|
//현재 월드, 채널, 서버타입에 따른 특화된 정보
|
|
CString strTemp, strMsg;
|
|
|
|
//1. 마스터 서버
|
|
_BaseInfo* pMasterInfo = FindBaseInfo( TotalList, MASTER_SERVER );
|
|
if( pMasterInfo )
|
|
{
|
|
strTemp = "[MASTERSERVER]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format("IP = %s \r\n", pMasterInfo->m_szPrivateIP );
|
|
strMsg += strTemp;
|
|
strTemp.Format("PORT = %d \r\n", pMasterInfo->m_wPrivatePort );
|
|
strMsg += strTemp;
|
|
strMsg += "\r\n";
|
|
WriteMessge( strMsg );
|
|
}
|
|
}
|
|
|
|
//서버 연결정보
|
|
//채팅정보는 공통이다. 공용정보에서 얻을수 있다.
|
|
void WorldServerScript::CreateChatInfo()
|
|
{
|
|
CString strMsg, strTemp;
|
|
WorldServerInfo* pInfo = (WorldServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() );
|
|
if( !pInfo ) return;
|
|
|
|
_CHATLOG* pChat = pInfo->GetChatLog();
|
|
if( pChat )
|
|
{
|
|
strTemp = "[CHATLOG]\r\n";
|
|
strMsg += strTemp;
|
|
strTemp.Format("CHAT_NORMAL = %d \r\n", pChat->m_bNormal );
|
|
strMsg += strTemp;
|
|
strTemp.Format("CHAT_SHOUT = %d \r\n", pChat->m_bShout );
|
|
strMsg += strTemp;
|
|
strTemp.Format("CHAT_PARTY = %d \r\n", pChat->m_bParty );
|
|
strMsg += strTemp;
|
|
strTemp.Format("CHAT_GUILD = %d \r\n", pChat->m_bGuild );
|
|
strMsg += strTemp;
|
|
strTemp.Format("CHAT_PRIVATE = %d \r\n", pChat->m_bPrivate );
|
|
strMsg += strTemp;
|
|
strTemp.Format("CHAT_FRIEND = %d \r\n", pChat->m_bFriend );
|
|
strMsg += strTemp;
|
|
|
|
strMsg += "\r\n";
|
|
WriteMessge( strMsg );
|
|
}
|
|
}
|
|
|