forked from metin2/server
Remove hackshield and unused function, game now compiles and runs
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include "constants.h"
|
||||
#include "config.h"
|
||||
#include "event.h"
|
||||
#include "minilzo.h"
|
||||
#include "packet.h"
|
||||
#include "desc_manager.h"
|
||||
#include "item_manager.h"
|
||||
@@ -58,21 +57,10 @@
|
||||
#include "threeway_war.h"
|
||||
#include "auth_brazil.h"
|
||||
#include "DragonLair.h"
|
||||
#include "HackShield.h"
|
||||
#include "skill_power.h"
|
||||
#include "SpeedServer.h"
|
||||
#include "XTrapManager.h"
|
||||
#include "DragonSoul.h"
|
||||
#include <boost/bind.hpp>
|
||||
#ifndef __WIN32__
|
||||
#include "limit_time.h"
|
||||
#endif
|
||||
|
||||
//#define __FILEMONITOR__
|
||||
|
||||
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
|
||||
#include "FileMonitor_FreeBSD.h"
|
||||
#endif
|
||||
|
||||
#ifdef __AUCTION__
|
||||
#include "auction_manager.h"
|
||||
@@ -86,12 +74,6 @@
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>쿡<EFBFBD><ECBFA1> <20><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD>Ű üũ
|
||||
#ifdef _WIN32
|
||||
//#define _USE_SERVER_KEY_
|
||||
#endif
|
||||
#include "check_server.h"
|
||||
|
||||
extern void WriteVersion();
|
||||
//extern const char * _malloc_options;
|
||||
#if defined(__FreeBSD__) && defined(DEBUG_ALLOC)
|
||||
@@ -250,13 +232,6 @@ void heartbeat(LPHEART ht, int pulse)
|
||||
// 1<>ʸ<EFBFBD><CAB8><EFBFBD>
|
||||
if (!(pulse % ht->passes_per_sec))
|
||||
{
|
||||
#ifdef ENABLE_LIMIT_TIME
|
||||
if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME)
|
||||
{
|
||||
g_bShutdown = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_bAuthServer && LC_IsBrazil() && !test_server)
|
||||
auth_brazil_log();
|
||||
|
||||
@@ -316,14 +291,6 @@ void heartbeat(LPHEART ht, int pulse)
|
||||
if (!(pulse % (passes_per_sec + 4)))
|
||||
CHARACTER_MANAGER::instance().ProcessDelayedSave();
|
||||
|
||||
//4<><34> <20><><EFBFBD><EFBFBD>
|
||||
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
|
||||
if (!(pulse % (passes_per_sec * 5)))
|
||||
{
|
||||
FileMonitorFreeBSD::Instance().Update(pulse);
|
||||
}
|
||||
#endif
|
||||
|
||||
// <20><> 5.08<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD>
|
||||
if (!(pulse % (passes_per_sec * 5 + 2)))
|
||||
{
|
||||
@@ -357,87 +324,6 @@ void heartbeat(LPHEART ht, int pulse)
|
||||
}
|
||||
}
|
||||
|
||||
static bool g_isInvalidServer = false;
|
||||
|
||||
bool Metin2Server_IsInvalid()
|
||||
{
|
||||
return g_isInvalidServer;
|
||||
}
|
||||
|
||||
void Metin2Server_Check()
|
||||
{
|
||||
#ifdef _SERVER_CHECK_
|
||||
|
||||
#ifdef _USE_SERVER_KEY_
|
||||
if (false == CheckServer::CheckIp(g_szPublicIP))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
fprintf(stderr, "check ip failed\n");
|
||||
#endif
|
||||
g_isInvalidServer = true;
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (LC_IsEurope() || test_server)
|
||||
return;
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ip
|
||||
if (strncmp (g_szPublicIP, "189.112.1", 9) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> ip
|
||||
if (strncmp (g_szPublicIP, "74.200.6", 8) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
static const size_t CheckServerListSize = 1;
|
||||
static const char* CheckServerList[] = { "202.31.178.251"};
|
||||
static const int CheckServerPort = 7120;
|
||||
|
||||
socket_t sockConnector = INVALID_SOCKET;
|
||||
|
||||
for (size_t i = 0 ; i < CheckServerListSize ; i++)
|
||||
{
|
||||
sockConnector = socket_connect( CheckServerList[i], CheckServerPort );
|
||||
|
||||
if (0 < sockConnector)
|
||||
break;
|
||||
}
|
||||
|
||||
if (0 > sockConnector)
|
||||
{
|
||||
if (true != LC_IsEurope()) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ϸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
g_isInvalidServer = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256] = { 0, };
|
||||
|
||||
socket_read(sockConnector, buf, sizeof(buf) - 1);
|
||||
|
||||
sys_log(0, "recv[%s]", buf);
|
||||
|
||||
if (strncmp(buf, "OK", 2) == 0)
|
||||
g_isInvalidServer = false;
|
||||
else if (strncmp(buf, "CK", 2) == 0)
|
||||
g_isInvalidServer = true;
|
||||
|
||||
socket_close(sockConnector);
|
||||
#else
|
||||
g_isInvalidServer = false;
|
||||
return;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void CleanUpForEarlyExit() {
|
||||
CancelReloadSpamEvent();
|
||||
}
|
||||
@@ -511,9 +397,6 @@ int main(int argc, char **argv)
|
||||
CThreeWayWar threeway_war;
|
||||
CDragonLairManager dl_manager;
|
||||
|
||||
CHackShieldManager HSManager;
|
||||
CXTrapManager XTManager;
|
||||
|
||||
CSpeedServerManager SSManager;
|
||||
DSManager dsManager;
|
||||
|
||||
@@ -545,53 +428,9 @@ int main(int argc, char **argv)
|
||||
ani_init();
|
||||
PanamaLoad();
|
||||
|
||||
Metin2Server_Check();
|
||||
|
||||
#if defined(_WIN32) && defined(_USE_SERVER_KEY_)
|
||||
if (CheckServer::IsFail())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( g_bTrafficProfileOn )
|
||||
TrafficProfiler::instance().Initialize( TRAFFIC_PROFILE_FLUSH_CYCLE, "ProfileLog" );
|
||||
|
||||
//if game server
|
||||
if (!g_bAuthServer)
|
||||
{
|
||||
//hackshield
|
||||
if (isHackShieldEnable)
|
||||
{
|
||||
if (!HSManager.Initialize())
|
||||
{
|
||||
fprintf(stderr, "Failed To Initialize HS");
|
||||
CleanUpForEarlyExit();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//xtrap
|
||||
if(bXTrapEnabled)
|
||||
{
|
||||
if (!XTManager.LoadXTrapModule())
|
||||
{
|
||||
CleanUpForEarlyExit();
|
||||
return 0;
|
||||
}
|
||||
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
|
||||
//PFN_FileChangeListener pNotifyFunc = boost::bind( &CXTrapManager::NotifyMapFileChanged, CXTrapManager::instance(), _1 );
|
||||
PFN_FileChangeListener pNotifyFunc = &(CXTrapManager::NotifyMapFileChanged);
|
||||
|
||||
const std::string strMap1Name = "map1.CS3";
|
||||
const std::string strMap2Name = "map2.CS3";
|
||||
|
||||
FileMonitorFreeBSD::Instance().AddWatch( strMap1Name, pNotifyFunc );
|
||||
FileMonitorFreeBSD::Instance().AddWatch( strMap2Name, pNotifyFunc );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Client PackageCrypt
|
||||
|
||||
//TODO : make it config
|
||||
@@ -601,11 +440,6 @@ int main(int argc, char **argv)
|
||||
sys_err("Failed to Load ClientPackageCryptInfo File(%s)", strPackageCryptInfoDir.c_str());
|
||||
}
|
||||
|
||||
#if defined (__FreeBSD__) && defined(__FILEMONITOR__)
|
||||
PFN_FileChangeListener pPackageNotifyFunc = &(DESC_MANAGER::NotifyClientPackageFileChanged);
|
||||
//FileMonitorFreeBSD::Instance().AddWatch( strPackageCryptInfoName, pPackageNotifyFunc );
|
||||
#endif
|
||||
|
||||
while (idle());
|
||||
|
||||
sys_log(0, "<shutdown> Starting...");
|
||||
@@ -666,15 +500,6 @@ int main(int argc, char **argv)
|
||||
sys_log(0, "<shutdown> Destroying building::CManager...");
|
||||
building_manager.Destroy();
|
||||
|
||||
if (!g_bAuthServer)
|
||||
{
|
||||
if (isHackShieldEnable)
|
||||
{
|
||||
sys_log(0, "<shutdown> Releasing HackShield manager...");
|
||||
HSManager.Release();
|
||||
}
|
||||
}
|
||||
|
||||
sys_log(0, "<shutdown> Flushing TrafficProfiler...");
|
||||
trafficProfiler.Flush();
|
||||
|
||||
@@ -708,12 +533,6 @@ int start(int argc, char **argv)
|
||||
#if defined(__FreeBSD__) && defined(DEBUG_ALLOC)
|
||||
_malloc_message = WriteMallocMessage;
|
||||
#endif
|
||||
#ifdef ENABLE_LIMIT_TIME
|
||||
if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
while ((ch = getopt(argc, argv, "npverltI")) != -1)
|
||||
{
|
||||
@@ -726,8 +545,7 @@ int start(int argc, char **argv)
|
||||
|
||||
printf("IP %s\n", g_szPublicIP);
|
||||
|
||||
optind++;
|
||||
optreset = 1;
|
||||
optind = 0;
|
||||
break;
|
||||
|
||||
case 'p': // port
|
||||
@@ -741,8 +559,7 @@ int start(int argc, char **argv)
|
||||
|
||||
printf("port %d\n", mother_port);
|
||||
|
||||
optind++;
|
||||
optreset = 1;
|
||||
optind = 0;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
@@ -751,8 +568,7 @@ int start(int argc, char **argv)
|
||||
|
||||
log_set_level(l);
|
||||
|
||||
optind++;
|
||||
optreset = 1;
|
||||
optind = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -761,8 +577,9 @@ int start(int argc, char **argv)
|
||||
{
|
||||
if (optind < argc)
|
||||
{
|
||||
st_localeServiceName = argv[optind++];
|
||||
optreset = 1;
|
||||
st_localeServiceName = argv[optind];
|
||||
|
||||
optind = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -976,12 +793,6 @@ int idle()
|
||||
memset(&thecore_profiler[0], 0, sizeof(thecore_profiler));
|
||||
memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler));
|
||||
}
|
||||
#ifdef _USE_SERVER_KEY_
|
||||
if (Metin2Server_IsInvalid() && 0 == (thecore_random() % 7146))
|
||||
{
|
||||
return 0; // shutdown
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
if (_kbhit()) {
|
||||
|
Reference in New Issue
Block a user