#include "stdafx.h" #include "RylGameServer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // edith 2009.08.11 °ÔÀÓ°¡µå 2.5 ¾÷±×·¹À̵å void Log(const char *szMsg, ... ) { va_list marker; char szTmp[256] = {0,}; va_start( marker ,szMsg ); vsprintf(szTmp,szMsg, marker); va_end( marker ); // DebugView ¸¦ ÅëÇØ¼­ ·Î±×¸¦ È®ÀÎ ÇÒ ¼ö ÀÖ½À´Ï´Ù. // OutputDebugString( szTmp ); DETLOG0(g_Log, szTmp); } GGAUTHS_API void NpLog(int mode, char* msg) { if(mode & (NPLOG_DEBUG | NPLOG_ERROR)) { Log(msg); } } GGAUTHS_API void GGAuthUpdateCallback(PGG_UPREPORT report) { Log( "GGAuth version update [%s] : [%ld] -> [%ld] \n", report->nType==1?"GameGuard Ver":"Protocol Num", report->dwBefore, report->dwNext ); } void PrePerformanceMsg(FILE* lpFile) { if(0 != lpFile) { SYSTEMTIME currentTime; GetLocalTime(¤tTime); fprintf(lpFile, "\n------------------------------------------------------------------------\n" "\tPID:0x%08x/ServerID:0x%08x/ServerZone:%02d/ServerChannel:%02d/\n" "\tGameServer PerformanceCheck. %04d-%02d-%02d %02d:%02d:%02d:%04d\n\n", GetCurrentProcessId(), CServerSetup::GetInstance().GetServerID(), CServerSetup::GetZoneFromCmdLine(), CServerSetup::GetChannelFromCmdLine(), currentTime.wYear, currentTime.wMonth, currentTime.wDay, currentTime.wHour, currentTime.wMinute, currentTime.wSecond, currentTime.wMilliseconds); } } bool CRylGameServer::InitializeGameObject(void) { // ·Î±× À̸§ ÃʱâÈ­. char szProgramName[MAX_PATH]; char szLogFilePrefixName[MAX_PATH]; char szSessionLogFilePrefixName[MAX_PATH]; char szSkillLogFilePrefixName[MAX_PATH]; DbgUtils::SetProgramName(szProgramName, MAX_PATH); szProgramName[MAX_PATH - 1] = 0; _snprintf(szLogFilePrefixName, MAX_PATH - 1, "%sZ%02dC%02d-", szProgramName, CServerSetup::GetInstance().GetServerZone(), CServerSetup::GetInstance().GetServerChannel()); _snprintf(szSessionLogFilePrefixName, MAX_PATH - 1, "SessionLogZ%02dC%02d-", CServerSetup::GetInstance().GetServerZone(), CServerSetup::GetInstance().GetServerChannel()); _snprintf(szSkillLogFilePrefixName, MAX_PATH - 1, "SkillLogZ%02dC%02d-", CServerSetup::GetInstance().GetServerZone(), CServerSetup::GetInstance().GetServerChannel()); g_Log.SetLogFileName(szLogFilePrefixName, szProgramName); g_SessionLog.SetLogFileName(szSessionLogFilePrefixName, szProgramName); g_SkillLog.SetLogFileName(szSkillLogFilePrefixName, szProgramName); // ÆÐŶ Åë°è ·Î±× Çì´õ ÃʱâÈ­ CPacketStatistics::GetInstance().SetUserMessageFunc(PrePerformanceMsg, 0); // ÆÛÆ÷¸Õ½º ·Î±× Çì´õ ÃʱâÈ­ CPerformanceCheck::GetInstance().SetUserMessageFunc(PrePerformanceMsg, 0); // °ÔÀÓ ·Î±× ÃʱâÈ­ if (false == CGameLog::GetInstance().Initialize(szLogFilePrefixName)) { ERRLOG0(g_Log, "°ÔÀÓ ·Î±×¸¦ ÃʱâÈ­Çϴµ¥ ½ÇÆÐÇß½À´Ï´Ù."); return false; } // ¾ÆÀÌÅÛ ½ºÅ©¸³Æ® ·Îµå char szItemScriptName[MAX_PATH]; if (SERVER_ID::GROUP_BATTLE_SERVER == CServerSetup::GetInstance().GetServerGroup()) { strncpy(szItemScriptName, "./Script/Game/BGItemScript.txt", MAX_PATH); } else { strncpy(szItemScriptName, "./Script/Game/ItemScript.txt", MAX_PATH); } if (false == Item::CItemMgr::GetInstance().LoadItemProtoType(szItemScriptName)) { ERRLOG0(g_Log, "¾ÆÀÌÅÛ ½ºÅ©¸³Æ®¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù."); return false; } // ¾ÆÀÌÅÛ ÇÕ¼º ½ºÅ©¸³Æ® ·Îµå if (false == Item::CItemMgr::GetInstance().LoadItemChemical()) { ERRLOG0(g_Log, "¾ÆÀÌÅÛ ÇÕ¼º ½ºÅ©¸³Æ®¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù."); return false; } // ¾ÆÀÌÅÛ º¸»ó ½ºÅ©¸³Æ® ·Îµå if (false == Item::CItemMgr::GetInstance().LoadItemSpeacialCompensation()) { ERRLOG0(g_Log, "¾ÆÀÌÅÛ º¸»ó ½ºÅ©¸³Æ®¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù."); return false; } // ½ºÅ³ ½ºÅ©¸³Æ® ·Îµå if (false == CSkillMgr::GetInstance().LoadSkillsFromFile()) { ERRLOG0(g_Log, "½ºÅ³ ½ºÅ©¸³Æ®¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù."); return false; } // ½ºÅ³ Å×À̺í ÃʱâÈ­ if (false == Skill::CProcessTable::GetInstance().Initialize()) { ERRLOG0(g_Log, "½ºÅ³ ó¸® Å×À̺íÀ» ÃʱâÈ­ ÇÒ ¼ö ¾ø½À´Ï´Ù."); return false; } // °ÔÀÓ À̺¥Æ® ÃʱâÈ­ if (false == CGameEventMgr::GetInstance().Initialize()) { ERRLOG0(g_Log, "°ÔÀÓ À̺¥Æ® ÃʱâÈ­¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù."); return false; } // ¸®½ºÆù À§Ä¡ ½ºÅ©¸³Æ® ·Îµå if (false == CCharRespawnMgr::GetInstance().LoadRespawnFromFile()) { ERRLOG0(g_Log, "¸®½ºÆù À§Ä¡ ½ºÅ©¸³Æ®¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù."); return false; } if (false == Filter::InitFilter()) { ERRLOG0(g_Log, "À̸§ ÇÊÅ͸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù."); return false; } // ¼¿ ·Îµå CCellManager& CellManager = CCellManager::GetInstance(); if (false == CellManager.LoadComplete()) { CellManager.Load(); CellManager.SetMoving(true); } // ±¤¹° ¹èÄ¡ ½ºÅ©¸³Æ® ·Îµå switch ( CServerSetup::GetInstance().GetServerZone() ) { case SERVER_ID::CAPITAL: { char szMineralVeinScriptName[MAX_PATH]; sprintf(szMineralVeinScriptName, "./Script/Game/MineralVein/MineralVein%d.gsf", CServerSetup::GetInstance().GetServerZone()); CMineralVeinMgr& MineralVeinMgr = CMineralVeinMgr::GetInstance(); if (false == MineralVeinMgr.LoadMineralVeinsFromBinary(szMineralVeinScriptName)) { ERRLOG0(g_Log, "±¤¹° ¹èÄ¡ ½ºÅ©¸³Æ® ·Îµå¿¡ ½ÇÆÐÇß½À´Ï´Ù."); return false; } } break; } // ¸ó½ºÅÍ Ã¤ÆÃ ½ºÅ©¸³Æ® ÃʱâÈ­ - ¼¿ ·ÎµåÇØ¼­ ¸ó½ºÅÍ ·ÎµåÇÑ ÈÄ ·Îµå if (false == CMonsterShout::GetInstance().LoadScript()) { ERRLOG0(g_Log, "¸ó½ºÅÍ Ã¤ÆÃ ½ºÅ©¸³Æ® ·Îµå¿¡ ½ÇÆÐÇß½À´Ï´Ù."); return false; } // ÇǾƽĺ° ·ê ÃʱâÈ­ if (false == EnemyCheck::CCheckTable::GetInstance().Initialize()) { ERRLOG0(g_Log, "ÇǾƽĺ° ·êÀ» ÃʱâÈ­Çϴµ¥ ½ÇÆÐÇÏ¿´½À´Ï´Ù."); return false; } // ------------------------------------------------------------------------------------------ // °ÔÀÓ °¡µå °ü·Ã ÃʱâÈ­ // edith 2009.08.11 °ÔÀÓ°¡µå 2.5 ¾÷±×·¹À̵å /* if (0 == LoadAuthTable("./Script/Server/CSAuth.tab")) { ERRLOG0(g_Log, "RowGameServer initialize failed : GameGuard LoadAuthTable failed"); return false; } if (0 == LoadAuthIndex("./Script/Server/CSAuth.idx")) { ERRLOG0(g_Log, "RowGameServer initialize failed : GameGuard LoadAuthIndex failed"); return false; } if (0 == InitPacketProtect("RYLPART2", 1)) { ERRLOG0(g_Log, "RowGameServer initialize failed : GameGuard InitPacketProtect failed"); return false; } */ #ifndef NO_GAMEGUARD /* // edith 2009.08.11 °ÔÀÓ°¡µå 2.5 ¾÷±×·¹À̵å // 1. ¼­¹öÀÎÁõ ÃʱâÈ­ ÇÔ¼ö : InitGameguardAuth unsigned long dwGGErrCode = InitGameguardAuth("./Script/Server", 50); if (ERROR_SUCCESS != dwGGErrCode) { ERRLOG1(g_Log, "RowGameServer initialize failed : GameGuard InitGameguardAuth failed(%d)", dwGGErrCode); return false; } */ // 1. ¼­¹öÀÎÁõ ÃʱâÈ­ ÇÔ¼ö : InitGameguardAuth unsigned long dwGGErrCode = InitGameguardAuth("./Script/Server", 50, true, NPLOG_DEBUG|NPLOG_ERROR); if (ERROR_SUCCESS != dwGGErrCode) { ERRLOG1(g_Log, "RowGameServer initialize failed : GameGuard InitGameguardAuth failed(%d)", dwGGErrCode); return false; } // 2. ¼­¹öÀÎÁõ »óÅ ÀúÀåÇÔ¼ö : SetUpdateCondition // 2. Storage function of server certification condition : SetUpdateCondition SetUpdateCondition(30, 50); // ------------------------------------------------------------------------------------------ #endif m_bInitialized = true; return true; } void CRylGameServer::DestoryGameObject(void) { #ifndef NO_GAMEGUARD CleanupGameguardAuth(); #endif }