From 42079d56b70bbc5f3b020927bc27699b3e188cac Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 16:17:34 +0200 Subject: [PATCH 01/10] Removed hotbackup --- src/db/src/ClientManagerPlayer.cpp | 6 --- src/db/src/DBManager.h | 1 - src/db/src/HB.cpp | 86 ------------------------------ src/db/src/HB.h | 24 --------- src/db/src/Main.cpp | 57 -------------------- 5 files changed, 174 deletions(-) delete mode 100644 src/db/src/HB.cpp delete mode 100644 src/db/src/HB.h diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index 944da6e..16b7558 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -6,11 +6,8 @@ #include "Main.h" #include "QID.h" #include "ItemAwardManager.h" -#include "HB.h" #include "Cache.h" -extern bool g_bHotBackup; - extern std::string g_stLocale; extern int g_test_server; @@ -195,9 +192,6 @@ void CClientManager::PutPlayerCache(TPlayerTable * pNew) m_map_playerCache.insert(TPlayerTableCacheMap::value_type(pNew->id, c)); } - if (g_bHotBackup) - PlayerHB::instance().Put(pNew->id); - c->Put(pNew); } diff --git a/src/db/src/DBManager.h b/src/db/src/DBManager.h index f8b1d39..f9268f9 100644 --- a/src/db/src/DBManager.h +++ b/src/db/src/DBManager.h @@ -23,7 +23,6 @@ enum eSQL_SLOT SQL_PLAYER, SQL_ACCOUNT, SQL_COMMON, - SQL_HOTBACKUP, SQL_MAX_NUM, }; diff --git a/src/db/src/HB.cpp b/src/db/src/HB.cpp deleted file mode 100644 index 8e899fe..0000000 --- a/src/db/src/HB.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "stdafx.h" -#include "HB.h" -#include "Main.h" -#include "DBManager.h" - -#include - -PlayerHB::PlayerHB() -{ - m_iExpireTime = 3600; // 1 hour hotbackup default. -} - -PlayerHB::~PlayerHB() -{ -} - -bool PlayerHB::Initialize() -{ - char szQuery[128]; - snprintf(szQuery, sizeof(szQuery), "SHOW CREATE TABLE player%s", GetTablePostfix()); - - std::unique_ptr pMsg(CDBManager::instance().DirectQuery(szQuery)); - - if (pMsg->Get()->uiNumRows == 0) - return false; - - MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); - m_stCreateTableQuery = row[1]; - return true; -} - -// -// @version 05/07/05 Bang2ni - id ¿¡ ÇØ´çÇÏ´Â data °¡ ¾øÀ» ¶§ Äõ¸®ÇÏ°í data ¸¦ insert ÇÏ´ÂÄÚµå Ãß°¡. -// -void PlayerHB::Put(DWORD id) -{ - itertype(m_map_data) it = m_map_data.find(id); - - if (it == m_map_data.end()) - { - Query(id); - m_map_data.insert(std::pair< DWORD, time_t >(id, get_dword_time())); - return; - } - - if (time(0) - it->second > m_iExpireTime) - Query(id); -} - -// -// @version 05/07/05 Bang2ni - Query string ¹öÆÛ°¡ À۾Ƽ­ ´Ã·ÁÁÜ. -// -bool PlayerHB::Query(DWORD id) -{ - time_t ct = time(0); - struct tm curr_tm = *localtime(&ct); - char szTableName[64]; - snprintf(szTableName, sizeof(szTableName), "hb_%02d%02d%02d%02d_player%s", - curr_tm.tm_year - 100, curr_tm.tm_mon + 1, curr_tm.tm_mday, curr_tm.tm_hour, GetTablePostfix()); - - char szQuery[4096]; - - if (m_stTableName.compare(szTableName)) - { - char szFind[32]; - snprintf(szFind, sizeof(szFind), "CREATE TABLE `player%s`", GetTablePostfix()); - int pos = m_stCreateTableQuery.find(szFind); - - if (pos < 0) - { - SPDLOG_ERROR("cannot find {} ", szFind); - // SPDLOG_ERROR("cannot find {} in {}", szFind, m_stCreateTableQuery.c_str()); - return false; - } - - snprintf(szQuery, sizeof(szQuery), "CREATE TABLE IF NOT EXISTS %s%s", szTableName, m_stCreateTableQuery.c_str() + strlen(szFind)); - // SPDLOG_DEBUG("{}", szQuery); - std::unique_ptr pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP)); - m_stTableName = szTableName; - } - - snprintf(szQuery, sizeof(szQuery), "REPLACE INTO %s SELECT * FROM %splayer%s WHERE id=%u", m_stTableName.c_str(), GetPlayerDBName(), GetTablePostfix(), id); - CDBManager::instance().AsyncQuery(szQuery, SQL_HOTBACKUP); - return true; -} - diff --git a/src/db/src/HB.h b/src/db/src/HB.h deleted file mode 100644 index 8c5da77..0000000 --- a/src/db/src/HB.h +++ /dev/null @@ -1,24 +0,0 @@ -// vim:ts=8 sw=4 -#ifndef __INC_METIN_II_PLAYERHB_H__ -#define __INC_METIN_II_PLAYERHB_H__ - -class PlayerHB : public singleton -{ - public: - PlayerHB(); - virtual ~PlayerHB(); - - bool Initialize(); - - void Put(DWORD id); - - private: - bool Query(DWORD id); - - std::map m_map_data; - std::string m_stCreateTableQuery; - std::string m_stTableName; - int m_iExpireTime; -}; - -#endif diff --git a/src/db/src/Main.cpp b/src/db/src/Main.cpp index ac392cb..271c4ef 100644 --- a/src/db/src/Main.cpp +++ b/src/db/src/Main.cpp @@ -5,7 +5,6 @@ #include "ClientManager.h" #include "GuildManager.h" #include "ItemAwardManager.h" -#include "HB.h" #include "PrivManager.h" #include "MoneyLog.h" #include "Marriage.h" @@ -28,7 +27,6 @@ std::string g_stLocale = "euckr"; std::string g_stPlayerDBName = ""; -bool g_bHotBackup = false; BOOL g_test_server = false; //´ÜÀ§ ÃÊ @@ -70,7 +68,6 @@ int main() CConfig Config; CDBManager DBManager; CClientManager ClientManager; - PlayerHB player_hb; CGuildManager GuildManager; CPrivManager PrivManager; CMoneyLog MoneyLog; @@ -170,27 +167,8 @@ int Start() { g_stLocale = szBuf; SPDLOG_INFO("LOCALE set to {}", g_stLocale.c_str()); - - // CHINA_DISABLE_HOTBACKUP - if ("gb2312" == g_stLocale) - { - SPDLOG_INFO("CIBN_LOCALE: DISABLE_HOTBACKUP"); - g_bHotBackup = false; - } - // END_OF_CHINA_DISABLE_HOTBACKUP } - int iDisableHotBackup; - if (CConfig::instance().GetValue("DISABLE_HOTBACKUP", &iDisableHotBackup)) - { - if (iDisableHotBackup) - { - SPDLOG_INFO("CONFIG: DISABLE_HOTBACKUP"); - g_bHotBackup = false; - } - } - - if (!CConfig::instance().GetValue("TABLE_POSTFIX", szBuf, 256)) { SPDLOG_WARN("TABLE_POSTFIX not configured use default"); @@ -324,35 +302,6 @@ int Start() return false; } - if (CConfig::instance().GetValue("SQL_HOTBACKUP", line, 256)) - { - sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - SPDLOG_DEBUG("connecting to MySQL server (hotbackup)"); - - int iRetry = 5; - - do - { - if (CDBManager::instance().Connect(SQL_HOTBACKUP, szAddr, iPort, szDB, szUser, szPassword)) - { - SPDLOG_DEBUG(" OK"); - break; - } - - SPDLOG_DEBUG(" failed, retrying in 5 seconds"); - SPDLOG_ERROR(" failed, retrying in 5 seconds"); - sleep(5); - } - while (iRetry--); - - SPDLOG_INFO("Success HOTBACKUP"); - } - else - { - SPDLOG_ERROR("SQL_HOTBACKUP not configured"); - return false; - } - if (!CClientManager::instance().Initialize()) { SPDLOG_ERROR("ClientManager initialization failed"); @@ -361,12 +310,6 @@ int Start() SPDLOG_INFO("ClientManager initialization OK"); - if (!PlayerHB::instance().Initialize()) - { - SPDLOG_ERROR("cannot initialize player hotbackup"); - return false; - } - #ifndef __WIN32__ signal(SIGUSR1, emergency_sig); #endif From 00c5634c0971b67272d90dc5580c2551a12862cc Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 17:09:03 +0200 Subject: [PATCH 02/10] Removed country blocking (and exceptions) --- src/common/tables.h | 24 ---- src/db/src/BlockCountry.cpp | 214 --------------------------------- src/db/src/BlockCountry.h | 44 ------- src/db/src/ClientManager.cpp | 49 -------- src/db/src/ClientManager.h | 1 - src/db/src/Main.cpp | 3 - src/game/src/block_country.cpp | 150 ----------------------- src/game/src/block_country.h | 18 --- src/game/src/db.cpp | 9 -- src/game/src/db.h | 4 - src/game/src/input.cpp | 14 --- src/game/src/input.h | 2 - src/game/src/input_db.cpp | 24 ---- src/game/src/input_login.cpp | 15 --- src/game/src/packet.h | 1 - 15 files changed, 572 deletions(-) delete mode 100644 src/db/src/BlockCountry.cpp delete mode 100644 src/db/src/BlockCountry.h delete mode 100644 src/game/src/block_country.cpp delete mode 100644 src/game/src/block_country.h diff --git a/src/common/tables.h b/src/common/tables.h index e50b236..f604719 100644 --- a/src/common/tables.h +++ b/src/common/tables.h @@ -129,8 +129,6 @@ enum HEADER_GD_DEC_MONARCH_MONEY = 125, HEADER_GD_CHANGE_MONARCH_LORD = 126, - HEADER_GD_BLOCK_COUNTRY_IP = 127, // ±¤´ë¿ª IP-Block - HEADER_GD_BLOCK_EXCEPTION = 128, // ±¤´ë¿ª IP-Block ¿¹¿Ü HEADER_GD_REQ_CHANGE_GUILD_MASTER = 129, @@ -272,8 +270,6 @@ enum HEADER_DG_CHANGE_MONARCH_LORD_ACK = 169, HEADER_DG_UPDATE_MONARCH_INFO = 170, - HEADER_DG_BLOCK_COUNTRY_IP = 171, // ±¤´ë¿ª IP-Block - HEADER_DG_BLOCK_EXCEPTION = 172, // ±¤´ë¿ª IP-Block ¿¹¿Ü account HEADER_DG_ACK_CHANGE_GUILD_MASTER = 173, @@ -1379,26 +1375,6 @@ typedef struct tChangeMonarchLordACK char szDate[32]; } TPacketChangeMonarchLordACK; -// 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; - typedef struct tChangeGuildMaster { DWORD dwGuildID; diff --git a/src/db/src/BlockCountry.cpp b/src/db/src/BlockCountry.cpp deleted file mode 100644 index bb69e80..0000000 --- a/src/db/src/BlockCountry.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// vim:ts=4 sw=4 -/********************************************************************* - * date : 2007.05.31 - * file : BlockCountry.cpp - * author : mhh - * description : - */ - -#include "stdafx.h" - -#include "BlockCountry.h" - -#include "DBManager.h" - -#define DO_ALL_BLOCK_IP(iter) \ - for ((iter) = m_block_ip.begin(); (iter) != m_block_ip.end(); ++(iter)) - -#define DO_ALL_BLOCK_EXCEPTION(iter) \ - for ((iter) = m_block_exception.begin(); (iter) != m_block_exception.end(); ++(iter)) - -CBlockCountry::CBlockCountry() -{ - - - -} - -CBlockCountry::~CBlockCountry() -{ - BLOCK_IP *block_ip; - BLOCK_IP_VECTOR::iterator iter; - - DO_ALL_BLOCK_IP(iter) - { - block_ip = *iter; - delete block_ip; - } - - m_block_ip.clear(); -} - - -bool CBlockCountry::Load() -{ - // load blocked ip - { - char szQuery[256]; - snprintf(szQuery, sizeof(szQuery), "SELECT IP_FROM, IP_TO, COUNTRY_NAME FROM iptocountry"); - SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_ACCOUNT); - - if (pMsg->Get()->uiNumRows == 0) - { - SPDLOG_ERROR(" DirectQuery failed({})", szQuery); - delete pMsg; - return false; - } - - MYSQL_ROW row; - for (int n = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++n) - { - BLOCK_IP *block_ip = new BLOCK_IP; - block_ip->ip_from = strtoul(row[0], NULL, 10); - block_ip->ip_to = strtoul(row[1], NULL, 10); - strlcpy(block_ip->country, row[2], sizeof(block_ip->country)); - - m_block_ip.push_back(block_ip); - SPDLOG_DEBUG("BLOCKED_IP : {} - {}", block_ip->ip_from, block_ip->ip_to); - - } - delete pMsg; - } - - - // load block exception account - { - char szQuery[256]; - snprintf(szQuery, sizeof(szQuery), "SELECT login FROM block_exception"); - SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_ACCOUNT); - - if (pMsg->Get()->uiNumRows == 0) - { - SPDLOG_ERROR(" DirectQuery failed({})", szQuery); - delete pMsg; - return true; - } - - MYSQL_ROW row; - for (int n = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++n) - { - const char *login = row[0]; - - m_block_exception.push_back(strdup(login)); - - SPDLOG_DEBUG("BLOCK_EXCEPTION = {}", login); - - } - delete pMsg; - } - - return true; -} - -bool CBlockCountry::IsBlockedCountryIp(const char *user_ip) -{ - BLOCK_IP* block_ip; - BLOCK_IP_VECTOR::iterator iter; - struct in_addr st_addr; - -#ifndef __WIN32__ - if (0 == inet_aton(user_ip, &st_addr)) -#else - unsigned int in_address; - in_address = inet_addr(user_ip); - st_addr.s_addr = in_address; - if (INADDR_NONE == in_address) -#endif - return true; // ¾ÆÀÌÇÇ°¡ ±«»óÇÏ´Ï ÀÏ´Ü ºí·°Ã³¸® - - DO_ALL_BLOCK_IP(iter) - { - block_ip = *iter; - - if (st_addr.s_addr >= block_ip->ip_from && st_addr.s_addr <= block_ip->ip_to) - return true; - } - - return false; -} - -void CBlockCountry::SendBlockedCountryIp(CPeer *peer) -{ - SPDLOG_DEBUG("SendBlockedCountryIp start"); - BLOCK_IP *block_ip; - BLOCK_IP_VECTOR::iterator iter; - TPacketBlockCountryIp packet; - - DO_ALL_BLOCK_IP(iter) - { - block_ip = *iter; - - packet.ip_from = block_ip->ip_from; - packet.ip_to = block_ip->ip_to; - - peer->EncodeHeader(HEADER_DG_BLOCK_COUNTRY_IP, 0, sizeof(TPacketBlockCountryIp)); - peer->Encode(&packet, sizeof(packet)); - } - - SPDLOG_DEBUG("[DONE] CBlockCountry::SendBlockedCountryIp() : count = {}", - m_block_ip.size()); - SPDLOG_DEBUG("SendBlockedCountryIp end"); -} /* end of CBlockCountry::SendBlockedCountryIp() */ - - -void CBlockCountry::SendBlockException(CPeer *peer) -{ - BLOCK_EXCEPTION_VECTOR::iterator iter; - - DO_ALL_BLOCK_EXCEPTION(iter) - { - const char *login = *iter; - - this->SendBlockExceptionOne(peer, login, BLOCK_EXCEPTION_CMD_ADD); - } -} /* end of CBlockCountry::SendBlockException() */ - -void CBlockCountry::SendBlockExceptionOne(CPeer *peer, const char *login, BYTE cmd) -{ - if (NULL == peer || NULL == login) - return; - - if (BLOCK_EXCEPTION_CMD_ADD != cmd && BLOCK_EXCEPTION_CMD_DEL != cmd) - return; - - TPacketBlockException packet; - - packet.cmd = cmd; - strlcpy(packet.login, login, sizeof(packet.login)); - - peer->EncodeHeader(HEADER_DG_BLOCK_EXCEPTION, 0, sizeof(TPacketBlockException)); - peer->Encode(&packet, sizeof(packet)); -} - -void CBlockCountry::AddBlockException(const char *login) -{ - BLOCK_EXCEPTION_VECTOR::iterator iter; - DO_ALL_BLOCK_EXCEPTION(iter) - { - const char *saved_login = *iter; - - if (!strcmp(saved_login, login)) - return; - } - - m_block_exception.push_back(strdup(login)); - return; -} - -void CBlockCountry::DelBlockException(const char *login) -{ - BLOCK_EXCEPTION_VECTOR::iterator iter; - DO_ALL_BLOCK_EXCEPTION(iter) - { - const char *saved_login = *iter; - - if (!strcmp(saved_login, login)) - { - ::free((void*)saved_login); - m_block_exception.erase(iter); - return; - } - } - return; -} - diff --git a/src/db/src/BlockCountry.h b/src/db/src/BlockCountry.h deleted file mode 100644 index 7e41e41..0000000 --- a/src/db/src/BlockCountry.h +++ /dev/null @@ -1,44 +0,0 @@ -// vim: ts=4 sw=4 -// Date : 2007.05.31 -// File : BlockCountry.h -// Author : mhh -// Description : - -#ifndef __INC_METIN_II_BLOCKCOUNTRY_H__ -#define __INC_METIN_II_BLOCKCOUNTRY_H__ - -#include "Peer.h" - -#define MAX_COUNTRY_NAME_LENGTH 50 - -class CBlockCountry : public singleton -{ - private: - struct BLOCK_IP - { - DWORD ip_from; - DWORD ip_to; - char country[MAX_COUNTRY_NAME_LENGTH + 1]; - }; - - typedef std::vector BLOCK_IP_VECTOR; - BLOCK_IP_VECTOR m_block_ip; - - typedef std::vector BLOCK_EXCEPTION_VECTOR; - BLOCK_EXCEPTION_VECTOR m_block_exception; - - public: - CBlockCountry(); - ~CBlockCountry(); - - public: - bool Load(); - bool IsBlockedCountryIp(const char *user_ip); - void SendBlockedCountryIp(CPeer *peer); - void SendBlockException(CPeer *peer); - void SendBlockExceptionOne(CPeer *peer, const char *login, BYTE cmd); - void AddBlockException(const char *login); - void DelBlockException(const char *login); -}; - -#endif diff --git a/src/db/src/ClientManager.cpp b/src/db/src/ClientManager.cpp index 45d4c51..1d5e40a 100644 --- a/src/db/src/ClientManager.cpp +++ b/src/db/src/ClientManager.cpp @@ -17,7 +17,6 @@ #include "ItemAwardManager.h" #include "Marriage.h" #include "Monarch.h" -#include "BlockCountry.h" #include "ItemIDRangeManager.h" #include "Cache.h" #ifdef __AUCTION__ @@ -2672,17 +2671,6 @@ void CClientManager::ProcessPackets(CPeer * peer) ChangeMonarchLord(peer, dwHandle, (TPacketChangeMonarchLord*)data); break; - case HEADER_GD_BLOCK_COUNTRY_IP: - SPDLOG_DEBUG("HEADER_GD_BLOCK_COUNTRY_IP received"); - CBlockCountry::instance().SendBlockedCountryIp(peer); - CBlockCountry::instance().SendBlockException(peer); - break; - - case HEADER_GD_BLOCK_EXCEPTION: - SPDLOG_DEBUG("HEADER_GD_BLOCK_EXCEPTION received"); - BlockException((TPacketBlockException*) data); - break; - case HEADER_GD_REQ_SPARE_ITEM_ID_RANGE : SendSpareItemIDRange(peer); break; @@ -4190,43 +4178,6 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan delete pMsg; } -void CClientManager::BlockException(TPacketBlockException *data) -{ - SPDLOG_DEBUG("[BLOCK_EXCEPTION] CMD({}) login({})", 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); - } -} - void CClientManager::SendSpareItemIDRange(CPeer* peer) { peer->SendSpareItemIDRange(); diff --git a/src/db/src/ClientManager.h b/src/db/src/ClientManager.h index 251cd2a..a13e11a 100644 --- a/src/db/src/ClientManager.h +++ b/src/db/src/ClientManager.h @@ -545,7 +545,6 @@ class CClientManager : public singleton //END_MONARCH void ChangeMonarchLord(CPeer* peer, DWORD dwHandle, TPacketChangeMonarchLord* info); - void BlockException(TPacketBlockException *data); void SendSpareItemIDRange(CPeer* peer); diff --git a/src/db/src/Main.cpp b/src/db/src/Main.cpp index 271c4ef..6d9e53a 100644 --- a/src/db/src/Main.cpp +++ b/src/db/src/Main.cpp @@ -9,7 +9,6 @@ #include "MoneyLog.h" #include "Marriage.h" #include "Monarch.h" -#include "BlockCountry.h" #include "ItemIDRangeManager.h" #include #ifdef __AUCTION__ @@ -74,7 +73,6 @@ int main() ItemAwardManager ItemAwardManager; marriage::CManager MarriageManager; CMonarch Monarch; - CBlockCountry BlockCountry; CItemIDRangeManager ItemIDRangeManager; #ifdef __AUCTION__ AuctionManager auctionManager; @@ -84,7 +82,6 @@ int main() GuildManager.Initialize(); MarriageManager.Initialize(); - BlockCountry.Load(); ItemIDRangeManager.Build(); #ifdef __AUCTION__ AuctionManager::instance().Initialize(); diff --git a/src/game/src/block_country.cpp b/src/game/src/block_country.cpp deleted file mode 100644 index 6a1b70a..0000000 --- a/src/game/src/block_country.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/********************************************************************* - * date : 2007.05.31 - * file : block_country.cpp - * author : mhh - * description : - */ - -#define _block_country_cpp_ - -#include "stdafx.h" -#include "constants.h" -#include "block_country.h" - -#define DEC_ITER(iter) std::vector::iterator iter -#define DO_ALL_BLOCKED_IP(iter) for ((iter)=s_blocked_ip.begin(); (iter)!=s_blocked_ip.end(); ++(iter)) - -#define DEC_EXCEPTION_ITER(iter) std::set::iterator iter - - -typedef struct { - DWORD ip_from; - DWORD ip_to; -} T_BLOCK_IP; - -//-------------------------------------- -// static variables -std::vector s_blocked_ip; -std::set s_block_exception; -// static variables -//-------------------------------------- - - - -//-------------------------------------- -// static functions -static void __add_block_exception(const char *login) -{ -SPDLOG_TRACE("BLOCK_EXCEPTION_ADD : {}", login); - - DEC_EXCEPTION_ITER(iter); - std::string string_login(login); - - iter = s_block_exception.find(string_login); - - // can not find - if (iter==s_block_exception.end()) - { - s_block_exception.insert(string_login); - } -} - -static void __del_block_exception(const char *login) -{ -SPDLOG_TRACE("BLOCK_EXCEPTION_DEL : {}", login); - - DEC_EXCEPTION_ITER(iter); - std::string string_login(login); - - iter = s_block_exception.find(string_login); - - // ok : find - if (iter!=s_block_exception.end()) - { - s_block_exception.erase(iter); - } -} -// static functions -//-------------------------------------- - - - - -void add_blocked_country_ip(TPacketBlockCountryIp *data) -{ - T_BLOCK_IP *block_ip = M2_NEW T_BLOCK_IP; - - block_ip->ip_from = data->ip_from; - block_ip->ip_to = data->ip_to; - - s_blocked_ip.push_back(block_ip); - - SPDLOG_TRACE("BLOCKED_IP = {} - {}", block_ip->ip_from, block_ip->ip_to); -} - - -void block_exception(TPacketBlockException *data) -{ - if (NULL==data) return; - - if (BLOCK_EXCEPTION_CMD_ADD!=data->cmd && BLOCK_EXCEPTION_CMD_DEL!=data->cmd) - return; - - - switch (data->cmd) - { - case BLOCK_EXCEPTION_CMD_ADD: - __add_block_exception(data->login); - break; - case BLOCK_EXCEPTION_CMD_DEL: - __del_block_exception(data->login); - break; - } -} - -bool is_blocked_country_ip(const char *user_ip) -{ - DEC_ITER(iter); - T_BLOCK_IP *block_ip; - DWORD ip_number; - struct in_addr st_addr; - -#ifndef __WIN32__ - if (0 == inet_aton(user_ip, &st_addr)) -#else - unsigned int in_address; - in_address = inet_addr(user_ip); - st_addr.s_addr = in_address; - if (INADDR_NONE == in_address) -#endif - { - SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip); - return true; // ¾ÆÀÌÇÇ°¡ ±«»óÇÏ´Ï ÀÏ´Ü ºí·°Ã³¸® - } - ip_number = htonl(st_addr.s_addr); - - DO_ALL_BLOCKED_IP(iter) - { - block_ip = *iter; - if ( block_ip->ip_from <= ip_number && ip_number <= block_ip->ip_to ) - { - SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip); - return true; - } - } - - SPDLOG_DEBUG("BLOCKED_COUNTRY_IP ({}) : NO", user_ip); - return false; -} - -bool is_block_exception(const char *login) -{ - std::string login_string(login); - std::set::iterator iter; - - iter = s_block_exception.find(login_string); - if (iter != s_block_exception.end()) - return true; - - return false; -} diff --git a/src/game/src/block_country.h b/src/game/src/block_country.h deleted file mode 100644 index fe69e46..0000000 --- a/src/game/src/block_country.h +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * date : 2007.05.31 - * file : block_country.h - * author : mhh - * description : - */ - -#ifndef _block_country_h_ -#define _block_country_h_ - - -void add_blocked_country_ip(TPacketBlockCountryIp *data); -void block_exception(TPacketBlockException *data); -bool is_blocked_country_ip(const char *user_ip); -bool is_block_exception(const char *login); - -#endif // _block_country_h_ - diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index e0a73e1..7278768 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -1198,15 +1198,6 @@ void DBManager::StopAllBilling() } } -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)); -} - size_t DBManager::EscapeString(char* dst, size_t dstSize, const char *src, size_t srcSize) { return m_sql_direct.EscapeString(dst, dstSize, src, srcSize); diff --git a/src/game/src/db.h b/src/game/src/db.h index 21db8fc..27d3da1 100644 --- a/src/game/src/db.h +++ b/src/game/src/db.h @@ -111,10 +111,6 @@ class DBManager : public singleton DWORD CountQueryResult() { return m_sql.CountResult(); } void ResetQueryResult() { m_sql.ResetQueryFinished(); } - // BLOCK EXCEPTION - void RequestBlockException(const char *login, int cmd); - // BLOCK EXCEPTION - void LoadDBString(); const std::string & GetDBString(const std::string& key); const std::vector & GetGreetMessage(); diff --git a/src/game/src/input.cpp b/src/game/src/input.cpp index 36329c6..d7055b8 100644 --- a/src/game/src/input.cpp +++ b/src/game/src/input.cpp @@ -543,20 +543,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) } } } - 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; - - SPDLOG_DEBUG("block_exception {}:{}", login_string.c_str(), cmd); - DBManager::instance().RequestBlockException(login_string.c_str(), cmd); - stResult = "BLOCK_EXCEPTION_YES"; - } } } diff --git a/src/game/src/input.h b/src/game/src/input.h index e90d256..9bc3f48 100644 --- a/src/game/src/input.h +++ b/src/game/src/input.h @@ -268,8 +268,6 @@ protected: void ChangeMonarchLord(TPacketChangeMonarchLordACK* data); void UpdateMonarchInfo(TMonarchInfo* data); - void AddBlockCountryIp(TPacketBlockCountryIp * data); - void BlockException(TPacketBlockException * data); // MYSHOP_PRICE_LIST /// ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ¸®½ºÆ® ¿äû¿¡ ´ëÇÑ ÀÀ´ä ÆÐŶ(HEADER_DG_MYSHOP_PRICELIST_RES) ó¸®ÇÔ¼ö diff --git a/src/game/src/input_db.cpp b/src/game/src/input_db.cpp index a50047a..9fa1dd4 100644 --- a/src/game/src/input_db.cpp +++ b/src/game/src/input_db.cpp @@ -32,7 +32,6 @@ #include "monarch.h" #include "affect.h" #include "castle.h" -#include "block_country.h" #include "motion.h" @@ -1002,12 +1001,6 @@ void CInputDB::Boot(const char* data) // castle_boot castle_boot(); - - // request blocked_country_ip - { - db_clientdesc->DBPacket(HEADER_GD_BLOCK_COUNTRY_IP, 0, NULL, 0); - SPDLOG_TRACE(""); - } } EVENTINFO(quest_login_event_info) @@ -2426,13 +2419,6 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) UpdateMonarchInfo((TMonarchInfo*)c_pData); break; - case HEADER_DG_BLOCK_COUNTRY_IP: - this->AddBlockCountryIp((TPacketBlockCountryIp *) c_pData); - break; - case HEADER_DG_BLOCK_EXCEPTION: - this->BlockException((TPacketBlockException *) c_pData); - break; - case HEADER_DG_ACK_CHANGE_GUILD_MASTER : this->GuildChangeMaster((TPacketChangeGuildMaster*) c_pData); break; @@ -2588,16 +2574,6 @@ void CInputDB::UpdateMonarchInfo(TMonarchInfo* info) SPDLOG_INFO("MONARCH INFO UPDATED"); } -void CInputDB::AddBlockCountryIp(TPacketBlockCountryIp * data) -{ - add_blocked_country_ip(data); -} - -void CInputDB::BlockException(TPacketBlockException *data) -{ - block_exception(data); -} - void CInputDB::GuildChangeMaster(TPacketChangeGuildMaster* p) { CGuildManager::instance().ChangeMaster(p->dwGuildID); diff --git a/src/game/src/input_login.cpp b/src/game/src/input_login.cpp index d9a600a..cfe9d67 100644 --- a/src/game/src/input_login.cpp +++ b/src/game/src/input_login.cpp @@ -25,7 +25,6 @@ #include "arena.h" #include "OXEvent.h" #include "priv_manager.h" -#include "block_country.h" #include "log.h" #include "horsename_manager.h" #include "MarkManager.h" @@ -140,20 +139,6 @@ void CInputLogin::LoginByKey(LPDESC d, const char * data) char login[LOGIN_MAX_LEN + 1]; trim_and_lower(pinfo->login, login, sizeof(login)); - // is blocked ip? - { - SPDLOG_TRACE("check_blocked_country_start"); - - if (!is_block_exception(login) && is_blocked_country_ip(d->GetHostName())) - { - SPDLOG_DEBUG("BLOCK_COUNTRY_IP ({})", d->GetHostName()); - d->SetPhase(PHASE_CLOSE); - return; - } - - SPDLOG_TRACE("check_blocked_country_end"); - } - if (g_bNoMoreClient) { TPacketGCLoginFailure failurePacket; diff --git a/src/game/src/packet.h b/src/game/src/packet.h index 8b1eb1e..f906ad9 100644 --- a/src/game/src/packet.h +++ b/src/game/src/packet.h @@ -303,7 +303,6 @@ enum HEADER_GG_CHECK_CLIENT_VERSION = 21, HEADER_GG_BLOCK_CHAT = 22, - HEADER_GG_BLOCK_EXCEPTION = 24, HEADER_GG_SIEGE = 25, HEADER_GG_MONARCH_NOTICE = 26, HEADER_GG_MONARCH_TRANSFER = 27, From 05a1406c7c93e13d9fc42ff139dd56276de9c440 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 17:50:04 +0200 Subject: [PATCH 03/10] Removed database strings and automatic greeting --- src/game/src/char.cpp | 10 ------- src/game/src/char.h | 1 - src/game/src/cmd_gm.cpp | 8 ------ src/game/src/db.cpp | 52 ------------------------------------ src/game/src/db.h | 7 ----- src/game/src/input.cpp | 5 ---- src/game/src/input_login.cpp | 2 -- 7 files changed, 85 deletions(-) diff --git a/src/game/src/char.cpp b/src/game/src/char.cpp index 3b44242..aa4d61d 100644 --- a/src/game/src/char.cpp +++ b/src/game/src/char.cpp @@ -5955,16 +5955,6 @@ void CHARACTER::SetGuild(CGuild* pGuild) } } -void CHARACTER::SendGreetMessage() -{ - typeof(DBManager::instance().GetGreetMessage()) v = DBManager::instance().GetGreetMessage(); - - for (itertype(v) it = v.begin(); it != v.end(); ++it) - { - ChatPacket(CHAT_TYPE_NOTICE, it->c_str()); - } -} - void CHARACTER::BeginStateEmpty() { MonsterLog("!"); diff --git a/src/game/src/char.h b/src/game/src/char.h index 4fe039f..b84c3f1 100644 --- a/src/game/src/char.h +++ b/src/game/src/char.h @@ -740,7 +740,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider void ChatPacket(BYTE type, const char *format, ...); void MonsterChat(BYTE bMonsterChatType); - void SendGreetMessage(); void ResetPoint(int iLv); diff --git a/src/game/src/cmd_gm.cpp b/src/game/src/cmd_gm.cpp index 1ae4d3d..77d49d5 100644 --- a/src/game/src/cmd_gm.cpp +++ b/src/game/src/cmd_gm.cpp @@ -2099,11 +2099,6 @@ ACMD(do_reload) db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0); break; - case 's': - ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string."); - DBManager::instance().LoadDBString(); - break; - case 'q': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading quest."); quest::CQuestManager::instance().Reload(); @@ -2133,9 +2128,6 @@ ACMD(do_reload) ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,"); db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0); - - ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string."); - DBManager::instance().LoadDBString(); } } diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index 7278768..1ab6808 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -38,11 +38,6 @@ bool DBManager::Connect(const char * host, const int port, const char * user, co if (!m_sql_direct.Setup(host, user, pwd, db, g_stLocale.c_str(), true, port)) SPDLOG_ERROR("cannot open direct sql connection to host {}", host); - if (m_bIsConnect && !g_bAuthServer) - { - LoadDBString(); - } - return m_bIsConnect; } @@ -946,34 +941,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) } break; - case QID_DB_STRING: - { - m_map_dbstring.clear(); - m_vec_GreetMessage.clear(); - - for (uint i = 0; i < pMsg->Get()->uiNumRows; ++i) - { - MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); - //ch->SetSafeboxSize(SAFEBOX_PAGE_SIZE * atoi(row[0])); - if (row[0] && row[1]) - { - m_map_dbstring.insert(make_pair(std::string(row[0]), std::string(row[1]))); - SPDLOG_DEBUG("DBSTR '{}' '{}'", row[0], row[1]); - } - } - if (m_map_dbstring.find("GREET") != m_map_dbstring.end()) - { - std::istringstream is(m_map_dbstring["GREET"]); - while (!is.eof()) - { - std::string str; - getline(is, str); - m_vec_GreetMessage.push_back(str); - } - } - } - break; - case QID_LOTTO: { LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent); @@ -1137,25 +1104,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) M2_DELETE(qi); } -void DBManager::LoadDBString() -{ - ReturnQuery(QID_DB_STRING, 0, NULL, "SELECT name, text FROM string%s", get_table_postfix()); -} - -const std::string& DBManager::GetDBString(const std::string& key) -{ - static std::string null_str = ""; - itertype(m_map_dbstring) it = m_map_dbstring.find(key); - if (it == m_map_dbstring.end()) - return null_str; - return it->second; -} - -const std::vector& DBManager::GetGreetMessage() -{ - return m_vec_GreetMessage; -} - void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold) { if (!gold) diff --git a/src/game/src/db.h b/src/game/src/db.h index 27d3da1..f2f68ec 100644 --- a/src/game/src/db.h +++ b/src/game/src/db.h @@ -14,7 +14,6 @@ enum enum { QID_SAFEBOX_SIZE, - QID_DB_STRING, QID_AUTH_LOGIN, QID_LOTTO, QID_HIGHSCORE_REGISTER, @@ -111,10 +110,6 @@ class DBManager : public singleton DWORD CountQueryResult() { return m_sql.CountResult(); } void ResetQueryResult() { m_sql.ResetQueryFinished(); } - void LoadDBString(); - const std::string & GetDBString(const std::string& key); - const std::vector & GetGreetMessage(); - template void FuncQuery(Functor f, const char * c_pszFormat, ...); // °á°ú¸¦ fÀÎÀڷΠȣÃâÇÔ (SQLMsg *) ¾Ë¾Æ¼­ ÇØÁ¦µÊ template void FuncAfterQuery(Functor f, const char * c_pszFormat, ...); // ³¡³ª°í ³ª¸é f°¡ È£ÃâµÊ void f(void) ÇüÅ @@ -127,8 +122,6 @@ class DBManager : public singleton CAsyncSQL m_sql_direct; bool m_bIsConnect; - std::map m_map_dbstring; - std::vector m_vec_GreetMessage; std::map m_map_pkLoginData; std::map mapLDBilling; std::vector m_vec_kUseTime; diff --git a/src/game/src/input.cpp b/src/game/src/input.cpp index d7055b8..e15e821 100644 --- a/src/game/src/input.cpp +++ b/src/game/src/input.cpp @@ -435,7 +435,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) { LoadStateUserCount(); db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0); - DBManager::instance().LoadDBString(); } else { @@ -451,10 +450,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0); break; - case 's': - DBManager::instance().LoadDBString(); - break; - case 'q': quest::CQuestManager::instance().Reload(); break; diff --git a/src/game/src/input_login.cpp b/src/game/src/input_login.cpp index cfe9d67..1e83a73 100644 --- a/src/game/src/input_login.cpp +++ b/src/game/src/input_login.cpp @@ -607,8 +607,6 @@ void CInputLogin::Entergame(LPDESC d, const char * data) p2.channel = g_bChannel; d->Packet(&p2, sizeof(p2)); - ch->SendGreetMessage(); - _send_bonus_info(ch); for (int i = 0; i <= PREMIUM_MAX_NUM; ++i) From 0c86f802caf1c4bc414e16bb97029a215bc745e6 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 18:06:36 +0200 Subject: [PATCH 04/10] Removed unused highscore Lua & DB functions --- .../locale/english/quest/quest_functions | 2 - src/common/tables.h | 9 --- src/db/src/ClientManager.cpp | 9 --- src/db/src/ClientManager.h | 3 - src/db/src/ClientManagerPlayer.cpp | 70 ------------------- src/db/src/QID.h | 21 +++--- src/game/src/db.cpp | 33 --------- src/game/src/db.h | 9 --- src/game/src/fishing.cpp | 20 ------ src/game/src/questlua.cpp | 40 ----------- src/quest/src/quest_functions | 4 -- 11 files changed, 10 insertions(+), 210 deletions(-) diff --git a/gamefiles/locale/english/quest/quest_functions b/gamefiles/locale/english/quest/quest_functions index b88a178..ebbea6f 100644 --- a/gamefiles/locale/english/quest/quest_functions +++ b/gamefiles/locale/english/quest/quest_functions @@ -174,8 +174,6 @@ guild.level guild.name guild.war_bet guild.war_enter -highscore.register -highscore.show horse.advance horse.feed horse.get_grade diff --git a/src/common/tables.h b/src/common/tables.h index f604719..fae5fb6 100644 --- a/src/common/tables.h +++ b/src/common/tables.h @@ -49,7 +49,6 @@ enum HEADER_GD_ADD_AFFECT = 32, HEADER_GD_REMOVE_AFFECT = 33, - HEADER_GD_HIGHSCORE_REGISTER = 34, HEADER_GD_ITEM_FLUSH = 35, HEADER_GD_PARTY_CREATE = 36, @@ -847,14 +846,6 @@ typedef struct SPacketGDRemoveAffect BYTE bApplyOn; } TPacketGDRemoveAffect; -typedef struct SPacketGDHighscore -{ - DWORD dwPID; - LONG lValue; - char cDir; - char szBoard[21]; -} TPacketGDHighscore; - typedef struct SPacketPartyCreate { DWORD dwLeaderPID; diff --git a/src/db/src/ClientManager.cpp b/src/db/src/ClientManager.cpp index 1d5e40a..c5a2697 100644 --- a/src/db/src/ClientManager.cpp +++ b/src/db/src/ClientManager.cpp @@ -2475,10 +2475,6 @@ void CClientManager::ProcessPackets(CPeer * peer) QUERY_REMOVE_AFFECT(peer, (TPacketGDRemoveAffect *) data); break; - case HEADER_GD_HIGHSCORE_REGISTER: - QUERY_HIGHSCORE_REGISTER(peer, (TPacketGDHighscore *) data); - break; - case HEADER_GD_PARTY_CREATE: QUERY_PARTY_CREATE(peer, (TPacketPartyCreate*) data); break; @@ -2922,11 +2918,6 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) RESULT_SAFEBOX_CHANGE_PASSWORD_SECOND(peer, msg); break; - case QID_HIGHSCORE_REGISTER: - SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_HIGHSCORE_REGISTER {}", (void*) msg); - RESULT_HIGHSCORE_REGISTER(peer, msg); - break; - case QID_SAFEBOX_SAVE: case QID_ITEM_SAVE: case QID_ITEM_DESTROY: diff --git a/src/db/src/ClientManager.h b/src/db/src/ClientManager.h index a13e11a..21c84bd 100644 --- a/src/db/src/ClientManager.h +++ b/src/db/src/ClientManager.h @@ -310,9 +310,6 @@ class CClientManager : public singleton void SendPartyOnSetup(CPeer * peer); - void QUERY_HIGHSCORE_REGISTER(CPeer * peer, TPacketGDHighscore* data); - void RESULT_HIGHSCORE_REGISTER(CPeer * pkPeer, SQLMsg * msg); - void QUERY_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData); void QUERY_PARTY_CREATE(CPeer * peer, TPacketPartyCreate* p); diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index 16b7558..e534924 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -1200,76 +1200,6 @@ void CClientManager::QUERY_REMOVE_AFFECT(CPeer * peer, TPacketGDRemoveAffect * p CDBManager::instance().AsyncQuery(queryStr); } - -void CClientManager::QUERY_HIGHSCORE_REGISTER(CPeer* peer, TPacketGDHighscore * data) -{ - char szQuery[128]; - snprintf(szQuery, sizeof(szQuery), "SELECT value FROM highscore%s WHERE board='%s' AND pid = %u", GetTablePostfix(), data->szBoard, data->dwPID); - - SPDLOG_DEBUG("HEADER_GD_HIGHSCORE_REGISTER: PID {}", data->dwPID); - - ClientHandleInfo * pi = new ClientHandleInfo(0); - strlcpy(pi->login, data->szBoard, sizeof(pi->login)); - pi->account_id = (DWORD)data->lValue; - pi->player_id = data->dwPID; - pi->account_index = (data->cDir > 0); - - CDBManager::instance().ReturnQuery(szQuery, QID_HIGHSCORE_REGISTER, peer->GetHandle(), pi); -} - -void CClientManager::RESULT_HIGHSCORE_REGISTER(CPeer * pkPeer, SQLMsg * msg) -{ - CQueryInfo * qi = (CQueryInfo *) msg->pvUserData; - ClientHandleInfo * pi = (ClientHandleInfo *) qi->pvData; - //DWORD dwHandle = pi->dwHandle; - - char szBoard[21]; - strlcpy(szBoard, pi->login, sizeof(szBoard)); - int value = (int)pi->account_id; - - SQLResult * res = msg->Get(); - - if (res->uiNumRows == 0) - { - // »õ·Î¿î ÇÏÀ̽ºÄھ »ðÀÔ - char buf[256]; - snprintf(buf, sizeof(buf), "INSERT INTO highscore%s VALUES('%s', %u, %d)", GetTablePostfix(), szBoard, pi->player_id, value); - CDBManager::instance().AsyncQuery(buf); - } - else - { - if (!res->pSQLResult) - { - delete pi; - return; - } - - MYSQL_ROW row = mysql_fetch_row(res->pSQLResult); - if (row && row[0]) - { - int current_value = 0; str_to_number(current_value, row[0]); - if (pi->account_index && current_value >= value || !pi->account_index && current_value <= value) - { - value = current_value; - } - else - { - char buf[256]; - snprintf(buf, sizeof(buf), "REPLACE INTO highscore%s VALUES('%s', %u, %d)", GetTablePostfix(), szBoard, pi->player_id, value); - CDBManager::instance().AsyncQuery(buf); - } - } - else - { - char buf[256]; - snprintf(buf, sizeof(buf), "INSERT INTO highscore%s VALUES('%s', %u, %d)", GetTablePostfix(), szBoard, pi->player_id, value); - CDBManager::instance().AsyncQuery(buf); - } - } - // TODO: ÀÌ°÷¿¡¼­ ÇÏÀ̽ºÄھ ¾÷µ¥ÀÌÆ® µÇ¾ú´ÂÁö üũÇÏ¿© °øÁö¸¦ »Ñ·Á¾ßÇÑ´Ù. - delete pi; -} - void CClientManager::InsertLogoutPlayer(DWORD pid) { TLogoutPlayerMap::iterator it = m_map_logout.find(pid); diff --git a/src/db/src/QID.h b/src/db/src/QID.h index 230d2ef..b6d5339 100644 --- a/src/db/src/QID.h +++ b/src/db/src/QID.h @@ -20,19 +20,18 @@ enum QID QID_ITEM_DESTROY, // 11 QID_QUEST_SAVE, // 12 QID_PLAYER_SAVE, // 13 - QID_HIGHSCORE_REGISTER, // 14 - QID_PLAYER_DELETE, // 15 - QID_LOGIN_BY_KEY, // 16 - QID_PLAYER_INDEX_CREATE, // 17 - QID_ITEM_AWARD_LOAD, // 18 - QID_ITEM_AWARD_TAKEN, // 19 - QID_GUILD_RANKING, // 20 + QID_PLAYER_DELETE, // 14 + QID_LOGIN_BY_KEY, // 15 + QID_PLAYER_INDEX_CREATE, // 16 + QID_ITEM_AWARD_LOAD, // 17 + QID_ITEM_AWARD_TAKEN, // 18 + QID_GUILD_RANKING, // 19 // MYSHOP_PRICE_LIST - QID_ITEMPRICE_SAVE, ///< 21, ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ÀúÀå Äõ¸® - QID_ITEMPRICE_DESTROY, ///< 22, ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ »èÁ¦ Äõ¸® - QID_ITEMPRICE_LOAD_FOR_UPDATE, ///< 23, °¡°ÝÁ¤º¸ ¾÷µ¥ÀÌÆ®¸¦ À§ÇÑ ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ·Îµå Äõ¸® - QID_ITEMPRICE_LOAD, ///< 24, ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ·Îµå Äõ¸® + QID_ITEMPRICE_SAVE, ///< 20, ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ÀúÀå Äõ¸® + QID_ITEMPRICE_DESTROY, ///< 21, ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ »èÁ¦ Äõ¸® + QID_ITEMPRICE_LOAD_FOR_UPDATE, ///< 22, °¡°ÝÁ¤º¸ ¾÷µ¥ÀÌÆ®¸¦ À§ÇÑ ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ·Îµå Äõ¸® + QID_ITEMPRICE_LOAD, ///< 22, ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ·Îµå Äõ¸® // END_OF_MYSHOP_PRICE_LIST }; diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index 1ab6808..925de5f 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -973,39 +973,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) } break; - case QID_HIGHSCORE_REGISTER: - { - THighscoreRegisterQueryInfo * info = (THighscoreRegisterQueryInfo *) qi->pvData; - bool bQuery = true; - - if (pMsg->Get()->uiNumRows) - { - MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); - - if (row && row[0]) - { - int iCur = 0; - str_to_number(iCur, row[0]); - - if ((info->bOrder && iCur >= info->iValue) || - (!info->bOrder && iCur <= info->iValue)) - bQuery = false; - } - } - - if (bQuery) - Query("REPLACE INTO highscore%s VALUES('%s', %u, %d)", - get_table_postfix(), info->szBoard, info->dwPID, info->iValue); - - M2_DELETE(info); - } - break; - - case QID_HIGHSCORE_SHOW: - { - } - break; - // BLOCK_CHAT case QID_BLOCK_CHAT_LIST: { diff --git a/src/game/src/db.h b/src/game/src/db.h index f2f68ec..99d0031 100644 --- a/src/game/src/db.h +++ b/src/game/src/db.h @@ -16,8 +16,6 @@ enum QID_SAFEBOX_SIZE, QID_AUTH_LOGIN, QID_LOTTO, - QID_HIGHSCORE_REGISTER, - QID_HIGHSCORE_SHOW, QID_BILLING_GET_TIME, QID_BILLING_CHECK, @@ -162,13 +160,6 @@ template void DBManager::FuncAfterQuery(Functor f, const char* c } //////////////////////////////////////////////////////////////// -typedef struct SHighscoreRegisterQueryInfo -{ - char szBoard[20+1]; - DWORD dwPID; - int iValue; - bool bOrder; -} THighscoreRegisterQueryInfo; extern void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLoginData * pkLD); extern void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item); diff --git a/src/game/src/fishing.cpp b/src/game/src/fishing.cpp index c241ec5..4ae91b1 100644 --- a/src/game/src/fishing.cpp +++ b/src/game/src/fishing.cpp @@ -649,26 +649,6 @@ void Take(fishing_event_info* info, LPCHARACTER ch) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À̹ø¿¡ ÀâÀº ¹°°í±âÀÇ ±æÀÌ´Â %.2fcm"), item->GetSocket(0)/100.f); } - - if (quest::CQuestManager::instance().GetEventFlag("fishevent") > 0 && (info->fish_id == 5 || info->fish_id == 6)) - { - // À̺¥Æ® ÁßÀ̹ǷΠ±â·ÏÇÑ´Ù. - - TPacketGDHighscore p; - p.dwPID = ch->GetPlayerID(); - p.lValue = item->GetSocket(0); - - if (info->fish_id == 5) - { - strlcpy(p.szBoard, LC_TEXT("³¬½ÃÀ̺¥Æ®¿ùôºØ¾î"), sizeof(p.szBoard)); - } - else if (info->fish_id == 6) - { - strlcpy(p.szBoard, LC_TEXT("³¬½ÃÀ̺¥Æ®À×¾î"), sizeof(p.szBoard)); - } - - db_clientdesc->DBPacket(HEADER_GD_HIGHSCORE_REGISTER, 0, &p, sizeof(TPacketGDHighscore)); - } } int map_idx = ch->GetMapIndex(); diff --git a/src/game/src/questlua.cpp b/src/game/src/questlua.cpp index 2b78367..7ee34d2 100644 --- a/src/game/src/questlua.cpp +++ b/src/game/src/questlua.cpp @@ -200,35 +200,6 @@ namespace quest } } - int highscore_show(lua_State* L) - { - CQuestManager & q = CQuestManager::instance(); - const char * pszBoardName = lua_tostring(L, 1); - DWORD mypid = q.GetCurrentCharacterPtr()->GetPlayerID(); - bool bOrder = (int) lua_tonumber(L, 2) != 0 ? true : false; - - DBManager::instance().ReturnQuery(QID_HIGHSCORE_SHOW, mypid, NULL, - "SELECT h.pid, p.name, h.value FROM highscore%s as h, player%s as p WHERE h.board = '%s' AND h.pid = p.id ORDER BY h.value %s LIMIT 10", - get_table_postfix(), get_table_postfix(), pszBoardName, bOrder ? "DESC" : ""); - return 0; - } - - int highscore_register(lua_State* L) - { - CQuestManager & q = CQuestManager::instance(); - - THighscoreRegisterQueryInfo * qi = M2_NEW THighscoreRegisterQueryInfo; - - strlcpy(qi->szBoard, lua_tostring(L, 1), sizeof(qi->szBoard)); - qi->dwPID = q.GetCurrentCharacterPtr()->GetPlayerID(); - qi->iValue = (int) lua_tonumber(L, 2); - qi->bOrder = (int) lua_tonumber(L, 3); - - DBManager::instance().ReturnQuery(QID_HIGHSCORE_REGISTER, qi->dwPID, qi, - "SELECT value FROM highscore%s WHERE board='%s' AND pid=%u", get_table_postfix(), qi->szBoard, qi->dwPID); - return 1; - } - // // "member" Lua functions // @@ -496,17 +467,6 @@ namespace quest AddLuaFunctionTable("member", member_functions); } - { - luaL_reg highscore_functions[] = - { - { "register", highscore_register }, - { "show", highscore_show }, - { NULL, NULL } - }; - - AddLuaFunctionTable("highscore", highscore_functions); - } - { luaL_reg mob_functions[] = { diff --git a/src/quest/src/quest_functions b/src/quest/src/quest_functions index 2c1078c..6097758 100644 --- a/src/quest/src/quest_functions +++ b/src/quest/src/quest_functions @@ -228,8 +228,6 @@ guild.get_name guild.war_bet guild.is_bet guild.get_warp_war_list -highscore.register -highscore.show mob.spawn mob.spawn_group q.setstate @@ -335,8 +333,6 @@ guild.get_reserve_war_table guild.get_name guild.war_bet guild.is_bet -highscore.register -highscore.show mob.spawn mob.spawn_group q.setstate From 72b495c03cc825fcf8fed8615dce3fc77d396533 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 18:55:44 +0200 Subject: [PATCH 05/10] Removed PCBang/iCafe code --- gamefiles/conf/CMD | 2 - src/common/item_length.h | 2 + src/common/tables.h | 15 ------- src/game/src/char.cpp | 18 -------- src/game/src/char.h | 13 ++---- src/game/src/char_battle.cpp | 21 --------- src/game/src/char_item.cpp | 27 ----------- src/game/src/cmd.cpp | 6 --- src/game/src/cmd_general.cpp | 2 - src/game/src/cmd_gm.cpp | 47 ------------------- src/game/src/constants.cpp | 1 + src/game/src/db.cpp | 68 ---------------------------- src/game/src/db.h | 5 --- src/game/src/input.h | 1 - src/game/src/input_db.cpp | 8 ---- src/game/src/input_p2p.cpp | 12 ----- src/game/src/item.cpp | 12 ----- src/game/src/item.h | 2 - src/game/src/item_manager.cpp | 8 ---- src/game/src/log.cpp | 6 --- src/game/src/log.h | 1 - src/game/src/main.cpp | 2 - src/game/src/packet.h | 7 --- src/game/src/packet_info.cpp | 1 - src/game/src/pcbang.cpp | 85 ----------------------------------- src/game/src/pcbang.h | 26 ----------- 26 files changed, 6 insertions(+), 392 deletions(-) delete mode 100644 src/game/src/pcbang.cpp delete mode 100644 src/game/src/pcbang.h diff --git a/gamefiles/conf/CMD b/gamefiles/conf/CMD index 4e60a9c..701bbbd 100644 --- a/gamefiles/conf/CMD +++ b/gamefiles/conf/CMD @@ -41,8 +41,6 @@ tstr IMPLEMENTOR tint IMPLEMENTOR tcon IMPLEMENTOR mob_ld IMPLEMENTOR -pcbang_check IMPLEMENTOR -pcbang_update IMPLEMENTOR setqf IMPLEMENTOR delqf IMPLEMENTOR effect IMPLEMENTOR diff --git a/src/common/item_length.h b/src/common/item_length.h index 2f44961..7a2083d 100644 --- a/src/common/item_length.h +++ b/src/common/item_length.h @@ -333,6 +333,8 @@ enum ELimitTypes LIMIT_DEX, LIMIT_INT, LIMIT_CON, + + // TODO: Remove this and re-check the validity of item_proto afterwards LIMIT_PCBANG, /// Âø¿ë ¿©ºÎ¿Í »ó°ü ¾øÀÌ ½Ç½Ã°£À¸·Î ½Ã°£ Â÷°¨ (socket0¿¡ ¼Ò¸ê ½Ã°£ÀÌ ¹ÚÈû: unix_timestamp ŸÀÔ) diff --git a/src/common/tables.h b/src/common/tables.h index fae5fb6..9e63d64 100644 --- a/src/common/tables.h +++ b/src/common/tables.h @@ -108,12 +108,6 @@ enum HEADER_GD_BLOCK_CHAT = 110, - // PCBANG_IP_LIST_BY_AUTH - HEADER_GD_PCBANG_REQUEST_IP_LIST = 111, - HEADER_GD_PCBANG_CLEAR_IP_LIST = 112, - HEADER_GD_PCBANG_INSERT_IP = 113, - // END_OF_PCBANG_IP_LIST_BY_AUTH - HEADER_GD_HAMMER_OF_TOR = 114, HEADER_GD_RELOAD_ADMIN = 115, ///<¿î¿µÀÚ Á¤º¸ ¿äû HEADER_GD_BREAK_MARRIAGE = 116, ///< °áÈ¥ Æıâ @@ -1293,15 +1287,6 @@ typedef struct LONG lDuration; } TPacketBlockChat; -// PCBANG_IP_LIST -typedef struct SPacketPCBangIP -{ - DWORD id; - DWORD ip; -} TPacketPCBangIP; -// END_OF_PCBANG_IP_LIST - - //ADMIN_MANAGER typedef struct TAdminInfo { diff --git a/src/game/src/char.cpp b/src/game/src/char.cpp index aa4d61d..3528b97 100644 --- a/src/game/src/char.cpp +++ b/src/game/src/char.cpp @@ -48,7 +48,6 @@ #include "castle.h" #include "arena.h" #include "horsename_manager.h" -#include "pcbang.h" #include "gm.h" #include "map_location.h" #include "BlueDragon_Binder.h" @@ -307,8 +306,6 @@ void CHARACTER::Initialize() memset(m_adwMobSkillCooltime, 0, sizeof(m_adwMobSkillCooltime)); // END_OF_MOB_SKILL_COOLTIME - m_isinPCBang = false; - // ARENA m_pArena = NULL; m_nPotionLimit = quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count"); @@ -1314,9 +1311,6 @@ void CHARACTER::Disconnect(const char * c_pszReason) { int playTime = GetRealPoint(POINT_PLAYTIME) - m_dwLoginPlayTime; LogManager::instance().LoginLog(false, GetDesc()->GetAccountTable().id, GetPlayerID(), GetLevel(), GetJob(), playTime); - - if (LC_IsBrazil() != true) - CPCBangManager::instance().Log(GetDesc()->GetHostName(), GetPlayerID(), playTime); } if (m_pWarMap) @@ -2242,11 +2236,6 @@ void CHARACTER::ComputePoints() SetPoint(POINT_HP_RECOVERY, lHPRecovery); SetPoint(POINT_SP_RECOVERY, lSPRecovery); - // PC_BANG_ITEM_ADD - SetPoint(POINT_PC_BANG_EXP_BONUS, 0); - SetPoint(POINT_PC_BANG_DROP_BONUS, 0); - // END_PC_BANG_ITEM_ADD - int iMaxHP, iMaxSP; int iMaxStamina; @@ -3478,14 +3467,10 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast val = GetPoint(type); break; - // PC_BANG_ITEM_ADD - case POINT_PC_BANG_EXP_BONUS : - case POINT_PC_BANG_DROP_BONUS : case POINT_RAMADAN_CANDY_BONUS_EXP: SetPoint(type, amount); val = GetPoint(type); break; - // END_PC_BANG_ITEM_ADD case POINT_EXP_DOUBLE_BONUS: // 71 case POINT_GOLD_DOUBLE_BONUS: // 72 @@ -3759,9 +3744,6 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal) case APPLY_NORMAL_HIT_DEFEND_BONUS: // END_OF_DEPEND_BONUS_ATTRIBUTES - case APPLY_PC_BANG_EXP_BONUS : - case APPLY_PC_BANG_DROP_BONUS : - case APPLY_RESIST_WARRIOR : case APPLY_RESIST_ASSASSIN : case APPLY_RESIST_SURA : diff --git a/src/game/src/char.h b/src/game/src/char.h index b84c3f1..5e3356b 100644 --- a/src/game/src/char.h +++ b/src/game/src/char.h @@ -260,10 +260,12 @@ enum EPointTypes POINT_NORMAL_HIT_DEFEND_BONUS, // 124 ÆòŸ ¹æ¾î µ¥¹ÌÁö // END_OF_DEFEND_BONUS_ATTRIBUTES - // PC_BANG_ITEM_ADD + // TODO: check if the PC_BANG_* bonuses can be safely removed + // PC_BANG_ITEM_ADD POINT_PC_BANG_EXP_BONUS, // 125 PC¹æ Àü¿ë °æÇèÄ¡ º¸³Ê½º POINT_PC_BANG_DROP_BONUS, // 126 PC¹æ Àü¿ë µå·Ó·ü º¸³Ê½º // END_PC_BANG_ITEM_ADD + POINT_RAMADAN_CANDY_BONUS_EXP, // ¶ó¸¶´Ü »çÅÁ °æÇèÄ¡ Áõ°¡¿ë POINT_ENERGY = 128, // 128 ±â·Â @@ -1745,15 +1747,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider static const char msc_szChangeItemAttrCycleFlag[]; ///< ¾ÆÀÌÅÛ ¼Ó¼ºº´°æ °¡´É ÁÖ±âÀÇ Quest Flag À̸§ // END_OF_CHANGE_ITEM_ATTRIBUTES - // PC_BANG_ITEM_ADD - private : - bool m_isinPCBang; - - public : - bool SetPCBang(bool flag) { m_isinPCBang = flag; return m_isinPCBang; } - bool IsPCBang() const { return m_isinPCBang; } - // END_PC_BANG_ITEM_ADD - // NEW_HAIR_STYLE_ADD public : bool ItemProcess_Hair(LPITEM item, int iDestCell); diff --git a/src/game/src/char_battle.cpp b/src/game/src/char_battle.cpp index 86056c9..59de5aa 100644 --- a/src/game/src/char_battle.cpp +++ b/src/game/src/char_battle.cpp @@ -2394,13 +2394,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp) iExp += (iExp * 50 / 100); } - // PC¹æ ¾ÆÅÛ °æÄ¡ º¸³Ê½º - if (to->GetPoint(POINT_PC_BANG_EXP_BONUS) > 0) - { - if (to->IsPCBang() == true) - iExp += (iExp * to->GetPoint(POINT_PC_BANG_EXP_BONUS)/100); - } - // °áÈ¥ º¸³Ê½º iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100; } @@ -2417,13 +2410,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp) iExp += iExp; } - // PC¹æ ¾ÆÅÛ °æÄ¡ º¸³Ê½º - if (to->GetPoint(POINT_PC_BANG_EXP_BONUS) > 0) - { - if (to->IsPCBang() == true) - iExp += (iExp * to->GetPoint(POINT_PC_BANG_EXP_BONUS)/100); - } - // °áÈ¥ º¸³Ê½º iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100; } @@ -2440,13 +2426,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp) iExp += (iExp * 20 / 100); } - // PC¹æ ¾ÆÅÛ °æÄ¡ º¸³Ê½º - if (to->GetPoint(POINT_PC_BANG_EXP_BONUS) > 0) - { - if (to->IsPCBang() == true) - iExp += (iExp * to->GetPoint(POINT_PC_BANG_EXP_BONUS)/100); - } - // °áÈ¥ º¸³Ê½º iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100; } diff --git a/src/game/src/char_item.cpp b/src/game/src/char_item.cpp index 0992df7..01a9b60 100644 --- a/src/game/src/char_item.cpp +++ b/src/game/src/char_item.cpp @@ -34,7 +34,6 @@ #include "castle.h" #include "BattleArena.h" #include "arena.h" -#include "pcbang.h" #include "threeway_war.h" #include "safebox.h" @@ -2219,19 +2218,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) } else { - // PC_BANG_ITEM_ADD - if (item->IsPCBangItem() == true) - { - // PC¹æÀÎÁö üũÇؼ­ ó¸® - if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false) - { - // PC¹æÀÌ ¾Æ´Ô! - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº PC¹æ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); - return false; - } - } - // END_PC_BANG_ITEM_ADD - AddAffect(AFFECT_EXP_BONUS_EURO_FREE, aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false, true); item->SetCount(item->GetCount() - 1); } @@ -4880,19 +4866,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) } else { - // PC_BANG_ITEM_ADD - if (item->IsPCBangItem() == true) - { - // PC¹æÀÎÁö üũÇؼ­ ó¸® - if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false) - { - // PC¹æÀÌ ¾Æ´Ô! - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº PC¹æ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); - return false; - } - } - // END_PC_BANG_ITEM_ADD - AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false); item->SetCount(item->GetCount() - 1); } diff --git a/src/game/src/cmd.cpp b/src/game/src/cmd.cpp index 4b6a112..b9d3bf6 100644 --- a/src/game/src/cmd.cpp +++ b/src/game/src/cmd.cpp @@ -10,9 +10,6 @@ ACMD(do_user_horse_ride); ACMD(do_user_horse_back); ACMD(do_user_horse_feed); -ACMD(do_pcbang_update); -ACMD(do_pcbang_check); - // ADD_COMMAND_SLOW_STUN ACMD(do_slow); ACMD(do_stun); @@ -444,9 +441,6 @@ struct command_info cmd_info[] = { "horse_unsummon", do_horse_unsummon, 0, POS_DEAD, GM_HIGH_WIZARD }, { "horse_set_stat", do_horse_set_stat, 0, POS_DEAD, GM_HIGH_WIZARD }, - { "pcbang_update", do_pcbang_update, 0, POS_DEAD, GM_LOW_WIZARD }, - { "pcbang_check", do_pcbang_check, 0, POS_DEAD, GM_LOW_WIZARD }, - { "emotion_allow", do_emotion_allow, 0, POS_FIGHTING, GM_PLAYER }, { "kiss", do_emotion, 0, POS_FIGHTING, GM_PLAYER }, { "slap", do_emotion, 0, POS_FIGHTING, GM_PLAYER }, diff --git a/src/game/src/cmd_general.cpp b/src/game/src/cmd_general.cpp index 51a9277..1cc6ca1 100644 --- a/src/game/src/cmd_general.cpp +++ b/src/game/src/cmd_general.cpp @@ -2006,8 +2006,6 @@ static const char* FN_point_string(int apply_number) case POINT_NORMAL_HIT_DAMAGE_BONUS: return LC_TEXT("ÆòŸ µ¥¹ÌÁö %d%%"); case POINT_SKILL_DEFEND_BONUS: return LC_TEXT("½ºÅ³ µ¥¹ÌÁö ÀúÇ× %d%%"); case POINT_NORMAL_HIT_DEFEND_BONUS: return LC_TEXT("ÆòŸ µ¥¹ÌÁö ÀúÇ× %d%%"); -// case POINT_PC_BANG_EXP_BONUS: return LC_TEXT(""); -// case POINT_PC_BANG_DROP_BONUS: return LC_TEXT(""); // case POINT_EXTRACT_HP_PCT: return LC_TEXT(""); case POINT_RESIST_WARRIOR: return LC_TEXT("¹«»ç°ø°Ý¿¡ %d%% ÀúÇ×"); case POINT_RESIST_ASSASSIN: return LC_TEXT("ÀÚ°´°ø°Ý¿¡ %d%% ÀúÇ×"); diff --git a/src/game/src/cmd_gm.cpp b/src/game/src/cmd_gm.cpp index 77d49d5..d78d061 100644 --- a/src/game/src/cmd_gm.cpp +++ b/src/game/src/cmd_gm.cpp @@ -32,7 +32,6 @@ #include "BattleArena.h" #include "xmas_event.h" #include "log.h" -#include "pcbang.h" #include "threeway_war.h" #include "unique_item.h" #include "DragonSoul.h" @@ -82,52 +81,6 @@ void Command_ApplyAffect(LPCHARACTER ch, const char* argument, const char* affec } // END_OF_ADD_COMMAND_SLOW_STUN -ACMD(do_pcbang_update) -{ - char arg1[256]; - one_argument(argument, arg1, sizeof(arg1)); - - unsigned int PCBangID = 0; - - if (*arg1 == '\0') - PCBangID = 0; - else - str_to_number(PCBangID, arg1); - - if (PCBangID == 0) - { - CPCBangManager::instance().RequestUpdateIPList(0); - ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For All"); - } - else - { - CPCBangManager::instance().RequestUpdateIPList(PCBangID); - ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For %u", PCBangID); - } - - TPacketPCBangUpdate packet; - packet.bHeader = HEADER_GG_PCBANG_UPDATE; - packet.ulPCBangID = PCBangID; - - P2P_MANAGER::instance().Send(&packet, sizeof(TPacketPCBangUpdate)); - -} - -ACMD(do_pcbang_check) -{ - char arg1[256]; - one_argument(argument, arg1, sizeof(arg1)); - - if (CPCBangManager::instance().IsPCBangIP(arg1) == true) - { - ch->ChatPacket(CHAT_TYPE_INFO, "%s is a PCBang IP", arg1); - } - else - { - ch->ChatPacket(CHAT_TYPE_INFO, "%s is not a PCBang IP", arg1); - } -} - ACMD(do_stun) { Command_ApplyAffect(ch, argument, "stun", COMMANDAFFECT_STUN); diff --git a/src/game/src/constants.cpp b/src/game/src/constants.cpp index 9ca411e..da892bd 100644 --- a/src/game/src/constants.cpp +++ b/src/game/src/constants.cpp @@ -893,6 +893,7 @@ const TApplyInfo aApplyInfo[MAX_APPLY_NUM] = { POINT_NORMAL_HIT_DEFEND_BONUS }, // 74 // END_OF_DEFEND_BONUS_ATTRIBUTES + // TODO: check if these can be safely removed // PC_BANG_ITEM_ADD { POINT_PC_BANG_EXP_BONUS }, // 75 { POINT_PC_BANG_DROP_BONUS }, // 76 diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index 925de5f..54d3f4e 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -17,7 +17,6 @@ #include "log.h" #include "login_data.h" #include "locale_service.h" -#include "pcbang.h" #include "spam.h" extern std::string g_stBlockDate; @@ -996,73 +995,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) break; // END_OF_BLOCK_CHAT - // PCBANG_IP_LIST - case QID_PCBANG_IP_LIST_CHECK: - { - const std::string PCBANG_IP_TABLE_NAME("pcbang_ip"); - - if (pMsg->Get()->uiNumRows > 0) - { - MYSQL_ROW row; - bool isFinded = false; - - while ((row = mysql_fetch_row(pMsg->Get()->pSQLResult))) - { - const char* c_szName = row[0]; - const char* c_szUpdateTime = row[12]; - - SPDLOG_TRACE("{}:{}", c_szName, c_szUpdateTime); - - if (PCBANG_IP_TABLE_NAME == c_szName) - { - isFinded = true; - - static std::string s_stLastTime; - if (s_stLastTime != c_szUpdateTime) - { - s_stLastTime = c_szUpdateTime; - SPDLOG_DEBUG("'{}' mysql table is UPDATED({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime); - ReturnQuery(QID_PCBANG_IP_LIST_SELECT, 0, NULL, "SELECT pcbang_id, ip FROM %s;", PCBANG_IP_TABLE_NAME.c_str()); - } - else - { - SPDLOG_DEBUG("'{}' mysql table is NOT updated({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime); - } - break; - } - } - - if (!isFinded) - { - SPDLOG_ERROR("'{}' mysql table CANNOT FIND", PCBANG_IP_TABLE_NAME); - } - } - else if (test_server) - { - SPDLOG_ERROR("'{}' mysql table is NOT EXIST", PCBANG_IP_TABLE_NAME); - } - } - break; - - case QID_PCBANG_IP_LIST_SELECT: - { - if (pMsg->Get()->uiNumRows > 0) - { - MYSQL_ROW row; - - while ((row = mysql_fetch_row(pMsg->Get()->pSQLResult))) - { - CPCBangManager::instance().InsertIP(row[0], row[1]); - } - } - else - SPDLOG_TRACE("PCBANG_IP_LIST is EMPTY"); - } - break; - - - // END_OF_PCBANG_IP_LIST - default: SPDLOG_ERROR("FATAL ERROR!!! Unhandled return query id {}", qi->iType); break; diff --git a/src/game/src/db.h b/src/game/src/db.h index 99d0031..650ee33 100644 --- a/src/game/src/db.h +++ b/src/game/src/db.h @@ -23,11 +23,6 @@ enum QID_BLOCK_CHAT_LIST, // END_OF_BLOCK_CHAT - // PCBANG_IP_LIST - QID_PCBANG_IP_LIST_CHECK, - QID_PCBANG_IP_LIST_SELECT, - // END_OF_PCBANG_IP_LIST - // PROTECT_CHILD_FOR_NEWCIBN QID_PROTECT_CHILD, // END_PROTECT_CHILD_FOR_NEWCIBN diff --git a/src/game/src/input.h b/src/game/src/input.h index 9bc3f48..33a117e 100644 --- a/src/game/src/input.h +++ b/src/game/src/input.h @@ -323,7 +323,6 @@ class CInputP2P : public CInputProcessor void XmasWarpSantaReply(const char * c_pData); void LoginPing(LPDESC d, const char * c_pData); void BlockChat(const char * c_pData); - void PCBangUpdate(const char* c_pData); void IamAwake(LPDESC d, const char * c_pData); protected: diff --git a/src/game/src/input_db.cpp b/src/game/src/input_db.cpp index 9fa1dd4..6204ca5 100644 --- a/src/game/src/input_db.cpp +++ b/src/game/src/input_db.cpp @@ -38,7 +38,6 @@ #include "log.h" #include "horsename_manager.h" -#include "pcbang.h" #include "gm.h" #include "panama.h" #include "map_location.h" @@ -420,11 +419,6 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data) { LogManager::instance().LoginLog(true, ch->GetDesc()->GetAccountTable().id, ch->GetPlayerID(), ch->GetLevel(), ch->GetJob(), ch->GetRealPoint(POINT_PLAYTIME)); - - if (LC_IsBrazil() != true ) - { - ch->SetPCBang(CPCBangManager::instance().IsPCBangIP(ch->GetDesc()->GetHostName())); - } } } @@ -997,8 +991,6 @@ void CInputDB::Boot(const char* data) CMobManager::instance().DumpRegenCount("mob_count"); } - CPCBangManager::instance().RequestUpdateIPList(0); - // castle_boot castle_boot(); } diff --git a/src/game/src/input_p2p.cpp b/src/game/src/input_p2p.cpp index b522058..d408f50 100644 --- a/src/game/src/input_p2p.cpp +++ b/src/game/src/input_p2p.cpp @@ -17,7 +17,6 @@ #include "castle.h" #include "locale_service.h" #include "questmanager.h" -#include "pcbang.h" #include "skill.h" #include "threeway_war.h" @@ -396,13 +395,6 @@ void CInputP2P::BlockChat(const char * c_pData) // END_OF_BLOCK_CHAT // -void CInputP2P::PCBangUpdate(const char* c_pData) -{ - TPacketPCBangUpdate* p = (TPacketPCBangUpdate*)c_pData; - - CPCBangManager::instance().RequestUpdateIPList(p->ulPCBangID); -} - void CInputP2P::IamAwake(LPDESC d, const char * c_pData) { std::string hostNames; @@ -522,10 +514,6 @@ int CInputP2P::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) MonarchTransfer(d, c_pData); break; - case HEADER_GG_PCBANG_UPDATE : - PCBangUpdate(c_pData); - break; - case HEADER_GG_CHECK_AWAKENESS: IamAwake(d, c_pData); break; diff --git a/src/game/src/item.cpp b/src/game/src/item.cpp index 116b996..3531419 100644 --- a/src/game/src/item.cpp +++ b/src/game/src/item.cpp @@ -1831,18 +1831,6 @@ bool CItem::CanPutInto(LPITEM item) return 50623 + type == GetVnum(); } -// PC_BANG_ITEM_ADD -bool CItem::IsPCBangItem() -{ - for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) - { - if (m_pProto->aLimits[i].bType == LIMIT_PCBANG) - return true; - } - return false; -} -// END_PC_BANG_ITEM_ADD - bool CItem::CheckItemUseLevel(int nLevel) { for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) diff --git a/src/game/src/item.h b/src/game/src/item.h index 063ef4c..ed8b14a 100644 --- a/src/game/src/item.h +++ b/src/game/src/item.h @@ -18,8 +18,6 @@ class CItem : public CEntity bool CheckItemUseLevel(int nLevel); - bool IsPCBangItem(); - int FindApplyValue(BYTE bApplyType); bool IsStackable() { return (GetFlag() & ITEM_FLAG_STACKABLE)?true:false; } diff --git a/src/game/src/item_manager.cpp b/src/game/src/item_manager.cpp index 90e0d53..9c388ba 100644 --- a/src/game/src/item_manager.cpp +++ b/src/game/src/item_manager.cpp @@ -817,14 +817,6 @@ bool ITEM_MANAGER::GetDropPct(LPCHARACTER pkChr, LPCHARACTER pkKiller, OUT int& iDeltaPercent += iDeltaPercent; // END_OF_ADD_PREMIUM - // PC_BANG_ITEM_ADD - if (pkKiller->GetPoint(POINT_PC_BANG_DROP_BONUS) > 0) - { - if (pkKiller->IsPCBang() == true) - iDeltaPercent += iDeltaPercent * pkKiller->GetPoint(POINT_PC_BANG_DROP_BONUS)/100; - } - // END_PC_BANG_ITEM_ADD - iRandRange = 4000000; iRandRange = iRandRange * 100 / (100 + diff --git a/src/game/src/log.cpp b/src/game/src/log.cpp index f462170..08cf4a7 100644 --- a/src/game/src/log.cpp +++ b/src/game/src/log.cpp @@ -128,12 +128,6 @@ void LogManager::HackCRCLog(const char * c_pszHackName, const char * c_pszLogin, Query("INSERT INTO hack_crc_log (time, login, name, ip, server, why, crc) VALUES(NOW(), '%s', '%s', '%s', '%s', '%s', %u)", c_pszLogin, c_pszName, c_pszIP, g_stHostname.c_str(), c_pszHackName, dwCRC); } -void LogManager::PCBangLoginLog(DWORD dwPCBangID, const char* c_szPCBangIP, DWORD dwPlayerID, DWORD dwPlayTime) -{ - Query("INSERT INTO pcbang_loginlog (time, pcbang_id, ip, pid, play_time) VALUES (NOW(), %u, '%s', %u, %u)", - dwPCBangID, c_szPCBangIP, dwPlayerID, dwPlayTime); -} - void LogManager::GoldBarLog(DWORD dwPID, DWORD dwItemID, GOLDBAR_HOW eHow, const char* c_pszHint) { char szHow[32+1]; diff --git a/src/game/src/log.h b/src/game/src/log.h index f5a119c..cf8bb98 100644 --- a/src/game/src/log.h +++ b/src/game/src/log.h @@ -38,7 +38,6 @@ class LogManager : public singleton void HackLog(const char * c_pszHackName, LPCHARACTER ch); void HackCRCLog(const char * c_pszHackName, const char * c_pszLogin, const char * c_pszName, const char * c_pszIP, DWORD dwCRC); void GoldBarLog(DWORD dwPID, DWORD dwItemID, GOLDBAR_HOW eHow, const char * c_pszHint); - void PCBangLoginLog(DWORD dwPCBangID, const char * c_szPCBangIP, DWORD dwPlayerID, DWORD dwPlayTime); void CubeLog(DWORD dwPID, DWORD x, DWORD y, DWORD item_vnum, DWORD item_uid, int item_count, bool success); void GMCommandLog(DWORD dwPID, const char * szName, const char * szIP, BYTE byChannel, const char * szCommand); void SpeedHackLog(DWORD pid, DWORD x, DWORD y, int hack_count); diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index 7380068..71dc5d4 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -49,7 +49,6 @@ #include "BattleArena.h" #include "over9refine.h" #include "horsename_manager.h" -#include "pcbang.h" #include "MarkManager.h" #include "spam.h" #include "panama.h" @@ -366,7 +365,6 @@ int main(int argc, char **argv) COXEventManager OXEvent_manager; CMonarch Monarch; CHorseNameManager horsename_manager; - CPCBangManager pcbang_manager; DESC_MANAGER desc_manager; diff --git a/src/game/src/packet.h b/src/game/src/packet.h index f906ad9..d33ecf0 100644 --- a/src/game/src/packet.h +++ b/src/game/src/packet.h @@ -306,7 +306,6 @@ enum HEADER_GG_SIEGE = 25, HEADER_GG_MONARCH_NOTICE = 26, HEADER_GG_MONARCH_TRANSFER = 27, - HEADER_GG_PCBANG_UPDATE = 28, HEADER_GG_CHECK_AWAKENESS = 29, }; @@ -2130,12 +2129,6 @@ typedef struct SPacketGGMonarchTransfer LONG y; } TPacketMonarchGGTransfer; -typedef struct SPacketGGPCBangUpdate -{ - BYTE bHeader; - ULONG ulPCBangID; -} TPacketPCBangUpdate; - typedef struct SPacketGGCheckAwakeness { BYTE bHeader; diff --git a/src/game/src/packet_info.cpp b/src/game/src/packet_info.cpp index 2ee3fb4..874dbaf 100644 --- a/src/game/src/packet_info.cpp +++ b/src/game/src/packet_info.cpp @@ -258,7 +258,6 @@ CPacketInfoGG::CPacketInfoGG() Set(HEADER_GG_MONARCH_NOTICE, sizeof(TPacketGGMonarchNotice), "MonarchNotice", false); Set(HEADER_GG_MONARCH_TRANSFER, sizeof(TPacketMonarchGGTransfer), "MonarchTransfer", false); - Set(HEADER_GG_PCBANG_UPDATE, sizeof(TPacketPCBangUpdate), "PCBangUpdate", false); Set(HEADER_GG_CHECK_AWAKENESS, sizeof(TPacketGGCheckAwakeness), "CheckAwakeness", false); } diff --git a/src/game/src/pcbang.cpp b/src/game/src/pcbang.cpp deleted file mode 100644 index a5593c5..0000000 --- a/src/game/src/pcbang.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "stdafx.h" -#include "constants.h" -#include "config.h" -#include "locale_service.h" -#include "log.h" -#include "db.h" -#include "pcbang.h" - -CPCBangManager::CPCBangManager() -{ - m_minSavablePlayTime = 10; - m_map_ip.clear(); -} - -void CPCBangManager::InsertIP(const char* c_szID, const char* c_szIP) -{ - PCBang_IP ip = __GetIPFromString(c_szIP); - PCBang_ID id = __GetIDFromString(c_szID); - - m_map_ip.insert(std::map::value_type(ip, id)); -} - -bool CPCBangManager::Log(const char* c_szIP, DWORD pid, time_t playTime) -{ - if (playTime < m_minSavablePlayTime) - { - return false; - } - - std::map::iterator f = m_map_ip.find(__GetIPFromString(c_szIP)); - - if (m_map_ip.end() == f) - { - return false; - } - - LogManager::instance().PCBangLoginLog(f->second, c_szIP, pid, playTime); - - return true; -} - -void CPCBangManager::RequestUpdateIPList(PCBang_ID id) -{ - if ( LC_IsYMIR() == true || LC_IsKorea() == true ) - { - if ( id == 0 ) - { - DBManager::instance().ReturnQuery(QID_PCBANG_IP_LIST_CHECK, 0, NULL, "show table status"); - } - else - { - DBManager::instance().ReturnQuery(QID_PCBANG_IP_LIST_SELECT, 0, NULL, "SELECT pcbang_id, ip FROM pcbang_ip WHERE pcbang_id=%u", id); - } - } -} - -bool CPCBangManager::IsPCBangIP(const char* c_szIP) -{ - if (!c_szIP) - return false; - - PCBang_IP ip = __GetIPFromString(c_szIP); - std::map::iterator f = m_map_ip.find(ip); - - if (m_map_ip.end() == f) - return false; - - return true; -} - -PCBang_ID CPCBangManager::__GetIDFromString(const char* c_szID) -{ - PCBang_ID id = 0; - str_to_number(id, c_szID); - return id; -} - -PCBang_IP CPCBangManager::__GetIPFromString(const char* c_szIP) -{ - int nums[4]; - sscanf(c_szIP, "%d.%d.%d.%d", nums+0, nums+1, nums+2, nums+3); - - return (nums[0]<<24)|(nums[1]<<16)|(nums[2]<<8)|nums[3]; -} - diff --git a/src/game/src/pcbang.h b/src/game/src/pcbang.h deleted file mode 100644 index d6ebd91..0000000 --- a/src/game/src/pcbang.h +++ /dev/null @@ -1,26 +0,0 @@ - -typedef unsigned int PCBang_IP; -typedef unsigned int PCBang_ID; - -class CPCBangManager : public singleton -{ - private: - std::map m_map_ip; - - time_t m_minSavablePlayTime; - - PCBang_ID __GetIDFromString(const char* c_szID); - PCBang_IP __GetIPFromString(const char* c_szIP); - - public: - CPCBangManager(); - - void InsertIP(const char* c_szID, const char* c_szIP); - - bool Log(const char* c_szIP, DWORD pid, time_t playTime); - - void RequestUpdateIPList(PCBang_ID id); - - bool IsPCBangIP(const char* c_szIP); -}; - From 01cc27a7df23c6e672da8791c3dcd963fed5d602 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 19:58:21 +0200 Subject: [PATCH 06/10] Removed Billing/VCard --- src/common/billing.h | 15 - src/common/tables.h | 42 +-- src/db/src/ClientManager.cpp | 211 +----------- src/db/src/ClientManager.h | 12 - src/db/src/ClientManagerLogin.cpp | 1 - src/db/src/ClientManagerPlayer.cpp | 2 - src/db/src/LoginData.cpp | 2 - src/db/src/LoginData.h | 8 - src/game/src/char_item.cpp | 5 - src/game/src/config.cpp | 7 - src/game/src/config.h | 1 - src/game/src/db.cpp | 506 +---------------------------- src/game/src/db.h | 24 +- src/game/src/desc.cpp | 12 - src/game/src/desc.h | 4 - src/game/src/desc_client.cpp | 1 - src/game/src/exchange.cpp | 6 - src/game/src/input.h | 6 - src/game/src/input_db.cpp | 159 --------- src/game/src/input_p2p.cpp | 5 +- src/game/src/log.cpp | 6 - src/game/src/log.h | 1 - src/game/src/login_data.cpp | 53 --- src/game/src/login_data.h | 16 - src/game/src/main.cpp | 7 - src/game/src/shop.cpp | 40 +-- 26 files changed, 26 insertions(+), 1126 deletions(-) delete mode 100644 src/common/billing.h diff --git a/src/common/billing.h b/src/common/billing.h deleted file mode 100644 index 807c0cc..0000000 --- a/src/common/billing.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __INC_METIN_II_COMMON_BILLING_H__ -#define __INC_METIN_II_COMMON_BILLING_H__ - -enum EBillingTypes -{ - BILLING_NONE, - BILLING_IP_FREE, - BILLING_FREE, - BILLING_IP_TIME, - BILLING_IP_DAY, - BILLING_TIME, - BILLING_DAY, -}; - -#endif diff --git a/src/common/tables.h b/src/common/tables.h index 9e63d64..2a6663d 100644 --- a/src/common/tables.h +++ b/src/common/tables.h @@ -98,9 +98,6 @@ enum HEADER_GD_AUTH_LOGIN = 100, HEADER_GD_LOGIN_BY_KEY = 101, - HEADER_GD_BILLING_EXPIRE = 104, - HEADER_GD_VCARD = 105, - HEADER_GD_BILLING_CHECK = 106, HEADER_GD_MALL_LOAD = 107, HEADER_GD_MYSHOP_PRICELIST_UPDATE = 108, ///< °¡°ÝÁ¤º¸ °»½Å ¿äû @@ -229,12 +226,6 @@ enum HEADER_DG_CHANGE_CHARACTER_PRIV = 127, - HEADER_DG_BILLING_REPAIR = 128, - HEADER_DG_BILLING_EXPIRE = 129, - HEADER_DG_BILLING_LOGIN = 130, - HEADER_DG_VCARD = 131, - HEADER_DG_BILLING_CHECK = 132, - HEADER_DG_CREATE_OBJECT = 140, HEADER_DG_DELETE_OBJECT = 141, HEADER_DG_UPDATE_LAND = 142, @@ -1013,9 +1004,7 @@ typedef struct SPacketGDAuthLogin char szLogin[LOGIN_MAX_LEN + 1]; char szSocialID[SOCIAL_ID_MAX_LEN + 1]; DWORD adwClientKey[4]; - BYTE bBillType; - DWORD dwBillID; - DWORD iPremiumTimes[PREMIUM_MAX_NUM]; + DWORD iPremiumTimes[PREMIUM_MAX_NUM]; } TPacketGDAuthLogin; typedef struct SPacketGDLoginByKey @@ -1127,26 +1116,6 @@ typedef struct SPacketSetEventFlag LONG lValue; } TPacketSetEventFlag; -typedef struct SPacketBillingLogin -{ - DWORD dwLoginKey; - BYTE bLogin; -} TPacketBillingLogin; - -typedef struct SPacketBillingRepair -{ - DWORD dwLoginKey; - char szLogin[LOGIN_MAX_LEN + 1]; - char szHost[MAX_HOST_LENGTH + 1]; -} TPacketBillingRepair; - -typedef struct SPacketBillingExpire -{ - char szLogin[LOGIN_MAX_LEN + 1]; - BYTE bBillType; - DWORD dwRemainSeconds; -} TPacketBillingExpire; - typedef struct SPacketLoginOnSetup { DWORD dwID; @@ -1174,15 +1143,6 @@ typedef struct SPacketGDHammerOfTor DWORD delay; } TPacketGDHammerOfTor; -typedef struct SPacketGDVCard -{ - DWORD dwID; - char szSellCharacter[CHARACTER_NAME_MAX_LEN + 1]; - char szSellAccount[LOGIN_MAX_LEN + 1]; - char szBuyCharacter[CHARACTER_NAME_MAX_LEN + 1]; - char szBuyAccount[LOGIN_MAX_LEN + 1]; -} TPacketGDVCard; - typedef struct SGuildReserve { DWORD dwID; diff --git a/src/db/src/ClientManager.cpp b/src/db/src/ClientManager.cpp index c5a2697..1ed17d6 100644 --- a/src/db/src/ClientManager.cpp +++ b/src/db/src/ClientManager.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" -#include #include #include #include "../../libgame/include/grid.h" @@ -1143,7 +1142,6 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD SPDLOG_DEBUG("AUTH_PEER ptr {}", (void*) peer); m_pkAuthPeer = peer; - SendAllLoginToBilling(); return; } @@ -1286,10 +1284,9 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD } // - // ·Î±×ÀÎ ¹× ºô¸µÁ¤º¸ º¸³»±â + // Log in the player // - TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData;; - std::vector vec_repair; + TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData; for (DWORD c = 0; c < p->dwLoginCount; ++c, ++pck) { @@ -1312,29 +1309,11 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD { SPDLOG_DEBUG("SETUP: login {} {} login_key {} host {}", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost); pkLD->SetPlay(true); - - if (m_pkAuthPeer) - { - TPacketBillingRepair pck_repair; - pck_repair.dwLoginKey = pkLD->GetKey(); - strlcpy(pck_repair.szLogin, pck->szLogin, sizeof(pck_repair.szLogin)); - strlcpy(pck_repair.szHost, pck->szHost, sizeof(pck_repair.szHost)); - vec_repair.push_back(pck_repair); - } } else SPDLOG_DEBUG("SETUP: login_fail {} {} login_key {}", pck->dwID, pck->szLogin, pck->dwLoginKey); } - if (m_pkAuthPeer && !vec_repair.empty()) - { - SPDLOG_DEBUG("REPAIR size {}", vec_repair.size()); - - m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_REPAIR, 0, sizeof(DWORD) + sizeof(TPacketBillingRepair) * vec_repair.size()); - m_pkAuthPeer->EncodeDWORD(vec_repair.size()); - m_pkAuthPeer->Encode(&vec_repair[0], sizeof(TPacketBillingRepair) * vec_repair.size()); - } - SendPartyOnSetup(peer); CGuildManager::instance().OnSetup(peer); CPrivManager::instance().SendPrivOnSetup(peer); @@ -1843,8 +1822,6 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA pkLD->SetKey(p->dwLoginKey); pkLD->SetClientKey(p->adwClientKey); - pkLD->SetBillType(p->bBillType); - pkLD->SetBillID(p->dwBillID); pkLD->SetPremium(p->iPremiumTimes); TAccountTable & r = pkLD->GetAccountRef(); @@ -1867,109 +1844,6 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA } } -void CClientManager::BillingExpire(TPacketBillingExpire * p) -{ - char key[LOGIN_MAX_LEN + 1]; - trim_and_lower(p->szLogin, key, sizeof(key)); - - switch (p->bBillType) - { - case BILLING_IP_TIME: - case BILLING_IP_DAY: - { - DWORD dwIPID = 0; - str_to_number(dwIPID, p->szLogin); - - TLogonAccountMap::iterator it = m_map_kLogonAccount.begin(); - - while (it != m_map_kLogonAccount.end()) - { - CLoginData * pkLD = (it++)->second; - - if (pkLD->GetBillID() == dwIPID) - { - CPeer * pkPeer = GetPeer(pkLD->GetConnectedPeerHandle()); - - if (pkPeer) - { - strlcpy(p->szLogin, pkLD->GetAccountRef().login, sizeof(p->szLogin)); - pkPeer->EncodeHeader(HEADER_DG_BILLING_EXPIRE, 0, sizeof(TPacketBillingExpire)); - pkPeer->Encode(p, sizeof(TPacketBillingExpire)); - } - } - } - } - break; - - case BILLING_TIME: - case BILLING_DAY: - { - TLogonAccountMap::iterator it = m_map_kLogonAccount.find(key); - - if (it != m_map_kLogonAccount.end()) - { - CLoginData * pkLD = it->second; - - CPeer * pkPeer = GetPeer(pkLD->GetConnectedPeerHandle()); - - if (pkPeer) - { - pkPeer->EncodeHeader(HEADER_DG_BILLING_EXPIRE, 0, sizeof(TPacketBillingExpire)); - pkPeer->Encode(p, sizeof(TPacketBillingExpire)); - } - } - } - break; - } -} - -void CClientManager::BillingCheck(const char * data) -{ - if (!m_pkAuthPeer) - return; - - time_t curTime = GetCurrentTime(); - - DWORD dwCount = *(DWORD *) data; - data += sizeof(DWORD); - - std::vector vec; - - SPDLOG_DEBUG("BillingCheck: size {}", dwCount); - - for (DWORD i = 0; i < dwCount; ++i) - { - DWORD dwKey = *(DWORD *) data; - data += sizeof(DWORD); - - SPDLOG_DEBUG("BillingCheck: {}", dwKey); - - TLoginDataByLoginKey::iterator it = m_map_pkLoginData.find(dwKey); - - if (it == m_map_pkLoginData.end()) - { - SPDLOG_DEBUG("BillingCheck: key not exist: {}", dwKey); - vec.push_back(dwKey); - } - else - { - CLoginData * pkLD = it->second; - - if (!pkLD->IsPlay() && curTime - pkLD->GetLastPlayTime() > 180) - { - SPDLOG_DEBUG("BillingCheck: not login: {}", dwKey); - vec.push_back(dwKey); - } - } - } - - m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_CHECK, 0, sizeof(DWORD) + sizeof(DWORD) * vec.size()); - m_pkAuthPeer->EncodeDWORD(vec.size()); - - if (!vec.empty()) - m_pkAuthPeer->Encode(&vec[0], sizeof(DWORD) * vec.size()); -} - void CClientManager::GuildDepositMoney(TPacketGDGuildMoney* p) { CGuildManager::instance().DepositMoney(p->dwGuild, p->iGold); @@ -1990,51 +1864,6 @@ void CClientManager::GuildWarBet(TPacketGDGuildWarBet * p) CGuildManager::instance().Bet(p->dwWarID, p->szLogin, p->dwGold, p->dwGuild); } -void CClientManager::SendAllLoginToBilling() -{ - if (!m_pkAuthPeer) - return; - - std::vector vec; - TPacketBillingRepair p; - - TLogonAccountMap::iterator it = m_map_kLogonAccount.begin(); - - while (it != m_map_kLogonAccount.end()) - { - CLoginData * pkLD = (it++)->second; - - p.dwLoginKey = pkLD->GetKey(); - strlcpy(p.szLogin, pkLD->GetAccountRef().login, sizeof(p.szLogin)); - strlcpy(p.szHost, pkLD->GetIP(), sizeof(p.szHost)); - SPDLOG_DEBUG("SendAllLoginToBilling {} {}", pkLD->GetAccountRef().login, pkLD->GetIP()); - vec.push_back(p); - } - - if (!vec.empty()) - { - m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_REPAIR, 0, sizeof(DWORD) + sizeof(TPacketBillingRepair) * vec.size()); - m_pkAuthPeer->EncodeDWORD(vec.size()); - m_pkAuthPeer->Encode(&vec[0], sizeof(TPacketBillingRepair) * vec.size()); - } -} - -void CClientManager::SendLoginToBilling(CLoginData * pkLD, bool bLogin) -{ - if (!m_pkAuthPeer) - return; - - TPacketBillingLogin p; - - p.dwLoginKey = pkLD->GetKey(); - p.bLogin = bLogin ? 1 : 0; - - DWORD dwCount = 1; - m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_LOGIN, 0, sizeof(DWORD) + sizeof(TPacketBillingLogin)); - m_pkAuthPeer->EncodeDWORD(dwCount); - m_pkAuthPeer->Encode(&p, sizeof(TPacketBillingLogin)); -} - void CClientManager::CreateObject(TPacketGDCreateObject * p) { using namespace building; @@ -2124,28 +1953,6 @@ void CClientManager::UpdateLand(DWORD * pdw) ForwardPacket(HEADER_DG_UPDATE_LAND, p, sizeof(building::TLand)); } -void CClientManager::VCard(TPacketGDVCard * p) -{ - SPDLOG_DEBUG("VCARD: {} {} {} {} {}", - p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount); - - m_queue_vcard.push(*p); -} - -void CClientManager::VCardProcess() -{ - if (!m_pkAuthPeer) - return; - - while (!m_queue_vcard.empty()) - { - m_pkAuthPeer->EncodeHeader(HEADER_DG_VCARD, 0, sizeof(TPacketGDVCard)); - m_pkAuthPeer->Encode(&m_queue_vcard.front(), sizeof(TPacketGDVCard)); - - m_queue_vcard.pop(); - } -} - // BLOCK_CHAT void CClientManager::BlockChat(TPacketBlockChat* p) { @@ -2551,14 +2358,6 @@ void CClientManager::ProcessPackets(CPeer * peer) SetEventFlag((TPacketSetEventFlag*) data); break; - case HEADER_GD_BILLING_EXPIRE: - BillingExpire((TPacketBillingExpire *) data); - break; - - case HEADER_GD_BILLING_CHECK: - BillingCheck(data); - break; - case HEADER_GD_CREATE_OBJECT: CreateObject((TPacketGDCreateObject *) data); break; @@ -2571,10 +2370,6 @@ void CClientManager::ProcessPackets(CPeer * peer) UpdateLand((DWORD *) data); break; - case HEADER_GD_VCARD: - VCard((TPacketGDVCard *) data); - break; - case HEADER_GD_MARRIAGE_ADD: MarriageAdd((TPacketMarriageAdd *) data); break; @@ -2802,7 +2597,6 @@ void CClientManager::RemovePeer(CPeer * pPeer) if (pkLD->IsPlay()) { pkLD->SetPlay(false); - SendLoginToBilling(pkLD, false); } if (pkLD->IsDeleted()) @@ -3163,7 +2957,6 @@ int CClientManager::Process() // Process network events event_base_loop(m_base, EVLOOP_NONBLOCK); - VCardProcess(); return 1; } diff --git a/src/db/src/ClientManager.h b/src/db/src/ClientManager.h index 21c84bd..3b9d0bf 100644 --- a/src/db/src/ClientManager.h +++ b/src/db/src/ClientManager.h @@ -344,12 +344,6 @@ class CClientManager : public singleton void SetEventFlag(TPacketSetEventFlag* p); void SendEventFlagsOnSetup(CPeer* peer); - void BillingExpire(TPacketBillingExpire * p); - void BillingCheck(const char * data); - - void SendAllLoginToBilling(); - void SendLoginToBilling(CLoginData * pkLD, bool bLogin); - // °áÈ¥ void MarriageAdd(TPacketMarriageAdd * p); void MarriageUpdate(TPacketMarriageUpdate * p); @@ -382,10 +376,6 @@ class CClientManager : public singleton void DeleteObject(DWORD dwID); void UpdateLand(DWORD * pdw); - // VCard - void VCard(TPacketGDVCard * p); - void VCardProcess(); - // BLOCK_CHAT void BlockChat(TPacketBlockChat * p); // END_OF_BLOCK_CHAT @@ -438,8 +428,6 @@ class CClientManager : public singleton std::vector m_vec_kObjectProto; std::map m_map_pkObjectTable; - std::queue m_queue_vcard; - bool m_bShutdowned; TPlayerTableCacheMap m_map_playerCache; // Ç÷¹À̾î id°¡ key diff --git a/src/db/src/ClientManagerLogin.cpp b/src/db/src/ClientManagerLogin.cpp index 280dc4e..182d8d3 100644 --- a/src/db/src/ClientManagerLogin.cpp +++ b/src/db/src/ClientManagerLogin.cpp @@ -55,7 +55,6 @@ bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle) if (pkLD->IsPlay()) { pkLD->SetPlay(false); - SendLoginToBilling(pkLD, false); } if (pkLD->IsDeleted()) diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index e534924..55f4bd5 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -237,7 +237,6 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad pTab = c->Get(); pkLD->SetPlay(true); - SendLoginToBilling(pkLD, true); memcpy(pTab->aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(pTab->aiPremiumTimes)); peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, dwHandle, sizeof(TPlayerTable)); @@ -643,7 +642,6 @@ void CClientManager::RESULT_PLAYER_LOAD(CPeer * peer, MYSQL_RES * pRes, ClientHa } pkLD->SetPlay(true); - SendLoginToBilling(pkLD, true); memcpy(tab.aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(tab.aiPremiumTimes)); peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, pkInfo->dwHandle, sizeof(TPlayerTable)); diff --git a/src/db/src/LoginData.cpp b/src/db/src/LoginData.cpp index dbcec54..5ef328c 100644 --- a/src/db/src/LoginData.cpp +++ b/src/db/src/LoginData.cpp @@ -11,8 +11,6 @@ CLoginData::CLoginData() memset(m_szIP, 0, sizeof(m_szIP)); m_bPlay = false; m_bDeleted = false; - m_bBillType = 0; - m_dwBillID = 0; m_lastPlayTime = 0; m_dwLastPlayerID = 0; diff --git a/src/db/src/LoginData.h b/src/db/src/LoginData.h index 9c6c085..debd493 100644 --- a/src/db/src/LoginData.h +++ b/src/db/src/LoginData.h @@ -29,12 +29,6 @@ class CLoginData void SetDeleted(bool bSet); bool IsDeleted(); - void SetBillID(DWORD id) { m_dwBillID = id; } - DWORD GetBillID() { return m_dwBillID; } - - void SetBillType(BYTE type) { m_bBillType = type; } - BYTE GetBillType() { return m_bBillType; } - time_t GetLastPlayTime() { return m_lastPlayTime; } void SetPremium(DWORD * paiPremiumTimes); @@ -53,8 +47,6 @@ class CLoginData bool m_bPlay; bool m_bDeleted; - BYTE m_bBillType; - DWORD m_dwBillID; time_t m_lastPlayTime; DWORD m_aiPremiumTimes[PREMIUM_MAX_NUM]; diff --git a/src/game/src/char_item.cpp b/src/game/src/char_item.cpp index 01a9b60..d449dbd 100644 --- a/src/game/src/char_item.cpp +++ b/src/game/src/char_item.cpp @@ -3748,11 +3748,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) item->SetCount(item->GetCount()-1); break; - case 90008: // VCARD - case 90009: // VCARD - VCardUse(this, this, item); - break; - case ITEM_ELK_VNUM: // µ·²Ù·¯¹Ì { int iGold = item->GetSocket(0); diff --git a/src/game/src/config.cpp b/src/game/src/config.cpp index 0818d29..59334a1 100644 --- a/src/game/src/config.cpp +++ b/src/game/src/config.cpp @@ -75,8 +75,6 @@ BYTE g_bAuthServer = false; bool g_bCheckClientVersion = true; string g_stClientVersion = "1215955205"; -BYTE g_bBilling = false; - string g_stAuthMasterIP; WORD g_wAuthMasterPort = 0; @@ -913,11 +911,6 @@ void config_init(const string& st_localeServiceName) continue; } - TOKEN("billing") - { - g_bBilling = true; - } - TOKEN("quest_dir") { SPDLOG_INFO("QUEST_DIR SETTING : {}", value_string); diff --git a/src/game/src/config.h b/src/game/src/config.h index 685b95a..37dfecb 100644 --- a/src/game/src/config.h +++ b/src/game/src/config.h @@ -64,7 +64,6 @@ extern void LoadStateUserCount(); extern bool g_bEmpireWhisper; extern BYTE g_bAuthServer; -extern BYTE g_bBilling; extern BYTE PK_PROTECT_LEVEL; diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index 54d3f4e..fb6de80 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include -#include #include #include "db.h" @@ -158,260 +157,10 @@ void DBManager::DeleteLoginData(CLoginData * pkLD) SPDLOG_DEBUG("DeleteLoginData {} {}", pkLD->GetLogin(), (void*) pkLD); - mapLDBilling.erase(pkLD->GetLogin()); - M2_DELETE(it->second); m_map_pkLoginData.erase(it); } -void DBManager::SetBilling(DWORD dwKey, bool bOn, bool bSkipPush) -{ - std::map::iterator it = m_map_pkLoginData.find(dwKey); - - if (it == m_map_pkLoginData.end()) - { - SPDLOG_ERROR("cannot find login key {}", dwKey); - return; - } - - CLoginData * ld = it->second; - - itertype(mapLDBilling) it2 = mapLDBilling.find(ld->GetLogin()); - - if (it2 != mapLDBilling.end()) - if (it2->second != ld) - DeleteLoginData(it2->second); - - mapLDBilling.insert(std::make_pair(ld->GetLogin(), ld)); - - if (ld->IsBilling() && !bOn && !bSkipPush) - PushBilling(ld); - - SendLoginPing(ld->GetLogin()); - ld->SetBilling(bOn); -} - -void DBManager::PushBilling(CLoginData * pkLD) -{ - TUseTime t; - - t.dwUseSec = (get_dword_time() - pkLD->GetLogonTime()) / 1000; - - if (t.dwUseSec <= 0) - return; - - pkLD->SetLogonTime(); - int lRemainSecs = pkLD->GetRemainSecs() - t.dwUseSec; - pkLD->SetRemainSecs(std::max(0, lRemainSecs)); - - t.dwLoginKey = pkLD->GetKey(); - t.bBillType = pkLD->GetBillType(); - - SPDLOG_DEBUG("BILLING: PUSH {} {} type {}", pkLD->GetLogin(), t.dwUseSec, t.bBillType); - - if (t.bBillType == BILLING_IP_FREE || t.bBillType == BILLING_IP_TIME || t.bBillType == BILLING_IP_DAY) - snprintf(t.szLogin, sizeof(t.szLogin), "%u", pkLD->GetBillID()); - else - strlcpy(t.szLogin, pkLD->GetLogin(), sizeof(t.szLogin)); - - strlcpy(t.szIP, pkLD->GetIP(), sizeof(t.szIP)); - - m_vec_kUseTime.push_back(t); -} - -void DBManager::FlushBilling(bool bForce) -{ - if (bForce) - { - std::map::iterator it = m_map_pkLoginData.begin(); - - while (it != m_map_pkLoginData.end()) - { - CLoginData * pkLD = (it++)->second; - - if (pkLD->IsBilling()) - PushBilling(pkLD); - } - } - - if (!m_vec_kUseTime.empty()) - { - DWORD dwCount = 0; - - std::vector::iterator it = m_vec_kUseTime.begin(); - - while (it != m_vec_kUseTime.end()) - { - TUseTime * p = &(*(it++)); - - // DISABLE_OLD_BILLING_CODE - if (!g_bBilling) - { - ++dwCount; - continue; - } - - Query("INSERT GameTimeLog (login, type, logon_time, logout_time, use_time, ip, server) " - "VALUES('%s', %u, DATE_SUB(NOW(), INTERVAL %u SECOND), NOW(), %u, '%s', '%s')", - p->szLogin, p->bBillType, p->dwUseSec, p->dwUseSec, p->szIP, g_stHostname.c_str()); - // DISABLE_OLD_BILLING_CODE_END - - switch (p->bBillType) - { - case BILLING_FREE: - case BILLING_IP_FREE: - break; - - case BILLING_DAY: - { - if (!bForce) - { - TUseTime * pInfo = M2_NEW TUseTime; - memcpy(pInfo, p, sizeof(TUseTime)); - ReturnQuery(QID_BILLING_CHECK, 0, pInfo, - "SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTime WHERE UserID='%s'", p->szLogin); - } - } - break; - - case BILLING_TIME: - { - Query("UPDATE GameTime SET LimitTime=LimitTime-%u WHERE UserID='%s'", p->dwUseSec, p->szLogin); - - if (!bForce) - { - TUseTime * pInfo = M2_NEW TUseTime; - memcpy(pInfo, p, sizeof(TUseTime)); - ReturnQuery(QID_BILLING_CHECK, 0, pInfo, - "SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTime WHERE UserID='%s'", p->szLogin); - } - } - break; - - case BILLING_IP_DAY: - { - if (!bForce) - { - TUseTime * pInfo = M2_NEW TUseTime; - memcpy(pInfo, p, sizeof(TUseTime)); - ReturnQuery(QID_BILLING_CHECK, 0, pInfo, - "SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTimeIP WHERE ipid=%s", p->szLogin); - } - } - break; - - case BILLING_IP_TIME: - { - Query("UPDATE GameTimeIP SET LimitTime=LimitTime-%u WHERE ipid=%s", p->dwUseSec, p->szLogin); - - if (!bForce) - { - TUseTime * pInfo = M2_NEW TUseTime; - memcpy(pInfo, p, sizeof(TUseTime)); - ReturnQuery(QID_BILLING_CHECK, 0, pInfo, - "SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTimeIP WHERE ipid=%s", p->szLogin); - } - } - break; - } - - if (!bForce && ++dwCount >= 1000) - break; - } - - if (dwCount < m_vec_kUseTime.size()) - { - int nNewSize = m_vec_kUseTime.size() - dwCount; - memcpy(&m_vec_kUseTime[0], &m_vec_kUseTime[dwCount], sizeof(TUseTime) * nNewSize); - m_vec_kUseTime.resize(nNewSize); - } - else - m_vec_kUseTime.clear(); - - SPDLOG_DEBUG("FLUSH_USE_TIME: count {}", dwCount); - } - - if (m_vec_kUseTime.size() < 10240) - { - DWORD dwCurTime = get_dword_time(); - - std::map::iterator it = m_map_pkLoginData.begin(); - - while (it != m_map_pkLoginData.end()) - { - CLoginData * pkLD = (it++)->second; - - if (!pkLD->IsBilling()) - continue; - - switch (pkLD->GetBillType()) - { - case BILLING_IP_FREE: - case BILLING_FREE: - break; - - case BILLING_IP_DAY: - case BILLING_DAY: - case BILLING_IP_TIME: - case BILLING_TIME: - if (pkLD->GetRemainSecs() < 0) - { - DWORD dwSecsConnected = (dwCurTime - pkLD->GetLogonTime()) / 1000; - - if (dwSecsConnected % 10 == 0) - SendBillingExpire(pkLD->GetLogin(), BILLING_DAY, 0, pkLD); - } - else if (pkLD->GetRemainSecs() <= 600) // if remain seconds lower than 10 minutes - { - DWORD dwSecsConnected = (dwCurTime - pkLD->GetLogonTime()) / 1000; - - if (dwSecsConnected >= 60) // 60 second cycle - { - SPDLOG_DEBUG("BILLING 1 {} remain {} connected secs {}", - pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected); - PushBilling(pkLD); - } - } - else - { - DWORD dwSecsConnected = (dwCurTime - pkLD->GetLogonTime()) / 1000; - - if (dwSecsConnected > (DWORD) (pkLD->GetRemainSecs() - 600) || dwSecsConnected >= 600) - { - SPDLOG_DEBUG("BILLING 2 {} remain {} connected secs {}", - pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected); - PushBilling(pkLD); - } - } - break; - } - } - } - -} - -void DBManager::CheckBilling() -{ - std::vector vec; - vec.push_back(0); // Ä«¿îÆ®¸¦ À§ÇØ ¹Ì¸® ºñ¿öµÐ´Ù. - - itertype(m_map_pkLoginData) it = m_map_pkLoginData.begin(); - - while (it != m_map_pkLoginData.end()) - { - CLoginData * pkLD = (it++)->second; - - if (pkLD->IsBilling()) - { - SPDLOG_DEBUG("BILLING: CHECK {}", pkLD->GetKey()); - vec.push_back(pkLD->GetKey()); - } - } - - vec[0] = vec.size() - 1; // ºñ¿öµÐ °÷¿¡ »çÀÌÁ ³Ö´Â´Ù, »çÀÌÁî ÀÚ½ÅÀº Á¦¿ÜÇØ¾ß ÇϹǷΠ-1 - db_clientdesc->DBPacket(HEADER_GD_BILLING_CHECK, 0, &vec[0], sizeof(DWORD) * vec.size()); -} - void DBManager::SendLoginPing(const char * c_pszLogin) { TPacketGGLoginPing ptog; @@ -444,8 +193,6 @@ void DBManager::SendAuthLogin(LPDESC d) trim_and_lower(r.login, ptod.szLogin, sizeof(ptod.szLogin)); strlcpy(ptod.szSocialID, r.social_id, sizeof(ptod.szSocialID)); ptod.dwLoginKey = d->GetLoginKey(); - ptod.bBillType = pkLD->GetBillType(); - ptod.dwBillID = pkLD->GetBillID(); memcpy(ptod.iPremiumTimes, pkLD->GetPremiumPtr(), sizeof(ptod.iPremiumTimes)); memcpy(&ptod.adwClientKey, pkLD->GetClientKey(), sizeof(DWORD) * 4); @@ -456,7 +203,7 @@ void DBManager::SendAuthLogin(LPDESC d) SendLoginPing(r.login); } -void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes) +void DBManager::LoginPrepare(LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes) { const TAccountTable & r = d->GetAccountTable(); @@ -464,9 +211,6 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP pkLD->SetKey(d->GetLoginKey()); pkLD->SetLogin(r.login); - pkLD->SetBillType(bBillType); - pkLD->SetBillID(dwBillID); - pkLD->SetRemainSecs(lRemainSecs); pkLD->SetIP(d->GetHostName()); pkLD->SetClientKey(pdwClientKey); @@ -508,108 +252,6 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP } } -bool GetGameTimeIP(MYSQL_RES * pRes, BYTE & bBillType, DWORD & dwBillID, int & seconds, const char * c_pszIP) -{ - if (!pRes) - return true; - - MYSQL_ROW row = mysql_fetch_row(pRes); - int col = 0; - - str_to_number(dwBillID, row[col++]); - - int ip_start = 0; - str_to_number(ip_start, row[col++]); - - int ip_end = 0; - str_to_number(ip_end, row[col++]); - - int type = 0; - str_to_number(type, row[col++]); - - str_to_number(seconds, row[col++]); - - int day_seconds = 0; - str_to_number(day_seconds, row[col++]); - - char szIP[MAX_HOST_LENGTH + 1]; - strlcpy(szIP, c_pszIP, sizeof(szIP)); - - char * p = strrchr(szIP, '.'); - ++p; - - int ip_postfix = 0; - str_to_number(ip_postfix, p); - int valid_ip = false; - - if (ip_start <= ip_postfix && ip_end >= ip_postfix) - valid_ip = true; - - bBillType = BILLING_NONE; - - if (valid_ip) - { - if (type == -1) - return false; - - if (type == 0) - bBillType = BILLING_IP_FREE; - else if (day_seconds > 0) - { - bBillType = BILLING_IP_DAY; - seconds = day_seconds; - } - else if (seconds > 0) - bBillType = BILLING_IP_TIME; - } - - return true; -} - -bool GetGameTime(MYSQL_RES * pRes, BYTE & bBillType, int & seconds) -{ - if (!pRes) - return true; - - MYSQL_ROW row = mysql_fetch_row(pRes); - SPDLOG_DEBUG("GetGameTime {} {} {}", row[0], row[1], row[2]); - - int type = 0; - str_to_number(type, row[0]); - str_to_number(seconds, row[1]); - int day_seconds = 0; - str_to_number(day_seconds, row[2]); - bBillType = BILLING_NONE; - - if (type == -1) - return false; - else if (type == 0) - bBillType = BILLING_FREE; - else if (day_seconds > 0) - { - bBillType = BILLING_DAY; - seconds = day_seconds; - } - else if (seconds > 0) - bBillType = BILLING_TIME; - - if (!g_bBilling) - bBillType = BILLING_FREE; - - return true; -} - -void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLoginData * pkLD) -{ - TPacketBillingExpire ptod; - - strlcpy(ptod.szLogin, c_pszLogin, sizeof(ptod.szLogin)); - ptod.bBillType = bBillType; - ptod.dwRemainSeconds = std::max(0, iSecs); - db_clientdesc->DBPacket(HEADER_GD_BILLING_EXPIRE, 0, &ptod, sizeof(TPacketBillingExpire)); - SPDLOG_DEBUG("BILLING: EXPIRE {} type {} sec {} ptr {}", c_pszLogin, bBillType, iSecs, (void*) pkLD); -} - void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) { CReturnQueryInfo * qi = (CReturnQueryInfo *) pMsg->pvUserData; @@ -626,7 +268,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) M2_DELETE(pinfo); break; } - //À§Ä¡ º¯°æ - By SeMinZ + d->SetLogin(pinfo->login); SPDLOG_DEBUG("QID_AUTH_LOGIN: START {} {}", qi->dwIdent, (void*) get_pointer(d)); @@ -807,122 +449,15 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) d->SetMatrixCode(szMatrixCode); - if (!g_bBilling) - { - LoginPrepare(BILLING_FREE, 0, 0, d, pinfo->adwClientKey, aiPremiumTimes); - //By SeMinZ - M2_DELETE(pinfo); - break; - } - SPDLOG_DEBUG("QID_AUTH_LOGIN: SUCCESS {}", pinfo->login); + + LoginPrepare(d, pinfo->adwClientKey, aiPremiumTimes); + M2_DELETE(pinfo); } } } break; - case QID_BILLING_GET_TIME: - { - TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) qi->pvData; - LPDESC d = DESC_MANAGER::instance().FindByLoginKey(qi->dwIdent); - - SPDLOG_DEBUG("QID_BILLING_GET_TIME: START ident {} d {}", qi->dwIdent, (void*) get_pointer(d)); - - if (d) - { - if (pMsg->Get()->uiNumRows == 0) - { - if (g_bBilling) - LoginFailure(d, "NOBILL"); - else - LoginPrepare(BILLING_FREE, 0, 0, d, pinfo->adwClientKey); - } - else - { - int seconds = 0; - BYTE bBillType = BILLING_NONE; - - if (!GetGameTime(pMsg->Get()->pSQLResult, bBillType, seconds)) - { - SPDLOG_DEBUG("QID_BILLING_GET_TIME: BLOCK"); - LoginFailure(d, "BLOCK"); - } - else if (bBillType == BILLING_NONE) - { - LoginFailure(d, "NOBILL"); - SPDLOG_DEBUG("QID_BILLING_GET_TIME: NO TIME"); - } - else - { - LoginPrepare(bBillType, 0, seconds, d, pinfo->adwClientKey); - SPDLOG_DEBUG("QID_BILLING_GET_TIME: SUCCESS"); - } - } - } - M2_DELETE(pinfo); - } - break; - - case QID_BILLING_CHECK: - { - TUseTime * pinfo = (TUseTime *) qi->pvData; - int iRemainSecs = 0; - - CLoginData * pkLD = NULL; - - if (pMsg->Get()->uiNumRows > 0) - { - MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); - - int iLimitDt = 0; - str_to_number(iLimitDt, row[0]); - - int iLimitTime = 0; - str_to_number(iLimitTime, row[1]); - - pkLD = GetLoginData(pinfo->dwLoginKey); - - if (pkLD) - { - switch (pkLD->GetBillType()) - { - case BILLING_TIME: - if (iLimitTime <= 600 && iLimitDt > 0) - { - iRemainSecs = iLimitDt; - pkLD->SetBillType(BILLING_DAY); - pinfo->bBillType = BILLING_DAY; - } - else - iRemainSecs = iLimitTime; - break; - - case BILLING_IP_TIME: - if (iLimitTime <= 600 && iLimitDt > 0) - { - iRemainSecs = iLimitDt; - pkLD->SetBillType(BILLING_IP_DAY); - pinfo->bBillType = BILLING_IP_DAY; - } - else - iRemainSecs = iLimitTime; - break; - - case BILLING_DAY: - case BILLING_IP_DAY: - iRemainSecs = iLimitDt; - break; - } - - pkLD->SetRemainSecs(iRemainSecs); - } - } - - SendBillingExpire(pinfo->szLogin, pinfo->bBillType, std::max(0, iRemainSecs), pkLD); - M2_DELETE(pinfo); - } - break; - case QID_SAFEBOX_SIZE: { LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent); @@ -1014,37 +549,6 @@ void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold) db_clientdesc->DBPacket(HEADER_GD_MONEY_LOG, 0, &p, sizeof(p)); } -void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item) -{ - TPacketGDVCard p; - - p.dwID = item->GetSocket(0); - strlcpy(p.szSellCharacter, CardOwner->GetName(), sizeof(p.szSellCharacter)); - strlcpy(p.szSellAccount, CardOwner->GetDesc()->GetAccountTable().login, sizeof(p.szSellAccount)); - strlcpy(p.szBuyCharacter, CardTaker->GetName(), sizeof(p.szBuyCharacter)); - strlcpy(p.szBuyAccount, CardTaker->GetDesc()->GetAccountTable().login, sizeof(p.szBuyAccount)); - - db_clientdesc->DBPacket(HEADER_GD_VCARD, 0, &p, sizeof(TPacketGDVCard)); - - CardTaker->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dºÐÀÇ °áÁ¦½Ã°£ÀÌ Ãß°¡ µÇ¾ú½À´Ï´Ù. (°áÁ¦¹øÈ£ %d)"), item->GetSocket(1) / 60, item->GetSocket(0)); - - LogManager::instance().VCardLog(p.dwID, CardTaker->GetX(), CardTaker->GetY(), g_stHostname.c_str(), - CardOwner->GetName(), CardOwner->GetDesc()->GetHostName(), - CardTaker->GetName(), CardTaker->GetDesc()->GetHostName()); - - ITEM_MANAGER::instance().RemoveItem(item); - - SPDLOG_DEBUG("VCARD_TAKE: {} {} -> {}", p.dwID, CardOwner->GetName(), CardTaker->GetName()); -} - -void DBManager::StopAllBilling() -{ - for (itertype(m_map_pkLoginData) it = m_map_pkLoginData.begin(); it != m_map_pkLoginData.end(); ++it) - { - SetBilling(it->first, false); - } -} - size_t DBManager::EscapeString(char* dst, size_t dstSize, const char *src, size_t srcSize) { return m_sql_direct.EscapeString(dst, dstSize, src, srcSize); diff --git a/src/game/src/db.h b/src/game/src/db.h index 650ee33..3ac8abe 100644 --- a/src/game/src/db.h +++ b/src/game/src/db.h @@ -16,8 +16,6 @@ enum QID_SAFEBOX_SIZE, QID_AUTH_LOGIN, QID_LOTTO, - QID_BILLING_GET_TIME, - QID_BILLING_CHECK, // BLOCK_CHAT QID_BLOCK_CHAT_LIST, @@ -28,15 +26,6 @@ enum // END_PROTECT_CHILD_FOR_NEWCIBN }; -typedef struct SUseTime -{ - DWORD dwLoginKey; - char szLogin[LOGIN_MAX_LEN+1]; - BYTE bBillType; - DWORD dwUseSec; - char szIP[MAX_HOST_LENGTH+1]; -} TUseTime; - class CQueryInfo { public: @@ -85,19 +74,13 @@ class DBManager : public singleton void SendMoneyLog(BYTE type, DWORD vnum, int gold); - void LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes = NULL); + void LoginPrepare(LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes = NULL); void SendAuthLogin(LPDESC d); void SendLoginPing(const char * c_pszLogin); void InsertLoginData(CLoginData * pkLD); void DeleteLoginData(CLoginData * pkLD); CLoginData * GetLoginData(DWORD dwKey); - void SetBilling(DWORD dwKey, bool bOn, bool bSkipPush = false); - void PushBilling(CLoginData * pkLD); - void FlushBilling(bool bForce=false); - void CheckBilling(); - - void StopAllBilling(); // 20050503.ipkn.DB-AUTH Á¢¼Ó Á¾·á½Ã ºô¸µ Å×ÀÌºí ¸ðµÎ Áö¿ì±â (À翬°á½Ã º¹±¸ÇÔ) DWORD CountQuery() { return m_sql.CountQuery(); } DWORD CountQueryResult() { return m_sql.CountResult(); } @@ -116,8 +99,6 @@ class DBManager : public singleton bool m_bIsConnect; std::map m_map_pkLoginData; - std::map mapLDBilling; - std::vector m_vec_kUseTime; }; template void DBManager::FuncQuery(Functor f, const char* c_pszFormat, ...) @@ -156,9 +137,6 @@ template void DBManager::FuncAfterQuery(Functor f, const char* c //////////////////////////////////////////////////////////////// -extern void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLoginData * pkLD); -extern void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item); - // ACCOUNT_DB class AccountDB : public singleton diff --git a/src/game/src/desc.cpp b/src/game/src/desc.cpp index 7be9c29..b49ad94 100644 --- a/src/game/src/desc.cpp +++ b/src/game/src/desc.cpp @@ -121,8 +121,6 @@ void DESC::Initialize() m_dwProcCRC = 0; m_dwFileCRC = 0; - m_dwBillingExpireSecond = 0; - m_outtime = 0; m_playtime = 0; m_offtime = 0; @@ -725,16 +723,6 @@ void DESC::AssembleCRCMagicCube(BYTE bProcPiece, BYTE bFilePiece) } } -void DESC::SetBillingExpireSecond(DWORD dwSec) -{ - m_dwBillingExpireSecond = dwSec; -} - -DWORD DESC::GetBillingExpireSecond() -{ - return m_dwBillingExpireSecond; -} - void DESC::push_seq(BYTE hdr, BYTE seq) { if (m_seq_vector.size()>=20) diff --git a/src/game/src/desc.h b/src/game/src/desc.h index b2f4a1d..b8379e6 100644 --- a/src/game/src/desc.h +++ b/src/game/src/desc.h @@ -155,9 +155,6 @@ class DESC void AssembleCRCMagicCube(BYTE bProcPiece, BYTE bFilePiece); - void SetBillingExpireSecond(DWORD dwSec); - DWORD GetBillingExpireSecond(); - void SetClientVersion(const char * c_pszTimestamp) { m_stClientVersion = c_pszTimestamp; } const char * GetClientVersion() { return m_stClientVersion.c_str(); } @@ -217,7 +214,6 @@ class DESC DWORD m_dwProcCRC; DWORD m_dwFileCRC; - DWORD m_dwBillingExpireSecond; std::string m_stClientVersion; std::string m_stMatrixCode; diff --git a/src/game/src/desc_client.cpp b/src/game/src/desc_client.cpp index 59016bc..77eb3a7 100644 --- a/src/game/src/desc_client.cpp +++ b/src/game/src/desc_client.cpp @@ -75,7 +75,6 @@ void CLIENT_DESC::Destroy() CPartyManager::instance().DeleteAllParty(); CPartyManager::instance().DisablePCParty(); CGuildManager::instance().StopAllGuildWar(); - DBManager::instance().StopAllBilling(); } SPDLOG_DEBUG("SYSTEM: closing client socket."); diff --git a/src/game/src/exchange.cpp b/src/game/src/exchange.cpp index 4738254..f0d1e18 100644 --- a/src/game/src/exchange.cpp +++ b/src/game/src/exchange.cpp @@ -438,12 +438,6 @@ bool CExchange::Done() assert(empty_pos >= 0); - if (item->GetVnum() == 90008 || item->GetVnum() == 90009) // VCARD - { - VCardUse(m_pOwner, victim, item); - continue; - } - m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255); item->RemoveFromCharacter(); diff --git a/src/game/src/input.h b/src/game/src/input.h index 33a117e..dbb9d01 100644 --- a/src/game/src/input.h +++ b/src/game/src/input.h @@ -240,12 +240,6 @@ protected: void SetEventFlag(const char* c_pData); - void BillingRepair(const char * c_pData); - void BillingExpire(const char * c_pData); - void BillingLogin(const char * c_pData); - void BillingCheck(const char * c_pData); - void VCard(const char * c_pData); - void CreateObject(const char * c_pData); void DeleteObject(const char * c_pData); void UpdateLand(const char * c_pData); diff --git a/src/game/src/input_db.cpp b/src/game/src/input_db.cpp index 6204ca5..b56184d 100644 --- a/src/game/src/input_db.cpp +++ b/src/game/src/input_db.cpp @@ -1823,90 +1823,6 @@ void CInputDB::UpdateLand(const char * c_pData) CManager::instance().UpdateLand((TLand *) c_pData); } -//////////////////////////////////////////////////////////////////// -// Billing -//////////////////////////////////////////////////////////////////// -void CInputDB::BillingRepair(const char * c_pData) -{ - DWORD dwCount = *(DWORD *) c_pData; - c_pData += sizeof(DWORD); - - TPacketBillingRepair * p = (TPacketBillingRepair *) c_pData; - - for (DWORD i = 0; i < dwCount; ++i, ++p) - { - CLoginData * pkLD = M2_NEW CLoginData; - - pkLD->SetKey(p->dwLoginKey); - pkLD->SetLogin(p->szLogin); - pkLD->SetIP(p->szHost); - - SPDLOG_INFO("BILLING: REPAIR {} host {}", p->szLogin, p->szHost); - } -} - -void CInputDB::BillingExpire(const char * c_pData) -{ - TPacketBillingExpire * p = (TPacketBillingExpire *) c_pData; - - LPDESC d = DESC_MANAGER::instance().FindByLoginName(p->szLogin); - - if (!d) - return; - - LPCHARACTER ch = d->GetCharacter(); - - if (p->dwRemainSeconds <= 60) - { - int i = std::max(5, p->dwRemainSeconds); - SPDLOG_INFO("BILLING_EXPIRE: {} {}", p->szLogin, p->dwRemainSeconds); - d->DelayedDisconnect(i); - } - else - { - if ((p->dwRemainSeconds - d->GetBillingExpireSecond()) > 60) - { - d->SetBillingExpireSecond(p->dwRemainSeconds); - - if (ch) - ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°áÀç±â°£ÀÌ %dºÐ ÈÄ ¸¸·á µË´Ï´Ù."), (p->dwRemainSeconds / 60)); - } - } -} - -void CInputDB::BillingLogin(const char * c_pData) -{ - if (NULL == c_pData) - return; - - TPacketBillingLogin * p; - - DWORD dwCount = *(DWORD *) c_pData; - c_pData += sizeof(DWORD); - - p = (TPacketBillingLogin *) c_pData; - - for (DWORD i = 0; i < dwCount; ++i, ++p) - { - DBManager::instance().SetBilling(p->dwLoginKey, p->bLogin); - } -} - -void CInputDB::BillingCheck(const char * c_pData) -{ - DWORD size = *(DWORD *) c_pData; - c_pData += sizeof(DWORD); - - for (DWORD i = 0; i < size; ++i) - { - DWORD dwKey = *(DWORD *) c_pData; - c_pData += sizeof(DWORD); - - SPDLOG_INFO("BILLING: NOT_LOGIN {}", dwKey); - DBManager::instance().SetBilling(dwKey, 0, true); - } -} - void CInputDB::Notice(const char * c_pData) { extern void SendNotice(const char * c_pszBuf); @@ -1920,61 +1836,6 @@ void CInputDB::Notice(const char * c_pData) SendNotice(szBuf); } -void CInputDB::VCard(const char * c_pData) -{ - TPacketGDVCard * p = (TPacketGDVCard *) c_pData; - - SPDLOG_DEBUG("VCARD: {} {} {} {} {}", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount); - - std::unique_ptr pmsg(DBManager::instance().DirectQuery("SELECT sell_account, buy_account, time FROM vcard WHERE id=%u", p->dwID)); - if (pmsg->Get()->uiNumRows != 1) - { - SPDLOG_ERROR("VCARD_FAIL: no data"); - return; - } - - MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult); - - if (strcmp(row[0], p->szSellAccount)) - { - SPDLOG_ERROR("VCARD_FAIL: sell account differ {}", row[0]); - return; - } - - if (!row[1] || *row[1]) - { - SPDLOG_ERROR("VCARD_FAIL: buy account already exist"); - return; - } - - int time = 0; - str_to_number(time, row[2]); - - if (!row[2] || time < 0) - { - SPDLOG_ERROR("VCARD_FAIL: time null"); - return; - } - - std::unique_ptr 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) - { - SPDLOG_ERROR("VCARD_FAIL: cannot modify GameTime table"); - return; - } - - std::unique_ptr 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) - { - SPDLOG_ERROR("VCARD_FAIL: cannot modify vcard table"); - return; - } - - SPDLOG_DEBUG("VCARD_SUCCESS: {} {}", p->szBuyAccount, p->szBuyCharacter); -} - void CInputDB::GuildWarReserveAdd(TGuildWarReserve * p) { CGuildManager::instance().ReserveWarAdd(p); @@ -2303,26 +2164,6 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) SetEventFlag(c_pData); break; - case HEADER_DG_BILLING_REPAIR: - BillingRepair(c_pData); - break; - - case HEADER_DG_BILLING_EXPIRE: - BillingExpire(c_pData); - break; - - case HEADER_DG_BILLING_LOGIN: - BillingLogin(c_pData); - break; - - case HEADER_DG_BILLING_CHECK: - BillingCheck(c_pData); - break; - - case HEADER_DG_VCARD: - VCard(c_pData); - break; - case HEADER_DG_CREATE_OBJECT: CreateObject(c_pData); break; diff --git a/src/game/src/input_p2p.cpp b/src/game/src/input_p2p.cpp index d408f50..15f0aeb 100644 --- a/src/game/src/input_p2p.cpp +++ b/src/game/src/input_p2p.cpp @@ -1,5 +1,4 @@ -#include "stdafx.h" -#include +#include "stdafx.h" #include "config.h" #include "desc_client.h" #include "desc_manager.h" @@ -369,8 +368,6 @@ void CInputP2P::LoginPing(LPDESC d, const char * c_pData) { TPacketGGLoginPing * p = (TPacketGGLoginPing *) c_pData; - SendBillingExpire(p->szLogin, BILLING_DAY, 0, NULL); - if (!g_pkAuthMasterDesc) // If I am master, I have to broadcast P2P_MANAGER::instance().Send(p, sizeof(TPacketGGLoginPing), d); } diff --git a/src/game/src/log.cpp b/src/game/src/log.cpp index 08cf4a7..6aa1671 100644 --- a/src/game/src/log.cpp +++ b/src/game/src/log.cpp @@ -244,12 +244,6 @@ void LogManager::BootLog(const char * c_pszHostName, BYTE bChannel) c_pszHostName, bChannel); } -void LogManager::VCardLog(DWORD vcard_id, DWORD x, DWORD y, const char * hostname, const char * giver_name, const char * giver_ip, const char * taker_name, const char * taker_ip) -{ - Query("INSERT DELAYED INTO vcard_log (vcard_id, x, y, hostname, giver_name, giver_ip, taker_name, taker_ip) VALUES(%u, %u, %u, '%s', '%s', '%s', '%s', '%s')", - vcard_id, x, y, hostname, giver_name, giver_ip, taker_name, taker_ip); -} - void LogManager::FishLog(DWORD dwPID, int prob_idx, int fish_id, int fish_level, DWORD dwMiliseconds, DWORD dwVnum, DWORD dwValue) { Query("INSERT INTO fish_log%s VALUES(NOW(), %u, %d, %u, %d, %u, %u, %u)", diff --git a/src/game/src/log.h b/src/game/src/log.h index cf8bb98..c57cb23 100644 --- a/src/game/src/log.h +++ b/src/game/src/log.h @@ -46,7 +46,6 @@ class LogManager : public singleton void ShoutLog(BYTE bChannel, BYTE bEmpire, const char * pszText); void LevelLog(LPCHARACTER pChar, unsigned int level, unsigned int playhour); void BootLog(const char * c_pszHostName, BYTE bChannel); - void VCardLog(DWORD vcard_id, DWORD x, DWORD y, const char * hostname, const char * giver_name, const char * giver_ip, const char * taker_name, const char * taker_ip); void FishLog(DWORD dwPID, int prob_idx, int fish_id, int fish_level, DWORD dwMiliseconds, DWORD dwVnum = false, DWORD dwValue = 0); void QuestRewardLog(const char * c_pszQuestName, DWORD dwPID, DWORD dwLevel, int iValue1, int iValue2); void DetailLoginLog(bool isLogin, LPCHARACTER ch); diff --git a/src/game/src/login_data.cpp b/src/game/src/login_data.cpp index 6031e13..d4f262b 100644 --- a/src/game/src/login_data.cpp +++ b/src/game/src/login_data.cpp @@ -8,13 +8,9 @@ CLoginData::CLoginData() { m_dwKey = 0; memset(m_adwClientKey, 0, sizeof(m_adwClientKey)); - m_bBillType = 0; - m_dwBillID = 0; m_dwConnectedPeerHandle = 0; m_dwLogonTime = 0; - m_lRemainSecs = 0; memset(m_szIP, 0, sizeof(m_szIP)); - m_bBilling = false; m_bDeleted = false; memset(m_aiPremiumTimes, 0, sizeof(m_aiPremiumTimes)); } @@ -39,26 +35,6 @@ DWORD CLoginData::GetKey() return m_dwKey; } -void CLoginData::SetBillType(BYTE bType) -{ - m_bBillType = bType; -} - -DWORD CLoginData::GetBillID() -{ - return m_dwBillID; -} - -void CLoginData::SetBillID(DWORD dwID) -{ - m_dwBillID = dwID; -} - -BYTE CLoginData::GetBillType() -{ - return m_bBillType; -} - void CLoginData::SetConnectedPeerHandle(DWORD dwHandle) { m_dwConnectedPeerHandle = dwHandle; @@ -89,35 +65,6 @@ const char * CLoginData::GetIP() return m_szIP; } -void CLoginData::SetRemainSecs(int l) -{ - m_lRemainSecs = l; - SPDLOG_DEBUG("SetRemainSecs {} {} type {}", m_stLogin, m_lRemainSecs, m_bBillType); -} - -int CLoginData::GetRemainSecs() -{ - return m_lRemainSecs; -} - -void CLoginData::SetBilling(bool bOn) -{ - if (bOn) - { - SPDLOG_DEBUG("BILLING: ON {} key {} ptr {}", m_stLogin, m_dwKey, (void*) this); - SetLogonTime(); - } - else - SPDLOG_DEBUG("BILLING: OFF {} key {} ptr {}", m_stLogin, m_dwKey, (void*) this); - - m_bBilling = bOn; -} - -bool CLoginData::IsBilling() -{ - return m_bBilling; -} - void CLoginData::SetDeleted(bool bSet) { m_bDeleted = bSet; diff --git a/src/game/src/login_data.h b/src/game/src/login_data.h index 474c8c0..58f082e 100644 --- a/src/game/src/login_data.h +++ b/src/game/src/login_data.h @@ -15,12 +15,6 @@ class CLoginData void SetLogin(const char * c_pszLogin); const char * GetLogin(); - void SetBillType(BYTE bType); - DWORD GetBillID(); - - void SetBillID(DWORD dwID); - BYTE GetBillType(); - void SetConnectedPeerHandle(DWORD dwHandle); DWORD GetConnectedPeerHandle(); @@ -30,12 +24,6 @@ class CLoginData void SetIP(const char * c_pszIP); const char * GetIP(); - void SetRemainSecs(int l); - int GetRemainSecs(); - - void SetBilling(bool bOn); - bool IsBilling(); - void SetDeleted(bool bSet); bool IsDeleted(); @@ -47,13 +35,9 @@ class CLoginData private: DWORD m_dwKey; DWORD m_adwClientKey[4]; - BYTE m_bBillType; - DWORD m_dwBillID; DWORD m_dwConnectedPeerHandle; DWORD m_dwLogonTime; - int m_lRemainSecs; char m_szIP[MAX_HOST_LENGTH+1]; - bool m_bBilling; bool m_bDeleted; std::string m_stLogin; int m_aiPremiumTimes[PREMIUM_MAX_NUM]; diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index 71dc5d4..8d58f06 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -238,11 +238,6 @@ void heartbeat(LPHEART ht, int pulse) else { DESC_MANAGER::instance().ProcessExpiredLoginKey(); - DBManager::instance().FlushBilling(); - /* - if (!(pulse % (ht->passes_per_sec * 600))) - DBManager::instance().CheckBilling(); - */ } { @@ -429,8 +424,6 @@ int main(int argc, char **argv) if (g_bAuthServer) { - DBManager::instance().FlushBilling(true); - int iLimit = DBManager::instance().CountQuery() / 50; int i = 0; diff --git a/src/game/src/shop.cpp b/src/game/src/shop.cpp index 1224556..7697178 100644 --- a/src/game/src/shop.cpp +++ b/src/game/src/shop.cpp @@ -341,36 +341,28 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) { m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255); - if (item->GetVnum() == 90008 || item->GetVnum() == 90009) // VCARD + char buf[512]; + + if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007) { - VCardUse(m_pkPC, ch, item); - item = NULL; + snprintf(buf, sizeof(buf), "%s FROM: %u TO: %u PRICE: %u", item->GetName(), ch->GetPlayerID(), m_pkPC->GetPlayerID(), dwPrice); + LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), SHOP_BUY, buf); + LogManager::instance().GoldBarLog(m_pkPC->GetPlayerID(), item->GetID(), SHOP_SELL, buf); } + + item->RemoveFromCharacter(); + if (item->IsDragonSoul()) + item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); else - { - char buf[512]; + item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); + ITEM_MANAGER::instance().FlushDelayedSave(item); - if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007) - { - snprintf(buf, sizeof(buf), "%s FROM: %u TO: %u PRICE: %u", item->GetName(), ch->GetPlayerID(), m_pkPC->GetPlayerID(), dwPrice); - LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), SHOP_BUY, buf); - LogManager::instance().GoldBarLog(m_pkPC->GetPlayerID(), item->GetID(), SHOP_SELL, buf); - } - - item->RemoveFromCharacter(); - if (item->IsDragonSoul()) - item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); - else - item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); - ITEM_MANAGER::instance().FlushDelayedSave(item); - - snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), m_pkPC->GetPlayerID(), m_pkPC->GetName(), dwPrice, item->GetCount()); - LogManager::instance().ItemLog(ch, item, "SHOP_BUY", buf); + snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), m_pkPC->GetPlayerID(), m_pkPC->GetName(), dwPrice, item->GetCount()); + LogManager::instance().ItemLog(ch, item, "SHOP_BUY", buf); - snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), ch->GetPlayerID(), ch->GetName(), dwPrice, item->GetCount()); - LogManager::instance().ItemLog(m_pkPC, item, "SHOP_SELL", buf); - } + snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), ch->GetPlayerID(), ch->GetName(), dwPrice, item->GetCount()); + LogManager::instance().ItemLog(m_pkPC, item, "SHOP_SELL", buf); r_item.pkItem = NULL; BroadcastUpdateItem(pos); From d85ef28eace2b76e7e61b1e711d89a1bd5670d19 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 21:14:50 +0200 Subject: [PATCH 07/10] Removed messenger SMS --- src/common/length.h | 2 -- src/common/tables.h | 10 ---------- src/db/src/ClientManager.cpp | 20 -------------------- src/db/src/ClientManager.h | 1 - src/db/src/ClientManagerPlayer.cpp | 9 ++------- src/game/src/char.cpp | 12 ------------ src/game/src/char.h | 2 -- src/game/src/cmd.cpp | 2 -- src/game/src/input.h | 1 - src/game/src/messenger_manager.cpp | 1 - src/game/src/packet.h | 16 +--------------- src/game/src/packet_info.cpp | 1 - 12 files changed, 3 insertions(+), 74 deletions(-) diff --git a/src/common/length.h b/src/common/length.h index 82eca5d..8bd31a4 100644 --- a/src/common/length.h +++ b/src/common/length.h @@ -16,8 +16,6 @@ enum EMisc ABILITY_MAX_NUM = 50, EMPIRE_MAX_NUM = 4, BANWORD_MAX_LEN = 24, - SMS_MAX_LEN = 80, - MOBILE_MAX_LEN = 32, SOCIAL_ID_MAX_LEN = 18, MAP_ALLOW_MAX_LEN = 128, diff --git a/src/common/tables.h b/src/common/tables.h index 2a6663d..ce4e54b 100644 --- a/src/common/tables.h +++ b/src/common/tables.h @@ -62,7 +62,6 @@ enum HEADER_GD_RELOAD_PROTO = 43, HEADER_GD_CHANGE_NAME = 44, - HEADER_GD_SMS = 45, HEADER_GD_GUILD_CHANGE_LADDER_POINT = 46, HEADER_GD_GUILD_USE_SKILL = 47, @@ -421,7 +420,6 @@ typedef struct SPlayerTable BYTE skill_group; LONG lAlignment; - char szMobile[MOBILE_MAX_LEN + 1]; WORD stat_reset_count; @@ -969,14 +967,6 @@ typedef struct SPacketGuildLadderPoint LONG lChange; } TPacketGuildLadderPoint; -typedef struct SPacketGDSMS -{ - char szFrom[CHARACTER_NAME_MAX_LEN + 1]; - char szTo[CHARACTER_NAME_MAX_LEN + 1]; - char szMobile[MOBILE_MAX_LEN + 1]; - char szMsg[SMS_MAX_LEN + 1]; -} TPacketGDSMS; - typedef struct SPacketGuildUseSkill { DWORD dwGuild; diff --git a/src/db/src/ClientManager.cpp b/src/db/src/ClientManager.cpp index 1ed17d6..8ed96d4 100644 --- a/src/db/src/ClientManager.cpp +++ b/src/db/src/ClientManager.cpp @@ -1665,22 +1665,6 @@ void CClientManager::QUERY_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData) delete pkCache; } -void CClientManager::QUERY_SMS(CPeer * pkPeer, TPacketGDSMS * pack) -{ - char szQuery[QUERY_MAX_LEN]; - - char szMsg[256+1]; - //unsigned int len = CDBManager::instance().EscapeString(szMsg, pack->szMsg, strlen(pack->szMsg), SQL_ACCOUNT); - unsigned int len = CDBManager::instance().EscapeString(szMsg, pack->szMsg, strlen(pack->szMsg)); - szMsg[len] = '\0'; - - snprintf(szQuery, sizeof(szQuery), - "INSERT INTO sms_pool (server, sender, receiver, mobile, msg) VALUES(%d, '%s', '%s', '%s', '%s')", - (m_iPlayerIDStart + 2) / 3, pack->szFrom, pack->szTo, pack->szMobile, szMsg); - - CDBManager::instance().AsyncQuery(szQuery); -} - void CClientManager::QUERY_RELOAD_PROTO() { if (!InitializeTables()) @@ -2314,10 +2298,6 @@ void CClientManager::ProcessPackets(CPeer * peer) QUERY_CHANGE_NAME(peer, dwHandle, (TPacketGDChangeName *) data); break; - case HEADER_GD_SMS: - QUERY_SMS(peer, (TPacketGDSMS *) data); - break; - case HEADER_GD_AUTH_LOGIN: QUERY_AUTH_LOGIN(peer, dwHandle, (TPacketGDAuthLogin *) data); break; diff --git a/src/db/src/ClientManager.h b/src/db/src/ClientManager.h index 3b9d0bf..a6782d4 100644 --- a/src/db/src/ClientManager.h +++ b/src/db/src/ClientManager.h @@ -324,7 +324,6 @@ class CClientManager : public singleton void QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p); void GetPlayerFromRes(TPlayerTable * player_table, MYSQL_RES* res); - void QUERY_SMS(CPeer * pkPeer, TPacketGDSMS * p); void QUERY_LOGIN_KEY(CPeer * pkPeer, TPacketGDLoginKey * p); void AddGuildPriv(TPacketGiveGuildPriv* p); diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index 55f4bd5..70c94e8 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -357,7 +357,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad "id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime," "gold,level,level_step,st,ht,dx,iq,exp," "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair," - "skill_level,quickslot,skill_group,alignment,mobile,horse_level,horse_riding,horse_hp,horse_hp_droptime,horse_stamina," + "skill_level,quickslot,skill_group,alignment,horse_level,horse_riding,horse_hp,horse_hp_droptime,horse_stamina," "UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(last_play),horse_skill_point FROM player%s WHERE id=%d", GetTablePostfix(), packet->player_id); @@ -447,7 +447,7 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab) // "id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime," // "gold,level,level_step,st,ht,dx,iq,exp," // "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair," - // "skill_level,quickslot,skill_group,alignment,mobile,horse_level,horse_riding,horse_hp,horse_stamina FROM player%s WHERE id=%d", + // "skill_level,quickslot,skill_group,alignment,horse_level,horse_riding,horse_hp,horse_stamina FROM player%s WHERE id=%d", str_to_number(pkTab->id, row[col++]); strlcpy(pkTab->name, row[col++], sizeof(pkTab->name)); str_to_number(pkTab->job, row[col++]); @@ -498,11 +498,6 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab) str_to_number(pkTab->skill_group, row[col++]); str_to_number(pkTab->lAlignment, row[col++]); - if (row[col]) - { - strlcpy(pkTab->szMobile, row[col], sizeof(pkTab->szMobile)); - } - col++; str_to_number(pkTab->horse.bLevel, row[col++]); diff --git a/src/game/src/char.cpp b/src/game/src/char.cpp index 3528b97..afe96ac 100644 --- a/src/game/src/char.cpp +++ b/src/game/src/char.cpp @@ -258,8 +258,6 @@ void CHARACTER::Initialize() m_dwQuestByVnum = 0; m_pQuestItem = NULL; - m_szMobileAuth[0] = '\0'; - m_dwUnderGuildWarInfoMessageTime = get_dword_time()-60000; m_bUnderRefine = false; @@ -1219,9 +1217,6 @@ void CHARACTER::CreatePlayerProto(TPlayerTable & tab) for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i) tab.quickslot[i] = m_quickslot[i]; - if (m_stMobile.length() && !*m_szMobileAuth) - strlcpy(tab.szMobile, m_stMobile.c_str(), sizeof(tab.szMobile)); - memcpy(tab.parts, m_pointsInstant.parts, sizeof(tab.parts)); // REMOVE_REAL_SKILL_LEVLES @@ -1549,8 +1544,6 @@ void CHARACTER::MainCharacterPacket() strlcpy(mainChrPacket.szBGMName, bgmInfo.name.c_str(), sizeof(mainChrPacket.szBGMName)); GetDesc()->Packet(&mainChrPacket, sizeof(TPacketGCMainCharacter3_BGM)); } - //if (m_stMobile.length()) - // ChatPacket(CHAT_TYPE_COMMAND, "sms"); } // END_OF_SUPPORT_BGM else @@ -1568,9 +1561,6 @@ void CHARACTER::MainCharacterPacket() pack.skill_group = GetSkillGroup(); strlcpy(pack.szName, GetName(), sizeof(pack.szName)); GetDesc()->Packet(&pack, sizeof(TPacketGCMainCharacter)); - - if (m_stMobile.length()) - ChatPacket(CHAT_TYPE_COMMAND, "sms"); } } @@ -1790,8 +1780,6 @@ void CHARACTER::SetPlayerProto(const TPlayerTable * t) if (GetLevel() < PK_PROTECT_LEVEL) m_bPKMode = PK_MODE_PROTECT; - m_stMobile = t->szMobile; - SetHorseData(t->horse); if (GetHorseLevel() > 0) diff --git a/src/game/src/char.h b/src/game/src/char.h index 5e3356b..0450720 100644 --- a/src/game/src/char.h +++ b/src/game/src/char.h @@ -790,8 +790,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider DWORD m_dwPlayStartTime; BYTE m_bAddChrState; bool m_bSkipSave; - std::string m_stMobile; - char m_szMobileAuth[5]; BYTE m_bChatCounter; // End of Basic Points diff --git a/src/game/src/cmd.cpp b/src/game/src/cmd.cpp index b9d3bf6..0b25b1c 100644 --- a/src/game/src/cmd.cpp +++ b/src/game/src/cmd.cpp @@ -111,8 +111,6 @@ ACMD(do_cancel_guild_war); ACMD(do_guild_state); ACMD(do_pkmode); -ACMD(do_mobile); -ACMD(do_mobile_auth); ACMD(do_messenger_auth); ACMD(do_getqf); diff --git a/src/game/src/input.h b/src/game/src/input.h index dbb9d01..38a7608 100644 --- a/src/game/src/input.h +++ b/src/game/src/input.h @@ -308,7 +308,6 @@ class CInputP2P : public CInputProcessor void Disconnect(const char * c_pData); void MessengerAdd(const char * c_pData); void MessengerRemove(const char * c_pData); - void MessengerMobile(const char * c_pData); void FindPosition(LPDESC d, const char* c_pData); void WarpCharacter(const char* c_pData); void GuildWarZoneMapIndex(const char* c_pData); diff --git a/src/game/src/messenger_manager.cpp b/src/game/src/messenger_manager.cpp index e30b7b5..f1b2078 100644 --- a/src/game/src/messenger_manager.cpp +++ b/src/game/src/messenger_manager.cpp @@ -109,7 +109,6 @@ void MessengerManager::Logout(MessengerManager::keyA account) } m_Relation.erase(account); - //m_map_stMobile.erase(account); } void MessengerManager::RequestToAdd(LPCHARACTER ch, LPCHARACTER target) diff --git a/src/game/src/packet.h b/src/game/src/packet.h index d33ecf0..f602fb3 100644 --- a/src/game/src/packet.h +++ b/src/game/src/packet.h @@ -293,7 +293,6 @@ enum HEADER_GG_MESSENGER_REMOVE = 11, HEADER_GG_FIND_POSITION = 12, HEADER_GG_WARP_CHARACTER = 13, - HEADER_GG_MESSENGER_MOBILE = 14, HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX = 15, HEADER_GG_TRANSFER = 16, HEADER_GG_XMAS_WARP_SANTA = 17, @@ -430,11 +429,6 @@ typedef struct SPacketGGXmasWarpSantaReply BYTE bChannel; } TPacketGGXmasWarpSantaReply; -typedef struct SMessengerData -{ - char szMobile[MOBILE_MAX_LEN + 1]; -} TMessengerData; - typedef struct SPacketGGMessenger { BYTE bHeader; @@ -442,13 +436,6 @@ typedef struct SPacketGGMessenger char szCompanion[CHARACTER_NAME_MAX_LEN + 1]; } TPacketGGMessenger; -typedef struct SPacketGGMessengerMobile -{ - BYTE bHeader; - char szName[CHARACTER_NAME_MAX_LEN + 1]; - char szMobile[MOBILE_MAX_LEN + 1]; -} TPacketGGMessengerMobile; - typedef struct SPacketGGFindPosition { BYTE header; @@ -1436,8 +1423,7 @@ enum MESSENGER_SUBHEADER_GC_LIST, MESSENGER_SUBHEADER_GC_LOGIN, MESSENGER_SUBHEADER_GC_LOGOUT, - MESSENGER_SUBHEADER_GC_INVITE, - MESSENGER_SUBHEADER_GC_MOBILE + MESSENGER_SUBHEADER_GC_INVITE }; typedef struct packet_messenger diff --git a/src/game/src/packet_info.cpp b/src/game/src/packet_info.cpp index 874dbaf..88f4744 100644 --- a/src/game/src/packet_info.cpp +++ b/src/game/src/packet_info.cpp @@ -242,7 +242,6 @@ CPacketInfoGG::CPacketInfoGG() Set(HEADER_GG_MESSENGER_REMOVE, sizeof(TPacketGGMessenger), "MessengerRemove", false); Set(HEADER_GG_FIND_POSITION, sizeof(TPacketGGFindPosition), "FindPosition", false); Set(HEADER_GG_WARP_CHARACTER, sizeof(TPacketGGWarpCharacter), "WarpCharacter", false); - Set(HEADER_GG_MESSENGER_MOBILE, sizeof(TPacketGGMessengerMobile), "MessengerMobile", false); Set(HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX, sizeof(TPacketGGGuildWarMapIndex), "GuildWarMapIndex", false); Set(HEADER_GG_TRANSFER, sizeof(TPacketGGTransfer), "Transfer", false); Set(HEADER_GG_XMAS_WARP_SANTA, sizeof(TPacketGGXmasWarpSanta), "XmasWarpSanta", false); From 1ee687f2692e15b82c2baea1832151c294d14c18 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 31 Mar 2024 08:54:34 +0300 Subject: [PATCH 08/10] Removed unused PROTECT_CHILD_FOR_NEWCIBN --- src/game/src/db.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/game/src/db.h b/src/game/src/db.h index 3ac8abe..ecc888a 100644 --- a/src/game/src/db.h +++ b/src/game/src/db.h @@ -20,10 +20,6 @@ enum // BLOCK_CHAT QID_BLOCK_CHAT_LIST, // END_OF_BLOCK_CHAT - - // PROTECT_CHILD_FOR_NEWCIBN - QID_PROTECT_CHILD, - // END_PROTECT_CHILD_FOR_NEWCIBN }; class CQueryInfo From ebc479b7dfe03d4d3b4e5340833338ff86c45ba8 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 31 Mar 2024 09:09:35 +0300 Subject: [PATCH 09/10] Fixed "Invalid Socket Count 3, set to maximum" error --- src/game/src/item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/src/item.cpp b/src/game/src/item.cpp index 3531419..2fc238d 100644 --- a/src/game/src/item.cpp +++ b/src/game/src/item.cpp @@ -1129,7 +1129,7 @@ bool CItem::AddSocket() void CItem::AlterToSocketItem(int iSocketCount) { - if (iSocketCount >= ITEM_SOCKET_MAX_NUM) + if (iSocketCount > ITEM_SOCKET_MAX_NUM) { SPDLOG_ERROR("Invalid Socket Count {}, set to maximum", (int) ITEM_SOCKET_MAX_NUM); iSocketCount = ITEM_SOCKET_MAX_NUM; From 847ab2ef89717d3a7fbeec5f50c8c18f6b4a9d2d Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 31 Mar 2024 15:30:43 +0300 Subject: [PATCH 10/10] Fixed erroneous database table parsing due to incorrect SMS phone number removal --- src/db/src/ClientManagerPlayer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index 70c94e8..74303ec 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -498,8 +498,6 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab) str_to_number(pkTab->skill_group, row[col++]); str_to_number(pkTab->lAlignment, row[col++]); - col++; - str_to_number(pkTab->horse.bLevel, row[col++]); str_to_number(pkTab->horse.bRiding, row[col++]); str_to_number(pkTab->horse.sHealth, row[col++]);