#include "StdAfx.h" #include ".\sunserverscript.h" #include "InfoManager.h" #include "SunServerInfo.h" #include "WorldInfo.h" #include "WorldInfoManager.h" SunServerScript::SunServerScript(void) { } SunServerScript::~SunServerScript(void) { } BOOL SunServerScript::Create( CString& strFilePath, _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { if( !MakeScriptFile( strFilePath ) ) return FALSE; CreateCommonInfo(); CreateClientInfo( pBaseInfo, WorldList ); CreateServerInfo( pBaseInfo, WorldList ); CreateConnectInfo( pBaseInfo, WorldList ); CreateNoWorldInfo( pBaseInfo ); CreateLogInfo(); return TRUE; } void SunServerScript::CreateCommonInfo() { CString strMsg, strTemp; SunServerInfo* pInfo = (SunServerInfo*)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( "GMLIST_APPLY = %d \r\n", pCommon->m_nCommonGM ); strMsg += strTemp; strTemp.Format( "FIELD_SERVER_TYPE = %d \r\n", pCommon->m_nCommonField ); strMsg += strTemp; strTemp.Format( "BATTLE_SERVER_TYPE = %d \r\n", pCommon->m_nCommonBattle ); strMsg += strTemp; strTemp.Format( "VILLAGE_RENDERINFO = %d \r\n", pCommon->m_nCommonVillage ); strMsg += strTemp; strTemp.Format( "SERVICE_MODE = %d \r\n", pCommon->m_nCommonService ); strMsg += strTemp; strTemp.Format( "AGE_GRADE = %d \r\n", pCommon->m_nCommonAgeGrade ); strMsg += strTemp; strTemp.Format( "CRYPTOGRAPHY_ENABLED = %d \r\n", pCommon->m_nCommonCryptoGraphy ); strMsg += strTemp; strTemp.Format( "CRYPTO_KEY_CHANGED = %d \r\n", pCommon->m_nCommonCryptoKeyChanged ); strMsg += strTemp; strTemp.Format( "CRYPTO_KEY_CHANGE_INTERVAL = %d \r\n", pCommon->m_nCommonCryptoKeyChangeInterval ); strMsg += strTemp; strTemp.Format( "SERVER_STATUS = %d \r\n", pCommon->m_nCommonServerStatus ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } void SunServerScript::CreateLogInfo() { CString strMsg, strTemp; SunServerInfo* pInfo = (SunServerInfo*)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 SunServerScript::CreateServerInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { CString strMsg, strTemp; SunServerInfo* pInfo = (SunServerInfo*)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"; WriteMessge( strMsg ); } void SunServerScript::CreateClientInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { CString strMsg, strTemp; SunServerInfo* pInfo = (SunServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() ); if( !pInfo ) return; _IOHANDLER* pHandler = pInfo->GetClientInfo(); if( !pHandler ) return; strTemp = "[CLIENT_IOHANDLER]\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 ); } //¿©±â¼­ WorldList´Â pBaseInfo¿¡ ÀÖ´Â ¿ùµåÀÇ ¸ðµç Á¤º¸¸¦ °¡Áö°í ÀÖ´Ù. void SunServerScript::CreateConnectInfo( _BaseInfo* pBaseInfo, WORLD_LIST& WorldList ) { CString strMsg, strTemp; _BaseInfo* pInfo = NULL; //3. GameDBProxy pInfo = FindBaseInfo( WorldList, GAME_DBPROXY ); if( pInfo ) { strTemp = "[GAMEDBPROXYSERVER]\r\n"; strMsg = strTemp; strTemp.Format("GAMEDBPROXYSERVER_IP = %s \r\n", pInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("GAMEDBPROXYSERVER_PORT = %d \r\n", pInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //4. AGENT_SERVER pInfo = FindBaseInfoEx( WorldList, AGENT_SERVER, pBaseInfo ); if( pInfo ) { strTemp = "[AGENTSERVER]\r\n"; strMsg = strTemp; strTemp.Format("AGENTSERVER_OUTSIDE_IP = %s \r\n", pInfo->m_szPublicIP ); strMsg += strTemp; strTemp.Format("AGENTSERVER_OUTSIDE_PORT = %d \r\n", pInfo->m_wPublicPort ); strMsg += strTemp; strTemp.Format("AGENTSERVER_INSIDE_IP = %s \r\n", pInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("AGENTSERVER_INSIDE_PORT = %d \r\n", pInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //6. GuildServer pInfo = FindBaseInfo( WorldList, GUILD_SERVER ); if( pInfo ) { strTemp = "[GUILDSERVER]\r\n"; strMsg = strTemp; strTemp.Format("GUILDSERVER_IP = %s \r\n", pInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("GUILDSERVER_PORT = %d \r\n", pInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //7. WorldServer pInfo = FindBaseInfo( WorldList, WORLD_SERVER ); if( pInfo ) { strTemp = "[WORLDSERVER]\r\n"; strMsg = strTemp; strTemp.Format("WORLDSERVER_IP = %s \r\n", pInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("WORLDSERVER_PORT = %d \r\n", pInfo->m_wPrivatePort ); strMsg += strTemp; strTemp.Format("WORLDSERVER_CLIENT_IP = %s \r\n", pInfo->m_szPublicIP ); strMsg += strTemp; strTemp.Format("WORLDSERVER_CLIENT_PORT = %d \r\n", pInfo->m_wPublicPort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } } //¿ùµå¿¡ ¼ÓÇÏÁö ¾ÊÀº Àüü¿¡ Æ÷ÇԵǴ Á¤º¸ void SunServerScript::CreateNoWorldInfo( _BaseInfo* pBaseInfo ) { //1. SunServe.ini¸¦ »ç¿ëÇÏ´Â °¢ ¼­¹öº° °øÅëµÈ ÀÚ·á SunServerInfo* pServerInfo = (SunServerInfo*)ServerInfoManager::GetInstance()->GetServerInfo( GetServerType() ); if( !pServerInfo ) return; //2. AUTH_AGENT_SERVER WorldInfo* pWorldInfo = WorldInfoManager::GetInstance()->GetWorldInfo(); if( !pWorldInfo ) return; WORLD_LIST WorldList; pWorldInfo->GetBaseInfo( 0, WorldList ); //Àüü¿¡ ¼ÓÇÏ´Â Á¤º¸.. CString strTemp, strMsg; //ÇöÀç ¿ùµå, ä³Î, ¼­¹öŸÀÔ¿¡ µû¸¥ ƯȭµÈ Á¤º¸ //1. ÀÎÁõ ¼­¹ö _BaseInfo* pAuthInfo = FindBaseInfo( WorldList, AUTH_AGENT_SERVER ); _AUTH* pAuth = pServerInfo->GetAuthInfo(); if( pAuthInfo && pAuth ) { strTemp = "[AUTHAGENTSERVER]\r\n"; strMsg = strTemp; strTemp.Format("ENABLE_AUTH_AGENT_SERVER = %d \r\n", pAuth->m_bEnable ); strMsg += strTemp; //ÀÎÁõ¼­¹ö ¹øÈ£ : (ÇöÀç »ý¼ºÇÏ·Á´Â ¼­¹öÀÇ ¿ùµå-1) * (¿ùµå´ç ä³Î¼ö) + ÇöÀç »ý¼ºÇÏ·Á´Â ¼­¹öÀÇ Ã¤³Î¹øÈ£ WORD wAuthID = ( pBaseInfo->m_wWorld - 1) * pAuth->m_wChannel + pBaseInfo->m_wChannel; strTemp.Format("AGENTSERVER_ID = %d \r\n", wAuthID ); strMsg += strTemp; strTemp.Format("AUTHAGENTSERVER_IP = %s \r\n", pAuthInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("AUTHAGENTSERVER_PORT = %d \r\n", pAuthInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //2. ¸¶½ºÅÍ ¼­¹ö _BaseInfo* pMasterInfo = FindBaseInfo( WorldList, MASTER_SERVER ); if( pMasterInfo ) { strTemp = "[MASTERSERVER]\r\n"; strMsg = strTemp; strTemp.Format("MASTERSERVER_IP = %s \r\n", pMasterInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("MASTERSERVER_PORT = %d \r\n", pMasterInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } //2. AccountDBProxy _BaseInfo* pAccountInfo = FindBaseInfo( WorldList, ACCOUNT_DBPROXY ); if( pAccountInfo ) { strTemp = "[ACCOUNTDBPROXYSERVER]\r\n"; strMsg = strTemp; strTemp.Format("ACCOUNTDBPROXYSERVER_IP = %s \r\n", pAccountInfo->m_szPrivateIP ); strMsg += strTemp; strTemp.Format("ACCOUNTDBPROXYSERVER_PORT = %d \r\n", pAccountInfo->m_wPrivatePort ); strMsg += strTemp; strMsg += "\r\n"; WriteMessge( strMsg ); } }