SamuraiHUN 1548 Posted October 31, 2021 Share Posted October 31, 2021 (edited) Hi guys, I created this topic to have a collection topic about removing unnecessary code. blocked_country_ip Spoiler Common/tables.h search this and remove: HEADER_GD_BLOCK_COUNTRY_IP = 127, // ±¤´ëżŞ IP-Block HEADER_GD_BLOCK_EXCEPTION = 128, // ±¤´ëżŞ IP-Block żążÜ HEADER_DG_BLOCK_COUNTRY_IP = 171, // ±¤´ëżŞ IP-Block HEADER_DG_BLOCK_EXCEPTION = 172, // ±¤´ëżŞ IP-Block żążÜ account search this too and remove // Block Country Ip typedef struct tBlockCountryIp { DWORD ip_from; DWORD ip_to; } TPacketBlockCountryIp; enum EBlockExceptionCommand { BLOCK_EXCEPTION_CMD_ADD = 1, BLOCK_EXCEPTION_CMD_DEL = 2, }; // Block Exception Account typedef struct tBlockException { BYTE cmd; // 1 == add, 2 == delete char login[LOGIN_MAX_LEN + 1]; }TPacketBlockException; db/src: remove this files: BlockCountry.cpp + BlockCountry.h open db/clientmanager.cpp remove this: #include "BlockCountry.h" search this and remove: case HEADER_GD_BLOCK_COUNTRY_IP: sys_log(0, "HEADER_GD_BLOCK_COUNTRY_IP received"); CBlockCountry::instance().SendBlockedCountryIp(peer); CBlockCountry::instance().SendBlockException(peer); break; case HEADER_GD_BLOCK_EXCEPTION: sys_log(0, "HEADER_GD_BLOCK_EXCEPTION received"); BlockException((TPacketBlockException*)data); break; search this and remove too: void CClientManager::BlockException(TPacketBlockException* data) { sys_log(0, "[BLOCK_EXCEPTION] CMD(%d) login(%s)", data->cmd, data->login); // save sql { char buf[1024]; switch (data->cmd) { case BLOCK_EXCEPTION_CMD_ADD: snprintf(buf, sizeof(buf), "INSERT INTO block_exception VALUES('%s')", data->login); CDBManager::instance().AsyncQuery(buf, SQL_ACCOUNT); CBlockCountry::instance().AddBlockException(data->login); break; case BLOCK_EXCEPTION_CMD_DEL: snprintf(buf, sizeof(buf), "DELETE FROM block_exception VALUES('%s')", data->login); CDBManager::instance().AsyncQuery(buf, SQL_ACCOUNT); CBlockCountry::instance().DelBlockException(data->login); break; default: return; } } for (itertype(m_peerList) it = m_peerList.begin(); it != m_peerList.end(); ++it) { CPeer* peer = *it; if (!peer->GetChannel()) continue; CBlockCountry::instance().SendBlockExceptionOne(peer, data->login, data->cmd); } } Open db/clientmanager.h search this and remove: void BlockException(TPacketBlockException* data); Open Main.cpp search this and remove: #include "BlockCountry.h" search too and remove: CBlockCountry BlockCountry; and this: BlockCountry.Load(); makefile Search this and remove too: BlockCountry.cpp open game src and remove this files: Block_Country.cpp + Block_Country.h -> cpp remove too makefile Open game/db.cpp search this and remove: void DBManager::RequestBlockException(const char* login, int cmd) { TPacketBlockException packet; packet.cmd = cmd; strlcpy(packet.login, login, sizeof(packet.login)); db_clientdesc->DBPacket(HEADER_GD_BLOCK_EXCEPTION, 0, &packet, sizeof(packet)); } open db.h and remove this: // BLOCK EXCEPTION void RequestBlockException(const char* login, int cmd); // BLOCK EXCEPTION open input.cpp and remove this: else if (!stBuf.compare(0, 15, "BLOCK_EXCEPTION")) { // BLOCK_EXCEPTION cmd(add=1, del=2) login std::istringstream is(stBuf); std::string dummy_string; std::string login_string; int cmd; is >> dummy_string >> cmd >> login_string; sys_log(0, "block_exception %s:%d", login_string.c_str(), cmd); DBManager::instance().RequestBlockException(login_string.c_str(), cmd); stResult = "BLOCK_EXCEPTION_YES"; } open input.h and remove this: void AddBlockCountryIp(TPacketBlockCountryIp* data); void BlockException(TPacketBlockException* data); open input_db and remove this: #include "block_country.h" + this: // request blocked_country_ip { db_clientdesc->DBPacket(HEADER_GD_BLOCK_COUNTRY_IP, 0, NULL, 0); dev_log(LOG_DEB0, "<sent HEADER_GD_BLOCK_COUNTRY_IP>"); } and this: case HEADER_DG_BLOCK_COUNTRY_IP: this->AddBlockCountryIp((TPacketBlockCountryIp*)c_pData); break; case HEADER_DG_BLOCK_EXCEPTION: this->BlockException((TPacketBlockException*)c_pData); break; and more this: void CInputDB::AddBlockCountryIp(TPacketBlockCountryIp* data) { add_blocked_country_ip(data); } void CInputDB::BlockException(TPacketBlockException* data) { block_exception(data); } open input_login.cpp and remove this: #include "block_country.h" + this: // is blocked ip? { dev_log(LOG_DEB0, "check_blocked_country_start"); if (!is_block_exception(login) && is_blocked_country_ip(d->GetHostName())) { sys_log(0, "BLOCK_COUNTRY_IP (%s)", d->GetHostName()); d->SetPhase(PHASE_CLOSE); return; } dev_log(LOG_DEB0, "check_blocked_country_end"); } open packet.h and remove this: HEADER_GG_BLOCK_EXCEPTION = 24, Limit_time Spoiler open db/clientmanagerlogin.cpp search this and remove: #ifdef ENABLE_LIMIT_TIME static int s_updateCount = 0; static int s_curTime = time(0); if (s_updateCount > 100) { s_curTime = time(0); s_updateCount = 0; } ++s_updateCount; if (s_curTime >= GLOBAL_LIMIT_TIME) { sys_err("Server life time expired."); exit(0); return; } #endif open game/desc.cpp and remove this: #ifdef ENABLE_LIMIT_TIME if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME) { extern void ClearAdminPages(); ClearAdminPages(); extern g_bShutdown; g_bShutdown = true; } #endif open game/input.cpp search this + remove: #ifndef __WIN32__ #include "limit_time.h" #endif and this: #ifdef ENABLE_LIMIT_TIME if (Metin2Server_IsInvalid()) { extern bool g_bShutdown; g_bShutdown = true; ClearAdminPages(); } #endif open input_auth.cpp search this and remove: #ifndef __WIN32__ #include "limit_time.h" #endif + #ifdef ENABLE_LIMIT_TIME extern bool Metin2Server_IsInvalid(); if (Metin2Server_IsInvalid()) { extern void ClearAdminPages(); ClearAdminPages(); exit(1); return; } #endif and + this: #ifdef ENABLE_LIMIT_TIME extern bool Metin2Server_IsInvalid(); if (Metin2Server_IsInvalid()) { extern void ClearAdminPages(); ClearAdminPages(); exit(1); return; } #endif delete two file from game folder (limit_time.h + update_limit_time.py) Open game/main.cpp search this and remove: #ifndef __WIN32__ #include "limit_time.h" #endif + this: #ifdef ENABLE_LIMIT_TIME if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME) { g_bShutdown = true; } #endif and YEAH this too: #ifdef ENABLE_LIMIT_TIME if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME) { return 0; } #endif open game/makefile and remove this: limit_time: @echo update limit time @python update_limit_time.py More removed code: Spoiler This is the hidden content, please Sign In or Sign Up or This is the hidden content, please Sign In or Sign Up Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 247 2 7 1 2 1 2 1 66 7 115 Link to comment Share on other sites More sharing options...
DrTurk 133 Posted October 31, 2021 Share Posted October 31, 2021 better use spoilers for each removed system Link to comment Share on other sites More sharing options...
PetePeter 36 Posted October 31, 2021 Share Posted October 31, 2021 Or just comment the define xD //#define ENABLE_LIMIT_TIME 1 Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted October 31, 2021 Author Share Posted October 31, 2021 Just now, PetePeter said: Or just comment the define xD //#define ENABLE_LIMIT_TIME Why be there unnecessarily? Link to comment Share on other sites More sharing options...
PetePeter 36 Posted October 31, 2021 Share Posted October 31, 2021 12 minutes ago, SamuraiHUN said: Why be there unnecessarily? If the define is commented the code is not included on the build, so i don't understand the problem Link to comment Share on other sites More sharing options...
Active Member Thorek 283 Posted October 31, 2021 Active Member Share Posted October 31, 2021 (edited) It's 2021 Edited October 31, 2021 by Thorek 1 1 Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted November 1, 2021 Author Share Posted November 1, 2021 7 hours ago, PetePeter said: If the define is commented the code is not included on the build, so i don't understand the problem I think we don't need talk anymore. 1 1 Link to comment Share on other sites More sharing options...
Hik 108 Posted November 2, 2021 Share Posted November 2, 2021 I think you can also delete passpod, openid, teen packet, vcard, aucion, login_sim etc. 1 Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted November 2, 2021 Author Share Posted November 2, 2021 (edited) 1 hour ago, Hik said: I think you can also delete passpod, openid, teen packet, vcard, aucion, login_sim etc. Yes i make tutorial, but i upload to github. I need 2 day to write tutorial. This is the hidden content, please Sign In or Sign Up #Included passpod + openid Edited November 2, 2021 by SamuraiHUN 62 1 1 1 1 18 2 33 Link to comment Share on other sites More sharing options...
DrTurk 133 Posted November 2, 2021 Share Posted November 2, 2021 You can remove alot of dead code, i removed all of it years ago. It takes time Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted November 2, 2021 Author Share Posted November 2, 2021 (edited) 10 minutes ago, DrTurk said: You can remove alot of dead code, i removed all of it years ago. It takes time Yes I removed too, but I think it's a good initiative for people who haven't removed it but want to. Edited November 2, 2021 by SamuraiHUN Link to comment Share on other sites More sharing options...
r00t3r 67 Posted November 2, 2021 Share Posted November 2, 2021 5 hours ago, SamuraiHUN said: Yes i make tutorial, but i upload to github. I need 2 day to write tutorial. This is the hidden content, please Sign In or Sign Up #Included passpod + openid good job bro ! 9 1 1 4 Link to comment Share on other sites More sharing options...
Premium ragem0re 155 Posted November 2, 2021 Premium Share Posted November 2, 2021 thanks for share! here a list of (for me) unnecessary code/functions/systems: Spoiler Auction Monarch Billing (GameTime) Matrix Passpod PC Bang OpenID HammerOfTor CheckAwakeness Hotbackup Speed Server China Intoxication Event / Teen Siege / Castle / Fork / Battle Arena Three Way Auth Brazil Dance Event Protect Child Lotto Roulette Highscore Panama PackageCryptInfo Block Exception Input_UDP Greet / QID_DB_STRING Mobile / SMS g_bCheckMultiHack Hack Shield XTRAP check_server limit_time 3 1 1 Link to comment Share on other sites More sharing options...
Denizeri24 35 Posted November 2, 2021 Share Posted November 2, 2021 what the fucking stupid deleted my comment without notice? 4 Link to comment Share on other sites More sharing options...
SmyleMDFK 147 Posted November 6, 2021 Share Posted November 6, 2021 This it's the goold thread! 1 https://amnesia2.com/ Link to comment Share on other sites More sharing options...
Active Member Draveniou1 716 Posted November 6, 2021 Active Member Share Posted November 6, 2021 You need to configure the buffer after these Remove unussed so that you never have a problem on your multiplayer server. Buffer 64bit = 65536 use after second 8192 If you do not set the buffer then you do not suggest these changes protocol.h search: #define DEFAULT_PACKET_BUFFER_SIZE 65536 change with : #define DEFAULT_PACKET_BUFFER_SIZE 95536 //fix 2 2 Link to comment Share on other sites More sharing options...
Management AZICKO 7345 Posted November 6, 2021 Management Share Posted November 6, 2021 On 11/2/2021 at 10:50 PM, Denizeri24 said: what the fucking stupid deleted my comment without notice? You could have copied/pasted part of your topic before redirecting to an external link 1 Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted November 10, 2021 Author Share Posted November 10, 2021 (edited) In github added new removed functions ( Billing ) today toDo: mobile | sms, matrixcard) Edited November 10, 2021 by SamuraiHUN 1 3 1 Link to comment Share on other sites More sharing options...
r00t3r 67 Posted November 10, 2021 Share Posted November 10, 2021 7 hours ago, SamuraiHUN said: In github added new removed functions ( Billing ) today toDo: mobile | sms, matrixcard) I think the part of ClientManager.cpp is not complete 1 Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted November 10, 2021 Author Share Posted November 10, 2021 (edited) @ r00t3r thank you the anwser, i now fixed the tutorial. #Update001: Added matrix_card remove #Update002: Added sms | mobile remove Edited November 10, 2021 by SamuraiHUN 1 Link to comment Share on other sites More sharing options...
r00t3r 67 Posted November 11, 2021 Share Posted November 11, 2021 (edited) 13 hours ago, SamuraiHUN said: @ r00t3r thank you the anwser, i now fixed the tutorial. #Update001: Added matrix_card remove #Update002: Added sms | mobile remove after i delete the billing i cant login in game, is blocked at " you will be connected" Edited November 11, 2021 by r00t3r Link to comment Share on other sites More sharing options...
Active Member Draveniou1 716 Posted November 11, 2021 Active Member Share Posted November 11, 2021 1 hour ago, r00t3r said: after i delete the billing i cant login in game, is blocked at " you will be connected" Remove from python and source client They are not 100% complete Send me a message to help you delete them correctly Link to comment Share on other sites More sharing options...
SamuraiHUN 1548 Posted November 11, 2021 Author Share Posted November 11, 2021 (edited) @tutorial fixed <- in db.cpp + db.h. 1 hour ago, Draveniou1 said: Remove from python and source client They are not 100% complete Send me a message to help you delete them correctly In client i didn't see definition of bill/billing. Edited November 11, 2021 by SamuraiHUN 2 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 716 Posted November 11, 2021 Active Member Share Posted November 11, 2021 1 minute ago, SamuraiHUN said: @tutorial fixed <- in db.cpp. In client i didn't see definition of bill/billing. No problem I can help you if you want everything to be easy Link to comment Share on other sites More sharing options...
r00t3r 67 Posted November 12, 2021 Share Posted November 12, 2021 On 11/10/2021 at 8:33 PM, SamuraiHUN said: @ r00t3r thank you the anwser, i now fixed the tutorial. #Update001: Added matrix_card remove #Update002: Added sms | mobile remove Good job brother! Everything is going perfectly. We are waiting for more updates! Thank you for what you do 1 Link to comment Share on other sites More sharing options...
Recommended Posts