Remove hackshield and unused function, game now compiles and runs

This commit is contained in:
2022-03-06 00:01:03 +02:00
parent 90ef09c331
commit b99293c9d7
103 changed files with 217 additions and 5364 deletions

View File

@ -6,7 +6,7 @@ file(GLOB_RECURSE sources
src/*.cpp src/*.h
)
include_directories(${PROJECT_BINARY_DIR}/src/system/)
include_directories(${PROJECT_BINARY_DIR}/src/)
include_directories(src/)
@ -15,18 +15,21 @@ find_package(libmysql REQUIRED)
find_package(Boost COMPONENTS system REQUIRED)
find_package(DevIL REQUIRED)
find_package(LZO REQUIRED)
find_package(cryptopp CONFIG REQUIRED)
find_package(GTest REQUIRED)
add_executable(${PROJECT_NAME} ${sources})
# Link dependencies if found
if (libmysql_FOUND)
target_link_libraries (${PROJECT_NAME} ${MYSQL_LIBRARIES})
endif (libmysql_FOUND)
target_link_libraries (${PROJECT_NAME} ${MYSQL_LIBRARIES})
# Crypto++
target_link_libraries (${PROJECT_NAME} cryptopp-static)
# Boost
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY})
endif (Boost_FOUND)
if (IL_FOUND)
include_directories(${IL_INCLUDE_DIR})
@ -39,14 +42,12 @@ if (LZO_FOUND)
endif (LZO_FOUND)
target_link_libraries(${PROJECT_NAME} md)
# Pthreads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED)
target_link_libraries (${PROJECT_NAME} Threads::Threads)
find_package(GTest REQUIRED)
# Google test
if (GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} ${GTEST_BOTH_LIBRARIES})

View File

@ -2,10 +2,6 @@
#include "ClientPackageCryptInfo.h"
#include <common/stl.h>
#ifndef __FreeBSD__
#include "../../libthecore/include/xdirent.h"
#endif
CClientPackageCryptInfo::CClientPackageCryptInfo() : m_pSerializedCryptKeyStream(NULL), m_nCryptKeyPackageCnt(0)
{
}

View File

@ -1,7 +1,7 @@
#ifndef __INC_CLIENTPACKAGE_CRYPTINFO_H
#define __INC_CLIENTPACKAGE_CRYPTINFO_H
#include <boost/unordered_map.hpp>
#include <unordered_map>
#pragma pack(1)
@ -103,7 +103,7 @@ private:
} TPerFileSDBInfo;
typedef boost::unordered_map<std::string, TPerFileSDBInfo > TPackageSDBMap; //key: related map name
typedef std::unordered_map<std::string, TPerFileSDBInfo > TPackageSDBMap; //key: related map name
TPackageSDBMap m_mapPackageSDB;

View File

@ -222,7 +222,7 @@ void CDragonLairManager::OnDragonDead(LPCHARACTER pDragon, DWORD KillerGuildID)
if (false == pDragon->IsMonster())
return;
boost::unordered_map<DWORD, CDragonLair*>::iterator iter = LairMap_.find( KillerGuildID );
std::unordered_map<DWORD, CDragonLair*>::iterator iter = LairMap_.find( KillerGuildID );
if (LairMap_.end() == iter)
{

View File

@ -1,5 +1,5 @@
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <common/stl.h>
@ -32,6 +32,6 @@ class CDragonLairManager : public singleton<CDragonLairManager>
size_t GetLairCount () const { return LairMap_.size(); }
private:
boost::unordered_map<DWORD, CDragonLair*> LairMap_;
std::unordered_map<DWORD, CDragonLair*> LairMap_;
};

View File

@ -1,136 +0,0 @@
#include "stdafx.h"
#include "FileMonitor_FreeBSD.h"
#include "../../libthecore/include/log.h"
#define INVALID_KERNEL_EVENT -1
FileMonitorFreeBSD::FileMonitorFreeBSD()
{
m_KernelEventQueue = INVALID_KERNEL_EVENT;
}
FileMonitorFreeBSD::~FileMonitorFreeBSD()
{
if( m_KernelEventQueue != INVALID_KERNEL_EVENT )
{
close ( m_KernelEventQueue );
m_KernelEventQueue = INVALID_KERNEL_EVENT;
}
TMonitorFileHashMap::iterator it;
for( it = m_FileLists.begin(); it != m_FileLists.end(); ++it )
{
close(it->second.fhMonitor);
}
m_FileLists.clear();
m_MonitoredEventLists.clear();
m_TriggeredEventLists.clear();
}
void FileMonitorFreeBSD::Update(DWORD dwPulses)
{
if( m_KernelEventQueue == INVALID_KERNEL_EVENT || m_FileLists.size() == 0 )
return;
int nEvent = kevent(m_KernelEventQueue, &m_TriggeredEventLists[0], (int)m_TriggeredEventLists.size(), &m_MonitoredEventLists[0], (int)m_MonitoredEventLists.size(), NULL );
if( nEvent == INVALID_KERNEL_EVENT )
{
return;
}
else if( nEvent > 0 )
{
for( int i = 0; i < nEvent; ++i )
{
int nEventFlags = m_MonitoredEventLists[i].flags;
eFileUpdatedOptions eUpdateOption = e_FileUpdate_None;
if (nEventFlags & EV_ERROR)
eUpdateOption = e_FileUpdate_Error;
else if (nEventFlags & NOTE_DELETE)
eUpdateOption = e_FileUpdate_Deleted;
else if (nEventFlags & NOTE_EXTEND || nEventFlags & NOTE_WRITE)
eUpdateOption = e_FileUpdate_Modified;
else if (nEventFlags & NOTE_ATTRIB)
eUpdateOption = e_FileUpdate_AttrModified;
else if (nEventFlags & NOTE_LINK)
eUpdateOption = e_FileUpdate_Linked;
else if (nEventFlags & NOTE_RENAME)
eUpdateOption = e_FileUpdate_Renamed;
else if (nEventFlags & NOTE_REVOKE)
eUpdateOption = e_FileUpdate_Revoked;
if( eUpdateOption != e_FileUpdate_None )
{
TMonitorFileHashMap::iterator it;
for( it = m_FileLists.begin(); it != m_FileLists.end(); ++it )
{
FileIOContext_FreeBSD& context = it->second;
if( context.idxToEventList == i )
{
std::string strModifedFileName = it->first;
context.pListenFunc( strModifedFileName, eUpdateOption );
break;
}
}
}
}
}
}
void FileMonitorFreeBSD::AddWatch(const std::string& strFileName, PFN_FileChangeListener pListenerFunc)
{
int iFileHandle = -1;
if( (iFileHandle = open(strFileName.c_str(), O_RDONLY)) == -1)
{
sys_err("FileMonitorFreeBSD:AddWatch : can`t open file(%s).\n", strFileName.c_str());
return;
}
//create kqueue if not exists
if( m_KernelEventQueue == INVALID_KERNEL_EVENT )
m_KernelEventQueue = kqueue();
if( m_KernelEventQueue == INVALID_KERNEL_EVENT )
{
sys_err("FileMonitorFreeBSD:AddWatch : failed to create kqueue.\n");
return;
}
TMonitorFileHashMap::iterator it = m_FileLists.find( strFileName );
if( it != m_FileLists.end() )
{
sys_log(0, "FileMonitorFreeBSD:AddWatch : trying to add duplicated watch on file(%s).\n", strFileName.c_str() );
return;
}
//set file context
FileIOContext_FreeBSD context;
{
context.fhMonitor = iFileHandle;
context.idxToEventList = (int)m_MonitoredEventLists.size();
context.pListenFunc = pListenerFunc;
}
m_FileLists[strFileName] = context;
//set events
struct kevent kTriggerEvent, kMonitorEvent;
EV_SET(&kTriggerEvent, iFileHandle, EVFILT_VNODE,
EV_ADD | EV_ENABLE | EV_ONESHOT,
NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_LINK | NOTE_RENAME | NOTE_REVOKE,
0, 0);
m_TriggeredEventLists.push_back( kTriggerEvent );
m_MonitoredEventLists.push_back( kMonitorEvent );
}

View File

@ -1,47 +0,0 @@
#ifndef FILEMONITOR_FREEBSD_INCLUDED
#define FILEMONITOR_FREEBSD_INCLUDED
#include "IFileMonitor.h"
#include <unistd.h>
#include <sys/event.h>
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/time.h>
struct FileIOContext_FreeBSD
{
int fhMonitor;
int idxToEventList; // evtTrigger & evtMonitor index should be same
PFN_FileChangeListener pListenFunc;
};
class FileMonitorFreeBSD : public IFileMonitor
{
private:
FileMonitorFreeBSD(); //hidden
public:
virtual ~FileMonitorFreeBSD();
void AddWatch (const std::string& strFileName, PFN_FileChangeListener pListenerFunc);
void Update (DWORD dwPulses);
static FileMonitorFreeBSD& Instance()
{
static FileMonitorFreeBSD theMonitor;
return theMonitor;
}
private:
typedef boost::unordered_map<std::string, FileIOContext_FreeBSD> TMonitorFileHashMap;
typedef std::vector<struct kevent> TEventList;
TMonitorFileHashMap m_FileLists;
TEventList m_MonitoredEventLists;
TEventList m_TriggeredEventLists;
int m_KernelEventQueue;
};
#endif //FILEMONITOR_FREEBSD_INCLUDED

View File

@ -1,54 +0,0 @@
#include "stdafx.h"
#include "HackShield.h"
#include "HackShield_Impl.h"
#include "config.h"
bool CHackShieldManager::Initialize()
{
impl_ = M2_NEW CHackShieldImpl;
if (NULL == impl_)
{
return false;
}
return impl_->Initialize();
}
void CHackShieldManager::Release()
{
if (NULL != impl_)
{
impl_->Release();
M2_DELETE(impl_);
impl_ = NULL;
}
}
bool CHackShieldManager::CreateClientHandle(DWORD dwPlayerID)
{
return impl_->CreateClientHandle(dwPlayerID);
}
void CHackShieldManager::DeleteClientHandle(DWORD dwPlayerID)
{
impl_->DeleteClientHandle(dwPlayerID);
}
bool CHackShieldManager::SendCheckPacket(LPCHARACTER ch)
{
return impl_->SendCheckPacket(ch);
}
bool CHackShieldManager::VerifyAck(LPCHARACTER ch, const void* buf)
{
TPacketGCHSCheck* p = reinterpret_cast<TPacketGCHSCheck*>(const_cast<void*>(buf));
return impl_->VerifyAck(ch, p);
}

View File

@ -1,24 +0,0 @@
#ifndef HACK_SHIELD_MANAGER_H_
#define HACK_SHIELD_MANAGER_H_
class CHackShieldImpl;
class CHackShieldManager : public singleton<CHackShieldManager>
{
public:
bool Initialize ();
void Release ();
bool CreateClientHandle (DWORD dwPlayerID);
void DeleteClientHandle (DWORD dwPlayerID);
bool SendCheckPacket (LPCHARACTER ch);
bool VerifyAck (LPCHARACTER ch, const void* buf);
private:
CHackShieldImpl* impl_;
};
#endif /* HACK_SHIELD_MANAGER_H_ */

View File

@ -1,202 +0,0 @@
#include "stdafx.h"
#include "HackShield_Impl.h"
#ifdef __FreeBSD__
#include "char.h"
#include "packet.h"
#include "desc.h"
#include "log.h"
bool CHackShieldImpl::Initialize()
{
handle_ = _AhnHS_CreateServerObject("metin2client.bin.hsb");
if (ANTICPX_INVALID_HANDLE_VALUE == handle_)
{
return false;
}
sys_log(0, "HShield: Success to CreateServerObject");
return true;
}
void CHackShieldImpl::Release()
{
_AhnHS_CloseServerHandle(handle_);
sys_log(0, "HShield: Server Handle Closed");
}
bool CHackShieldImpl::CreateClientHandle(DWORD dwPlayerID)
{
ClientHandleContainer::const_iterator iter = CliehtHandleMap_.find( dwPlayerID );
if (iter != CliehtHandleMap_.end())
{
sys_log(0, "HShield: Client Handle is already created for Player(%u)", dwPlayerID);
return false;
}
AHNHS_CLIENT_HANDLE handle = _AhnHS_CreateClientObject(handle_);
if (ANTICPX_INVALID_HANDLE_VALUE == handle)
{
sys_log(0, "HShield: Failed to create client handle for Player(%u)", dwPlayerID);
return false;
}
CliehtHandleMap_.insert( std::make_pair(dwPlayerID, handle) );
sys_log(0, "HShield: Success to create client handle for Player(%u)", dwPlayerID);
return true;
}
void CHackShieldImpl::DeleteClientHandle(DWORD dwPlayerID)
{
ClientHandleContainer::iterator iter = CliehtHandleMap_.find( dwPlayerID );
if (iter == CliehtHandleMap_.end())
{
sys_log(0, "HShield: there is no client handle for Player(%u)", dwPlayerID);
return;
}
_AhnHS_CloseClientHandle(iter->second);
CliehtHandleMap_.erase(iter);
sys_log(0, "HShield: client handle deleted for Player(%u)", dwPlayerID);
}
bool CHackShieldImpl::SendCheckPacket(LPCHARACTER ch)
{
if (NULL == ch)
{
return false;
}
ClientHandleContainer::const_iterator iter = CliehtHandleMap_.find( ch->GetPlayerID() );
if (iter == CliehtHandleMap_.end())
{
sys_log(0, "HShield: Client Handle not create for Player(%u)", ch->GetPlayerID());
return false;
}
TPacketGCHSCheck pack;
pack.bHeader = HEADER_GC_HS_REQUEST;
memset( &pack.Req, 0, sizeof(pack.Req));
unsigned long ret = _AhnHS_MakeRequest( iter->second, &(pack.Req) );
if (0 != ret)
{
sys_log(0, "HShield: _AhnHS_MakeRequest return error(%u) for Player(%u)", ret, ch->GetPlayerID());
return false;
}
else
{
sys_log(0, "HShield: _AhnHS_MakeRequest success ret(%d)", ret);
}
if (NULL != ch->GetDesc())
{
ch->GetDesc()->Packet( &pack, sizeof(pack) );
sys_log(0, "HShield: Send Check Request for Player(%u)", ch->GetPlayerID());
return true;
}
sys_log(0, "HShield: Failed to get DESC for Player(%u)", ch->GetPlayerID());
return false;
}
bool CHackShieldImpl::VerifyAck(LPCHARACTER ch, TPacketGCHSCheck* buf)
{
if (NULL == ch)
{
return false;
}
bool NeedDisconnect = false;
ClientHandleContainer::const_iterator iter = CliehtHandleMap_.find( ch->GetPlayerID() );
if (iter == CliehtHandleMap_.end())
{
sys_log(0, "HShield: Cannot Find ClientHandle For Verify");
NeedDisconnect = true;
}
unsigned long dwError = 0;
unsigned long ret = _AhnHS_VerifyResponseEx( iter->second, buf->Req.byBuffer, buf->Req.nLength, &dwError );
if (ANTICPX_RECOMMAND_CLOSE_SESSION == ret)
{
sys_log(0, "HShield: not a valid ack ret(%u) error(%u) from Player(%u)", ret, dwError, ch->GetPlayerID());
NeedDisconnect = true;
ch->StopHackShieldCheckCycle();
}
if (NULL != ch->GetDesc())
{
if (true == NeedDisconnect)
{
ch->GetDesc()->SetPhase(PHASE_CLOSE);
LogManager::instance().HackShieldLog(dwError, ch);
return false;
}
else
{
ch->SetHackShieldCheckMode(false);
}
}
sys_log(0, "HShield: Valid Ack from Player(%u)", ch->GetPlayerID());
return true;
}
#else
bool CHackShieldImpl::Initialize()
{
return true;
}
void CHackShieldImpl::Release()
{
}
bool CHackShieldImpl::CreateClientHandle(DWORD dwPlayerID)
{
return true;
}
void CHackShieldImpl::DeleteClientHandle(DWORD dwPlayerID)
{
}
bool CHackShieldImpl::SendCheckPacket(LPCHARACTER ch)
{
return true;
}
bool CHackShieldImpl::VerifyAck(LPCHARACTER ch, TPacketGCHSCheck* buf)
{
return true;
}
#endif

View File

@ -1,51 +0,0 @@
#ifndef HACK_SHIELD_IMPL_H_
#define HACK_SHIELD_IMPL_H_
#include <boost/unordered_map.hpp>
#ifdef __FreeBSD__
// Live build only
#define UNIX
#include <AntiCpXSvr.h>
#undef UNIX
#endif
#pragma pack(1)
typedef struct SPacketGCHSCheck
{
BYTE bHeader;
#ifdef __FreeBSD__
AHNHS_TRANS_BUFFER Req;
#endif
} TPacketGCHSCheck;
#pragma pack()
class CHackShieldImpl
{
public:
bool Initialize ();
void Release ();
bool CreateClientHandle (DWORD dwPlayerID);
void DeleteClientHandle (DWORD dwPlayerID);
bool SendCheckPacket (LPCHARACTER ch);
bool VerifyAck (LPCHARACTER ch, TPacketGCHSCheck* buf);
private:
#ifdef __FreeBSD__
AHNHS_SERVER_HANDLE handle_;
typedef boost::unordered_map<DWORD, AHNHS_CLIENT_HANDLE> ClientHandleContainer;
ClientHandleContainer CliehtHandleMap_;
typedef boost::unordered_map<DWORD, bool> ClientCheckContainer;
ClientCheckContainer ClientCheckMap_;
#endif
};
#endif /* HACK_SHIELD_IMPL_H_ */

View File

@ -2,7 +2,7 @@
#define IFILEMONITOR_INCLUDED
//#include <boost/function.hpp>
#include <boost/unordered_map.hpp>
#include <unordered_map>
enum eFileUpdatedOptions
{

View File

@ -2,7 +2,7 @@
#define __INC_METIN_II_MARKIMAGE_H__
#include <IL/il.h>
#include "minilzo.h"
#include <lzo/lzo1x.h>
typedef unsigned long Pixel;

View File

@ -95,7 +95,7 @@ private:
class CPetSystem
{
public:
typedef boost::unordered_map<DWORD, CPetActor*> TPetActorMap; /// <VNUM, PetActor> map. (<28><> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD> vnum<75><6D> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..??)
typedef std::unordered_map<DWORD, CPetActor*> TPetActorMap; /// <VNUM, PetActor> map. (<28><> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD> vnum<75><6D> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..??)
public:
CPetSystem(LPCHARACTER owner);

View File

@ -1,329 +0,0 @@
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64)
#include <io.h>
#include <windows.h>
#include <tchar.h>
#else
#include <dlfcn.h>
#include <unistd.h>
#endif
#include <XTrap_S_Interface.h>
#include "char.h"
#include "config.h"
#include "event.h"
#include "log.h"
#include "desc.h"
#include "packet.h"
#include "XTrapManager.h"
#define CSFILE_NUM 2
#define XTRAP_CS1_CHECK_CYCLE PASSES_PER_SEC(20) // per 20sec
unsigned char g_XTrap_ClientMap[CSFILE_NUM][XTRAP_CS4_BUFSIZE_MAP];
struct CXTrapManager::sXTrapContext
{
//API function pointers
PFN_XTrap_S_Start XTrap_S_Start;
PFN_XTrap_S_SessionInit XTrap_S_SessionInit;
PFN_XTrap_CS_Step1 XTrap_CS_Step1;
PFN_XTrap_CS_Step3 XTrap_CS_Step3;
PFN_XTrap_S_SetActiveCode XTrap_S_SetActiveCode;
PFN_XTrap_S_SetOption XTrap_S_SetOption;
PFN_XTrap_S_SetAllowDelay XTrap_S_SetAllowDelay;
PFN_XTrap_S_SendGamePacket XTrap_S_SendGamePacket;
PFN_XTrap_S_RecvGamePacket XTrap_S_RecvGamePacket;
//handle
void* hXTrap4Server;
};
CXTrapManager::CXTrapManager()
{
m_pImpl = M2_NEW sXTrapContext;
memset( m_pImpl, 0x00, sizeof(sXTrapContext) );
}
CXTrapManager::~CXTrapManager()
{
#ifdef __FreeBSD__
if (m_pImpl->hXTrap4Server)
{
dlclose(m_pImpl->hXTrap4Server);
}
#endif
M2_DELETE(m_pImpl);
}
#ifdef __FreeBSD__
void CXTrapManager::MapReloadSignalHandler( int signal )
{
for(int i=0; i<CSFILE_NUM; ++i )
{
if( Instance().LoadClientMapFile(i) )
sys_log(0, "client map file(map%d).CS3 is reloaded", i+1 );
}
}
void CXTrapManager::NotifyMapFileChanged( const std::string& fileName, eFileUpdatedOptions eUpdateOption )
{
MapReloadSignalHandler(1);
}
#endif
bool CXTrapManager::LoadXTrapModule()
{
#ifdef __FreeBSD__
//first load client mapfile
bool bClientMapFileLoaded = false;
for(int i=0; i<CSFILE_NUM; ++i )
{
if( LoadClientMapFile(i) )
{
bClientMapFileLoaded = true;
}
}
if( !bClientMapFileLoaded )
{
sys_err("XTrap-failed to load at least one client map file. map file name should be map1.CS3 or map2.CS3");
return false;
}
//load shared objects
char sDllBinFile[] ="./libXTrap4Server.so";
m_pImpl->hXTrap4Server = dlopen(sDllBinFile, RTLD_LAZY);
if (m_pImpl->hXTrap4Server == 0)
{
sys_err("XTrap-failed to load so reason:%s", dlerror()) ;
return false;
}
void* hXTrapHandle = m_pImpl->hXTrap4Server;
m_pImpl->XTrap_S_Start = (PFN_XTrap_S_Start) dlsym(hXTrapHandle, "XTrap_S_Start");
m_pImpl->XTrap_S_SessionInit = (PFN_XTrap_S_SessionInit) dlsym(hXTrapHandle, "XTrap_S_SessionInit");
m_pImpl->XTrap_CS_Step1 = (PFN_XTrap_CS_Step1) dlsym(hXTrapHandle, "XTrap_CS_Step1");
m_pImpl->XTrap_CS_Step3 = (PFN_XTrap_CS_Step3) dlsym(hXTrapHandle, "XTrap_CS_Step3");
m_pImpl->XTrap_S_SetActiveCode = (PFN_XTrap_S_SetActiveCode) dlsym(hXTrapHandle, "XTrap_S_SetActiveCode");
m_pImpl->XTrap_S_SetOption = (PFN_XTrap_S_SetOption) dlsym(hXTrapHandle, "XTrap_S_SetOption");
m_pImpl->XTrap_S_SetAllowDelay = (PFN_XTrap_S_SetAllowDelay) dlsym(hXTrapHandle, "XTrap_S_SetAllowDelay");
m_pImpl->XTrap_S_SendGamePacket = (PFN_XTrap_S_SendGamePacket) dlsym(hXTrapHandle, "XTrap_S_SendGamePacket");
m_pImpl->XTrap_S_RecvGamePacket = (PFN_XTrap_S_RecvGamePacket) dlsym(hXTrapHandle, "XTrap_S_RecvGamePacket");
if (m_pImpl->XTrap_S_Start == NULL ||
m_pImpl->XTrap_S_SessionInit == NULL ||
m_pImpl->XTrap_CS_Step1 == NULL ||
m_pImpl->XTrap_CS_Step3 == NULL ||
m_pImpl->XTrap_S_SetOption == NULL ||
m_pImpl->XTrap_S_SetAllowDelay == NULL ||
m_pImpl->XTrap_S_SendGamePacket == NULL ||
m_pImpl->XTrap_S_RecvGamePacket == NULL)
{
sys_err("XTrap-failed to load function ptrs");
return false;
}
//start server module
m_pImpl->XTrap_S_Start( 600, CSFILE_NUM, g_XTrap_ClientMap, NULL );
//NOTE : <20>ϴ<EFBFBD> XProtect<63><74><EFBFBD><20><><EFBFBD>װ<EFBFBD> <20>־ <20>ڵ念<DAB5><E5BFB5> üũ<C3BC><C5A9> <20><><EFBFBD><EFBFBD>.
m_pImpl->XTrap_S_SetActiveCode( XTRAP_ACTIVE_CODE_THEMIDA );
//setup signal
signal(SIGUSR2, CXTrapManager::MapReloadSignalHandler);
#endif
return true;
}
bool CXTrapManager::LoadClientMapFile( unsigned int iMapIndex )
{
#ifdef __FreeBSD__
//index check
if( iMapIndex >= CSFILE_NUM )
{
return false;
}
char szFileName[1024] = {0,};
snprintf(szFileName, sizeof(szFileName), "map%d.CS3", iMapIndex+1);
FILE* fi = 0;
fi = fopen(szFileName, "rb");
if (fi == NULL)
{
return false;
}
fread(g_XTrap_ClientMap[iMapIndex], XTRAP_CS4_BUFSIZE_MAP, 1, fi);
fclose(fi);
#endif
return true;
}
EVENTINFO(xtrap_cs1_check_info)
{
DynamicCharacterPtr ptrPC;
};
EVENTFUNC(xtrap_cs1_check_event)
{
xtrap_cs1_check_info* info = dynamic_cast<xtrap_cs1_check_info*>( event->info );
if ( info == NULL )
{
sys_err( "<xtrap_event> info null pointer" );
return 0;
}
TPacketXTrapCSVerify pack;
pack.bHeader = HEADER_GC_XTRAP_CS1_REQUEST;
bool bSuccess = CXTrapManager::instance().Verify_CSStep1( info->ptrPC, pack.bPacketData );
LPDESC lpClientDesc = info->ptrPC.Get()->GetDesc();
if( !lpClientDesc )
{
sys_err( "<xtrap_event> client session is invalid" );
return 0;
}
lpClientDesc->Packet( &pack, sizeof(pack) );
if( bSuccess )
{
return XTRAP_CS1_CHECK_CYCLE;
}
sys_err( "XTrap: hack is detected %s", lpClientDesc->GetHostName() );
info->ptrPC.Get()->Disconnect("XTrapCheckInvalid");
lpClientDesc->SetPhase(PHASE_CLOSE);
return 0;
}
bool CXTrapManager::CreateClientSession( LPCHARACTER lpCharSession )
{
if( !bXTrapEnabled )
return true;
if( !lpCharSession )
return false;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it != m_mapClientSessions.end() )
{
sys_err("XTrap: client session is alreay registered");
return false;
}
//init session info
sSessionInfo infoData;
//xtrap session init
DWORD dwReturn = m_pImpl->XTrap_S_SessionInit( 600, CSFILE_NUM, g_XTrap_ClientMap, infoData.szSessionBuf );
if( dwReturn != 0 )
{
sys_err("XTrap: client session init failed");
}
xtrap_cs1_check_info* event_info = AllocEventInfo<xtrap_cs1_check_info>();
event_info->ptrPC = lpCharSession;
infoData.m_pCheckEvent = event_create(xtrap_cs1_check_event, event_info, XTRAP_CS1_CHECK_CYCLE);
m_mapClientSessions[dwSessionID] = infoData;
return true;
}
void CXTrapManager::DestroyClientSession( LPCHARACTER lpCharSession )
{
if( !bXTrapEnabled )
return;
if( !lpCharSession )
return;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it == m_mapClientSessions.end() )
{
sys_err("XTrap: client session is already destroyed");
return;
}
event_cancel(&(it->second.m_pCheckEvent) );
m_mapClientSessions.erase(it);
}
bool CXTrapManager::Verify_CSStep1( LPCHARACTER lpCharSession, BYTE* pBufData )
{
if( !bXTrapEnabled )
return false;
if( !lpCharSession )
return false;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it == m_mapClientSessions.end() )
{
sys_err("XTrap: client session is already destroyed");
return false;
}
int nReturn = m_pImpl->XTrap_CS_Step1( it->second.szSessionBuf, it->second.szPackBuf );
memcpy( pBufData, it->second.szPackBuf, VERIFY_PACK_LEN );
return (nReturn == 0) ? true : false;
}
void CXTrapManager::Verify_CSStep3( LPCHARACTER lpCharSession, BYTE* pBufData )
{
if( !bXTrapEnabled )
return;
if( !lpCharSession )
return;
DWORD dwSessionID = lpCharSession->GetPlayerID();
ClientSessionMap::iterator it = m_mapClientSessions.find( dwSessionID );
if( it == m_mapClientSessions.end() )
{
sys_log(0, "XTrap: client session is alreay destroyed");
return;
}
memcpy( it->second.szPackBuf, pBufData, VERIFY_PACK_LEN );
m_pImpl->XTrap_CS_Step3( it->second.szSessionBuf, it->second.szPackBuf );
//if( XTRAP_API_RETURN_DETECTHACK == m_pImpl->XTrap_CS_Step3( it->second.szSessionBuf, pBufData ) )
//{
// sys_error(0, "XTrap: client session is alreay destroyed");
//}
}

View File

@ -1,67 +0,0 @@
#ifndef _XTRAP_MANAGER_H_
#define _XTRAP_MANAGER_H_
#include "IFileMonitor.h"
#define SESSION_BUF_LEN 320
#define VERIFY_PACK_LEN 128
#define SESSION_CSSTEP1_LEN 256
#pragma pack(1)
typedef struct PacketXTrapVerify
{
BYTE bHeader;
BYTE bPacketData[VERIFY_PACK_LEN];
} TPacketXTrapCSVerify;
#pragma pack()
class CXTrapManager : public singleton<CXTrapManager>
{
public:
CXTrapManager();
virtual ~CXTrapManager();
bool LoadXTrapModule();
bool LoadClientMapFile( unsigned int iMapIndex );
bool CreateClientSession( LPCHARACTER lpCharSession );
void DestroyClientSession( LPCHARACTER lpCharSession );
bool Verify_CSStep1( LPCHARACTER lpCharSession, BYTE* pOutBufData );
void Verify_CSStep3( LPCHARACTER lpCharSession, BYTE* pBufData );
#ifdef __FreeBSD__
static void MapReloadSignalHandler( int signal );
static void NotifyMapFileChanged( const std::string& fileName, eFileUpdatedOptions eUpdateOption );
#endif
private:
//pimpl`s idiom
struct sXTrapContext;
sXTrapContext* m_pImpl;
struct sSessionInfo
{
sSessionInfo()
{
m_pCheckEvent = NULL;
memset(szSessionBuf, 0x00, sizeof(szSessionBuf) );
memset(szPackBuf, 0x00, sizeof(szPackBuf) );
}
BYTE szSessionBuf[SESSION_BUF_LEN];
BYTE szPackBuf[VERIFY_PACK_LEN];
LPEVENT m_pCheckEvent;
};
typedef boost::unordered_map<DWORD, sSessionInfo> ClientSessionMap;
ClientSessionMap m_mapClientSessions;
};
#endif /* _XTRAP_MANAGER_H_ */

View File

@ -3,7 +3,7 @@
#include <libsql/include/AsyncSQL.h>
#include <common/auction_table.h>
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <algorithm>
#define GRADE_LOW 30
@ -55,11 +55,11 @@ public:
private:
typedef boost::unordered_map <DWORD, TAuctionItemInfo*> TItemInfoMap;
typedef std::unordered_map <DWORD, TAuctionItemInfo*> TItemInfoMap;
TItemInfoMap item_map;
typedef std::map <DWORD, TAuctionItemInfo*> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TPCMap;
typedef std::unordered_map <DWORD, TItemMap*> TPCMap;
TPCMap offer_map;
@ -83,11 +83,11 @@ public:
class SaleBoard
{
private:
typedef boost::unordered_map <DWORD, TSaleItemInfo*> TItemInfoMap;
typedef std::unordered_map <DWORD, TSaleItemInfo*> TItemInfoMap;
TItemInfoMap item_map;
typedef std::map <DWORD, TSaleItemInfo*> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TPCMap;
typedef std::unordered_map <DWORD, TItemMap*> TPCMap;
TPCMap wisher_map;
TPCMap seller_map;
@ -111,7 +111,7 @@ class WishBoard
{
private:
typedef std::map <DWORD, TWishItemInfo*> TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TPCMap;
typedef std::unordered_map <DWORD, TItemMap*> TPCMap;
TPCMap wisher_map;
public:
@ -130,7 +130,7 @@ class MyBidBoard
private:
typedef std::pair <int, bool> BidInfo;
typedef std::map <DWORD, BidInfo > TItemMap;
typedef boost::unordered_map <DWORD, TItemMap*> TMyBidBoard;
typedef std::unordered_map <DWORD, TItemMap*> TMyBidBoard;
// bidder_id<69><64> key
TMyBidBoard pc_map;
@ -153,7 +153,7 @@ public:
class AuctionManager : public singleton <AuctionManager>
{
private :
typedef boost::unordered_map<DWORD, LPITEM> TItemMap;
typedef std::unordered_map<DWORD, LPITEM> TItemMap;
TItemMap auction_item_map;
// auction<6F><6E> <20><><EFBFBD>ϵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>͵<EFBFBD>

View File

@ -2,7 +2,7 @@
#ifndef BANWORD_MANAGER_H_
#define BANWORD_MANAGER_H_
#include <boost/unordered_map.hpp>
#include <unordered_map>
class CBanwordManager : public singleton<CBanwordManager>
{
@ -16,7 +16,7 @@ class CBanwordManager : public singleton<CBanwordManager>
void ConvertString(char * c_pszString, size_t _len);
protected:
typedef boost::unordered_map<std::string, bool> TBanwordHashmap;
typedef std::unordered_map<std::string, bool> TBanwordHashmap;
TBanwordHashmap m_hashmap_words;
};

View File

@ -53,9 +53,7 @@
#include "gm.h"
#include "map_location.h"
#include "BlueDragon_Binder.h"
#include "HackShield.h"
#include "skill_power.h"
#include "XTrapManager.h"
#include "buff_on_attributes.h"
#ifdef __PET_SYSTEM__
@ -358,9 +356,6 @@ void CHARACTER::Initialize()
m_dwLastGoldDropTime = 0;
m_HackShieldCheckEvent = NULL;
m_HackShieldCheckMode = false;
m_bIsLoadedAffect = false;
cannot_dead = false;
@ -428,14 +423,6 @@ void CHARACTER::Destroy()
if (GetRider())
GetRider()->ClearHorseInfo();
if( IsPC() )
{
if (isHackShieldEnable)
{
CHackShieldManager::instance().DeleteClientHandle(GetPlayerID());
}
}
if (GetDesc())
{
GetDesc()->BindCharacter(NULL);
@ -528,8 +515,6 @@ void CHARACTER::Destroy()
event_cancel(&m_pkMiningEvent);
// END_OF_MINING
StopHackShieldCheckCycle();
for (itertype(m_mapMobSkillEvent) it = m_mapMobSkillEvent.begin(); it != m_mapMobSkillEvent.end(); ++it)
{
LPEVENT pkEvent = it->second;
@ -1407,8 +1392,6 @@ void CHARACTER::Disconnect(const char * c_pszReason)
// BindDesc(NULL);
}
CXTrapManager::instance().DestroyClientSession(this);
M2_DESTROY_CHARACTER(this);
}
@ -3692,7 +3675,7 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal)
if (0 == iAdd)
iChange = -iChange;
boost::unordered_map<BYTE, int>::iterator iter = m_SkillDamageBonus.find(bSkillVnum);
std::unordered_map<BYTE, int>::iterator iter = m_SkillDamageBonus.find(bSkillVnum);
if (iter == m_SkillDamageBonus.end())
m_SkillDamageBonus.insert(std::make_pair(bSkillVnum, iChange));

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_CHAR_H__
#define __INC_METIN_II_CHAR_H__
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <common/stl.h>
#include "entity.h"
@ -455,7 +455,7 @@ struct TSkillUseInfo
DWORD dwVID;
bool isGrandMaster;
boost::unordered_map<VID, size_t> TargetVIDMap;
std::map<VID, size_t> TargetVIDMap;
TSkillUseInfo()
: iHitCount(0), iMaxHitCount(0), iSplashCount(0), dwNextSkillUsableTime(0), iRange(0), bUsed(false),
@ -1449,7 +1449,7 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
//
protected:
TPlayerSkill* m_pSkillLevels;
boost::unordered_map<BYTE, int> m_SkillDamageBonus;
std::unordered_map<BYTE, int> m_SkillDamageBonus;
std::map<int, TSkillUseInfo> m_SkillUseInfo;
////////////////////////////////////////////////////////////////////////////////////////
@ -1939,18 +1939,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
private:
DWORD m_dwLastGoldDropTime;
public:
void StartHackShieldCheckCycle(int seconds);
void StopHackShieldCheckCycle();
bool GetHackShieldCheckMode() const { return m_HackShieldCheckMode; }
void SetHackShieldCheckMode(bool m) { m_HackShieldCheckMode = m; }
LPEVENT m_HackShieldCheckEvent;
private:
bool m_HackShieldCheckMode;
public:
void AutoRecoveryItemProcess (const EAffectTypes);

View File

@ -32,7 +32,7 @@ int CHARACTER::ChangeEmpire(BYTE empire)
"SELECT id, pid1, pid2, pid3, pid4 FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
if (msg->Get()->uiNumRows == 0)
{
@ -105,7 +105,7 @@ int CHARACTER::ChangeEmpire(BYTE empire)
snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
get_table_postfix(), empire, GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
if (msg->Get()->uiAffectedRows > 0)
{
@ -173,7 +173,7 @@ void CHARACTER::SetChangeEmpireCount()
snprintf(szQuery, sizeof(szQuery), "UPDATE change_empire SET change_count=%d WHERE account_id=%u", count, dwAID);
}
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
}
DWORD CHARACTER::GetAID() const

View File

@ -1,93 +0,0 @@
#include "stdafx.h"
#include "char.h"
#include "config.h"
#include "event.h"
#include "HackShield.h"
#include "log.h"
#include "desc.h"
#include "packet.h"
EVENTINFO(hackshield_event_info)
{
DynamicCharacterPtr CharPtr;
};
EVENTFUNC(hackshield_event)
{
hackshield_event_info* info = dynamic_cast<hackshield_event_info*>( event->info );
if ( info == NULL )
{
sys_err( "hackshield_event> <Factor> Null pointer" );
return 0;
}
LPCHARACTER ch = info->CharPtr;
if (NULL == ch)
{
sys_err("HShield: character pointer is null");
return 0;
}
if (NULL == ch->GetDesc())
{
sys_err("HShield: character has no descriptor");
return 0;
}
if (false == ch->GetHackShieldCheckMode())
{
if (false == CHackShieldManager::instance().SendCheckPacket(ch))
{
return 0;
}
else
{
ch->SetHackShieldCheckMode(true);
return HackShield_CheckCycleTime;
}
}
sys_log(0, "HShield: no response from Player(%u)", ch->GetPlayerID());
LogManager::instance().HackShieldLog(0, ch);
ch->m_HackShieldCheckEvent = NULL;
ch->GetDesc()->SetPhase(PHASE_CLOSE);
return 0;
}
void CHARACTER::StartHackShieldCheckCycle(int seconds)
{
StopHackShieldCheckCycle();
if (false == isHackShieldEnable)
return;
hackshield_event_info* info = AllocEventInfo<hackshield_event_info>();
info->CharPtr = this;
m_HackShieldCheckEvent = event_create(hackshield_event, info, seconds);
sys_log(0, "HShield: StartHackShieldCheckCycle %d", seconds);
}
void CHARACTER::StopHackShieldCheckCycle()
{
if (NULL != m_HackShieldCheckEvent)
{
event_cancel(&m_HackShieldCheckEvent);
m_HackShieldCheckEvent = NULL;
sys_log(0, "HShield: StopHackShieldCheckCycle");
}
}

View File

@ -15,7 +15,6 @@
#include "questmanager.h"
#include "questlua.h"
#include "locale_service.h"
#include "XTrapManager.h"
#ifndef __GNUC__
#include <boost/bind.hpp>
@ -713,15 +712,6 @@ void CHARACTER_MANAGER::Update(int iPulse)
for (itertype(m_map_dwMobKillCount) it = m_map_dwMobKillCount.begin(); it != m_map_dwMobKillCount.end(); ++it)
DBManager::instance().SendMoneyLog(MONEY_LOG_MONSTER_KILL, it->first, it->second);
#ifdef _USE_SERVER_KEY_
extern bool Metin2Server_IsInvalid();
extern bool g_bShutdown;
if (Metin2Server_IsInvalid())
{
g_bShutdown = true;
}
#endif
m_map_dwMobKillCount.clear();
}

View File

@ -17,7 +17,7 @@ class CharacterVectorInteractor;
class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER>
{
public:
typedef TR1_NS::unordered_map<std::string, LPCHARACTER> NAME_MAP;
typedef std::unordered_map<std::string, LPCHARACTER> NAME_MAP;
CHARACTER_MANAGER();
virtual ~CHARACTER_MANAGER();
@ -119,8 +119,8 @@ class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER>
int m_iUserDamageRatePremium;
int m_iVIDCount;
TR1_NS::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByVID;
TR1_NS::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByPID;
std::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByVID;
std::unordered_map<DWORD, LPCHARACTER> m_map_pkChrByPID;
NAME_MAP m_map_pkPCChr;
char dummy1[1024]; // memory barrier
@ -146,7 +146,7 @@ class CHARACTER_MANAGER : public singleton<CHARACTER_MANAGER>
template<class Func>
Func CHARACTER_MANAGER::for_each_pc(Func f)
{
TR1_NS::unordered_map<DWORD, LPCHARACTER>::iterator it;
std::unordered_map<DWORD, LPCHARACTER>::iterator it;
for (it = m_map_pkChrByPID.begin(); it != m_map_pkChrByPID.end(); ++it)
f(it->second);

View File

@ -3556,7 +3556,7 @@ bool CHARACTER::CheckSkillHitCount(const BYTE SkillID, const VID TargetVID)
return false;
}
boost::unordered_map<VID, size_t>::iterator iterTargetMap = rSkillUseInfo.TargetVIDMap.find(TargetVID);
auto iterTargetMap = rSkillUseInfo.TargetVIDMap.find(TargetVID);
if (rSkillUseInfo.TargetVIDMap.end() != iterTargetMap)
{

View File

@ -1,4 +0,0 @@
#include "check_server.h"
std::vector<std::string> CheckServer::keys_;
bool CheckServer::fail_ = true;

View File

@ -1,48 +0,0 @@
#ifndef _M2_CHECK_SERVER_KEY_H_
#define _M2_CHECK_SERVER_KEY_H_
#include <string>
#include <vector>
#include "CheckServerKey.h"
class CheckServer
{
public:
static FORCEINLINE void AddServerKey(const char* serverKey)
{
keys_.push_back(serverKey);
}
static FORCEINLINE bool CheckIp(const char* ip)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ȱɸ<C8B0><C9B8><EFBFBD> üũ <20><><EFBFBD><EFBFBD>
#ifndef _USE_SERVER_KEY_
fail_ = false;
return true;
#endif
for (int i = 0; i < keys_.size(); i++)
{
// <20>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD> <20>´<EFBFBD> <20><><EFBFBD><EFBFBD>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ok
std::string errorString;
if (CheckServerKey(keys_[i].c_str(), ip, "", errorString))
{
fail_ = false;
break;
}
}
return !IsFail();
}
static FORCEINLINE bool IsFail()
{
return fail_;
}
private:
static std::vector<std::string> keys_;
static bool fail_;
};
#endif // #ifndef _M2_CHECK_SERVER_KEY_H_

View File

@ -29,7 +29,6 @@
#include <cryptopp/shacal2.h>
#include <cryptopp/skipjack.h>
#include <cryptopp/tea.h>
#include <cryptopp/cryptoppLibLink.h>
using namespace CryptoPP;
@ -192,8 +191,8 @@ bool Cipher::SetUp(bool polarity) {
BlockCipherAlgorithm* detail_1 = BlockCipherAlgorithm::Pick(hint_1);
assert(detail_0 != NULL);
assert(detail_1 != NULL);
std::auto_ptr<BlockCipherAlgorithm> algorithm_0(detail_0);
std::auto_ptr<BlockCipherAlgorithm> algorithm_1(detail_1);
std::unique_ptr<BlockCipherAlgorithm> algorithm_0(detail_0);
std::unique_ptr<BlockCipherAlgorithm> algorithm_1(detail_1);
const size_t key_length_0 = algorithm_0->GetDefaultKeyLength();
const size_t iv_length_0 = algorithm_0->GetBlockSize();

View File

@ -28,7 +28,7 @@ class Cipher {
if (!activated_) {
return;
}
encoder_->ProcessData((byte*)buffer, (const byte*)buffer, length);
encoder_->ProcessData((CryptoPP::byte*)buffer, (const CryptoPP::byte*)buffer, length);
}
// Decrypts the given block of data. (no padding required)
void Decrypt(void* buffer, size_t length) {
@ -36,7 +36,7 @@ class Cipher {
if (!activated_) {
return;
}
decoder_->ProcessData((byte*)buffer, (const byte*)buffer, length);
decoder_->ProcessData((CryptoPP::byte*)buffer, (const CryptoPP::byte*)buffer, length);
}
bool activated() const { return activated_; }

View File

@ -974,17 +974,17 @@ ACMD(do_state)
snprintf(buf, sizeof(buf), "%s's State: ", tch->GetName());
if (tch->IsPosition(POS_FIGHTING))
strlcat(buf, "Battle", sizeof(buf));
strncat(buf, "Battle", sizeof(buf));
else if (tch->IsPosition(POS_DEAD))
strlcat(buf, "Dead", sizeof(buf));
strncat(buf, "Dead", sizeof(buf));
else
strlcat(buf, "Standing", sizeof(buf));
strncat(buf, "Standing", sizeof(buf));
if (ch->GetShop())
strlcat(buf, ", Shop", sizeof(buf));
strncat(buf, ", Shop", sizeof(buf));
if (ch->GetExchange())
strlcat(buf, ", Exchange", sizeof(buf));
strncat(buf, ", Exchange", sizeof(buf));
ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf);

View File

@ -19,7 +19,6 @@
#include "dev_log.h"
#include "db.h"
#include "skill_power.h"
#include "check_server.h"
using std::string;
@ -121,12 +120,6 @@ bool LoadClientVersion();
bool g_protectNormalPlayer = false; // <20><><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> "<22><>ȭ<EFBFBD><C8AD><EFBFBD><EFBFBD>" <20><> <20>Ϲ<EFBFBD><CFB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
bool g_noticeBattleZone = false; // <20>߸<EFBFBD><DFB8><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ȳ<EFBFBD><C8B3>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7><EFBFBD>
bool isHackShieldEnable = false;
int HackShield_FirstCheckWaitTime = passes_per_sec * 30;
int HackShield_CheckCycleTime = passes_per_sec * 180;
bool bXTrapEnabled = false;
int gPlayerMaxLevel = 99;
bool g_BlockCharCreation = false;
@ -560,7 +553,7 @@ void config_init(const string& st_localeServiceName)
char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "SELECT mKey, mValue FROM locale");
std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
if (pMsg->Get()->uiNumRows == 0)
{
@ -625,7 +618,7 @@ void config_init(const string& st_localeServiceName)
{
char szQuery[256];
snprintf(szQuery, sizeof(szQuery), "SELECT mValue FROM locale WHERE mKey='SKILL_POWER_BY_LEVEL'");
std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
if (pMsg->Get()->uiNumRows == 0)
{
@ -666,7 +659,7 @@ void config_init(const string& st_localeServiceName)
for (int job = 0; job < JOB_MAX_NUM * 2; ++job)
{
snprintf(szQuery, sizeof(szQuery), "SELECT mValue from locale where mKey='SKILL_POWER_BY_LEVEL_TYPE%d' ORDER BY CAST(mValue AS unsigned)", job);
std::auto_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> pMsg(AccountDB::instance().DirectQuery(szQuery));
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵǾ<C8B5><C7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2BABB><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
if (pMsg->Get()->uiNumRows == 0)
@ -1052,46 +1045,6 @@ void config_init(const string& st_localeServiceName)
str_to_number(g_noticeBattleZone, value_string);
}
TOKEN("hackshield_enable")
{
int flag = 0;
str_to_number(flag, value_string);
//if (1 == flag && LC_IsEurope() )
if (1 == flag)
{
isHackShieldEnable = true;
}
}
TOKEN("hackshield_first_check_time")
{
int secs = 30;
str_to_number(secs, value_string);
HackShield_FirstCheckWaitTime = passes_per_sec * secs;
}
TOKEN("hackshield_check_cycle_time")
{
int secs = 180;
str_to_number(secs, value_string);
HackShield_CheckCycleTime = passes_per_sec * secs;
}
TOKEN("xtrap_enable")
{
int flag = 0;
str_to_number(flag, value_string);
if (1 == flag )
{
bXTrapEnabled = true;
}
}
TOKEN("pk_protect_level")
{
str_to_number(PK_PROTECT_LEVEL, value_string);
@ -1120,12 +1073,6 @@ void config_init(const string& st_localeServiceName)
continue;
}
TOKEN("server_key")
{
CheckServer::AddServerKey(value_string);
continue;
}
}
if (g_setQuestObjectDir.empty())

View File

@ -107,11 +107,6 @@ extern bool g_noticeBattleZone; //
extern DWORD g_GoldDropTimeLimitValue;
extern bool isHackShieldEnable;
extern int HackShield_FirstCheckWaitTime;
extern int HackShield_CheckCycleTime;
extern bool bXTrapEnabled;
extern int gPlayerMaxLevel;
extern bool g_BlockCharCreation;

View File

@ -78,8 +78,8 @@ struct SItemNameAndLevel
// <20>ڷᱸ<DAB7><E1B1B8><EFBFBD><EFBFBD> <20>̷<EFBFBD><CCB7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef std::vector<SCubeMaterialInfo> TCubeResultList;
typedef boost::unordered_map<DWORD, TCubeResultList> TCubeMapByNPC; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NPC<50><43><EFBFBD><EFBFBD> <20><20><> <20><><EFBFBD><EFBFBD> <20><> <20>ְ<EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD>...
typedef boost::unordered_map<DWORD, std::string> TCubeResultInfoTextByNPC; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NPC<50><43><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
typedef std::unordered_map<DWORD, TCubeResultList> TCubeMapByNPC; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NPC<50><43><EFBFBD><EFBFBD> <20><20><> <20><><EFBFBD><EFBFBD> <20><> <20>ְ<EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD>...
typedef std::unordered_map<DWORD, std::string> TCubeResultInfoTextByNPC; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NPC<50><43><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
TCubeMapByNPC cube_info_map;
TCubeResultInfoTextByNPC cube_result_info_map_by_npc; // <20><><EFBFBD>̹<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ű<EFBFBD><C5B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -872,7 +872,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID);
std::auto_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) );
std::unique_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) );
}
TAccountTable & r = d->GetAccountTable();
@ -1104,7 +1104,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID);
std::auto_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) );
std::unique_ptr<SQLMsg> msg( DBManager::instance().DirectQuery(szQuery) );
}
TAccountTable & r = d->GetAccountTable();

View File

@ -12,13 +12,8 @@
#include <iostream>
#include <fstream>
#ifdef __GNUC__
#include <tr1/unordered_map>
#define TR1_NS std::tr1
#else
#include <boost/unordered_map.hpp>
#define TR1_NS boost
#endif
#include <unordered_map>
#define std std
#define DBGALLOC_LOG_FILENAME "dbgalloc.log"
#define DBGALLOC_REPORT_FILENAME "dbgalloc_report.log"
@ -308,7 +303,7 @@ private:
}
#endif
typedef TR1_NS::unordered_map<void*, AllocTag> AllocMapType;
typedef std::unordered_map<void*, AllocTag> AllocMapType;
Detail detail_;
AllocMapType alloc_map_;

View File

@ -16,7 +16,6 @@
#include "guild_manager.h"
#include "TrafficProfiler.h"
#include "locale_service.h"
#include "HackShield.h"
#include "log.h"
extern int max_bytes_written;
@ -94,7 +93,6 @@ void DESC::Initialize()
m_bCRCMagicCubeIdx = 0;
m_dwProcCRC = 0;
m_dwFileCRC = 0;
m_bHackCRCQuery = 0;
m_dwBillingExpireSecond = 0;
@ -199,16 +197,6 @@ EVENTFUNC(ping_event)
desc->SetPong(false);
}
#ifdef ENABLE_LIMIT_TIME
if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME)
{
extern void ClearAdminPages();
ClearAdminPages();
extern g_bShutdown;
g_bShutdown = true;
}
#endif
desc->SendHandshake(get_dword_time(), 0);
return (ping_event_second_cycle);

View File

@ -247,7 +247,6 @@ class DESC
BYTE m_bCRCMagicCubeIdx;
DWORD m_dwProcCRC;
DWORD m_dwFileCRC;
bool m_bHackCRCQuery;
DWORD m_dwBillingExpireSecond;
std::string m_stClientVersion;

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_GAME_DESC_MANAGER_H__
#define __INC_METIN_II_GAME_DESC_MANAGER_H__
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <common/stl.h>
#include <common/length.h>
@ -13,12 +13,12 @@ class CClientPackageCryptInfo;
class DESC_MANAGER : public singleton<DESC_MANAGER>
{
public:
typedef TR1_NS::unordered_set<LPDESC> DESC_SET;
typedef TR1_NS::unordered_set<LPCLIENT_DESC> CLIENT_DESC_SET;
typedef std::unordered_set<LPDESC> DESC_SET;
typedef std::unordered_set<LPCLIENT_DESC> CLIENT_DESC_SET;
typedef std::map<int, LPDESC> DESC_HANDLE_MAP;
typedef std::map<DWORD, LPDESC> DESC_HANDSHAKE_MAP;
typedef std::map<DWORD, LPDESC> DESC_ACCOUNTID_MAP;
typedef boost::unordered_map<std::string, LPDESC> DESC_LOGINNAME_MAP;
typedef std::unordered_map<std::string, LPDESC> DESC_LOGINNAME_MAP;
typedef std::map<DWORD, DWORD> DESC_HANDLE_RANDOM_KEY_MAP;
public:

View File

@ -7,7 +7,7 @@ class CParty;
class CDungeon
{
typedef TR1_NS::unordered_map<LPPARTY, int> TPartyMap;
typedef std::unordered_map<LPPARTY, int> TPartyMap;
typedef std::map<std::string, LPCHARACTER> TUniqueMobMap;
public:

View File

@ -6,7 +6,7 @@ class SECTREE;
class CEntity
{
public:
typedef TR1_NS::unordered_map<LPENTITY, int> ENTITY_MAP;
typedef std::unordered_map<LPENTITY, int> ENTITY_MAP;
public:
CEntity();

View File

@ -5,10 +5,10 @@
#ifdef __GNUC__
#include <tr1/unordered_map>
#define TR1_NS std::tr1
#define std std::tr1
#else
#include <boost/unordered_map.hpp>
#define TR1_NS boost
#include <unordered_map>
#define std boost
#endif
// Allocator implementation detail with simple FIFO grow-only pool.
@ -70,8 +70,8 @@ private:
}
typedef std::deque<void*> PoolType;
typedef TR1_NS::unordered_map<size_t, PoolType> PoolMapType;
typedef TR1_NS::unordered_map<void*, size_t> AllocMapType;
typedef std::unordered_map<size_t, PoolType> PoolMapType;
typedef std::unordered_map<void*, size_t> AllocMapType;
static const size_t kWatermark = 4; // FIFO enforcement level

View File

@ -72,7 +72,7 @@ CGuild::CGuild(TGuildCreateParameter & cp)
m_data.grade_array[i].auth_flag = 0;
}
std::auto_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery(
std::unique_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery(
"INSERT INTO guild%s(name, master, sp, level, exp, skill_point, skill) "
"VALUES('%s', %u, 1000, 1, 0, 0, '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0')",
get_table_postfix(), m_data.name, m_data.master_pid));
@ -1052,7 +1052,7 @@ void CGuild::RefreshCommentForce(DWORD player_id)
return;
}
std::auto_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery("SELECT id, name, content FROM guild_comment%s WHERE guild_id = %u ORDER BY notice DESC, id DESC LIMIT %d", get_table_postfix(), m_data.guild_id, GUILD_COMMENT_MAX_COUNT));
std::unique_ptr<SQLMsg> pmsg (DBManager::instance().DirectQuery("SELECT id, name, content FROM guild_comment%s WHERE guild_id = %u ORDER BY notice DESC, id DESC LIMIT %d", get_table_postfix(), m_data.guild_id, GUILD_COMMENT_MAX_COUNT));
TPacketGCGuild pack;
pack.header = HEADER_GC_GUILD;
@ -2090,7 +2090,7 @@ CGuild::GuildJoinErrCode CGuild::VerifyGuildJoinableCondition( const LPCHARACTER
}
else if ( LC_IsBrazil() == true )
{
std::auto_ptr<SQLMsg> pMsg( DBManager::instance().DirectQuery("SELECT value FROM guild_invite_limit WHERE id=%d", GetID()) );
std::unique_ptr<SQLMsg> pMsg( DBManager::instance().DirectQuery("SELECT value FROM guild_invite_limit WHERE id=%d", GetID()) );
if ( pMsg->Get()->uiNumRows > 0 )
{

View File

@ -81,7 +81,7 @@ DWORD CGuildManager::CreateGuild(TGuildCreateParameter& gcp)
return 0;
}
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM guild%s WHERE name = '%s'",
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM guild%s WHERE name = '%s'",
get_table_postfix(), gcp.name));
if (pmsg->Get()->uiNumRows > 0)
@ -205,7 +205,7 @@ void CGuildManager::Initialize()
return;
}
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM guild%s", get_table_postfix()));
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM guild%s", get_table_postfix()));
std::vector<DWORD> vecGuildID;
vecGuildID.reserve(pmsg->Get()->uiNumRows);

View File

@ -17,11 +17,6 @@
#include "priv_manager.h"
#include "castle.h"
#include "dev_log.h"
#include "HackShield_Impl.h"
#ifndef __WIN32__
#include "limit_time.h"
#endif
extern time_t get_global_time();
extern bool g_bNoPasspod;
@ -180,17 +175,6 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes,
void CInputProcessor::Pong(LPDESC d)
{
d->SetPong(true);
extern bool Metin2Server_IsInvalid();
#ifdef ENABLE_LIMIT_TIME
if (Metin2Server_IsInvalid())
{
extern bool g_bShutdown;
g_bShutdown = true;
ClearAdminPages();
}
#endif
}
void CInputProcessor::Handshake(LPDESC d, const char * c_pData)

View File

@ -152,7 +152,6 @@ class CInputMain : public CInputProcessor
void Fishing(LPCHARACTER ch, const char* c_pData);
void ItemGive(LPCHARACTER ch, const char* c_pData);
void Hack(LPCHARACTER ch, const char * c_pData);
int MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes);
void Refine(LPCHARACTER ch, const char* c_pData);

View File

@ -11,10 +11,6 @@
#include "auth_brazil.h"
#include "db.h"
#ifndef __WIN32__
#include "limit_time.h"
#endif
extern time_t get_global_time();
extern int openid_server;
@ -109,17 +105,6 @@ CInputAuth::CInputAuth()
void CInputAuth::Login(LPDESC d, const char * c_pData)
{
extern bool Metin2Server_IsInvalid();
#ifdef ENABLE_LIMIT_TIME
if (Metin2Server_IsInvalid())
{
extern void ClearAdminPages();
ClearAdminPages();
exit(1);
return;
}
#endif
TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) c_pData;
if (!g_bAuthServer)
@ -240,17 +225,6 @@ void CInputAuth::Login(LPDESC d, const char * c_pData)
void CInputAuth::LoginOpenID(LPDESC d, const char * c_pData)
{
extern bool Metin2Server_IsInvalid();
#ifdef ENABLE_LIMIT_TIME
if (Metin2Server_IsInvalid())
{
extern void ClearAdminPages();
ClearAdminPages();
exit(1);
return;
}
#endif
//OpenID test code.
TPacketCGLogin5 *tempInfo1 = (TPacketCGLogin5 *)c_pData;

View File

@ -44,8 +44,6 @@
#include "gm.h"
#include "panama.h"
#include "map_location.h"
#include "HackShield.h"
#include "XTrapManager.h"
#include "DragonSoul.h"
@ -477,20 +475,6 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data)
ch->GetGMLevel());
ch->QuerySafeboxSize();
if (isHackShieldEnable)
{
if (! CHackShieldManager::instance().CreateClientHandle(ch->GetPlayerID()))
{
d->SetPhase(PHASE_CLOSE);
}
else
{
ch->StartHackShieldCheckCycle( HackShield_CheckCycleTime );
}
}
CXTrapManager::instance().CreateClientSession( ch );
}
void CInputDB::Boot(const char* data)
@ -1995,7 +1979,7 @@ void CInputDB::VCard(const char * c_pData)
sys_log(0, "VCARD: %u %s %s %s %s", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount);
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT sell_account, buy_account, time FROM vcard WHERE id=%u", p->dwID));
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT sell_account, buy_account, time FROM vcard WHERE id=%u", p->dwID));
if (pmsg->Get()->uiNumRows != 1)
{
sys_log(0, "VCARD_FAIL: no data");
@ -2025,7 +2009,7 @@ void CInputDB::VCard(const char * c_pData)
return;
}
std::auto_ptr<SQLMsg> pmsg1(DBManager::instance().DirectQuery("UPDATE GameTime SET LimitTime=LimitTime+%d WHERE UserID='%s'", time, p->szBuyAccount));
std::unique_ptr<SQLMsg> pmsg1(DBManager::instance().DirectQuery("UPDATE GameTime SET LimitTime=LimitTime+%d WHERE UserID='%s'", time, p->szBuyAccount));
if (pmsg1->Get()->uiAffectedRows == 0 || pmsg1->Get()->uiAffectedRows == (uint32_t)-1)
{
@ -2033,7 +2017,7 @@ void CInputDB::VCard(const char * c_pData)
return;
}
std::auto_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery("UPDATE vcard,GameTime SET sell_pid='%s', buy_pid='%s', buy_account='%s', sell_time=NOW(), new_time=GameTime.LimitTime WHERE vcard.id=%u AND GameTime.UserID='%s'", p->szSellCharacter, p->szBuyCharacter, p->szBuyAccount, p->dwID, p->szBuyAccount));
std::unique_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery("UPDATE vcard,GameTime SET sell_pid='%s', buy_pid='%s', buy_account='%s', sell_time=NOW(), new_time=GameTime.LimitTime WHERE vcard.id=%u AND GameTime.UserID='%s'", p->szSellCharacter, p->szBuyCharacter, p->szBuyAccount, p->dwID, p->szBuyAccount));
if (pmsg2->Get()->uiAffectedRows == 0 || pmsg2->Get()->uiAffectedRows == (uint32_t)-1)
{
@ -2671,11 +2655,6 @@ void CInputDB::DetailLog(const TPacketNeedLoginLogInfo* info)
if (NULL != pChar)
{
LogManager::instance().DetailLoginLog(true, pChar);
if (isHackShieldEnable)
{
pChar->StartHackShieldCheckCycle( HackShield_FirstCheckWaitTime );
}
}
}
}

View File

@ -30,8 +30,6 @@
#include "log.h"
#include "horsename_manager.h"
#include "MarkManager.h"
#include "HackShield.h"
#include "XTrapManager.h"
static void _send_bonus_info(LPCHARACTER ch)
{
@ -1083,9 +1081,6 @@ int CInputLogin::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
break;
/////////////////////////////////////
case HEADER_CG_HACK:
break;
case HEADER_CG_CHANGE_NAME:
ChangeName(d, c_pData);
break;
@ -1098,20 +1093,6 @@ int CInputLogin::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
Version(d->GetCharacter(), c_pData);
break;
case HEADER_CG_HS_ACK:
if (isHackShieldEnable)
{
CHackShieldManager::instance().VerifyAck(d->GetCharacter(), c_pData);
}
break;
case HEADER_CG_XTRAP_ACK:
{
TPacketXTrapCSVerify* p = reinterpret_cast<TPacketXTrapCSVerify*>((void*)c_pData);
CXTrapManager::instance().Verify_CSStep3(d->GetCharacter(), p->bPacketData);
}
break;
default:
sys_err("login phase does not handle this packet! header %d", bHeader);
//d->SetPhase(PHASE_CLOSE);

View File

@ -38,8 +38,6 @@
#include "motion.h"
#include "OXEvent.h"
#include "locale_service.h"
#include "HackShield.h"
#include "XTrapManager.h"
#include "DragonSoul.h"
extern void SendShout(const char * szText, BYTE bEmpire);
@ -88,7 +86,7 @@ EVENTINFO(spam_event_info)
}
};
typedef boost::unordered_map<std::string, std::pair<unsigned int, LPEVENT> > spam_score_of_ip_t;
typedef std::unordered_map<std::string, std::pair<unsigned int, LPEVENT> > spam_score_of_ip_t;
spam_score_of_ip_t spam_score_of_ip;
EVENTFUNC(block_chat_by_ip_event)
@ -567,12 +565,9 @@ struct FEmpireChatPacket
else
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٸ<EFBFBD><D9B8><EFBFBD> <20>Ź<EFBFBD> <20>ؾ<EFBFBD><D8BE>մϴ<D5B4>
size_t len = strncpy(converted_msg, orig_msg, sizeof(converted_msg));
strncpy(converted_msg, orig_msg, sizeof(converted_msg));
if (len >= sizeof(converted_msg))
len = sizeof(converted_msg) - 1;
ConvertEmpireText(bEmpire, converted_msg + namelen, len - namelen, 10 + 2 * d->GetCharacter()->GetSkillPower(SKILL_LANGUAGE1 + bEmpire - 1));
ConvertEmpireText(bEmpire, converted_msg + namelen, sizeof(converted_msg) - namelen, 10 + 2 * d->GetCharacter()->GetSkillPower(SKILL_LANGUAGE1 + bEmpire - 1));
d->Packet(converted_msg, orig_len);
}
}
@ -2913,19 +2908,6 @@ void CInputMain::ItemGive(LPCHARACTER ch, const char* c_pData)
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>dz<EFBFBD><C7B3><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
void CInputMain::Hack(LPCHARACTER ch, const char * c_pData)
{
TPacketCGHack * p = (TPacketCGHack *) c_pData;
char buf[sizeof(p->szBuf)];
strncpy(buf, p->szBuf, sizeof(buf));
sys_err("HACK_DETECT: %s %s", ch->GetName(), buf);
// <20><><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD>̾<EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><> <20><>Ŷ<EFBFBD><C5B6> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
ch->GetDesc()->SetPhase(PHASE_CLOSE);
}
int CInputMain::MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes)
{
TPacketCGMyShop * p = (TPacketCGMyShop *) c_pData;
@ -3276,10 +3258,6 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
Fishing(ch, c_pData);
break;
case HEADER_CG_HACK:
Hack(ch, c_pData);
break;
case HEADER_CG_MYSHOP:
if ((iExtraLen = MyShop(ch, c_pData, m_iBufferLeft)) < 0)
return -1;
@ -3293,19 +3271,6 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
Version(ch, c_pData);
break;
case HEADER_CG_HS_ACK:
if (isHackShieldEnable)
{
CHackShieldManager::instance().VerifyAck(d->GetCharacter(), c_pData);
}
break;
case HEADER_CG_XTRAP_ACK:
{
TPacketXTrapCSVerify* p = reinterpret_cast<TPacketXTrapCSVerify*>((void*)c_pData);
CXTrapManager::instance().Verify_CSStep3(d->GetCharacter(), p->bPacketData);
}
break;
case HEADER_CG_DRAGON_SOUL_REFINE:
{
TPacketCGDragonSoulRefine* p = reinterpret_cast <TPacketCGDragonSoulRefine*>((void*)c_pData);
@ -3371,10 +3336,6 @@ int CInputDead::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
break;
case HEADER_CG_HACK:
Hack(ch, c_pData);
break;
default:
return (0);
}

View File

@ -49,7 +49,7 @@ void ITEM_MANAGER::Destroy()
void ITEM_MANAGER::GracefulShutdown()
{
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin();
std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin();
while (it != m_set_pkItemForDelayedSave.end())
SaveSingleItem(*(it++));
@ -424,7 +424,7 @@ void ITEM_MANAGER::DelayedSave(LPITEM item)
void ITEM_MANAGER::FlushDelayedSave(LPITEM item)
{
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item);
std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item);
if (it == m_set_pkItemForDelayedSave.end())
{
@ -469,8 +469,8 @@ void ITEM_MANAGER::SaveSingleItem(LPITEM item)
void ITEM_MANAGER::Update()
{
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin();
TR1_NS::unordered_set<LPITEM>::iterator this_it;
std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.begin();
std::unordered_set<LPITEM>::iterator this_it;
while (it != m_set_pkItemForDelayedSave.end())
{
@ -540,7 +540,7 @@ void ITEM_MANAGER::DestroyItem(LPITEM item, const char* file, size_t line)
}
}
TR1_NS::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item);
std::unordered_set<LPITEM>::iterator it = m_set_pkItemForDelayedSave.find(item);
if (it != m_set_pkItemForDelayedSave.end())
m_set_pkItemForDelayedSave.erase(it);

View File

@ -427,7 +427,7 @@ class ITEM_MANAGER : public singleton<ITEM_MANAGER>
TItemIDRangeTable m_ItemIDRange;
TItemIDRangeTable m_ItemIDSpareRange;
TR1_NS::unordered_set<LPITEM> m_set_pkItemForDelayedSave;
std::unordered_set<LPITEM> m_set_pkItemForDelayedSave;
std::map<DWORD, LPITEM> m_map_pkItemByID;
std::map<DWORD, DWORD> m_map_dwEtcItemDropProb;
std::map<DWORD, CDropItemGroup*> m_map_pkDropItemGroup;

View File

@ -1,8 +0,0 @@
#ifndef __LIMIT_TIME__
#define __LIMIT_TIME__
#define ENABLE_LIMIT_TIME
#define GLOBAL_LIMIT_TIME 1409996783UL // Sat Sep 6 18:46:23 2014
#define TIME_OVER_PONG_DOWN_RATE 50000
#define TIME_OVER_LOGIN_DOWN_RATE 10000
#endif

View File

@ -1,7 +1,7 @@
#ifndef __INC_LOG_MANAGER_H__
#define __INC_LOG_MANAGER_H__
#include <libsql/include/AsyncSQL.h>
#include <libsql/include/CAsyncSQL.h>
#include "any_function.h"
enum GOLDBAR_HOW

View File

@ -1,7 +1,7 @@
#ifndef __INC_LZO_MANAGER_H
#define __INC_LZO_MANAGER_H
#include "minilzo.h"
#include <lzo/lzo1x.h>
class LZOManager : public singleton<LZOManager>
{

View File

@ -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()) {

View File

@ -129,7 +129,7 @@ namespace marriage
Func for_each_wedding(Func f);
private:
TR1_NS::unordered_set<TMarriage*> m_Marriages;
std::unordered_set<TMarriage*> m_Marriages;
std::map<DWORD, TMarriage *> m_MarriageByPID;
std::set<std::pair<DWORD, DWORD> > m_setWedding;
};

View File

@ -42,7 +42,7 @@ bool EncodeMatrix(const char* szsrc, const char* szpwd, char* lpdes, const unsig
char dc = sc ^ pc;
char szhex[3];
snprintf(szhex, sizeof(szhex), "%02X", dc);
strlcat(lpdes, szhex, usize);
strncat(lpdes, szhex, usize);
}
return (i == nlen) ? true : false;
@ -148,7 +148,7 @@ void GetRightAnswer(const unsigned long rows, const unsigned long cols, const ch
{
char sztemp[3] = { 0, 0, 0 };
memcpy(sztemp, (char*)(pmatrix + (ROW(rows, i) * MAX_COLS + COL(cols, i))), 2);
strlcat(answer, sztemp, nsize);
strncat(answer, sztemp, nsize);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +0,0 @@
/* minilzo.h -- mini subset of the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The LZO library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the LZO library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
/*
* NOTE:
* the full LZO package can be found at
* http://www.oberhumer.com/opensource/lzo/
*/
#ifndef __MINILZO_H
#define __MINILZO_H
#define MINILZO_VERSION 0x1080
#ifdef __LZOCONF_H
# error "you cannot use both LZO and miniLZO"
#endif
#undef LZO_HAVE_CONFIG_H
#include "lzo/lzoconf.h"
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
# error "version mismatch in header files"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
//
************************************************************************/
/* Memory required for the wrkmem parameter.
* When the required size is 0, you can also pass a NULL pointer.
*/
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t))
#define LZO1X_MEM_DECOMPRESS (0)
/* compression */
LZO_EXTERN(int)
lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
/* decompression */
LZO_EXTERN(int)
lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );
/* safe decompression with overrun testing */
LZO_EXTERN(int)
lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* already included */

View File

@ -2,12 +2,12 @@
#ifndef OVER_9_REFINE_MANAGER_H_
#define OVER_9_REFINE_MANAGER_H_
#include <boost/unordered_map.hpp>
#include <unordered_map>
class COver9RefineManager : public singleton<COver9RefineManager>
{
private :
typedef boost::unordered_map<DWORD, DWORD> OVER9ITEM_MAP;
typedef std::unordered_map<DWORD, DWORD> OVER9ITEM_MAP;
OVER9ITEM_MAP m_mapItem;
public :

View File

@ -53,7 +53,7 @@ void P2P_MANAGER::Boot(LPDESC d)
void P2P_MANAGER::FlushOutput()
{
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
while (it != m_set_pkPeers.end())
{
@ -91,7 +91,7 @@ void P2P_MANAGER::RegisterConnector(LPDESC d)
void P2P_MANAGER::UnregisterConnector(LPDESC d)
{
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.find(d);
std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.find(d);
if (it != m_set_pkPeers.end())
{
@ -117,7 +117,7 @@ void P2P_MANAGER::EraseUserByDesc(LPDESC d)
void P2P_MANAGER::Send(const void * c_pvData, int iSize, LPDESC except)
{
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
while (it != m_set_pkPeers.end())
{
@ -271,7 +271,7 @@ int P2P_MANAGER::GetDescCount()
void P2P_MANAGER::GetP2PHostNames(std::string& hostNames)
{
TR1_NS::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
std::unordered_set<LPDESC>::iterator it = m_set_pkPeers.begin();
std::ostringstream oss(std::ostringstream::out);

View File

@ -2,7 +2,7 @@
#ifndef P2P_MANAGER_H_
#define P2P_MANAGER_H_
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include "input.h"
#include <common/stl.h>
@ -57,10 +57,10 @@ class P2P_MANAGER : public singleton<P2P_MANAGER>
CInputProcessor * m_pkInputProcessor;
int m_iHandleCount;
typedef boost::unordered_map<std::string, CCI *, stringhash> TCCIMap;
typedef boost::unordered_map<DWORD, CCI*> TPIDCCIMap;
typedef std::unordered_map<std::string, CCI *, stringhash> TCCIMap;
typedef std::unordered_map<DWORD, CCI*> TPIDCCIMap;
TR1_NS::unordered_set<LPDESC> m_set_pkPeers;
std::unordered_set<LPDESC> m_set_pkPeers;
TCCIMap m_map_pkCCI;
TPIDCCIMap m_map_dwPID_pkCCI;
int m_aiEmpireUserCount[EMPIRE_MAX_NUM];

View File

@ -79,7 +79,6 @@ enum
HEADER_CG_MARK_UPLOAD = 102,
HEADER_CG_MARK_IDXLIST = 104,
HEADER_CG_HACK = 105,
HEADER_CG_CHANGE_NAME = 106,
HEADER_CG_LOGIN2 = 109,
HEADER_CG_DUNGEON = 110,
@ -104,8 +103,6 @@ enum
//enum<75><6D> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD><CFB4><EFBFBD>. <20>ƴ<EFBFBD> namepsace<63><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD><CFB4><EFBFBD>..
//<2F><><EFBFBD><EFBFBD> packet generator<6F><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>. <20>̷<EFBFBD> <20><>XX
//<2F>̷<EFBFBD><CCB7>ٰ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> å<><C3A5><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>???
HEADER_CG_HS_ACK = 203,
HEADER_CG_XTRAP_ACK = 204,
HEADER_CG_DRAGON_SOUL_REFINE = 205,
HEADER_CG_STATE_CHECKER = 206,
@ -288,9 +285,6 @@ enum
HEADER_GC_REQUEST_PASSPOD = 202,
HEADER_GC_REQUEST_PASSPOD_FAILED = 203,
HEADER_GC_HS_REQUEST = 204,
HEADER_GC_XTRAP_CS1_REQUEST = 205,
HEADER_GC_SPECIFIC_EFFECT = 208,
HEADER_GC_DRAGON_SOUL_REFINE = 209,
@ -1895,12 +1889,6 @@ typedef struct command_give_item
BYTE byItemCount;
} TPacketCGGiveItem;
typedef struct SPacketCGHack
{
BYTE bHeader;
char szBuf[255 + 1];
} TPacketCGHack;
// SubHeader - Dungeon
enum
{

View File

@ -2,8 +2,6 @@
#include <common/stl.h>
#include "constants.h"
#include "packet_info.h"
#include "HackShield_Impl.h"
#include "XTrapManager.h"
CPacketInfo::CPacketInfo()
: m_pCurrentPacket(NULL), m_dwStartTime(0)
@ -210,7 +208,6 @@ CPacketInfoCG::CPacketInfoCG()
Set(HEADER_CG_FISHING, sizeof(TPacketCGFishing), "Fishing", true);
Set(HEADER_CG_ITEM_GIVE, sizeof(TPacketCGGiveItem), "ItemGive", true);
Set(HEADER_CG_HACK, sizeof(TPacketCGHack), "Hack", true);
Set(HEADER_CG_MYSHOP, sizeof(TPacketCGMyShop), "MyShop", true);
Set(HEADER_CG_REFINE, sizeof(TPacketCGRefine), "Refine", true);
@ -224,8 +221,6 @@ CPacketInfoCG::CPacketInfoCG()
Set(HEADER_CG_SCRIPT_SELECT_ITEM, sizeof(TPacketCGScriptSelectItem), "ScriptSelectItem", true);
Set(HEADER_CG_PASSPOD_ANSWER, sizeof(TPacketCGPasspod), "PasspodAnswer", true);
Set(HEADER_CG_HS_ACK, sizeof(TPacketGCHSCheck), "HackShieldResponse", false);
Set(HEADER_CG_XTRAP_ACK, sizeof(TPacketXTrapCSVerify), "XTrapResponse", false);
Set(HEADER_CG_DRAGON_SOUL_REFINE, sizeof(TPacketCGDragonSoulRefine), "DragonSoulRefine", false);
Set(HEADER_CG_STATE_CHECKER, sizeof(BYTE), "ServerStateCheck", false);

View File

@ -51,12 +51,12 @@ int CPasspod::ConfirmPasspod( const char * account, const char * passpod )
snprintf( szRequest, sizeof(szRequest), "username=%s&systemname=%s&passpod=%s&algname=%s", account, servername, passpod, algname );
snprintf( szResult, sizeof(szResult), "POST %s%s HTTP/1.0\r\n", posspod_server, auth );
snprintf( szTmp, sizeof(szTmp), "Host: %s\r\n", "218.99.6.103" );
strlcat( szResult, szTmp, sizeof(szResult) );
strlcat( szResult, "Content-type: application/x-www-form-urlencoded\r\n", sizeof(szResult) );
strncat( szResult, szTmp, sizeof(szResult) );
strncat( szResult, "Content-type: application/x-www-form-urlencoded\r\n", sizeof(szResult) );
snprintf( szTmp, sizeof(szTmp), "Content-length: %d\r\n", strlen(szRequest));
strlcat( szResult, szTmp, sizeof(szResult) );
strlcat( szResult, "Connection: Close\r\n\r\n", sizeof(szResult) );
strlcat( szResult, szRequest, sizeof(szResult) );
strncat( szResult, szTmp, sizeof(szResult) );
strncat( szResult, "Connection: Close\r\n\r\n", sizeof(szResult) );
strncat( szResult, szRequest, sizeof(szResult) );
if ( !Connect( NULL ) )
{

View File

@ -13,7 +13,7 @@ CPolymorphUtils::CPolymorphUtils()
POLYMORPH_BONUS_TYPE CPolymorphUtils::GetBonusType(DWORD dwVnum)
{
boost::unordered_map<DWORD, DWORD>::iterator iter;
std::unordered_map<DWORD, DWORD>::iterator iter;
iter = m_mapSPDType.find(dwVnum);

View File

@ -2,7 +2,7 @@
#ifndef __POLYMORPH_UTILS__
#define __POLYMORPH_UTILS__
#include <boost/unordered_map.hpp>
#include <unordered_map>
#define POLYMORPH_SKILL_ID 129
#define POLYMORPH_BOOK_ID 50322
@ -18,9 +18,9 @@ enum POLYMORPH_BONUS_TYPE
class CPolymorphUtils : public singleton<CPolymorphUtils>
{
private :
boost::unordered_map<DWORD, DWORD> m_mapSPDType;
boost::unordered_map<DWORD, DWORD> m_mapATKType;
boost::unordered_map<DWORD, DWORD> m_mapDEFType;
std::unordered_map<DWORD, DWORD> m_mapSPDType;
std::unordered_map<DWORD, DWORD> m_mapATKType;
std::unordered_map<DWORD, DWORD> m_mapDEFType;
public :
CPolymorphUtils();

View File

@ -232,7 +232,7 @@ public:
pool->Release(p);
}
private:
typedef TR1_NS::unordered_map<size_t, Pool*> PoolMapType;
typedef std::unordered_map<size_t, Pool*> PoolMapType;
PoolMapType pools_;
};

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_GAME_PROFILER_H__
#define __INC_METIN_II_GAME_PROFILER_H__
#include <boost/unordered_map.hpp>
#include <unordered_map>
class CProfiler : public singleton<CProfiler>
{
@ -50,7 +50,7 @@ class CProfiler : public singleton<CProfiler>
}
};
typedef boost::unordered_map<std::string, TProfileAccumData> TProfileAccumDataMap;
typedef std::unordered_map<std::string, TProfileAccumData> TProfileAccumDataMap;
public:
CProfiler()

View File

@ -239,7 +239,7 @@ void CPVPManager::ConnectEx(LPCHARACTER pkChr, bool bDisconnect)
DWORD dwVID = bDisconnect ? 0 : pkChr->GetVID();
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();
std::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end())
{
@ -266,7 +266,7 @@ void CPVPManager::GiveUp(LPCHARACTER pkChr, DWORD dwKillerPID) // This method is
return;
sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID());
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();
std::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end())
{
@ -311,7 +311,7 @@ bool CPVPManager::Dead(LPCHARACTER pkChr, DWORD dwKillerPID)
bool found = false;
sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID());
TR1_NS::unordered_set<CPVP*>::iterator it2 = it->second.begin();
std::unordered_set<CPVP*>::iterator it2 = it->second.begin();
while (it2 != it->second.end())
{

View File

@ -49,7 +49,7 @@ class CPVP
class CPVPManager : public singleton<CPVPManager>
{
typedef std::map<DWORD, TR1_NS::unordered_set<CPVP*> > CPVPSetMap;
typedef std::map<DWORD, std::unordered_set<CPVP*> > CPVPSetMap;
public:
CPVPManager();

View File

@ -97,7 +97,7 @@ namespace quest
lua_pushboolean(L, false);
*/
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM land%s WHERE guild_id = %d", get_table_postfix(), (DWORD)lua_tonumber(L,1)));
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM land%s WHERE guild_id = %d", get_table_postfix(), (DWORD)lua_tonumber(L,1)));
if ( pmsg->Get()->uiNumRows > 0 )
{

View File

@ -2100,7 +2100,7 @@ teleport_area:
char szQuery[1024];
snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName);
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
if ( pmsg->Get()->uiNumRows > 0 )
{

View File

@ -1,7 +1,7 @@
#ifndef __METIN2_SERVER_QUEST_MANAGER__
#define __METIN2_SERVER_QUEST_MANAGER__
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include "questnpc.h"
@ -234,8 +234,8 @@ namespace quest
}
};
typedef boost::unordered_map<string, int, stringhash> THashMapQuestName;
typedef boost::unordered_map<unsigned int, vector<char> > THashMapQuestStartScript;
typedef std::unordered_map<string, int, stringhash> THashMapQuestName;
typedef std::unordered_map<unsigned int, vector<char> > THashMapQuestStartScript;
THashMapQuestName m_hmQuestName;
THashMapQuestStartScript m_hmQuestStartScript;

View File

@ -465,8 +465,8 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p
int maxMemSize = LZOManager::instance().GetMaxCompressedSize(sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE));
unsigned int uiSize;
unsigned int uiDestSize;
size_t uiSize;
lzo_uint uiDestSize;
#ifndef _MSC_VER
BYTE abComp[maxMemSize];

View File

@ -225,7 +225,7 @@ class SECTREE_MANAGER : public singleton<SECTREE_MANAGER>
std::map<DWORD, std::vector<npc_info> > m_mapNPCPosition;
// <Factor> Circular private map indexing
typedef TR1_NS::unordered_map<long, int> PrivateIndexMapType;
typedef std::unordered_map<long, int> PrivateIndexMapType;
PrivateIndexMapType next_private_index_map_;
};

View File

@ -68,7 +68,7 @@ class CShop
CGrid * m_pGrid;
typedef TR1_NS::unordered_map<LPCHARACTER, bool> GuestMapType;
typedef std::unordered_map<LPCHARACTER, bool> GuestMapType;
GuestMapType m_map_guest;
std::vector<SHOP_ITEM> m_itemVector; // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD>ǵ<EFBFBD>

View File

@ -1,7 +1,7 @@
#ifndef __INC_METIN_II_GAME_CSkillManager_H__
#define __INC_METIN_II_GAME_CSkillManager_H__
#include "../../libpoly/Poly.h"
#include <libpoly/include/Poly.h>
enum ESkillFlags
{

View File

@ -20,19 +20,11 @@
#include <queue>
#include <string>
#include <vector>
#include <memory>
#ifdef __GNUC__
#include <float.h>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#define TR1_NS std::tr1
#else
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#define TR1_NS boost
#define isdigit iswdigit
#define isspace iswspace
#endif
#include <unordered_map>
#include <unordered_set>
#include "typedef.h"
#include "locale.hpp"

View File

@ -245,7 +245,7 @@ void CThreeWayWar::RandomEventMapSet()
bool CThreeWayWar::IsRegisteredUser(DWORD PlayerID) const
{
boost::unordered_map<DWORD, DWORD>::const_iterator iter = RegisterUserMap_.find(PlayerID);
std::unordered_map<DWORD, DWORD>::const_iterator iter = RegisterUserMap_.find(PlayerID);
if (iter == RegisterUserMap_.end())
{

View File

@ -2,7 +2,7 @@
#ifndef THREE_WAY_WAR_EVENT_
#define THREE_WAY_WAR_EVENT_
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <common/stl.h>
@ -63,8 +63,8 @@ class CThreeWayWar : public singleton<CThreeWayWar>
std::vector<ForkedPassMapInfo> PassInfoMap_;
std::vector<ForkedSungziMapInfo> SungZiInfoMap_;
boost::unordered_map<DWORD, DWORD> RegisterUserMap_;
boost::unordered_map<DWORD, int> ReviveTokenMap_;
std::unordered_map<DWORD, DWORD> RegisterUserMap_;
std::unordered_map<DWORD, int> ReviveTokenMap_;
};
const char* GetSungziMapPath();

View File

@ -30,7 +30,7 @@ typedef CHARACTER* LPCHARACTER;
#endif
typedef std::vector<LPCHARACTER> CHARACTER_VECTOR;
typedef std::list<LPCHARACTER> CHARACTER_LIST;
typedef TR1_NS::unordered_set<LPCHARACTER> CHARACTER_SET;
typedef std::unordered_set<LPCHARACTER> CHARACTER_SET;
class CItem;
#ifdef USE_DEBUG_PTR
@ -58,7 +58,7 @@ typedef DebugPtr<CEntity> LPENTITY;
typedef CEntity* LPENTITY;
#endif
typedef std::vector<LPENTITY> ENTITY_VECTOR;
typedef TR1_NS::unordered_set<LPENTITY> ENTITY_SET;
typedef std::unordered_set<LPENTITY> ENTITY_SET;
class SECTREE;
#ifdef USE_DEBUG_PTR

View File

@ -1,16 +0,0 @@
#!/usr/local/bin/python
import time
desc = """#ifndef __LIMIT_TIME__
#define __LIMIT_TIME__
#define ENABLE_LIMIT_TIME
#define GLOBAL_LIMIT_TIME %dUL // %s
#define TIME_OVER_PONG_DOWN_RATE 50000
#define TIME_OVER_LOGIN_DOWN_RATE 10000
#endif
"""
limitTime = time.mktime(time.localtime()) + 3600 * 24 * 180 * 2
open("limit_time.h", "w").write(desc % (limitTime, time.asctime(time.localtime(limitTime))))

View File

@ -7,7 +7,7 @@ void WriteVersion()
if (fp)
{
fprintf(fp, "emulated game server revision: %s\n", __SVN_VERSION__);
fprintf(fp, "emulated game server\n");
//fprintf(fp, "%s@%s:%s\n", __USER__, __HOSTNAME__, __PWD__);
fclose(fp);
}