#include "StdAfx.h" #include ".\masterserverscript.h" #include "MasterServerInfo.h" #include "InfoManager.h" #include "WorldInfoManager.h" #include "WorldInfo.h" MasterServerScript::MasterServerScript(void) { } MasterServerScript::~MasterServerScript(void) { } BOOL MasterServerScript::Create( CString& strFilePath, _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { if( !MakeScriptFile( strFilePath ) ) return FALSE; CreateServerInfo( pBaseInfo ); CreateNoWorldInfo(); CreateLogInfo(); return TRUE; } void MasterServerScript::CreateServerInfo( _BaseInfo* pBaseInfo ) { CString strMsg, strTemp; MasterServerInfo* pInfo = (MasterServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() ); if( !pInfo ) return; _IOHANDLER* pHandler = pInfo->GetServerInfo(); if( !pHandler ) return; strTemp = "[MASTERSERVER]\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 MasterServerScript::CreateNoWorldInfo() { // 0¹ø ¿ùµå¿¡ ¼ÓÇÑ ¸ðµç ¼­¹öÀÇ Á¤º¸¸¦ °¡Á®¿Â´Ù. WORLD_LIST TotalList; WorldInfo* pWorldInfo = WorldInfoManager::GetInstance()->GetWorldInfo(); if( !pWorldInfo ) return; pWorldInfo->GetBaseInfo( 0, TotalList ); //ÇöÀç ¿ùµå, ä³Î, ¼­¹öŸÀÔ¿¡ µû¸¥ ƯȭµÈ Á¤º¸ //1. ACCOUNT DBP _BaseInfo* pADBProxyInfo = FindBaseInfo( TotalList, ACCOUNT_DBPROXY ); if( pADBProxyInfo ) { CString strTemp, strMsg; strTemp = "[ACCOUNTDBPROXY]\r\n"; strMsg = strTemp; strTemp.Format("IP = %s \r\n", pADBProxyInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("PORT = %d \r\n", pADBProxyInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //2. OP SERVER _BaseInfo* pOPServerInfo = FindBaseInfo( TotalList, OP_SERVER ); if( pOPServerInfo ) { CString strTemp, strMsg; strTemp = "[OPSERVER]\r\n"; strMsg = strTemp; strTemp.Format("IP = %s \r\n", pOPServerInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("PORT = %d \r\n", pOPServerInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } } void MasterServerScript::CreateLogInfo() { CString strMsg, strTemp; MasterServerInfo* pInfo = (MasterServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() ); if( !pInfo ) return; _LOGFILE* pLogFile = pInfo->GetLogfileInfo(); if( !pLogFile ) return; strTemp = "[LOGFILE]\r\n"; 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 ); }