From 05a1406c7c93e13d9fc42ff139dd56276de9c440 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Mar 2024 17:50:04 +0200 Subject: [PATCH] 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)