#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 ); } }