diff --git a/src/game/HackShield.cpp b/src/game/HackShield.cpp deleted file mode 100644 index f22f042..0000000 --- a/src/game/HackShield.cpp +++ /dev/null @@ -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(const_cast(buf)); - - return impl_->VerifyAck(ch, p); -} - diff --git a/src/game/HackShield.h b/src/game/HackShield.h deleted file mode 100644 index c6a01c1..0000000 --- a/src/game/HackShield.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef HACK_SHIELD_MANAGER_H_ -#define HACK_SHIELD_MANAGER_H_ - -class CHackShieldImpl; - -class CHackShieldManager : public singleton -{ - 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_ */ - diff --git a/src/game/HackShield_Impl.cpp b/src/game/HackShield_Impl.cpp deleted file mode 100644 index 99e1c23..0000000 --- a/src/game/HackShield_Impl.cpp +++ /dev/null @@ -1,202 +0,0 @@ -#include "stdafx.h" - -#include "HackShield_Impl.h" - -#ifdef OS_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 - diff --git a/src/game/HackShield_Impl.h b/src/game/HackShield_Impl.h deleted file mode 100644 index 17ead00..0000000 --- a/src/game/HackShield_Impl.h +++ /dev/null @@ -1,51 +0,0 @@ - -#ifndef HACK_SHIELD_IMPL_H_ -#define HACK_SHIELD_IMPL_H_ - -#include - -#ifdef OS_FREEBSD -// Live build only -#define UNIX -#include -#undef UNIX -#endif - -#pragma pack(1) - -typedef struct SPacketGCHSCheck -{ - BYTE bHeader; -#ifdef OS_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 OS_FREEBSD - AHNHS_SERVER_HANDLE handle_; - - typedef std::unordered_map ClientHandleContainer; - ClientHandleContainer CliehtHandleMap_; - - typedef std::unordered_map ClientCheckContainer; - ClientCheckContainer ClientCheckMap_; -#endif -}; - -#endif /* HACK_SHIELD_IMPL_H_ */ - diff --git a/src/game/char.cpp b/src/game/char.cpp index 3a64e97..e9805f4 100644 --- a/src/game/char.cpp +++ b/src/game/char.cpp @@ -53,7 +53,6 @@ #include "gm.h" #include "map_location.h" #include "BlueDragon_Binder.h" -// #include "HackShield.h" #include "skill_power.h" #include "buff_on_attributes.h" @@ -363,9 +362,6 @@ void CHARACTER::Initialize() m_dwLastGoldDropTime = 0; - // m_HackShieldCheckEvent = NULL; - // m_HackShieldCheckMode = false; - m_bIsLoadedAffect = false; cannot_dead = false; @@ -433,14 +429,6 @@ void CHARACTER::Destroy() if (GetRider()) GetRider()->ClearHorseInfo(); - // if( IsPC() ) - // { - // if (isHackShieldEnable) - // { - // CHackShieldManager::instance().DeleteClientHandle(GetPlayerID()); - // } - // } - if (GetDesc()) { GetDesc()->BindCharacter(NULL); diff --git a/src/game/char_manager.cpp b/src/game/char_manager.cpp index 8ba84bb..aaf6e54 100644 --- a/src/game/char_manager.cpp +++ b/src/game/char_manager.cpp @@ -15,7 +15,6 @@ #include "questmanager.h" #include "questlua.h" #include "locale_service.h" -// #include "XTrapManager.h" CHARACTER_MANAGER::CHARACTER_MANAGER() : m_iVIDCount(0), diff --git a/src/game/config.cpp b/src/game/config.cpp index 1fc4264..c585cf9 100644 --- a/src/game/config.cpp +++ b/src/game/config.cpp @@ -125,12 +125,6 @@ bool LoadClientVersion(); bool g_protectNormalPlayer = false; // 범법자가 "평화모드" 인 일반유저를 공격하지 못함 bool g_noticeBattleZone = false; // 중립지대에 입장하면 안내메세지를 알려줌 -// 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; @@ -1168,49 +1162,6 @@ void config_init(const string& st_localeServiceName) str_to_number(g_server_id, value_string); continue; } - - - - // 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; - // } - // } - } if (g_setQuestObjectDir.empty()) diff --git a/src/game/config.h b/src/game/config.h index 9e53568..c1842e8 100644 --- a/src/game/config.h +++ b/src/game/config.h @@ -111,11 +111,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; diff --git a/src/game/desc.cpp b/src/game/desc.cpp index 0d3216e..c900a6b 100644 --- a/src/game/desc.cpp +++ b/src/game/desc.cpp @@ -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; diff --git a/src/game/input.cpp b/src/game/input.cpp index 950b2e5..d427a2f 100644 --- a/src/game/input.cpp +++ b/src/game/input.cpp @@ -17,7 +17,6 @@ #include "priv_manager.h" #include "castle.h" #include "dev_log.h" -// #include "HackShield_Impl.h" #ifndef OS_WINDOWS #include "limit_time.h" diff --git a/src/game/input_db.cpp b/src/game/input_db.cpp index 14d3395..0372514 100644 --- a/src/game/input_db.cpp +++ b/src/game/input_db.cpp @@ -44,7 +44,6 @@ #include "gm.h" #include "panama.h" #include "map_location.h" -// #include "HackShield.h" #include "DragonSoul.h" @@ -491,19 +490,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 ); - // } - // } - } void CInputDB::Boot(const char* data) @@ -2684,11 +2670,6 @@ void CInputDB::DetailLog(const TPacketNeedLoginLogInfo* info) if (NULL != pChar) { LogManager::instance().DetailLoginLog(true, pChar); - - // if (isHackShieldEnable) - // { - // pChar->StartHackShieldCheckCycle( HackShield_FirstCheckWaitTime ); - // } } } } diff --git a/src/game/input_login.cpp b/src/game/input_login.cpp index a5ddf3e..87bc78d 100644 --- a/src/game/input_login.cpp +++ b/src/game/input_login.cpp @@ -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) { @@ -1099,20 +1097,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((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); diff --git a/src/game/input_main.cpp b/src/game/input_main.cpp index a8d10a8..9184e5b 100644 --- a/src/game/input_main.cpp +++ b/src/game/input_main.cpp @@ -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); @@ -3309,20 +3307,6 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) case HEADER_CG_CLIENT_VERSION: 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((void*)c_pData); - // CXTrapManager::instance().Verify_CSStep3(d->GetCharacter(), p->bPacketData); - // } - // break; case HEADER_CG_DRAGON_SOUL_REFINE: { diff --git a/src/game/log.cpp b/src/game/log.cpp index ee4b074..cac369e 100644 --- a/src/game/log.cpp +++ b/src/game/log.cpp @@ -314,33 +314,3 @@ void LogManager::DragonSlayLog(DWORD dwGuildID, DWORD dwDragonVnum, DWORD dwStar dwGuildID, dwDragonVnum, dwStartTime, dwEndTime); } -// void LogManager::HackShieldLog(unsigned long ErrorCode, LPCHARACTER ch) -// { - // struct in_addr st_addr; - -// #ifndef OS_WINDOWS - // if (0 == inet_aton(ch->GetDesc()->GetHostName(), &st_addr)) -// #else - // unsigned long in_address; - // in_address = inet_addr(ch->GetDesc()->GetHostName()); - // st_addr.s_addr = in_address; - // if (INADDR_NONE == in_address) -// #endif - // { - // Query( "INSERT INTO hackshield_log(time, account_id, login, pid, name, reason, ip) " - // "VALUES(NOW(), %u, '%s', %u, '%s', %u, 0)", - // ch->GetDesc()->GetAccountTable().id, ch->GetDesc()->GetAccountTable().login, - // ch->GetPlayerID(), ch->GetName(), - // ErrorCode); - // } - // else - // { - // Query( "INSERT INTO hackshield_log(time, account_id, login, pid, name, reason, ip) " - // "VALUES(NOW(), %u, '%s', %u, '%s', %u, inet_aton('%s'))", - // ch->GetDesc()->GetAccountTable().id, ch->GetDesc()->GetAccountTable().login, - // ch->GetPlayerID(), ch->GetName(), - // ErrorCode, - // ch->GetDesc()->GetHostName()); - // } -// } - diff --git a/src/game/log.h b/src/game/log.h index 2606a47..ec1c3de 100644 --- a/src/game/log.h +++ b/src/game/log.h @@ -52,7 +52,6 @@ class LogManager : public singleton void QuestRewardLog(const char * c_pszQuestName, DWORD dwPID, DWORD dwLevel, int iValue1, int iValue2); void DetailLoginLog(bool isLogin, LPCHARACTER ch); void DragonSlayLog(DWORD dwGuildID, DWORD dwDragonVnum, DWORD dwStartTime, DWORD dwEndTime); - // void HackShieldLog(unsigned long ErrorCode, LPCHARACTER ch); private: void Query(const char * c_pszFormat, ...); diff --git a/src/game/main.cpp b/src/game/main.cpp index 8243d93..e346b0d 100644 --- a/src/game/main.cpp +++ b/src/game/main.cpp @@ -58,10 +58,8 @@ #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" #ifndef OS_WINDOWS #include "limit_time.h" @@ -507,9 +505,6 @@ int main(int argc, char **argv) CThreeWayWar threeway_war; CDragonLairManager dl_manager; - // CHackShieldManager HSManager; - // CXTrapManager XTManager; - CSpeedServerManager SSManager; DSManager dsManager; @@ -553,43 +548,6 @@ int main(int argc, char **argv) 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 (OS_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 const std::string strPackageCryptInfoDir = "package/"; if( !desc_manager.LoadClientPackageCryptInfo( strPackageCryptInfoDir.c_str() ) ) @@ -662,15 +620,6 @@ int main(int argc, char **argv) sys_log(0, " Destroying building::CManager..."); building_manager.Destroy(); - // if (!g_bAuthServer) - // { - // if (isHackShieldEnable) - // { - // sys_log(0, " Releasing HackShield manager..."); - // HSManager.Release(); - // } - // } - sys_log(0, " Flushing TrafficProfiler..."); trafficProfiler.Flush(); diff --git a/src/game/packet.h b/src/game/packet.h index 58f7465..db7e93a 100644 --- a/src/game/packet.h +++ b/src/game/packet.h @@ -104,8 +104,6 @@ enum //enum을 별도로 구별을 하던가. 아님 namepsace로 구별을 하던가.. //정말 packet generator까지는 바라지도 않는다. 이런 씨XX //이러다가 숫자 겹치면 누가 책임지는데??? - HEADER_CG_HS_ACK = 203, - HEADER_CG_XTRAP_ACK = 204, HEADER_CG_DRAGON_SOUL_REFINE = 205, HEADER_CG_STATE_CHECKER = 206, @@ -288,9 +286,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, diff --git a/src/game/packet_info.cpp b/src/game/packet_info.cpp index 5717936..1c81e4b 100644 --- a/src/game/packet_info.cpp +++ b/src/game/packet_info.cpp @@ -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) @@ -224,8 +222,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);