#include "StdAfx.h" #include ".\guildserverscript.h" #include "InfoManager.h" #include "GuildServerInfo.h" #include "WorldInfo.h" #include "WorldInfoManager.h" GuildServerScript::GuildServerScript(void) { } GuildServerScript::~GuildServerScript(void) { } BOOL GuildServerScript::Create( CString& strFilePath, _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { if( !MakeScriptFile( strFilePath ) ) return FALSE; CreateCommonInfo( pBaseInfo ); CreateServerInfo( pBaseInfo, WorldList ); CreateConnectInfo( WorldList ); CreateNoWorldInfo(); return TRUE; } void GuildServerScript::CreateCommonInfo( _BaseInfo* pBaseInfo ) { CString strMsg, strTemp; GuildServerInfo* pInfo = (GuildServerInfo*)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; strMsg += "\r\n"; WriteMessge( strMsg ); } void GuildServerScript::CreateServerInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { CString strMsg, strTemp; GuildServerInfo* pInfo = (GuildServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() ); if( !pInfo ) return; _IOHANDLER* pHandler = pInfo->GetServerInfo(); if( !pHandler ) return; strTemp = "[SERVER_IOHANDLER]\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"; //Connection ¼ö strTemp.Format( "CONEECTION_NUM = %d \r\n", pInfo->GetConnectionCount() ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //¿©±â¼­ WorldList´Â pBaseInfo¿¡ ÀÖ´Â ¿ùµåÀÇ ¸ðµç Á¤º¸¸¦ °¡Áö°í ÀÖ´Ù. void GuildServerScript::CreateConnectInfo( WORLD_LIST& WorldList ) { _BaseInfo* pDBProxyInfo = FindBaseInfo( WorldList, GAME_DBPROXY ); if( pDBProxyInfo ) { CString strMsg, strTemp; strTemp = "[CONNECTION_0]\r\n"; strMsg += strTemp; strTemp.Format( "IP = %s \r\n", pDBProxyInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format( "PORT = %d \r\n", pDBProxyInfo->m_wPrivatePort ); strMsg += strTemp; strTemp.Format( "TYPE = %d \r\n", GAME_DBPROXY ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } _BaseInfo* pWorldInfo = FindBaseInfo( WorldList, WORLD_SERVER ); if( pWorldInfo ) { CString strMsg, strTemp; strTemp = "[CONNECTION_2]\r\n"; strMsg += strTemp; strTemp.Format( "IP = %s \r\n", pWorldInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format( "PORT = %d \r\n", pWorldInfo->m_wPrivatePort ); strMsg += strTemp; strTemp.Format( "TYPE = %d \r\n", WORLD_SERVER ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } } //¿ùµå¿¡ ¼ÓÇÏÁö ¾ÊÀº Àüü¿¡ Æ÷ÇԵǴ Á¤º¸ void GuildServerScript::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 = "[CONNECTION_1]\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; strTemp.Format("TYPE = %d \r\n", MASTER_SERVER ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } }