From 2c8cb0c8578b20cd34a4f92e189fcbeb68687148 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Dec 2023 10:30:52 +0200 Subject: [PATCH 1/5] Made a small-scale test with the spdlog library. Incidentally added fmt. --- Dockerfile | 2 +- README.md | 1 - src/common/version.h.in | 2 +- src/db/CMakeLists.txt | 34 +++++++++---- src/db/src/DBManager.cpp | 10 ++-- src/db/src/Main.cpp | 56 ++++++++++------------ src/db/src/stdafx.h | 2 + src/db/src/version.cpp | 15 ++---- src/game/CMakeLists.txt | 36 ++++++++++---- src/game/src/config.cpp | 12 ++--- src/game/src/db.cpp | 4 +- src/game/src/main.cpp | 101 +++++++++++++++++++-------------------- src/game/src/stdafx.h | 2 + src/game/src/version.cpp | 15 ++---- 14 files changed, 156 insertions(+), 136 deletions(-) diff --git a/Dockerfile b/Dockerfile index c620826..88f045b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && \ # Install vcpkg and the required libraries RUN git clone https://github.com/Microsoft/vcpkg.git RUN bash ./vcpkg/bootstrap-vcpkg.sh -RUN ./vcpkg/vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo +RUN ./vcpkg/vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog COPY . . diff --git a/README.md b/README.md index bbd11c9..612241b 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,6 @@ This is a very serious security risk and one of the reasons this project is stil - Migrate `conf.txt` and `CONFIG` to a modern dotenv-like format, which would enable pretty nice Docker images. - Add a health check to the Docker image. - Use the [fmt](https://fmt.dev/latest/index.html) library for safe and modern string formatting. -- Use a modern logging library to clean up the current mess. - Handle kernel signals (SIGTERM, SIGHUP etc.) for gracefully shutting down the game server. - Improve memory safety. - Use fixed width integer types instead of Microsoft-style typedefs. diff --git a/src/common/version.h.in b/src/common/version.h.in index 08dee7d..3777098 100644 --- a/src/common/version.h.in +++ b/src/common/version.h.in @@ -10,6 +10,6 @@ #define __COMPILER__ "@METIN2_COMPILER@" #define __CPU_TARGET__ "@METIN2_CPU_TARGET@" -void WriteVersion(std::ostream& out); +void WriteVersion(); #endif diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt index 7f420a9..9fe330f 100644 --- a/src/db/CMakeLists.txt +++ b/src/db/CMakeLists.txt @@ -12,17 +12,15 @@ include_directories(src) add_executable(${PROJECT_NAME} ${sources}) # Find dependencies + +# +# vcpkg dependencies +# + +# Boost find_package(Boost COMPONENTS system REQUIRED) target_link_libraries (${PROJECT_NAME} PRIVATE Boost::boost Boost::system) -# Pthreads -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) - -# LibBSD -target_link_libraries(${PROJECT_NAME} PRIVATE bsd) - # Libevent find_package(Libevent CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core libevent::extra libevent::pthreads) @@ -31,4 +29,24 @@ target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core libevent::extra lib find_package(effolkronium_random CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random) +# fmt +find_package(fmt CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) + +# spdlog +find_package(spdlog CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) + +# +# System-provided dependencies +# + +# Pthreads +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) + +# LibBSD +target_link_libraries(${PROJECT_NAME} PRIVATE bsd) + target_link_libraries(${PROJECT_NAME} PRIVATE libpoly libsql libthecore) diff --git a/src/db/src/DBManager.cpp b/src/db/src/DBManager.cpp index 2ee66f3..bc8c402 100644 --- a/src/db/src/DBManager.cpp +++ b/src/db/src/DBManager.cpp @@ -98,7 +98,7 @@ int CDBManager::Connect(int iSlot, const char * db_address, const int db_port, c if (iSlot < 0 || iSlot >= SQL_MAX_NUM) return false; - sys_log(0, "CREATING DIRECT_SQL"); + SPDLOG_INFO("CREATING DIRECT_SQL"); m_directSQL[iSlot] = new CAsyncSQL2; if (!m_directSQL[iSlot]->Setup(db_address, user, pwd, db_name, g_stLocale.c_str(), true, db_port)) { @@ -107,7 +107,7 @@ int CDBManager::Connect(int iSlot, const char * db_address, const int db_port, c } - sys_log(0, "CREATING MAIN_SQL"); + SPDLOG_INFO("CREATING MAIN_SQL"); m_mainSQL[iSlot] = new CAsyncSQL2; if (!m_mainSQL[iSlot]->Setup(db_address, user, pwd, db_name, g_stLocale.c_str(), false, db_port)) { @@ -115,7 +115,7 @@ int CDBManager::Connect(int iSlot, const char * db_address, const int db_port, c return false; } - sys_log(0, "CREATING ASYNC_SQL"); + SPDLOG_INFO("CREATING ASYNC_SQL"); m_asyncSQL[iSlot] = new CAsyncSQL2; if (!m_asyncSQL[iSlot]->Setup(db_address, user, pwd, db_name, g_stLocale.c_str(), false, db_port)) { @@ -166,14 +166,14 @@ unsigned int CDBManager::EscapeString(void *to, const void *from, unsigned int l void CDBManager::SetLocale(const char * szLocale) { const std::string stLocale(szLocale); - sys_log(0, "SetLocale start" ); + SPDLOG_DEBUG("SetLocale start"); for (int n = 0; n < SQL_MAX_NUM; ++n) { m_mainSQL[n]->SetLocale(stLocale); m_directSQL[n]->SetLocale(stLocale); m_asyncSQL[n]->SetLocale(stLocale); } - sys_log(0, "End setlocale %s", szLocale); + SPDLOG_DEBUG("End setlocale {}", szLocale); } void CDBManager::QueryLocaleSet() diff --git a/src/db/src/Main.cpp b/src/db/src/Main.cpp index df92cc9..a51d836 100644 --- a/src/db/src/Main.cpp +++ b/src/db/src/Main.cpp @@ -62,7 +62,7 @@ void emergency_sig(int sig) int main() { - WriteVersion(std::cout); + WriteVersion(); #ifdef __FreeBSD__ _malloc_options = "A"; @@ -133,26 +133,26 @@ int Start() { if (!CConfig::instance().LoadFile("conf.txt")) { - fprintf(stderr, "Loading conf.txt failed.\n"); + SPDLOG_ERROR("Loading conf.txt failed."); return false; } if (!CConfig::instance().GetValue("TEST_SERVER", &g_test_server)) { - fprintf(stderr, "Real Server\n"); + SPDLOG_INFO("Real Server"); } else - fprintf(stderr, "Test Server\n"); + SPDLOG_INFO("Test Server"); if (!CConfig::instance().GetValue("LOG", &g_log)) { - fprintf(stderr, "Log Off"); + SPDLOG_INFO("Log Off"); g_log= 0; } else { g_log = 1; - fprintf(stderr, "Log On"); + SPDLOG_INFO("Log On"); } @@ -161,7 +161,7 @@ int Start() int heart_beat = 50; if (!CConfig::instance().GetValue("CLIENT_HEART_FPS", &heart_beat)) { - fprintf(stderr, "Cannot find CLIENT_HEART_FPS configuration.\n"); + SPDLOG_ERROR("Cannot find CLIENT_HEART_FPS configuration."); return false; } @@ -171,7 +171,7 @@ int Start() { tmpValue = std::clamp(tmpValue, 3, 30); log_set_expiration_days(tmpValue); - fprintf(stderr, "Setting log keeping days to %d\n", tmpValue); + SPDLOG_INFO("Setting log keeping days to {}", tmpValue); } thecore_init(heart_beat, emptybeat); @@ -182,12 +182,12 @@ int Start() if (CConfig::instance().GetValue("LOCALE", szBuf, 256)) { g_stLocale = szBuf; - sys_log(0, "LOCALE set to %s", g_stLocale.c_str()); + SPDLOG_INFO("LOCALE set to {}", g_stLocale.c_str()); // CHINA_DISABLE_HOTBACKUP if ("gb2312" == g_stLocale) { - sys_log(0, "CIBN_LOCALE: DISABLE_HOTBACKUP"); + SPDLOG_INFO("CIBN_LOCALE: DISABLE_HOTBACKUP"); g_bHotBackup = false; } // END_OF_CHINA_DISABLE_HOTBACKUP @@ -197,8 +197,8 @@ int Start() if (CConfig::instance().GetValue("DISABLE_HOTBACKUP", &iDisableHotBackup)) { if (iDisableHotBackup) - { - sys_log(0, "CONFIG: DISABLE_HOTBACKUP"); + { + SPDLOG_INFO("CONFIG: DISABLE_HOTBACKUP"); g_bHotBackup = false; } } @@ -206,7 +206,7 @@ int Start() if (!CConfig::instance().GetValue("TABLE_POSTFIX", szBuf, 256)) { - sys_err("TABLE_POSTFIX not configured use default"); + SPDLOG_WARN("TABLE_POSTFIX not configured use default"); szBuf[0] = '\0'; } @@ -215,20 +215,20 @@ int Start() if (CConfig::instance().GetValue("PLAYER_CACHE_FLUSH_SECONDS", szBuf, 256)) { str_to_number(g_iPlayerCacheFlushSeconds, szBuf); - sys_log(0, "PLAYER_CACHE_FLUSH_SECONDS: %d", g_iPlayerCacheFlushSeconds); + SPDLOG_INFO("PLAYER_CACHE_FLUSH_SECONDS: {}", g_iPlayerCacheFlushSeconds); } if (CConfig::instance().GetValue("ITEM_CACHE_FLUSH_SECONDS", szBuf, 256)) { str_to_number(g_iItemCacheFlushSeconds, szBuf); - sys_log(0, "ITEM_CACHE_FLUSH_SECONDS: %d", g_iItemCacheFlushSeconds); + SPDLOG_INFO("ITEM_CACHE_FLUSH_SECONDS: {}", g_iItemCacheFlushSeconds); } // MYSHOP_PRICE_LIST if (CConfig::instance().GetValue("ITEM_PRICELIST_CACHE_FLUSH_SECONDS", szBuf, 256)) { str_to_number(g_iItemPriceListTableCacheFlushSeconds, szBuf); - sys_log(0, "ITEM_PRICELIST_CACHE_FLUSH_SECONDS: %d", g_iItemPriceListTableCacheFlushSeconds); + SPDLOG_INFO("ITEM_PRICELIST_CACHE_FLUSH_SECONDS: {}", g_iItemPriceListTableCacheFlushSeconds); } // END_OF_MYSHOP_PRICE_LIST // @@ -241,7 +241,7 @@ int Start() int iIDStart; if (!CConfig::instance().GetValue("PLAYER_ID_START", &iIDStart)) { - sys_err("PLAYER_ID_START not configured"); + SPDLOG_ERROR("PLAYER_ID_START not configured"); return false; } @@ -249,7 +249,7 @@ int Start() if (CConfig::instance().GetValue("NAME_COLUMN", szBuf, 256)) { - fprintf(stderr, "%s %s", g_stLocaleNameColumn.c_str(), szBuf); + SPDLOG_INFO("{} {}", g_stLocaleNameColumn, szBuf); g_stLocaleNameColumn = szBuf; } @@ -260,7 +260,7 @@ int Start() if (CConfig::instance().GetValue("SQL_PLAYER", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (player)"); + SPDLOG_DEBUG("Connecting to MySQL server (player)"); int iRetry = 5; @@ -268,20 +268,18 @@ int Start() { if (CDBManager::instance().Connect(SQL_PLAYER, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_INFO("Connected to MySQL server (player)"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_ERROR("Connection to MySQL server (player) failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success PLAYER\n"); SetPlayerDBName(szDB); } else { - sys_err("SQL_PLAYER not configured"); + SPDLOG_ERROR("SQL_PLAYER not configured"); return false; } @@ -368,19 +366,17 @@ int Start() return false; } - sys_log(0, "ClientManager initialization.. "); - if (!CClientManager::instance().Initialize()) { - sys_log(0, " failed"); + SPDLOG_ERROR("ClientManager initialization failed"); return false; } - sys_log(0, " OK"); + SPDLOG_INFO("ClientManager initialization OK"); - if (!PlayerHB::instance().Initialize()) + if (!PlayerHB::instance().Initialize()) { - sys_err("cannot initialize player hotbackup"); + SPDLOG_ERROR("cannot initialize player hotbackup"); return false; } diff --git a/src/db/src/stdafx.h b/src/db/src/stdafx.h index df0b38d..6d90277 100644 --- a/src/db/src/stdafx.h +++ b/src/db/src/stdafx.h @@ -17,6 +17,8 @@ #include #include +#include + #include #include #include diff --git a/src/db/src/version.cpp b/src/db/src/version.cpp index f9972a6..c6347e8 100644 --- a/src/db/src/version.cpp +++ b/src/db/src/version.cpp @@ -1,15 +1,8 @@ +#include #include -void WriteVersion(std::ostream& out) { - out << "Metin2 DB Cache version " << __COMMIT_TAG__ << " " - << "(rev. " << __REVISION__ << ", date: " << __COMMIT_DATE__ << ")" - << std::endl; - - out << "OS: " << __OS_NAME__ << ", " - << "target arch: " << __CPU_TARGET__ << ", " - << "compiler: " << __COMPILER__ - << std::endl; - - out << std::endl; +void WriteVersion() { + fmt::println("Metin2 DB Cache version {} (rev. {}, date: {})", __COMMIT_TAG__, __REVISION__, __COMMIT_DATE__); + fmt::println("OS: {}, target arch: {}, compiler: {}", __OS_NAME__, __CPU_TARGET__, __COMPILER__); } diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 71f7160..fb95bdf 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -12,6 +12,10 @@ add_executable(${PROJECT_NAME} ${sources}) # Find dependencies +# +# vcpkg dependencies +# + # MySQL find_package(unofficial-libmysql REQUIRED) target_link_libraries(${PROJECT_NAME} unofficial::libmysql::libmysql) @@ -28,11 +32,6 @@ target_link_libraries (${PROJECT_NAME} Boost::boost) find_package(Libevent CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} libevent::core libevent::extra libevent::pthreads) -# DevIL -find_package(DevIL REQUIRED) -include_directories(${IL_INCLUDE_DIR}) -target_link_libraries(${PROJECT_NAME} ${IL_LIBRARIES}) - # LZO find_package(LZO REQUIRED) if (LZO_FOUND) @@ -40,6 +39,27 @@ if (LZO_FOUND) target_link_libraries(${PROJECT_NAME} ${LZO_LIBRARIES}) endif (LZO_FOUND) +# effolkronium/random +find_package(effolkronium_random CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} effolkronium_random) + +# fmt +find_package(fmt CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} fmt::fmt) + +# spdlog +find_package(spdlog CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} spdlog::spdlog) + +# +# System-provided dependencies +# + +# DevIL +find_package(DevIL REQUIRED) +include_directories(${IL_INCLUDE_DIR}) +target_link_libraries(${PROJECT_NAME} ${IL_LIBRARIES}) + # Pthreads set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -48,8 +68,8 @@ target_link_libraries(${PROJECT_NAME} Threads::Threads) # LibBSD target_link_libraries(${PROJECT_NAME} bsd) -# effolkronium/random -find_package(effolkronium_random CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} effolkronium_random) +# +# Project-provided dependencies +# target_link_libraries(${PROJECT_NAME} libgame libpoly libsql libthecore liblua) diff --git a/src/game/src/config.cpp b/src/game/src/config.cpp index b278ec7..e9b1cdc 100644 --- a/src/game/src/config.cpp +++ b/src/game/src/config.cpp @@ -271,13 +271,13 @@ bool GetIPInfo() { char * ip = inet_ntoa(sai->sin_addr); strlcpy(g_szInternalIP, ip, sizeof(g_szInternalIP)); - fprintf(stderr, "Internal IP automatically configured: %s interface %s\n", ip, ifap->ifa_name); + SPDLOG_WARN("Internal IP automatically configured: {} interface {}", ip, ifap->ifa_name); } else if (g_szPublicIP[0] == '0') { char * ip = inet_ntoa(sai->sin_addr); strlcpy(g_szPublicIP, ip, sizeof(g_szPublicIP)); - fprintf(stderr, "Public IP automatically configured: %s interface %s\n", ip, ifap->ifa_name); + SPDLOG_WARN("Public IP automatically configured: {} interface {}", ip, ifap->ifa_name); } } @@ -396,7 +396,7 @@ void config_init(const string& st_localeServiceName) TOKEN("hostname") { g_stHostname = value_string; - fprintf(stdout, "HOSTNAME: %s\n", g_stHostname.c_str()); + SPDLOG_INFO("HOSTNAME: {}", g_stHostname); continue; } @@ -509,11 +509,11 @@ void config_init(const string& st_localeServiceName) if (false == AccountDB::instance().IsConnected()) { - fprintf(stderr, "cannot start server while no common sql connected\n"); - exit(1); + SPDLOG_CRITICAL("cannot start server while no common sql connected"); + exit(EXIT_FAILURE); } - fprintf(stdout, "CommonSQL connected\n"); + SPDLOG_INFO("CommonSQL connected"); // ·ÎÄÉÀÏ Á¤º¸¸¦ °¡Á®¿ÀÀÚ // <°æ°í> Äõ¸®¹®¿¡ Àý´ë Á¶°Ç¹®(WHERE) ´ÞÁö ¸¶¼¼¿ä. (´Ù¸¥ Áö¿ª¿¡¼­ ¹®Á¦°¡ »ý±æ¼ö ÀÖ½À´Ï´Ù) diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index 6aac486..0ffb912 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -1233,11 +1233,11 @@ bool AccountDB::IsConnected() bool AccountDB::Connect(const char * host, const int port, const char * user, const char * pwd, const char * db) { - m_IsConnect = m_sql_direct.Setup(host, user, pwd, db, "", true, port); + m_IsConnect = m_sql_direct.Setup(host, user, pwd, db, nullptr, true, port); if (false == m_IsConnect) { - fprintf(stderr, "cannot open direct sql connection to host: %s user: %s db: %s\n", host, user, db); + SPDLOG_ERROR("cannot open direct sql connection to host: {} user: {} db: {}", host, user, db); return false; } diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index 5192696..f05b915 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -162,7 +162,7 @@ void ShutdownOnFatalError() { if (!g_bShutdown) { - sys_err("ShutdownOnFatalError!!!!!!!!!!"); + SPDLOG_CRITICAL("ShutdownOnFatalError!!!!!!!!!!"); { char buf[256]; @@ -258,7 +258,7 @@ void heartbeat(LPHEART ht, int pulse) if (++count > 50) { - sys_log(0, "FLUSH_SENT"); + SPDLOG_DEBUG("FLUSH_SENT"); break; } } @@ -273,7 +273,7 @@ void heartbeat(LPHEART ht, int pulse) for (int i = 0; i < count; ++i, ++save_idx) db_clientdesc->DBPacket(HEADER_GD_PLAYER_SAVE, 0, &g_vec_save[save_idx], sizeof(TPlayerTable)); - sys_log(0, "SAVE_FLUSH %d", count); + SPDLOG_DEBUG("SAVE_FLUSH {}", count); } } } @@ -331,7 +331,7 @@ int main(int argc, char **argv) ilInit(); // DevIL Initialize - WriteVersion(std::cout); + WriteVersion(); SECTREE_MANAGER sectree_manager; CHARACTER_MANAGER char_manager; @@ -419,12 +419,12 @@ int main(int argc, char **argv) const std::string strPackageCryptInfoDir = "package/"; if( !desc_manager.LoadClientPackageCryptInfo( strPackageCryptInfoDir.c_str() ) ) { - sys_err("Failed to Load ClientPackageCryptInfo File(%s)", strPackageCryptInfoDir.c_str()); + SPDLOG_WARN("Failed to Load ClientPackageCryptInfo Files ({})", strPackageCryptInfoDir); } while (idle()); - sys_log(0, " Starting..."); + SPDLOG_INFO(" Starting..."); g_bShutdown = true; g_bNoMoreClient = true; @@ -438,7 +438,7 @@ int main(int argc, char **argv) do { DWORD dwCount = DBManager::instance().CountQuery(); - sys_log(0, "Queries %u", dwCount); + SPDLOG_DEBUG("Queries {}", dwCount); if (dwCount == 0) break; @@ -451,38 +451,38 @@ int main(int argc, char **argv) } while (1); } - sys_log(0, " Destroying CArenaManager..."); + SPDLOG_INFO(" Destroying CArenaManager..."); arena_manager.Destroy(); - sys_log(0, " Destroying COXEventManager..."); + SPDLOG_INFO(" Destroying COXEventManager..."); OXEvent_manager.Destroy(); - sys_log(0, " Disabling signal timer..."); + SPDLOG_INFO(" Disabling signal timer..."); signal_timer_disable(); - sys_log(0, " Shutting down CHARACTER_MANAGER..."); + SPDLOG_INFO(" Shutting down CHARACTER_MANAGER..."); char_manager.GracefulShutdown(); - sys_log(0, " Shutting down ITEM_MANAGER..."); + SPDLOG_INFO(" Shutting down ITEM_MANAGER..."); item_manager.GracefulShutdown(); - sys_log(0, " Flushing db_clientdesc..."); + SPDLOG_INFO(" Flushing db_clientdesc..."); db_clientdesc->FlushOutput(); - sys_log(0, " Flushing p2p_manager..."); + SPDLOG_INFO(" Flushing p2p_manager..."); p2p_manager.FlushOutput(); - sys_log(0, " Destroying CShopManager..."); + SPDLOG_INFO(" Destroying CShopManager..."); shop_manager.Destroy(); - sys_log(0, " Destroying CHARACTER_MANAGER..."); + SPDLOG_INFO(" Destroying CHARACTER_MANAGER..."); char_manager.Destroy(); - sys_log(0, " Destroying ITEM_MANAGER..."); + SPDLOG_INFO(" Destroying ITEM_MANAGER..."); item_manager.Destroy(); - sys_log(0, " Destroying DESC_MANAGER..."); + SPDLOG_INFO(" Destroying DESC_MANAGER..."); desc_manager.Destroy(); - sys_log(0, " Destroying quest::CQuestManager..."); + SPDLOG_INFO(" Destroying quest::CQuestManager..."); quest_manager.Destroy(); - sys_log(0, " Destroying building::CManager..."); + SPDLOG_INFO(" Destroying building::CManager..."); building_manager.Destroy(); - sys_log(0, " Flushing TrafficProfiler..."); + SPDLOG_INFO(" Flushing TrafficProfiler..."); trafficProfiler.Flush(); destroy(); @@ -592,23 +592,21 @@ int start(int argc, char **argv) // In Windows dev mode, "verbose" option is [on] by default. bVerbose = true; #endif - if (!bVerbose) - freopen("stdout", "a", stdout); bool is_thecore_initialized = thecore_init(25, heartbeat); if (!is_thecore_initialized) { - fprintf(stderr, "Could not initialize thecore, check owner of pid, syslog\n"); - exit(0); + SPDLOG_CRITICAL("Could not initialize thecore, check owner of pid, syslog"); + exit(EXIT_FAILURE); } if (false == CThreeWayWar::instance().LoadSetting("forkedmapindex.txt")) { if (false == g_bAuthServer) { - fprintf(stderr, "Could not Load ThreeWayWar Setting file"); - exit(0); + SPDLOG_CRITICAL("Could not Load ThreeWayWar Setting file"); + exit(EXIT_FAILURE); } } @@ -618,25 +616,25 @@ int start(int argc, char **argv) // Check if the public and internal IP addresses were configured if (g_szInternalIP[0] == '0') { - fprintf(stderr, "Public IP address could not be automatically detected. Manually set the IP and try again."); - return 0; + SPDLOG_CRITICAL("Public IP address could not be automatically detected. Manually set the IP and try again."); + exit(EXIT_FAILURE); } if (g_szPublicIP[0] == '0') { - fprintf(stderr, "Public IP address could not be automatically detected. Manually set the IP and try again."); - return 0; + SPDLOG_CRITICAL("Public IP address could not be automatically detected. Manually set the IP and try again."); + exit(EXIT_FAILURE); } // Create a new libevent base and listen for new connections ev_base = event_base_new(); if (!ev_base) { - sys_err("Libevent base initialization FAILED!"); - return 0; + SPDLOG_CRITICAL("Libevent base initialization FAILED!"); + exit(EXIT_FAILURE); } dns_base = evdns_base_new(ev_base, 1); if (!dns_base) { - sys_err("Libevent DNS base initialization FAILED!"); - return 0; + SPDLOG_CRITICAL("Libevent DNS base initialization FAILED!"); + exit(EXIT_FAILURE); } sockaddr_in sin = {}; @@ -653,10 +651,10 @@ int start(int argc, char **argv) (const sockaddr*)&sin, sizeof(sin) ); if (!tcp_listener) { - sys_err("TCP listener initialization FAILED!"); - return 0; + SPDLOG_CRITICAL("TCP listener initialization FAILED!"); + exit(EXIT_FAILURE); } - fprintf(stdout, "TCP listening on %s:%u\n", g_szPublicBindIP, mother_port); + SPDLOG_INFO("TCP listening on {}:{}", g_szPublicBindIP, mother_port); evconnlistener_set_error_cb(tcp_listener, AcceptError); // Game P2P listener @@ -671,10 +669,10 @@ int start(int argc, char **argv) (const sockaddr*)&sin, sizeof(sin) ); if (!p2p_listener) { - sys_err("P2P listener initialization FAILED!"); - return 0; + SPDLOG_CRITICAL("P2P listener initialization FAILED!"); + exit(EXIT_FAILURE); } - fprintf(stdout, "P2P listening on %s:%u\n", g_szInternalBindIP, p2p_port); + SPDLOG_INFO("P2P listening on {}:{}", g_szInternalBindIP, p2p_port); evconnlistener_set_error_cb(p2p_listener, AcceptError); // Create client connections @@ -687,7 +685,7 @@ int start(int argc, char **argv) { if (g_stAuthMasterIP.length() != 0) { - fprintf(stderr, "SlaveAuth"); + SPDLOG_INFO("SlaveAuth"); g_pkAuthMasterDesc = DESC_MANAGER::instance().CreateConnectionDesc(ev_base, dns_base, g_stAuthMasterIP.c_str(), g_wAuthMasterPort, PHASE_P2P, true); P2P_MANAGER::instance().RegisterConnector(g_pkAuthMasterDesc); g_pkAuthMasterDesc->SetP2P(g_wAuthMasterPort, g_bChannel); @@ -695,7 +693,7 @@ int start(int argc, char **argv) } else { - fprintf(stderr, "MasterAuth %d", LC_GetLocalType()); + SPDLOG_INFO("MasterAuth {}", (int) LC_GetLocalType()); } } /* game server to teen server */ @@ -708,7 +706,7 @@ int start(int argc, char **argv) extern unsigned int g_uiSpamBlockScore; extern unsigned int g_uiSpamReloadCycle; - sys_log(0, "SPAM_CONFIG: duration %u score %u reload cycle %u\n", + SPDLOG_INFO("SPAM_CONFIG: duration {} score {} reload cycle {}", g_uiSpamBlockDuration, g_uiSpamBlockScore, g_uiSpamReloadCycle); extern void LoadSpamDB(); @@ -721,13 +719,13 @@ int start(int argc, char **argv) void destroy() { - sys_log(0, " Canceling ReloadSpamEvent..."); + SPDLOG_INFO(" Canceling ReloadSpamEvent..."); CancelReloadSpamEvent(); - sys_log(0, " regen_free()..."); + SPDLOG_INFO(" regen_free()..."); regen_free(); - sys_log(0, " Closing network stack..."); + SPDLOG_INFO(" Closing network stack..."); if (tcp_listener) { evconnlistener_free(tcp_listener); tcp_listener = nullptr; @@ -748,13 +746,13 @@ void destroy() ev_base = nullptr; } - sys_log(0, " event_destroy()..."); + SPDLOG_INFO(" event_destroy()..."); event_destroy(); - sys_log(0, " CTextFileLoader::DestroySystem()..."); + SPDLOG_INFO(" CTextFileLoader::DestroySystem()..."); CTextFileLoader::DestroySystem(); - sys_log(0, " thecore_destroy()..."); + SPDLOG_INFO(" thecore_destroy()..."); thecore_destroy(); } @@ -840,8 +838,7 @@ int idle() static void AcceptError(evconnlistener *listener, void *ctx) { struct event_base *base = evconnlistener_get_base(listener); int err = EVUTIL_SOCKET_ERROR(); - fprintf(stderr, "Got an error %d (%s) on the listener. " - "Shutting down.\n", err, evutil_socket_error_to_string(err)); + SPDLOG_CRITICAL("Got an error {} ({}) on the listener. Shutting down.", err, evutil_socket_error_to_string(err)); event_base_loopexit(base, nullptr); ShutdownOnFatalError(); diff --git a/src/game/src/stdafx.h b/src/game/src/stdafx.h index 375c48c..bdd77ca 100644 --- a/src/game/src/stdafx.h +++ b/src/game/src/stdafx.h @@ -14,6 +14,8 @@ #include #include +#include + #include #include #include diff --git a/src/game/src/version.cpp b/src/game/src/version.cpp index 5bb175a..70b140b 100644 --- a/src/game/src/version.cpp +++ b/src/game/src/version.cpp @@ -1,15 +1,8 @@ +#include #include -void WriteVersion(std::ostream& out) { - out << "Metin2 Game Server version " << __COMMIT_TAG__ << " " - << "(rev. " << __REVISION__ << ", date: " << __COMMIT_DATE__ << ")" - << std::endl; - - out << "OS: " << __OS_NAME__ << ", " - << "target arch: " << __CPU_TARGET__ << ", " - << "compiler: " << __COMPILER__ - << std::endl; - - out << std::endl; +void WriteVersion() { + fmt::println("Metin2 Game Server version {} (rev. {}, date: {})", __COMMIT_TAG__, __REVISION__, __COMMIT_DATE__); + fmt::println("OS: {}, target arch: {}, compiler: {}", __OS_NAME__, __CPU_TARGET__, __COMPILER__); } From 2f829ae2dc2b57956a4df5b0a437b5b2092f6761 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 30 Dec 2023 22:15:54 +0200 Subject: [PATCH 2/5] Applied changes on the game executable. --- src/game/src/BlueDragon.cpp | 8 +- src/game/src/BlueDragon_Binder.cpp | 22 +- src/game/src/BlueDragon_Skill.h | 12 +- src/game/src/ClientPackageCryptInfo.cpp | 18 +- src/game/src/DragonLair.cpp | 8 +- src/game/src/DragonSoul.cpp | 48 +- src/game/src/MarkConvert.cpp | 10 +- src/game/src/MarkImage.cpp | 21 +- src/game/src/MarkManager.cpp | 21 +- src/game/src/OXEvent.cpp | 6 +- src/game/src/PetSystem.cpp | 16 +- src/game/src/SpeedServer.cpp | 38 +- src/game/src/ani.cpp | 11 +- src/game/src/arena.cpp | 50 +- src/game/src/auction_manager.cpp | 36 +- src/game/src/battle.cpp | 24 +- src/game/src/belt_inventory_helper.h | 2 +- src/game/src/blend_item.cpp | 9 +- src/game/src/block_country.cpp | 13 +- src/game/src/buff_on_attributes.cpp | 2 +- src/game/src/building.cpp | 66 +- src/game/src/castle.cpp | 8 +- src/game/src/char.cpp | 779 +++++++++++----------- src/game/src/char_affect.cpp | 35 +- src/game/src/char_battle.cpp | 140 ++-- src/game/src/char_dragonsoul.cpp | 2 +- src/game/src/char_horse.cpp | 9 +- src/game/src/char_item.cpp | 127 ++-- src/game/src/char_manager.cpp | 57 +- src/game/src/char_resist.cpp | 4 +- src/game/src/char_skill.cpp | 198 +++--- src/game/src/char_state.cpp | 15 +- src/game/src/cmd.cpp | 8 +- src/game/src/cmd_emotion.cpp | 6 +- src/game/src/cmd_general.cpp | 41 +- src/game/src/cmd_gm.cpp | 39 +- src/game/src/config.cpp | 131 ++-- src/game/src/cube.cpp | 49 +- src/game/src/db.cpp | 94 ++- src/game/src/desc.cpp | 92 +-- src/game/src/desc.h | 3 - src/game/src/desc_client.cpp | 30 +- src/game/src/desc_manager.cpp | 13 +- src/game/src/desc_p2p.cpp | 10 +- src/game/src/dev_log.cpp | 152 ----- src/game/src/dev_log.h | 79 --- src/game/src/dragon_soul_table.cpp | 185 ++--- src/game/src/dungeon.cpp | 132 ++-- src/game/src/dungeon.h | 2 +- src/game/src/entity_view.cpp | 2 +- src/game/src/event.cpp | 3 +- src/game/src/exchange.cpp | 10 +- src/game/src/fishing.cpp | 10 +- src/game/src/gm.cpp | 18 +- src/game/src/group_text_parse_tree.cpp | 8 +- src/game/src/guild.cpp | 68 +- src/game/src/guild_manager.cpp | 24 +- src/game/src/guild_war.cpp | 58 +- src/game/src/horse_rider.cpp | 18 +- src/game/src/horsename_manager.cpp | 4 +- src/game/src/input.cpp | 48 +- src/game/src/input_auth.cpp | 21 +- src/game/src/input_db.cpp | 260 ++++---- src/game/src/input_login.cpp | 83 ++- src/game/src/input_main.cpp | 152 ++--- src/game/src/input_p2p.cpp | 30 +- src/game/src/input_teen.cpp | 1 - src/game/src/item.cpp | 69 +- src/game/src/item_addon.cpp | 2 +- src/game/src/item_attribute.cpp | 6 +- src/game/src/item_manager.cpp | 77 +-- src/game/src/item_manager_idrange.cpp | 14 +- src/game/src/item_manager_read_tables.cpp | 78 ++- src/game/src/locale.cpp | 8 +- src/game/src/locale_service.cpp | 23 +- src/game/src/log.cpp | 7 +- src/game/src/login_data.cpp | 6 +- src/game/src/login_sim.h | 2 +- src/game/src/lzo_manager.cpp | 2 +- src/game/src/main.cpp | 10 +- src/game/src/map_location.cpp | 8 +- src/game/src/marriage.cpp | 26 +- src/game/src/matrix_card.cpp | 4 +- src/game/src/messenger_manager.cpp | 8 +- src/game/src/mining.cpp | 12 +- src/game/src/mob_manager.cpp | 24 +- src/game/src/monarch.cpp | 13 +- src/game/src/motion.cpp | 30 +- src/game/src/p2p.cpp | 18 +- src/game/src/panama.cpp | 6 +- src/game/src/party.cpp | 56 +- src/game/src/party.h | 4 +- src/game/src/polymorph.cpp | 2 +- src/game/src/priv_manager.cpp | 24 +- src/game/src/profiler.h | 4 +- src/game/src/pvp.cpp | 8 +- src/game/src/questevent.cpp | 8 +- src/game/src/questlua.cpp | 52 +- src/game/src/questlua_affect.cpp | 18 +- src/game/src/questlua_arena.cpp | 4 +- src/game/src/questlua_building.cpp | 8 +- src/game/src/questlua_dragonsoul.cpp | 13 +- src/game/src/questlua_dungeon.cpp | 118 ++-- src/game/src/questlua_forked.cpp | 11 +- src/game/src/questlua_game.cpp | 9 +- src/game/src/questlua_global.cpp | 95 ++- src/game/src/questlua_guild.cpp | 23 +- src/game/src/questlua_horse.cpp | 11 +- src/game/src/questlua_item.cpp | 19 +- src/game/src/questlua_marriage.cpp | 43 +- src/game/src/questlua_monarch.cpp | 36 +- src/game/src/questlua_npc.cpp | 2 +- src/game/src/questlua_party.cpp | 19 +- src/game/src/questlua_pc.cpp | 143 ++-- src/game/src/questlua_pet.cpp | 7 - src/game/src/questlua_quest.cpp | 23 +- src/game/src/questlua_speedserver.cpp | 30 +- src/game/src/questlua_target.cpp | 12 +- src/game/src/questmanager.cpp | 134 ++-- src/game/src/questmanager.h | 6 + src/game/src/questnpc.cpp | 61 +- src/game/src/questnpc.h | 3 +- src/game/src/questpc.cpp | 64 +- src/game/src/refine.cpp | 6 +- src/game/src/regen.cpp | 20 +- src/game/src/safebox.cpp | 16 +- src/game/src/sectree.cpp | 12 +- src/game/src/sectree.h | 10 +- src/game/src/sectree_manager.cpp | 112 ++-- src/game/src/sectree_manager.h | 2 +- src/game/src/shop.cpp | 39 +- src/game/src/shopEx.cpp | 12 +- src/game/src/shop_manager.cpp | 55 +- src/game/src/skill.cpp | 34 +- src/game/src/skill_power.cpp | 2 +- src/game/src/spam.h | 2 +- src/game/src/target.cpp | 20 +- src/game/src/text_file_loader.cpp | 36 +- src/game/src/threeway_war.cpp | 8 +- src/game/src/trigger.cpp | 2 +- src/game/src/utils.cpp | 4 +- src/game/src/war_map.cpp | 52 +- src/game/src/wedding.cpp | 20 +- src/game/src/xmas_event.cpp | 8 +- 144 files changed, 2547 insertions(+), 3147 deletions(-) delete mode 100644 src/game/src/dev_log.cpp delete mode 100644 src/game/src/dev_log.h diff --git a/src/game/src/BlueDragon.cpp b/src/game/src/BlueDragon.cpp index 15089ee..d9e15c4 100644 --- a/src/game/src/BlueDragon.cpp +++ b/src/game/src/BlueDragon.cpp @@ -31,7 +31,7 @@ time_t UseBlueDragonSkill(LPCHARACTER pChar, unsigned int idx) { case 0: { - sys_log(0, "BlueDragon: Using Skill Breath"); + SPDLOG_DEBUG("BlueDragon: Using Skill Breath"); FSkillBreath f(pChar); @@ -43,7 +43,7 @@ time_t UseBlueDragonSkill(LPCHARACTER pChar, unsigned int idx) case 1: { - sys_log(0, "BlueDragon: Using Skill Weak Breath"); + SPDLOG_DEBUG("BlueDragon: Using Skill Weak Breath"); FSkillWeakBreath f(pChar); @@ -55,7 +55,7 @@ time_t UseBlueDragonSkill(LPCHARACTER pChar, unsigned int idx) case 2: { - sys_log(0, "BlueDragon: Using Skill EarthQuake"); + SPDLOG_DEBUG("BlueDragon: Using Skill EarthQuake"); FSkillEarthQuake f(pChar); @@ -71,7 +71,7 @@ time_t UseBlueDragonSkill(LPCHARACTER pChar, unsigned int idx) break; default: - sys_err("BlueDragon: Wrong Skill Index: %d", idx); + SPDLOG_ERROR("BlueDragon: Wrong Skill Index: {}", idx); return 0; } diff --git a/src/game/src/BlueDragon_Binder.cpp b/src/game/src/BlueDragon_Binder.cpp index b6bbfe7..dccd4f2 100644 --- a/src/game/src/BlueDragon_Binder.cpp +++ b/src/game/src/BlueDragon_Binder.cpp @@ -32,7 +32,7 @@ unsigned int BlueDragon_GetSkillFactor(const size_t cnt, ...) { va_end(vl); lua_settop( L, stack_top ); - sys_err("BlueDragon: wrong key list"); + SPDLOG_ERROR("BlueDragon: wrong key list"); return 0; } @@ -43,7 +43,7 @@ unsigned int BlueDragon_GetSkillFactor(const size_t cnt, ...) { va_end(vl); lua_settop( L, stack_top ); - sys_err("BlueDragon: wrong key table %s", key); + SPDLOG_ERROR("BlueDragon: wrong key table {}", key); return 0; } } @@ -53,7 +53,7 @@ unsigned int BlueDragon_GetSkillFactor(const size_t cnt, ...) if (false == lua_isnumber(L, -1)) { lua_settop( L, stack_top ); - sys_err("BlueDragon: Last key is not a number"); + SPDLOG_ERROR("BlueDragon: Last key is not a number"); return 0; } @@ -86,7 +86,7 @@ unsigned int BlueDragon_GetRangeFactor(const char* key, const int val) { lua_settop( L, stack_top ); - sys_err("BlueDragon: no required table %s", key); + SPDLOG_ERROR("BlueDragon: no required table {}", key); return 0; } @@ -100,7 +100,7 @@ unsigned int BlueDragon_GetRangeFactor(const char* key, const int val) { lua_settop( L, stack_top ); - sys_err("BlueDragon: wrong table index %s %d", key, i); + SPDLOG_ERROR("BlueDragon: wrong table index {} {}", key, i); return 0; } @@ -111,7 +111,7 @@ unsigned int BlueDragon_GetRangeFactor(const char* key, const int val) { lua_settop( L, stack_top ); - sys_err("BlueDragon: no min value set %s", key); + SPDLOG_ERROR("BlueDragon: no min value set {}", key); return 0; } @@ -126,7 +126,7 @@ unsigned int BlueDragon_GetRangeFactor(const char* key, const int val) { lua_settop( L, stack_top ); - sys_err("BlueDragon: no max value set %s", key); + SPDLOG_ERROR("BlueDragon: no max value set {}", key); return 0; } @@ -143,7 +143,7 @@ unsigned int BlueDragon_GetRangeFactor(const char* key, const int val) { lua_settop( L, stack_top ); - sys_err("BlueDragon: no pct value set %s", key); + SPDLOG_ERROR("BlueDragon: no pct value set {}", key); return 0; } @@ -184,7 +184,7 @@ unsigned int BlueDragon_GetIndexFactor(const char* container, const size_t idx, { lua_settop( L, stack_top ); - sys_err("BlueDragon: no required table %s", key); + SPDLOG_ERROR("BlueDragon: no required table {}", key); return 0; } @@ -194,7 +194,7 @@ unsigned int BlueDragon_GetIndexFactor(const char* container, const size_t idx, { lua_settop( L, stack_top ); - sys_err("BlueDragon: wrong table index %s %d", key, idx); + SPDLOG_ERROR("BlueDragon: wrong table index {} {}", key, idx); return 0; } @@ -205,7 +205,7 @@ unsigned int BlueDragon_GetIndexFactor(const char* container, const size_t idx, { lua_settop( L, stack_top ); - sys_err("BlueDragon: no min value set %s", key); + SPDLOG_ERROR("BlueDragon: no min value set {}", key); return 0; } diff --git a/src/game/src/BlueDragon_Skill.h b/src/game/src/BlueDragon_Skill.h index 1e42ee0..af46585 100644 --- a/src/game/src/BlueDragon_Skill.h +++ b/src/game/src/BlueDragon_Skill.h @@ -30,7 +30,7 @@ struct FSkillBreath if ((signed)BlueDragon_GetSkillFactor(2, "Skill0", "damage_area") < DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY())) { - sys_log(0, "BlueDragon: Breath too far (%d)", DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY()) ); + SPDLOG_DEBUG("BlueDragon: Breath too far ({})", DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY()) ); return; } @@ -124,7 +124,7 @@ struct FSkillBreath ch->Damage( pAttacker, dam, DAMAGE_TYPE_ICE ); - sys_log(0, "BlueDragon: Breath to %s pct(%d) dam(%d) overlap(%d)", ch->GetName(), pct, dam, overlapDamageCount); + SPDLOG_DEBUG("BlueDragon: Breath to {} pct({}) dam({}) overlap({})", ch->GetName(), pct, dam, overlapDamageCount); } } } @@ -155,7 +155,7 @@ struct FSkillWeakBreath if ((signed)BlueDragon_GetSkillFactor(2, "Skill1", "damage_area") < DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY())) { - sys_log(0, "BlueDragon: Breath too far (%d)", DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY()) ); + SPDLOG_DEBUG("BlueDragon: Breath too far ({})", DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY()) ); return; } @@ -166,7 +166,7 @@ struct FSkillWeakBreath ch->Damage( pAttacker, dam, DAMAGE_TYPE_ICE ); - sys_log(0, "BlueDragon: WeakBreath to %s addPct(%d) dam(%d)", ch->GetName(), addPct, dam); + SPDLOG_DEBUG("BlueDragon: WeakBreath to {} addPct({}) dam({})", ch->GetName(), addPct, dam); } } } @@ -209,7 +209,7 @@ struct FSkillEarthQuake if ((signed)BlueDragon_GetSkillFactor(2, "Skill2", "damage_area") < DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY())) { - sys_log(0, "BlueDragon: Breath too far (%d)", DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY()) ); + SPDLOG_DEBUG("BlueDragon: Breath too far ({})", DISTANCE_APPROX(pAttacker->GetX()-ch->GetX(), pAttacker->GetY()-ch->GetY()) ); return; } @@ -274,7 +274,7 @@ struct FSkillEarthQuake SkillAttackAffect( ch, 1000, IMMUNE_STUN, AFFECT_STUN, POINT_NONE, 0, AFF_STUN, sec, "BDRAGON_STUN" ); - sys_log(0, "BlueDragon: EarthQuake to %s addPct(%d) dam(%d) sec(%d)", ch->GetName(), addPct, dam, sec); + SPDLOG_DEBUG("BlueDragon: EarthQuake to {} addPct({}) dam({}) sec({})", ch->GetName(), addPct, dam, sec); VECTOR vec; diff --git a/src/game/src/ClientPackageCryptInfo.cpp b/src/game/src/ClientPackageCryptInfo.cpp index 6b106b3..01e32b2 100644 --- a/src/game/src/ClientPackageCryptInfo.cpp +++ b/src/game/src/ClientPackageCryptInfo.cpp @@ -37,7 +37,7 @@ bool CClientPackageCryptInfo::LoadPackageCryptFile( const char* pCryptFile ) if (0 == iCryptKeySize) { - sys_log(0, "[PackageCryptInfo] failed to load crypt key. (file: %s, key size: %d)", pCryptFile, iCryptKeySize); + SPDLOG_WARN("[PackageCryptInfo] failed to load crypt key. (file: {}, key size: {})", pCryptFile, iCryptKeySize); m_nCryptKeyPackageCnt -= iPackageCnt; } else @@ -47,7 +47,7 @@ bool CClientPackageCryptInfo::LoadPackageCryptFile( const char* pCryptFile ) memcpy( &m_vecPackageCryptKeys[nCurKeySize], &iCryptKeySize, sizeof(int)); fread( &m_vecPackageCryptKeys[nCurKeySize + sizeof(int)], sizeof(BYTE), iCryptKeySize, fp ); - sys_log(0, "[PackageCryptInfo] %s loaded. (key size: %d, count: %d, total: %d)", pCryptFile, iCryptKeySize, iPackageCnt, m_nCryptKeyPackageCnt); + SPDLOG_WARN("[PackageCryptInfo] {} loaded. (key size: {}, count: {}, total: {})", pCryptFile, iCryptKeySize, iPackageCnt, m_nCryptKeyPackageCnt); } } @@ -81,7 +81,7 @@ bool CClientPackageCryptInfo::LoadPackageCryptFile( const char* pCryptFile ) fread(&dwSDBFileCnt, sizeof(DWORD), 1, fp); - sys_log(0, "[PackageCryptInfo] SDB Loaded. (Name Hash : %d, Stream Size: %d, File Count: %d)", dwPackageNameHash,dwPackageStreamSize, dwSDBFileCnt); + SPDLOG_INFO("[PackageCryptInfo] SDB Loaded. (Name Hash : {}, Stream Size: {}, File Count: {})", dwPackageNameHash,dwPackageStreamSize, dwSDBFileCnt); for( int j = 0; j < (int)dwSDBFileCnt; ++j ) { @@ -91,7 +91,7 @@ bool CClientPackageCryptInfo::LoadPackageCryptFile( const char* pCryptFile ) strRelatedMapName.resize( dwMapNameSize ); fread(&strRelatedMapName[0], sizeof(BYTE), dwMapNameSize, fp); - sys_log(0, "[PackageCryptInfo] \t SDB each file info loaded.(MapName: %s, NameHash: %X)", strRelatedMapName.c_str(), dwFileNameHash); + SPDLOG_INFO("[PackageCryptInfo] \t SDB each file info loaded.(MapName: {}, NameHash: {})", strRelatedMapName.c_str(), dwFileNameHash); BYTE bSDBStreamSize; std::vector vecSDBStream; @@ -152,16 +152,16 @@ bool CClientPackageCryptInfo::LoadPackageCryptInfo( const char* pCryptInfoDir ) //if (strncmp( &(pDirEnt->d_name[0]), szPrefixCryptInfoFile, strlen(szPrefixCryptInfoFile)) ) if (std::string::npos == std::string(pDirEnt->d_name).find(szPrefixCryptInfoFile)) { - sys_log(0, "[PackageCryptInfo] %s is not crypt file. pass!", pDirEnt->d_name); + SPDLOG_DEBUG("[PackageCryptInfo] {} is not crypt file. pass!", pDirEnt->d_name); continue; } std::string strFullPathName = std::string(pCryptInfoDir) + std::string(pDirEnt->d_name); - sys_log(0, "[PackageCryptInfo] Try to load crypt file: %s", strFullPathName.c_str()); + SPDLOG_DEBUG("[PackageCryptInfo] Try to load crypt file: {}", strFullPathName.c_str()); if (false == LoadPackageCryptFile( strFullPathName.c_str() )) - sys_err("[PackageCryptInfo] Failed to load %s", strFullPathName.c_str()); + SPDLOG_DEBUG("[PackageCryptInfo] Failed to load {}", strFullPathName.c_str()); } closedir(pDir); @@ -207,15 +207,13 @@ bool CClientPackageCryptInfo::GetRelatedMapSDBStreams(const char* pMapName, BYTE TPackageSDBMap::iterator it = m_mapPackageSDB.find( strLowerMapName.c_str() ); if( it == m_mapPackageSDB.end() || it->second.vecSDBInfos.size() == 0 ) { - //sys_err("GetRelatedMapSDBStreams Failed(%s)", strLowerMapName.c_str()); + SPDLOG_ERROR("GetRelatedMapSDBStreams Failed({})", strLowerMapName.c_str()); return false; } *ppData = it->second.GetSerializedStream(); iDataSize = it->second.GetSize(); - //sys_log(0, "GetRelatedMapSDBStreams Size(%d)", iDataSize); - return true; } diff --git a/src/game/src/DragonLair.cpp b/src/game/src/DragonLair.cpp index 31374e8..a847b8e 100644 --- a/src/game/src/DragonLair.cpp +++ b/src/game/src/DragonLair.cpp @@ -84,7 +84,7 @@ EVENTFUNC( DragonLair_Collapse_Event ) if ( pInfo == NULL ) { - sys_err( "DragonLair_Collapse_Event> Null pointer" ); + SPDLOG_ERROR("DragonLair_Collapse_Event> Null pointer" ); return 0; } @@ -146,7 +146,7 @@ DWORD CDragonLair::GetEstimatedTime() const void CDragonLair::OnDragonDead(LPCHARACTER pDragon) { - sys_log(0, "DragonLair: µµ¶ó°ïÀÌ Á×¾î½áÈ¿"); + SPDLOG_DEBUG("DragonLair: µµ¶ó°ïÀÌ Á×¾î½áÈ¿"); LogManager::instance().DragonSlayLog( GuildID_, pDragon->GetMobTable().dwVnum, StartTime_, get_global_time() ); } @@ -174,7 +174,7 @@ bool CDragonLairManager::Start(int MapIndexFrom, int BaseMapIndex, DWORD GuildID { int instanceMapIndex = SECTREE_MANAGER::instance().CreatePrivateMap(BaseMapIndex); if (instanceMapIndex == 0) { - sys_err("CDragonLairManager::Start() : no private map index available"); + SPDLOG_ERROR("CDragonLairManager::Start() : no private map index available"); return false; } @@ -203,8 +203,6 @@ bool CDragonLairManager::Start(int MapIndexFrom, int BaseMapIndex, DWORD GuildID strMapBasePath += "/" + pRegionInfo->strMapName + "/instance_regen.txt"; - sys_log(0, "%s", strMapBasePath.c_str()); - regen_do(strMapBasePath.c_str(), instanceMapIndex, pTargetMap->m_setting.iBaseX, pTargetMap->m_setting.iBaseY, NULL, true); return true; diff --git a/src/game/src/DragonSoul.cpp b/src/game/src/DragonSoul.cpp index ad5edd1..28eb300 100644 --- a/src/game/src/DragonSoul.cpp +++ b/src/game/src/DragonSoul.cpp @@ -147,7 +147,7 @@ bool DSManager::RefreshItemAttributes(LPITEM pDS) { if (!pDS->IsDragonSoul()) { - sys_err ("This item(ID : %d) is not DragonSoul.", pDS->GetID()); + SPDLOG_ERROR("This item(ID : {}) is not DragonSoul.", pDS->GetID()); return false; } @@ -159,13 +159,13 @@ bool DSManager::RefreshItemAttributes(LPITEM pDS) if (!m_pTable->GetBasicApplys(ds_type, vec_basic_applys)) { - sys_err ("There is no BasicApply about %d type dragon soul.", ds_type); + SPDLOG_ERROR("There is no BasicApply about {} type dragon soul.", ds_type); return false; } if (!m_pTable->GetAdditionalApplys(ds_type, vec_addtional_applys)) { - sys_err ("There is no AdditionalApply about %d type dragon soul.", ds_type); + SPDLOG_ERROR("There is no AdditionalApply about {} type dragon soul.", ds_type); return false; } @@ -173,7 +173,7 @@ bool DSManager::RefreshItemAttributes(LPITEM pDS) int basic_apply_num, add_min, add_max; if (!m_pTable->GetApplyNumSettings(ds_type, grade_idx, basic_apply_num, add_min, add_max)) { - sys_err ("In ApplyNumSettings, INVALID VALUES Group type(%d), GRADE idx(%d)", ds_type, grade_idx); + SPDLOG_ERROR("In ApplyNumSettings, INVALID VALUES Group type({}), GRADE idx({})", ds_type, grade_idx); return false; } @@ -217,7 +217,7 @@ bool DSManager::PutAttributes(LPITEM pDS) { if (!pDS->IsDragonSoul()) { - sys_err ("This item(ID : %d) is not DragonSoul.", pDS->GetID()); + SPDLOG_ERROR("This item(ID : {}) is not DragonSoul.", pDS->GetID()); return false; } @@ -229,12 +229,12 @@ bool DSManager::PutAttributes(LPITEM pDS) if (!m_pTable->GetBasicApplys(ds_type, vec_basic_applys)) { - sys_err ("There is no BasicApply about %d type dragon soul.", ds_type); + SPDLOG_ERROR("There is no BasicApply about {} type dragon soul.", ds_type); return false; } if (!m_pTable->GetAdditionalApplys(ds_type, vec_addtional_applys)) { - sys_err ("There is no AdditionalApply about %d type dragon soul.", ds_type); + SPDLOG_ERROR("There is no AdditionalApply about {} type dragon soul.", ds_type); return false; } @@ -242,7 +242,7 @@ bool DSManager::PutAttributes(LPITEM pDS) int basic_apply_num, add_min, add_max; if (!m_pTable->GetApplyNumSettings(ds_type, grade_idx, basic_apply_num, add_min, add_max)) { - sys_err ("In ApplyNumSettings, INVALID VALUES Group type(%d), GRADE idx(%d)", ds_type, grade_idx); + SPDLOG_ERROR("In ApplyNumSettings, INVALID VALUES Group type({}), GRADE idx({})", ds_type, grade_idx); return false; } @@ -276,7 +276,7 @@ bool DSManager::PutAttributes(LPITEM pDS) } if (!MakeDistinctRandomNumberSet(list_probs, random_set)) { - sys_err ("MakeDistinctRandomNumberSet error."); + SPDLOG_ERROR("MakeDistinctRandomNumberSet error."); return false; } @@ -350,7 +350,7 @@ bool DSManager::ExtractDragonHeart(LPCHARACTER ch, LPITEM pItem, LPITEM pExtract float sum = 0.f; if (-1 == idx) { - sys_err ("Gamble is failed. ds_type(%d), grade_idx(%d)", ds_type, grade_idx); + SPDLOG_ERROR("Gamble is failed. ds_type({}), grade_idx({})", ds_type, grade_idx); return false; } @@ -375,8 +375,8 @@ bool DSManager::ExtractDragonHeart(LPCHARACTER ch, LPITEM pItem, LPITEM pExtract if (NULL == pDH) { - sys_err ("Cannot create DRAGON_HEART(%d).", DRAGON_HEART_VNUM); - return NULL; + SPDLOG_ERROR("Cannot create DRAGON_HEART({}).", (int) DRAGON_HEART_VNUM); + return false; } pItem->SetCount(pItem->GetCount() - 1); @@ -402,7 +402,7 @@ bool DSManager::PullOut(LPCHARACTER ch, TItemPos DestCell, LPITEM& pItem, LPITEM { if (NULL == ch || NULL == pItem) { - sys_err ("NULL POINTER. ch(%p) or pItem(%p)", ch, pItem); + SPDLOG_ERROR("NULL POINTER. ch({}) or pItem({})", (void*) ch, (void*) pItem); return false; } @@ -514,7 +514,7 @@ bool DSManager::DoRefineGrade(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL if (!ch->DragonSoul_RefineWindow_CanRefine()) { - sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); + SPDLOG_ERROR("{} do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot upgrade dragon soul without refine window."); return false; } @@ -595,7 +595,7 @@ bool DSManager::DoRefineGrade(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL // Ŭ¶ó¿¡¼­ Çѹø °¹¼ö üũ¸¦ Çϱ⠶§¹®¿¡ count != need_count¶ó¸é invalid Ŭ¶óÀÏ °¡´É¼ºÀÌ Å©´Ù. if (count != need_count) { - sys_err ("Possiblity of invalid client. Name %s", ch->GetName()); + SPDLOG_ERROR("Possiblity of invalid client. Name {}", ch->GetName()); BYTE bSubHeader = count < need_count? DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL : DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL; SendRefineResultPacket(ch, bSubHeader, NPOS); return false; @@ -610,7 +610,7 @@ bool DSManager::DoRefineGrade(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL if (-1 == (result_grade = Gamble(vec_probs))) { - sys_err ("Gamble failed. See RefineGardeTables' probabilities"); + SPDLOG_ERROR("Gamble failed. See RefineGardeTables' probabilities"); return false; } @@ -618,7 +618,7 @@ bool DSManager::DoRefineGrade(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL if (NULL == pResultItem) { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(ds_type, (BYTE)result_grade, 0, 0)); + SPDLOG_ERROR("INVALID DRAGON SOUL({})", MakeDragonSoulVnum(ds_type, (BYTE)result_grade, 0, 0)); return false; } @@ -674,7 +674,7 @@ bool DSManager::DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_ if (!ch->DragonSoul_RefineWindow_CanRefine()) { - sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); + SPDLOG_ERROR("{} do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot use dragon soul refine window."); return false; } @@ -747,7 +747,7 @@ bool DSManager::DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_ // Ŭ¶ó¿¡¼­ Çѹø °¹¼ö üũ¸¦ Çϱ⠶§¹®¿¡ count != need_count¶ó¸é invalid Ŭ¶óÀÏ °¡´É¼ºÀÌ Å©´Ù. if (count != need_count) { - sys_err ("Possiblity of invalid client. Name %s", ch->GetName()); + SPDLOG_ERROR("Possiblity of invalid client. Name {}", ch->GetName()); BYTE bSubHeader = count < need_count? DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL : DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL; SendRefineResultPacket(ch, bSubHeader, NPOS); return false; @@ -764,7 +764,7 @@ bool DSManager::DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_ if (-1 == (result_step = Gamble(vec_probs))) { - sys_err ("Gamble failed. See RefineStepTables' probabilities"); + SPDLOG_ERROR("Gamble failed. See RefineStepTables' probabilities"); return false; } @@ -772,7 +772,7 @@ bool DSManager::DoRefineStep(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_SOUL_ if (NULL == pResultItem) { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(ds_type, grade_idx, (BYTE)result_step, 0)); + SPDLOG_ERROR("INVALID DRAGON SOUL({})", MakeDragonSoulVnum(ds_type, grade_idx, (BYTE)result_step, 0)); return false; } @@ -835,7 +835,7 @@ bool DSManager::DoRefineStrength(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_S if (!ch->DragonSoul_RefineWindow_CanRefine()) { - sys_err ("%s do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); + SPDLOG_ERROR("{} do not activate DragonSoulRefineWindow. But how can he come here?", ch->GetName()); ch->ChatPacket(CHAT_TYPE_INFO, "[SYSTEM ERROR]You cannot use dragon soul refine window."); return false; } @@ -953,7 +953,7 @@ bool DSManager::DoRefineStrength(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_S pResult = ITEM_MANAGER::instance().CreateItem(MakeDragonSoulVnum(bType, bGrade, bStep, bStrength + 1)); if (NULL == pResult) { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(bType, bGrade, bStep, bStrength + 1)); + SPDLOG_ERROR("INVALID DRAGON SOUL({})", MakeDragonSoulVnum(bType, bGrade, bStep, bStrength + 1)); return false; } pDragonSoul->RemoveFromCharacter(); @@ -978,7 +978,7 @@ bool DSManager::DoRefineStrength(LPCHARACTER ch, TItemPos (&aItemPoses)[DRAGON_S pResult = ITEM_MANAGER::instance().CreateItem(MakeDragonSoulVnum(bType, bGrade, bStep, bStrength - 1)); if (NULL == pResult) { - sys_err ("INVALID DRAGON SOUL(%d)", MakeDragonSoulVnum(bType, bGrade, bStep, bStrength - 1)); + SPDLOG_ERROR("INVALID DRAGON SOUL({})", MakeDragonSoulVnum(bType, bGrade, bStep, bStrength - 1)); return false; } pDragonSoul->CopyAttributeTo(pResult); diff --git a/src/game/src/MarkConvert.cpp b/src/game/src/MarkConvert.cpp index 01eff54..3ac11b0 100644 --- a/src/game/src/MarkConvert.cpp +++ b/src/game/src/MarkConvert.cpp @@ -14,7 +14,7 @@ static Pixel * LoadOldGuildMarkImageFile() if (!fp) { - sys_err("cannot open %s", OLD_MARK_INDEX_FILENAME); + SPDLOG_ERROR("cannot open {}", OLD_MARK_INDEX_FILENAME); return NULL; } @@ -69,7 +69,7 @@ bool GuildMarkConvert(const std::vector & vecGuildID) pkImage->PutData(0, 0, 512, 512, oldImagePtr); pkImage->Save("guild_mark_real.tga"); */ - sys_log(0, "Guild Mark Converting Start."); + SPDLOG_INFO("Guild Mark Converting Start."); char line[256]; DWORD guild_id; @@ -82,7 +82,7 @@ bool GuildMarkConvert(const std::vector & vecGuildID) if (find(vecGuildID.begin(), vecGuildID.end(), guild_id) == vecGuildID.end()) { - sys_log(0, " skipping guild ID %u", guild_id); + SPDLOG_INFO(" skipping guild ID {}", guild_id); continue; } @@ -92,7 +92,7 @@ bool GuildMarkConvert(const std::vector & vecGuildID) if (row >= 42) { - sys_err("invalid mark_id %u", mark_id); + SPDLOG_ERROR("invalid mark_id {}", mark_id); continue; } @@ -128,7 +128,7 @@ bool GuildMarkConvert(const std::vector & vecGuildID) system("move /Y guild_mark.tga guild_mark.tga.removable"); #endif - sys_log(0, "Guild Mark Converting Complete."); + SPDLOG_INFO("Guild Mark Converting Complete."); return true; } diff --git a/src/game/src/MarkImage.cpp b/src/game/src/MarkImage.cpp index 54d2877..fe493c6 100644 --- a/src/game/src/MarkImage.cpp +++ b/src/game/src/MarkImage.cpp @@ -56,7 +56,7 @@ bool CGuildMarkImage::Save(const char* c_szFileName) bool CGuildMarkImage::Build(const char * c_szFileName) { - sys_log(0, "GuildMarkImage: creating new file %s", c_szFileName); + SPDLOG_INFO("GuildMarkImage: creating new file {}", c_szFileName); Destroy(); Create(); @@ -70,7 +70,7 @@ bool CGuildMarkImage::Build(const char * c_szFileName) if (!ilTexImage(WIDTH, HEIGHT, 1, 4, IL_BGRA, IL_UNSIGNED_BYTE, data)) { - sys_err("GuildMarkImage: cannot initialize image"); + SPDLOG_ERROR("GuildMarkImage: cannot initialize image"); return false; } @@ -95,19 +95,19 @@ bool CGuildMarkImage::Load(const char * c_szFileName) if (!ilLoad(IL_TYPE_UNKNOWN, (const ILstring) c_szFileName)) { - sys_err("GuildMarkImage: %s cannot open file.", c_szFileName); + SPDLOG_ERROR("GuildMarkImage: {} cannot open file.", c_szFileName); return false; } if (ilGetInteger(IL_IMAGE_WIDTH) != WIDTH) { - sys_err("GuildMarkImage: %s width must be %u", c_szFileName, WIDTH); + SPDLOG_ERROR("GuildMarkImage: {} width must be {}", c_szFileName, (int) WIDTH); return false; } if (ilGetInteger(IL_IMAGE_HEIGHT) != HEIGHT) { - sys_err("GuildMarkImage: %s height must be %u", c_szFileName, HEIGHT); + SPDLOG_ERROR("GuildMarkImage: {} height must be {}", c_szFileName, (int) HEIGHT); return false; } @@ -139,7 +139,7 @@ bool CGuildMarkImage::SaveMark(DWORD posMark, BYTE * pbImage) { if (posMark >= MARK_TOTAL_COUNT) { - sys_err("GuildMarkImage::CopyMarkFromData: Invalid mark position %u", posMark); + SPDLOG_ERROR("GuildMarkImage::CopyMarkFromData: Invalid mark position {}", posMark); return false; } @@ -178,13 +178,13 @@ bool CGuildMarkImage::SaveBlockFromCompressedData(DWORD posBlock, const BYTE * p if (LZO_E_OK != lzo1x_decompress_safe(pbComp, dwCompSize, (BYTE *) apxBuf, &sizeBuf, CLZO::Instance().GetWorkMemory())) { - sys_err("GuildMarkImage::CopyBlockFromCompressedData: cannot decompress, compressed size = %u", dwCompSize); + SPDLOG_ERROR("GuildMarkImage::CopyBlockFromCompressedData: cannot decompress, compressed size = {}", dwCompSize); return false; } if (sizeBuf != sizeof(apxBuf)) { - sys_err("GuildMarkImage::CopyBlockFromCompressedData: image corrupted, decompressed size = %u", sizeBuf); + SPDLOG_ERROR("GuildMarkImage::CopyBlockFromCompressedData: image corrupted, decompressed size = {}", sizeBuf); return false; } @@ -200,7 +200,7 @@ bool CGuildMarkImage::SaveBlockFromCompressedData(DWORD posBlock, const BYTE * p void CGuildMarkImage::BuildAllBlocks() // À̹ÌÁö Àüü¸¦ ºí·°È­ { Pixel apxBuf[SGuildMarkBlock::SIZE]; - sys_log(0, "GuildMarkImage::BuildAllBlocks"); + SPDLOG_INFO("GuildMarkImage::BuildAllBlocks"); for (UINT row = 0; row < BLOCK_ROW_COUNT; ++row) for (UINT col = 0; col < BLOCK_COL_COUNT; ++col) @@ -290,10 +290,9 @@ void SGuildMarkBlock::Compress(const Pixel * pxBuf) if (LZO_E_OK != lzo1x_1_compress((const BYTE *) pxBuf, sizeof(Pixel) * SGuildMarkBlock::SIZE, m_abCompBuf, &m_sizeCompBuf, CLZO::Instance().GetWorkMemory())) { - sys_err("SGuildMarkBlock::Compress: Error! %u > %u", sizeof(Pixel) * SGuildMarkBlock::SIZE, m_sizeCompBuf); + SPDLOG_ERROR("SGuildMarkBlock::Compress: Error! {} > {}", sizeof(Pixel) * SGuildMarkBlock::SIZE, m_sizeCompBuf); return; } - //sys_log(0, "SGuildMarkBlock::Compress %u > %u", sizeof(Pixel) * SGuildMarkBlock::SIZE, m_sizeCompBuf); m_crc = GetCRC32((const char *) pxBuf, sizeof(Pixel) * SGuildMarkBlock::SIZE); } diff --git a/src/game/src/MarkManager.cpp b/src/game/src/MarkManager.cpp index 8979216..70b9088 100644 --- a/src/game/src/MarkManager.cpp +++ b/src/game/src/MarkManager.cpp @@ -80,7 +80,7 @@ bool CGuildMarkManager::SaveMarkIndex() if (!fp) { - sys_err("MarkManager::SaveMarkIndex: cannot open index file."); + SPDLOG_ERROR("MarkManager::SaveMarkIndex: cannot open index file."); return false; } @@ -88,7 +88,7 @@ bool CGuildMarkManager::SaveMarkIndex() fprintf(fp, "%u %u\n", it->first, it->second); fclose(fp); - sys_log(0, "MarkManager::SaveMarkIndex: index count %d", m_mapGID_MarkID.size()); + SPDLOG_INFO("MarkManager::SaveMarkIndex: index count {}", m_mapGID_MarkID.size()); return true; } @@ -116,7 +116,7 @@ void CGuildMarkManager::SaveMarkImage(DWORD imgIdx) if (GetMarkImageFilename(imgIdx, path)) if (!__GetImage(imgIdx)->Save(path.c_str())) - sys_err("%s Save failed\n", path.c_str()); + SPDLOG_ERROR("{} Save failed", path.c_str()); } CGuildMarkImage * CGuildMarkManager::__GetImage(DWORD imgIdx) @@ -152,7 +152,6 @@ bool CGuildMarkManager::AddMarkIDByGuildID(DWORD guildID, DWORD markID) if (markID >= MAX_IMAGE_COUNT * CGuildMarkImage::MARK_TOTAL_COUNT) return false; - //sys_log(0, "MarkManager: guild_id=%d mark_id=%d", guildID, markID); m_mapGID_MarkID.insert(std::map::value_type(guildID, markID)); m_setFreeMarkID.erase(markID); return true; @@ -217,14 +216,14 @@ DWORD CGuildMarkManager::SaveMark(DWORD guildID, BYTE * pbMarkImage) { if ((idMark = __AllocMarkID(guildID)) == INVALID_MARK_ID) { - sys_err("CGuildMarkManager: cannot alloc mark id %u", guildID); + SPDLOG_ERROR("CGuildMarkManager: cannot alloc mark id {}", guildID); return false; } else - sys_log(0, "SaveMark: mark id alloc %u", idMark); + SPDLOG_INFO("SaveMark: mark id alloc {}", idMark); } else - sys_log(0, "SaveMark: mark id found %u", idMark); + SPDLOG_INFO("SaveMark: mark id found {}", idMark); DWORD imgIdx = (idMark / CGuildMarkImage::MARK_TOTAL_COUNT); CGuildMarkImage * pkImage = __GetImage(imgIdx); @@ -267,7 +266,7 @@ void CGuildMarkManager::GetDiffBlocks(DWORD imgIdx, const DWORD * crcList, std:: // Ŭ¶óÀ̾ðÆ®¿¡¼­ ¼­¹ö¿¡ ¾ø´Â À̹ÌÁö¸¦ ¿äûÇÒ ¼ö´Â ¾ø´Ù. if (m_mapIdx_Image.end() == m_mapIdx_Image.find(imgIdx)) { - sys_err("invalid idx %u", imgIdx); + SPDLOG_ERROR("invalid idx {}", imgIdx); return; } @@ -294,7 +293,7 @@ bool CGuildMarkManager::GetBlockCRCList(DWORD imgIdx, DWORD * crcList) // Ŭ¶óÀ̾ðÆ®¿¡¼­ ¼­¹ö¿¡ ¾ø´Â À̹ÌÁö¸¦ ¿äûÇÒ ¼ö´Â ¾ø´Ù. if (m_mapIdx_Image.end() == m_mapIdx_Image.find(imgIdx)) { - sys_err("invalid idx %u", imgIdx); + SPDLOG_ERROR("invalid idx {}", imgIdx); return false; } @@ -354,7 +353,7 @@ void CGuildMarkManager::SaveSymbol(const char* filename) FILE* fp = fopen(filename, "wb"); if (!fp) { - sys_err("Cannot open Symbol file (name: %s)", filename); + SPDLOG_ERROR("Cannot open Symbol file (name: {})", filename); return; } @@ -375,7 +374,7 @@ void CGuildMarkManager::SaveSymbol(const char* filename) void CGuildMarkManager::UploadSymbol(DWORD guildID, int iSize, const BYTE* pbyData) { - sys_log(0, "GuildSymbolUpload guildID %u Size %d", guildID, iSize); + SPDLOG_INFO("GuildSymbolUpload guildID {} Size {}", guildID, iSize); if (m_mapSymbol.find(guildID) == m_mapSymbol.end()) m_mapSymbol.insert(std::make_pair(guildID, TGuildSymbol())); diff --git a/src/game/src/OXEvent.cpp b/src/game/src/OXEvent.cpp index 713b42a..3e0bf8c 100644 --- a/src/game/src/OXEvent.cpp +++ b/src/game/src/OXEvent.cpp @@ -90,7 +90,7 @@ bool COXEventManager::Enter(LPCHARACTER pkChar) { if (GetStatus() == OXEVENT_FINISH) { - sys_log(0, "OXEVENT : map finished. but char enter. %s", pkChar->GetName()); + SPDLOG_WARN("OXEVENT : map finished. but char enter. {}", pkChar->GetName()); return false; } @@ -106,7 +106,7 @@ bool COXEventManager::Enter(LPCHARACTER pkChar) } else { - sys_log(0, "OXEVENT : wrong pos enter %d %d", pos.x, pos.y); + SPDLOG_ERROR("OXEVENT : wrong pos enter {} {}", pos.x, pos.y); return false; } @@ -190,7 +190,7 @@ EVENTFUNC(oxevent_timer) if ( info == NULL ) { - sys_err( "oxevent_timer> Null pointer" ); + SPDLOG_ERROR("oxevent_timer> Null pointer" ); return 0; } diff --git a/src/game/src/PetSystem.cpp b/src/game/src/PetSystem.cpp index d235b8a..f801850 100644 --- a/src/game/src/PetSystem.cpp +++ b/src/game/src/PetSystem.cpp @@ -30,7 +30,7 @@ EVENTFUNC(petsystem_update_event) petsystem_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "check_speedhack_event> Null pointer" ); + SPDLOG_ERROR("check_speedhack_event> Null pointer" ); return 0; } @@ -166,7 +166,7 @@ DWORD CPetActor::Summon(const char* petName, LPITEM pSummonItem, bool bSpawnFar) if (0 == m_pkChar) { - sys_err("[CPetSystem::Summon] Failed to summon the pet. (vnum: %d)", m_dwVnum); + SPDLOG_ERROR("[CPetSystem::Summon] Failed to summon the pet. (vnum: {})", m_dwVnum); return 0; } @@ -223,7 +223,7 @@ bool CPetActor::_UpdateFollowAI() { if (0 == m_pkChar->m_pkMobData) { - //sys_err("[CPetActor::_UpdateFollowAI] m_pkChar->m_pkMobData is NULL"); + SPDLOG_ERROR("[CPetActor::_UpdateFollowAI] m_pkChar->m_pkMobData is NULL"); return false; } @@ -480,14 +480,14 @@ void CPetSystem::DeletePet(DWORD mobVnum) if (m_petActorMap.end() == iter) { - sys_err("[CPetSystem::DeletePet] Can't find pet on my list (VNUM: %d)", mobVnum); + SPDLOG_ERROR("[CPetSystem::DeletePet] Can't find pet on my list (VNUM: {})", mobVnum); return; } CPetActor* petActor = iter->second; if (0 == petActor) - sys_err("[CPetSystem::DeletePet] Null Pointer (petActor)"); + SPDLOG_ERROR("[CPetSystem::DeletePet] Null Pointer (petActor)"); else delete petActor; @@ -508,7 +508,7 @@ void CPetSystem::DeletePet(CPetActor* petActor) } } - sys_err("[CPetSystem::DeletePet] Can't find petActor(0x%x) on my list(size: %d) ", petActor, m_petActorMap.size()); + SPDLOG_ERROR("[CPetSystem::DeletePet] Can't find petActor({}) on my list(size: {}) ", (void*) petActor, m_petActorMap.size()); } void CPetSystem::Unsummon(DWORD vnum, bool bDeleteFromList) @@ -517,7 +517,7 @@ void CPetSystem::Unsummon(DWORD vnum, bool bDeleteFromList) if (0 == actor) { - sys_err("[CPetSystem::GetByVnum(%d)] Null Pointer (petActor)", vnum); + SPDLOG_ERROR("[CPetSystem::GetByVnum({})] Null Pointer (petActor)", vnum); return; } actor->Unsummon(); @@ -576,7 +576,7 @@ CPetActor* CPetSystem::GetByVID(DWORD vid) const if (0 == petActor) { - sys_err("[CPetSystem::GetByVID(%d)] Null Pointer (petActor)", vid); + SPDLOG_ERROR("[CPetSystem::GetByVID({})] Null Pointer (petActor)", vid); continue; } diff --git a/src/game/src/SpeedServer.cpp b/src/game/src/SpeedServer.cpp index e564ec4..bd8c503 100644 --- a/src/game/src/SpeedServer.cpp +++ b/src/game/src/SpeedServer.cpp @@ -26,10 +26,10 @@ bool CSpeedServerManager::Initialize() { for (int i = 1; i < EMPIRE_MAX_NUM; i++) { - sys_log (0,"speed manager init"); + SPDLOG_DEBUG("speed manager init"); if(!Empire[i].Initialize (i)) { - sys_err ("EMPIRE %d Exp Bonus Manager Init fail",i); + SPDLOG_ERROR("EMPIRE {} Exp Bonus Manager Init fail",i); return false; } } @@ -39,7 +39,7 @@ bool CSpeedServerManager::Initialize() bool CSpeedServerEmpireExp::Initialize (BYTE e) { empire = e; - sys_log (0, "empire exp init %d", empire); + SPDLOG_DEBUG("empire exp init {}", empire); snprintf (file_name, sizeof(file_name), "%s/exp_bonus_table_%d.txt", LocaleService_GetBasePath().c_str(), empire); for (int i = 1; i < 6; i++) @@ -66,7 +66,7 @@ bool CSpeedServerEmpireExp::LoadWdayExpTable(int wday, char *str) char *t; char *h, *m, *e; int hour, min, exp; - sys_log (0, "str %s", str); + SPDLOG_DEBUG("str {}", str); strtok (str, delim); p = strtok (NULL, ";"); n = strtok (NULL, ";"); @@ -78,11 +78,11 @@ bool CSpeedServerEmpireExp::LoadWdayExpTable(int wday, char *str) m = strtok (NULL, delim); if (!str_to_number (hour, h) || !str_to_number (min, m) || !str_to_number (exp, e)) { - sys_log (0, "h m e : %s %s %s",h, m, e); - sys_err ("Invalid argument. Please insert hh:mm exp"); + SPDLOG_DEBUG("h m e : {} {} {}",h, m, e); + SPDLOG_ERROR("Invalid argument. Please insert hh:mm exp"); return false; } - sys_log (0, "h m e : %s %s %s",h, m, e); + SPDLOG_DEBUG("h m e : {} {} {}",h, m, e); lst.push_back (HME (hour, min, exp)); p = strtok (n, ";"); @@ -100,7 +100,7 @@ bool CSpeedServerEmpireExp::WriteExpTable() { FILE *fp; - sys_log (0, "write"); + SPDLOG_DEBUG("write"); if (0==file_name || 0==file_name[0]) return false; @@ -140,7 +140,7 @@ bool CSpeedServerEmpireExp::LoadExpTable() char temp[256]; const char *delim = " \t\r\n"; - sys_log (0, "load"); + SPDLOG_DEBUG("load"); if (0==file_name || 0==file_name[0]) return false; @@ -198,7 +198,7 @@ bool CSpeedServerEmpireExp::LoadExpTable() v = strtok (temp, delim); v = strtok (NULL, delim); - sys_log (0, "holiday %s", v); + SPDLOG_DEBUG("holiday {}", v); p = strtok (NULL, ";"); n = strtok (NULL, ";"); @@ -210,11 +210,11 @@ bool CSpeedServerEmpireExp::LoadExpTable() m = strtok (NULL, delim); if (!str_to_number (hour, h) || !str_to_number (min, m) || !str_to_number (exp, e)) { - sys_log (0, "h m e : %s %s %s",h, m, e); - sys_err ("Invalid argument. Please insert hh:mm exp"); + SPDLOG_DEBUG("h m e : {} {} {}",h, m, e); + SPDLOG_ERROR("Invalid argument. Please insert hh:mm exp"); return false; } - sys_log (0, "h m e : %s %s %s",h, m, e); + SPDLOG_DEBUG("h m e : {} {} {}",h, m, e); lst.push_back (HME (hour, min, exp)); p = strtok (n, ";"); @@ -225,11 +225,11 @@ bool CSpeedServerEmpireExp::LoadExpTable() || !str_to_number ( mon, strtok (NULL, ".")) || !str_to_number ( day, strtok (NULL, "."))) { - sys_err ("Invalid Date"); + SPDLOG_ERROR("Invalid Date"); return false; } - sys_log (0, "y m d %d %d %d",year, mon, day); + SPDLOG_DEBUG("y m d {} {} {}",year, mon, day); holiday_map.insert (std::pair > (Date (year - 1900, mon - 1, day), lst)); } @@ -265,7 +265,7 @@ void CSpeedServerManager::InitWdayExpTableOfEmpire (BYTE empire, int wday) { if (empire > EMPIRE_MAX_NUM) { - sys_err ("invalid empire"); + SPDLOG_ERROR("invalid empire"); return; } @@ -294,7 +294,7 @@ std::list & CSpeedServerEmpireExp::GetHolidayExpTable(Date date, bool &is_e else { is_exist = false; - sys_err ("Cannot find Holiday %d %d %d",date.year, date.mon, date.day); + SPDLOG_ERROR("Cannot find Holiday {} {} {}",date.year, date.mon, date.day); } return it->second; } @@ -318,7 +318,7 @@ void CSpeedServerManager::InitHolidayExpTableOfEmpire (BYTE empire, Date date) { if (empire > EMPIRE_MAX_NUM) { - sys_err ("invalid empire"); + SPDLOG_ERROR("invalid empire"); return; } @@ -327,7 +327,7 @@ void CSpeedServerManager::InitHolidayExpTableOfEmpire (BYTE empire, Date date) void CSpeedServerEmpireExp::InitHolidayExpTable(Date date) { - sys_log (0, "init holiday"); + SPDLOG_DEBUG("init holiday"); std::map >::iterator it = holiday_map.find(date); if (it == holiday_map.end()) { diff --git a/src/game/src/ani.cpp b/src/game/src/ani.cpp index 6eff935..7f2469d 100644 --- a/src/game/src/ani.cpp +++ b/src/game/src/ani.cpp @@ -11,7 +11,6 @@ #include "char.h" #include "item.h" #include "ani.h" -#include "dev_log.h" const char* FN_race_name(int race) { @@ -141,7 +140,7 @@ bool ANI::load() { if (false == load_one_race(race, dir_name[race])) { - sys_err("ANI directory = %s", dir_name[race]); + SPDLOG_ERROR("ANI directory = {}", dir_name[race]); return false; } } @@ -200,7 +199,7 @@ bool ANI::load_one_race(int race, const char *dir_name) for (int weapon = WEAPON_SWORD; weapon < WEAPON_NUM_TYPES; ++weapon) { - dev_log(LOG_DEB0, "ANI (%s,%s)", FN_race_name(race), FN_weapon_type(weapon)); + SPDLOG_TRACE("ANI ({},{})", FN_race_name(race), FN_weapon_type(weapon)); for (BYTE combo = 1; combo <= 8; ++combo) { @@ -212,11 +211,11 @@ bool ANI::load_one_race(int race, const char *dir_name) m_speed[race][1][weapon][combo] = load_one_weapon(dir_name, weapon, combo, true); m_speed[race][1][weapon][0] = std::min(m_speed[race][1][weapon][0], m_speed[race][1][weapon][combo]); // ÃÖ¼Ò°ª - dev_log(LOG_DEB0, "combo%02d speed=%d horse=%d", + SPDLOG_TRACE("combo{:02} speed={} horse={}", combo, m_speed[race][0][weapon][combo], m_speed[race][1][weapon][combo]); } - dev_log(LOG_DEB0, "minspeed=%u", m_speed[race][0][weapon][0]); + SPDLOG_TRACE("minspeed={}", m_speed[race][0][weapon][0]); } return true; @@ -331,7 +330,7 @@ DWORD ani_attack_speed(LPCHARACTER ch) int weapon = item->GetSubType(); /* - dev_log(LOG_DEB0, "%s : (race,weapon) = (%s,%s) POINT_ATT_SPEED = %d", + SPDLOG_TRACE("{} : (race,weapon) = ({},{}) POINT_ATT_SPEED = {}", ch->GetName(), FN_race_name(race), FN_weapon_type(weapon), diff --git a/src/game/src/arena.cpp b/src/game/src/arena.cpp index eb4790c..5e4d878 100644 --- a/src/game/src/arena.cpp +++ b/src/game/src/arena.cpp @@ -67,7 +67,7 @@ bool CArenaManager::AddArena(DWORD mapIdx, WORD startA_X, WORD startA_Y, WORD st if (pArenaMap->AddArena(mapIdx, startA_X, startA_Y, startB_X, startB_Y) == false) { - sys_log(0, "CArenaManager::AddArena - AddMap Error MapID: %d", mapIdx); + SPDLOG_ERROR("CArenaManager::AddArena - AddMap Error MapID: {}", mapIdx); return false; } @@ -80,7 +80,7 @@ bool CArenaMap::AddArena(DWORD mapIdx, WORD startA_X, WORD startA_Y, WORD startB { if (iter->CheckArea(startA_X, startA_Y, startB_X, startB_Y) == false) { - sys_log(0, "CArenaMap::AddArena - Same Start Position set. stA(%d, %d) stB(%d, %d)", startA_X, startA_Y, startB_X, startB_Y); + SPDLOG_ERROR("CArenaMap::AddArena - Same Start Position set. stA({}, {}) stB({}, {})", startA_X, startA_Y, startB_X, startB_Y); return false; } } @@ -111,7 +111,7 @@ void CArenaMap::Destroy() { itertype(m_listArena) iter = m_listArena.begin(); - sys_log(0, "ARENA: ArenaMap will be destroy. mapIndex(%d)", m_dwMapIndex); + SPDLOG_DEBUG("ARENA: ArenaMap will be destroy. mapIndex({})", m_dwMapIndex); for (; iter != m_listArena.end(); iter++) { @@ -212,7 +212,7 @@ EVENTFUNC(ready_to_start_event) if ( info == NULL ) { - sys_err( "ready_to_start_event> Null pointer" ); + SPDLOG_ERROR("ready_to_start_event> Null pointer" ); return 0; } @@ -220,7 +220,7 @@ EVENTFUNC(ready_to_start_event) if (pArena == NULL) { - sys_err("ARENA: Arena start event info is null."); + SPDLOG_ERROR("ARENA: Arena start event info is null."); return 0; } @@ -229,18 +229,18 @@ EVENTFUNC(ready_to_start_event) if (chA == NULL || chB == NULL) { - sys_err("ARENA: Player err in event func ready_start_event"); + SPDLOG_ERROR("ARENA: Player err in event func ready_start_event"); if (chA != NULL) { chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã »ó´ë°¡ »ç¶óÁ® ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); - sys_log(0, "ARENA: Oppernent is disappered. MyPID(%d) OppPID(%d)", pArena->GetPlayerAPID(), pArena->GetPlayerBPID()); + SPDLOG_DEBUG("ARENA: Oppernent is disappered. MyPID({}) OppPID({})", pArena->GetPlayerAPID(), pArena->GetPlayerBPID()); } if (chB != NULL) { chB->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã »ó´ë°¡ »ç¶óÁ® ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); - sys_log(0, "ARENA: Oppernent is disappered. MyPID(%d) OppPID(%d)", pArena->GetPlayerBPID(), pArena->GetPlayerAPID()); + SPDLOG_DEBUG("ARENA: Oppernent is disappered. MyPID({}) OppPID({})", pArena->GetPlayerBPID(), pArena->GetPlayerAPID()); } pArena->SendChatPacketToObserver(CHAT_TYPE_NOTICE, LC_TEXT("´ë·Ã »ó´ë°¡ »ç¶óÁ® ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); @@ -370,7 +370,7 @@ EVENTFUNC(ready_to_start_event) chB->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå ¹®Á¦·Î ÀÎÇÏ¿© ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); pArena->SendChatPacketToObserver(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå ¹®Á¦·Î ÀÎÇÏ¿© ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); - sys_log(0, "ARENA: Something wrong in event func. info->state(%d)", info->state); + SPDLOG_DEBUG("ARENA: Something wrong in event func. info->state({})", info->state); pArena->EndDuel(); @@ -388,7 +388,7 @@ EVENTFUNC(duel_time_out) if ( info == NULL ) { - sys_err( "duel_time_out> Null pointer" ); + SPDLOG_ERROR("duel_time_out> Null pointer" ); return 0; } @@ -396,7 +396,7 @@ EVENTFUNC(duel_time_out) if (pArena == NULL) { - sys_err("ARENA: Time out event error"); + SPDLOG_ERROR("ARENA: Time out event error"); return 0; } @@ -408,13 +408,13 @@ EVENTFUNC(duel_time_out) if (chA != NULL) { chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã »ó´ë°¡ »ç¶óÁ® ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); - sys_log(0, "ARENA: Oppernent is disappered. MyPID(%d) OppPID(%d)", pArena->GetPlayerAPID(), pArena->GetPlayerBPID()); + SPDLOG_DEBUG("ARENA: Oppernent is disappered. MyPID({}) OppPID({})", pArena->GetPlayerAPID(), pArena->GetPlayerBPID()); } if (chB != NULL) { chB->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã »ó´ë°¡ »ç¶óÁ® ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); - sys_log(0, "ARENA: Oppernent is disappered. MyPID(%d) OppPID(%d)", pArena->GetPlayerBPID(), pArena->GetPlayerAPID()); + SPDLOG_DEBUG("ARENA: Oppernent is disappered. MyPID({}) OppPID({})", pArena->GetPlayerBPID(), pArena->GetPlayerAPID()); } pArena->SendChatPacketToObserver(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã »ó´ë°¡ »ç¶óÁ® ´ë·ÃÀ» Á¾·áÇÕ´Ï´Ù.")); @@ -445,7 +445,7 @@ EVENTFUNC(duel_time_out) info->state++; - sys_log(0, "ARENA: Because of time over, duel is end. PIDA(%d) vs PIDB(%d)", pArena->GetPlayerAPID(), pArena->GetPlayerBPID()); + SPDLOG_DEBUG("ARENA: Because of time over, duel is end. PIDA({}) vs PIDB({})", pArena->GetPlayerAPID(), pArena->GetPlayerBPID()); return PASSES_PER_SEC(10); break; @@ -496,7 +496,7 @@ bool CArena::StartDuel(LPCHARACTER pCharFrom, LPCHARACTER pCharTo, int nSetPoint pCharTo->PointChange(POINT_HP, pCharTo->GetMaxHP() - pCharTo->GetHP()); pCharTo->PointChange(POINT_SP, pCharTo->GetMaxSP() - pCharTo->GetSP()); - sys_log(0, "ARENA: Start Duel with PID_A(%d) vs PID_B(%d)", GetPlayerAPID(), GetPlayerBPID()); + SPDLOG_DEBUG("ARENA: Start Duel with PID_A({}) vs PID_B({})", GetPlayerAPID(), GetPlayerBPID()); return true; } @@ -577,7 +577,7 @@ void CArena::EndDuel() m_mapObserver.clear(); - sys_log(0, "ARENA: End Duel PID_A(%d) vs PID_B(%d)", GetPlayerAPID(), GetPlayerBPID()); + SPDLOG_DEBUG("ARENA: End Duel PID_A({}) vs PID_B({})", GetPlayerAPID(), GetPlayerBPID()); Clear(); } @@ -756,7 +756,7 @@ bool CArena::OnDead(DWORD dwPIDA, DWORD dwPIDB) pCharB->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("%s ´ÔÀÌ ´ë·Ã¿¡¼­ ½Â¸®ÇÏ¿´½À´Ï´Ù."), pCharA->GetName()); SendChatPacketToObserver(CHAT_TYPE_NOTICE, LC_TEXT("%s ´ÔÀÌ ´ë·Ã¿¡¼­ ½Â¸®ÇÏ¿´½À´Ï´Ù."), pCharA->GetName()); - sys_log(0, "ARENA: Duel is end. Winner %s(%d) Loser %s(%d)", + SPDLOG_DEBUG("ARENA: Duel is end. Winner {}({}) Loser {}({})", pCharA->GetName(), GetPlayerAPID(), pCharB->GetName(), GetPlayerBPID()); } else @@ -770,7 +770,7 @@ bool CArena::OnDead(DWORD dwPIDA, DWORD dwPIDB) SendChatPacketToObserver(CHAT_TYPE_NOTICE, "%s %d : %d %s", pCharA->GetName(), m_dwSetPointOfA, m_dwSetPointOfB, pCharB->GetName()); - sys_log(0, "ARENA: %s(%d) won a round vs %s(%d)", + SPDLOG_DEBUG("ARENA: {}({}) won a round vs {}({})", pCharA->GetName(), GetPlayerAPID(), pCharB->GetName(), GetPlayerBPID()); } } @@ -783,7 +783,7 @@ bool CArena::OnDead(DWORD dwPIDA, DWORD dwPIDB) pCharB->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("%s ´ÔÀÌ ´ë·Ã¿¡¼­ ½Â¸®ÇÏ¿´½À´Ï´Ù."), pCharB->GetName()); SendChatPacketToObserver(CHAT_TYPE_NOTICE, LC_TEXT("%s ´ÔÀÌ ´ë·Ã¿¡¼­ ½Â¸®ÇÏ¿´½À´Ï´Ù."), pCharB->GetName()); - sys_log(0, "ARENA: Duel is end. Winner(%d) Loser(%d)", GetPlayerBPID(), GetPlayerAPID()); + SPDLOG_DEBUG("ARENA: Duel is end. Winner({}) Loser({})", GetPlayerBPID(), GetPlayerAPID()); } else { @@ -796,13 +796,13 @@ bool CArena::OnDead(DWORD dwPIDA, DWORD dwPIDB) SendChatPacketToObserver(CHAT_TYPE_NOTICE, "%s %d : %d %s", pCharA->GetName(), m_dwSetPointOfA, m_dwSetPointOfB, pCharB->GetName()); - sys_log(0, "ARENA : PID(%d) won a round. Opp(%d)", GetPlayerBPID(), GetPlayerAPID()); + SPDLOG_DEBUG("ARENA : PID({}) won a round. Opp({})", GetPlayerBPID(), GetPlayerAPID()); } } else { // wtf - sys_log(0, "ARENA : OnDead Error (%d, %d) (%d, %d)", m_dwPIDA, m_dwPIDB, dwPIDA, dwPIDB); + SPDLOG_WARN("ARENA : OnDead Error ({}, {}) ({}, {})", m_dwPIDA, m_dwPIDB, dwPIDA, dwPIDB); } int potion = quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count"); @@ -951,7 +951,7 @@ void CArena::OnDisconnect(DWORD pid) if (GetPlayerB() != NULL) GetPlayerB()->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æ ij¸¯ÅÍ°¡ Á¢¼ÓÀ» Á¾·áÇÏ¿© ´ë·ÃÀ» ÁßÁöÇÕ´Ï´Ù.")); - sys_log(0, "ARENA : Duel is end because of Opp(%d) is disconnect. MyPID(%d)", GetPlayerAPID(), GetPlayerBPID()); + SPDLOG_DEBUG("ARENA : Duel is end because of Opp({}) is disconnect. MyPID({})", GetPlayerAPID(), GetPlayerBPID()); EndDuel(); } else if (m_dwPIDB == pid) @@ -959,7 +959,7 @@ void CArena::OnDisconnect(DWORD pid) if (GetPlayerA() != NULL) GetPlayerA()->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æ ij¸¯ÅÍ°¡ Á¢¼ÓÀ» Á¾·áÇÏ¿© ´ë·ÃÀ» ÁßÁöÇÕ´Ï´Ù.")); - sys_log(0, "ARENA : Duel is end because of Opp(%d) is disconnect. MyPID(%d)", GetPlayerBPID(), GetPlayerAPID()); + SPDLOG_DEBUG("ARENA : Duel is end because of Opp({}) is disconnect. MyPID({})", GetPlayerBPID(), GetPlayerAPID()); EndDuel(); } } @@ -1057,7 +1057,7 @@ bool CArenaManager::RegisterObserverPtr(LPCHARACTER pChar, DWORD mapIdx, WORD Ob if (iter == m_mapArenaMap.end()) { - sys_log(0, "ARENA : Cannot find ArenaMap. %d %d %d", mapIdx, ObserverX, ObserverY); + SPDLOG_ERROR("ARENA : Cannot find ArenaMap. {} {} {}", mapIdx, ObserverX, ObserverY); return false; } @@ -1089,7 +1089,7 @@ bool CArena::RegisterObserverPtr(LPCHARACTER pChar) if (iter == m_mapObserver.end()) { - sys_log(0, "ARENA : not in ob list"); + SPDLOG_ERROR("ARENA : not in ob list"); return false; } diff --git a/src/game/src/auction_manager.cpp b/src/game/src/auction_manager.cpp index 3b6a8ac..32833a8 100644 --- a/src/game/src/auction_manager.cpp +++ b/src/game/src/auction_manager.cpp @@ -576,7 +576,7 @@ void AuctionManager::Boot (const char* &data, WORD size) { if (decode_2bytes(data) != sizeof(TPlayerItem)) { - sys_err("TPlayerItem table size error"); + SPDLOG_ERROR("TPlayerItem table size error"); thecore_shutdown(); return; } @@ -597,7 +597,7 @@ void AuctionManager::Boot (const char* &data, WORD size) } if (decode_2bytes(data) != sizeof(TAuctionItemInfo)) { - sys_err("TAuctionItemInfo table size error"); + SPDLOG_ERROR("TAuctionItemInfo table size error"); thecore_shutdown(); return; } @@ -617,7 +617,7 @@ void AuctionManager::Boot (const char* &data, WORD size) } if (decode_2bytes(data) != sizeof(TSaleItemInfo)) { - sys_err("TSaleItemInfo table size error"); + SPDLOG_ERROR("TSaleItemInfo table size error"); thecore_shutdown(); return; } @@ -638,7 +638,7 @@ void AuctionManager::Boot (const char* &data, WORD size) if (decode_2bytes(data) != sizeof(TWishItemInfo)) { - sys_err("TWishItemInfo table size error"); + SPDLOG_ERROR("TWishItemInfo table size error"); thecore_shutdown(); return; } @@ -659,7 +659,7 @@ void AuctionManager::Boot (const char* &data, WORD size) if (decode_2bytes(data) != (sizeof(DWORD) + sizeof(DWORD) + sizeof(int))) { - sys_err("my_bid table size error"); + SPDLOG_ERROR("my_bid table size error"); thecore_shutdown(); return; } @@ -702,7 +702,7 @@ bool AuctionManager::InsertItem (TPlayerItem* player_item) if (!item) { - sys_err("cannot create item vnum %d id %u",player_item->vnum, player_item->id); + SPDLOG_ERROR("cannot create item vnum {} id {}",player_item->vnum, player_item->id); return false; } @@ -756,7 +756,7 @@ bool AuctionManager::DeleteItem (DWORD item_id) // return false; // if (it->second + changing_amount < 0) // { -// sys_err ("Cannot have money under 0."); +// SPDLOG_ERROR("Cannot have money under 0."); // return false; // } // @@ -876,7 +876,7 @@ void AuctionManager::enroll_auction (LPCHARACTER ch, LPITEM item, BYTE empire, i { if (ch != item->GetOwner()) { - sys_err ("Item %d's owner is %s, not %s",ch->GetName(), item->GetOwner()->GetName()); + SPDLOG_ERROR("Item {}'s owner is {}, not {}", ch->GetName(), item->GetOwner()->GetName()); return; } if (item->IsEquipped()) @@ -887,14 +887,14 @@ void AuctionManager::enroll_auction (LPCHARACTER ch, LPITEM item, BYTE empire, i if (GetAuctionItemInfo (item->GetID())) { - sys_err ("Item %d is already in auction.", item->GetID()); + SPDLOG_ERROR("Item {} is already in auction.", item->GetID()); ch->ChatPacket(CHAT_TYPE_INFO, "ÀÌ¹Ì µî·ÏÇÑ °Å¾ß. µµ´ëü ¹¹Áö?"); return; } if (item->GetWindow() == AUCTION) { - sys_err ("Item %d is already in auction.", item->GetID()); + SPDLOG_ERROR("Item {} is already in auction.", item->GetID()); ch->ChatPacket(CHAT_TYPE_INFO, "¾ë ¶Ç ¹¹³Ä.."); return; } @@ -913,7 +913,7 @@ void AuctionManager::enroll_sale (LPCHARACTER ch, LPITEM item, DWORD wisher_id, { if (ch != item->GetOwner()) { - sys_err ("Item %d's owner is %s, not %s",ch->GetName(), item->GetOwner()->GetName()); + SPDLOG_ERROR("Item {}'s owner is {}, not {}", ch->GetName(), item->GetOwner()->GetName()); return; } if (item->IsEquipped()) @@ -924,14 +924,14 @@ void AuctionManager::enroll_sale (LPCHARACTER ch, LPITEM item, DWORD wisher_id, if (GetSaleItemInfo (item->GetID())) { - sys_err ("Item %d is already in auction.", item->GetID()); + SPDLOG_ERROR("Item {} is already in auction.", item->GetID()); ch->ChatPacket(CHAT_TYPE_INFO, "ÀÌ¹Ì µî·ÏÇÑ °Å¾ß. µµ´ëü ¹¹Áö?"); return; } if (item->GetWindow() == AUCTION) { - sys_err ("Item %d is already in auction.", item->GetID()); + SPDLOG_ERROR("Item {} is already in auction.", item->GetID()); ch->ChatPacket(CHAT_TYPE_INFO, "¾ë ¶Ç ¹¹³Ä.."); return; } @@ -982,7 +982,7 @@ void AuctionManager::immediate_purchase (LPCHARACTER ch, DWORD item_id) if (item_info == NULL) { - sys_err ("Invild item id : %d", item_id); + SPDLOG_ERROR("Invild item id : {}", item_id); return; } @@ -1063,7 +1063,7 @@ void AuctionManager::rebid (LPCHARACTER ch, DWORD item_id, int bid_price) bool lock = mb.second; if (money == -1) { - sys_err ("Do bid first. How can you rebid? pid %d, item_id %d",ch->GetPlayerID(), item_id); + SPDLOG_ERROR("Do bid first. How can you rebid? pid {}, item_id {}", ch->GetPlayerID(), item_id); return; } @@ -1095,7 +1095,7 @@ void AuctionManager::bid_cancel (LPCHARACTER ch, DWORD item_id) bool lock = mb.second; if (money == -1) { - sys_err ("Do bid first. How can you bid cancel? pid %d, item_id %d",ch->GetPlayerID(), item_id); + SPDLOG_ERROR("Do bid first. How can you bid cancel? pid {}, item_id {}",ch->GetPlayerID(), item_id); return; } @@ -1303,7 +1303,7 @@ void AuctionManager::recv_result_auction (DWORD commander_id, TPacketDGResultAuc if (!GetInventoryItem(player_item->id)) { - sys_err ("AUCTION_CMD %d : invalid item_id %d", cmd, item_id); + SPDLOG_ERROR("AUCTION_CMD {} : invalid item_id {}", cmd, item_id); break; } @@ -1333,7 +1333,7 @@ void AuctionManager::recv_result_auction (DWORD commander_id, TPacketDGResultAuc { if (!Wish.DeleteItemInfo (commander_id, cmd_result->target)) { - sys_err ("Cannot cancel wish, invalid player_id : %d, item_num : %d", commander_id, cmd_result->target); + SPDLOG_ERROR("Cannot cancel wish, invalid player_id : {}, item_num : {}", commander_id, cmd_result->target); } else if (ch != NULL) { diff --git a/src/game/src/battle.cpp b/src/game/src/battle.cpp index 1e9e9d6..f259e9e 100644 --- a/src/game/src/battle.cpp +++ b/src/game/src/battle.cpp @@ -105,19 +105,19 @@ bool battle_is_attackable(LPCHARACTER ch, LPCHARACTER victim) int battle_melee_attack(LPCHARACTER ch, LPCHARACTER victim) { if (test_server&&ch->IsPC()) - sys_log(0, "battle_melee_attack : [%s] attack to [%s]", ch->GetName(), victim->GetName()); + SPDLOG_TRACE("battle_melee_attack : [{}] attack to [{}]", ch->GetName(), victim->GetName()); if (!victim || ch == victim) return BATTLE_NONE; if (test_server&&ch->IsPC()) - sys_log(0, "battle_melee_attack : [%s] attack to [%s]", ch->GetName(), victim->GetName()); + SPDLOG_TRACE("battle_melee_attack : [{}] attack to [{}]", ch->GetName(), victim->GetName()); if (!battle_is_attackable(ch, victim)) return BATTLE_NONE; if (test_server&&ch->IsPC()) - sys_log(0, "battle_melee_attack : [%s] attack to [%s]", ch->GetName(), victim->GetName()); + SPDLOG_TRACE("battle_melee_attack : [{}] attack to [{}]", ch->GetName(), victim->GetName()); // °Å¸® üũ int distance = DISTANCE_APPROX(ch->GetX() - victim->GetX(), ch->GetY() - victim->GetY()); @@ -140,8 +140,7 @@ int battle_melee_attack(LPCHARACTER ch, LPCHARACTER victim) if (distance > max) { - if (test_server) - sys_log(0, "VICTIM_FAR: %s distance: %d max: %d", ch->GetName(), distance, max); + SPDLOG_TRACE("VICTIM_FAR: {} distance: {} max: {}", ch->GetName(), distance, max); return BATTLE_NONE; } @@ -367,7 +366,7 @@ void Item_GetDamage(LPITEM pkItem, int* pdamMin, int* pdamMax) } if (pkItem->GetType() != ITEM_WEAPON) - sys_err("Item_GetDamage - !ITEM_WEAPON vnum=%d, type=%d", pkItem->GetOriginalVnum(), pkItem->GetType()); + SPDLOG_ERROR("Item_GetDamage - !ITEM_WEAPON vnum={}, type={}", pkItem->GetOriginalVnum(), pkItem->GetType()); *pdamMin = pkItem->GetValue(3); *pdamMax = pkItem->GetValue(4); @@ -394,7 +393,7 @@ int CalcMeleeDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, bool bIgnoreDe break; case WEAPON_BOW: - sys_err("CalcMeleeDamage should not handle bows (name: %s)", pkAttacker->GetName()); + SPDLOG_ERROR("CalcMeleeDamage should not handle bows (name: {})", pkAttacker->GetName()); return 0; default: @@ -677,8 +676,7 @@ int battle_hit(LPCHARACTER pkAttacker, LPCHARACTER pkVictim) iDam = attMul * tempIDam + 0.5f; //PROF_UNIT puHit("Hit"); - if (test_server) - sys_log(0, "battle_hit : [%s] attack to [%s] : dam: %d", pkAttacker->GetName(), pkVictim->GetName(), iDam); + SPDLOG_TRACE("battle_hit : [{}] attack to [{}] : dam: {}", pkAttacker->GetName(), pkVictim->GetName(), iDam); //PROF_UNIT puDam("Dam"); if (pkVictim->Damage(pkAttacker, iDam, DAMAGE_TYPE_NORMAL)) @@ -740,7 +738,7 @@ void SET_ATTACKED_TIME(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) { // 2013 09 11 CYH debugging log - /*sys_log(0, "%s attack test log! time (delta, limit)=(%u, %u). ch->m_kAttackLog.dwvID(%u) victim->GetVID(%u)", + /*SPDLOG_DEBUG("{} attack test log! time (delta, limit)=({}, {}). ch->m_kAttackLog.dwvID({}) victim->GetVID({})", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), @@ -748,7 +746,7 @@ bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) victim->GetVID() ); - sys_log(0, "%s attack test log! time (delta, limit)=(%u, %u). victim->m_AttackedLog.dwPID(%u) ch->GetPlayerID(%u)", + SPDLOG_DEBUG("{} attack test log! time (delta, limit)=({}, {}). victim->m_AttackedLog.dwPID({}) ch->GetPlayerID({})", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), @@ -764,7 +762,7 @@ bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) if (test_server) { - sys_log(0, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", + SPDLOG_TRACE("{} attack hack! time (delta, limit)=({}, {}) hack_count {}", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), @@ -793,7 +791,7 @@ bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) if (test_server) { - sys_log(0, "%s Attack Speed HACK! time (delta, limit)=(%u, %u), hack_count = %d", + SPDLOG_TRACE("{} Attack Speed HACK! time (delta, limit)=({}, {}), hack_count = {}", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), diff --git a/src/game/src/belt_inventory_helper.h b/src/game/src/belt_inventory_helper.h index da1bd67..b3d8e20 100644 --- a/src/game/src/belt_inventory_helper.h +++ b/src/game/src/belt_inventory_helper.h @@ -27,7 +27,7 @@ public: if (level >= _countof(beltGradeByLevelTable)) { - sys_err("CBeltInventoryHelper::GetBeltGradeByRefineLevel - Overflow level (%d", level); + SPDLOG_ERROR("CBeltInventoryHelper::GetBeltGradeByRefineLevel - Overflow level ({})", level); return 0; } diff --git a/src/game/src/blend_item.cpp b/src/game/src/blend_item.cpp index c7dcb0e..d803ca5 100644 --- a/src/game/src/blend_item.cpp +++ b/src/game/src/blend_item.cpp @@ -10,7 +10,6 @@ #include "stdafx.h" #include "constants.h" #include "log.h" -#include "dev_log.h" #include "locale_service.h" #include "item.h" #include "blend_item.h" @@ -37,7 +36,7 @@ bool Blend_Item_init() char file_name[256]; snprintf (file_name, sizeof(file_name), "%s/blend.txt", LocaleService_GetBasePath().c_str()); - sys_log(0, "Blend_Item_init %s ", file_name); + SPDLOG_INFO("Blend_Item_init {} ", file_name); DO_ALL_BLEND_INFO(iter) { @@ -48,7 +47,7 @@ bool Blend_Item_init() if (false==Blend_Item_load(file_name)) { - sys_err(" fail"); + SPDLOG_ERROR(" fail"); return false; } return true; @@ -108,7 +107,7 @@ bool Blend_Item_load(char *file) if (0 == (blend_item_info->apply_type = FN_get_apply_type(v))) { - sys_err ("Invalid apply_type(%s)", v); + SPDLOG_ERROR("Invalid apply_type({})", v); return false; } } @@ -222,7 +221,7 @@ bool Blend_Item_set_value(LPITEM item) apply_value = blend_info->apply_value [FN_random_index()]; apply_duration = blend_info->apply_duration [FN_random_index()]; } - sys_log (0, "blend_item : type : %d, value : %d, du : %d", apply_type, apply_value, apply_duration); + SPDLOG_DEBUG("blend_item : type : {}, value : {}, du : {}", apply_type, apply_value, apply_duration); item->SetSocket(0, apply_type); item->SetSocket(1, apply_value); item->SetSocket(2, apply_duration); diff --git a/src/game/src/block_country.cpp b/src/game/src/block_country.cpp index a05aa25..6a1b70a 100644 --- a/src/game/src/block_country.cpp +++ b/src/game/src/block_country.cpp @@ -10,7 +10,6 @@ #include "stdafx.h" #include "constants.h" #include "block_country.h" -#include "dev_log.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)) @@ -36,7 +35,7 @@ std::set s_block_exception; // static functions static void __add_block_exception(const char *login) { -dev_log(LOG_DEB0, "BLOCK_EXCEPTION_ADD : %s", login); +SPDLOG_TRACE("BLOCK_EXCEPTION_ADD : {}", login); DEC_EXCEPTION_ITER(iter); std::string string_login(login); @@ -52,7 +51,7 @@ dev_log(LOG_DEB0, "BLOCK_EXCEPTION_ADD : %s", login); static void __del_block_exception(const char *login) { -dev_log(LOG_DEB0, "BLOCK_EXCEPTION_DEL : %s", login); +SPDLOG_TRACE("BLOCK_EXCEPTION_DEL : {}", login); DEC_EXCEPTION_ITER(iter); std::string string_login(login); @@ -80,7 +79,7 @@ void add_blocked_country_ip(TPacketBlockCountryIp *data) s_blocked_ip.push_back(block_ip); - dev_log(LOG_DEB0, "BLOCKED_IP = %u - %u", block_ip->ip_from, block_ip->ip_to); + SPDLOG_TRACE("BLOCKED_IP = {} - {}", block_ip->ip_from, block_ip->ip_to); } @@ -119,7 +118,7 @@ bool is_blocked_country_ip(const char *user_ip) if (INADDR_NONE == in_address) #endif { - dev_log(LOG_INFO, "BLOCKED_COUNTRY_IP (%s) : YES", user_ip); + SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip); return true; // ¾ÆÀÌÇÇ°¡ ±«»óÇÏ´Ï ÀÏ´Ü ºí·°Ã³¸® } ip_number = htonl(st_addr.s_addr); @@ -129,12 +128,12 @@ bool is_blocked_country_ip(const char *user_ip) block_ip = *iter; if ( block_ip->ip_from <= ip_number && ip_number <= block_ip->ip_to ) { - dev_log(LOG_INFO, "BLOCKED_COUNTRY_IP (%s) : YES", user_ip); + SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip); return true; } } - dev_log(LOG_INFO, "BLOCKED_COUNTRY_IP (%s) : NO", user_ip); + SPDLOG_DEBUG("BLOCKED_COUNTRY_IP ({}) : NO", user_ip); return false; } diff --git a/src/game/src/buff_on_attributes.cpp b/src/game/src/buff_on_attributes.cpp index ae24d68..1a44446 100644 --- a/src/game/src/buff_on_attributes.cpp +++ b/src/game/src/buff_on_attributes.cpp @@ -51,7 +51,7 @@ void CBuffOnAttributes::RemoveBuffFromItem(LPITEM pItem) } else { - sys_err ("Buff ERROR(type %d). This item(%d) attr_type(%d) was not in buff pool", m_bPointType, pItem->GetVnum(), attr.bType); + SPDLOG_ERROR("Buff ERROR(type {}). This item({}) attr_type({}) was not in buff pool", m_bPointType, pItem->GetVnum(), attr.bType); return; } } diff --git a/src/game/src/building.cpp b/src/game/src/building.cpp index 201f425..426fa8e 100644 --- a/src/game/src/building.cpp +++ b/src/game/src/building.cpp @@ -96,7 +96,7 @@ void CObject::EncodeInsertPacket(LPENTITY entity) if (!(d = entity->GetDesc())) return; - sys_log(0, "ObjectInsertPacket vid %u vnum %u rot %f %f %f", + SPDLOG_DEBUG("ObjectInsertPacket vid {} vnum {} rot {} {} {}", m_dwVID, m_data.dwVnum, m_data.xRot, m_data.yRot, m_data.zRot); TPacketGCCharacterAdd pack; @@ -132,7 +132,7 @@ void CObject::EncodeRemovePacket(LPENTITY entity) if (!(d = entity->GetDesc())) return; - sys_log(0, "ObjectRemovePacket vid %u", m_dwVID); + SPDLOG_DEBUG("ObjectRemovePacket vid {}", m_dwVID); TPacketGCCharacterDelete pack; @@ -153,7 +153,7 @@ bool CObject::Show(int lMapIndex, int x, int y) if (!tree) { - sys_err("cannot find sectree by %dx%d mapindex %d", x, y, lMapIndex); + SPDLOG_ERROR("cannot find sectree by {}x{} mapindex {}", x, y, lMapIndex); return false; } @@ -292,7 +292,7 @@ void CObject::RegenNPC() if (!m_chNPC) { - sys_err("Cannot create guild npc"); + SPDLOG_ERROR("Cannot create guild npc"); return; } @@ -461,7 +461,7 @@ void CLand::DeleteObject(DWORD dwID) if (!(pkObj = FindObject(dwID))) return; - sys_log(0, "Land::DeleteObject %u", dwID); + SPDLOG_DEBUG("Land::DeleteObject {}", dwID); CManager::instance().UnregisterObject(pkObj); M2_DESTROY_CHARACTER (pkObj->GetNPC()); @@ -506,14 +506,14 @@ bool CLand::RequestCreateObject(DWORD dwVnum, int lMapIndex, int x, int y, float if (!pkProto) { - sys_err("Invalid Object vnum %u", dwVnum); + SPDLOG_ERROR("Invalid Object vnum {}", dwVnum); return false; } const TMapRegion * r = rkSecTreeMgr.GetMapRegion(lMapIndex); if (!r) return false; - sys_log(0, "RequestCreateObject(vnum=%u, map=%d, pos=(%d,%d), rot=(%.1f,%.1f,%.1f) region(%d,%d ~ %d,%d)", + SPDLOG_DEBUG("RequestCreateObject(vnum={}, map={}, pos=({},{}), rot=({:.1f},{:.1f},{:.1f}) region({},{} ~ {},{})", dwVnum, lMapIndex, x, y, xRot, yRot, zRot, r->sx, r->sy, r->ex, r->ey); x += r->sx; @@ -539,7 +539,7 @@ bool CLand::RequestCreateObject(DWORD dwVnum, int lMapIndex, int x, int y, float if (tsx < sx || tex > ex || tsy < sy || tey > ey) { - sys_err("invalid position: object is outside of land region\nLAND: %d %d ~ %d %d\nOBJ: %d %d ~ %d %d", sx, sy, ex, ey, osx, osy, oex, oey); + SPDLOG_ERROR("invalid position: object is outside of land region\nLAND: {} {} ~ {} {}\nOBJ: {} {} ~ {} {}", sx, sy, ex, ey, osx, osy, oex, oey); return false; } @@ -548,7 +548,7 @@ bool CLand::RequestCreateObject(DWORD dwVnum, int lMapIndex, int x, int y, float { if (rkSecTreeMgr.ForAttrRegion(lMapIndex, osx, osy, oex, oey, (int)zRot, ATTR_OBJECT, ATTR_REGION_MODE_CHECK)) { - sys_err("another object already exist"); + SPDLOG_ERROR("another object already exist"); return false; } FIsIn f (osx, osy, oex, oey); @@ -556,7 +556,7 @@ bool CLand::RequestCreateObject(DWORD dwVnum, int lMapIndex, int x, int y, float if (f.bIn) { - sys_err("another object already exist"); + SPDLOG_ERROR("another object already exist"); return false; } } @@ -581,12 +581,12 @@ void CLand::RequestDeleteObject(DWORD dwID) { if (!FindObject(dwID)) { - sys_err("no object by id %u", dwID); + SPDLOG_ERROR("no object by id {}", dwID); return; } db_clientdesc->DBPacket(HEADER_GD_DELETE_OBJECT, 0, &dwID, sizeof(DWORD)); - sys_log(0, "RequestDeleteObject id %u", dwID); + SPDLOG_DEBUG("RequestDeleteObject id {}", dwID); } void CLand::RequestDeleteObjectByVID(DWORD dwVID) @@ -595,13 +595,13 @@ void CLand::RequestDeleteObjectByVID(DWORD dwVID) if (!(pkObj = FindObjectByVID(dwVID))) { - sys_err("no object by vid %u", dwVID); + SPDLOG_ERROR("no object by vid {}", dwVID); return; } DWORD dwID = pkObj->GetID(); db_clientdesc->DBPacket(HEADER_GD_DELETE_OBJECT, 0, &dwID, sizeof(DWORD)); - sys_log(0, "RequestDeleteObject vid %u id %u", dwVID, dwID); + SPDLOG_DEBUG("RequestDeleteObject vid {} id {}", dwVID, dwID); } void CLand::SetOwner(DWORD dwGuild) @@ -621,7 +621,7 @@ void CLand::RequestUpdate(DWORD dwGuild) a[1] = dwGuild; db_clientdesc->DBPacket(HEADER_GD_UPDATE_LAND, 0, &a[0], sizeof(DWORD) * 2); - sys_log(0, "RequestUpdate id %u guild %u", a[0], a[1]); + SPDLOG_DEBUG("RequestUpdate id {} guild {}", a[0], a[1]); } //////////////////////////////////////////////////////////////////////////////////// @@ -654,7 +654,7 @@ bool CManager::LoadObjectProto(const TObjectProto * pProto, int size) // from DB TObjectProto & r = m_vec_kObjectProto[i]; // BUILDING_NPC - sys_log(0, "ObjectProto %u price %u upgrade %u upg_limit %u life %d NPC %u", + SPDLOG_DEBUG("ObjectProto {} price {} upgrade {} upg_limit {} life {} NPC {}", r.dwVnum, r.dwPrice, r.dwUpgradeVnum, r.dwUpgradeLimitTime, r.lLife, r.dwNPCVnum); // END_OF_BUILDING_NPC @@ -665,11 +665,11 @@ bool CManager::LoadObjectProto(const TObjectProto * pProto, int size) // from DB if (NULL == ITEM_MANAGER::instance().GetTable(r.kMaterials[j].dwItemVnum)) { - sys_err(" mat: ERROR!! no item by vnum %u", r.kMaterials[j].dwItemVnum); + SPDLOG_ERROR(" mat: ERROR!! no item by vnum {}", r.kMaterials[j].dwItemVnum); return false; } - sys_log(0, " mat: %u %u", r.kMaterials[j].dwItemVnum, r.kMaterials[j].dwCount); + SPDLOG_TRACE(" mat: {} {}", r.kMaterials[j].dwItemVnum, r.kMaterials[j].dwCount); } m_map_pkObjectProto.insert(std::make_pair(r.dwVnum, &m_vec_kObjectProto[i])); @@ -700,7 +700,7 @@ bool CManager::LoadLand(TLand * pTable) // from DB CLand * pkLand = M2_NEW CLand(pTable); m_map_pkLand.insert(std::make_pair(pkLand->GetID(), pkLand)); - sys_log(0, "LAND: %u map %d %dx%d w %u h %u", + SPDLOG_INFO("LAND: {} map {} {}x{} w {} h {}", pTable->dwID, pTable->lMapIndex, pTable->x, pTable->y, pTable->width, pTable->height); return true; @@ -712,7 +712,7 @@ void CManager::UpdateLand(TLand * pTable) if (!pkLand) { - sys_err("cannot find land by id %u", pTable->dwID); + SPDLOG_ERROR("cannot find land by id {}", pTable->dwID); return; } @@ -736,7 +736,7 @@ void CManager::UpdateLand(TLand * pTable) e.height = pTable->height; e.dwGuildID = pTable->dwGuildID; - sys_log(0, "BUILDING: UpdateLand %u pos %dx%d guild %u", e.dwID, e.x, e.y, e.dwGuildID); + SPDLOG_INFO("BUILDING: UpdateLand {} pos {}x{} guild {}", e.dwID, e.x, e.y, e.dwGuildID); CGuild *guild = CGuildManager::instance().FindGuild(pTable->dwGuildID); while (it != cont.end()) @@ -766,7 +766,7 @@ CLand * CManager::FindLand(DWORD dwID) CLand * CManager::FindLand(int lMapIndex, int x, int y) { - sys_log(0, "BUILDING: FindLand %d %d %d", lMapIndex, x, y); + SPDLOG_DEBUG("BUILDING: FindLand {} {} {}", lMapIndex, x, y); const TMapRegion * r = SECTREE_MANAGER::instance().GetMapRegion(lMapIndex); @@ -819,7 +819,7 @@ bool CManager::LoadObject(TObject * pTable, bool isBoot) // from DB if (!pkLand) { - sys_log(0, "Cannot find land by id %u", pTable->dwLandID); + SPDLOG_ERROR("Cannot find land by id {}", pTable->dwLandID); return false; } @@ -827,11 +827,11 @@ bool CManager::LoadObject(TObject * pTable, bool isBoot) // from DB if (!pkProto) { - sys_err("Cannot find object %u in prototype (id %u)", pTable->dwVnum, pTable->dwID); + SPDLOG_ERROR("Cannot find object {} in prototype (id {})", pTable->dwVnum, pTable->dwID); return false; } - sys_log(0, "OBJ: id %u vnum %u map %d pos %dx%d", pTable->dwID, pTable->dwVnum, pTable->lMapIndex, pTable->x, pTable->y); + SPDLOG_DEBUG("OBJ: id {} vnum {} map {} pos {}x{}", pTable->dwID, pTable->dwVnum, pTable->lMapIndex, pTable->x, pTable->y); LPOBJECT pkObj = M2_NEW CObject(pTable, pkProto); @@ -880,7 +880,7 @@ void CManager::FinalizeBoot() } // BUILDING_NPC - sys_log(0, "FinalizeBoot"); + SPDLOG_DEBUG("FinalizeBoot"); // END_OF_BUILDING_NPC itertype(m_map_pkLand) it2 = m_map_pkLand.begin(); @@ -892,7 +892,7 @@ void CManager::FinalizeBoot() const TLand & r = pkLand->GetData(); // LAND_MASTER_LOG - sys_log(0, "LandMaster map_index=%d pos=(%d, %d)", r.lMapIndex, r.x, r.y); + SPDLOG_DEBUG("LandMaster map_index={} pos=({}, {})", r.lMapIndex, r.x, r.y); // END_OF_LAND_MASTER_LOG if (r.dwGuildID != 0) @@ -911,7 +911,7 @@ void CManager::FinalizeBoot() void CManager::DeleteObject(DWORD dwID) // from DB { - sys_log(0, "OBJ_DEL: %u", dwID); + SPDLOG_DEBUG("OBJ_DEL: {}", dwID); itertype(m_map_pkObjByID) it = m_map_pkObjByID.find(dwID); @@ -975,7 +975,7 @@ void CManager::SendLandList(LPDESC d, int lMapIndex) ++wCount; } - sys_log(0, "SendLandList map %d count %u elem_size: %d", lMapIndex, wCount, buf.size()); + SPDLOG_DEBUG("SendLandList map {} count {} elem_size: {}", lMapIndex, wCount, buf.size()); if (wCount != 0) { @@ -996,13 +996,13 @@ void CManager::ClearLand(DWORD dwLandID) if ( pLand == NULL ) { - sys_log(0, "LAND_CLEAR: there is no LAND id like %d", dwLandID); + SPDLOG_WARN("LAND_CLEAR: there is no LAND id like {}", dwLandID); return; } pLand->ClearLand(); - sys_log(0, "LAND_CLEAR: request Land Clear. LandID: %d", pLand->GetID()); + SPDLOG_DEBUG("LAND_CLEAR: request Land Clear. LandID: {}", pLand->GetID()); } void CManager::ClearLandByGuildID(DWORD dwGuildID) @@ -1011,13 +1011,13 @@ void CManager::ClearLandByGuildID(DWORD dwGuildID) if ( pLand == NULL ) { - sys_log(0, "LAND_CLEAR: there is no GUILD id like %d", dwGuildID); + SPDLOG_WARN("LAND_CLEAR: there is no GUILD id like {}", dwGuildID); return; } pLand->ClearLand(); - sys_log(0, "LAND_CLEAR: request Land Clear. LandID: %d", pLand->GetID()); + SPDLOG_DEBUG("LAND_CLEAR: request Land Clear. LandID: {}", pLand->GetID()); } void CLand::ClearLand() diff --git a/src/game/src/castle.cpp b/src/game/src/castle.cpp index 2d78211..51d41fe 100644 --- a/src/game/src/castle.cpp +++ b/src/game/src/castle.cpp @@ -241,7 +241,7 @@ EVENTFUNC(castle_siege_event) if ( info == NULL ) { - sys_err( "castle_siege_event> Null pointer" ); + SPDLOG_ERROR("castle_siege_event> Null pointer" ); return 0; } @@ -320,7 +320,7 @@ EVENTFUNC(castle_stone_event) if (info == NULL) { - sys_err( "castle_stone_event> Null pointer" ); + SPDLOG_ERROR("castle_stone_event> Null pointer" ); return 0; } @@ -470,7 +470,7 @@ bool castle_boot() else { fclose(fp); - sys_err("wrong empire number is null"); + SPDLOG_ERROR("wrong empire number is null"); return false; } } @@ -526,7 +526,7 @@ void castle_save() if (NULL == fp) { - sys_err(" fopen(%s)", castle_file); + SPDLOG_ERROR(" fopen({})", castle_file); return; } diff --git a/src/game/src/char.cpp b/src/game/src/char.cpp index 6aad1ac..31b0ba2 100644 --- a/src/game/src/char.cpp +++ b/src/game/src/char.cpp @@ -47,7 +47,6 @@ #include "monarch.h" #include "castle.h" #include "arena.h" -#include "dev_log.h" #include "horsename_manager.h" #include "pcbang.h" #include "gm.h" @@ -466,7 +465,7 @@ void CHARACTER::Destroy() party->Quit(GetVID()); } - SetParty(NULL); // ¾ÈÇصµ µÇÁö¸¸ ¾ÈÀüÇÏ°Ô. + SetParty(NULL); // ���ص� ������ �����ϰ�. } if (m_pkMobInst) @@ -560,20 +559,20 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE { if (GetPart(PART_MAIN) > 2) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹þ¾î¾ß °³ÀÎ »óÁ¡À» ¿­ ¼ö ÀÖ½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ����� ���� ������ �� �� �ֽ��ϴ�.")); return; } - if (GetMyShop()) // ÀÌ¹Ì ¼¥ÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý´Â´Ù. + if (GetMyShop()) // �̹� ���� ���� ������ �ݴ´�. { CloseMyShop(); return; } - // ÁøÇàÁßÀÎ Äù½ºÆ®°¡ ÀÖÀ¸¸é »óÁ¡À» ¿­ ¼ö ¾ø´Ù. + // �������� ����Ʈ�� ������ ������ �� �� ����. quest::PC * pPC = quest::CQuestManager::instance().GetPCForce(GetPlayerID()); - // GetPCForce´Â NULLÀÏ ¼ö ¾øÀ¸¹Ç·Î µû·Î È®ÀÎÇÏÁö ¾ÊÀ½ + // GetPCForce�� NULL�� �� �����Ƿ� ���� Ȯ������ ���� if (pPC->IsRunning()) return; @@ -591,8 +590,8 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE if (GOLD_MAX <= nTotalMoney) { - sys_err("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id %u name %s", GetPlayerID(), GetName()); - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20¾ï ³ÉÀ» ÃÊ°úÇÏ¿© »óÁ¡À» ¿­¼ö°¡ ¾ø½À´Ï´Ù")); + SPDLOG_ERROR("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id {} name {}", GetPlayerID(), GetName()); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20�� ���� �ʰ��Ͽ� ������ ������ �����ϴ�")); return; } @@ -608,13 +607,13 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE { if (CBanwordManager::instance().CheckString(m_stShopSign.c_str(), m_stShopSign.length())) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ºñ¼Ó¾î³ª Àº¾î°¡ Æ÷ÇÔµÈ »óÁ¡ À̸§À¸·Î »óÁ¡À» ¿­ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��Ӿ ��� ���Ե� ���� �̸����� ������ �� �� �����ϴ�.")); return; } } // MYSHOP_PRICE_LIST - std::map itemkind; // ¾ÆÀÌÅÛ Á¾·ùº° °¡°Ý, first: vnum, second: ´ÜÀÏ ¼ö·® °¡°Ý + std::map itemkind; // ������ ������ ����, first: vnum, second: ���� ���� ���� // END_OF_MYSHOP_PRICE_LIST std::set cont; @@ -622,7 +621,7 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE { if (cont.find((pTable + i)->pos) != cont.end()) { - sys_err("MYSHOP: duplicate shop item detected! (name: %s)", GetName()); + SPDLOG_ERROR("MYSHOP: duplicate shop item detected! (name: {})", GetName()); return; } @@ -635,19 +634,19 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE if (item_table && (IS_SET(item_table->dwAntiFlags, ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_MYSHOP))) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À¯·áÈ­ ¾ÆÀÌÅÛÀº °³ÀλóÁ¡¿¡¼­ ÆǸÅÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("����ȭ �������� ��������� �Ǹ��� �� �����ϴ�.")); return; } if (pkItem->IsEquipped() == true) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀåºñÁßÀÎ ¾ÆÀÌÅÛÀº °³ÀλóÁ¡¿¡¼­ ÆǸÅÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������� �������� ��������� �Ǹ��� �� �����ϴ�.")); return; } if (true == pkItem->isLocked()) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ëÁßÀÎ ¾ÆÀÌÅÛÀº °³ÀλóÁ¡¿¡¼­ ÆǸÅÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������� �������� ��������� �Ǹ��� �� �����ϴ�.")); return; } @@ -660,11 +659,11 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE } // MYSHOP_PRICE_LIST - // º¸µû¸® °³¼ö¸¦ °¨¼Ò½ÃŲ´Ù. - if (CountSpecifyItem(71049)) { // ºñ´Ü º¸µû¸®´Â ¾ø¾ÖÁö ¾Ê°í °¡°ÝÁ¤º¸¸¦ ÀúÀåÇÑ´Ù. + // ������ ������ ���ҽ�Ų��. + if (CountSpecifyItem(71049)) { // ��� �������� ������ �ʰ� ���������� �����Ѵ�. // - // ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸¸¦ ÀúÀåÇϱâ À§ÇØ ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ÆÐŶÀ» ¸¸µé¾î DB ij½Ã¿¡ º¸³½´Ù. + // ������ ���������� �����ϱ� ���� ������ �������� ��Ŷ�� ����� DB ij�ÿ� ������. // TPacketMyshopPricelistHeader header; TItemPriceInfo info; @@ -689,7 +688,7 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE else if (CountSpecifyItem(50200)) RemoveSpecifyItem(50200, 1); else - return; // º¸µû¸®°¡ ¾øÀ¸¸é Áß´Ü. + return; // �������� ������ �ߴ�. if (m_pkExchange) m_pkExchange->Cancel(); @@ -713,8 +712,8 @@ void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE { HorseSummon( false, true ); } - // new mount ÀÌ¿ë Áß¿¡, °³ÀÎ »óÁ¡ ¿­¸é ÀÚµ¿ unmount - // StopRidingÀ¸·Î ´º¸¶¿îÆ®±îÁö ó¸®Çϸé ÁÁÀºµ¥ ¿Ö ±×·¸°Ô ¾ÈÇسù´ÂÁö ¾Ë ¼ö ¾ø´Ù. + // new mount �̿� �߿�, ���� ���� ���� �ڵ� unmount + // StopRiding���� ������Ʈ���� ó���ϸ� ������ �� �׷��� ���س����� �� �� ����. else if (GetMountVnum()) { RemoveAffect(AFFECT_MOUNT); @@ -797,7 +796,7 @@ void CHARACTER::RestartAtSamePos() } -// Entity¿¡ ³»°¡ ³ªÅ¸³µ´Ù°í ÆÐŶÀ» º¸³½´Ù. +// Entity�� ���� ��Ÿ���ٰ� ��Ŷ�� ������. void CHARACTER::EncodeInsertPacket(LPENTITY entity) { @@ -806,10 +805,10 @@ void CHARACTER::EncodeInsertPacket(LPENTITY entity) if (!(d = entity->GetDesc())) return; - // ±æµåÀ̸§ ¹ö±× ¼öÁ¤ ÄÚµå + // ����̸� ���� ���� �ڵ� LPCHARACTER ch = (LPCHARACTER) entity; ch->SendGuildName(GetGuild()); - // ±æµåÀ̸§ ¹ö±× ¼öÁ¤ ÄÚµå + // ����̸� ���� ���� �ڵ� TPacketGCCharacterAdd pack; @@ -951,7 +950,7 @@ void CHARACTER::EncodeInsertPacket(LPENTITY entity) if (entity->IsType(ENTITY_CHARACTER)) { - sys_log(3, "EntityInsert %s (RaceNum %d) (%d %d) TO %s", + SPDLOG_TRACE("EntityInsert {} (RaceNum {}) ({} {}) TO {}", GetName(), GetRaceNum(), GetX() / SECTREE_SIZE, GetY() / SECTREE_SIZE, ((LPCHARACTER)entity)->GetName()); } } @@ -974,7 +973,7 @@ void CHARACTER::EncodeRemovePacket(LPENTITY entity) d->Packet(&pack, sizeof(TPacketGCCharacterDelete)); if (entity->IsType(ENTITY_CHARACTER)) - sys_log(3, "EntityRemove %s(%d) FROM %s", GetName(), (DWORD) m_vid, ((LPCHARACTER) entity)->GetName()); + SPDLOG_TRACE("EntityRemove {}({}) FROM {}", GetName(), (DWORD) m_vid, ((LPCHARACTER) entity)->GetName()); } void CHARACTER::UpdatePacket() @@ -1098,14 +1097,14 @@ void CHARACTER::SetPosition(int pos) { case POS_FIGHTING: if (!IsState(m_stateBattle)) - MonsterLog("[BATTLE] ½Î¿ì´Â »óÅÂ"); + MonsterLog("[BATTLE] �� ����"); GotoState(m_stateBattle); break; default: if (!IsState(m_stateIdle)) - MonsterLog("[IDLE] ½¬´Â »óÅÂ"); + MonsterLog("[IDLE] ���� ����"); GotoState(m_stateIdle); break; @@ -1198,7 +1197,7 @@ void CHARACTER::CreatePlayerProto(TPlayerTable & tab) tab.lExitY = m_posExit.y; } - sys_log(0, "SAVE: %s %dx%d", GetName(), tab.x, tab.y); + SPDLOG_DEBUG("SAVE: {} {}x{}", GetName(), tab.x, tab.y); tab.st = GetRealPoint(POINT_ST); tab.ht = GetRealPoint(POINT_HT); @@ -1243,7 +1242,7 @@ void CHARACTER::SaveReal() if (!GetDesc()) { - sys_err("Character::Save : no descriptor when saving (name: %s)", GetName()); + SPDLOG_ERROR("Character::Save : no descriptor when saving (name: {})", GetName()); return; } @@ -1255,7 +1254,7 @@ void CHARACTER::SaveReal() quest::PC * pkQuestPC = quest::CQuestManager::instance().GetPCForce(GetPlayerID()); if (!pkQuestPC) - sys_err("CHARACTER::Save : null quest::PC pointer! (name %s)", GetName()); + SPDLOG_ERROR("CHARACTER::Save : null quest::PC pointer! (name {})", GetName()); else { pkQuestPC->Save(); @@ -1268,7 +1267,7 @@ void CHARACTER::SaveReal() void CHARACTER::FlushDelayedSaveItem() { - // ÀúÀå ¾ÈµÈ ¼ÒÁöÇ°À» ÀüºÎ ÀúÀå½ÃŲ´Ù. + // ���� �ȵ� ����ǰ�� ���� �����Ų��. LPITEM item; for (int i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i) @@ -1280,7 +1279,7 @@ void CHARACTER::Disconnect(const char * c_pszReason) { assert(GetDesc() != NULL); - sys_log(0, "DISCONNECT: %s (%s)", GetName(), c_pszReason ? c_pszReason : "unset" ); + SPDLOG_DEBUG("DISCONNECT: {} ({})", GetName(), c_pszReason ? c_pszReason : "unset" ); if (GetShop()) { @@ -1336,7 +1335,7 @@ void CHARACTER::Disconnect(const char * c_pszReason) if (GetParty()) GetParty()->Unlink(this); - // Á×¾úÀ» ¶§ Á¢¼Ó²÷À¸¸é °æÇèÄ¡ ÁÙ°Ô Çϱâ + // �׾��� �� ���Ӳ����� ����ġ �ٰ� �ϱ� if (IsStun() || IsDead()) { DeathPenalty(0); @@ -1354,7 +1353,7 @@ void CHARACTER::Disconnect(const char * c_pszReason) SaveAffect(); m_bIsLoadedAffect = false; - m_bSkipSave = true; // ÀÌ ÀÌÈÄ¿¡´Â ´õÀÌ»ó ÀúÀåÇÏ¸é ¾ÈµÈ´Ù. + m_bSkipSave = true; // �� ���Ŀ��� ���̻� �����ϸ� �ȵȴ�. quest::CQuestManager::instance().DisconnectPC(this); @@ -1401,7 +1400,7 @@ bool CHARACTER::Show(int lMapIndex, int x, int y, int z, bool bShowSpawnMotion/* if (!sectree) { - sys_log(0, "cannot find sectree by %dx%d mapindex %d", x, y, lMapIndex); + SPDLOG_WARN("cannot find sectree by {}x{} mapindex {}", x, y, lMapIndex); return false; } @@ -1422,7 +1421,7 @@ bool CHARACTER::Show(int lMapIndex, int x, int y, int z, bool bShowSpawnMotion/* if (!IsNPC()) { - sys_log(0, "SHOW: %s %dx%dx%d", GetName(), x, y, z); + SPDLOG_DEBUG("SHOW: {} {}x{}x{}", GetName(), x, y, z); if (GetStamina() < GetMaxStamina()) StartAffectEvent(); } @@ -1459,7 +1458,7 @@ bool CHARACTER::Show(int lMapIndex, int x, int y, int z, bool bShowSpawnMotion/* else { ViewReencode(); - sys_log(0, " in same sectree"); + SPDLOG_DEBUG(" in same sectree"); } REMOVE_BIT(m_bAddChrState, ADD_CHARACTER_STATE_SPAWN); @@ -1483,7 +1482,7 @@ static bool gs_bgmVolEnable = false; void CHARACTER_SetBGMVolumeEnable() { gs_bgmVolEnable = true; - sys_log(0, "bgm_info.set_bgm_volume_enable"); + SPDLOG_DEBUG("bgm_info.set_bgm_volume_enable"); } void CHARACTER_AddBGMInfo(unsigned mapIndex, const char* name, float vol) @@ -1494,7 +1493,7 @@ void CHARACTER_AddBGMInfo(unsigned mapIndex, const char* name, float vol) gs_bgmInfoMap[mapIndex] = newInfo; - sys_log(0, "bgm_info.add_info(%d, '%s', %f)", mapIndex, name, vol); + SPDLOG_DEBUG("bgm_info.add_info({}, '{}', {})", mapIndex, name, vol); } const BGMInfo& CHARACTER_GetBGMInfo(unsigned mapIndex) @@ -1524,7 +1523,7 @@ void CHARACTER::MainCharacterPacket() { if (CHARACTER_IsBGMVolumeEnable()) { - sys_log(1, "bgm_info.play_bgm_vol(%d, name='%s', vol=%f)", mapIndex, bgmInfo.name.c_str(), bgmInfo.vol); + SPDLOG_DEBUG("bgm_info.play_bgm_vol({}, name='{}', vol={})", mapIndex, bgmInfo.name.c_str(), bgmInfo.vol); TPacketGCMainCharacter4_BGM_VOL mainChrPacket; mainChrPacket.header = HEADER_GC_MAIN_CHARACTER4_BGM_VOL; mainChrPacket.dwVID = m_vid; @@ -1542,7 +1541,7 @@ void CHARACTER::MainCharacterPacket() } else { - sys_log(1, "bgm_info.play(%d, '%s')", mapIndex, bgmInfo.name.c_str()); + SPDLOG_DEBUG("bgm_info.play({}, '{}')", mapIndex, bgmInfo.name.c_str()); TPacketGCMainCharacter3_BGM mainChrPacket; mainChrPacket.header = HEADER_GC_MAIN_CHARACTER3_BGM; mainChrPacket.dwVID = m_vid; @@ -1562,7 +1561,7 @@ void CHARACTER::MainCharacterPacket() // END_OF_SUPPORT_BGM else { - sys_log(0, "bgm_info.play(%d, DEFAULT_BGM_NAME)", mapIndex); + SPDLOG_DEBUG("bgm_info.play({}, DEFAULT_BGM_NAME)", mapIndex); TPacketGCMainCharacter pack; pack.header = HEADER_GC_MAIN_CHARACTER; @@ -1646,11 +1645,11 @@ bool CHARACTER::ChangeSex() break; default: - sys_err("CHANGE_SEX: %s unknown race %d", GetName(), src_race); + SPDLOG_ERROR("CHANGE_SEX: {} unknown race {}", GetName(), src_race); return false; } - sys_log(0, "CHANGE_SEX: %s (%d -> %d)", GetName(), src_race, m_points.job); + SPDLOG_DEBUG("CHANGE_SEX: {} ({} -> {})", GetName(), src_race, m_points.job); return true; } @@ -1669,7 +1668,7 @@ void CHARACTER::SetRace(BYTE race) { if (race >= MAIN_RACE_MAX_NUM) { - sys_err("CHARACTER::SetRace(name=%s, race=%d).OUT_OF_RACE_RANGE", GetName(), race); + SPDLOG_ERROR("CHARACTER::SetRace(name={}, race={}).OUT_OF_RACE_RANGE", GetName(), race); return; } @@ -1684,7 +1683,7 @@ BYTE CHARACTER::GetJob() const if (RaceToJob(race, &job)) return job; - sys_err("CHARACTER::GetJob(name=%s, race=%d).OUT_OF_RACE_RANGE", GetName(), race); + SPDLOG_ERROR("CHARACTER::GetJob(name={}, race={}).OUT_OF_RACE_RANGE", GetName(), race); return JOB_WARRIOR; } @@ -1711,7 +1710,7 @@ void CHARACTER::SetEmpire(BYTE bEmpire) void CHARACTER::SetPlayerProto(const TPlayerTable * t) { if (!GetDesc() || !*GetDesc()->GetHostName()) - sys_err("cannot get desc or hostname"); + SPDLOG_ERROR("cannot get desc or hostname"); else SetGMLevel(); @@ -1784,7 +1783,7 @@ void CHARACTER::SetPlayerProto(const TPlayerTable * t) SetSP(t->sp); SetStamina(t->stamina); - //GMÀ϶§ º¸È£¸ðµå + //GM�϶� ��ȣ��� if (!test_server) { if (GetGMLevel() > GM_LOW_WIZARD) @@ -1808,16 +1807,16 @@ void CHARACTER::SetPlayerProto(const TPlayerTable * t) m_dwLogOffInterval = t->logoff_interval; - sys_log(0, "PLAYER_LOAD: %s PREMIUM %d %d, LOGGOFF_INTERVAL %u PTR: %p", t->name, m_aiPremiumTimes[0], m_aiPremiumTimes[1], t->logoff_interval, this); + SPDLOG_INFO("PLAYER_LOAD: {} PREMIUM {} {}, LOGGOFF_INTERVAL {} PTR: {}", t->name, m_aiPremiumTimes[0], m_aiPremiumTimes[1], t->logoff_interval, (void*) this); if (GetGMLevel() != GM_PLAYER) { LogManager::instance().CharLog(this, GetGMLevel(), "GM_LOGIN", ""); - sys_log(0, "GM_LOGIN(gmlevel=%d, name=%s(%d), pos=(%d, %d)", GetGMLevel(), GetName(), GetPlayerID(), GetX(), GetY()); + SPDLOG_INFO("GM_LOGIN(gmlevel={}, name={}({}), pos=({}, {})", GetGMLevel(), GetName(), GetPlayerID(), GetX(), GetY()); } #ifdef __PET_SYSTEM__ - // NOTE: ÀÏ´Ü Ä³¸¯ÅÍ°¡ PCÀÎ °æ¿ì¿¡¸¸ PetSystemÀ» °®µµ·Ï ÇÔ. À¯·´ ¸Ó½Å´ç ¸Þ¸ð¸® »ç¿ë·ü¶§¹®¿¡ NPC±îÁö Çϱä Á».. + // NOTE: �ϴ� ij���Ͱ� PC�� ��쿡�� PetSystem�� ������ ��. ���� �ӽŴ� �޸� ���������� NPC���� �ϱ� ��.. if (m_petSystem) { m_petSystem->Destroy(); @@ -1833,7 +1832,7 @@ EVENTFUNC(kill_ore_load_event) char_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "kill_ore_load_even> Null pointer" ); + SPDLOG_ERROR("kill_ore_load_even> Null pointer" ); return 0; } @@ -1904,9 +1903,9 @@ void CHARACTER::SetProto(const CMob * pkMob) else SetPoint(POINT_DEF_GRADE_BONUS, 15); - //»êŸ¿ë + //��Ÿ�� //m_dwPlayStartTime = get_dword_time() + 10 * 60 * 1000; - //½Å¼±ÀÚ ³ëÇØ + //�ż��� ���� m_dwPlayStartTime = get_dword_time() + 30 * 1000; if (test_server) m_dwPlayStartTime = get_dword_time() + 30 * 1000; @@ -1981,7 +1980,7 @@ float CHARACTER::GetMobDamageMultiply() const float fDamMultiply = GetMobTable().fDamMultiply; if (IsBerserk()) - fDamMultiply = fDamMultiply * 2.0f; // BALANCE: ±¤ÆøÈ­ ½Ã µÎ¹è + fDamMultiply = fDamMultiply * 2.0f; // BALANCE: ����ȭ �� �ι� return fDamMultiply; } @@ -2014,7 +2013,7 @@ DWORD CHARACTER::GetMonsterDrainSPPoint() const BYTE CHARACTER::GetMobRank() const { if (!m_pkMobData) - return MOB_RANK_KNIGHT; // PCÀÏ °æ¿ì KNIGHT±Þ + return MOB_RANK_KNIGHT; // PC�� ��� KNIGHT�� return m_pkMobData->m_table.bRank; } @@ -2077,7 +2076,7 @@ void CHARACTER::ComputeBattlePoints() SetPoint(POINT_MAGIC_DEF_GRADE, GetPoint(POINT_DEF_GRADE)); // - // ±âº» ATK = 2lev + 2str, Á÷¾÷¿¡ ¸¶´Ù 2strÀº ¹Ù²ð ¼ö ÀÖÀ½ + // �⺻ ATK = 2lev + 2str, ������ ���� 2str�� �ٲ� �� ���� // int iAtk = GetLevel() * 2; int iStatAtk = 0; @@ -2098,19 +2097,19 @@ void CHARACTER::ComputeBattlePoints() break; default: - sys_err("invalid job %d", GetJob()); + SPDLOG_ERROR("invalid job {}", GetJob()); iStatAtk = (2 * GetPoint(POINT_ST)); break; } - // ¸»À» Ÿ°í ÀÖ°í, ½ºÅÈÀ¸·Î ÀÎÇÑ °ø°Ý·ÂÀÌ ST*2 º¸´Ù ³·À¸¸é ST*2·Î ÇÑ´Ù. - // ½ºÅÈÀ» À߸ø ÂïÀº »ç¶÷ °ø°Ý·ÂÀÌ ´õ ³·Áö ¾Ê°Ô Çϱâ À§Çؼ­´Ù. + // ���� Ÿ�� �ְ�, �������� ���� ���ݷ��� ST*2 ���� ������ ST*2�� �Ѵ�. + // ������ �߸� ���� ��� ���ݷ��� �� ���� �ʰ� �ϱ� ���ؼ���. if (GetMountVnum() && iStatAtk < 2 * GetPoint(POINT_ST)) iStatAtk = (2 * GetPoint(POINT_ST)); iAtk += iStatAtk; - // ½Â¸¶(¸») : °Ë¼ö¶ó µ¥¹ÌÁö °¨¼Ò + // �¸�(��) : �˼��� ������ ���� if (GetMountVnum()) { if (GetJob() == JOB_SURA && GetSkillGroup() == 1) @@ -2131,7 +2130,7 @@ void CHARACTER::ComputeBattlePoints() PointChange(POINT_ATT_GRADE, iAtk); // DEF = LEV + CON + ARMOR - int iShowDef = GetLevel() + GetPoint(POINT_HT); // For Ymir(õ¸¶) + int iShowDef = GetLevel() + GetPoint(POINT_HT); // For Ymir(õ��) int iDef = GetLevel() + (int) (GetPoint(POINT_HT) / 1.25); // For Other int iArmor = 0; @@ -2147,7 +2146,7 @@ void CHARACTER::ComputeBattlePoints() } } - // ¸» Ÿ°í ÀÖÀ» ¶§ ¹æ¾î·ÂÀÌ ¸»ÀÇ ±âÁØ ¹æ¾î·Âº¸´Ù ³·À¸¸é ±âÁØ ¹æ¾î·ÂÀ¸·Î ¼³Á¤ + // �� Ÿ�� ���� �� ������ ���� ���� ���º��� ������ ���� �������� ���� if( true == IsHorseRiding() ) { if (iArmor < GetHorseArmor()) @@ -2253,7 +2252,7 @@ void CHARACTER::ComputePoints() if (IsPC()) { - // ÃÖ´ë »ý¸í·Â/Á¤½Å·Â + // �ִ� �����/���ŷ� iMaxHP = JobInitialPoints[GetJob()].max_hp + m_points.iRandomHP + GetPoint(POINT_HT) * JobInitialPoints[GetJob()].hp_per_ht; iMaxSP = JobInitialPoints[GetJob()].max_sp + m_points.iRandomSP + GetPoint(POINT_IQ) * JobInitialPoints[GetJob()].sp_per_iq; iMaxStamina = JobInitialPoints[GetJob()].max_stamina + GetPoint(POINT_HT) * JobInitialPoints[GetJob()].stamina_per_con; @@ -2269,7 +2268,7 @@ void CHARACTER::ComputePoints() } } - // ±âº» °ªµé + // �⺻ ���� SetPoint(POINT_MOV_SPEED, 100); SetPoint(POINT_ATT_SPEED, 100); PointChange(POINT_ATT_SPEED, GetPoint(POINT_PARTY_HASTE_BONUS)); @@ -2288,9 +2287,9 @@ void CHARACTER::ComputePoints() if (IsPC()) { - // ¸» Ÿ°í ÀÖÀ» ¶§´Â ±âº» ½ºÅÈÀÌ ¸»ÀÇ ±âÁØ ½ºÅȺ¸´Ù ³·À¸¸é ³ô°Ô ¸¸µç´Ù. - // µû¶ó¼­ ¸»ÀÇ ±âÁØ ½ºÅÈÀÌ ¹«»ç ±âÁØÀ̹ǷÎ, ¼ö¶ó/¹«´çÀº Àüü ½ºÅÈ ÇÕÀÌ - // ´ëäÀûÀ¸·Î ´õ ¿Ã¶ó°¡°Ô µÉ °ÍÀÌ´Ù. + // �� Ÿ�� ���� ���� �⺻ ������ ���� ���� ���Ⱥ��� ������ ���� �����. + // ���� ���� ���� ������ ���� �����̹Ƿ�, ����/������ ��ü ���� ���� + // ������� �� �ö󰡰� �� ���̴�. if (GetMountVnum()) { if (GetHorseST() > GetPoint(POINT_ST)) @@ -2310,17 +2309,17 @@ void CHARACTER::ComputePoints() ComputeBattlePoints(); - // ±âº» HP/SP ¼³Á¤ + // �⺻ HP/SP ���� if (iMaxHP != GetMaxHP()) { - SetRealPoint(POINT_MAX_HP, iMaxHP); // ±âº»HP¸¦ RealPoint¿¡ ÀúÀåÇØ ³õ´Â´Ù. + SetRealPoint(POINT_MAX_HP, iMaxHP); // �⺻HP�� RealPoint�� ������ ���´�. } PointChange(POINT_MAX_HP, 0); if (iMaxSP != GetMaxSP()) { - SetRealPoint(POINT_MAX_SP, iMaxSP); // ±âº»SP¸¦ RealPoint¿¡ ÀúÀåÇØ ³õ´Â´Ù. + SetRealPoint(POINT_MAX_SP, iMaxSP); // �⺻SP�� RealPoint�� ������ ���´�. } PointChange(POINT_MAX_SP, 0); @@ -2339,10 +2338,10 @@ void CHARACTER::ComputePoints() } } - // ¿ëÈ¥¼® ½Ã½ºÅÛ - // ComputePoints¿¡¼­´Â Äɸ¯ÅÍÀÇ ¸ðµç ¼Ó¼º°ªÀ» ÃʱâÈ­ÇÏ°í, - // ¾ÆÀÌÅÛ, ¹öÇÁ µî¿¡ °ü·ÃµÈ ¸ðµç ¼Ó¼º°ªÀ» Àç°è»êÇϱ⠶§¹®¿¡, - // ¿ëÈ¥¼® ½Ã½ºÅÛµµ ActiveDeck¿¡ ÀÖ´Â ¸ðµç ¿ëÈ¥¼®ÀÇ ¼Ó¼º°ªÀ» ´Ù½Ã Àû¿ë½ÃÄÑ¾ß ÇÑ´Ù. + // ��ȥ�� �ý��� + // ComputePoints������ �ɸ����� ��� �Ӽ����� �ʱ�ȭ�ϰ�, + // ������, ���� � ���õ� ��� �Ӽ����� �����ϱ� ������, + // ��ȥ�� �ý��۵� ActiveDeck�� �ִ� ��� ��ȥ���� �Ӽ����� �ٽ� ������Ѿ� �Ѵ�. if (DragonSoul_IsDeckActivated()) { for (int i = WEAR_MAX_NUM + DS_SLOT_MAX * DragonSoul_GetActiveDeck(); @@ -2380,9 +2379,9 @@ void CHARACTER::ComputePoints() UpdatePacket(); } -// m_dwPlayStartTimeÀÇ ´ÜÀ§´Â milisecond´Ù. µ¥ÀÌÅͺ£À̽º¿¡´Â ºÐ´ÜÀ§·Î ±â·ÏÇϱâ -// ¶§¹®¿¡ Ç÷¹À̽ð£À» °è»êÇÒ ¶§ / 60000 À¸·Î ³ª´²¼­ Çϴµ¥, ±× ³ª¸ÓÁö °ªÀÌ ³²¾Ò -// À» ¶§ ¿©±â¿¡ dwTimeRemainÀ¸·Î ³Ö¾î¼­ Á¦´ë·Î °è»êµÇµµ·Ï ÇØÁÖ¾î¾ß ÇÑ´Ù. +// m_dwPlayStartTime�� ������ milisecond��. �����ͺ��̽����� ����� ����ϱ� +// ������ �÷��̽ð��� ����� �� / 60000 ���� ������ �ϴµ�, �� ������ ���� ���� +// �� �� ���⿡ dwTimeRemain���� �־ ����� ���ǵ��� ���־�� �Ѵ�. void CHARACTER::ResetPlayTime(DWORD dwTimeRemain) { m_dwPlayStartTime = get_dword_time() - dwTimeRemain; @@ -2395,7 +2394,7 @@ EVENTFUNC(recovery_event) char_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "recovery_event> Null pointer" ); + SPDLOG_ERROR("recovery_event> Null pointer" ); return 0; } @@ -2408,7 +2407,7 @@ EVENTFUNC(recovery_event) if (!ch->IsPC()) { // - // ¸ó½ºÅÍ È¸º¹ + // ���� ȸ�� // if (ch->IsAffectFlag(AFF_POISON)) return PASSES_PER_SEC(std::max(1, ch->GetMobTable().bRegenCycle)); @@ -2466,23 +2465,23 @@ EVENTFUNC(recovery_event) else { // - // PC ȸº¹ + // PC ȸ�� // ch->CheckTarget(); - //ch->UpdateSectree(); // ¿©±â¼­ ÀÌ°É ¿ÖÇÏÁö? + //ch->UpdateSectree(); // ���⼭ �̰� ������? ch->UpdateKillerMode(); if (ch->IsAffectFlag(AFF_POISON) == true) { - // Áßµ¶ÀÎ °æ¿ì ÀÚµ¿È¸º¹ ±ÝÁö - // ÆĹý¼úÀÎ °æ¿ì ÀÚµ¿È¸º¹ ±ÝÁö + // �ߵ��� ��� �ڵ�ȸ�� ���� + // ������ ��� �ڵ�ȸ�� ���� return 3; } int iSec = (get_dword_time() - ch->GetLastMoveTime()) / 3000; - // SP ȸº¹ ·çƾ. - // ¿Ö ÀÌ°É·Î Çؼ­ ÇÔ¼ö·Î »©³ù´Â°¡ ?! + // SP ȸ�� ��ƾ. + // �� �̰ɷ� �ؼ� �Լ��� �����°� ?! ch->DistributeSP(ch); if (ch->GetMaxHP() <= ch->GetHP()) @@ -2498,7 +2497,7 @@ EVENTFUNC(recovery_event) iAmount += (iAmount * ch->GetPoint(POINT_HP_REGEN)) / 100; - sys_log(1, "RECOVERY_EVENT: %s %d HP_REGEN %d HP +%d", ch->GetName(), iPercent, ch->GetPoint(POINT_HP_REGEN), iAmount); + SPDLOG_DEBUG("RECOVERY_EVENT: {} {} HP_REGEN {} HP +{}", ch->GetName(), iPercent, ch->GetPoint(POINT_HP_REGEN), iAmount); ch->PointChange(POINT_HP, iAmount, false); return PASSES_PER_SEC(3); @@ -2513,7 +2512,7 @@ void CHARACTER::StartRecoveryEvent() if (IsDead() || IsStun()) return; - if (IsNPC() && GetHP() >= GetMaxHP()) // ¸ó½ºÅʹ ü·ÂÀÌ ´Ù Â÷ÀÖÀ¸¸é ½ÃÀÛ ¾ÈÇÑ´Ù. + if (IsNPC() && GetHP() >= GetMaxHP()) // ���ʹ� ü���� �� �������� ���� ���Ѵ�. return; char_event_info* info = AllocEventInfo(); @@ -2533,7 +2532,7 @@ void CHARACTER::Standup() SetPosition(POS_STANDING); - sys_log(1, "STANDUP: %s", GetName()); + SPDLOG_DEBUG("STANDUP: {}", GetName()); pack_position.header = HEADER_GC_CHARACTER_POSITION; pack_position.vid = GetVID(); @@ -2550,7 +2549,7 @@ void CHARACTER::Sitdown(int is_ground) return; SetPosition(POS_SITTING); - sys_log(1, "SITDOWN: %s", GetName()); + SPDLOG_DEBUG("SITDOWN: {}", GetName()); pack_position.header = HEADER_GC_CHARACTER_POSITION; pack_position.vid = GetVID(); @@ -2563,7 +2562,7 @@ void CHARACTER::SetRotation(float fRot) m_pointsInstant.fRot = fRot; } -// x, y ¹æÇâÀ¸·Î º¸°í ¼±´Ù. +// x, y �������� ���� ����. void CHARACTER::SetRotationToXY(int x, int y) { SetRotation(GetDegreeFromPositionXY(GetX(), GetY(), x, y)); @@ -2579,10 +2578,10 @@ bool CHARACTER::CanMove() const if (CannotMoveByAffect()) return false; - if (GetMyShop()) // »óÁ¡ ¿¬ »óÅ¿¡¼­´Â ¿òÁ÷ÀÏ ¼ö ¾øÀ½ + if (GetMyShop()) // ���� �� ���¿����� ������ �� ���� return false; - // 0.2ÃÊ ÀüÀ̶ó¸é ¿òÁ÷ÀÏ ¼ö ¾ø´Ù. + // 0.2�� ���̶�� ������ �� ����. /* if (get_float_time() - m_fSyncTime < 0.2f) return false; @@ -2590,7 +2589,7 @@ bool CHARACTER::CanMove() const return true; } -// ¹«Á¶°Ç x, y À§Ä¡·Î À̵¿ ½ÃŲ´Ù. +// ������ x, y ��ġ�� �̵� ��Ų��. bool CHARACTER::Sync(int x, int y) { if (!GetSectree()) @@ -2602,12 +2601,12 @@ bool CHARACTER::Sync(int x, int y) { if (GetDesc()) { - sys_err("cannot find tree at %d %d (name: %s)", x, y, GetName()); + SPDLOG_ERROR("cannot find tree at {} {} (name: {})", x, y, GetName()); GetDesc()->SetPhase(PHASE_CLOSE); } else { - sys_err("no tree: %s %d %d %d", GetName(), x, y, GetMapIndex()); + SPDLOG_ERROR("no tree: {} {} {} {}", GetName(), x, y, GetMapIndex()); Dead(); } @@ -2619,7 +2618,7 @@ bool CHARACTER::Sync(int x, int y) if (GetDungeon()) { - // ´øÁ¯¿ë À̺¥Æ® ¼Ó¼º º¯È­ + // ������ �̺�Ʈ �Ӽ� ��ȭ int iLastEventAttr = m_iEventAttr; m_iEventAttr = new_tree->GetEventAttribute(x, y); @@ -2645,12 +2644,10 @@ bool CHARACTER::Sync(int x, int y) SECTREEID id = new_tree->GetID(); SECTREEID old_id = GetSectree()->GetID(); - sys_log(0, "SECTREE DIFFER: %s %dx%d was %dx%d", - GetName(), - id.coord.x, - id.coord.y, - old_id.coord.x, - old_id.coord.y); + SPDLOG_DEBUG( + "SECTREE DIFFER: {} {}x{} was {}x{}", + GetName(), (int) id.coord.x, (int) id.coord.y, (int) old_id.coord.x, (int) old_id.coord.y + ); } new_tree->InsertEntity(this); @@ -2662,7 +2659,7 @@ bool CHARACTER::Sync(int x, int y) void CHARACTER::Stop() { if (!IsState(m_stateIdle)) - MonsterLog("[IDLE] Á¤Áö"); + MonsterLog("[IDLE] ����"); GotoState(m_stateIdle); @@ -2672,8 +2669,8 @@ void CHARACTER::Stop() bool CHARACTER::Goto(int x, int y) { - // TODO °Å¸®Ã¼Å© ÇÊ¿ä - // °°Àº À§Ä¡¸é À̵¿ÇÒ ÇÊ¿ä ¾øÀ½ (ÀÚµ¿ ¼º°ø) + // TODO �Ÿ�üũ �ʿ� + // ���� ��ġ�� �̵��� �ʿ� ���� (�ڵ� ����) if (GetX() == x && GetY() == y) return false; @@ -2697,7 +2694,7 @@ bool CHARACTER::Goto(int x, int y) if (!IsState(m_stateMove)) { - MonsterLog("[MOVE] %s", GetVictim() ? "´ë»óÃßÀû" : "±×³ÉÀ̵¿"); + MonsterLog("[MOVE] %s", GetVictim() ? "�������" : "�׳��̵�"); if (GetVictim()) { @@ -2773,7 +2770,7 @@ float CHARACTER::GetMoveMotionSpeed() const return -pkMotion->GetAccumVector().y / pkMotion->GetDuration(); else { - sys_err("cannot find motion (name %s race %d mode %d)", GetName(), GetRaceNum(), dwMode); + SPDLOG_ERROR("cannot find motion (name {} race {} mode {})", GetName(), GetRaceNum(), dwMode); return 300.0f; } } @@ -2796,27 +2793,27 @@ void CHARACTER::CalculateMoveDuration() (int) ((fDist / motionSpeed) * 1000.0f)); if (IsNPC()) - sys_log(1, "%s: GOTO: distance %f, spd %u, duration %u, motion speed %f pos %d %d -> %d %d", + SPDLOG_TRACE("{}: GOTO: distance {}, spd {}, duration {}, motion speed {} pos {} {} -> {} {}", GetName(), fDist, GetLimitPoint(POINT_MOV_SPEED), m_dwMoveDuration, motionSpeed, m_posStart.x, m_posStart.y, m_posDest.x, m_posDest.y); m_dwMoveStartTime = get_dword_time(); } -// x y À§Ä¡·Î À̵¿ ÇÑ´Ù. (À̵¿ÇÒ ¼ö ÀÖ´Â °¡ ¾ø´Â °¡¸¦ È®ÀÎ ÇÏ°í Sync ¸Þ¼Òµå·Î ½ÇÁ¦ À̵¿ ÇÑ´Ù) -// ¼­¹ö´Â charÀÇ x, y °ªÀ» ¹Ù·Î ¹Ù²ÙÁö¸¸, -// Ŭ¶ó¿¡¼­´Â ÀÌÀü À§Ä¡¿¡¼­ ¹Ù²Û x, y±îÁö interpolationÇÑ´Ù. -// °È°Å³ª ¶Ù´Â °ÍÀº charÀÇ m_bNowWalking¿¡ ´Þ·ÁÀÖ´Ù. -// Warp¸¦ ÀǵµÇÑ °ÍÀ̶ó¸é Show¸¦ »ç¿ëÇÒ °Í. +// x y ��ġ�� �̵� �Ѵ�. (�̵��� �� �ִ� �� ���� ���� Ȯ�� �ϰ� Sync �޼ҵ�� ���� �̵� �Ѵ�) +// ������ char�� x, y ���� �ٷ� �ٲ�����, +// Ŭ�󿡼��� ���� ��ġ���� �ٲ� x, y���� interpolation�Ѵ�. +// �Ȱų� �ٴ� ���� char�� m_bNowWalking�� �޷��ִ�. +// Warp�� �ǵ��� ���̶�� Show�� ����� ��. bool CHARACTER::Move(int x, int y) { - // °°Àº À§Ä¡¸é À̵¿ÇÒ ÇÊ¿ä ¾øÀ½ (ÀÚµ¿ ¼º°ø) + // ���� ��ġ�� �̵��� �ʿ� ���� (�ڵ� ����) if (GetX() == x && GetY() == y) return true; if (test_server) if (m_bDetailLog) - sys_log(0, "%s position %u %u", GetName(), x, y); + SPDLOG_DEBUG("{} position {} {}", GetName(), x, y); OnMove(); return Sync(x, y); @@ -2883,7 +2880,7 @@ int CHARACTER::GetPoint(BYTE type) const { if (type >= POINT_MAX_NUM) { - sys_err("Point type overflow (type %u)", type); + SPDLOG_ERROR("Point type overflow (type {})", type); return 0; } @@ -2899,7 +2896,7 @@ int CHARACTER::GetPoint(BYTE type) const } if (val > max_val) - sys_err("POINT_ERROR: %s type %d val %d (max: %d)", GetName(), val, max_val); + SPDLOG_ERROR("POINT_ERROR: {} type {} val {} (max: {})", GetName(), val, max_val); return (val); } @@ -2908,7 +2905,7 @@ int CHARACTER::GetLimitPoint(BYTE type) const { if (type >= POINT_MAX_NUM) { - sys_err("Point type overflow (type %u)", type); + SPDLOG_ERROR("Point type overflow (type {})", type); return 0; } @@ -2951,7 +2948,7 @@ int CHARACTER::GetLimitPoint(BYTE type) const } if (val > max_val) - sys_err("POINT_ERROR: %s type %d val %d (max: %d)", GetName(), val, max_val); + SPDLOG_ERROR("POINT_ERROR: {} type {} val {} (max: {})", GetName(), val, max_val); if (val > limit) val = limit; @@ -2966,13 +2963,13 @@ void CHARACTER::SetPoint(BYTE type, int val) { if (type >= POINT_MAX_NUM) { - sys_err("Point type overflow (type %u)", type); + SPDLOG_ERROR("Point type overflow (type {})", type); return; } m_pointsInstant.points[type] = val; - // ¾ÆÁ÷ À̵¿ÀÌ ´Ù ¾È³¡³µ´Ù¸é À̵¿ ½Ã°£ °è»êÀ» ´Ù½Ã ÇØ¾ß ÇÑ´Ù. + // ���� �̵��� �� �ȳ����ٸ� �̵� �ð� ����� �ٽ� �ؾ� �Ѵ�. if (type == POINT_MOV_SPEED && get_dword_time() < m_dwMoveStartTime + m_dwMoveDuration) { CalculateMoveDuration(); @@ -3002,8 +2999,6 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast { int val = 0; - //sys_log(0, "PointChange %d %d | %d -> %d cHP %d mHP %d", type, amount, GetPoint(type), GetPoint(type)+amount, GetHP(), GetMaxHP()); - switch (type) { case POINT_NONE: @@ -3016,7 +3011,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast SetLevel(GetLevel() + amount); val = GetLevel(); - sys_log(0, "LEVELUP: %s %d NEXT EXP %d", GetName(), GetLevel(), GetNextExp()); + SPDLOG_DEBUG("LEVELUP: {} {} NEXT EXP {}", GetName(), GetLevel(), GetNextExp()); PointChange(POINT_NEXT_EXP, GetNextExp(), false); @@ -3040,7 +3035,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_NEXT_EXP: val = GetNextExp(); - bAmount = false; // ¹«Á¶°Ç bAmount´Â false ¿©¾ß ÇÑ´Ù. + bAmount = false; // ������ bAmount�� false ���� �Ѵ�. break; case POINT_EXP: @@ -3048,29 +3043,29 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast DWORD exp = GetExp(); DWORD next_exp = GetNextExp(); - // û¼Ò³âº¸È£ + // û�ҳ⺸ȣ if (LC_IsNewCIBN()) { if (IsOverTime(OT_NONE)) { - dev_log(LOG_DEB0, " %s = NONE", GetName()); + SPDLOG_TRACE(" {} = NONE", GetName()); } else if (IsOverTime(OT_3HOUR)) { amount = (amount / 2); - dev_log(LOG_DEB0, " %s = 3HOUR", GetName()); + SPDLOG_TRACE(" {} = 3HOUR", GetName()); } else if (IsOverTime(OT_5HOUR)) { amount = 0; - dev_log(LOG_DEB0, " %s = 5HOUR", GetName()); + SPDLOG_TRACE(" {} = 5HOUR", GetName()); } } - // exp°¡ 0 ÀÌÇÏ·Î °¡Áö ¾Êµµ·Ï ÇÑ´Ù + // exp�� 0 ���Ϸ� ���� �ʵ��� �Ѵ� if (amount < 0 && exp < -amount) { - sys_log(1, "%s AMOUNT < 0 %d, CUR EXP: %d", GetName(), -amount, exp); + SPDLOG_DEBUG("{} AMOUNT < 0 {}, CUR EXP: {}", GetName(), -amount, exp); amount = -exp; SetExp(exp + amount); @@ -3086,7 +3081,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast DWORD iExpBalance = 0; - // ·¹º§ ¾÷! + // ���� ��! if (exp + amount >= next_exp) { iExpBalance = (exp + amount) - next_exp; @@ -3104,10 +3099,10 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast DWORD q = DWORD(next_exp / 4.0f); int iLevStep = GetRealPoint(POINT_LEVEL_STEP); - // iLevStepÀÌ 4 ÀÌ»óÀÌ¸é ·¹º§ÀÌ ¿Ã¶ú¾î¾ß ÇϹǷΠ¿©±â¿¡ ¿Ã ¼ö ¾ø´Â °ªÀÌ´Ù. + // iLevStep�� 4 �̻��̸� ������ �ö���� �ϹǷ� ���⿡ �� �� ���� ���̴�. if (iLevStep >= 4) { - sys_err("%s LEVEL_STEP bigger than 4! (%d)", GetName(), iLevStep); + SPDLOG_ERROR("{} LEVEL_STEP bigger than 4! ({})", GetName(), iLevStep); iLevStep = 4; } @@ -3244,16 +3239,16 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast if (val == 0) { - // Stamina°¡ ¾øÀ¸´Ï °ÈÀÚ! + // Stamina�� ������ ����! SetNowWalking(true); } else if (prev_val == 0) { - // ¾ø´ø ½ºÅ׹̳ª°¡ »ý°åÀ¸´Ï ÀÌÀü ¸ðµå º¹±Í + // ���� ���׹̳��� �������� ���� ��� ���� ResetWalking(); } - if (amount < 0 && val != 0) // °¨¼Ò´Â º¸³»Áö¾Ê´Â´Ù. + if (amount < 0 && val != 0) // ���Ҵ� �������ʴ´�. return; } break; @@ -3263,7 +3258,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast SetPoint(type, GetPoint(type) + amount); //SetMaxHP(GetMaxHP() + amount); - // ÃÖ´ë »ý¸í·Â = (±âº» ÃÖ´ë »ý¸í·Â + Ãß°¡) * ÃÖ´ë»ý¸í·Â% + // �ִ� ����� = (�⺻ �ִ� ����� + �߰�) * �ִ�����% int hp = GetRealPoint(POINT_MAX_HP); int add_hp = std::min(3500, hp * GetPoint(POINT_MAX_HP_PCT) / 100); add_hp += GetPoint(POINT_MAX_HP); @@ -3280,7 +3275,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast SetPoint(type, GetPoint(type) + amount); //SetMaxSP(GetMaxSP() + amount); - // ÃÖ´ë Á¤½Å·Â = (±âº» ÃÖ´ë Á¤½Å·Â + Ãß°¡) * ÃÖ´ëÁ¤½Å·Â% + // �ִ� ���ŷ� = (�⺻ �ִ� ���ŷ� + �߰�) * �ִ����ŷ�% int sp = GetRealPoint(POINT_MAX_SP); int add_sp = std::min(800, sp * GetPoint(POINT_MAX_SP_PCT) / 100); add_sp += GetPoint(POINT_MAX_SP); @@ -3317,27 +3312,27 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast if (GOLD_MAX <= nTotalMoney) { - sys_err("[OVERFLOW_GOLD] OriGold %d AddedGold %d id %u Name %s ", GetGold(), amount, GetPlayerID(), GetName()); + SPDLOG_ERROR("[OVERFLOW_GOLD] OriGold {} AddedGold {} id {} Name {} ", GetGold(), amount, GetPlayerID(), GetName()); LogManager::instance().CharLog(this, GetGold() + amount, "OVERFLOW_GOLD", ""); return; } - // û¼Ò³âº¸È£ + // û�ҳ⺸ȣ if (LC_IsNewCIBN() && amount > 0) { if (IsOverTime(OT_NONE)) { - dev_log(LOG_DEB0, " %s = NONE", GetName()); + SPDLOG_TRACE(" {} = NONE", GetName()); } else if (IsOverTime(OT_3HOUR)) { amount = (amount / 2); - dev_log(LOG_DEB0, " %s = 3HOUR", GetName()); + SPDLOG_TRACE(" {} = 3HOUR", GetName()); } else if (IsOverTime(OT_5HOUR)) { amount = 0; - dev_log(LOG_DEB0, " %s = 5HOUR", GetName()); + SPDLOG_TRACE(" {} = 5HOUR", GetName()); } } @@ -3385,12 +3380,12 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_HP_RECOVERY: case POINT_SP_RECOVERY: - case POINT_ATTBONUS_HUMAN: // 42 Àΰ£¿¡°Ô °­ÇÔ - case POINT_ATTBONUS_ANIMAL: // 43 µ¿¹°¿¡°Ô µ¥¹ÌÁö % Áõ°¡ - case POINT_ATTBONUS_ORC: // 44 ¿õ±Í¿¡°Ô µ¥¹ÌÁö % Áõ°¡ - case POINT_ATTBONUS_MILGYO: // 45 ¹Ð±³¿¡°Ô µ¥¹ÌÁö % Áõ°¡ - case POINT_ATTBONUS_UNDEAD: // 46 ½Ãü¿¡°Ô µ¥¹ÌÁö % Áõ°¡ - case POINT_ATTBONUS_DEVIL: // 47 ¸¶±Í(¾Ç¸¶)¿¡°Ô µ¥¹ÌÁö % Áõ°¡ + case POINT_ATTBONUS_HUMAN: // 42 ����� ���� + case POINT_ATTBONUS_ANIMAL: // 43 �������� ������ % ���� + case POINT_ATTBONUS_ORC: // 44 ���Ϳ��� ������ % ���� + case POINT_ATTBONUS_MILGYO: // 45 ����� ������ % ���� + case POINT_ATTBONUS_UNDEAD: // 46 ��ü���� ������ % ���� + case POINT_ATTBONUS_DEVIL: // 47 ����(�Ǹ�)���� ������ % ���� case POINT_ATTBONUS_MONSTER: case POINT_ATTBONUS_SURA: @@ -3411,11 +3406,11 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_RESIST_PENETRATE: case POINT_CURSE_PCT: - case POINT_STEAL_HP: // 48 »ý¸í·Â Èí¼ö - case POINT_STEAL_SP: // 49 Á¤½Å·Â Èí¼ö + case POINT_STEAL_HP: // 48 ����� ��� + case POINT_STEAL_SP: // 49 ���ŷ� ��� - case POINT_MANA_BURN_PCT: // 50 ¸¶³ª ¹ø - case POINT_DAMAGE_SP_RECOVER: // 51 °ø°Ý´çÇÒ ½Ã Á¤½Å·Â ȸº¹ È®·ü + case POINT_MANA_BURN_PCT: // 50 ���� �� + case POINT_DAMAGE_SP_RECOVER: // 51 ���ݴ��� �� ���ŷ� ȸ�� Ȯ�� case POINT_RESIST_NORMAL_DAMAGE: case POINT_RESIST_SWORD: case POINT_RESIST_TWOHAND: @@ -3430,10 +3425,10 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_RESIST_ICE: case POINT_RESIST_EARTH: case POINT_RESIST_DARK: - case POINT_REFLECT_MELEE: // 67 °ø°Ý ¹Ý»ç - case POINT_REFLECT_CURSE: // 68 ÀúÁÖ ¹Ý»ç - case POINT_POISON_REDUCE: // 69 µ¶µ¥¹ÌÁö °¨¼Ò - case POINT_KILL_SP_RECOVER: // 70 Àû ¼Ò¸ê½Ã MP ȸº¹ + case POINT_REFLECT_MELEE: // 67 ���� �ݻ� + case POINT_REFLECT_CURSE: // 68 ���� �ݻ� + case POINT_POISON_REDUCE: // 69 �������� ���� + case POINT_KILL_SP_RECOVER: // 70 �� �Ҹ�� MP ȸ�� case POINT_KILL_HP_RECOVERY: // 75 case POINT_HIT_HP_RECOVERY: case POINT_HIT_SP_RECOVERY: @@ -3475,7 +3470,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_MELEE_MAGIC_ATT_BONUS_PER: if (GetPoint(type) + amount > 100) { - sys_err("MALL_BONUS exceeded over 100!! point type: %d name: %s amount %d", type, GetName(), amount); + SPDLOG_ERROR("MALL_BONUS exceeded over 100!! point type: {} name: {} amount {}", type, GetName(), amount); amount = 100 - GetPoint(type); } @@ -3498,7 +3493,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_POTION_BONUS: // 74 if (GetPoint(type) + amount > 100) { - sys_err("BONUS exceeded over 100!! point type: %d name: %s amount %d", type, GetName(), amount); + SPDLOG_ERROR("BONUS exceeded over 100!! point type: {} name: {} amount {}", type, GetName(), amount); amount = 100 - GetPoint(type); } @@ -3571,7 +3566,6 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast case POINT_VOICE: case POINT_EMPIRE_POINT: - //sys_err("CHARACTER::PointChange: %s: point cannot be changed. use SetPoint instead (type: %d)", GetName(), type); val = GetRealPoint(type); break; @@ -3598,7 +3592,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast break; default: - sys_err("CHARACTER::PointChange: %s: unknown point change type %d", GetName(), type); + SPDLOG_ERROR("CHARACTER::PointChange: {}: unknown point change type {}", GetName(), type); return; } @@ -3662,7 +3656,7 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal) case APPLY_SKILL: // SKILL_DAMAGE_BONUS { - // ÃÖ»óÀ§ ºñÆ® ±âÁØÀ¸·Î 8ºñÆ® vnum, 9ºñÆ® add, 15ºñÆ® change + // �ֻ��� ��Ʈ �������� 8��Ʈ vnum, 9��Ʈ add, 15��Ʈ change // 00000000 00000000 00000000 00000000 // ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ // vnum ^ add change @@ -3670,7 +3664,7 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal) int iAdd = iVal & 0x00800000; int iChange = iVal & 0x007fffff; - sys_log(1, "APPLY_SKILL skill %d add? %d change %d", bSkillVnum, iAdd ? 1 : 0, iChange); + SPDLOG_DEBUG("APPLY_SKILL skill {} add? {} change {}", bSkillVnum, iAdd ? 1 : 0, iChange); if (0 == iAdd) iChange = -iChange; @@ -3772,16 +3766,16 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal) case APPLY_RESIST_ASSASSIN : case APPLY_RESIST_SURA : case APPLY_RESIST_SHAMAN : - case APPLY_ENERGY: // 82 ±â·Â - case APPLY_DEF_GRADE: // 83 ¹æ¾î·Â. DEF_GRADE_BONUS´Â Ŭ¶ó¿¡¼­ µÎ¹è·Î º¸¿©Áö´Â ÀǵµµÈ ¹ö±×(...)°¡ ÀÖ´Ù. - case APPLY_COSTUME_ATTR_BONUS: // 84 ÄÚ½ºÆ¬ ¾ÆÀÌÅÛ¿¡ ºÙÀº ¼Ó¼ºÄ¡ º¸³Ê½º - case APPLY_MAGIC_ATTBONUS_PER: // 85 ¸¶¹ý °ø°Ý·Â +x% - case APPLY_MELEE_MAGIC_ATTBONUS_PER: // 86 ¸¶¹ý + ¹Ð¸® °ø°Ý·Â +x% + case APPLY_ENERGY: // 82 ��� + case APPLY_DEF_GRADE: // 83 ����. DEF_GRADE_BONUS�� Ŭ�󿡼� �� �������� �ǵ��� ����(...)�� �ִ�. + case APPLY_COSTUME_ATTR_BONUS: // 84 �ڽ�Ƭ �����ۿ� ���� �Ӽ�ġ ���ʽ� + case APPLY_MAGIC_ATTBONUS_PER: // 85 ���� ���ݷ� +x% + case APPLY_MELEE_MAGIC_ATTBONUS_PER: // 86 ���� + �и� ���ݷ� +x% PointChange(aApplyInfo[bApplyType].bPointType, iVal); break; default: - sys_err("Unknown apply type %d name %s", bApplyType, GetName()); + SPDLOG_ERROR("Unknown apply type {} name {}", bApplyType, GetName()); break; } } @@ -3810,7 +3804,7 @@ EVENTFUNC(save_event) char_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "save_event> Null pointer" ); + SPDLOG_ERROR("save_event> Null pointer" ); return 0; } @@ -3819,7 +3813,7 @@ EVENTFUNC(save_event) if (ch == NULL) { // return 0; } - sys_log(1, "SAVE_EVENT: %s", ch->GetName()); + SPDLOG_DEBUG("SAVE_EVENT: {}", ch->GetName()); ch->Save(); ch->FlushDelayedSaveItem(); return (save_event_second_cycle); @@ -3861,7 +3855,7 @@ void CHARACTER::MonsterLog(const char* format, ...) else len += len2; - // \0 ¹®ÀÚ Æ÷ÇÔ + // \0 ���� ���� ++len; va_end(args); @@ -3910,7 +3904,7 @@ void CHARACTER::ChatPacket(BYTE type, const char * format, ...) d->Packet(buf.read_peek(), buf.size()); if (type == CHAT_TYPE_COMMAND && test_server) - sys_log(0, "SEND_COMMAND %s %s", GetName(), chatbuf); + SPDLOG_TRACE("SEND_COMMAND {} {}", GetName(), chatbuf); } // MINING @@ -3923,9 +3917,9 @@ void CHARACTER::mining_cancel() { if (m_pkMiningEvent) { - sys_log(0, "XXX MINING CANCEL"); + SPDLOG_DEBUG("XXX MINING CANCEL"); event_cancel(&m_pkMiningEvent); - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("䱤À» Áß´ÜÇÏ¿´½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��� �ߴ��Ͽ����ϴ�.")); } } @@ -3947,13 +3941,13 @@ void CHARACTER::mining(LPCHARACTER chLoad) if (!pick || pick->GetType() != ITEM_PICK) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°î±ªÀ̸¦ ÀåÂøÇϼ¼¿ä.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��̸� �����ϼ���.")); return; } - int count = Random::get(5, 15); // µ¿ÀÛ È½¼ö, ÇÑ µ¿ÀÛ´ç 2ÃÊ + int count = Random::get(5, 15); // ���� Ƚ��, �� ���۴� 2�� - // 䱤 µ¿ÀÛÀ» º¸¿©ÁÜ + // � ������ ������ TPacketGCDigMotion p; p.header = HEADER_GC_DIG_MOTION; p.vid = GetVID(); @@ -3974,7 +3968,7 @@ void CHARACTER::fishing() return; } - // ¸ø°¨ ¼Ó¼º¿¡¼­ ³¬½Ã¸¦ ½ÃµµÇÑ´Ù? + // ���� �Ӽ����� ���ø� �õ��Ѵ�? { LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(GetMapIndex()); @@ -3986,23 +3980,23 @@ void CHARACTER::fishing() if (IS_SET(dwAttr, ATTR_BLOCK)) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã¸¦ ÇÒ ¼ö ÀÖ´Â °÷ÀÌ ¾Æ´Õ´Ï´Ù")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ø� �� �� �ִ� ���� �ƴմϴ�")); return; } } LPITEM rod = GetWear(WEAR_WEAPON); - // ³¬½Ã´ë ÀåÂø + // ���ô� ���� if (!rod || rod->GetType() != ITEM_ROD) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã´ë¸¦ ÀåÂø Çϼ¼¿ä.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ô븦 ���� �ϼ���.")); return; } if (0 == rod->GetSocket(2)) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹Ì³¢¸¦ ³¢°í ´øÁ® ÁÖ¼¼¿ä.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�̳��� ���� ���� �ּ���.")); return; } @@ -4028,7 +4022,7 @@ void CHARACTER::fishing_take() } else { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã´ë°¡ ¾Æ´Ñ ¹°°ÇÀ¸·Î ³¬½Ã¸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù!")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("���ô밡 �ƴ� �������� ���ø� �� �� �����ϴ�!")); } event_cancel(&m_pkFishingEvent); @@ -4068,11 +4062,11 @@ void CHARACTER::SetNextStatePulse(int iNextPulse) m_dwNextStatePulse = iNextPulse; if (iNextPulse < 10) - MonsterLog("´ÙÀ½»óÅ·ξ°¡ÀÚ"); + MonsterLog("�������·ξ����"); } -// ij¸¯ÅÍ ÀνºÅϽº ¾÷µ¥ÀÌÆ® ÇÔ¼ö. +// ij���� �ν��Ͻ� ������Ʈ �Լ�. void CHARACTER::UpdateCharacter(DWORD dwPulse) { CFSM::Update(); @@ -4111,7 +4105,7 @@ WORD CHARACTER::GetOriginalPart(BYTE bPartPos) const switch (bPartPos) { case PART_MAIN: - if (!IsPC()) // PC°¡ ¾Æ´Ñ °æ¿ì ÇöÀç ÆÄÆ®¸¦ ±×´ë·Î ¸®ÅÏ + if (!IsPC()) // PC�� �ƴ� ��� ���� ��Ʈ�� �״�� ���� return GetPart(PART_MAIN); else return m_pointsInstant.bBasePart; @@ -4138,7 +4132,7 @@ bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList) if (ch == this) { - sys_err("SetSyncOwner owner == this (%p)", this); + SPDLOG_ERROR("SetSyncOwner owner == this ({})", (void*) this); return false; } @@ -4150,9 +4144,9 @@ bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList) } if (m_pkChrSyncOwner) - sys_log(1, "SyncRelease %s %p from %s", GetName(), this, m_pkChrSyncOwner->GetName()); + SPDLOG_DEBUG("SyncRelease {} {} from {}", GetName(), (void*) this, m_pkChrSyncOwner->GetName()); - // ¸®½ºÆ®¿¡¼­ Á¦°ÅÇÏÁö ¾Ê´õ¶óµµ Æ÷ÀÎÅÍ´Â NULL·Î ¼ÂÆõǾî¾ß ÇÑ´Ù. + // ����Ʈ���� �������� �ʴ��� �����ʹ� NULL�� ���õǾ�� �Ѵ�. m_pkChrSyncOwner = NULL; } else @@ -4160,12 +4154,12 @@ bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList) if (!IsSyncOwner(ch)) return false; - // °Å¸®°¡ 200 ÀÌ»óÀ̸é SyncOwner°¡ µÉ ¼ö ¾ø´Ù. + // �Ÿ��� 200 �̻��̸� SyncOwner�� �� �� ����. if (DISTANCE_APPROX(GetX() - ch->GetX(), GetY() - ch->GetY()) > 250) { - sys_log(1, "SetSyncOwner distance over than 250 %s %s", GetName(), ch->GetName()); + SPDLOG_DEBUG("SetSyncOwner distance over than 250 {} {}", GetName(), ch->GetName()); - // SyncOwnerÀÏ °æ¿ì Owner·Î Ç¥½ÃÇÑ´Ù. + // SyncOwner�� ��� Owner�� ǥ���Ѵ�. if (m_pkChrSyncOwner == ch) return true; @@ -4176,26 +4170,26 @@ bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList) { if (m_pkChrSyncOwner) { - sys_log(1, "SyncRelease %s %p from %s", GetName(), this, m_pkChrSyncOwner->GetName()); + SPDLOG_DEBUG("SyncRelease {} {} from {}", GetName(), (void*) this, m_pkChrSyncOwner->GetName()); m_pkChrSyncOwner->m_kLst_pkChrSyncOwned.remove(this); } m_pkChrSyncOwner = ch; m_pkChrSyncOwner->m_kLst_pkChrSyncOwned.push_back(this); - // SyncOwner°¡ ¹Ù²î¸é LastSyncTimeÀ» ÃʱâÈ­ÇÑ´Ù. + // SyncOwner�� �ٲ�� LastSyncTime�� �ʱ�ȭ�Ѵ�. static const timeval zero_tv = {0, 0}; SetLastSyncTime(zero_tv); - sys_log(1, "SetSyncOwner set %s %p to %s", GetName(), this, ch->GetName()); + SPDLOG_DEBUG("SetSyncOwner set {} {} to {}", GetName(), (void*) this, ch->GetName()); } m_fSyncTime = get_float_time(); } - // TODO: Sync Owner°¡ °°´õ¶óµµ °è¼Ó ÆÐŶÀ» º¸³»°í ÀÖÀ¸¹Ç·Î, - // µ¿±âÈ­ µÈ ½Ã°£ÀÌ 3ÃÊ ÀÌ»ó Áö³µÀ» ¶§ Ç®¾îÁÖ´Â ÆÐŶÀ» - // º¸³»´Â ¹æ½ÄÀ¸·Î Çϸé ÆÐŶÀ» ÁÙÀÏ ¼ö ÀÖ´Ù. + // TODO: Sync Owner�� ������ ��� ��Ŷ�� ������ �����Ƿ�, + // ����ȭ �� �� 3�� �̻� ������ �� Ǯ���ִ� ��Ŷ�� + // ������ ������� �ϸ� ��Ŷ�� ���� �� �ִ�. TPacketGCOwnership pack; pack.bHeader = HEADER_GC_OWNERSHIP; @@ -4211,7 +4205,7 @@ struct FuncClearSync void operator () (LPCHARACTER ch) { assert(ch != NULL); - ch->SetSyncOwner(NULL, false); // false Ç÷¡±×·Î ÇØ¾ß for_each °¡ Á¦´ë·Î µ·´Ù. + ch->SetSyncOwner(NULL, false); // false �÷��׷� �ؾ� for_each �� ����� ����. } }; @@ -4219,7 +4213,7 @@ void CHARACTER::ClearSync() { SetSyncOwner(NULL); - // ¾Æ·¡ for_each¿¡¼­ ³ª¸¦ m_pkChrSyncOwner·Î °¡Áø ÀÚµéÀÇ Æ÷ÀÎÅ͸¦ NULL·Î ÇÑ´Ù. + // �Ʒ� for_each���� ���� m_pkChrSyncOwner�� ���� �ڵ��� �����͸� NULL�� �Ѵ�. std::for_each(m_kLst_pkChrSyncOwned.begin(), m_kLst_pkChrSyncOwned.end(), FuncClearSync()); m_kLst_pkChrSyncOwned.clear(); } @@ -4229,8 +4223,8 @@ bool CHARACTER::IsSyncOwner(LPCHARACTER ch) const if (m_pkChrSyncOwner == ch) return true; - // ¸¶Áö¸·À¸·Î µ¿±âÈ­ µÈ ½Ã°£ÀÌ 3ÃÊ ÀÌ»ó Áö³µ´Ù¸é ¼ÒÀ¯±ÇÀÌ ¾Æ¹«¿¡°Ôµµ - // ¾ø´Ù. µû¶ó¼­ ¾Æ¹«³ª SyncOwnerÀ̹ǷΠtrue ¸®ÅÏ + // ���������� ����ȭ �� �� 3�� �̻� �����ٸ� �������� �ƹ����Ե� + // ����. ���� �ƹ��� SyncOwner�̹Ƿ� true ���� if (get_float_time() - m_fSyncTime >= 3.0f) return true; @@ -4243,9 +4237,9 @@ void CHARACTER::SetParty(LPPARTY pkParty) return; if (pkParty && m_pkParty) - sys_err("%s is trying to reassigning party (current %p, new party %p)", GetName(), get_pointer(m_pkParty), get_pointer(pkParty)); + SPDLOG_ERROR("{} is trying to reassigning party (current {}, new party {})", GetName(), (void*) get_pointer(m_pkParty), (void*) get_pointer(pkParty)); - sys_log(1, "PARTY set to %p", get_pointer(pkParty)); + SPDLOG_TRACE("PARTY set to {}", (void*) get_pointer(pkParty)); //if (m_pkDungeon && IsPC()) //SetDungeon(NULL); @@ -4263,11 +4257,11 @@ void CHARACTER::SetParty(LPPARTY pkParty) } // PARTY_JOIN_BUG_FIX -/// ÆÄƼ °¡ÀÔ event Á¤º¸ +/// ��Ƽ ���� event ���� EVENTINFO(TPartyJoinEventInfo) { - DWORD dwGuestPID; ///< ÆÄƼ¿¡ Âü¿©ÇÒ Ä³¸¯ÅÍÀÇ PID - DWORD dwLeaderPID; ///< ÆÄƼ ¸®´õÀÇ PID + DWORD dwGuestPID; ///< ��Ƽ�� ������ ij������ PID + DWORD dwLeaderPID; ///< ��Ƽ ������ PID TPartyJoinEventInfo() : dwGuestPID( 0 ) @@ -4282,7 +4276,7 @@ EVENTFUNC(party_request_event) if ( info == NULL ) { - sys_err( "party_request_event> Null pointer" ); + SPDLOG_ERROR("party_request_event> Null pointer" ); return 0; } @@ -4290,7 +4284,7 @@ EVENTFUNC(party_request_event) if (ch) { - sys_log(0, "PartyRequestEvent %s", ch->GetName()); + SPDLOG_DEBUG("PartyRequestEvent {}", ch->GetName()); ch->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequestDenied"); ch->SetPartyRequestEvent(NULL); } @@ -4305,7 +4299,7 @@ bool CHARACTER::RequestToParty(LPCHARACTER leader) if (!leader) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÆÄƼÀåÀÌ Á¢¼Ó »óÅ°¡ ¾Æ´Ï¶ó¼­ ¿äûÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("��Ƽ���� ���� ���°� �ƴ϶� ��û�� �� �� �����ϴ�.")); return false; } @@ -4326,42 +4320,42 @@ bool CHARACTER::RequestToParty(LPCHARACTER leader) break; case PERR_SERVER: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼­¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ������ ��Ƽ ���� �� �� �� �����ϴ�.")); return false; case PERR_DIFFEMPIRE: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´Ù¸¥ Á¦±¹°ú ÆÄƼ¸¦ ÀÌ·ê ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �ٸ� ������ ��Ƽ�� �̷� �� �����ϴ�.")); return false; case PERR_DUNGEON: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼­´Â ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� �ȿ����� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); return false; case PERR_OBSERVER: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ��忡�� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); return false; case PERR_LVBOUNDARY: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> -30 ~ +30 ���� �̳��� ���游 �ʴ��� �� �ֽ��ϴ�.")); return false; case PERR_LOWLEVEL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� �ְ� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); return false; case PERR_HILEVEL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� ���� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); return false; case PERR_ALREADYJOIN: return false; case PERR_PARTYISFULL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �� �̻� ��Ƽ���� �ʴ��� �� �����ϴ�.")); return false; default: - sys_err("Do not process party join error(%d)", errcode); + SPDLOG_ERROR("Do not process party join error({})", (int) errcode); return false; } @@ -4373,13 +4367,13 @@ bool CHARACTER::RequestToParty(LPCHARACTER leader) SetPartyRequestEvent(event_create(party_request_event, info, PASSES_PER_SEC(10))); leader->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequest %u", (DWORD) GetVID()); - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ´Ô¿¡°Ô ÆÄƼ°¡ÀÔ ½ÅûÀ» Çß½À´Ï´Ù."), leader->GetName()); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s �Կ��� ��Ƽ���� ��û�� �߽��ϴ�."), leader->GetName()); return true; } void CHARACTER::DenyToParty(LPCHARACTER member) { - sys_log(1, "DenyToParty %s member %s %p", GetName(), member->GetName(), get_pointer(member->m_pkPartyRequestEvent)); + SPDLOG_DEBUG("DenyToParty {} member {} {}", GetName(), member->GetName(), (void*) get_pointer(member->m_pkPartyRequestEvent)); if (!member->m_pkPartyRequestEvent) return; @@ -4388,7 +4382,7 @@ void CHARACTER::DenyToParty(LPCHARACTER member) if (!info) { - sys_err( "CHARACTER::DenyToParty> Null pointer" ); + SPDLOG_ERROR("CHARACTER::DenyToParty> Null pointer" ); return; } @@ -4405,7 +4399,7 @@ void CHARACTER::DenyToParty(LPCHARACTER member) void CHARACTER::AcceptToParty(LPCHARACTER member) { - sys_log(1, "AcceptToParty %s member %s %p", GetName(), member->GetName(), get_pointer(member->m_pkPartyRequestEvent)); + SPDLOG_DEBUG("AcceptToParty {} member {} {}", GetName(), member->GetName(), (void*) get_pointer(member->m_pkPartyRequestEvent)); if (!member->m_pkPartyRequestEvent) return; @@ -4414,7 +4408,7 @@ void CHARACTER::AcceptToParty(LPCHARACTER member) if (!info) { - sys_err( "CHARACTER::AcceptToParty> Null pointer" ); + SPDLOG_ERROR("CHARACTER::AcceptToParty> Null pointer" ); return; } @@ -4427,7 +4421,7 @@ void CHARACTER::AcceptToParty(LPCHARACTER member) event_cancel(&member->m_pkPartyRequestEvent); if (!GetParty()) - member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÆÄƼ¿¡ ¼ÓÇØÀÖÁö ¾Ê½À´Ï´Ù.")); + member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ��Ƽ�� �������� �ʽ��ϴ�.")); else { if (GetPlayerID() != GetParty()->GetLeaderPID()) @@ -4437,19 +4431,19 @@ void CHARACTER::AcceptToParty(LPCHARACTER member) switch (errcode) { case PERR_NONE: member->PartyJoin(this); return; - case PERR_SERVER: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼­¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.")); break; - case PERR_DUNGEON: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼­´Â ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); break; - case PERR_OBSERVER: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); break; - case PERR_LVBOUNDARY: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); break; - case PERR_LOWLEVEL: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); break; - case PERR_HILEVEL: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); break; + case PERR_SERVER: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ������ ��Ƽ ���� �� �� �� �����ϴ�.")); break; + case PERR_DUNGEON: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� �ȿ����� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); break; + case PERR_OBSERVER: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ��忡�� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); break; + case PERR_LVBOUNDARY: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> -30 ~ +30 ���� �̳��� ���游 �ʴ��� �� �ֽ��ϴ�.")); break; + case PERR_LOWLEVEL: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� �ְ� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); break; + case PERR_HILEVEL: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� ���� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); break; case PERR_ALREADYJOIN: break; case PERR_PARTYISFULL: { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); - member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼÀÇ ÀοøÁ¦ÇÑÀÌ ÃÊ°úÇÏ¿© ÆÄƼ¿¡ Âü°¡ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �� �̻� ��Ƽ���� �ʴ��� �� �����ϴ�.")); + member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� ������� �ʰ��Ͽ� ��Ƽ�� ������ �� �����ϴ�.")); break; } - default: sys_err("Do not process party join error(%d)", errcode); + default: SPDLOG_ERROR("Do not process party join error({})", (int) errcode); } } @@ -4457,8 +4451,8 @@ void CHARACTER::AcceptToParty(LPCHARACTER member) } /** - * ÆÄƼ ÃÊ´ë event callback ÇÔ¼ö. - * event °¡ ¹ßµ¿Çϸé ÃÊ´ë °ÅÀý·Î ó¸®ÇÑ´Ù. + * ��Ƽ �ʴ� event callback �Լ�. + * event �� �ߵ��ϸ� �ʴ� ������ ó���Ѵ�. */ EVENTFUNC(party_invite_event) { @@ -4466,7 +4460,7 @@ EVENTFUNC(party_invite_event) if ( pInfo == NULL ) { - sys_err( "party_invite_event> Null pointer" ); + SPDLOG_ERROR("party_invite_event> Null pointer" ); return 0; } @@ -4474,7 +4468,7 @@ EVENTFUNC(party_invite_event) if (pchInviter) { - sys_log(1, "PartyInviteEvent %s", pchInviter->GetName()); + SPDLOG_DEBUG("PartyInviteEvent {}", pchInviter->GetName()); pchInviter->PartyInviteDeny(pInfo->dwGuestPID); } @@ -4485,12 +4479,12 @@ void CHARACTER::PartyInvite(LPCHARACTER pchInvitee) { if (GetParty() && GetParty()->GetLeaderPID() != GetPlayerID()) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ÀÖ´Â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ���� �ʴ��� �� �ִ� ������ �����ϴ�.")); return; } else if (pchInvitee->IsBlockMode(BLOCK_PARTY_INVITE)) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s ´ÔÀÌ ÆÄƼ °ÅºÎ »óÅÂÀÔ´Ï´Ù."), pchInvitee->GetName()); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> %s ���� ��Ƽ �ź� �����Դϴ�."), pchInvitee->GetName()); return; } @@ -4502,43 +4496,43 @@ void CHARACTER::PartyInvite(LPCHARACTER pchInvitee) break; case PERR_SERVER: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼­¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ������ ��Ƽ ���� �� �� �� �����ϴ�.")); return; case PERR_DIFFEMPIRE: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´Ù¸¥ Á¦±¹°ú ÆÄƼ¸¦ ÀÌ·ê ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �ٸ� ������ ��Ƽ�� �̷� �� �����ϴ�.")); return; case PERR_DUNGEON: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼­´Â ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� �ȿ����� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); return; case PERR_OBSERVER: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ��忡�� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); return; case PERR_LVBOUNDARY: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> -30 ~ +30 ���� �̳��� ���游 �ʴ��� �� �ֽ��ϴ�.")); return; case PERR_LOWLEVEL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� �ְ� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); return; case PERR_HILEVEL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� ���� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); return; case PERR_ALREADYJOIN: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÀÌ¹Ì %s´ÔÀº ÆÄƼ¿¡ ¼ÓÇØ ÀÖ½À´Ï´Ù."), pchInvitee->GetName()); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �̹� %s���� ��Ƽ�� ���� �ֽ��ϴ�."), pchInvitee->GetName()); return; case PERR_PARTYISFULL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �� �̻� ��Ƽ���� �ʴ��� �� �����ϴ�.")); return; default: - sys_err("Do not process party join error(%d)", errcode); + SPDLOG_ERROR("Do not process party join error({})", (int) errcode); return; } @@ -4546,7 +4540,7 @@ void CHARACTER::PartyInvite(LPCHARACTER pchInvitee) return; // - // EventMap ¿¡ À̺¥Æ® Ãß°¡ + // EventMap �� �̺�Ʈ �߰� // TPartyJoinEventInfo* info = AllocEventInfo(); @@ -4556,7 +4550,7 @@ void CHARACTER::PartyInvite(LPCHARACTER pchInvitee) m_PartyInviteEventMap.insert(EventMap::value_type(pchInvitee->GetPlayerID(), event_create(party_invite_event, info, PASSES_PER_SEC(10)))); // - // ÃÊ´ë ¹Þ´Â character ¿¡°Ô ÃÊ´ë ÆÐŶ Àü¼Û + // �ʴ� �޴� character ���� �ʴ� ��Ŷ ���� // TPacketGCPartyInvite p; @@ -4571,7 +4565,7 @@ void CHARACTER::PartyInviteAccept(LPCHARACTER pchInvitee) if (itFind == m_PartyInviteEventMap.end()) { - sys_log(1, "PartyInviteAccept from not invited character(%s)", pchInvitee->GetName()); + SPDLOG_DEBUG("PartyInviteAccept from not invited character({})", pchInvitee->GetName()); return; } @@ -4580,7 +4574,7 @@ void CHARACTER::PartyInviteAccept(LPCHARACTER pchInvitee) if (GetParty() && GetParty()->GetLeaderPID() != GetPlayerID()) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ÀÖ´Â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ���� �ʴ��� �� �ִ� ������ �����ϴ�.")); return; } @@ -4592,45 +4586,45 @@ void CHARACTER::PartyInviteAccept(LPCHARACTER pchInvitee) break; case PERR_SERVER: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼­¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ������ ��Ƽ ���� �� �� �� �����ϴ�.")); return; case PERR_DUNGEON: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼­´Â ÆÄƼ ÃÊ´ë¿¡ ÀÀÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� �ȿ����� ��Ƽ �ʴ뿡 ���� �� �����ϴ�.")); return; case PERR_OBSERVER: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ���� ��忡�� ��Ƽ �ʴ븦 �� �� �����ϴ�.")); return; case PERR_LVBOUNDARY: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> -30 ~ +30 ���� �̳��� ���游 �ʴ��� �� �ֽ��ϴ�.")); return; case PERR_LOWLEVEL: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� �ְ� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); return; case PERR_HILEVEL: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� ���� ���� ���� 30������ ���� �ʴ��� �� �����ϴ�.")); return; case PERR_ALREADYJOIN: - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ ÃÊ´ë¿¡ ÀÀÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ �ʴ뿡 ���� �� �����ϴ�.")); return; case PERR_PARTYISFULL: - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); - pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼÀÇ ÀοøÁ¦ÇÑÀÌ ÃÊ°úÇÏ¿© ÆÄƼ¿¡ Âü°¡ÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> �� �̻� ��Ƽ���� �ʴ��� �� �����ϴ�.")); + pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> ��Ƽ�� ������� �ʰ��Ͽ� ��Ƽ�� ������ �� �����ϴ�.")); return; default: - sys_err("ignore party join error(%d)", errcode); + SPDLOG_ERROR("ignore party join error({})", (int) errcode); return; } // - // ÆÄƼ °¡ÀÔ Ã³¸® + // ��Ƽ ���� ó�� // if (GetParty()) @@ -4651,7 +4645,7 @@ void CHARACTER::PartyInviteDeny(DWORD dwPID) if (itFind == m_PartyInviteEventMap.end()) { - sys_log(1, "PartyInviteDeny to not exist event(inviter PID: %d, invitee PID: %d)", GetPlayerID(), dwPID); + SPDLOG_DEBUG("PartyInviteDeny to not exist event(inviter PID: {}, invitee PID: {})", GetPlayerID(), dwPID); return; } @@ -4660,13 +4654,13 @@ void CHARACTER::PartyInviteDeny(DWORD dwPID) LPCHARACTER pchInvitee = CHARACTER_MANAGER::instance().FindByPID(dwPID); if (pchInvitee) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s´ÔÀÌ ÆÄƼ Ãʴ븦 °ÅÀýÇϼ̽À´Ï´Ù."), pchInvitee->GetName()); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> %s���� ��Ƽ �ʴ븦 �����ϼ̽��ϴ�."), pchInvitee->GetName()); } void CHARACTER::PartyJoin(LPCHARACTER pLeader) { - pLeader->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s´ÔÀÌ ÆÄƼ¿¡ Âü°¡Çϼ̽À´Ï´Ù."), GetName()); - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s´ÔÀÇ ÆÄƼ¿¡ Âü°¡Çϼ̽À´Ï´Ù."), pLeader->GetName()); + pLeader->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> %s���� ��Ƽ�� �����ϼ̽��ϴ�."), GetName()); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<��Ƽ> %s���� ��Ƽ�� �����ϼ̽��ϴ�."), pLeader->GetName()); pLeader->GetParty()->Join(GetPlayerID()); pLeader->GetParty()->Link(this); @@ -4721,7 +4715,7 @@ CHARACTER::PartyJoinErrCode CHARACTER::IsPartyJoinableMutableCondition(const LPC void CHARACTER::SetDungeon(LPDUNGEON pkDungeon) { if (pkDungeon && m_pkDungeon) - sys_err("%s is trying to reassigning dungeon (current %p, new party %p)", GetName(), get_pointer(m_pkDungeon), get_pointer(pkDungeon)); + SPDLOG_ERROR("{} is trying to reassigning dungeon (current {}, new party {})", GetName(), (void*) get_pointer(m_pkDungeon), (void*) get_pointer(pkDungeon)); if (m_pkDungeon == pkDungeon) { return; @@ -4746,7 +4740,7 @@ void CHARACTER::SetDungeon(LPDUNGEON pkDungeon) if (pkDungeon) { - sys_log(0, "%s DUNGEON set to %p, PARTY is %p", GetName(), get_pointer(pkDungeon), get_pointer(m_pkParty)); + SPDLOG_DEBUG("{} DUNGEON set to {}, PARTY is {}", GetName(), (void*) get_pointer(pkDungeon), (void*) get_pointer(m_pkParty)); if (IsPC()) { @@ -4836,65 +4830,65 @@ void CHARACTER::OnClick(LPCHARACTER pkChrCauser) { if (!pkChrCauser) { - sys_err("OnClick %s by NULL", GetName()); + SPDLOG_ERROR("OnClick {} by NULL", GetName()); return; } DWORD vid = GetVID(); - sys_log(0, "OnClick %s[vnum %d ServerUniqueID %d, pid %d] by %s", GetName(), GetRaceNum(), vid, GetPlayerID(), pkChrCauser->GetName()); + SPDLOG_DEBUG("OnClick {}[vnum {} ServerUniqueID {}, pid {}] by {}", GetName(), GetRaceNum(), vid, GetPlayerID(), pkChrCauser->GetName()); - // »óÁ¡À» ¿¬»óÅ·ΠÄù½ºÆ®¸¦ ÁøÇàÇÒ ¼ö ¾ø´Ù. + // ������ �����·� ����Ʈ�� ������ �� ����. { - // ´Ü, ÀÚ½ÅÀº ÀÚ½ÅÀÇ »óÁ¡À» Ŭ¸¯ÇÒ ¼ö ÀÖ´Ù. + // ��, �ڽ��� �ڽ��� ������ Ŭ���� �� �ִ�. if (pkChrCauser->GetMyShop() && pkChrCauser != this) { - sys_err("OnClick Fail (%s->%s) - pc has shop", pkChrCauser->GetName(), GetName()); + SPDLOG_ERROR("OnClick Fail ({}->{}) - pc has shop", pkChrCauser->GetName(), GetName()); return; } } - // ±³È¯ÁßÀ϶§ Äù½ºÆ®¸¦ ÁøÇàÇÒ ¼ö ¾ø´Ù. + // ��ȯ���϶� ����Ʈ�� ������ �� ����. { if (pkChrCauser->GetExchange()) { - sys_err("OnClick Fail (%s->%s) - pc is exchanging", pkChrCauser->GetName(), GetName()); + SPDLOG_ERROR("OnClick Fail ({}->{}) - pc is exchanging", pkChrCauser->GetName(), GetName()); return; } } if (IsPC()) { - // Ÿ°ÙÀ¸·Î ¼³Á¤µÈ °æ¿ì´Â PC¿¡ ÀÇÇÑ Å¬¸¯µµ Äù½ºÆ®·Î ó¸®Çϵµ·Ï ÇÕ´Ï´Ù. + // Ÿ������ ������ ���� PC�� ���� Ŭ���� ����Ʈ�� ó���ϵ��� �մϴ�. if (!CTargetManager::instance().GetTargetInfo(pkChrCauser->GetPlayerID(), TARGET_TYPE_VID, GetVID())) { - // 2005.03.17.myevan.Ÿ°ÙÀÌ ¾Æ´Ñ °æ¿ì´Â °³ÀÎ »óÁ¡ ó¸® ±â´ÉÀ» ÀÛµ¿½ÃŲ´Ù. + // 2005.03.17.myevan.Ÿ���� �ƴ� ���� ���� ���� ó�� ����� �۵���Ų��. if (GetMyShop()) { if (pkChrCauser->IsDead() == true) return; //PREVENT_TRADE_WINDOW - if (pkChrCauser == this) // ÀÚ±â´Â °¡´É + if (pkChrCauser == this) // �ڱ�� ���� { if ((GetExchange() || IsOpenSafebox() || GetShopOwner()) || IsCubeOpen()) { - pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ °Å·¡Áß(â°í,±³È¯,»óÁ¡)¿¡´Â °³ÀλóÁ¡À» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ٸ� �ŷ���(�,��ȯ,����)���� ������� ����� �� �����ϴ�.")); return; } } - else // ´Ù¸¥ »ç¶÷ÀÌ Å¬¸¯ÇßÀ»¶§ + else // �ٸ� ����� Ŭ�������� { - // Ŭ¸¯ÇÑ »ç¶÷ÀÌ ±³È¯/â°í/°³ÀλóÁ¡/»óÁ¡ÀÌ¿ëÁßÀ̶ó¸é ºÒ°¡ + // Ŭ���� ����� ��ȯ/�/�����/�����̿����̶�� �Ұ� if ((pkChrCauser->GetExchange() || pkChrCauser->IsOpenSafebox() || pkChrCauser->GetMyShop() || pkChrCauser->GetShopOwner()) || pkChrCauser->IsCubeOpen() ) { - pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ °Å·¡Áß(â°í,±³È¯,»óÁ¡)¿¡´Â °³ÀλóÁ¡À» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); + pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ٸ� �ŷ���(�,��ȯ,����)���� ������� ����� �� �����ϴ�.")); return; } - // Ŭ¸¯ÇÑ ´ë»óÀÌ ±³È¯/â°í/»óÁ¡ÀÌ¿ëÁßÀ̶ó¸é ºÒ°¡ + // Ŭ���� ����� ��ȯ/�/�����̿����̶�� �Ұ� //if ((GetExchange() || IsOpenSafebox() || GetShopOwner())) if ((GetExchange() || IsOpenSafebox() || IsCubeOpen())) { - pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ´Ù¸¥ °Å·¡¸¦ ÇÏ°í ÀÖ´Â ÁßÀÔ´Ï´Ù.")); + pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ �ٸ� �ŷ��� �ϰ� �ִ� ���Դϴ�.")); return; } } @@ -4911,24 +4905,23 @@ void CHARACTER::OnClick(LPCHARACTER pkChrCauser) return; } - if (test_server) - sys_err("%s.OnClickFailure(%s) - target is PC", pkChrCauser->GetName(), GetName()); + SPDLOG_TRACE("{}.OnClickFailure({}) - target is PC", pkChrCauser->GetName(), GetName()); return; } } - // û¼Ò³âÀº Äù½ºÆ® ¸øÇÔ + // û�ҳ��� ����Ʈ ���� if (LC_IsNewCIBN()) { if (pkChrCauser->IsOverTime(OT_3HOUR)) { - sys_log(0, "Teen OverTime : name = %s, hour = %d)", pkChrCauser->GetName(), 3); + SPDLOG_DEBUG("Teen OverTime : name = {}, hour = {})", pkChrCauser->GetName(), 3); return; } else if (pkChrCauser->IsOverTime(OT_5HOUR)) { - sys_log(0, "Teen OverTime : name = %s, hour = %d)", pkChrCauser->GetName(), 5); + SPDLOG_DEBUG("Teen OverTime : name = {}, hour = {})", pkChrCauser->GetName(), 5); return; } } @@ -4942,16 +4935,16 @@ void CHARACTER::OnClick(LPCHARACTER pkChrCauser) } - // NPC Àü¿ë ±â´É ¼öÇà : »óÁ¡ ¿­±â µî + // NPC ���� ��� ���� : ���� ���� �� if (!IsPC()) { if (!m_triggerOnClick.pFunc) { - // NPC Æ®¸®°Å ½Ã½ºÅÛ ·Î±× º¸±â - //sys_err("%s.OnClickFailure(%s) : triggerOnClick.pFunc is EMPTY(pid=%d)", - // pkChrCauser->GetName(), - // GetName(), - // pkChrCauser->GetPlayerID()); + // NPC Ʈ���� �ý��� �α� ���� + SPDLOG_ERROR("{}.OnClickFailure({}) : triggerOnClick.pFunc is EMPTY(pid={})", + pkChrCauser->GetName(), + GetName(), + pkChrCauser->GetPlayerID()); return; } @@ -5012,7 +5005,7 @@ void CHARACTER::ClearStone() { if (!m_set_pkChrSpawnedBy.empty()) { - // ³»°¡ ½ºÆù½ÃŲ ¸ó½ºÅ͵éÀ» ¸ðµÎ Á×ÀδÙ. + // ���� ������Ų ���͵��� ��� ���δ�. FuncDeadSpawnedByStone f; std::for_each(m_set_pkChrSpawnedBy.begin(), m_set_pkChrSpawnedBy.end(), f); m_set_pkChrSpawnedBy.clear(); @@ -5048,7 +5041,7 @@ void CHARACTER::ClearTarget() if (!pkChr->GetDesc()) { - sys_err("%s %p does not have desc", pkChr->GetName(), get_pointer(pkChr)); + SPDLOG_ERROR("{} {} does not have desc", pkChr->GetName(), (void*) get_pointer(pkChr)); abort(); } @@ -5148,7 +5141,7 @@ void CHARACTER::BroadcastTargetPacket() if (!pkChr->GetDesc()) { - sys_err("%s %p does not have desc", pkChr->GetName(), get_pointer(pkChr)); + SPDLOG_ERROR("{} {} does not have desc", pkChr->GetName(), (void*) get_pointer(pkChr)); abort(); } @@ -5180,7 +5173,7 @@ void CHARACTER::SaveExitLocation() void CHARACTER::ExitToSavedLocation() { - sys_log (0, "ExitToSavedLocation"); + SPDLOG_DEBUG("ExitToSavedLocation"); WarpSet(m_posWarp.x, m_posWarp.y, m_lWarpMapIndex); m_posExit.x = m_posExit.y = m_posExit.z = 0; @@ -5188,9 +5181,9 @@ void CHARACTER::ExitToSavedLocation() } // fixme -// Áö±Ý±îÁø privateMapIndex °¡ ÇöÀç ¸Ê À妽º¿Í °°ÀºÁö üũ ÇÏ´Â °ÍÀ» ¿ÜºÎ¿¡¼­ ÇÏ°í, -// ´Ù¸£¸é warpsetÀ» ºÒ·¶´Âµ¥ -// À̸¦ warpset ¾ÈÀ¸·Î ³ÖÀÚ. +// ���ݱ��� privateMapIndex �� ���� �� ����� ������ üũ �ϴ� ���� �ܺο��� �ϰ�, +// �ٸ��� warpset�� �ҷ��µ� +// �̸� warpset ������ ����. bool CHARACTER::WarpSet(int x, int y, int lPrivateMapIndex) { if (!IsPC()) @@ -5202,7 +5195,7 @@ bool CHARACTER::WarpSet(int x, int y, int lPrivateMapIndex) if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort)) { - sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName()); + SPDLOG_ERROR("cannot find map location index {} x {} y {} name {}", lMapIndex, x, y, GetName()); return false; } @@ -5228,7 +5221,7 @@ bool CHARACTER::WarpSet(int x, int y, int lPrivateMapIndex) { if (lPrivateMapIndex / 10000 != lMapIndex) { - sys_err("Invalid map inedx %d, must be child of %d", lPrivateMapIndex, lMapIndex); + SPDLOG_ERROR("Invalid map inedx {}, must be child of {}", lPrivateMapIndex, lMapIndex); return false; } @@ -5250,7 +5243,7 @@ bool CHARACTER::WarpSet(int x, int y, int lPrivateMapIndex) m_posWarp.x = x; m_posWarp.y = y; - sys_log(0, "WarpSet %s %d %d current map %d target map %d", GetName(), x, y, GetMapIndex(), lMapIndex); + SPDLOG_DEBUG("WarpSet {} {} {} current map {} target map {}", GetName(), x, y, GetMapIndex(), lMapIndex); TPacketGCWarp p; @@ -5274,8 +5267,7 @@ bool CHARACTER::WarpSet(int x, int y, int lPrivateMapIndex) void CHARACTER::WarpEnd() { - if (test_server) - sys_log(0, "WarpEnd %s", GetName()); + SPDLOG_TRACE("WarpEnd {}", GetName()); if (m_posWarp.x == 0 && m_posWarp.y == 0) return; @@ -5287,13 +5279,13 @@ void CHARACTER::WarpEnd() if (!map_allow_find(index)) { - // ÀÌ °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾øÀ¸¹Ç·Î ¿öÇÁÇϱâ Àü ÁÂÇ¥·Î µÇµ¹¸®ÀÚ. - sys_err("location %d %d not allowed to login this server", m_posWarp.x, m_posWarp.y); + // �� ������ ������ �� �����Ƿ� �����ϱ� �� ��ǥ�� �ǵ�����. + SPDLOG_ERROR("location {} {} not allowed to login this server", m_posWarp.x, m_posWarp.y); GetDesc()->SetPhase(PHASE_CLOSE); return; } - sys_log(0, "WarpEnd %s %d %u %u", GetName(), m_lWarpMapIndex, m_posWarp.x, m_posWarp.y); + SPDLOG_DEBUG("WarpEnd {} {} {} {}", GetName(), m_lWarpMapIndex, m_posWarp.x, m_posWarp.y); Show(m_lWarpMapIndex, m_posWarp.x, m_posWarp.y, 0); Stop(); @@ -5341,8 +5333,7 @@ bool CHARACTER::Return() SendMovePacket(FUNC_WAIT, 0, 0, 0, 0); - if (test_server) - sys_log(0, "%s %p Æ÷±âÇÏ°í µ¹¾Æ°¡ÀÚ! %d %d", GetName(), this, x, y); + SPDLOG_TRACE("{} {} �����ϰ� ���ư���! {} {}", GetName(), (void*) this, x, y); if (GetParty()) GetParty()->SendMessage(this, PM_RETURN, x, y); @@ -5354,21 +5345,21 @@ bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance) { if (IsPC()) { - sys_err("CHARACTER::Follow : PC cannot use this method", GetName()); + SPDLOG_ERROR("CHARACTER::Follow : PC cannot use this method", GetName()); return false; } // TRENT_MONSTER if (IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_NOMOVE)) { - if (pkChr->IsPC()) // ÂѾư¡´Â »ó´ë°¡ PCÀÏ ¶§ + if (pkChr->IsPC()) // �Ѿư��� ��밡 PC�� �� { // If i'm in a party. I must obey party leader's AI. if (!GetParty() || !GetParty()->GetLeader() || GetParty()->GetLeader() == this) { - if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000) // ¸¶Áö¸·À¸·Î °ø°Ý¹ÞÀºÁö 15ÃÊ°¡ Áö³µ°í + if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000) // ���������� ���ݹ����� 15�ʰ� ������ { - // ¸¶Áö¸· ¸ÂÀº °÷À¸·Î ºÎÅÍ 50¹ÌÅÍ ÀÌ»ó Â÷À̳ª¸é Æ÷±âÇÏ°í µ¹¾Æ°£´Ù. + // ������ ���� ������ ���� 50���� �̻� ���̳��� �����ϰ� ���ư���. if (m_pkMobData->m_table.wAttackRange < DISTANCE_APPROX(pkChr->GetX() - GetX(), pkChr->GetY() - GetY())) if (Return()) return true; @@ -5382,14 +5373,14 @@ bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance) int x = pkChr->GetX(); int y = pkChr->GetY(); - if (pkChr->IsPC()) // ÂѾư¡´Â »ó´ë°¡ PCÀÏ ¶§ + if (pkChr->IsPC()) // �Ѿư��� ��밡 PC�� �� { // If i'm in a party. I must obey party leader's AI. if (!GetParty() || !GetParty()->GetLeader() || GetParty()->GetLeader() == this) { - if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000) // ¸¶Áö¸·À¸·Î °ø°Ý¹ÞÀºÁö 15ÃÊ°¡ Áö³µ°í + if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000) // ���������� ���ݹ����� 15�ʰ� ������ { - // ¸¶Áö¸· ¸ÂÀº °÷À¸·Î ºÎÅÍ 50¹ÌÅÍ ÀÌ»ó Â÷À̳ª¸é Æ÷±âÇÏ°í µ¹¾Æ°£´Ù. + // ������ ���� ������ ���� 50���� �̻� ���̳��� �����ϰ� ���ư���. if (5000 < DISTANCE_APPROX(m_pkMobInst->m_posLastAttacked.x - GetX(), m_pkMobInst->m_posLastAttacked.y - GetY())) if (Return()) return true; @@ -5409,9 +5400,9 @@ bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance) GetMobBattleType() != BATTLE_TYPE_MAGIC && false == IsPet()) { - // ´ë»óÀÌ À̵¿ÁßÀÌ¸é ¿¹Ãø À̵¿À» ÇÑ´Ù - // ³ª¿Í »ó´ë¹æÀÇ ¼ÓµµÂ÷¿Í °Å¸®·ÎºÎÅÍ ¸¸³¯ ½Ã°£À» ¿¹»óÇÑ ÈÄ - // »ó´ë¹æÀÌ ±× ½Ã°£±îÁö Á÷¼±À¸·Î À̵¿ÇÑ´Ù°í °¡Á¤ÇÏ¿© °Å±â·Î À̵¿ÇÑ´Ù. + // ����� �̵����̸� ���� �̵��� �Ѵ� + // ���� ������ �ӵ����� �Ÿ��κ��� ���� �� ������ �� + // ������ �� ���� �������� �̵��Ѵٰ� �����Ͽ� �ű�� �̵��Ѵ�. float rot = pkChr->GetRotation(); float rot_delta = GetDegreeDelta(rot, GetDegreeFromPositionXY(GetX(), GetY(), pkChr->GetX(), pkChr->GetY())); @@ -5443,7 +5434,7 @@ bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance) } } - // °¡·Á´Â À§Ä¡¸¦ ¹Ù¶óºÁ¾ß ÇÑ´Ù. + // ������ ��ġ�� �ٶ���� �Ѵ�. SetRotationToXY(x, y); float fDist = DISTANCE_SQRT(x - GetX(), y - GetY()); @@ -5455,7 +5446,7 @@ bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance) if (IsChangeAttackPosition(pkChr) && GetMobRank() < MOB_RANK_BOSS) { - // »ó´ë¹æ ÁÖº¯ ·£´ýÇÑ °÷À¸·Î À̵¿ + // ���� �ֺ� ������ ������ �̵� SetChangeAttackPositionTime(); int retry = 16; @@ -5481,23 +5472,21 @@ bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance) break; } - //sys_log(0, "±Ùó ¾îµò°¡·Î À̵¿ %s retry %d", GetName(), retry); if (!Goto(dx, dy)) return false; } else { - // Á÷¼± µû¶ó°¡±â + // ���� ���󰡱� float fDistToGo = fDist - fMinDistance; GetDeltaByDegree(GetRotation(), fDistToGo, &fx, &fy); - //sys_log(0, "Á÷¼±À¸·Î À̵¿ %s", GetName()); if (!Goto(GetX() + (int) fx, GetY() + (int) fy)) return false; } SendMovePacket(FUNC_WAIT, 0, 0, 0, 0); - //MonsterLog("ÂѾư¡±â; %s", pkChr->GetName()); + //MonsterLog("�Ѿư���; %s", pkChr->GetName()); return true; } @@ -5520,12 +5509,12 @@ void CHARACTER::ReqSafeboxLoad(const char* pszPassword) { if (!*pszPassword || strlen(pszPassword) > SAFEBOX_PASSWORD_MAX_LEN) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> À߸øµÈ ¾ÏÈ£¸¦ ÀÔ·ÂÇϼ̽À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<�> �߸��� ��ȣ�� �Է��ϼ̽��ϴ�.")); return; } else if (m_pkSafebox) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> â°í°¡ ÀÌ¹Ì ¿­·ÁÀÖ½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<�> � �̹� �����ֽ��ϴ�.")); return; } @@ -5533,17 +5522,17 @@ void CHARACTER::ReqSafeboxLoad(const char* pszPassword) if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(10)) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> â°í¸¦ ´ÝÀºÁö 10ÃÊ ¾È¿¡´Â ¿­ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<�> � ������ 10�� �ȿ��� �� �� �����ϴ�.")); return; } else if (GetDistanceFromSafeboxOpen() > 1000) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> °Å¸®°¡ ¸Ö¾î¼­ â°í¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<�> �Ÿ��� �־ � �� �� �����ϴ�.")); return; } else if (m_bOpeningSafebox) { - sys_log(0, "Overlapped safebox load request from %s", GetName()); + SPDLOG_WARN("Overlapped safebox load request from {}", GetName()); return; } @@ -5594,7 +5583,7 @@ void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem if (!item) { - sys_err("cannot create item vnum %d id %u (name: %s)", pItems->vnum, pItems->id, GetName()); + SPDLOG_ERROR("cannot create item vnum {} id {} (name: {})", pItems->vnum, pItems->id, GetName()); continue; } @@ -5689,7 +5678,7 @@ void CHARACTER::LoadMall(int iItemCount, TPlayerItem * pItems) if (!item) { - sys_err("cannot create item vnum %d id %u (name: %s)", pItems->vnum, pItems->id, GetName()); + SPDLOG_ERROR("cannot create item vnum {} id {} (name: {})", pItems->vnum, pItems->id, GetName()); continue; } @@ -5730,7 +5719,7 @@ bool CHARACTER::BuildUpdatePartyPacket(TPacketGCPartyUpdate & out) out.percent_hp = std::clamp(GetHP() * 100 / GetMaxHP(), 0, 100); out.role = GetParty()->GetRole(GetPlayerID()); - sys_log(1, "PARTY %s role is %d", GetName(), out.role); + SPDLOG_DEBUG("PARTY {} role is {}", GetName(), out.role); LPCHARACTER l = GetParty()->GetLeaderCharacter(); @@ -5771,7 +5760,7 @@ void CHARACTER::QuerySafeboxSize() void CHARACTER::SetSafeboxSize(int iSize) { - sys_log(1, "SetSafeboxSize: %s %d", GetName(), iSize); + SPDLOG_DEBUG("SetSafeboxSize: {} {}", GetName(), iSize); m_iSafeboxSize = iSize; DBManager::instance().Query("UPDATE safebox%s SET size = %d WHERE account_id = %u", get_table_postfix(), iSize / SAFEBOX_PAGE_SIZE, GetDesc()->GetAccountTable().id); } @@ -5809,12 +5798,10 @@ void CHARACTER::SetNowWalking(bool bWalkFlag) if (IsNPC()) { if (m_bNowWalking) - MonsterLog("°È´Â´Ù"); + MonsterLog("�ȴ´�"); else - MonsterLog("¶Ú´Ù"); + MonsterLog("�ڴ�"); } - - //sys_log(0, "%s is now %s", GetName(), m_bNowWalking?"walking.":"running."); } } @@ -5886,7 +5873,7 @@ void CHARACTER::ResetPoint(int iLv) ComputePoints(); - // ȸº¹ + // ȸ�� PointChange(POINT_HP, GetMaxHP() - GetHP()); PointChange(POINT_SP, GetMaxSP() - GetSP()); @@ -6143,7 +6130,7 @@ void CHARACTER::SetPolymorph(DWORD dwRaceNum, bool bMaintainStat) m_bPolyMaintainStat = bMaintainStat; m_dwPolymorphRace = dwRaceNum; - sys_log(0, "POLYMORPH: %s race %u ", GetName(), dwRaceNum); + SPDLOG_DEBUG("POLYMORPH: {} race {} ", GetName(), dwRaceNum); if (dwRaceNum != 0) StopRiding(); @@ -6163,11 +6150,11 @@ void CHARACTER::SetPolymorph(DWORD dwRaceNum, bool bMaintainStat) PointChange(POINT_HT, 0); } - // Æú¸®¸ðÇÁ »óÅ¿¡¼­ Á×´Â °æ¿ì, Æú¸®¸ðÇÁ°¡ Ç®¸®°Ô µÇ´Âµ¥ - // Æú¸® ¸ðÇÁ ÀüÈÄ·Î valid combo intervalÀÌ ´Ù¸£±â ¶§¹®¿¡ - // Combo ÇÙ ¶Ç´Â Hacker·Î ÀνÄÇÏ´Â °æ¿ì°¡ ÀÖ´Ù. - // µû¶ó¼­ Æú¸®¸ðÇÁ¸¦ Ç®°Å³ª Æú¸®¸ðÇÁ ÇÏ°Ô µÇ¸é, - // valid combo intervalÀ» resetÇÑ´Ù. + // �������� ���¿��� �״� ���, ���������� Ǯ���� �Ǵµ� + // ���� ���� ���ķ� valid combo interval�� �ٸ��� ������ + // Combo �� �Ǵ� Hacker�� �ν��ϴ� ��찡 �ִ�. + // ���� ���������� Ǯ�ų� �������� �ϰ� �Ǹ�, + // valid combo interval�� reset�Ѵ�. SetValidComboInterval(0); SetComboSequence(0); @@ -6231,7 +6218,7 @@ void CHARACTER::DetermineDropMetinStone() else { iGradePct -= iLevelGradePortion; - m_dwDropMetinStone += 100; // µ¹ +a -> +(a+1)ÀÌ µÉ¶§¸¶´Ù 100¾¿ Áõ°¡ + m_dwDropMetinStone += 100; // �� +a -> +(a+1)�� �ɶ����� 100�� ���� } } } @@ -6279,9 +6266,9 @@ void CHARACTER::MountVnum(DWORD vnum) if (m_bIsObserver) return; - //NOTE : MountÇÑ´Ù°í Çؼ­ Client SideÀÇ °´Ã¼¸¦ »èÁ¦ÇÏÁø ¾Ê´Â´Ù. - //±×¸®°í ¼­¹öSide¿¡¼­ ÅÀÀ»¶§ À§Ä¡ À̵¿Àº ÇÏÁö ¾Ê´Â´Ù. ¿Ö³ÄÇϸé Client Side¿¡¼­ Coliision Adjust¸¦ ÇÒ¼ö Àִµ¥ - //°´Ã¼¸¦ ¼Ò¸ê½ÃÄ×´Ù°¡ ¼­¹öÀ§Ä¡·Î À̵¿½ÃÅ°¸é À̶§ collision check¸¦ ÇÏÁö´Â ¾ÊÀ¸¹Ç·Î ¹è°æ¿¡ ³¢°Å³ª ¶Õ°í ³ª°¡´Â ¹®Á¦°¡ Á¸ÀçÇÑ´Ù. + //NOTE : Mount�Ѵٰ� �ؼ� Client Side�� ��ü�� �������� �ʴ´�. + //�׸��� ����Side���� ������ ��ġ �̵��� ���� �ʴ´�. �ֳ��ϸ� Client Side���� Coliision Adjust�� �Ҽ� �ִµ� + //��ü�� �Ҹ���״ٰ� ������ġ�� �̵���Ű�� �̶� collision check�� ������ �����Ƿ� ��濡 ���ų� �հ� ������ ������ �����Ѵ�. m_posDest.x = m_posStart.x = GetX(); m_posDest.y = m_posStart.y = GetY(); //EncodeRemovePacket(this); @@ -6293,7 +6280,7 @@ void CHARACTER::MountVnum(DWORD vnum) { LPENTITY entity = (it++)->first; - //MountÇÑ´Ù°í Çؼ­ Client SideÀÇ °´Ã¼¸¦ »èÁ¦ÇÏÁø ¾Ê´Â´Ù. + //Mount�Ѵٰ� �ؼ� Client Side�� ��ü�� �������� �ʴ´�. //EncodeRemovePacket(entity); //if (!m_bIsObserver) EncodeInsertPacket(entity); @@ -6328,7 +6315,7 @@ namespace { if (3 != sscanf(pkWarp->GetName(), " %s %d %d ", szTmp, &m_lTargetX, &m_lTargetY)) { if (Random::get(1, 100) < 5) - sys_err("Warp NPC name wrong : vnum(%d) name(%s)", pkWarp->GetRaceNum(), pkWarp->GetName()); + SPDLOG_ERROR("Warp NPC name wrong : vnum({}) name({})", pkWarp->GetRaceNum(), pkWarp->GetName()); m_bInvalid = true; @@ -6407,7 +6394,7 @@ EVENTFUNC(warp_npc_event) char_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "warp_npc_event> Null pointer" ); + SPDLOG_ERROR("warp_npc_event> Null pointer" ); return 0; } @@ -6527,45 +6514,45 @@ bool CHARACTER::WarpToPID(DWORD dwPID) } else { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ �ִ� ������ ������ �� �����ϴ�.")); return false; } } else { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ �ִ� ������ ������ �� �����ϴ�.")); return false; } } else { - // ´Ù¸¥ ¼­¹ö¿¡ ·Î±×ÀÎµÈ »ç¶÷ÀÌ ÀÖÀ½ -> ¸Þ½ÃÁö º¸³» ÁÂÇ¥¸¦ ¹Þ¾Æ¿ÀÀÚ - // 1. A.pid, B.pid ¸¦ »Ñ¸² - // 2. B.pid¸¦ °¡Áø ¼­¹ö°¡ »Ñ¸°¼­¹ö¿¡°Ô A.pid, ÁÂÇ¥ ¸¦ º¸³¿ - // 3. ¿öÇÁ + // �ٸ� ������ �α��ε� ����� ���� -> �޽��� ���� ��ǥ�� �޾ƿ��� + // 1. A.pid, B.pid �� �Ѹ� + // 2. B.pid�� ���� ������ �Ѹ��������� A.pid, ��ǥ �� ���� + // 3. ���� CCI * pcci = P2P_MANAGER::instance().FindByPID(dwPID); if (!pcci) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ¿Â¶óÀÎ »óÅ°¡ ¾Æ´Õ´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ �¶��� ���°� �ƴմϴ�.")); return false; } if (pcci->bChannel != g_bChannel) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ %d ä³Î¿¡ ÀÖ½À´Ï´Ù. (ÇöÀç ä³Î %d)"), pcci->bChannel, g_bChannel); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ %d ä�ο� �ֽ��ϴ�. (���� � %d)"), pcci->bChannel, g_bChannel); return false; } else if (false == IS_SUMMONABLE_ZONE(pcci->lMapIndex)) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ �ִ� ������ ������ �� �����ϴ�.")); return false; } else { if (!CAN_ENTER_ZONE(this, pcci->lMapIndex)) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù.")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ �ִ� ������ ������ �� �����ϴ�.")); return false; } @@ -6603,7 +6590,7 @@ int CHARACTER::ComputeRefineFee(int iCost, int iMultiply) const if (pGuild == GetGuild()) return iCost * iMultiply * 9 / 10; - // ´Ù¸¥ Á¦±¹ »ç¶÷ÀÌ ½ÃµµÇÏ´Â °æ¿ì Ãß°¡·Î 3¹è ´õ + // �ٸ� ���� ����� �õ��ϴ� ��� �߰��� 3�� �� LPCHARACTER chRefineNPC = CHARACTER_MANAGER::instance().Find(m_dwRefineNPCVID); if (chRefineNPC && chRefineNPC->GetEmpire() != GetEmpire()) return iCost * iMultiply * 3; @@ -6623,7 +6610,7 @@ void CHARACTER::PayRefineFee(int iTotalMoney) if (pGuild) { - // Àڱ⠱æµåÀ̸é iTotalMoney¿¡ ÀÌ¹Ì 10%°¡ Á¦¿ÜµÇ¾îÀÖ´Ù + // �ڱ� ����̸� iTotalMoney�� �̹� 10%�� ���ܵǾ��ִ� if (pGuild != GetGuild()) { pGuild->RequestDepositMoney(this, iFee); @@ -6635,7 +6622,7 @@ void CHARACTER::PayRefineFee(int iTotalMoney) } // END_OF_ADD_REFINE_BUILDING -//Hack ¹æÁö¸¦ À§ÇÑ Ã¼Å©. +//Hack ������ ���� üũ. bool CHARACTER::IsHack(bool bSendMsg, bool bCheckShopOwner, int limittime) { const int iPulse = thecore_pulse(); @@ -6643,24 +6630,24 @@ bool CHARACTER::IsHack(bool bSendMsg, bool bCheckShopOwner, int limittime) if (test_server) bSendMsg = true; - //â°í ¿¬ÈÄ Ã¼Å© + //� ���� üũ if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(limittime)) { if (bSendMsg) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("â°í¸¦ ¿¬ÈÄ %dÃÊ À̳»¿¡´Â ´Ù¸¥°÷À¸·Î À̵¿ÇÒ¼ö ¾ø½À´Ï´Ù."), limittime); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("� ���� %d�� �̳����� �ٸ������� �̵��Ҽ� �����ϴ�."), limittime); if (test_server) ChatPacket(CHAT_TYPE_INFO, "[TestOnly]Pulse %d LoadTime %d PASS %d", iPulse, GetSafeboxLoadTime(), PASSES_PER_SEC(limittime)); return true; } - //°Å·¡°ü·Ã â üũ + //�ŷ����� â üũ if (bCheckShopOwner) { if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen()) { if (bSendMsg) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡Ã¢,â°í µîÀ» ¿¬ »óÅ¿¡¼­´Â ´Ù¸¥°÷À¸·Î À̵¿,Á¾·á ÇÒ¼ö ¾ø½À´Ï´Ù")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ŷ�â,� ���� �� ���¿����� �ٸ������� �̵�,���� �Ҽ� �����ϴ�")); return true; } @@ -6670,18 +6657,18 @@ bool CHARACTER::IsHack(bool bSendMsg, bool bCheckShopOwner, int limittime) if (GetExchange() || GetMyShop() || IsOpenSafebox() || IsCubeOpen()) { if (bSendMsg) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡Ã¢,â°í µîÀ» ¿¬ »óÅ¿¡¼­´Â ´Ù¸¥°÷À¸·Î À̵¿,Á¾·á ÇÒ¼ö ¾ø½À´Ï´Ù")); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ŷ�â,� ���� �� ���¿����� �ٸ������� �̵�,���� �Ҽ� �����ϴ�")); return true; } } //PREVENT_PORTAL_AFTER_EXCHANGE - //±³È¯ ÈÄ ½Ã°£Ã¼Å© + //��ȯ �� �ð�üũ if (iPulse - GetExchangeTime() < PASSES_PER_SEC(limittime)) { if (bSendMsg) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡ ÈÄ %dÃÊ À̳»¿¡´Â ´Ù¸¥Áö¿ªÀ¸·Î À̵¿ ÇÒ ¼ö ¾ø½À´Ï´Ù."), limittime ); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ŷ� �� %d�� �̳����� �ٸ��������� �̵� �� �� �����ϴ�."), limittime ); return true; } //END_PREVENT_PORTAL_AFTER_EXCHANGE @@ -6690,14 +6677,14 @@ bool CHARACTER::IsHack(bool bSendMsg, bool bCheckShopOwner, int limittime) if (iPulse - GetMyShopTime() < PASSES_PER_SEC(limittime)) { if (bSendMsg) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡ ÈÄ %dÃÊ À̳»¿¡´Â ´Ù¸¥Áö¿ªÀ¸·Î À̵¿ ÇÒ ¼ö ¾ø½À´Ï´Ù."), limittime); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("�ŷ� �� %d�� �̳����� �ٸ��������� �̵� �� �� �����ϴ�."), limittime); return true; } if (iPulse - GetRefineTime() < PASSES_PER_SEC(limittime)) { if (bSendMsg) - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ °³·®ÈÄ %dÃÊ À̳»¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), limittime); + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("������ ������ %d�� �̳����� ��ȯ��,��ȯ���θ� ����� �� �����ϴ�."), limittime); return true; } //END_PREVENT_ITEM_COPY @@ -6774,14 +6761,11 @@ bool CHARACTER::IsMCOK(enum MONARCH_INDEX e) const if ((iPulse - GetMC(e)) < GetMCL(e)) { - if (test_server) - sys_log(0, " Pulse %d cooltime %d, limit %d", iPulse, GetMC(e), GetMCL(e)); - + SPDLOG_TRACE(" Pulse {} cooltime {}, limit {}", iPulse, GetMC(e), GetMCL(e)); return false; } - - if (test_server) - sys_log(0, " Pulse %d cooltime %d, limit %d", iPulse, GetMC(e), GetMCL(e)); + + SPDLOG_TRACE(" Pulse {} cooltime {}, limit {}", iPulse, GetMC(e), GetMCL(e)); return true; } @@ -6795,8 +6779,7 @@ DWORD CHARACTER::GetMCLTime(enum MONARCH_INDEX e) const { int iPulse = thecore_pulse(); - if (test_server) - sys_log(0, " Pulse %d cooltime %d, limit %d", iPulse, GetMC(e), GetMCL(e)); + SPDLOG_TRACE(" Pulse {} cooltime {}, limit {}", iPulse, GetMC(e), GetMCL(e)); return (GetMCL(e)) / passes_per_sec - (iPulse - GetMC(e)) / passes_per_sec; } @@ -6809,7 +6792,7 @@ bool CHARACTER::IsSiegeNPC() const //------------------------------------------------ void CHARACTER::UpdateDepositPulse() { - m_deposit_pulse = thecore_pulse() + PASSES_PER_SEC(60*5); // 5ºÐ + m_deposit_pulse = thecore_pulse() + PASSES_PER_SEC(60*5); // 5�� } bool CHARACTER::CanDeposit() const @@ -6969,7 +6952,7 @@ EVENTFUNC(check_speedhack_event) char_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "check_speedhack_event> Null pointer" ); + SPDLOG_ERROR("check_speedhack_event> Null pointer" ); return 0; } @@ -7011,7 +6994,7 @@ void CHARACTER::StartCheckSpeedHackEvent() info->ch = this; - m_pkCheckSpeedHackEvent = event_create(check_speedhack_event, info, PASSES_PER_SEC(60)); // 1ºÐ + m_pkCheckSpeedHackEvent = event_create(check_speedhack_event, info, PASSES_PER_SEC(60)); // 1�� } void CHARACTER::GoHome() @@ -7052,7 +7035,7 @@ EVENTFUNC(destroy_when_idle_event) char_event_info* info = dynamic_cast( event->info ); if ( info == NULL ) { - sys_err( "destroy_when_idle_event> Null pointer" ); + SPDLOG_ERROR("destroy_when_idle_event> Null pointer" ); return 0; } @@ -7066,7 +7049,7 @@ EVENTFUNC(destroy_when_idle_event) return PASSES_PER_SEC(300); } - sys_log(1, "DESTROY_WHEN_IDLE: %s", ch->GetName()); + SPDLOG_DEBUG("DESTROY_WHEN_IDLE: {}", ch->GetName()); ch->m_pkDestroyWhenIdleEvent = NULL; M2_DESTROY_CHARACTER(ch); @@ -7129,7 +7112,7 @@ void CHARACTER::IncreaseComboHackCount(int k) if (GetDesc()) if (GetDesc()->DelayedDisconnect(Random::get(2, 7))) { - sys_log(0, "COMBO_HACK_DISCONNECT: %s count: %d", GetName(), m_iComboHackCount); + SPDLOG_WARN("COMBO_HACK_DISCONNECT: {} count: {}", GetName(), m_iComboHackCount); LogManager::instance().HackLog("Combo", this); } } @@ -7165,7 +7148,7 @@ BYTE CHARACTER::GetChatCounter() const return m_bChatCounter; } -// ¸»À̳ª ´Ù¸¥°ÍÀ» Ÿ°í ÀÖ³ª? +// ���̳� �ٸ����� Ÿ�� �ֳ�? bool CHARACTER::IsRiding() const { return IsHorseRiding() || GetMountVnum(); diff --git a/src/game/src/char_affect.cpp b/src/game/src/char_affect.cpp index 0766a5b..2beb8bd 100644 --- a/src/game/src/char_affect.cpp +++ b/src/game/src/char_affect.cpp @@ -71,7 +71,7 @@ EVENTFUNC(affect_event) if ( info == NULL ) { - sys_err( "affect_event> Null pointer" ); + SPDLOG_ERROR("affect_event> Null pointer" ); return 0; } @@ -174,7 +174,7 @@ void CHARACTER::StartAffectEvent() char_event_info* info = AllocEventInfo(); info->ch = this; m_pkAffectEvent = event_create(affect_event, info, passes_per_sec); - sys_log(1, "StartAffectEvent %s %p %p", GetName(), this, get_pointer(m_pkAffectEvent)); + SPDLOG_DEBUG("StartAffectEvent {} {} {}", GetName(), (void*) this, (void*) get_pointer(m_pkAffectEvent)); } void CHARACTER::ClearAffect(bool bSave) @@ -357,7 +357,7 @@ void CHARACTER::SaveAffect() if (IS_NO_SAVE_AFFECT(pkAff->dwType)) continue; - sys_log(1, "AFFECT_SAVE: %u %u %d %d", pkAff->dwType, pkAff->bApplyOn, pkAff->lApplyValue, pkAff->lDuration); + SPDLOG_DEBUG("AFFECT_SAVE: {} {} {} {}", pkAff->dwType, pkAff->bApplyOn, pkAff->lApplyValue, pkAff->lDuration); p.dwPID = GetPlayerID(); p.elem.dwType = pkAff->dwType; @@ -390,7 +390,7 @@ EVENTFUNC(load_affect_login_event) if ( info == NULL ) { - sys_err( "load_affect_login_event_info> Null pointer" ); + SPDLOG_ERROR("load_affect_login_event_info> Null pointer" ); return 0; } @@ -426,14 +426,14 @@ EVENTFUNC(load_affect_login_event) } else if (d->IsPhase(PHASE_GAME)) { - sys_log(1, "Affect Load by Event"); + SPDLOG_DEBUG("Affect Load by Event"); ch->LoadAffect(info->count, (TPacketAffectElement*)info->data); M2_DELETE_ARRAY(info->data); return 0; } else { - sys_err("input_db.cpp:quest_login_event INVALID PHASE pid %d", ch->GetPlayerID()); + SPDLOG_ERROR("input_db.cpp:quest_login_event INVALID PHASE pid {}", ch->GetPlayerID()); M2_DELETE_ARRAY(info->data); return 0; } @@ -445,8 +445,7 @@ void CHARACTER::LoadAffect(DWORD dwCount, TPacketAffectElement * pElements) if (!GetDesc()->IsPhase(PHASE_GAME)) { - if (test_server) - sys_log(0, "LOAD_AFFECT: Creating Event", GetName(), dwCount); + SPDLOG_TRACE("LOAD_AFFECT: Creating Event", GetName(), dwCount); load_affect_login_event_info* info = AllocEventInfo(); @@ -462,8 +461,7 @@ void CHARACTER::LoadAffect(DWORD dwCount, TPacketAffectElement * pElements) ClearAffect(true); - if (test_server) - sys_log(0, "LOAD_AFFECT: %s count %d", GetName(), dwCount); + SPDLOG_TRACE("LOAD_AFFECT: {} count {}", GetName(), dwCount); TAffectFlag afOld = m_afAffectFlag; @@ -488,15 +486,12 @@ void CHARACTER::LoadAffect(DWORD dwCount, TPacketAffectElement * pElements) if (pElements->bApplyOn >= POINT_MAX_NUM) { - sys_err("invalid affect data %s ApplyOn %u ApplyValue %d", + SPDLOG_ERROR("invalid affect data {} ApplyOn {} ApplyValue {}", GetName(), pElements->bApplyOn, pElements->lApplyValue); continue; } - if (test_server) - { - sys_log(0, "Load Affect : Affect %s %d %d", GetName(), pElements->dwType, pElements->bApplyOn ); - } + SPDLOG_TRACE("Load Affect : Affect {} {} {}", GetName(), pElements->dwType, pElements->bApplyOn ); CAffect* pkAff = CAffect::Acquire(); m_list_pkAffect.push_back(pkAff); @@ -544,7 +539,7 @@ bool CHARACTER::AddAffect(DWORD dwType, BYTE bApplyOn, int lApplyValue, DWORD dw if (lDuration == 0) { - sys_err("Character::AddAffect lDuration == 0 type %d", lDuration, dwType); + SPDLOG_ERROR("Character::AddAffect lDuration == 0 type {}", lDuration, dwType); lDuration = 1; } @@ -587,8 +582,7 @@ bool CHARACTER::AddAffect(DWORD dwType, BYTE bApplyOn, int lApplyValue, DWORD dw } - sys_log(1, "AddAffect %s type %d apply %d %d flag %u duration %d", GetName(), dwType, bApplyOn, lApplyValue, dwFlag, lDuration); - sys_log(0, "AddAffect %s type %d apply %d %d flag %u duration %d", GetName(), dwType, bApplyOn, lApplyValue, dwFlag, lDuration); + SPDLOG_DEBUG("AddAffect {} type {} apply {} {} flag {} duration {}", GetName(), dwType, bApplyOn, lApplyValue, dwFlag, lDuration); pkAff->dwType = dwType; pkAff->bApplyOn = bApplyOn; @@ -703,8 +697,7 @@ bool CHARACTER::RemoveAffect(CAffect * pkAff) } CheckMaximumPoints(); - if (test_server) - sys_log(0, "AFFECT_REMOVE: %s (flag %u apply: %u)", GetName(), pkAff->dwFlag, pkAff->bApplyOn); + SPDLOG_TRACE("AFFECT_REMOVE: {} (flag {} apply: {})", GetName(), pkAff->dwFlag, pkAff->bApplyOn); if (IsPC()) { @@ -801,7 +794,7 @@ bool CHARACTER::IsGoodAffect(BYTE bAffectType) const void CHARACTER::RemoveBadAffect() { - sys_log(0, "RemoveBadAffect %s", GetName()); + SPDLOG_DEBUG("RemoveBadAffect {}", GetName()); // µ¶ RemovePoison(); RemoveFire(); diff --git a/src/game/src/char_battle.cpp b/src/game/src/char_battle.cpp index ac6a70d..86056c9 100644 --- a/src/game/src/char_battle.cpp +++ b/src/game/src/char_battle.cpp @@ -26,7 +26,6 @@ #include "exchange.h" #include "shop_manager.h" #include "castle.h" -#include "dev_log.h" #include "ani.h" #include "BattleArena.h" #include "packet.h" @@ -179,8 +178,7 @@ void CHARACTER::DistributeSP(LPCHARACTER pkKiller, int iMethod) bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) { - if (test_server) - sys_log(0, "[TEST_SERVER] Attack : %s type %d, MobBattleType %d", GetName(), bType, !GetMobBattleType() ? 0 : GetMobAttackRange()); + SPDLOG_TRACE("[TEST_SERVER] Attack : {} type {}, MobBattleType {}", GetName(), bType, !GetMobBattleType() ? 0 : GetMobAttackRange()); //PROF_UNIT puAttack("Attack"); if (!CanMove()) return false; @@ -238,7 +236,7 @@ bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) break; default: - sys_err("Unhandled battle type %d", GetMobBattleType()); + SPDLOG_ERROR("Unhandled battle type {}", GetMobBattleType()); iRet = BATTLE_NONE; break; } @@ -249,18 +247,16 @@ bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) { if (dwCurrentTime - m_dwLastSkillTime > 1500) { - sys_log(1, "HACK: Too long skill using term. Name(%s) PID(%u) delta(%u)", + SPDLOG_DEBUG("HACK: Too long skill using term. Name({}) PID({}) delta({})", GetName(), GetPlayerID(), (dwCurrentTime - m_dwLastSkillTime)); return false; } } - sys_log(1, "Attack call ComputeSkill %d %s", bType, pkVictim?pkVictim->GetName():""); + SPDLOG_DEBUG("Attack call ComputeSkill {} {}", bType, pkVictim?pkVictim->GetName():""); iRet = ComputeSkill(bType, pkVictim); } - //if (test_server && IsPC()) - // sys_log(0, "%s Attack %s type %u ret %d", GetName(), pkVictim->GetName(), bType, iRet); if (iRet == BATTLE_DAMAGE || iRet == BATTLE_DEAD) { OnMove(true); @@ -278,7 +274,7 @@ bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) void CHARACTER::DeathPenalty(BYTE bTown) { - sys_log(1, "DEATH_PERNALY_CHECK(%s) town(%d)", GetName(), bTown); + SPDLOG_DEBUG("DEATH_PERNALY_CHECK({}) town({})", GetName(), bTown); Cube_close(this); @@ -289,14 +285,14 @@ void CHARACTER::DeathPenalty(BYTE bTown) if (GetLevel() < 10) { - sys_log(0, "NO_DEATH_PENALTY_LESS_LV10(%s)", GetName()); + SPDLOG_DEBUG("NO_DEATH_PENALTY_LESS_LV10({})", GetName()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ë½ÅÀÇ °¡È£·Î °æÇèÄ¡°¡ ¶³¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù.")); return; } if (Random::get(0, 2)) { - sys_log(0, "NO_DEATH_PENALTY_LUCK(%s)", GetName()); + SPDLOG_DEBUG("NO_DEATH_PENALTY_LUCK({})", GetName()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ë½ÅÀÇ °¡È£·Î °æÇèÄ¡°¡ ¶³¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù.")); return; } @@ -310,7 +306,7 @@ void CHARACTER::DeathPenalty(BYTE bTown) { if (FindAffect(AFFECT_NO_DEATH_PENALTY)) { - sys_log(0, "NO_DEATH_PENALTY_AFFECT(%s)", GetName()); + SPDLOG_DEBUG("NO_DEATH_PENALTY_AFFECT({})", GetName()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ë½ÅÀÇ °¡È£·Î °æÇèÄ¡°¡ ¶³¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù.")); RemoveAffect(AFFECT_NO_DEATH_PENALTY); return; @@ -320,7 +316,7 @@ void CHARACTER::DeathPenalty(BYTE bTown) { if (FindAffect(AFFECT_NO_DEATH_PENALTY)) { - sys_log(0, "NO_DEATH_PENALTY_AFFECT(%s)", GetName()); + SPDLOG_DEBUG("NO_DEATH_PENALTY_AFFECT({})", GetName()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ë½ÅÀÇ °¡È£·Î °æÇèÄ¡°¡ ¶³¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù.")); RemoveAffect(AFFECT_NO_DEATH_PENALTY); return; @@ -361,7 +357,7 @@ void CHARACTER::DeathPenalty(BYTE bTown) if (IsEquipUniqueItem(UNIQUE_ITEM_TEARDROP_OF_GODNESS)) iLoss /= 2; - sys_log(0, "DEATH_PENALTY(%s) EXP_LOSS: %d percent %d%%", GetName(), iLoss, aiExpLossPercents[std::min(gPlayerMaxLevel, GetLevel())]); + SPDLOG_DEBUG("DEATH_PENALTY({}) EXP_LOSS: {} percent {}%", GetName(), iLoss, aiExpLossPercents[std::min(gPlayerMaxLevel, GetLevel())]); PointChange(POINT_EXP, -iLoss, true); } @@ -381,7 +377,7 @@ EVENTFUNC(StunEvent) if ( info == NULL ) { - sys_err( "StunEvent> Null pointer" ); + SPDLOG_ERROR("StunEvent> Null pointer" ); return 0; } @@ -408,7 +404,7 @@ void CHARACTER::Stun() m_pkParty->SendMessage(this, PM_ATTACKED_BY, 0, 0); } - sys_log(1, "%s: Stun %p", GetName(), this); + SPDLOG_DEBUG("{}: Stun {}", GetName(), (void*) this); PointChange(POINT_HP_RECOVERY, -GetPoint(POINT_HP_RECOVERY)); PointChange(POINT_SP_RECOVERY, -GetPoint(POINT_SP_RECOVERY)); @@ -452,7 +448,7 @@ EVENTFUNC(dead_event) if ( info == NULL ) { - sys_err( "dead_event> Null pointer" ); + SPDLOG_ERROR("dead_event> Null pointer" ); return 0; } @@ -469,7 +465,7 @@ EVENTFUNC(dead_event) if (NULL == ch) { - sys_err("DEAD_EVENT: cannot find char pointer with %s id(%d)", info->isPC ? "PC" : "MOB", info->dwID ); + SPDLOG_ERROR("DEAD_EVENT: cannot find char pointer with {} id({})", info->isPC ? "PC" : "MOB", info->dwID ); return 0; } @@ -487,7 +483,7 @@ EVENTFUNC(dead_event) ch->WarpSet(pos.x, pos.y); else { - sys_err("cannot find spawn position (name %s)", ch->GetName()); + SPDLOG_ERROR("cannot find spawn position (name {})", ch->GetName()); ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire())); } @@ -619,8 +615,7 @@ void CHARACTER::RewardGold(LPCHARACTER pkAttacker) for (int i = 0; i < iSplitCount; ++i) { int iGold = Random::get(GetMobTable().dwGoldMin, GetMobTable().dwGoldMax) / iSplitCount; - if (test_server) - sys_log(0, "iGold %d", iGold); + SPDLOG_TRACE("iGold {}", iGold); iGold = iGold * CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker) / 100; iGold *= iGoldMultipler; @@ -629,11 +624,8 @@ void CHARACTER::RewardGold(LPCHARACTER pkAttacker) continue ; } - if (test_server) - { - sys_log(0, "Drop Moeny MobGoldAmountRate %d %d", CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker), iGoldMultipler); - sys_log(0, "Drop Money gold %d GoldMin %d GoldMax %d", iGold, GetMobTable().dwGoldMax, GetMobTable().dwGoldMax); - } + SPDLOG_TRACE("Drop Moeny MobGoldAmountRate {} {}", CHARACTER_MANAGER::instance().GetMobGoldAmountRate(pkAttacker), iGoldMultipler); + SPDLOG_TRACE("Drop Money gold {} GoldMin {} GoldMax {}", iGold, GetMobTable().dwGoldMax, GetMobTable().dwGoldMax); // NOTE: µ· ÆøźÀº Á¦ 3ÀÇ ¼Õ 󸮸¦ ÇÏÁö ¾ÊÀ½ if ((item = ITEM_MANAGER::instance().CreateItem(1, iGold))) @@ -741,7 +733,7 @@ void CHARACTER::Reward(bool bItemDrop) iGold *= GetGoldMultipler(); int iSplitCount = Random::get(25, 35); - sys_log(0, "WAEGU Dead gold %d split %d", iGold, iSplitCount); + SPDLOG_TRACE("WAEGU Dead gold {} split {}", iGold, iSplitCount); for (int i = 1; i <= iSplitCount; ++i) { @@ -818,8 +810,7 @@ void CHARACTER::Reward(bool bItemDrop) // µ· µå·Ó // //PROF_UNIT pu2("r2"); - if (test_server) - sys_log(0, "Drop money : Attacker %s", pkAttacker->GetName()); + SPDLOG_TRACE("Drop money : Attacker {}", pkAttacker->GetName()); RewardGold(pkAttacker); //pu2.Pop(); @@ -852,7 +843,7 @@ void CHARACTER::Reward(bool bItemDrop) pos.x += GetX(); pos.y += GetY(); - sys_log(0, "DROP_ITEM: %s %d %d from %s", item->GetName(), pos.x, pos.y, GetName()); + SPDLOG_DEBUG("DROP_ITEM: {} {} {} from {}", item->GetName(), pos.x, pos.y, GetName()); } else { @@ -894,7 +885,7 @@ void CHARACTER::Reward(bool bItemDrop) if (!item) { - sys_err("item null in vector idx %d", iItemIdx + 1); + SPDLOG_ERROR("item null in vector idx {}", iItemIdx + 1); continue; } @@ -908,7 +899,7 @@ void CHARACTER::Reward(bool bItemDrop) pos.x += GetX(); pos.y += GetY(); - sys_log(0, "DROP_ITEM: %s %d %d by %s", item->GetName(), pos.x, pos.y, GetName()); + SPDLOG_DEBUG("DROP_ITEM: {} {} {} by {}", item->GetName(), pos.x, pos.y, GetName()); } } else @@ -922,7 +913,7 @@ void CHARACTER::Reward(bool bItemDrop) if (!item) { - sys_err("item null in vector idx %d", iItemIdx + 1); + SPDLOG_ERROR("item null in vector idx {}", iItemIdx + 1); continue; } @@ -950,7 +941,7 @@ void CHARACTER::Reward(bool bItemDrop) pos.x += GetX(); pos.y += GetY(); - sys_log(0, "DROP_ITEM: %s %d %d by %s", item->GetName(), pos.x, pos.y, GetName()); + SPDLOG_DEBUG("DROP_ITEM: {} {} {} by {}", item->GetName(), pos.x, pos.y, GetName()); } } } @@ -1029,7 +1020,7 @@ void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller) bool isDropAllEquipments = false; TItemDropPenalty & r = table[iAlignIndex]; - sys_log(0, "%s align %d inven_pct %d equip_pct %d", GetName(), iAlignIndex, r.iInventoryPct, r.iEquipmentPct); + SPDLOG_DEBUG("{} align {} inven_pct {} equip_pct {}", GetName(), iAlignIndex, r.iInventoryPct, r.iEquipmentPct); bool bDropInventory = r.iInventoryPct >= Random::get(1, 1000); bool bDropEquipment = r.iEquipmentPct >= Random::get(1, 100); @@ -1144,7 +1135,7 @@ void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller) item->AddToGround(GetMapIndex(), pos); item->StartDestroyEvent(); - sys_log(0, "DROP_ITEM_PK: %s %d %d from %s", item->GetName(), pos.x, pos.y, GetName()); + SPDLOG_DEBUG("DROP_ITEM_PK: {} {} {} from {}", item->GetName(), pos.x, pos.y, GetName()); LogManager::instance().ItemLog(this, item, "DEAD_DROP", (window == INVENTORY) ? "INVENTORY" : ((window == EQUIPMENT) ? "EQUIPMENT" : "")); pos.x = GetX() + Random::get(-7, 7) * 20; @@ -1294,14 +1285,14 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead) { if (!isForked) { - sys_log(1, "DEAD: %s %p WITH PENALTY", GetName(), this); + SPDLOG_DEBUG("DEAD: {} {} WITH PENALTY", GetName(), (void*) this); SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_DEATH_PENALTY); LogManager::instance().CharLog(this, pkKiller->GetRaceNum(), "DEAD_BY_NPC", pkKiller->GetName()); } } else { - sys_log(1, "DEAD_BY_PC: %s %p KILLER %s %p", GetName(), this, pkKiller->GetName(), get_pointer(pkKiller)); + SPDLOG_DEBUG("DEAD_BY_PC: {} {} KILLER {} {}", GetName(), (void*) this, pkKiller->GetName(), (void*) get_pointer(pkKiller)); REMOVE_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_DEATH_PENALTY); if (GetEmpire() != pkKiller->GetEmpire()) @@ -1351,7 +1342,7 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead) pkKiller->UpdateAlignment(-20000); else { - sys_log(0, "ALIGNMENT PARTY count %d amount %d", f.m_iCount, f.m_iAmount); + SPDLOG_DEBUG("ALIGNMENT PARTY count {} amount {}", f.m_iCount, f.m_iAmount); f.m_iStep = 1; pkKiller->GetParty()->ForEachOnlineMember(f); @@ -1374,13 +1365,12 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead) } else { - sys_log(1, "DEAD: %s %p", GetName(), this); + SPDLOG_DEBUG("DEAD: {} {}", GetName(), (void*) this); REMOVE_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_DEATH_PENALTY); } ClearSync(); - //sys_log(1, "stun cancel %s[%d]", GetName(), (DWORD)GetVID()); event_cancel(&m_pkStunEvent); // ±âÀý À̺¥Æ®´Â Á×ÀδÙ. if (IsPC()) @@ -1469,7 +1459,7 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead) { if (m_pkDeadEvent) { - sys_log(1, "DEAD_EVENT_CANCEL: %s %p %p", GetName(), this, get_pointer(m_pkDeadEvent)); + SPDLOG_DEBUG("DEAD_EVENT_CANCEL: {} {} {}", GetName(), (void*) this, (void*) get_pointer(m_pkDeadEvent)); event_cancel(&m_pkDeadEvent); } @@ -1505,7 +1495,7 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead) } } - sys_log(1, "DEAD_EVENT_CREATE: %s %p %p", GetName(), this, get_pointer(m_pkDeadEvent)); + SPDLOG_DEBUG("DEAD_EVENT_CREATE: {} {} {}", GetName(), (void*) this, (void*) get_pointer(m_pkDeadEvent)); } if (m_pkExchange != NULL) @@ -1530,7 +1520,7 @@ void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead) } else { - sys_err("DragonLair: Dragon killed by nobody"); + SPDLOG_ERROR("DragonLair: Dragon killed by nobody"); } } } @@ -1641,7 +1631,7 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu DWORD dwGold = 1000; int iSplitCount = Random::get(10, 13); - sys_log(0, "WAEGU DropGoldOnHit %d times", GetMaxSP()); + SPDLOG_TRACE("WAEGU DropGoldOnHit {} times", GetMaxSP()); for (int i = 1; i <= iSplitCount; ++i) { @@ -2471,14 +2461,12 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp) } */ - if (test_server) - { - sys_log(0, "Bonus Exp : Ramadan Candy: %d MallExp: %d PointExp: %d", - to->GetPoint(POINT_RAMADAN_CANDY_BONUS_EXP), - to->GetPoint(POINT_MALL_EXPBONUS), - to->GetPoint(POINT_EXP) - ); - } + + SPDLOG_TRACE("Bonus Exp : Ramadan Candy: {} MallExp: {} PointExp: {}", + to->GetPoint(POINT_RAMADAN_CANDY_BONUS_EXP), + to->GetPoint(POINT_MALL_EXPBONUS), + to->GetPoint(POINT_EXP) + ); // ±âȹÃø Á¶Á¤°ª 2005.04.21 ÇöÀç 85% iExp = iExp * CHARACTER_MANAGER::instance().GetMobExpRate(to) / 100; @@ -2581,7 +2569,7 @@ namespace NPartyExpDistribute break; default: - sys_err("Unknown party exp distribution mode %d", m_iMode); + SPDLOG_ERROR("Unknown party exp distribution mode {}", m_iMode); return; } @@ -2705,8 +2693,6 @@ LPCHARACTER CHARACTER::DistributeExp() di.pAttacker = pAttacker; di.pParty = NULL; - //sys_log(0, "__ pq_damage %s %d", pAttacker->GetName(), iDam); - //pq_damage.push(di); damage_info_table.push_back(di); } } @@ -2714,7 +2700,6 @@ LPCHARACTER CHARACTER::DistributeExp() for (std::map::iterator it = map_party_damage.begin(); it != map_party_damage.end(); ++it) { damage_info_table.push_back(it->second); - //sys_log(0, "__ pq_damage_party [%u] %d", it->second.pParty->GetLeaderPID(), it->second.iDam); } SetExp(0); @@ -2725,16 +2710,13 @@ LPCHARACTER CHARACTER::DistributeExp() if (m_pkChrStone) // µ¹ÀÌ ÀÖÀ» °æ¿ì °æÇèÄ¡ÀÇ ¹ÝÀ» µ¹¿¡°Ô ³Ñ±ä´Ù. { - //sys_log(0, "__ Give half to Stone : %d", iExpToDistribute>>1); int iExp = iExpToDistribute >> 1; m_pkChrStone->SetExp(m_pkChrStone->GetExp() + iExp); iExpToDistribute -= iExp; } - sys_log(1, "%s total exp: %d, damage_info_table.size() == %d, TotalDam %d", + SPDLOG_DEBUG("{} total exp: {}, damage_info_table.size() == {}, TotalDam {}", GetName(), iExpToDistribute, damage_info_table.size(), iTotalDam); - //sys_log(1, "%s total exp: %d, pq_damage.size() == %d, TotalDam %d", - //GetName(), iExpToDistribute, pq_damage.size(), iTotalDam); if (damage_info_table.empty()) return NULL; @@ -2762,14 +2744,12 @@ LPCHARACTER CHARACTER::DistributeExp() if (fPercent > 1.0f) { - sys_err("DistributeExp percent over 1.0 (fPercent %f name %s)", fPercent, di->pAttacker->GetName()); + SPDLOG_ERROR("DistributeExp percent over 1.0 (fPercent {} name {})", fPercent, di->pAttacker->GetName()); fPercent = 1.0f; } iExp += (int) (iExpToDistribute * fPercent); - //sys_log(0, "%s given exp percent %.1f + 20 dam %d", GetName(), fPercent * 100.0f, di.iDam); - di->Distribute(this, iExp); // 100% ´Ù ¸Ô¾úÀ¸¸é ¸®ÅÏÇÑ´Ù. @@ -2791,11 +2771,10 @@ LPCHARACTER CHARACTER::DistributeExp() if (fPercent > 1.0f) { - sys_err("DistributeExp percent over 1.0 (fPercent %f name %s)", fPercent, di.pAttacker->GetName()); + SPDLOG_ERROR("DistributeExp percent over 1.0 (fPercent {} name {})", fPercent, di.pAttacker->GetName()); fPercent = 1.0f; } - //sys_log(0, "%s given exp percent %.1f dam %d", GetName(), fPercent * 100.0f, di.iDam); di.Distribute(this, (int) (iExpToDistribute * fPercent)); } } @@ -2840,7 +2819,7 @@ void CHARACTER::UseArrow(LPITEM pkArrow, DWORD dwArrowCount) { LPITEM pkNewArrow = FindSpecifyItem(dwVnum); - sys_log(0, "UseArrow : FindSpecifyItem %u %p", dwVnum, get_pointer(pkNewArrow)); + SPDLOG_DEBUG("UseArrow : FindSpecifyItem {} {}", dwVnum, (void*) get_pointer(pkNewArrow)); if (pkNewArrow) EquipItem(pkNewArrow); @@ -2926,8 +2905,6 @@ class CFuncShoot // µ¥¹ÌÁö °è»ê iDam = iDam * (100 - pkVictim->GetPoint(POINT_RESIST_BOW)) / 100; - //sys_log(0, "%s arrow %s dam %d", m_me->GetName(), pkVictim->GetName(), iDam); - m_me->OnMove(true); pkVictim->OnMove(); @@ -2953,8 +2930,6 @@ class CFuncShoot // µ¥¹ÌÁö °è»ê iDam = iDam * (100 - pkVictim->GetPoint(POINT_RESIST_MAGIC)) / 100; - //sys_log(0, "%s arrow %s dam %d", m_me->GetName(), pkVictim->GetName(), iDam); - m_me->OnMove(true); pkVictim->OnMove(); @@ -3007,7 +2982,7 @@ class CFuncShoot if (pkVictim->CanBeginFight()) pkVictim->BeginFight(m_me); - sys_log(0, "%s kwankeyok %s", m_me->GetName(), pkVictim->GetName()); + SPDLOG_DEBUG("{} kwankeyok {}", m_me->GetName(), pkVictim->GetName()); m_me->ComputeSkill(m_bType, pkVictim); m_me->UseArrow(pkArrow, iUseArrow); } @@ -3025,7 +3000,7 @@ class CFuncShoot if (pkVictim->CanBeginFight()) pkVictim->BeginFight(m_me); - sys_log(0, "%s gigung %s", m_me->GetName(), pkVictim->GetName()); + SPDLOG_DEBUG("{} gigung {}", m_me->GetName(), pkVictim->GetName()); m_me->ComputeSkill(m_bType, pkVictim); m_me->UseArrow(pkArrow, iUseArrow); } @@ -3043,7 +3018,7 @@ class CFuncShoot if (pkVictim->CanBeginFight()) pkVictim->BeginFight(m_me); - sys_log(0, "%s hwajo %s", m_me->GetName(), pkVictim->GetName()); + SPDLOG_DEBUG("{} hwajo {}", m_me->GetName(), pkVictim->GetName()); m_me->ComputeSkill(m_bType, pkVictim); m_me->UseArrow(pkArrow, iUseArrow); } @@ -3062,7 +3037,7 @@ class CFuncShoot if (pkVictim->CanBeginFight()) pkVictim->BeginFight(m_me); - sys_log(0, "%s horse_wildattack %s", m_me->GetName(), pkVictim->GetName()); + SPDLOG_DEBUG("{} horse_wildattack {}", m_me->GetName(), pkVictim->GetName()); m_me->ComputeSkill(m_bType, pkVictim); m_me->UseArrow(pkArrow, iUseArrow); } @@ -3087,7 +3062,7 @@ class CFuncShoot if (pkVictim->CanBeginFight()) pkVictim->BeginFight(m_me); - sys_log(0, "%s - Skill %d -> %s", m_me->GetName(), m_bType, pkVictim->GetName()); + SPDLOG_DEBUG("{} - Skill {} -> {}", m_me->GetName(), m_bType, pkVictim->GetName()); m_me->ComputeSkill(m_bType, pkVictim); } break; @@ -3100,7 +3075,7 @@ class CFuncShoot if (pkVictim->CanBeginFight()) pkVictim->BeginFight(m_me); - sys_log(0, "%s - Skill %d -> %s", m_me->GetName(), m_bType, pkVictim->GetName()); + SPDLOG_DEBUG("{} - Skill {} -> {}", m_me->GetName(), m_bType, pkVictim->GetName()); m_me->ComputeSkill(m_bType, pkVictim); // TODO ¿©·¯¸í¿¡°Ô ½µ ½µ ½µ Çϱâ @@ -3128,7 +3103,7 @@ class CFuncShoot break;*/ default: - sys_err("CFuncShoot: I don't know this type [%d] of range attack.", (int) m_bType); + SPDLOG_ERROR("CFuncShoot: I don't know this type [{}] of range attack.", (int) m_bType); break; } @@ -3138,7 +3113,7 @@ class CFuncShoot bool CHARACTER::Shoot(BYTE bType) { - sys_log(1, "Shoot %s type %u flyTargets.size %zu", GetName(), bType, m_vec_dwFlyTargets.size()); + SPDLOG_DEBUG("Shoot {} type {} flyTargets.size {}", GetName(), bType, m_vec_dwFlyTargets.size()); if (!CanMove()) { @@ -3186,7 +3161,7 @@ void CHARACTER::FlyTarget(DWORD dwTargetVID, int x, int y, BYTE bHeader) pack.y = y; } - sys_log(1, "FlyTarget %s vid %d x %d y %d", GetName(), pack.dwTargetVID, pack.x, pack.y); + SPDLOG_DEBUG("FlyTarget {} vid {} x {} y {}", GetName(), pack.dwTargetVID, pack.x, pack.y); PacketAround(&pack, sizeof(pack), this); } @@ -3326,7 +3301,7 @@ void CHARACTER::SetKillerMode(bool isOn) m_iKillerModePulse = thecore_pulse(); UpdatePacket(); - sys_log(0, "SetKillerMode Update %s[%d]", GetName(), GetPlayerID()); + SPDLOG_DEBUG("SetKillerMode Update {}[{}]", GetName(), GetPlayerID()); } bool CHARACTER::IsKillerMode() const @@ -3359,7 +3334,7 @@ void CHARACTER::SetPKMode(BYTE bPKMode) m_bPKMode = bPKMode; UpdatePacket(); - sys_log(0, "PK_MODE: %s %d", GetName(), m_bPKMode); + SPDLOG_DEBUG("PK_MODE: {} {}", GetName(), m_bPKMode); } BYTE CHARACTER::GetPKMode() const @@ -3562,7 +3537,6 @@ void CHARACTER::UpdateAggrPointEx(LPCHARACTER pAttacker, EDamageType type, int d if (info.iAggro < 0) info.iAggro = 0; - //sys_log(0, "UpdateAggrPointEx for %s by %s dam %d total %d", GetName(), pAttacker->GetName(), dam, total); if (GetParty() && dam > 0 && type != DAMAGE_TYPE_SPECIAL) { LPPARTY pParty = GetParty(); diff --git a/src/game/src/char_dragonsoul.cpp b/src/game/src/char_dragonsoul.cpp index e561447..98de574 100644 --- a/src/game/src/char_dragonsoul.cpp +++ b/src/game/src/char_dragonsoul.cpp @@ -125,7 +125,7 @@ bool CHARACTER::DragonSoul_RefineWindow_Open(LPENTITY pEntity) if (NULL == d) { - sys_err ("User(%s)'s DESC is NULL POINT.", GetName()); + SPDLOG_ERROR("User({})'s DESC is NULL POINT.", GetName()); return false; } diff --git a/src/game/src/char_horse.cpp b/src/game/src/char_horse.cpp index 4ec44dd..c7a1404 100644 --- a/src/game/src/char_horse.cpp +++ b/src/game/src/char_horse.cpp @@ -62,8 +62,7 @@ bool CHARACTER::StartRiding() MountVnum(dwMountVnum); - if(test_server) - sys_log(0, "Ride Horse : %s ", GetName()); + SPDLOG_TRACE("Ride Horse : {} ", GetName()); return true; } @@ -106,7 +105,7 @@ EVENTFUNC(horse_dead_event) if ( info == NULL ) { - sys_err( "horse_dead_event> Null pointer" ); + SPDLOG_ERROR("horse_dead_event> Null pointer" ); return 0; } @@ -151,7 +150,7 @@ void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const cha if (IsRiding()) return; - sys_log(0, "HorseSummon : %s lv:%d bSummon:%d fromFar:%d", GetName(), GetLevel(), bSummon, bFromFar); + SPDLOG_DEBUG("HorseSummon : {} lv:{} bSummon:{} fromFar:{}", GetName(), GetLevel(), bSummon, bFromFar); int x = GetX(); int y = GetY(); @@ -210,7 +209,7 @@ void CHARACTER::HorseSummon(bool bSummon, bool bFromFar, DWORD dwVnum, const cha if (!m_chHorse->Show(GetMapIndex(), x, y, GetZ())) { M2_DESTROY_CHARACTER(m_chHorse); - sys_err("cannot show monster"); + SPDLOG_ERROR("cannot show monster"); m_chHorse = NULL; return; } diff --git a/src/game/src/char_item.cpp b/src/game/src/char_item.cpp index 9ca9b3b..0992df7 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 "dev_log.h" #include "pcbang.h" #include "threeway_war.h" @@ -246,14 +245,14 @@ LPITEM CHARACTER::GetItem(TItemPos Cell) const case EQUIPMENT: if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX) { - sys_err("CHARACTER::GetInventoryItem: invalid item cell %d", wCell); + SPDLOG_ERROR("CHARACTER::GetInventoryItem: invalid item cell {}", wCell); return NULL; } return m_pointsInstant.pItems[wCell]; case DRAGON_SOUL_INVENTORY: if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) { - sys_err("CHARACTER::GetInventoryItem: invalid DS item cell %d", wCell); + SPDLOG_ERROR("CHARACTER::GetInventoryItem: invalid DS item cell {}", wCell); return NULL; } return m_pointsInstant.pDSItems[wCell]; @@ -270,7 +269,7 @@ void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem) BYTE window_type = Cell.window_type; if ((unsigned long)((CItem*)pItem) == 0xff || (unsigned long)((CItem*)pItem) == 0xffffffff) { - sys_err("!!! FATAL ERROR !!! item == 0xff (char: %s cell: %u)", GetName(), wCell); + SPDLOG_ERROR("!!! FATAL ERROR !!! item == 0xff (char: {} cell: {})", GetName(), wCell); core_dump(); return; } @@ -288,7 +287,7 @@ void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem) { if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX) { - sys_err("CHARACTER::SetItem: invalid item cell %d", wCell); + SPDLOG_ERROR("CHARACTER::SetItem: invalid item cell {}", wCell); return; } @@ -368,7 +367,7 @@ void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem) { if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) { - sys_err("CHARACTER::SetItem: invalid DS item cell %d", wCell); + SPDLOG_ERROR("CHARACTER::SetItem: invalid DS item cell {}", wCell); return; } @@ -394,7 +393,7 @@ void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem) } break; default: - sys_err ("Invalid Inventory type %d", window_type); + SPDLOG_ERROR("Invalid Inventory type {}", window_type); return; } @@ -457,7 +456,7 @@ LPITEM CHARACTER::GetWear(BYTE bCell) const // > WEAR_MAX_NUM : ¿ëÈ¥¼® ½½·Ôµé. if (bCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX) { - sys_err("CHARACTER::GetWear: invalid wear cell %d", bCell); + SPDLOG_ERROR("CHARACTER::GetWear: invalid wear cell {}", bCell); return NULL; } @@ -469,7 +468,7 @@ void CHARACTER::SetWear(BYTE bCell, LPITEM item) // > WEAR_MAX_NUM : ¿ëÈ¥¼® ½½·Ôµé. if (bCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX) { - sys_err("CHARACTER::SetItem: invalid item cell %d", bCell); + SPDLOG_ERROR("CHARACTER::SetItem: invalid item cell {}", bCell); return; } @@ -815,7 +814,7 @@ bool CHARACTER::DoRefine(LPITEM item, bool bMoneyOnly) { if (get_global_time() < quest::CQuestManager::instance().GetEventFlag("update_refine_time") + (60 * 5)) { - sys_log(0, "can't refine %d %s", GetPlayerID(), GetName()); + SPDLOG_DEBUG("can't refine {} {}", GetPlayerID(), GetName()); return false; } } @@ -858,7 +857,7 @@ bool CHARACTER::DoRefine(LPITEM item, bool bMoneyOnly) if (!pProto) { - sys_err("DoRefine NOT GET ITEM PROTO %d", item->GetRefinedVnum()); + SPDLOG_ERROR("DoRefine NOT GET ITEM PROTO {}", item->GetRefinedVnum()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } @@ -937,18 +936,18 @@ bool CHARACTER::DoRefine(LPITEM item, bool bMoneyOnly) pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell)); ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem); - sys_log(0, "Refine Success %d", cost); + SPDLOG_DEBUG("Refine Success {}", cost); pkNewItem->AttrLog(); //PointChange(POINT_GOLD, -cost); - sys_log(0, "PayPee %d", cost); + SPDLOG_DEBUG("PayPee {}", cost); PayRefineFee(cost); - sys_log(0, "PayPee End %d", cost); + SPDLOG_DEBUG("PayPee End {}", cost); } else { // DETAIL_REFINE_LOG // ¾ÆÀÌÅÛ »ý¼º¿¡ ½ÇÆÐ -> °³·® ½ÇÆзΠ°£ÁÖ - sys_err("cannot create item %u", result_vnum); + SPDLOG_ERROR("cannot create item {}", result_vnum); NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER"); // END_OF_DETAIL_REFINE_LOG } @@ -995,7 +994,7 @@ bool CHARACTER::DoRefineWithScroll(LPITEM item) { if (get_global_time() < quest::CQuestManager::instance().GetEventFlag("update_refine_time") + (60 * 5)) { - sys_log(0, "can't refine %d %s", GetPlayerID(), GetName()); + SPDLOG_DEBUG("can't refine {} {}", GetPlayerID(), GetName()); return false; } } @@ -1063,7 +1062,7 @@ bool CHARACTER::DoRefineWithScroll(LPITEM item) if (!pProto) { - sys_err("DoRefineWithScroll NOT GET ITEM PROTO %d", item->GetRefinedVnum()); + SPDLOG_ERROR("DoRefineWithScroll NOT GET ITEM PROTO {}", item->GetRefinedVnum()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } @@ -1142,7 +1141,7 @@ bool CHARACTER::DoRefineWithScroll(LPITEM item) } else { - sys_err("REFINE : Unknown refine scroll item. Value0: %d", pkItemScroll->GetValue(0)); + SPDLOG_ERROR("REFINE : Unknown refine scroll item. Value0: {}", pkItemScroll->GetValue(0)); } if (test_server) @@ -1214,7 +1213,7 @@ bool CHARACTER::DoRefineWithScroll(LPITEM item) else { // ¾ÆÀÌÅÛ »ý¼º¿¡ ½ÇÆÐ -> °³·® ½ÇÆзΠ°£ÁÖ - sys_err("cannot create item %u", result_vnum); + SPDLOG_ERROR("cannot create item {}", result_vnum); NotifyRefineFail(this, item, szRefineType); } } @@ -1245,7 +1244,7 @@ bool CHARACTER::DoRefineWithScroll(LPITEM item) else { // ¾ÆÀÌÅÛ »ý¼º¿¡ ½ÇÆÐ -> °³·® ½ÇÆзΠ°£ÁÖ - sys_err("cannot create item %u", result_fail_vnum); + SPDLOG_ERROR("cannot create item {}", result_fail_vnum); NotifyRefineFail(this, item, szRefineType); } } @@ -1287,7 +1286,7 @@ bool CHARACTER::RefineInformation(BYTE bCell, BYTE bType, int iAdditionalCell) if (p.result_vnum == 0) { - sys_err("RefineInformation p.result_vnum == 0"); + SPDLOG_ERROR("RefineInformation p.result_vnum == 0"); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } @@ -1317,7 +1316,7 @@ bool CHARACTER::RefineInformation(BYTE bCell, BYTE bType, int iAdditionalCell) if (!prt) { - sys_err("RefineInformation NOT GET REFINE SET %d", item->GetRefineSet()); + SPDLOG_ERROR("RefineInformation NOT GET REFINE SET {}", item->GetRefineSet()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } @@ -1433,7 +1432,7 @@ EVENTFUNC(kill_campfire_event) if ( info == NULL ) { - sys_err( "kill_campfire_event> Null pointer" ); + SPDLOG_ERROR("kill_campfire_event> Null pointer" ); return 0; } @@ -1550,7 +1549,7 @@ void CHARACTER::ProcessRecallItem(LPITEM item) } else { - sys_log(1, "Recall: %s %d %d -> %d %d", GetName(), GetX(), GetY(), item->GetSocket(0), item->GetSocket(1)); + SPDLOG_DEBUG("Recall: {} {} {} -> {} {}", GetName(), GetX(), GetY(), item->GetSocket(0), item->GetSocket(1)); WarpSet(item->GetSocket(0), item->GetSocket(1)); item->SetCount(item->GetCount() - 1); } @@ -1578,7 +1577,7 @@ void CHARACTER::SendMyShopPriceListCmd(DWORD dwItemVnum, DWORD dwItemPrice) char szLine[256]; snprintf(szLine, sizeof(szLine), "MyShopPriceList %u %u", dwItemVnum, dwItemPrice); ChatPacket(CHAT_TYPE_COMMAND, szLine); - sys_log(0, szLine); + SPDLOG_DEBUG(szLine); } // @@ -1696,10 +1695,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) } } - if (test_server) - { - sys_log(0, "USE_ITEM %s, Inven %d, Cell %d, ItemType %d, SubType %d", item->GetName(), bDestInven, wDestCell, item->GetType(), item->GetSubType()); - } + SPDLOG_TRACE("USE_ITEM {}, Inven {}, Cell {}, ItemType {}, SubType {}", item->GetName(), bDestInven, wDestCell, item->GetType(), item->GetSubType()); if ( CArenaManager::instance().IsLimitedItem( GetMapIndex(), item->GetVnum() ) == true ) { @@ -1854,7 +1850,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) { if (item->GetSubType() == USE_SPECIAL) { - sys_log(0, "ITEM_UNIQUE: USE_SPECIAL %u", item->GetVnum()); + SPDLOG_DEBUG("ITEM_UNIQUE: USE_SPECIAL {}", item->GetVnum()); switch (item->GetVnum()) { @@ -2166,8 +2162,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) { if (item->GetVnum() > 50800 && item->GetVnum() <= 50820) { - if (test_server) - sys_log (0, "ADD addtional effect : vnum(%d) subtype(%d)", item->GetOriginalVnum(), item->GetSubType()); + SPDLOG_TRACE("ADD addtional effect : vnum({}) subtype({})", item->GetOriginalVnum(), item->GetSubType()); int affect_type = AFFECT_EXP_BONUS_EURO_FREE; int apply_type = aApplyInfo[item->GetValue(0)].bPointType; @@ -2355,10 +2350,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) } } - if (test_server) - { - sys_log (0, "USE_ITEM %s Type %d SubType %d vnum %d", item->GetName(), item->GetType(), item->GetSubType(), item->GetOriginalVnum()); - } + SPDLOG_TRACE("USE_ITEM {} Type {} SubType {} vnum {}", item->GetName(), item->GetType(), item->GetSubType(), item->GetOriginalVnum()); switch (item->GetSubType()) { @@ -3408,7 +3400,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) int delta = std::min(-GetAlignment(), item->GetValue(0)); - sys_log(0, "%s ALIGNMENT ITEM %d", GetName(), delta); + SPDLOG_DEBUG("{} ALIGNMENT ITEM {}", GetName(), delta); UpdateAlignment(delta); item->SetCount(item->GetCount() - 1); @@ -4387,7 +4379,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) } else { - sys_err("CHARACTER::UseItem : cannot find spawn position (name %s, %d x %d)", GetName(), GetX(), GetY()); + SPDLOG_ERROR("CHARACTER::UseItem : cannot find spawn position (name {}, {} x {})", GetName(), GetX(), GetY()); } } else @@ -4758,7 +4750,7 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) else { // wtf ?! - sys_err("ADD_ATTRIBUTE2 : Item has wrong AttributeCount(%d)", item2->GetAttributeCount()); + SPDLOG_ERROR("ADD_ATTRIBUTE2 : Item has wrong AttributeCount({})", item2->GetAttributeCount()); } break; @@ -5081,13 +5073,13 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) case ITEM_BLEND: // »õ·Î¿î ¾àÃʵé - sys_log(0,"ITEM_BLEND!!"); + SPDLOG_DEBUG("ITEM_BLEND!!"); if (Blend_Item_find(item->GetVnum())) { int affect_type = AFFECT_BLEND; if (item->GetSocket(0) >= _countof(aApplyInfo)) { - sys_err ("INVALID BLEND ITEM(id : %d, vnum : %d). APPLY TYPE IS %d.", item->GetID(), item->GetVnum(), item->GetSocket(0)); + SPDLOG_ERROR("INVALID BLEND ITEM(id : {}, vnum : {}). APPLY TYPE IS {}.", item->GetID(), item->GetVnum(), item->GetSocket(0)); return false; } int apply_type = aApplyInfo[item->GetSocket(0)].bPointType; @@ -5140,11 +5132,11 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) break; case ITEM_NONE: - sys_err("Item type NONE %s", item->GetName()); + SPDLOG_ERROR("Item type NONE {}", item->GetName()); break; default: - sys_log(0, "UseItemEx: Unknown type %s %d", item->GetName(), item->GetType()); + SPDLOG_WARN("UseItemEx: Unknown type {} {}", item->GetName(), item->GetType()); return false; } @@ -5167,7 +5159,7 @@ bool CHARACTER::UseItem(TItemPos Cell, TItemPos DestCell) if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell))) return false; - sys_log(0, "%s: USE_ITEM %s (inven %d, cell: %d)", GetName(), item->GetName(), window_type, wCell); + SPDLOG_DEBUG("{}: USE_ITEM {} (inven {}, cell: {})", GetName(), item->GetName(), window_type, wCell); if (item->IsExchanging()) return false; @@ -5391,8 +5383,7 @@ bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount) { if (bCount == 0) { - if (test_server) - sys_log(0, "[DROP_ITEM] drop item count == 0"); + SPDLOG_TRACE("[DROP_ITEM] drop item count == 0"); return false; } @@ -5594,7 +5585,7 @@ bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count) if (count == 0) count = item->GetCount(); - sys_log(0, "%s: ITEM_STACK %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell, + SPDLOG_DEBUG("{}: ITEM_STACK {} (window: {}, cell : {}) -> (window:{}, cell {}) count {}", GetName(), item->GetName(), Cell.window_type, Cell.cell, DestCell.window_type, DestCell.cell, count); count = std::min(200 - item2->GetCount(), count); @@ -5609,7 +5600,7 @@ bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count) if (count == 0 || count >= item->GetCount() || !item->IsStackable() || IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { - sys_log(0, "%s: ITEM_MOVE %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell, + SPDLOG_DEBUG("{}: ITEM_MOVE {} (window: {}, cell : {}) -> (window:{}, cell {}) count {}", GetName(), item->GetName(), Cell.window_type, Cell.cell, DestCell.window_type, DestCell.cell, count); item->RemoveFromCharacter(); @@ -5629,7 +5620,7 @@ bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count) // } //} - sys_log(0, "%s: ITEM_SPLIT %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell, + SPDLOG_DEBUG("{}: ITEM_SPLIT {} (window: {}, cell : {}) -> (window:{}, cell {}) count {}", GetName(), item->GetName(), Cell.window_type, Cell.cell, DestCell.window_type, DestCell.cell, count); item->SetCount(item->GetCount() - count); @@ -5716,7 +5707,7 @@ void CHARACTER::GiveGold(int iAmount) if (iAmount <= 0) return; - sys_log(0, "GIVE_GOLD: %s %d", GetName(), iAmount); + SPDLOG_DEBUG("GIVE_GOLD: {} {}", GetName(), iAmount); if (GetParty()) { @@ -5839,7 +5830,7 @@ bool CHARACTER::PickupItem(DWORD dwVID) { if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1) { - sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID()); + SPDLOG_DEBUG("No empty ds inventory pid {} size {}d itemid {}", GetPlayerID(), item->GetSize(), item->GetID()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù.")); return false; } @@ -5848,7 +5839,7 @@ bool CHARACTER::PickupItem(DWORD dwVID) { if ((iEmptyCell = GetEmptyInventory(item->GetSize())) == -1) { - sys_log(0, "No empty inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID()); + SPDLOG_DEBUG("No empty inventory pid {} size {}d itemid {}", GetPlayerID(), item->GetSize(), item->GetID()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù.")); return false; } @@ -5980,7 +5971,7 @@ bool CHARACTER::SwapItem(BYTE bCell, BYTE bDestCell) if (item1 == item2) { - sys_log(0, "[WARNING][WARNING][HACK USER!] : %s %d %d", m_stName.c_str(), bCell, bDestCell); + SPDLOG_WARN("[WARNING][WARNING][HACK USER!] : {} {} {}", m_stName.c_str(), bCell, bDestCell); return false; } @@ -6006,7 +5997,7 @@ bool CHARACTER::SwapItem(BYTE bCell, BYTE bDestCell) if (item1->EquipTo(this, bEquipCell)) item2->AddToCharacter(this, TItemPos(INVENTORY, bInvenCell)); else - sys_err("SwapItem cannot equip %s! item1 %s", item2->GetName(), item1->GetName()); + SPDLOG_ERROR("SwapItem cannot equip {}! item1 {}", item2->GetName(), item1->GetName()); } else { @@ -6401,7 +6392,7 @@ void CHARACTER::RemoveSpecifyItem(DWORD vnum, DWORD count) // ¿¹¿Ü󸮰¡ ¾àÇÏ´Ù. if (count) - sys_log(0, "CHARACTER::RemoveSpecifyItem cannot remove enough item vnum %u, still remain %d", vnum, count); + SPDLOG_WARN("CHARACTER::RemoveSpecifyItem cannot remove enough item vnum {}, still remain {}", vnum, count); } int CHARACTER::CountSpecifyTypeItem(BYTE type) const @@ -6461,12 +6452,12 @@ void CHARACTER::AutoGiveItem(LPITEM item, bool longOwnerShip) { if (NULL == item) { - sys_err ("NULL point."); + SPDLOG_ERROR("NULL point."); return; } if (item->GetOwner()) { - sys_err ("item %d 's owner exists!",item->GetID()); + SPDLOG_ERROR("item {} 's owner exists!",item->GetID()); return; } @@ -6561,7 +6552,7 @@ LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool if (!item) { - sys_err("cannot create item by vnum %u (name: %s)", dwItemVnum, GetName()); + SPDLOG_ERROR("cannot create item by vnum {} (name: {})", dwItemVnum, GetName()); return NULL; } @@ -6636,8 +6627,6 @@ LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool LogManager::instance().ItemLog(this, item, "SYSTEM_DROP", item->GetName()); } - sys_log(0, - "7: %d %d", dwItemVnum, bCount); return item; } @@ -6910,7 +6899,7 @@ void CHARACTER::ReceiveItem(LPCHARACTER from, LPITEM item) break; default: - sys_log(0, "TakeItem %s %d %s", from->GetName(), GetRaceNum(), item->GetName()); + SPDLOG_DEBUG("TakeItem {} {} {}", from->GetName(), GetRaceNum(), item->GetName()); from->SetQuestNPCID(GetVID()); quest::CQuestManager::instance().TakeItem(from->GetPlayerID(), GetRaceNum(), item); break; @@ -6980,7 +6969,7 @@ bool CHARACTER::GiveItemFromSpecialItemGroup(DWORD dwGroupNum, std::vectorGetOriginalVnum()); + SPDLOG_ERROR("POLYMORPH invalid item passed PID({}) vnum({})", GetPlayerID(), item->GetOriginalVnum()); return false; } diff --git a/src/game/src/char_manager.cpp b/src/game/src/char_manager.cpp index 3ed927c..0b9d688 100644 --- a/src/game/src/char_manager.cpp +++ b/src/game/src/char_manager.cpp @@ -110,7 +110,7 @@ void CHARACTER_MANAGER::DestroyCharacter(LPCHARACTER ch, const char* file, size_ // Check whether it has been already deleted or not. itertype(m_map_pkChrByVID) it = m_map_pkChrByVID.find(ch->GetVID()); if (it == m_map_pkChrByVID.end()) { - sys_err("[CHARACTER_MANAGER::DestroyCharacter] %d not found", (int)(ch->GetVID())); + SPDLOG_ERROR("[CHARACTER_MANAGER::DestroyCharacter] {} not found", (int)(ch->GetVID())); return; // prevent duplicated destrunction } @@ -178,7 +178,7 @@ LPCHARACTER CHARACTER_MANAGER::Find(DWORD dwVID) // Added sanity check LPCHARACTER found = it->second; if (found != NULL && dwVID != (DWORD)found->GetVID()) { - sys_err("[CHARACTER_MANAGER::Find] %u != %u", dwVID, (DWORD)found->GetVID()); + SPDLOG_ERROR("[CHARACTER_MANAGER::Find] {} != {}", dwVID, (DWORD)found->GetVID()); return NULL; } return found; @@ -204,7 +204,7 @@ LPCHARACTER CHARACTER_MANAGER::FindByPID(DWORD dwPID) // Added sanity check LPCHARACTER found = it->second; if (found != NULL && dwPID != found->GetPlayerID()) { - sys_err("[CHARACTER_MANAGER::FindByPID] %u != %u", dwPID, found->GetPlayerID()); + SPDLOG_ERROR("[CHARACTER_MANAGER::FindByPID] {} != {}", dwPID, found->GetPlayerID()); return NULL; } return found; @@ -222,7 +222,7 @@ LPCHARACTER CHARACTER_MANAGER::FindPC(const char * name) // Added sanity check LPCHARACTER found = it->second; if (found != NULL && strncasecmp(szName, found->GetName(), CHARACTER_NAME_MAX_LEN) != 0) { - sys_err("[CHARACTER_MANAGER::FindPC] %s != %s", name, found->GetName()); + SPDLOG_ERROR("[CHARACTER_MANAGER::FindPC] {} != {}", name, found->GetName()); return NULL; } return found; @@ -234,7 +234,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde { if (dwVnum == 5001 && !quest::CQuestManager::instance().GetEventFlag("japan_regen")) { - sys_log(1, "WAEGU[5001] regen disabled."); + SPDLOG_TRACE("WAEGU[5001] regen disabled."); return NULL; } } @@ -243,7 +243,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde { if (dwVnum == 5002 && !quest::CQuestManager::instance().GetEventFlag("newyear_mob")) { - sys_log(1, "HAETAE (new-year-mob) [5002] regen disabled."); + SPDLOG_TRACE("HAETAE (new-year-mob) [5002] regen disabled."); return NULL; } } @@ -252,7 +252,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde { if (dwVnum == 5004 && !quest::CQuestManager::instance().GetEventFlag("independence_day")) { - sys_log(1, "INDEPENDECE DAY [5004] regen disabled."); + SPDLOG_TRACE("INDEPENDECE DAY [5004] regen disabled."); return NULL; } } @@ -261,13 +261,13 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde if (!pkMob) { - sys_err("no mob data for vnum %u", dwVnum); + SPDLOG_ERROR("no mob data for vnum {}", dwVnum); return NULL; } if (!map_allow_find(lMapIndex)) { - sys_err("not allowed map %u", lMapIndex); + SPDLOG_ERROR("not allowed map {}", lMapIndex); return NULL; } @@ -301,7 +301,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde if (i == 2000) { - sys_err("cannot find valid location"); + SPDLOG_ERROR("cannot find valid location"); return NULL; } @@ -309,7 +309,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde if (!sectree) { - sys_log(0, "SpawnMobRandomPosition: cannot create monster at non-exist sectree %d x %d (map %d)", x, y, lMapIndex); + SPDLOG_ERROR("SpawnMobRandomPosition: cannot create monster at non-exist sectree {} x {} (map {})", x, y, lMapIndex); return NULL; } @@ -317,7 +317,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde if (!ch) { - sys_log(0, "SpawnMobRandomPosition: cannot create new character"); + SPDLOG_ERROR("SpawnMobRandomPosition: cannot create new character"); return NULL; } @@ -333,7 +333,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde if (!ch->Show(lMapIndex, x, y, 0, false)) { M2_DESTROY_CHARACTER(ch); - sys_err(0, "SpawnMobRandomPosition: cannot show monster"); + SPDLOG_ERROR("SpawnMobRandomPosition: cannot show monster"); return NULL; } @@ -345,7 +345,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRandomPosition(DWORD dwVnum, int lMapInde if (test_server) SendNotice(buf); - sys_log(0, buf); + SPDLOG_DEBUG(buf); return (ch); } @@ -354,7 +354,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMob(DWORD dwVnum, int lMapIndex, int x, int const CMob * pkMob = CMobManager::instance().Get(dwVnum); if (!pkMob) { - sys_err("SpawnMob: no mob data for vnum %u", dwVnum); + SPDLOG_ERROR("SpawnMob: no mob data for vnum {}", dwVnum); return NULL; } @@ -364,7 +364,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMob(DWORD dwVnum, int lMapIndex, int x, int if (!tree) { - sys_log(0, "no sectree for spawn at %d %d mobvnum %d mapindex %d", x, y, dwVnum, lMapIndex); + SPDLOG_ERROR("no sectree for spawn at {} {} mobvnum {} mapindex {}", x, y, dwVnum, lMapIndex); return NULL; } @@ -391,14 +391,14 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMob(DWORD dwVnum, int lMapIndex, int x, int } if (s_isLog) - sys_log(0, "SpawnMob: BLOCKED position for spawn %s %u at %d %d (attr %u)", pkMob->m_table.szName, dwVnum, x, y, dwAttr); + SPDLOG_DEBUG("SpawnMob: BLOCKED position for spawn {} {} at {} {} (attr {})", pkMob->m_table.szName, dwVnum, x, y, dwAttr); // END_OF_SPAWN_BLOCK_LOG return NULL; } if (IS_SET(dwAttr, ATTR_BANPK)) { - sys_log(0, "SpawnMob: BAN_PK position for mob spawn %s %u at %d %d", pkMob->m_table.szName, dwVnum, x, y); + SPDLOG_DEBUG("SpawnMob: BAN_PK position for mob spawn {} {} at {} {}", pkMob->m_table.szName, dwVnum, x, y); return NULL; } } @@ -407,7 +407,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMob(DWORD dwVnum, int lMapIndex, int x, int if (!sectree) { - sys_log(0, "SpawnMob: cannot create monster at non-exist sectree %d x %d (map %d)", x, y, lMapIndex); + SPDLOG_ERROR("SpawnMob: cannot create monster at non-exist sectree {} x {} (map {})", x, y, lMapIndex); return NULL; } @@ -415,7 +415,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMob(DWORD dwVnum, int lMapIndex, int x, int if (!ch) { - sys_log(0, "SpawnMob: cannot create new character"); + SPDLOG_ERROR("SpawnMob: cannot create new character"); return NULL; } @@ -434,7 +434,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMob(DWORD dwVnum, int lMapIndex, int x, int if (bShow && !ch->Show(lMapIndex, x, y, z, bSpawnMotion)) { M2_DESTROY_CHARACTER(ch); - sys_log(0, "SpawnMob: cannot show monster"); + SPDLOG_ERROR("SpawnMob: cannot show monster"); return NULL; } @@ -466,7 +466,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnMobRange(DWORD dwVnum, int lMapIndex, int sx if (ch) { - sys_log(1, "MOB_SPAWN: %s(%d) %dx%d", ch->GetName(), (DWORD) ch->GetVID(), ch->GetX(), ch->GetY()); + SPDLOG_TRACE("MOB_SPAWN: {}({}) {}x{}", ch->GetName(), (DWORD) ch->GetVID(), ch->GetX(), ch->GetY()); if ( bAggressive ) ch->SetAggressive(); return (ch); @@ -487,7 +487,7 @@ bool CHARACTER_MANAGER::SpawnMoveGroup(DWORD dwVnum, int lMapIndex, int sx, int if (!pkGroup) { - sys_err("NOT_EXIST_GROUP_VNUM(%u) Map(%u) ", dwVnum, lMapIndex); + SPDLOG_ERROR("NOT_EXIST_GROUP_VNUM({}) Map({}) ", dwVnum, lMapIndex); return false; } @@ -557,7 +557,7 @@ bool CHARACTER_MANAGER::SpawnGroupGroup(DWORD dwVnum, int lMapIndex, int sx, int } else { - sys_err( "NOT_EXIST_GROUP_GROUP_VNUM(%u) MAP(%ld)", dwVnum, lMapIndex ); + SPDLOG_ERROR("NOT_EXIST_GROUP_GROUP_VNUM({}) MAP({})", dwVnum, lMapIndex ); return false; } } @@ -568,7 +568,7 @@ LPCHARACTER CHARACTER_MANAGER::SpawnGroup(DWORD dwVnum, int lMapIndex, int sx, i if (!pkGroup) { - sys_err("NOT_EXIST_GROUP_VNUM(%u) Map(%u) ", dwVnum, lMapIndex); + SPDLOG_ERROR("NOT_EXIST_GROUP_VNUM({}) Map({}) ", dwVnum, lMapIndex); return NULL; } @@ -717,7 +717,7 @@ void CHARACTER_MANAGER::Update(int iPulse) // Å×½ºÆ® ¼­¹ö¿¡¼­´Â 60Ãʸ¶´Ù ij¸¯ÅÍ °³¼ö¸¦ ¼¾´Ù if (test_server && 0 == (iPulse % PASSES_PER_SEC(60))) - sys_log(0, "CHARACTER COUNT vid %zu pid %zu", m_map_pkChrByVID.size(), m_map_pkChrByPID.size()); + SPDLOG_TRACE("CHARACTER COUNT vid {} pid {}", m_map_pkChrByVID.size(), m_map_pkChrByPID.size()); // Áö¿¬µÈ DestroyCharacter Çϱâ FlushPendingDestroy(); @@ -757,7 +757,6 @@ void CHARACTER_MANAGER::RemoveFromStateList(LPCHARACTER ch) if (it != m_set_pkChrState.end()) { - //sys_log(0, "RemoveFromStateList %p", ch); m_set_pkChrState.erase(it); } } @@ -838,7 +837,7 @@ void CHARACTER_MANAGER::RegisterRaceNumMap(LPCHARACTER ch) if (m_set_dwRegisteredRaceNum.find(dwVnum) != m_set_dwRegisteredRaceNum.end()) // µî·ÏµÈ ¹øÈ£ À̸é { - sys_log(0, "RegisterRaceNumMap %s %u", ch->GetName(), dwVnum); + SPDLOG_TRACE("RegisterRaceNumMap {} {}", ch->GetName(), dwVnum); m_map_pkChrByRaceNum[dwVnum].insert(ch); } } @@ -1074,7 +1073,7 @@ void CHARACTER_MANAGER::FlushPendingDestroy() if (!m_set_pkChrPendingDestroy.empty()) { - sys_log(0, "FlushPendingDestroy size %d", m_set_pkChrPendingDestroy.size()); + SPDLOG_DEBUG("FlushPendingDestroy size {}", m_set_pkChrPendingDestroy.size()); CHARACTER_SET::iterator it = m_set_pkChrPendingDestroy.begin(), end = m_set_pkChrPendingDestroy.end(); diff --git a/src/game/src/char_resist.cpp b/src/game/src/char_resist.cpp index 0b052b9..115daee 100644 --- a/src/game/src/char_resist.cpp +++ b/src/game/src/char_resist.cpp @@ -50,7 +50,7 @@ EVENTFUNC(poison_event) if ( info == NULL ) { - sys_err( "poison_event> Null pointer" ); + SPDLOG_ERROR("poison_event> Null pointer" ); return 0; } @@ -103,7 +103,7 @@ EVENTFUNC(fire_event) if ( info == NULL ) { - sys_err( "fire_event> Null pointer" ); + SPDLOG_ERROR("fire_event> Null pointer" ); return 0; } diff --git a/src/game/src/char_skill.cpp b/src/game/src/char_skill.cpp index 4769b3d..c2fb144 100644 --- a/src/game/src/char_skill.cpp +++ b/src/game/src/char_skill.cpp @@ -47,7 +47,7 @@ time_t CHARACTER::GetSkillNextReadTime(DWORD dwVnum) const { if (dwVnum >= SKILL_MAX_NUM) { - sys_err("vnum overflow (vnum: %u)", dwVnum); + SPDLOG_ERROR("vnum overflow (vnum: {})", dwVnum); return 0; } @@ -66,24 +66,24 @@ bool TSkillUseInfo::HitOnce(DWORD dwVnum) if (!bUsed) return false; - sys_log(1, "__HitOnce NextUse %u current %u count %d scount %d", dwNextSkillUsableTime, get_dword_time(), iHitCount, iSplashCount); + SPDLOG_DEBUG("__HitOnce NextUse {} current {} count {} scount {}", dwNextSkillUsableTime, get_dword_time(), iHitCount, iSplashCount); if (dwNextSkillUsableTime && dwNextSkillUsableTime dwCur) { - sys_log(0, "cooltime is not over delta %u", dwNextSkillUsableTime - dwCur); + SPDLOG_DEBUG("cooltime is not over delta {}", dwNextSkillUsableTime - dwCur); iHitCount = 0; return false; } @@ -115,8 +115,7 @@ bool TSkillUseInfo::UseSkill(bool isGrandMaster, DWORD vid, DWORD dwCooltime, in iRange = range; iMaxHitCount = iHitCount = hitcount; - if (test_server) - sys_log(0, "UseSkill NextUse %u current %u cooltime %d hitcount %d/%d", dwNextSkillUsableTime, dwCur, dwCooltime, iHitCount, iMaxHitCount); + SPDLOG_TRACE("UseSkill NextUse {} current {} cooltime {} hitcount {}/{}", dwNextSkillUsableTime, dwCur, dwCooltime, iHitCount, iMaxHitCount); dwVID = vid; iSplashCount = splashcount; @@ -174,7 +173,7 @@ void CHARACTER::SetSkillLevel(DWORD dwVnum, BYTE bLev) if (dwVnum >= SKILL_MAX_NUM) { - sys_err("vnum overflow (vnum %u)", dwVnum); + SPDLOG_ERROR("vnum overflow (vnum {})", dwVnum); return; } @@ -272,7 +271,7 @@ bool CHARACTER::LearnGrandMasterSkill(DWORD dwSkillVnum) return false; } - sys_log(0, "learn grand master skill[%d] cur %d, next %d", dwSkillVnum, get_global_time(), GetSkillNextReadTime(dwSkillVnum)); + SPDLOG_DEBUG("learn grand master skill[{}] cur {}, next {}", dwSkillVnum, get_global_time(), GetSkillNextReadTime(dwSkillVnum)); /* if (get_global_time() < GetSkillNextReadTime(dwSkillVnum)) @@ -322,7 +321,7 @@ bool CHARACTER::LearnGrandMasterSkill(DWORD dwSkillVnum) int idx = std::min(9, GetSkillLevel(dwSkillVnum) - 30); - sys_log(0, "LearnGrandMasterSkill %s table idx %d value %d", GetName(), idx, aiGrandMasterSkillBookCountForLevelUp[idx]); + SPDLOG_DEBUG("LearnGrandMasterSkill {} table idx {} value {}", GetName(), idx, aiGrandMasterSkillBookCountForLevelUp[idx]); int iTotalReadCount = GetQuestFlag(strTrainSkill) + 1; SetQuestFlag(strTrainSkill, iTotalReadCount); @@ -365,11 +364,11 @@ bool CHARACTER::LearnGrandMasterSkill(DWORD dwSkillVnum) } int n = Random::get(1, iBookCount); - sys_log(0, "Number(%d)", n); + SPDLOG_TRACE("Number({})", n); DWORD nextTime = get_global_time() + Random::get(28800, 43200); - sys_log(0, "GrandMaster SkillBookCount min %d cur %d max %d (next_time=%d)", iMinReadCount, iTotalReadCount, iMaxReadCount, nextTime); + SPDLOG_DEBUG("GrandMaster SkillBookCount min {} cur {} max {} (next_time={})", iMinReadCount, iTotalReadCount, iMaxReadCount, nextTime); bool bSuccess = n == 2; @@ -483,26 +482,24 @@ bool CHARACTER::LearnSkillByBook(DWORD dwSkillVnum, BYTE bProb) } // END_OF_SKILL_BOOK_BONUS - sys_log(0, "LearnSkillByBook Pct %u prob %d", dwSkillVnum, bProb); + SPDLOG_DEBUG("LearnSkillByBook Pct {} prob {}", dwSkillVnum, bProb); if (Random::get(1, 100) <= bProb) { - if (test_server) - sys_log(0, "LearnSkillByBook %u SUCC", dwSkillVnum); + SPDLOG_TRACE("LearnSkillByBook {} SUCC", dwSkillVnum); SkillLevelUp(dwSkillVnum, SKILL_UP_BY_BOOK); } else { - if (test_server) - sys_log(0, "LearnSkillByBook %u FAIL", dwSkillVnum); + SPDLOG_TRACE("LearnSkillByBook {} FAIL", dwSkillVnum); } } else { int idx = std::min(9, GetSkillLevel(dwSkillVnum) - 20); - sys_log(0, "LearnSkillByBook %s table idx %d value %d", GetName(), idx, aiSkillBookCountForLevelUp[idx]); + SPDLOG_DEBUG("LearnSkillByBook {} table idx {} value {}", GetName(), idx, aiSkillBookCountForLevelUp[idx]); if (!LC_IsYMIR()) { @@ -635,7 +632,7 @@ bool CHARACTER::SkillLevelDown(DWORD dwVnum) if (!pkSk) { - sys_err("There is no such skill by number %u", dwVnum); + SPDLOG_ERROR("There is no such skill by number {}", dwVnum); return false; } @@ -671,7 +668,7 @@ bool CHARACTER::SkillLevelDown(DWORD dwVnum) idx = POINT_HORSE_SKILL; break; default: - sys_err("Wrong skill type %d skill vnum %d", pkSk->dwType, pkSk->dwVnum); + SPDLOG_ERROR("Wrong skill type {} skill vnum {}", pkSk->dwType, pkSk->dwVnum); return false; } @@ -679,7 +676,7 @@ bool CHARACTER::SkillLevelDown(DWORD dwVnum) PointChange(idx, +1); SetSkillLevel(pkSk->dwVnum, m_pSkillLevels[pkSk->dwVnum].bLevel - 1); - sys_log(0, "SkillDown: %s %u %u %u type %u", GetName(), pkSk->dwVnum, m_pSkillLevels[pkSk->dwVnum].bMasterType, m_pSkillLevels[pkSk->dwVnum].bLevel, pkSk->dwType); + SPDLOG_DEBUG("SkillDown: {} {} {} {} type {}", GetName(), pkSk->dwVnum, m_pSkillLevels[pkSk->dwVnum].bMasterType, m_pSkillLevels[pkSk->dwVnum].bLevel, pkSk->dwType); Save(); ComputePoints(); @@ -711,13 +708,13 @@ void CHARACTER::SkillLevelUp(DWORD dwVnum, BYTE bMethod) if (!pkSk) { - sys_err("There is no such skill by number (vnum %u)", dwVnum); + SPDLOG_ERROR("There is no such skill by number (vnum {})", dwVnum); return; } if (pkSk->dwVnum >= SKILL_MAX_NUM) { - sys_err("Skill Vnum overflow (vnum %u)", dwVnum); + SPDLOG_ERROR("Skill Vnum overflow (vnum {})", dwVnum); return; } @@ -789,7 +786,7 @@ void CHARACTER::SkillLevelUp(DWORD dwVnum, BYTE bMethod) break; default: - sys_err("Wrong skill type %d skill vnum %d", pkSk->dwType, pkSk->dwVnum); + SPDLOG_ERROR("Wrong skill type {} skill vnum {}", pkSk->dwType, pkSk->dwVnum); return; } @@ -846,7 +843,7 @@ void CHARACTER::SkillLevelUp(DWORD dwVnum, BYTE bMethod) snprintf(szSkillUp, sizeof(szSkillUp), "SkillUp: %s %u %d %d[Before:%d] type %u", GetName(), pkSk->dwVnum, m_pSkillLevels[pkSk->dwVnum].bMasterType, m_pSkillLevels[pkSk->dwVnum].bLevel, SkillPointBefore, pkSk->dwType); - sys_log(0, "%s", szSkillUp); + SPDLOG_DEBUG("{}", szSkillUp); LogManager::instance().CharLog(this, pkSk->dwVnum, "SKILLUP", szSkillUp); Save(); @@ -904,7 +901,7 @@ void CHARACTER::ComputePassiveSkill(DWORD dwVnum) pkSk->SetPointVar("k", GetSkillLevel(dwVnum)); int iAmount = (int) pkSk->kPointPoly.Eval(); - sys_log(2, "%s passive #%d on %d amount %d", GetName(), dwVnum, pkSk->bPointOn, iAmount); + SPDLOG_TRACE("{} passive #{} on {} amount {}", GetName(), dwVnum, pkSk->bPointOn, iAmount); PointChange(pkSk->bPointOn, iAmount); } @@ -991,11 +988,11 @@ EVENTFUNC(ChainLightningEvent) if (!pkChr || !pkChrVictim) { - sys_log(1, "use chainlighting, but no character"); + SPDLOG_DEBUG("use chainlighting, but no character"); return 0; } - sys_log(1, "chainlighting event %s", pkChr->GetName()); + SPDLOG_DEBUG("chainlighting event {}", pkChr->GetName()); if (pkChrVictim->GetParty()) // ÆÄƼ ¸ÕÀú { @@ -1025,7 +1022,7 @@ EVENTFUNC(ChainLightningEvent) } else { - sys_log(1, "%s use chainlighting, but find victim failed near %s", pkChr->GetName(), pkChrVictim->GetName()); + SPDLOG_DEBUG("{} use chainlighting, but find victim failed near {}", pkChr->GetName(), pkChrVictim->GetName()); } return 0; @@ -1075,7 +1072,6 @@ struct FuncSplashDamage { if (!ent->IsType(ENTITY_CHARACTER)) { - //if (m_pkSk->dwVnum == SKILL_CHAIN) sys_log(0, "CHAIN target not character %s", m_pkChr->GetName()); return; } @@ -1083,15 +1079,13 @@ struct FuncSplashDamage if (DISTANCE_APPROX(m_x - pkChrVictim->GetX(), m_y - pkChrVictim->GetY()) > m_pkSk->iSplashRange) { - if(test_server) - sys_log(0, "XXX target too far %s", m_pkChr->GetName()); + SPDLOG_TRACE("XXX target too far {}", m_pkChr->GetName()); return; } if (!battle_is_attackable(m_pkChr, pkChrVictim)) { - if(test_server) - sys_log(0, "XXX target not attackable %s", m_pkChr->GetName()); + SPDLOG_TRACE("XXX target not attackable {}", m_pkChr->GetName()); return; } @@ -1100,8 +1094,7 @@ struct FuncSplashDamage if (!(m_pkSk->dwVnum >= GUILD_SKILL_START && m_pkSk->dwVnum <= GUILD_SKILL_END)) if (!m_bDisableCooltime && m_pInfo && !m_pInfo->HitOnce(m_pkSk->dwVnum) && m_pkSk->dwVnum != SKILL_MUYEONG) { - if(test_server) - sys_log(0, "check guild skill %s", m_pkChr->GetName()); + SPDLOG_TRACE("check guild skill {}", m_pkChr->GetName()); return; } @@ -1243,7 +1236,6 @@ struct FuncSplashDamage iAmount = (int) (iAmount * adjust); } //////////////////////////////////////////////////////////////////////////////// - //sys_log(0, "name: %s skill: %s amount %d to %s", m_pkChr->GetName(), m_pkSk->szName, iAmount, pkChrVictim->GetName()); iDam = CalcBattleDamage(iAmount, m_pkChr->GetLevel(), pkChrVictim->GetLevel()); @@ -1317,7 +1309,7 @@ struct FuncSplashDamage break; default: - sys_err("Unknown skill attr type %u vnum %u", m_pkSk->bSkillAttrType, m_pkSk->dwVnum); + SPDLOG_ERROR("Unknown skill attr type {} vnum {}", m_pkSk->bSkillAttrType, m_pkSk->dwVnum); break; } @@ -1355,7 +1347,7 @@ struct FuncSplashDamage pkChrVictim->BeginFight(m_pkChr); if (m_pkSk->dwVnum == SKILL_CHAIN) - sys_log(0, "%s CHAIN INDEX %d DAM %d DT %d", m_pkChr->GetName(), m_pkChr->GetChainLightningIndex() - 1, iDam, dt); + SPDLOG_DEBUG("{} CHAIN INDEX {} DAM {} DT {}", m_pkChr->GetName(), m_pkChr->GetChainLightningIndex() - 1, iDam, (int) dt); { BYTE AntiSkillID = 0; @@ -1381,7 +1373,7 @@ struct FuncSplashDamage CSkillProto* pkSk = CSkillManager::instance().Get(AntiSkillID); if (!pkSk) { - sys_err ("There is no anti skill(%d) in skill proto", AntiSkillID); + SPDLOG_ERROR("There is no anti skill({}) in skill proto", AntiSkillID); } else { @@ -1389,7 +1381,7 @@ struct FuncSplashDamage double ResistAmount = pkSk->kPointPoly.Eval(); - sys_log(0, "ANTI_SKILL: Resist(%lf) Orig(%d) Reduce(%d)", ResistAmount, iDam, int(iDam * (ResistAmount/100.0))); + SPDLOG_DEBUG("ANTI_SKILL: Resist({}) Orig({}) Reduce({})", ResistAmount, iDam, int(iDam * (ResistAmount/100.0))); iDam -= iDam * (ResistAmount/100.0); } @@ -1478,7 +1470,7 @@ struct FuncSplashDamage } GetDeltaByDegree(degree, fCrushSlidingLength, &fx, &fy); - sys_log(0, "CRUSH! %s -> %s (%d %d) -> (%d %d)", m_pkChr->GetName(), pkChrVictim->GetName(), pkChrVictim->GetX(), pkChrVictim->GetY(), (int)(pkChrVictim->GetX()+fx), (int)(pkChrVictim->GetY()+fy)); + SPDLOG_TRACE("CRUSH! {} -> {} ({} {}) -> ({} {})", m_pkChr->GetName(), pkChrVictim->GetName(), pkChrVictim->GetX(), pkChrVictim->GetY(), (int)(pkChrVictim->GetX()+fx), (int)(pkChrVictim->GetY()+fy)); int tx = (int)(pkChrVictim->GetX()+fx); int ty = (int)(pkChrVictim->GetY()+fy); @@ -1522,8 +1514,7 @@ struct FuncSplashDamage event_create(ChainLightningEvent, info, passes_per_sec / 5); } - if(test_server) - sys_log(0, "FuncSplashDamage End :%s ", m_pkChr->GetName()); + SPDLOG_TRACE("FuncSplashDamage End :{} ", m_pkChr->GetName()); } int m_x; @@ -1568,12 +1559,10 @@ struct FuncSplashAffect { LPCHARACTER pkChr = (LPCHARACTER) ent; - if (test_server) - sys_log(0, "FuncSplashAffect step 1 : name:%s vnum:%d iDur:%d", pkChr->GetName(), m_dwVnum, m_iDuration); + SPDLOG_TRACE("FuncSplashAffect step 1 : name:{} vnum:{} iDur:{}", pkChr->GetName(), m_dwVnum, m_iDuration); if (DISTANCE_APPROX(m_x - pkChr->GetX(), m_y - pkChr->GetY()) < m_iDist) { - if (test_server) - sys_log(0, "FuncSplashAffect step 2 : name:%s vnum:%d iDur:%d", pkChr->GetName(), m_dwVnum, m_iDuration); + SPDLOG_TRACE("FuncSplashAffect step 2 : name:{} vnum:{} iDur:{}", pkChr->GetName(), m_dwVnum, m_iDuration); if (m_dwVnum == SKILL_TUSOK) if (pkChr->CanBeginFight()) pkChr->BeginFight(m_pkChrAttacker); @@ -1621,7 +1610,7 @@ EVENTFUNC(skill_gwihwan_event) if ( info == NULL ) { - sys_err( "skill_gwihwan_event> Null pointer" ); + SPDLOG_ERROR("skill_gwihwan_event> Null pointer" ); return 0; } @@ -1641,12 +1630,12 @@ EVENTFUNC(skill_gwihwan_event) // ¼º°ø if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos)) { - sys_log(1, "Recall: %s %d %d -> %d %d", ch->GetName(), ch->GetX(), ch->GetY(), pos.x, pos.y); + SPDLOG_DEBUG("Recall: {} {} {} -> {} {}", ch->GetName(), ch->GetX(), ch->GetY(), pos.x, pos.y); ch->WarpSet(pos.x, pos.y); } else { - sys_err("CHARACTER::UseItem : cannot find spawn position (name %s, %d x %d)", ch->GetName(), ch->GetX(), ch->GetY()); + SPDLOG_ERROR("CHARACTER::UseItem : cannot find spawn position (name {}, {} x {})", ch->GetName(), ch->GetX(), ch->GetY()); ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire())); } } @@ -1674,11 +1663,8 @@ int CHARACTER::ComputeSkillAtPosition(DWORD dwVnum, const PIXEL_POSITION& posTar if (!pkSk) return BATTLE_NONE; - if (test_server) - { - sys_log(0, "ComputeSkillAtPosition %s vnum %d x %d y %d level %d", - GetName(), dwVnum, posTarget.x, posTarget.y, bSkillLevel); - } + SPDLOG_TRACE("ComputeSkillAtPosition {} vnum {} x {} y {} level {}", + GetName(), dwVnum, posTarget.x, posTarget.y, bSkillLevel); // ³ª¿¡°Ô ¾²´Â ½ºÅ³Àº ³» À§Ä¡¸¦ ¾´´Ù. //if (IS_SET(pkSk->dwFlag, SKILL_FLAG_SELFONLY)) @@ -1800,20 +1786,17 @@ int CHARACTER::ComputeSkillAtPosition(DWORD dwVnum, const PIXEL_POSITION& posTar } else { - //if (dwVnum == SKILL_CHAIN) sys_log(0, "CHAIN skill call FuncSplashDamage %s", GetName()); f(this); } } else { - //if (dwVnum == SKILL_CHAIN) sys_log(0, "CHAIN skill no damage %d %s", iAmount, GetName()); int iDur = (int) pkSk->kDurationPoly.Eval(); if (IsPC()) if (!(dwVnum >= GUILD_SKILL_START && dwVnum <= GUILD_SKILL_END)) // ±æµå ½ºÅ³Àº ÄðŸÀÓ Ã³¸®¸¦ ÇÏÁö ¾Ê´Â´Ù. if (!m_bDisableCooltime && !m_SkillUseInfo[dwVnum].HitOnce(dwVnum) && dwVnum != SKILL_MUYEONG) { - //if (dwVnum == SKILL_CHAIN) sys_log(0, "CHAIN skill cannot hit %s", GetName()); return BATTLE_NONE; } @@ -1840,7 +1823,7 @@ int CHARACTER::ComputeSkillAtPosition(DWORD dwVnum, const PIXEL_POSITION& posTar { int iDur = (int) pkSk->kDurationPoly2.Eval(); - sys_log(1, "try second %u %d %d", pkSk->dwVnum, pkSk->bPointOn2, iDur); + SPDLOG_DEBUG("try second {} {} {}", pkSk->dwVnum, pkSk->bPointOn2, iDur); if (iDur > 0) { @@ -1990,21 +1973,19 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel if (!pkVictim) { - if (test_server) - sys_log(0, "ComputeSkill: %s Victim == null, skill %d", GetName(), dwVnum); + SPDLOG_TRACE("ComputeSkill: {} Victim == null, skill {}", GetName(), dwVnum); return BATTLE_NONE; } if (pkSk->dwTargetRange && DISTANCE_SQRT(GetX() - pkVictim->GetX(), GetY() - pkVictim->GetY()) >= pkSk->dwTargetRange + 50) { - if (test_server) - sys_log(0, "ComputeSkill: Victim too far, skill %d : %s to %s (distance %u limit %u)", - dwVnum, - GetName(), - pkVictim->GetName(), - (int)DISTANCE_SQRT(GetX() - pkVictim->GetX(), GetY() - pkVictim->GetY()), - pkSk->dwTargetRange); + SPDLOG_TRACE("ComputeSkill: Victim too far, skill {} : {} to {} (distance {} limit {})", + dwVnum, + GetName(), + pkVictim->GetName(), + (int)DISTANCE_SQRT(GetX() - pkVictim->GetX(), GetY() - pkVictim->GetY()), + pkSk->dwTargetRange); return BATTLE_NONE; } @@ -2013,8 +1994,7 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel { if ((bSkillLevel = GetSkillLevel(pkSk->dwVnum)) == 0) { - if (test_server) - sys_log(0, "ComputeSkill : name:%s vnum:%d skillLevelBySkill : %d ", GetName(), pkSk->dwVnum, bSkillLevel); + SPDLOG_TRACE("ComputeSkill : name:{} vnum:{} skillLevelBySkill : {} ", GetName(), pkSk->dwVnum, bSkillLevel); return BATTLE_NONE; } } @@ -2095,7 +2075,7 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel int iAmount3 = (int) pkSk->kPointPoly3.Eval(); if (test_server && IsPC()) - sys_log(0, "iAmount: %d %d %d , atk:%f skLevel:%f k:%f GetSkillPower(%d) MaxLevel:%d Per:%f", + SPDLOG_TRACE("iAmount: {} {} {} , atk:{} skLevel:{} k:{} GetSkillPower({}) MaxLevel:{} Per:{}", iAmount, iAmount2, iAmount3, pkSk->kPointPoly.GetVar("atk"), pkSk->kPointPoly.GetVar("k"), @@ -2117,8 +2097,6 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel } // END_OF_ADD_GRANDMASTER_SKILL - //sys_log(0, "XXX SKILL Calc %d Amount %d", dwVnum, iAmount); - // REMOVE_BAD_AFFECT_BUG_FIX if (IS_SET(pkSk->dwFlag, SKILL_FLAG_REMOVE_BAD_AFFECT)) { @@ -2281,13 +2259,12 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel if (iDur2 > 0) { - if (test_server) - sys_log(0, "SKILL_AFFECT: %s %s Dur:%d To:%d Amount:%d", - GetName(), - pkSk->szName, - iDur2, - pkSk->bPointOn2, - iAmount2); + SPDLOG_TRACE("SKILL_AFFECT: {} {} Dur:{} To:{} Amount:{}", + GetName(), + pkSk->szName, + iDur2, + pkSk->bPointOn2, + iAmount2); iDur2 += GetPoint(POINT_PARTY_BUFFER_BONUS); pkVictim->AddAffect(pkSk->dwVnum, pkSk->bPointOn2, iAmount2, pkSk->dwAffectFlag2, iDur2, 0, false); @@ -2323,13 +2300,12 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel } else { - if (test_server) - sys_log(0, "SKILL_AFFECT: %s %s Dur:%d To:%d Amount:%d", - GetName(), - pkSk->szName, - iDur, - pkSk->bPointOn, - iAmount); + SPDLOG_TRACE("SKILL_AFFECT: {} {} Dur:{} To:{} Amount:{}", + GetName(), + pkSk->szName, + iDur, + pkSk->bPointOn, + iAmount); pkVictim->AddAffect(pkSk->dwVnum, pkSk->bPointOn, @@ -2379,7 +2355,7 @@ int CHARACTER::ComputeSkill(DWORD dwVnum, LPCHARACTER pkVictim, BYTE bSkillLevel pkSk->kDurationPoly3.SetVar("k", k/*bSkillLevel*/); int iDur = (int) pkSk->kDurationPoly3.Eval(); - sys_log(0, "try third %u %d %d %d 1894", pkSk->dwVnum, pkSk->bPointOn3, iDur, iAmount3); + SPDLOG_DEBUG("try third {} {} {} {} 1894", pkSk->dwVnum, pkSk->bPointOn3, iDur, iAmount3); if (iDur > 0) { @@ -2457,7 +2433,7 @@ bool CHARACTER::UseSkill(DWORD dwVnum, LPCHARACTER pkVictim, bool bUseGrandMaste return false; CSkillProto * pkSk = CSkillManager::instance().Get(dwVnum); - sys_log(0, "%s: USE_SKILL: %d pkVictim %p", GetName(), dwVnum, get_pointer(pkVictim)); + SPDLOG_DEBUG("{}: USE_SKILL: {} pkVictim {}", GetName(), dwVnum, (void*) get_pointer(pkVictim)); if (!pkSk) return false; @@ -2541,7 +2517,7 @@ bool CHARACTER::UseSkill(DWORD dwVnum, LPCHARACTER pkVictim, bool bUseGrandMaste if (dwVnum == SKILL_TERROR && m_SkillUseInfo[dwVnum].bUsed && m_SkillUseInfo[dwVnum].dwNextSkillUsableTime > dwCur ) { - sys_log(0, " SKILL_TERROR's Cooltime is not delta over %u", m_SkillUseInfo[dwVnum].dwNextSkillUsableTime - dwCur ); + SPDLOG_DEBUG(" SKILL_TERROR's Cooltime is not delta over {}", m_SkillUseInfo[dwVnum].dwNextSkillUsableTime - dwCur ); return false; } @@ -2658,7 +2634,7 @@ int CHARACTER::GetSkillMasterType(DWORD dwVnum) const if (dwVnum >= SKILL_MAX_NUM) { - sys_err("%s skill vnum overflow %u", GetName(), dwVnum); + SPDLOG_ERROR("{} skill vnum overflow {}", GetName(), dwVnum); return 0; } @@ -2690,7 +2666,7 @@ int CHARACTER::GetSkillPower(DWORD dwVnum, BYTE bLevel) const if (dwVnum >= SKILL_MAX_NUM) { - sys_err("%s skill vnum overflow %u", GetName(), dwVnum); + SPDLOG_ERROR("{} skill vnum overflow {}", GetName(), dwVnum); return 0; } @@ -2703,8 +2679,7 @@ int CHARACTER::GetSkillLevel(DWORD dwVnum) const { if (dwVnum >= SKILL_MAX_NUM) { - sys_err("%s skill vnum overflow %u", GetName(), dwVnum); - sys_log(0, "%s skill vnum overflow %u", GetName(), dwVnum); + SPDLOG_ERROR("{} skill vnum overflow {}", GetName(), dwVnum); return 0; } @@ -2717,7 +2692,7 @@ EVENTFUNC(skill_muyoung_event) if ( info == NULL ) { - sys_err( "skill_muyoung_event> Null pointer" ); + SPDLOG_ERROR("skill_muyoung_event> Null pointer" ); return 0; } @@ -2896,7 +2871,7 @@ EVENTFUNC(mob_skill_hit_event) if ( info == NULL ) { - sys_err( "mob_skill_event_info> Null pointer" ); + SPDLOG_ERROR("mob_skill_event_info> Null pointer" ); return 0; } @@ -2935,11 +2910,11 @@ bool CHARACTER::UseMobSkill(unsigned int idx) m_adwMobSkillCooltime[idx] = get_dword_time() + iCooltime; - sys_log(0, "USE_MOB_SKILL: %s idx %d vnum %u cooltime %d", GetName(), idx, dwVnum, iCooltime); + SPDLOG_DEBUG("USE_MOB_SKILL: {} idx {} vnum {} cooltime {}", GetName(), idx, dwVnum, iCooltime); if (m_pkMobData->m_mobSkillInfo[idx].vecSplashAttack.empty()) { - sys_err("No skill hit data for mob %s index %d", GetName(), idx); + SPDLOG_ERROR("No skill hit data for mob {} index {}", GetName(), idx); return false; } @@ -2958,8 +2933,7 @@ bool CHARACTER::UseMobSkill(unsigned int idx) if (rInfo.dwTiming) { - if (test_server) - sys_log(0, " timing %ums", rInfo.dwTiming); + SPDLOG_TRACE(" timing {}ms", rInfo.dwTiming); mob_skill_event_info* info = AllocEventInfo(); @@ -3350,7 +3324,7 @@ bool CHARACTER::IsUsableSkillMotion(DWORD dwMotionIndex) const if (dwMotionIndex >= MOTION_MAX_NUM) { - sys_err("OUT_OF_MOTION_VNUM: name=%s, motion=%d/%d", GetName(), dwMotionIndex, MOTION_MAX_NUM); + SPDLOG_ERROR("OUT_OF_MOTION_VNUM: name={}, motion={}/{}", GetName(), dwMotionIndex, MOTION_MAX_NUM); return false; } @@ -3359,7 +3333,7 @@ bool CHARACTER::IsUsableSkillMotion(DWORD dwMotionIndex) const DWORD skillCount = *skillVNums++; if (skillCount >= SKILL_LIST_MAX_COUNT) { - sys_err("OUT_OF_SKILL_LIST: name=%s, count=%d/%d", GetName(), skillCount, SKILL_LIST_MAX_COUNT); + SPDLOG_ERROR("OUT_OF_SKILL_LIST: name={}, count={}/{}", GetName(), skillCount, SKILL_LIST_MAX_COUNT); return false; } @@ -3367,7 +3341,7 @@ bool CHARACTER::IsUsableSkillMotion(DWORD dwMotionIndex) const { if (skillIndex >= SKILL_MAX_NUM) { - sys_err("OUT_OF_SKILL_VNUM: name=%s, skill=%d/%d", GetName(), skillIndex, SKILL_MAX_NUM); + SPDLOG_ERROR("OUT_OF_SKILL_VNUM: name={}, skill={}/{}", GetName(), skillIndex, (int) SKILL_MAX_NUM); return false; } @@ -3418,7 +3392,7 @@ void CHARACTER::ClearSubSkill() if (m_pSkillLevels == NULL) { - sys_err("m_pSkillLevels nil (name: %s)", GetName()); + SPDLOG_ERROR("m_pSkillLevels nil (name: {})", GetName()); return; } @@ -3443,13 +3417,13 @@ bool CHARACTER::ResetOneSkill(DWORD dwVnum) { if (NULL == m_pSkillLevels) { - sys_err("m_pSkillLevels nil (name %s, vnum %u)", GetName(), dwVnum); + SPDLOG_ERROR("m_pSkillLevels nil (name {}, vnum {})", GetName(), dwVnum); return false; } if (dwVnum >= SKILL_MAX_NUM) { - sys_err("vnum overflow (name %s, vnum %u)", GetName(), dwVnum); + SPDLOG_ERROR("vnum overflow (name {}, vnum {})", GetName(), dwVnum); return false; } @@ -3534,7 +3508,7 @@ bool CHARACTER::CheckSkillHitCount(const BYTE SkillID, const VID TargetVID) if (iter == m_SkillUseInfo.end()) { - sys_log(0, "SkillHack: Skill(%u) is not in container", SkillID); + SPDLOG_WARN("SkillHack: Skill({}) is not in container", SkillID); return false; } @@ -3542,7 +3516,7 @@ bool CHARACTER::CheckSkillHitCount(const BYTE SkillID, const VID TargetVID) if (false == rSkillUseInfo.bUsed) { - sys_log(0, "SkillHack: not used skill(%u)", SkillID); + SPDLOG_WARN("SkillHack: not used skill({})", SkillID); return false; } @@ -3552,7 +3526,7 @@ bool CHARACTER::CheckSkillHitCount(const BYTE SkillID, const VID TargetVID) case SKILL_HWAYEOMPOK: case SKILL_DAEJINGAK: case SKILL_PAERYONG: - sys_log(0, "SkillHack: cannot use attack packet for skill(%u)", SkillID); + SPDLOG_WARN("SkillHack: cannot use attack packet for skill({})", SkillID); return false; } @@ -3584,7 +3558,7 @@ bool CHARACTER::CheckSkillHitCount(const BYTE SkillID, const VID TargetVID) if (iterTargetMap->second >= MaxAttackCountPerTarget) { - sys_log(0, "SkillHack: Too Many Hit count from SkillID(%u) count(%u)", SkillID, iterTargetMap->second); + SPDLOG_WARN("SkillHack: Too Many Hit count from SkillID({}) count({})", SkillID, iterTargetMap->second); return false; } diff --git a/src/game/src/char_state.cpp b/src/game/src/char_state.cpp index 426cc07..9e7becb 100644 --- a/src/game/src/char_state.cpp +++ b/src/game/src/char_state.cpp @@ -128,8 +128,8 @@ namespace { CAffect * pkAff = pkChr->FindAffect(AFFECT_WAR_FLAG); - sys_log(0, "FlagBase %s dist %d aff %p flag gid %d chr gid %u", - pkChr->GetName(), iDist, pkAff, m_pkChr->GetPoint(POINT_STAT), + SPDLOG_DEBUG("FlagBase {} dist {} aff {} flag gid {} chr gid {}", + pkChr->GetName(), iDist, (void*) pkAff, m_pkChr->GetPoint(POINT_STAT), pkChr->GetGuild()->GetID()); if (pkAff) @@ -313,7 +313,7 @@ void CHARACTER::CowardEscape() if (Goto(iDestX, iDestY)) SendMovePacket(FUNC_WAIT, 0, 0, 0, 0); - sys_log(0, "WAEGU move to %d %d (far)", iDestX, iDestY); + SPDLOG_TRACE("WAEGU move to {} {} (far)", iDestX, iDestY); return; } } @@ -877,7 +877,7 @@ void CHARACTER::StateMove() { if (IsPC()) { - sys_log(1, "µµÂø %s %d %d", GetName(), x, y); + SPDLOG_DEBUG("µµÂø {} {} {}", GetName(), x, y); GotoState(m_stateIdle); StopStaminaConsume(); } @@ -910,7 +910,7 @@ void CHARACTER::StateBattle() { if (IsStone()) { - sys_err("Stone must not use battle state (name %s)", GetName()); + SPDLOG_ERROR("Stone must not use battle state (name {})", GetName()); return; } @@ -982,7 +982,7 @@ void CHARACTER::StateBattle() if (Goto((int) dx, (int) dy)) { - sys_log(0, "KILL_AND_GO: %s distance %.1f", GetName(), fDist); + SPDLOG_DEBUG("KILL_AND_GO: {} distance {:.1f}", GetName(), fDist); SendMovePacket(FUNC_WAIT, 0, 0, 0, 0); } } @@ -1101,8 +1101,7 @@ void CHARACTER::StateBattle() float fDuration = CMotionManager::instance().GetMotionDuration(GetRaceNum(), MAKE_MOTION_KEY(MOTION_MODE_GENERAL, MOTION_SPECIAL_1 + iSkillIdx)); m_dwStateDuration = (DWORD) (fDuration == 0.0f ? PASSES_PER_SEC(2) : PASSES_PER_SEC(fDuration)); - if (test_server) - sys_log(0, "USE_MOB_SKILL: %s idx %u motion %u duration %.0f", GetName(), iSkillIdx, MOTION_SPECIAL_1 + iSkillIdx, fDuration); + SPDLOG_TRACE("USE_MOB_SKILL: {} idx {} motion {} duration {:.0f}", GetName(), iSkillIdx, MOTION_SPECIAL_1 + iSkillIdx, fDuration); return; } diff --git a/src/game/src/cmd.cpp b/src/game/src/cmd.cpp index 8171e86..4b6a112 100644 --- a/src/game/src/cmd.cpp +++ b/src/game/src/cmd.cpp @@ -598,7 +598,7 @@ void interpreter_set_privilege(const char *cmd, int lvl) if (!str_cmp(cmd, cmd_info[i].command)) { cmd_info[i].gm_level = lvl; - sys_log(0, "Setting command privilege: %s -> %d", cmd, lvl); + SPDLOG_INFO("Setting command privilege: {} -> {}", cmd, lvl); break; } } @@ -640,7 +640,7 @@ void interpret_command(LPCHARACTER ch, const char * argument, size_t len) { if (NULL == ch) { - sys_err ("NULL CHRACTER"); + SPDLOG_ERROR("NULL CHRACTER"); return ; } @@ -694,7 +694,7 @@ void interpret_command(LPCHARACTER ch, const char * argument, size_t len) break; */ default: - sys_err("unknown position %d", ch->GetPosition()); + SPDLOG_ERROR("unknown position {}", ch->GetPosition()); break; } @@ -714,7 +714,7 @@ void interpret_command(LPCHARACTER ch, const char * argument, size_t len) } if (strncmp("phase", cmd_info[icmd].command, 5) != 0) // È÷µç ¸í·É¾î ó¸® - sys_log(0, "COMMAND: %s: %s", ch->GetName(), cmd_info[icmd].command); + SPDLOG_DEBUG("COMMAND: {}: {}", ch->GetName(), cmd_info[icmd].command); ((*cmd_info[icmd].command_pointer) (ch, line, icmd, cmd_info[icmd].subcmd)); diff --git a/src/game/src/cmd_emotion.cpp b/src/game/src/cmd_emotion.cpp index 111cb31..958c60e 100644 --- a/src/game/src/cmd_emotion.cpp +++ b/src/game/src/cmd_emotion.cpp @@ -144,7 +144,7 @@ ACMD(do_emotion) if (*emotion_types[i].command == '\n') { - sys_err("cannot find emotion"); + SPDLOG_ERROR("cannot find emotion"); return; } @@ -260,8 +260,8 @@ ACMD(do_emotion) ch->PacketAround(buf.read_peek(), buf.size()); if (victim) - sys_log(1, "ACTION: %s TO %s", emotion_types[i].command, victim->GetName()); + SPDLOG_DEBUG("ACTION: {} TO {}", emotion_types[i].command, victim->GetName()); else - sys_log(1, "ACTION: %s", emotion_types[i].command); + SPDLOG_DEBUG("ACTION: {}", emotion_types[i].command); } diff --git a/src/game/src/cmd_general.cpp b/src/game/src/cmd_general.cpp index 4845962..51a9277 100644 --- a/src/game/src/cmd_general.cpp +++ b/src/game/src/cmd_general.cpp @@ -21,7 +21,6 @@ #include "item_manager.h" #include "monarch.h" #include "mob_manager.h" -#include "dev_log.h" #include "item.h" #include "arena.h" #include "buffer_manager.h" @@ -178,7 +177,7 @@ EVENTFUNC(shutdown_event) if ( info == NULL ) { - sys_err( "shutdown_event> Null pointer" ); + SPDLOG_ERROR("shutdown_event> Null pointer" ); return 0; } @@ -186,7 +185,7 @@ EVENTFUNC(shutdown_event) if (*pSec < 0) { - sys_log(0, "shutdown_event sec %d", *pSec); + SPDLOG_INFO("shutdown_event sec {}", *pSec); if (--*pSec == -10) { @@ -243,7 +242,7 @@ ACMD(do_shutdown) { if (NULL == ch) { - sys_err("Accept shutdown command from %s.", ch->GetName()); + SPDLOG_ERROR("Accept shutdown command from {}.", ch->GetName()); } TPacketGGShutdown p; p.bHeader = HEADER_GG_SHUTDOWN; @@ -258,7 +257,7 @@ EVENTFUNC(timed_event) if ( info == NULL ) { - sys_err( "timed_event> Null pointer" ); + SPDLOG_ERROR("timed_event> Null pointer" ); return 0; } @@ -589,7 +588,7 @@ ACMD(do_restart) switch (subcmd) { case SCMD_RESTART_TOWN: - sys_log(0, "do_restart: restart town"); + SPDLOG_DEBUG("do_restart: restart town"); PIXEL_POSITION pos; if (CWarMapManager::instance().GetStartPosition(ch->GetMapIndex(), ch->GetGuild()->GetID() < dwGuildOpponent ? 0 : 1, pos)) @@ -603,7 +602,7 @@ ACMD(do_restart) break; case SCMD_RESTART_HERE: - sys_log(0, "do_restart: restart here"); + SPDLOG_DEBUG("do_restart: restart here"); ch->RestartAtSamePos(); //ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY()); ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP()); @@ -619,7 +618,7 @@ ACMD(do_restart) switch (subcmd) { case SCMD_RESTART_TOWN: - sys_log(0, "do_restart: restart town"); + SPDLOG_DEBUG("do_restart: restart town"); PIXEL_POSITION pos; if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos)) @@ -632,7 +631,7 @@ ACMD(do_restart) break; case SCMD_RESTART_HERE: - sys_log(0, "do_restart: restart here"); + SPDLOG_DEBUG("do_restart: restart here"); ch->RestartAtSamePos(); //ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY()); ch->PointChange(POINT_HP, 50 - ch->GetHP()); @@ -1144,16 +1143,16 @@ ACMD(do_war) if (g->GetLadderPoint() == 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ·¹´õ Á¡¼ö°¡ ¸ðÀÚ¶ó¼­ ±æµåÀüÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù.")); - sys_log(0, "GuildWar.StartError.NEED_LADDER_POINT"); + SPDLOG_DEBUG("GuildWar.StartError.NEED_LADDER_POINT"); } else if (g->GetMemberCount() < GUILD_WAR_MIN_MEMBER_COUNT) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<±æµå> ±æµåÀüÀ» Çϱâ À§Çؼ± ÃÖ¼ÒÇÑ %d¸íÀÌ ÀÖ¾î¾ß ÇÕ´Ï´Ù."), GUILD_WAR_MIN_MEMBER_COUNT); - sys_log(0, "GuildWar.StartError.NEED_MINIMUM_MEMBER[%d]", GUILD_WAR_MIN_MEMBER_COUNT); + SPDLOG_DEBUG("GuildWar.StartError.NEED_MINIMUM_MEMBER[{}]", (int) GUILD_WAR_MIN_MEMBER_COUNT); } else { - sys_log(0, "GuildWar.StartError.UNKNOWN_ERROR"); + SPDLOG_DEBUG("GuildWar.StartError.UNKNOWN_ERROR"); } return; } @@ -2161,7 +2160,7 @@ ACMD(do_cube) if (!ch->CanDoCube()) return; - dev_log(LOG_DEB0, "CUBE COMMAND <%s>: %s", ch->GetName(), argument); + SPDLOG_TRACE("CUBE COMMAND <{}>: {}", ch->GetName(), argument); int cube_index = 0, inven_index = 0; const char *line; @@ -2254,7 +2253,7 @@ ACMD(do_cube) if (0 != arg2[0]) { while (true == Cube_make(ch)) - dev_log (LOG_DEB0, "cube make success"); + SPDLOG_TRACE("cube make success"); } else Cube_make(ch); @@ -2392,7 +2391,7 @@ ACMD(do_click_mall) ACMD(do_ride) { - dev_log(LOG_DEB0, "[DO_RIDE] start"); + SPDLOG_TRACE("[DO_RIDE] start"); if (ch->IsDead() || ch->IsStun()) return; @@ -2400,14 +2399,14 @@ ACMD(do_ride) { if (ch->IsHorseRiding()) { - dev_log(LOG_DEB0, "[DO_RIDE] stop riding"); + SPDLOG_TRACE("[DO_RIDE] stop riding"); ch->StopRiding(); return; } if (ch->GetMountVnum()) { - dev_log(LOG_DEB0, "[DO_RIDE] unmount"); + SPDLOG_TRACE("[DO_RIDE] unmount"); do_unmount(ch, NULL, 0, 0); return; } @@ -2417,7 +2416,7 @@ ACMD(do_ride) { if (ch->GetHorse() != NULL) { - dev_log(LOG_DEB0, "[DO_RIDE] start riding"); + SPDLOG_TRACE("[DO_RIDE] start riding"); ch->StartRiding(); return; } @@ -2433,7 +2432,7 @@ ACMD(do_ride) { if (NULL==ch->GetWear(WEAR_UNIQUE1) || NULL==ch->GetWear(WEAR_UNIQUE2)) { - dev_log(LOG_DEB0, "[DO_RIDE] USE UNIQUE ITEM"); + SPDLOG_TRACE("[DO_RIDE] USE UNIQUE ITEM"); //ch->EquipItem(item); ch->UseItem(TItemPos (INVENTORY, i)); return; @@ -2448,14 +2447,14 @@ ACMD(do_ride) case 71116: // »ê°ß½ÅÀÌ¿ë±Ç case 71118: // ÅõÁö¹üÀÌ¿ë±Ç case 71120: // »çÀÚ¿ÕÀÌ¿ë±Ç - dev_log(LOG_DEB0, "[DO_RIDE] USE QUEST ITEM"); + SPDLOG_TRACE("[DO_RIDE] USE QUEST ITEM"); ch->UseItem(TItemPos (INVENTORY, i)); return; } // GF mantis #113524, 52001~52090 ¹ø Å»°Í if( (item->GetVnum() > 52000) && (item->GetVnum() < 52091) ) { - dev_log(LOG_DEB0, "[DO_RIDE] USE QUEST ITEM"); + SPDLOG_TRACE("[DO_RIDE] USE QUEST ITEM"); ch->UseItem(TItemPos (INVENTORY, i)); return; } diff --git a/src/game/src/cmd_gm.cpp b/src/game/src/cmd_gm.cpp index 222fe75..1ae4d3d 100644 --- a/src/game/src/cmd_gm.cpp +++ b/src/game/src/cmd_gm.cpp @@ -51,7 +51,7 @@ void Command_ApplyAffect(LPCHARACTER ch, const char* argument, const char* affec char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); - sys_log(0, arg1); + SPDLOG_DEBUG(arg1); if (!*arg1) { @@ -76,7 +76,7 @@ void Command_ApplyAffect(LPCHARACTER ch, const char* argument, const char* affec break; } - sys_log(0, "%s %s", arg1, affectName); + SPDLOG_DEBUG("{} {}", arg1, affectName); ch->ChatPacket(CHAT_TYPE_INFO, "%s %s", arg1, affectName); } @@ -175,7 +175,7 @@ ACMD(do_transfer) else { ch->ChatPacket(CHAT_TYPE_INFO, "There is no character(%s) by that name", arg1); - sys_log(0, "There is no character(%s) by that name", arg1); + SPDLOG_DEBUG("There is no character({}) by that name", arg1); } return; @@ -240,7 +240,7 @@ void CHARACTER_AddGotoInfo(const std::string& c_st_name, BYTE empire, int mapInd newGotoInfo.y = y; gs_vec_gotoInfo.push_back(newGotoInfo); - sys_log(0, "AddGotoInfo(name=%s, empire=%d, mapIndex=%d, pos=(%d, %d))", c_st_name.c_str(), empire, mapIndex, x, y); + SPDLOG_DEBUG("AddGotoInfo(name={}, empire={}, mapIndex={}, pos=({}, {}))", c_st_name.c_str(), empire, mapIndex, x, y); } bool FindInString(const char * c_pszFind, const char * c_pszIn) @@ -605,8 +605,7 @@ ACMD(do_group) DWORD dwVnum = 0; str_to_number(dwVnum, arg1); - if (test_server) - sys_log(0, "COMMAND GROUP SPAWN %u at %u %u %u", dwVnum, ch->GetMapIndex(), ch->GetX(), ch->GetY()); + SPDLOG_TRACE("COMMAND GROUP SPAWN {} at {} {} {}", dwVnum, ch->GetMapIndex(), ch->GetX(), ch->GetY()); CHARACTER_MANAGER::instance().SpawnGroup(dwVnum, ch->GetMapIndex(), ch->GetX() - 500, ch->GetY() - 500, ch->GetX() + 500, ch->GetY() + 500); } @@ -892,7 +891,7 @@ struct FuncPurge if (!m_bAll && iDist >= 1000) // 10¹ÌÅÍ ÀÌ»ó¿¡ ÀÖ´Â °ÍµéÀº purge ÇÏÁö ¾Ê´Â´Ù. return; - sys_log(0, "PURGE: %s %d", pkChr->GetName(), iDist); + SPDLOG_DEBUG("PURGE: {} {}", pkChr->GetName(), iDist); if (pkChr->IsNPC() && !pkChr->IsPet() && pkChr->GetRider() == NULL) { @@ -915,7 +914,7 @@ ACMD(do_purge) if (sectree) // #431 sectree->ForEachAround(func); else - sys_err("PURGE_ERROR.NULL_SECTREE(mapIndex=%d, pos=(%d, %d)", ch->GetMapIndex(), ch->GetX(), ch->GetY()); + SPDLOG_ERROR("PURGE_ERROR.NULL_SECTREE(mapIndex={}, pos=({}, {})", ch->GetMapIndex(), ch->GetX(), ch->GetY()); } ACMD(do_item_purge) @@ -1735,7 +1734,7 @@ ACMD(do_event_flag) //quest::CQuestManager::instance().SetEventFlag(arg1, atoi(arg2)); quest::CQuestManager::instance().RequestSetEventFlag(arg1, value); ch->ChatPacket(CHAT_TYPE_INFO, "RequestSetEventFlag %s %d", arg1, value); - sys_log(0, "RequestSetEventFlag %s %d", arg1, value); + SPDLOG_DEBUG("RequestSetEventFlag {} {}", arg1, value); } ACMD(do_get_event_flag) @@ -2118,7 +2117,7 @@ ACMD(do_reload) case 'a': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading Admin infomation."); db_clientdesc->DBPacket(HEADER_GD_RELOAD_ADMIN, 0, NULL, 0); - sys_log(0, "Reloading admin infomation."); + SPDLOG_INFO("Reloading admin infomation."); break; //END_RELOAD_ADMIN case 'c': // cube @@ -2531,7 +2530,7 @@ ACMD(do_priv_empire) // ½Ã°£ ´ÜÀ§·Î º¯°æ duration = duration * (60*60); - sys_log(0, "_give_empire_privileage(empire=%d, type=%d, value=%d, duration=%d) by command", + SPDLOG_DEBUG("_give_empire_privileage(empire={}, type={}, value={}, duration={}) by command", empire, type, value, duration); CPrivManager::instance().RequestGiveEmpirePriv(empire, type, value, duration); return; @@ -2659,7 +2658,7 @@ ACMD(do_vote_block_chat) const char* name = arg1; int lBlockDuration = 10; - sys_log(0, "vote_block_chat %s %d", name, lBlockDuration); + SPDLOG_DEBUG("vote_block_chat {} {}", name, lBlockDuration); LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(name); @@ -2729,7 +2728,7 @@ ACMD(do_block_chat) return; } - sys_log(0, "BLOCK CHAT %s %d", name, lBlockDuration); + SPDLOG_DEBUG("BLOCK CHAT {} {}", name, lBlockDuration); LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(name); @@ -2781,7 +2780,7 @@ ACMD(do_build) // ¸Þ¼¼Áö¸¦ Àü¼ÛÇÏÁö ¾Ê°í ¿¡·¯¸¦ Ãâ·ÂÇÑ´Ù. if (!pkLand) { - sys_err("%s trying to build on not buildable area.", ch->GetName()); + SPDLOG_ERROR("{} trying to build on not buildable area.", ch->GetName()); return; } @@ -2797,14 +2796,14 @@ ACMD(do_build) // Ç÷¹À̾ ÁýÀ» ÁöÀ» ¶§´Â ¶¥ÀÌ ³»²«Áö È®ÀÎÇØ¾ß ÇÑ´Ù. if ((!ch->GetGuild() || ch->GetGuild()->GetID() != pkLand->GetOwner())) { - sys_err("%s trying to build on not owned land.", ch->GetName()); + SPDLOG_ERROR("{} trying to build on not owned land.", ch->GetName()); return; } // ³»°¡ ±æ¸¶Àΰ¡? if (ch->GetGuild()->GetMasterPID() != ch->GetPlayerID()) { - sys_err("%s trying to build while not the guild master.", ch->GetName()); + SPDLOG_ERROR("{} trying to build while not the guild master.", ch->GetName()); return; } } @@ -2946,7 +2945,7 @@ ACMD(do_build) if (dwItemVnum == 0) break; - sys_log(0, "BUILD: material %d %u %u", i, dwItemVnum, dwItemCount); + SPDLOG_DEBUG("BUILD: material {} {} {}", i, dwItemVnum, dwItemCount); ch->RemoveSpecifyItem(dwItemVnum, dwItemCount); } } @@ -2981,7 +2980,7 @@ ACMD(do_build) one_argument(line, arg1, sizeof(arg1)); - sys_log(0, "guild.wall.build map[%d] direction[%s]", mapIndex, arg1); + SPDLOG_DEBUG("guild.wall.build map[{}] direction[{}]", mapIndex, arg1); switch (arg1[0]) { @@ -2999,7 +2998,7 @@ ACMD(do_build) break; default: ch->ChatPacket(CHAT_TYPE_INFO, "guild.wall.build unknown_direction[%s]", arg1); - sys_err("guild.wall.build unknown_direction[%s]", arg1); + SPDLOG_ERROR("guild.wall.build unknown_direction[{}]", arg1); break; } @@ -3030,7 +3029,7 @@ ACMD(do_build) if (setID != 14105 && setID != 14115 && setID != 14125) { - sys_log(0, "BUILD_WALL: wrong wall set id %d", setID); + SPDLOG_WARN("BUILD_WALL: wrong wall set id {}", setID); break; } else diff --git a/src/game/src/config.cpp b/src/game/src/config.cpp index e9b1cdc..7da6204 100644 --- a/src/game/src/config.cpp +++ b/src/game/src/config.cpp @@ -15,7 +15,6 @@ #include "war_map.h" #include "locale_service.h" #include "config.h" -#include "dev_log.h" #include "db.h" #include "skill_power.h" @@ -161,24 +160,24 @@ void map_allow_log() std::set::iterator i; for (i = s_set_map_allows.begin(); i != s_set_map_allows.end(); ++i) - sys_log(0, "MAP_ALLOW: %d", *i); + SPDLOG_INFO("MAP_ALLOW: {}", *i); } void map_allow_add(int index) { if (map_allow_find(index) == true) { - fprintf(stdout, "!!! FATAL ERROR !!! multiple MAP_ALLOW setting!!\n"); - exit(1); + SPDLOG_CRITICAL("!!! FATAL ERROR !!! multiple MAP_ALLOW setting!!"); + exit(EXIT_FAILURE); } if (s_set_map_allows.size() >= MAP_ALLOW_MAX_LEN) { - fprintf(stdout, "Fatal error: maximum allowed maps reached!\n"); - exit(1); + SPDLOG_CRITICAL("Fatal error: maximum allowed maps reached!"); + exit(EXIT_FAILURE); } - fprintf(stdout, "MAP ALLOW %d\n", index); + SPDLOG_INFO("MAP ALLOW {}", index); s_set_map_allows.insert(index); } @@ -214,11 +213,11 @@ static void FN_log_adminpage() while (iter != g_stAdminPageIP.end()) { - dev_log(LOG_DEB0, "ADMIN_PAGE_IP = %s", (*iter).c_str()); + SPDLOG_TRACE("ADMIN_PAGE_IP = {}", (*iter).c_str()); ++iter; } - dev_log(LOG_DEB0, "ADMIN_PAGE_PASSWORD = %s", g_stAdminPagePassword.c_str()); + SPDLOG_TRACE("ADMIN_PAGE_PASSWORD = {}", g_stAdminPagePassword.c_str()); } /** @@ -308,14 +307,14 @@ void config_init(const string& st_localeServiceName) if (!(fp = fopen(st_configFileName.c_str(), "r"))) { - fprintf(stderr, "Can not open [%s]\n", st_configFileName.c_str()); - exit(1); + SPDLOG_CRITICAL("Can not open [{}]", st_configFileName); + exit(EXIT_FAILURE); } if (!GetIPInfo()) { - fprintf(stderr, "Failure in retrieving IP address information!\n"); - exit(1); + SPDLOG_CRITICAL("Failure in retrieving IP address information!"); + exit(EXIT_FAILURE); } char db_host[2][64], db_user[2][64], db_pwd[2][64], db_db[2][64]; @@ -351,8 +350,8 @@ void config_init(const string& st_localeServiceName) if (!(fpOnlyForDB = fopen(st_configFileName.c_str(), "r"))) { - fprintf(stderr, "Can not open [%s]\n", st_configFileName.c_str()); - exit(1); + SPDLOG_CRITICAL("Can not open [{}]", st_configFileName); + exit(EXIT_FAILURE); } while (fgets(buf, 256, fpOnlyForDB)) @@ -420,8 +419,8 @@ void config_init(const string& st_localeServiceName) if (!*db_host[0] || !*db_user[0] || !*db_pwd[0] || !*db_db[0]) { - fprintf(stderr, "PLAYER_SQL syntax: logsql \n"); - exit(1); + SPDLOG_CRITICAL("PLAYER_SQL syntax: logsql "); + exit(EXIT_FAILURE); } char buf[1024]; @@ -444,8 +443,8 @@ void config_init(const string& st_localeServiceName) if (!*db_host[1] || !*db_user[1] || !*db_pwd[1] || !*db_db[1]) { - fprintf(stderr, "COMMON_SQL syntax: logsql \n"); - exit(1); + SPDLOG_CRITICAL("COMMON_SQL syntax: logsql "); + exit(EXIT_FAILURE); } char buf[1024]; @@ -468,8 +467,8 @@ void config_init(const string& st_localeServiceName) if (!*log_host || !*log_user || !*log_pwd || !*log_db) { - fprintf(stderr, "LOG_SQL syntax: logsql \n"); - exit(1); + SPDLOG_CRITICAL("LOG_SQL syntax: logsql "); + exit(EXIT_FAILURE); } char buf[1024]; @@ -490,7 +489,7 @@ void config_init(const string& st_localeServiceName) puts("------------------------------------------------"); puts("COMMON_SQL: HOST USER PASSWORD DATABASE"); puts(""); - exit(1); + exit(EXIT_FAILURE); } if (!isPlayerSQL) @@ -501,7 +500,7 @@ void config_init(const string& st_localeServiceName) puts("------------------------------------------------"); puts("PLAYER_SQL: HOST USER PASSWORD DATABASE"); puts(""); - exit(1); + exit(EXIT_FAILURE); } // Common DB °¡ Locale Á¤º¸¸¦ °¡Áö°í Àֱ⠶§¹®¿¡ °¡Àå ¸ÕÀú Á¢¼ÓÇØ¾ß ÇÑ´Ù. @@ -525,8 +524,8 @@ void config_init(const string& st_localeServiceName) if (pMsg->Get()->uiNumRows == 0) { - fprintf(stderr, "COMMON_SQL: DirectQuery failed : %s\n", szQuery); - exit(1); + SPDLOG_CRITICAL("COMMON_SQL: DirectQuery failed: {}", szQuery); + exit(EXIT_FAILURE); } MYSQL_ROW row; @@ -538,8 +537,8 @@ void config_init(const string& st_localeServiceName) { if (LocaleService_Init(row[1]) == false) { - fprintf(stderr, "COMMON_SQL: invalid locale key %s\n", row[1]); - exit(1); + SPDLOG_CRITICAL("COMMON_SQL: invalid locale key {}", row[1]); + exit(EXIT_FAILURE); } } } @@ -547,7 +546,7 @@ void config_init(const string& st_localeServiceName) // ·ÎÄÉÀÏ Á¤º¸¸¦ COMMON SQL¿¡ ¼¼ÆÃÇØÁØ´Ù. // Âü°í·Î g_stLocale Á¤º¸´Â LocaleService_Init() ³»ºÎ¿¡¼­ ¼¼ÆõȴÙ. - fprintf(stdout, "Setting DB to locale %s\n", g_stLocale.c_str()); + SPDLOG_INFO("Setting DB to locale {}", g_stLocale.c_str()); AccountDB::instance().SetLocale(g_stLocale); @@ -558,11 +557,11 @@ void config_init(const string& st_localeServiceName) if (!DBManager::instance().IsConnected()) { - fprintf(stderr, "PlayerSQL.ConnectError\n"); - exit(1); + SPDLOG_CRITICAL("PlayerSQL.ConnectError"); + exit(EXIT_FAILURE); } - fprintf(stdout, "PlayerSQL connected\n"); + SPDLOG_INFO("PlayerSQL connected"); if (false == g_bAuthServer) // ÀÎÁõ ¼­¹ö°¡ ¾Æ´Ò °æ¿ì { @@ -571,11 +570,11 @@ void config_init(const string& st_localeServiceName) if (!LogManager::instance().IsConnected()) { - fprintf(stderr, "LogSQL.ConnectError\n"); - exit(1); + SPDLOG_CRITICAL("LogSQL.ConnectError"); + exit(EXIT_FAILURE); } - fprintf(stdout, "LogSQL connected\n"); + SPDLOG_INFO("LogSQL connected"); LogManager::instance().BootLog(g_stHostname.c_str(), g_bChannel); } @@ -590,8 +589,8 @@ void config_init(const string& st_localeServiceName) if (pMsg->Get()->uiNumRows == 0) { - fprintf(stderr, "[SKILL_PERCENT] Query failed: %s", szQuery); - exit(1); + SPDLOG_CRITICAL("[SKILL_PERCENT] Query failed: {}", szQuery); + exit(EXIT_FAILURE); } MYSQL_ROW row; @@ -603,22 +602,21 @@ void config_init(const string& st_localeServiceName) char num[128]; int aiBaseSkillPowerByLevelTable[SKILL_MAX_LEVEL+1]; - fprintf(stdout, "SKILL_POWER_BY_LEVEL %s\n", p); + SPDLOG_INFO("SKILL_POWER_BY_LEVEL {}", p); while (*p != '\0' && cnt < (SKILL_MAX_LEVEL + 1)) { p = one_argument(p, num, sizeof(num)); aiBaseSkillPowerByLevelTable[cnt++] = atoi(num); - //fprintf(stdout, "%d %d\n", cnt - 1, aiBaseSkillPowerByLevelTable[cnt - 1]); if (*p == '\0') { if (cnt != (SKILL_MAX_LEVEL + 1)) { - fprintf(stderr, "[SKILL_PERCENT] locale table has not enough skill information! (count: %d query: %s)", cnt, szQuery); - exit(1); + SPDLOG_CRITICAL("[SKILL_PERCENT] locale table has not enough skill information! (count: {} query: {})", cnt, szQuery); + exit(EXIT_FAILURE); } - fprintf(stdout, "SKILL_POWER_BY_LEVEL: Done! (count %d)\n", cnt); + SPDLOG_INFO("SKILL_POWER_BY_LEVEL: Done! (count {})", cnt); break; } } @@ -641,22 +639,21 @@ void config_init(const string& st_localeServiceName) p = row[0]; int aiSkillTable[SKILL_MAX_LEVEL + 1]; - fprintf(stdout, "SKILL_POWER_BY_JOB %d %s\n", job, p); + SPDLOG_INFO("SKILL_POWER_BY_JOB {} {}", job, p); while (*p != '\0' && cnt < (SKILL_MAX_LEVEL + 1)) { p = one_argument(p, num, sizeof(num)); aiSkillTable[cnt++] = atoi(num); - //fprintf(stdout, "%d %d\n", cnt - 1, aiBaseSkillPowerByLevelTable[cnt - 1]); if (*p == '\0') { if (cnt != (SKILL_MAX_LEVEL + 1)) { - fprintf(stderr, "[SKILL_PERCENT] locale table has not enough skill information! (count: %d query: %s)", cnt, szQuery); - exit(1); + SPDLOG_CRITICAL("[SKILL_PERCENT] locale table has not enough skill information! (count: {} query: {})", cnt, szQuery); + exit(EXIT_FAILURE); } - fprintf(stdout, "SKILL_POWER_BY_JOB: Done! (job: %d count: %d)\n", job, cnt); + SPDLOG_INFO("SKILL_POWER_BY_JOB: Done! (job: {} count: {})", job, cnt); break; } } @@ -902,20 +899,20 @@ void config_init(const string& st_localeServiceName) if (!*szIP || (!*szPort && strcasecmp(szIP, "master"))) { - fprintf(stderr, "AUTH_SERVER: syntax error: \n"); - exit(1); + SPDLOG_CRITICAL("AUTH_SERVER: syntax error: "); + exit(EXIT_FAILURE); } g_bAuthServer = true; if (!strcasecmp(szIP, "master")) - fprintf(stdout, "AUTH_SERVER: I am the master\n"); + SPDLOG_INFO("AUTH_SERVER: I am the master"); else { g_stAuthMasterIP = szIP; str_to_number(g_wAuthMasterPort, szPort); - fprintf(stdout, "AUTH_SERVER: master %s %u\n", g_stAuthMasterIP.c_str(), g_wAuthMasterPort); + SPDLOG_INFO("AUTH_SERVER: master {} {}", g_stAuthMasterIP.c_str(), g_wAuthMasterPort); } continue; } @@ -927,7 +924,7 @@ void config_init(const string& st_localeServiceName) TOKEN("quest_dir") { - sys_log(0, "QUEST_DIR SETTING : %s", value_string); + SPDLOG_INFO("QUEST_DIR SETTING : {}", value_string); g_stQuestDir = value_string; } @@ -935,7 +932,7 @@ void config_init(const string& st_localeServiceName) { //g_stQuestObjectDir = value_string; std::istringstream is(value_string); - sys_log(0, "QUEST_OBJECT_DIR SETTING : %s", value_string); + SPDLOG_INFO("QUEST_OBJECT_DIR SETTING : {}", value_string); string dir; while (!is.eof()) { @@ -943,7 +940,7 @@ void config_init(const string& st_localeServiceName) if (is.fail()) break; g_setQuestObjectDir.insert(dir); - sys_log(0, "QUEST_OBJECT_DIR INSERT : %s", dir .c_str()); + SPDLOG_INFO("QUEST_OBJECT_DIR INSERT : {}", dir .c_str()); } } @@ -1033,7 +1030,7 @@ void config_init(const string& st_localeServiceName) TOKEN("pk_protect_level") { str_to_number(PK_PROTECT_LEVEL, value_string); - fprintf(stderr, "PK_PROTECT_LEVEL: %d", PK_PROTECT_LEVEL); + SPDLOG_INFO("PK_PROTECT_LEVEL: {}", PK_PROTECT_LEVEL); } TOKEN("max_level") @@ -1042,7 +1039,7 @@ void config_init(const string& st_localeServiceName) gPlayerMaxLevel = std::clamp(gPlayerMaxLevel, 1, PLAYER_MAX_LEVEL_CONST); - fprintf(stderr, "PLAYER_MAX_LEVEL: %d\n", gPlayerMaxLevel); + SPDLOG_INFO("PLAYER_MAX_LEVEL: {}", gPlayerMaxLevel); } TOKEN("block_char_creation") @@ -1065,20 +1062,20 @@ void config_init(const string& st_localeServiceName) if (0 == db_port) { - fprintf(stderr, "DB_PORT not configured\n"); - exit(1); + SPDLOG_CRITICAL("DB_PORT not configured"); + exit(EXIT_FAILURE); } if (0 == g_bChannel) { - fprintf(stderr, "CHANNEL not configured\n"); - exit(1); + SPDLOG_CRITICAL("CHANNEL not configured"); + exit(EXIT_FAILURE); } if (g_stHostname.empty()) { - fprintf(stderr, "HOSTNAME must be configured.\n"); - exit(1); + SPDLOG_CRITICAL("HOSTNAME must be configured."); + exit(EXIT_FAILURE); } // LOCALE_SERVICE @@ -1100,8 +1097,8 @@ void config_init(const string& st_localeServiceName) if (!*cmd || !*levelname) { - fprintf(stderr, "CMD syntax error: \n"); - exit(1); + SPDLOG_CRITICAL("CMD syntax error: "); + exit(EXIT_FAILURE); } if (!strcasecmp(levelname, "LOW_WIZARD")) @@ -1118,8 +1115,8 @@ void config_init(const string& st_localeServiceName) level = GM_IMPLEMENTOR + 1; else { - fprintf(stderr, "CMD syntax error: \n"); - exit(1); + SPDLOG_CRITICAL("CMD syntax error: "); + exit(EXIT_FAILURE); } interpreter_set_privilege(cmd, level); @@ -1164,7 +1161,7 @@ void LoadValidCRCList() s_set_dwProcessCRC.insert(dwValidClientProcessCRC); s_set_dwFileCRC.insert(dwValidClientFileCRC); - fprintf(stderr, "CLIENT_CRC: %u %u\n", dwValidClientProcessCRC, dwValidClientFileCRC); + SPDLOG_INFO("CLIENT_CRC: {} {}", dwValidClientProcessCRC, dwValidClientFileCRC); } fclose(fp); @@ -1184,7 +1181,7 @@ bool LoadClientVersion() char * p = strchr(buf, '\n'); if (p) *p = '\0'; - fprintf(stderr, "VERSION: \"%s\"\n", buf); + SPDLOG_INFO("VERSION: \"{}\"", buf); g_stClientVersion = buf; fclose(fp); diff --git a/src/game/src/cube.cpp b/src/game/src/cube.cpp index 5d6562f..3205df8 100644 --- a/src/game/src/cube.cpp +++ b/src/game/src/cube.cpp @@ -12,7 +12,6 @@ #include "utils.h" #include "log.h" #include "char.h" -#include "dev_log.h" #include "locale_service.h" #include "item.h" #include "item_manager.h" @@ -297,17 +296,13 @@ void Cube_open (LPCHARACTER ch) npc = ch->GetQuestNPC(); if (NULL==npc) { - if (test_server) - dev_log(LOG_DEB0, "cube_npc is NULL"); + SPDLOG_TRACE("cube_npc is NULL"); return; } if ( FN_check_valid_npc(npc->GetRaceNum()) == false ) { - if ( test_server == true ) - { - dev_log(LOG_DEB0, "cube not valid NPC"); - } + SPDLOG_TRACE("cube not valid NPC"); return; } @@ -326,7 +321,7 @@ void Cube_open (LPCHARACTER ch) if (distance >= CUBE_MAX_DISTANCE) { - sys_log(1, "CUBE: TOO_FAR: %s distance %d", ch->GetName(), distance); + SPDLOG_DEBUG("CUBE: TOO_FAR: {} distance {}", ch->GetName(), distance); return; } @@ -343,7 +338,7 @@ void Cube_close (LPCHARACTER ch) Cube_clean_item(ch); ch->SetCubeNpc(NULL); ch->ChatPacket(CHAT_TYPE_COMMAND, "cube close"); - dev_log(LOG_DEB0, " close (%s)", ch->GetName()); + SPDLOG_TRACE(" close ({})", ch->GetName()); } void Cube_init() @@ -354,7 +349,7 @@ void Cube_init() char file_name[256+1]; snprintf(file_name, sizeof(file_name), "%s/cube.txt", LocaleService_GetBasePath().c_str()); - sys_log(0, "Cube_Init %s", file_name); + SPDLOG_INFO("Cube_Init {}", file_name); for (iter = s_cube_proto.begin(); iter!=s_cube_proto.end(); iter++) { @@ -365,7 +360,7 @@ void Cube_init() s_cube_proto.clear(); if (false == Cube_load(file_name)) - sys_err("Cube_Init failed"); + SPDLOG_ERROR("Cube_Init failed"); } bool Cube_load (const char *file) @@ -439,7 +434,7 @@ bool Cube_load (const char *file) // TODO : check cube data if (false == FN_check_cube_data(cube_data)) { - dev_log(LOG_DEB0, "something wrong"); + SPDLOG_TRACE("something wrong"); M2_DELETE(cube_data); continue; } @@ -454,23 +449,23 @@ bool Cube_load (const char *file) static void FN_cube_print (CUBE_DATA *data, DWORD index) { DWORD i; - dev_log(LOG_DEB0, "--------------------------------"); - dev_log(LOG_DEB0, "CUBE_DATA[%d]", index); + SPDLOG_TRACE("--------------------------------"); + SPDLOG_TRACE("CUBE_DATA[{}]", index); for (i=0; inpc_vnum.size(); ++i) { - dev_log(LOG_DEB0, "\tNPC_VNUM[%d] = %d", i, data->npc_vnum[i]); + SPDLOG_TRACE("\tNPC_VNUM[{}] = {}", i, data->npc_vnum[i]); } for (i=0; iitem.size(); ++i) { - dev_log(LOG_DEB0, "\tITEM[%d] = (%d, %d)", i, data->item[i].vnum, data->item[i].count); + SPDLOG_TRACE("\tITEM[{}] = ({}, {})", i, data->item[i].vnum, data->item[i].count); } for (i=0; ireward.size(); ++i) { - dev_log(LOG_DEB0, "\tREWARD[%d] = (%d, %d)", i, data->reward[i].vnum, data->reward[i].count); + SPDLOG_TRACE("\tREWARD[{}] = ({}, {})", i, data->reward[i].vnum, data->reward[i].count); } - dev_log(LOG_DEB0, "\tPERCENT = %d", data->percent); - dev_log(LOG_DEB0, "--------------------------------"); + SPDLOG_TRACE("\tPERCENT = {}", data->percent); + SPDLOG_TRACE("--------------------------------"); } void Cube_print () @@ -772,9 +767,7 @@ void Cube_MakeCubeInformationText() sprintf(temp, "%d", materialInfo.gold); infoText += std::string("/") + temp; } - - //sys_err("\t\tNPC: %d, Reward: %d(%s)\n\t\t\tInfo: %s", npcVNUM, materialInfo.reward.vnum, ITEM_MANAGER::Instance().GetTable(materialInfo.reward.vnum)->szName, materialInfo.infoText.c_str()); - } // for resultList + } // for resultList } // for npc } @@ -789,12 +782,12 @@ bool Cube_InformationInitialize() // ÇϵåÄÚµù ¤¸¤µ if (1 != rewards.size()) { - sys_err("[CubeInfo] WARNING! Does not support multiple rewards (count: %d)", rewards.size()); + SPDLOG_ERROR("[CubeInfo] WARNING! Does not support multiple rewards (count: {})", rewards.size()); continue; } //if (1 != cubeData->npc_vnum.size()) //{ - // sys_err("[CubeInfo] WARNING! Does not support multiple NPC (count: %d)", cubeData->npc_vnum.size()); + // SPDLOG_ERROR("[CubeInfo] WARNING! Does not support multiple NPC (count: {})", cubeData->npc_vnum.size()); // continue; //} @@ -828,7 +821,7 @@ bool Cube_InformationInitialize() TItemTable* existMaterialProto = ITEM_MANAGER::Instance().GetTable(existMaterialIter->vnum); if (NULL == existMaterialProto) { - sys_err("There is no item(%u)", existMaterialIter->vnum); + SPDLOG_ERROR("There is no item({})", existMaterialIter->vnum); return false; } SItemNameAndLevel existItemInfo = SplitItemNameAndLevelFromName(existMaterialProto->szName); @@ -908,7 +901,7 @@ void Cube_request_result_list(LPCHARACTER ch) // äÆà ÆÐŶÀÇ ÇѰ踦 ³Ñ¾î°¡¸é ¿¡·¯ ³²±è... ±âȹÀÚ ºÐµé ²² Á¶Á¤ÇØ´Þ¶ó°í ¿äûÇϰųª, ³ªÁß¿¡ ´Ù¸¥ ¹æ½ÄÀ¸·Î ¹Ù²Ù°Å³ª... if (resultText.size() - 20 >= CHAT_MAX_LEN) { - sys_err("[CubeInfo] Too long cube result list text. (NPC: %d, length: %d)", npcVNUM, resultText.size()); + SPDLOG_ERROR("[CubeInfo] Too long cube result list text. (NPC: {}, length: {})", npcVNUM, resultText.size()); resultText.clear(); resultCount = 0; } @@ -958,7 +951,7 @@ void Cube_request_material_info(LPCHARACTER ch, int requestStartIndex, int reque if (false == bCatchInfo) { - sys_err("[CubeInfo] Can't find matched material info (NPC: %d, index: %d, request count: %d)", npcVNUM, requestStartIndex, requestCount); + SPDLOG_ERROR("[CubeInfo] Can't find matched material info (NPC: {}, index: {}, request count: {})", npcVNUM, requestStartIndex, requestCount); return; } @@ -968,7 +961,7 @@ void Cube_request_material_info(LPCHARACTER ch, int requestStartIndex, int reque // (Server -> Client) /cube m_info start_index count 125,1|126,2|127,2|123,5&555,5&555,4/120000 if (materialInfoText.size() - 20 >= CHAT_MAX_LEN) { - sys_err("[CubeInfo] Too long material info. (NPC: %d, requestStart: %d, requestCount: %d, length: %d)", npcVNUM, requestStartIndex, requestCount, materialInfoText.size()); + SPDLOG_ERROR("[CubeInfo] Too long material info. (NPC: {}, requestStart: {}, requestCount: {}, length: {})", npcVNUM, requestStartIndex, requestCount, materialInfoText.size()); } ch->ChatPacket(CHAT_TYPE_COMMAND, "cube m_info %d %d %s", requestStartIndex, requestCount, materialInfoText.c_str()); diff --git a/src/game/src/db.cpp b/src/game/src/db.cpp index 0ffb912..e0a73e1 100644 --- a/src/game/src/db.cpp +++ b/src/game/src/db.cpp @@ -36,7 +36,7 @@ bool DBManager::Connect(const char * host, const int port, const char * user, co m_bIsConnect = true; if (!m_sql_direct.Setup(host, user, pwd, db, g_stLocale.c_str(), true, port)) - sys_err("cannot open direct sql connection to host %s", host); + SPDLOG_ERROR("cannot open direct sql connection to host {}", host); if (m_bIsConnect && !g_bAuthServer) { @@ -77,7 +77,6 @@ bool DBManager::IsConnected() void DBManager::ReturnQuery(int iType, DWORD dwIdent, void * pvData, const char * c_pszFormat, ...) { - //sys_log(0, "ReturnQuery %s", c_pszQuery); char szQuery[4096]; va_list args; @@ -163,7 +162,7 @@ void DBManager::DeleteLoginData(CLoginData * pkLD) if (it == m_map_pkLoginData.end()) return; - sys_log(0, "DeleteLoginData %s %p", pkLD->GetLogin(), pkLD); + SPDLOG_DEBUG("DeleteLoginData {} {}", pkLD->GetLogin(), (void*) pkLD); mapLDBilling.erase(pkLD->GetLogin()); @@ -177,7 +176,7 @@ void DBManager::SetBilling(DWORD dwKey, bool bOn, bool bSkipPush) if (it == m_map_pkLoginData.end()) { - sys_err("cannot find login key %u", dwKey); + SPDLOG_ERROR("cannot find login key {}", dwKey); return; } @@ -214,7 +213,7 @@ void DBManager::PushBilling(CLoginData * pkLD) t.dwLoginKey = pkLD->GetKey(); t.bBillType = pkLD->GetBillType(); - sys_log(0, "BILLING: PUSH %s %u type %u", pkLD->GetLogin(), t.dwUseSec, t.bBillType); + 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()); @@ -335,7 +334,7 @@ void DBManager::FlushBilling(bool bForce) else m_vec_kUseTime.clear(); - sys_log(0, "FLUSH_USE_TIME: count %u", dwCount); + SPDLOG_DEBUG("FLUSH_USE_TIME: count {}", dwCount); } if (m_vec_kUseTime.size() < 10240) @@ -374,7 +373,7 @@ void DBManager::FlushBilling(bool bForce) if (dwSecsConnected >= 60) // 60 second cycle { - sys_log(0, "BILLING 1 %s remain %d connected secs %u", + SPDLOG_DEBUG("BILLING 1 {} remain {} connected secs {}", pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected); PushBilling(pkLD); } @@ -385,7 +384,7 @@ void DBManager::FlushBilling(bool bForce) if (dwSecsConnected > (DWORD) (pkLD->GetRemainSecs() - 600) || dwSecsConnected >= 600) { - sys_log(0, "BILLING 2 %s remain %d connected secs %u", + SPDLOG_DEBUG("BILLING 2 {} remain {} connected secs {}", pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected); PushBilling(pkLD); } @@ -402,8 +401,6 @@ void DBManager::CheckBilling() std::vector vec; vec.push_back(0); // Ä«¿îÆ®¸¦ À§ÇØ ¹Ì¸® ºñ¿öµÐ´Ù. - //sys_log(0, "CheckBilling: map size %d", m_map_pkLoginData.size()); - itertype(m_map_pkLoginData) it = m_map_pkLoginData.begin(); while (it != m_map_pkLoginData.end()) @@ -412,7 +409,7 @@ void DBManager::CheckBilling() if (pkLD->IsBilling()) { - sys_log(0, "BILLING: CHECK %u", pkLD->GetKey()); + SPDLOG_DEBUG("BILLING: CHECK {}", pkLD->GetKey()); vec.push_back(pkLD->GetKey()); } } @@ -460,7 +457,7 @@ void DBManager::SendAuthLogin(LPDESC d) memcpy(&ptod.adwClientKey, pkLD->GetClientKey(), sizeof(DWORD) * 4); db_clientdesc->DBPacket(HEADER_GD_AUTH_LOGIN, d->GetHandle(), &ptod, sizeof(TPacketGDAuthLogin)); - sys_log(0, "SendAuthLogin %s key %u", ptod.szLogin, ptod.dwID); + SPDLOG_DEBUG("SendAuthLogin {} key {}", ptod.szLogin, ptod.dwID); SendLoginPing(r.login); } @@ -499,7 +496,7 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP d->Packet(&pm, sizeof(TPacketGCMatrixCard)); - sys_log(0, "MATRIX_QUERY: %s %c%d %c%d %c%d %c%d %s", + SPDLOG_DEBUG("MATRIX_QUERY: {} {}{} {}{} {}{} {}{} {}", r.login, MATRIX_CARD_ROW(rows, 0) + 'A', MATRIX_CARD_COL(cols, 0) + 1, @@ -581,7 +578,7 @@ bool GetGameTime(MYSQL_RES * pRes, BYTE & bBillType, int & seconds) return true; MYSQL_ROW row = mysql_fetch_row(pRes); - sys_log(1, "GetGameTime %p %p %p", row[0], row[1], row[2]); + SPDLOG_DEBUG("GetGameTime {} {} {}", row[0], row[1], row[2]); int type = 0; str_to_number(type, row[0]); @@ -616,7 +613,7 @@ void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLogi ptod.bBillType = bBillType; ptod.dwRemainSeconds = std::max(0, iSecs); db_clientdesc->DBPacket(HEADER_GD_BILLING_EXPIRE, 0, &ptod, sizeof(TPacketBillingExpire)); - sys_log(0, "BILLING: EXPIRE %s type %d sec %d ptr %p", c_pszLogin, bBillType, iSecs, pkLD); + SPDLOG_DEBUG("BILLING: EXPIRE {} type {} sec {} ptr {}", c_pszLogin, bBillType, iSecs, (void*) pkLD); } void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) @@ -638,11 +635,11 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) //À§Ä¡ º¯°æ - By SeMinZ d->SetLogin(pinfo->login); - sys_log(0, "QID_AUTH_LOGIN: START %u %p", qi->dwIdent, get_pointer(d)); + SPDLOG_DEBUG("QID_AUTH_LOGIN: START {} {}", qi->dwIdent, (void*) get_pointer(d)); if (pMsg->Get()->uiNumRows == 0) { - sys_log(0, " NOID"); + SPDLOG_DEBUG(" NOID"); LoginFailure(d, "NOID"); M2_DELETE(pinfo); } @@ -661,7 +658,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!row[col]) { - sys_err("error column %d", col); + SPDLOG_ERROR("error column {}", col); M2_DELETE(pinfo); break; } @@ -670,7 +667,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!row[col]) { - sys_err("error column %d", col); + SPDLOG_ERROR("error column {}", col); M2_DELETE(pinfo); break; } @@ -689,7 +686,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!row[col]) { - sys_err("error column %d", col); + SPDLOG_ERROR("error column {}", col); M2_DELETE(pinfo); break; } @@ -698,7 +695,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!row[col]) { - sys_err("error column %d", col); + SPDLOG_ERROR("error column {}", col); M2_DELETE(pinfo); break; } @@ -707,7 +704,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!row[col]) { - sys_err("error column %d", col); + SPDLOG_ERROR("error column {}", col); M2_DELETE(pinfo); break; } @@ -752,8 +749,8 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) tm1 = localtime(&create_time); strftime(szCreateDate, 255, "%Y%m%d", tm1); - sys_log(0, "Create_Time %d %s", retValue, szCreateDate); - sys_log(0, "Block Time %d ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8)); + SPDLOG_DEBUG("Create_Time {} {}", retValue, szCreateDate); + SPDLOG_DEBUG("Block Time {} ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8)); } } @@ -767,25 +764,25 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (nPasswordDiff) { LoginFailure(d, "WRONGPWD"); - sys_log(0, " WRONGPWD"); + SPDLOG_DEBUG(" WRONGPWD"); M2_DELETE(pinfo); } else if (bNotAvail) { LoginFailure(d, "NOTAVAIL"); - sys_log(0, " NOTAVAIL"); + SPDLOG_DEBUG(" NOTAVAIL"); M2_DELETE(pinfo); } else if (DESC_MANAGER::instance().FindByLoginName(pinfo->login)) { LoginFailure(d, "ALREADY"); - sys_log(0, " ALREADY"); + SPDLOG_DEBUG(" ALREADY"); M2_DELETE(pinfo); } else if (strcmp(szStatus, "OK")) { LoginFailure(d, szStatus); - sys_log(0, " STATUS: %s", szStatus); + SPDLOG_DEBUG(" STATUS: {}", szStatus); M2_DELETE(pinfo); } else @@ -796,7 +793,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (strncmp(szCreateDate, g_stBlockDate.c_str(), 8) >= 0) { LoginFailure(d, "BLKLOGIN"); - sys_log(0, " BLKLOGIN"); + SPDLOG_DEBUG(" BLKLOGIN"); M2_DELETE(pinfo); break; } @@ -824,7 +821,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) break; } - sys_log(0, "QID_AUTH_LOGIN: SUCCESS %s", pinfo->login); + SPDLOG_DEBUG("QID_AUTH_LOGIN: SUCCESS {}", pinfo->login); } } } @@ -835,7 +832,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) qi->pvData; LPDESC d = DESC_MANAGER::instance().FindByLoginKey(qi->dwIdent); - sys_log(0, "QID_BILLING_GET_TIME: START ident %u d %p", qi->dwIdent, get_pointer(d)); + SPDLOG_DEBUG("QID_BILLING_GET_TIME: START ident {} d {}", qi->dwIdent, (void*) get_pointer(d)); if (d) { @@ -853,18 +850,18 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!GetGameTime(pMsg->Get()->pSQLResult, bBillType, seconds)) { - sys_log(0, "QID_BILLING_GET_TIME: BLOCK"); + SPDLOG_DEBUG("QID_BILLING_GET_TIME: BLOCK"); LoginFailure(d, "BLOCK"); } else if (bBillType == BILLING_NONE) { LoginFailure(d, "NOBILL"); - sys_log(0, "QID_BILLING_GET_TIME: NO TIME"); + SPDLOG_DEBUG("QID_BILLING_GET_TIME: NO TIME"); } else { LoginPrepare(bBillType, 0, seconds, d, pinfo->adwClientKey); - sys_log(0, "QID_BILLING_GET_TIME: SUCCESS"); + SPDLOG_DEBUG("QID_BILLING_GET_TIME: SUCCESS"); } } } @@ -961,7 +958,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (row[0] && row[1]) { m_map_dbstring.insert(make_pair(std::string(row[0]), std::string(row[1]))); - sys_log(0, "DBSTR '%s' '%s'", row[0], row[1]); + SPDLOG_DEBUG("DBSTR '{}' '{}'", row[0], row[1]); } } if (m_map_dbstring.find("GREET") != m_map_dbstring.end()) @@ -986,7 +983,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) { if (pMsg->Get()->uiAffectedRows == 0 || pMsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "GIVE LOTTO FAIL TO pid %u", ch->GetPlayerID()); + SPDLOG_DEBUG("GIVE LOTTO FAIL TO pid {}", ch->GetPlayerID()); } else { @@ -994,14 +991,14 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (pkItem) { - sys_log(0, "GIVE LOTTO SUCCESS TO %s (pid %u)", ch->GetName(), qi->dwIdent); + SPDLOG_DEBUG("GIVE LOTTO SUCCESS TO {} (pid {})", ch->GetName(), qi->dwIdent); //ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), pkItem->GetName()); pkItem->SetSocket(0, pMsg->Get()->uiInsertID); pkItem->SetSocket(1, pdw[2]); } else - sys_log(0, "GIVE LOTTO FAIL2 TO pid %u", ch->GetPlayerID()); + SPDLOG_DEBUG("GIVE LOTTO FAIL2 TO pid {}", ch->GetPlayerID()); } } @@ -1080,8 +1077,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) const char* c_szName = row[0]; const char* c_szUpdateTime = row[12]; - if (test_server) - sys_log(0, "%s:%s", c_szName, c_szUpdateTime); + SPDLOG_TRACE("{}:{}", c_szName, c_szUpdateTime); if (PCBANG_IP_TABLE_NAME == c_szName) { @@ -1091,12 +1087,12 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (s_stLastTime != c_szUpdateTime) { s_stLastTime = c_szUpdateTime; - sys_log(0, "'%s' mysql table is UPDATED(%s)", PCBANG_IP_TABLE_NAME.c_str(), 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 { - sys_log(0, "'%s' mysql table is NOT updated(%s)", PCBANG_IP_TABLE_NAME.c_str(), c_szUpdateTime); + SPDLOG_DEBUG("'{}' mysql table is NOT updated({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime); } break; } @@ -1104,12 +1100,12 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) if (!isFinded) { - sys_err(0, "'%s' mysql table CANNOT FIND", PCBANG_IP_TABLE_NAME.c_str()); + SPDLOG_ERROR("'{}' mysql table CANNOT FIND", PCBANG_IP_TABLE_NAME); } } else if (test_server) { - sys_err(0, "'%s' mysql table is NOT EXIST", PCBANG_IP_TABLE_NAME.c_str()); + SPDLOG_ERROR("'{}' mysql table is NOT EXIST", PCBANG_IP_TABLE_NAME); } } break; @@ -1125,10 +1121,8 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) CPCBangManager::instance().InsertIP(row[0], row[1]); } } - else if (test_server) - { - sys_log(0, "PCBANG_IP_LIST is EMPTY"); - } + else + SPDLOG_TRACE("PCBANG_IP_LIST is EMPTY"); } break; @@ -1136,7 +1130,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg) // END_OF_PCBANG_IP_LIST default: - sys_err("FATAL ERROR!!! Unhandled return query id %d", qi->iType); + SPDLOG_ERROR("FATAL ERROR!!! Unhandled return query id {}", qi->iType); break; } @@ -1193,7 +1187,7 @@ void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item) ITEM_MANAGER::instance().RemoveItem(item); - sys_log(0, "VCARD_TAKE: %u %s -> %s", p.dwID, CardOwner->GetName(), CardTaker->GetName()); + SPDLOG_DEBUG("VCARD_TAKE: {} {} -> {}", p.dwID, CardOwner->GetName(), CardTaker->GetName()); } void DBManager::StopAllBilling() diff --git a/src/game/src/desc.cpp b/src/game/src/desc.cpp index 873fde2..7be9c29 100644 --- a/src/game/src/desc.cpp +++ b/src/game/src/desc.cpp @@ -29,9 +29,6 @@ void DescReadHandler(bufferevent *bev, void *ctx) { { int size = d->ProcessInput(); - if (size) - sys_log(1, "DB_BYTES_READ: %d", size); - if (size < 0) { d->SetPhase(PHASE_CLOSE); @@ -50,15 +47,11 @@ void DescWriteHandler(bufferevent *bev, void *ctx) { { evbuffer *output = bufferevent_get_output(bev); size_t buf_size = evbuffer_get_length(output); - if (buf_size) - sys_log(1, "DB_BYTES_WRITE: size %d", buf_size); } else if (g_TeenDesc==d) { evbuffer *output = bufferevent_get_output(bev); size_t buf_size = evbuffer_get_length(output); - if (buf_size) - sys_log(0, "TEEN::Send(size %d)", buf_size); } } @@ -66,10 +59,10 @@ void DescEventHandler(bufferevent *bev, short events, void *ctx) { auto* d = (LPDESC) ctx; if (events & BEV_EVENT_ERROR) - sys_err("DESC libevent error, handle: %d", d->GetHandle()); + SPDLOG_ERROR("DESC libevent error, handle: {}", d->GetHandle()); if (events & BEV_EVENT_EOF) - sys_log(0, "DESC disconnected: handle %d", d->GetHandle()); + SPDLOG_DEBUG("DESC disconnected: handle {}", d->GetHandle()); // Either the socket was closed or an error occured, therefore we can disconnect this peer. if (events & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) @@ -108,8 +101,6 @@ void DESC::Initialize() m_lpCharacter = NULL; memset( &m_accountTable, 0, sizeof(m_accountTable) ); - m_pLogFile = NULL; - m_wP2PPort = 0; m_bP2PChannel = 0; @@ -154,12 +145,6 @@ void DESC::Destroy() if (GetAccountTable().id) DESC_MANAGER::instance().DisconnectAccount(GetAccountTable().login); - if (m_pLogFile) - { - fclose(m_pLogFile); - m_pLogFile = NULL; - } - if (m_lpCharacter) { m_lpCharacter->Disconnect("DESC::~DESC"); @@ -184,8 +169,7 @@ void DESC::Destroy() if (m_bufevent != nullptr) { - sys_log(0, "SYSTEM: closing socket."); - Log("SYSTEM: closing socket."); + SPDLOG_DEBUG("SYSTEM: closing socket."); bufferevent_free(m_bufevent); m_bufevent = nullptr; @@ -200,7 +184,7 @@ EVENTFUNC(ping_event) if ( info == NULL ) { - sys_err( "ping_event> Null pointer" ); + SPDLOG_ERROR("ping_event> Null pointer" ); return 0; } @@ -211,7 +195,7 @@ EVENTFUNC(ping_event) if (!desc->IsPong()) { - sys_log(0, "PING_EVENT: no pong %s", desc->GetHostName()); + SPDLOG_WARN("PING_EVENT: no pong {}", desc->GetHostName()); desc->SetPhase(PHASE_CLOSE); @@ -244,7 +228,7 @@ bool DESC::Setup(event_base * evbase, evutil_socket_t fd, const sockaddr * c_rSo { m_bufevent = bufferevent_socket_new(evbase, fd, BEV_OPT_CLOSE_ON_FREE); if (m_bufevent == nullptr) { - sys_err("DESC::Setup : Could not set up bufferevent!"); + SPDLOG_ERROR("DESC::Setup : Could not set up bufferevent!"); return false; } @@ -270,10 +254,8 @@ bool DESC::Setup(event_base * evbase, evutil_socket_t fd, const sockaddr * c_rSo SetPhase(PHASE_HANDSHAKE); StartHandshake(_handshake); - sys_log(0, "SYSTEM: new connection from [%s] handshake %u, ptr %p", - m_stHost.c_str(), m_dwHandshake, this); + SPDLOG_DEBUG("SYSTEM: new connection from [{}] handshake {}, ptr {}", m_stHost, m_dwHandshake, (void*) this); - Log("SYSTEM: new connection from [%s] handshake %u ptr %p", m_stHost.c_str(), m_dwHandshake, this); return true; } @@ -281,12 +263,12 @@ bool DESC::ProcessInput() { evbuffer *input = bufferevent_get_input(m_bufevent); if (input == nullptr) { - sys_err("DESC::ProcessInput : nil input buffer"); + SPDLOG_ERROR("DESC::ProcessInput : nil input buffer"); return false; } if (!m_pInputProcessor) { - sys_err("no input processor"); + SPDLOG_ERROR("no input processor"); return false; } @@ -320,12 +302,12 @@ bool DESC::RawPacket(const void * c_pvData, int iSize) return false; if (!m_bufevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return false; } if (bufferevent_write(m_bufevent, c_pvData, iSize) != 0) { - sys_err("Buffer write error!"); + SPDLOG_ERROR("Buffer write error!"); return false; } @@ -373,8 +355,6 @@ void DESC::Packet(const void * c_pvData, int iSize) m_iPhase = PHASE_CLOSE; } } - - //sys_log(0, "%d bytes written (first byte %d)", iSize, *(BYTE *) c_pvData); } void DESC::SetPhase(int _phase) @@ -413,7 +393,7 @@ void DESC::SetPhase(int _phase) case PHASE_AUTH: m_pInputProcessor = &m_inputAuth; - sys_log(0, "AUTH_PHASE %p", this); + SPDLOG_DEBUG("AUTH_PHASE {}", (void*) this); break; } } @@ -425,33 +405,6 @@ void DESC::BindAccountTable(TAccountTable * pAccountTable) DESC_MANAGER::instance().ConnectAccount(m_accountTable.login, this); } -void DESC::Log(const char * format, ...) -{ - if (!m_pLogFile) - return; - - va_list args; - - time_t ct = get_global_time(); - struct tm tm = *localtime(&ct); - - fprintf(m_pLogFile, - "%02d %02d %02d:%02d:%02d | ", - tm.tm_mon + 1, - tm.tm_mday, - tm.tm_hour, - tm.tm_min, - tm.tm_sec); - - va_start(args, format); - vfprintf(m_pLogFile, format, args); - va_end(args); - - fputs("\n", m_pLogFile); - - fflush(m_pLogFile); -} - void DESC::StartHandshake(DWORD _handshake) { // Handshake @@ -483,7 +436,7 @@ bool DESC::HandshakeProcess(DWORD dwTime, LONG lDelta, bool bInfiniteRetry) if (lDelta < 0) { - sys_err("Desc::HandshakeProcess : value error (lDelta %d, ip %s)", lDelta, m_stHost.c_str()); + SPDLOG_ERROR("Desc::HandshakeProcess : value error (lDelta {}, ip {})", lDelta, m_stHost.c_str()); return false; } @@ -498,9 +451,9 @@ bool DESC::HandshakeProcess(DWORD dwTime, LONG lDelta, bool bInfiniteRetry) } if (GetCharacter()) - sys_log(0, "Handshake: client_time %u server_time %u name: %s", m_dwClientTime, dwCurTime, GetCharacter()->GetName()); + SPDLOG_DEBUG("Handshake: client_time {} server_time {} name: {}", m_dwClientTime, dwCurTime, GetCharacter()->GetName()); else - sys_log(0, "Handshake: client_time %u server_time %u", m_dwClientTime, dwCurTime, lDelta); + SPDLOG_DEBUG("Handshake: client_time {} server_time {}", m_dwClientTime, dwCurTime, lDelta); m_dwClientTime = dwCurTime; m_bHandshaking = false; @@ -511,16 +464,16 @@ bool DESC::HandshakeProcess(DWORD dwTime, LONG lDelta, bool bInfiniteRetry) if (lNewDelta < 0) { - sys_log(0, "Handshake: lower than zero %d", lNewDelta); + SPDLOG_DEBUG("Handshake: lower than zero {}", lNewDelta); lNewDelta = (dwCurTime - m_dwHandshakeSentTime) / 2; } - sys_log(1, "Handshake: ServerTime %u dwTime %u lDelta %d SentTime %u lNewDelta %d", dwCurTime, dwTime, lDelta, m_dwHandshakeSentTime, lNewDelta); + SPDLOG_DEBUG("Handshake: ServerTime {} dwTime {} lDelta {} SentTime {} lNewDelta {}", dwCurTime, dwTime, lDelta, m_dwHandshakeSentTime, lNewDelta); if (!bInfiniteRetry) if (++m_iHandshakeRetry > HANDSHAKE_RETRY_LIMIT) { - sys_err("handshake retry limit reached! (limit %d character %s)", + SPDLOG_ERROR("handshake retry limit reached! (limit {} character {})", HANDSHAKE_RETRY_LIMIT, GetCharacter() ? GetCharacter()->GetName() : "!NO CHARACTER!"); SetPhase(PHASE_CLOSE); return false; @@ -556,10 +509,9 @@ void DESC::FlushOutput() return; if (bufferevent_flush(m_bufevent, EV_WRITE, BEV_FLUSH) < 0) - sys_log(0, "FLUSH FAIL"); - else - sys_log(0, "FLUSH SUCCESS"); + SPDLOG_ERROR("FLUSH FAIL"); + // TODO: investigate if necessary usleep(250000); } @@ -569,7 +521,7 @@ EVENTFUNC(disconnect_event) if ( info == NULL ) { - sys_err( "disconnect_event> Null pointer" ); + SPDLOG_ERROR("disconnect_event> Null pointer" ); return 0; } @@ -714,7 +666,7 @@ void DESC::SetLoginKey(DWORD dwKey) void DESC::SetLoginKey(CLoginKey * pkKey) { m_pkLoginKey = pkKey; - sys_log(0, "SetLoginKey %u", m_pkLoginKey->m_dwKey); + SPDLOG_DEBUG("SetLoginKey {}", m_pkLoginKey->m_dwKey); } DWORD DESC::GetLoginKey() diff --git a/src/game/src/desc.h b/src/game/src/desc.h index d179595..b2f4a1d 100644 --- a/src/game/src/desc.h +++ b/src/game/src/desc.h @@ -109,8 +109,6 @@ class DESC bool IsPhase(int phase) const { return m_iPhase == phase ? true : false; } - void Log(const char * format, ...); - // Çڵ彦ÀÌÅ© (½Ã°£ µ¿±âÈ­) void StartHandshake(DWORD _dw); void SendHandshake(DWORD dwCurTime, LONG lNewDelta); @@ -197,7 +195,6 @@ class DESC LPCHARACTER m_lpCharacter; TAccountTable m_accountTable; - FILE * m_pLogFile; std::string m_stRelayName; WORD m_wP2PPort; diff --git a/src/game/src/desc_client.cpp b/src/game/src/desc_client.cpp index 5c30653..59016bc 100644 --- a/src/game/src/desc_client.cpp +++ b/src/game/src/desc_client.cpp @@ -33,7 +33,7 @@ void ClientDescEventHandler(bufferevent *bev, short events, void *ptr) { auto * clientDesc = static_cast(ptr); if (events & BEV_EVENT_CONNECTED) { - sys_log(0, "SYSTEM: connected to server (ptr %p)", clientDesc); + SPDLOG_DEBUG("SYSTEM: connected to server (ptr {})", (void*) clientDesc); clientDesc->OnConnectSuccessful(); // Now that we're connected, we can set the read/write/event handlers (and therefore stop using this handler) @@ -43,10 +43,10 @@ void ClientDescEventHandler(bufferevent *bev, short events, void *ptr) { if (events & BEV_EVENT_ERROR) { int err = bufferevent_socket_get_dns_error(bev); if (err) - sys_err("SYSTEM: Client connection DNS error: %s", evutil_gai_strerror(err)); + SPDLOG_ERROR("SYSTEM: Client connection DNS error: {}", evutil_gai_strerror(err)); } - sys_log(0, "SYSTEM: closing client connection (ptr %p)", clientDesc); + SPDLOG_DEBUG("SYSTEM: closing client connection (ptr {})", (void*) clientDesc); clientDesc->SetPhase(PHASE_CLOSE); } } @@ -78,7 +78,7 @@ void CLIENT_DESC::Destroy() DBManager::instance().StopAllBilling(); } - sys_log(0, "SYSTEM: closing client socket."); + SPDLOG_DEBUG("SYSTEM: closing client socket."); bufferevent_free(m_bufevent); m_bufevent = nullptr; @@ -105,14 +105,14 @@ bool CLIENT_DESC::Connect(int iPhaseWhenSucceed) if (m_bufevent != nullptr) return false; - sys_log(0, "SYSTEM: Trying to connect to %s:%d", m_stHost.c_str(), m_wPort); + SPDLOG_DEBUG("SYSTEM: Trying to connect to {}:{}", m_stHost.c_str(), m_wPort); if (m_evbase == nullptr) { - sys_err("SYSTEM: event base not set!"); + SPDLOG_ERROR("SYSTEM: event base not set!"); return false; } if (m_dnsBase == nullptr) { - sys_err("SYSTEM: DNS event base not set!"); + SPDLOG_ERROR("SYSTEM: DNS event base not set!"); return false; } @@ -126,7 +126,7 @@ bool CLIENT_DESC::Connect(int iPhaseWhenSucceed) } void CLIENT_DESC::OnConnectSuccessful() { - sys_log(0, "SYSTEM: connected to server (ptr %p)", this); + SPDLOG_DEBUG("SYSTEM: connected to server (ptr {})", (void*) this); SetPhase(m_iPhaseWhenSucceed); } @@ -144,13 +144,13 @@ void CLIENT_DESC::SetPhase(int iPhase) switch (iPhase) { case PHASE_CLIENT_CONNECTING: - sys_log(1, "PHASE_CLIENT_DESC::CONNECTING"); + SPDLOG_DEBUG("PHASE_CLIENT_DESC::CONNECTING"); m_pInputProcessor = NULL; break; case PHASE_DBCLIENT: { - sys_log(1, "PHASE_DBCLIENT"); + SPDLOG_DEBUG("PHASE_DBCLIENT"); if (!g_bAuthServer) { @@ -218,7 +218,7 @@ void CLIENT_DESC::SetPhase(int iPhase) } } - sys_log(0, "DB_SETUP current user %d size %d", p.dwLoginCount, buf.size()); + SPDLOG_DEBUG("DB_SETUP current user {} size {}", p.dwLoginCount, buf.size()); // ÆÄƼ¸¦ ó¸®ÇÒ ¼ö ÀÖ°Ô µÊ. CPartyManager::instance().EnablePCParty(); @@ -236,7 +236,7 @@ void CLIENT_DESC::SetPhase(int iPhase) break; case PHASE_P2P: - sys_log(1, "PHASE_P2P"); + SPDLOG_DEBUG("PHASE_P2P"); m_pInputProcessor = &m_inputP2P; break; @@ -264,11 +264,11 @@ void CLIENT_DESC::DBPacketHeader(BYTE bHeader, DWORD dwHandle, DWORD dwSize) void CLIENT_DESC::DBPacket(BYTE bHeader, DWORD dwHandle, const void * c_pvData, DWORD dwSize) { if (m_bufevent == nullptr) { - sys_log(0, "CLIENT_DESC [%s] trying DBPacket() while not connected", + SPDLOG_INFO("CLIENT_DESC [{}] trying DBPacket() while not connected", GetKnownClientDescName(this)); return; } - sys_log(1, "DB_PACKET: header %d handle %d size %d", bHeader, dwHandle, dwSize); + SPDLOG_TRACE("DB_PACKET: header {} handle {} size {}", bHeader, dwHandle, dwSize); DBPacketHeader(bHeader, dwHandle, dwSize); if (c_pvData) @@ -278,7 +278,7 @@ void CLIENT_DESC::DBPacket(BYTE bHeader, DWORD dwHandle, const void * c_pvData, void CLIENT_DESC::Packet(const void * c_pvData, int iSize) { if (m_bufevent == nullptr) { - sys_log(0, "CLIENT_DESC [%s] trying Packet() while not connected", + SPDLOG_INFO("CLIENT_DESC [{}] trying Packet() while not connected", GetKnownClientDescName(this)); return; } diff --git a/src/game/src/desc_manager.cpp b/src/game/src/desc_manager.cpp index 5545522..30d11bb 100644 --- a/src/game/src/desc_manager.cpp +++ b/src/game/src/desc_manager.cpp @@ -10,7 +10,6 @@ #include "protocol.h" #include "messenger_manager.h" #include "p2p.h" -#include "dev_log.h" #include "ClientPackageCryptInfo.h" struct valid_ip @@ -151,7 +150,7 @@ LPDESC DESC_MANAGER::AcceptDesc(evconnlistener* listener, evutil_socket_t fd, so { if (m_iSocketsConnected >= MAX_ALLOW_USER) { - sys_err("max connection reached. MAX_ALLOW_USER = %d", MAX_ALLOW_USER); + SPDLOG_ERROR("max connection reached. MAX_ALLOW_USER = {}", MAX_ALLOW_USER); return nullptr; } } @@ -183,7 +182,7 @@ LPDESC DESC_MANAGER::AcceptP2PDesc(evconnlistener* listener, evutil_socket_t fd, if (!pkDesc->Setup(base, fd, address)) { - sys_err("DESC_MANAGER::AcceptP2PDesc : Setup failed"); + SPDLOG_ERROR("DESC_MANAGER::AcceptP2PDesc : Setup failed"); delete pkDesc; return nullptr; } @@ -191,20 +190,20 @@ LPDESC DESC_MANAGER::AcceptP2PDesc(evconnlistener* listener, evutil_socket_t fd, m_set_pkDesc.insert(pkDesc); ++m_iSocketsConnected; - sys_log(0, "DESC_MANAGER::AcceptP2PDesc %s:%u", GetSocketHost(address).c_str(), GetSocketPort(address)); + SPDLOG_DEBUG("DESC_MANAGER::AcceptP2PDesc {}:{}", GetSocketHost(address).c_str(), GetSocketPort(address)); P2P_MANAGER::instance().RegisterAcceptor(pkDesc); return (pkDesc); } void DESC_MANAGER::ConnectAccount(const std::string& login, LPDESC d) { -dev_log(LOG_DEB0, "BBBB ConnectAccount(%s)", login.c_str()); + SPDLOG_TRACE("BBBB ConnectAccount({})", login.c_str()); m_map_loginName.insert(DESC_LOGINNAME_MAP::value_type(login,d)); } void DESC_MANAGER::DisconnectAccount(const std::string& login) { -dev_log(LOG_DEB0, "BBBB DisConnectAccount(%s)", login.c_str()); + SPDLOG_TRACE("BBBB DisConnectAccount({})", login.c_str()); m_map_loginName.erase(login); } @@ -402,7 +401,7 @@ void DESC_MANAGER::GetUserCount(int & iTotal, int ** paiEmpireUserCount, int & i int iCount = P2P_MANAGER::instance().GetCount(); if (iCount < 0) { - sys_err("P2P_MANAGER::instance().GetCount() == -1"); + SPDLOG_ERROR("P2P_MANAGER::instance().GetCount() == -1"); } iTotal = m_iLocalUserCount + iCount; iLocalCount = m_iLocalUserCount; diff --git a/src/game/src/desc_p2p.cpp b/src/game/src/desc_p2p.cpp index 8c0a815..df730ce 100644 --- a/src/game/src/desc_p2p.cpp +++ b/src/game/src/desc_p2p.cpp @@ -14,7 +14,7 @@ void DESC_P2P::Destroy() P2P_MANAGER::instance().UnregisterAcceptor(this); - sys_log(0, "SYSTEM: closing p2p socket."); + SPDLOG_DEBUG("SYSTEM: closing p2p socket."); bufferevent_free(m_bufevent); m_bufevent = nullptr; @@ -27,7 +27,7 @@ bool DESC_P2P::Setup(event_base * evbase, evutil_socket_t fd, const sockaddr * c { m_bufevent = bufferevent_socket_new(evbase, fd, BEV_OPT_CLOSE_ON_FREE); if (m_bufevent == nullptr) { - sys_err("DESC::Setup : Could not set up bufferevent!"); + SPDLOG_ERROR("DESC::Setup : Could not set up bufferevent!"); return false; } @@ -42,7 +42,7 @@ bool DESC_P2P::Setup(event_base * evbase, evutil_socket_t fd, const sockaddr * c SetPhase(PHASE_P2P); - sys_log(0, "SYSTEM: new p2p connection from [%s]", m_stHost.c_str()); + SPDLOG_DEBUG("SYSTEM: new p2p connection from [{}]", m_stHost.c_str()); return true; } @@ -54,7 +54,7 @@ void DESC_P2P::SetPhase(int iPhase) switch (iPhase) { case PHASE_P2P: - sys_log(1, "PHASE_P2P"); + SPDLOG_DEBUG("PHASE_P2P"); m_pInputProcessor = &s_inputP2P; break; @@ -63,7 +63,7 @@ void DESC_P2P::SetPhase(int iPhase) break; default: - sys_err("DESC_P2P::SetPhase : Unknown phase"); + SPDLOG_ERROR("DESC_P2P::SetPhase : Unknown phase"); break; } diff --git a/src/game/src/dev_log.cpp b/src/game/src/dev_log.cpp deleted file mode 100644 index 606af91..0000000 --- a/src/game/src/dev_log.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/********************************************************************* - * date : 2006.09.07 - * file : dev_log.cpp - * author : mhh - * description : - */ - -#define _dev_log_cpp_ - -#include "stdafx.h" -#include "dev_log.h" - -#ifndef IS_SET -# define IS_SET(flag,bit) ((flag) & (bit)) -#endif // IS_SET - -#ifndef SET_BIT -# define SET_BIT(var,bit) ((var) |= (bit)) -#endif // SET_BIT - -#ifndef REMOVE_BIT -# define REMOVE_BIT(var,bit) ((var) &= ~(bit)) -#endif // REMOVE_BIT - -#ifndef TOGGLE_BIT -# define TOGGLE_BIT(var,bit) ((var) = (var) ^ (bit)) -#endif // TOGGLE_BIT - -extern int test_server; -static int s_log_mask = 0xffffffff; - -void dev_log(const char *file, int line, const char *function, int level, const char *fmt, ...) -{ - // Å×½ºÆ® ¼­¹ö¿¡¼­¸¸ ³²±â¸ç, ¸¶½ºÅ©°¡ ²¨Á®ÀÖÀ¸¸é ³²±âÁö ¾Ê´Â´Ù. - if (!test_server || !IS_SET(s_log_mask, level)) - return; - - static char buf[1024*1024]; // 1M - int fd; - char strtime[64+1]; - const char *strlevel; - struct timeval tv; - struct tm ltm; - int mon, day, hour, min, sec, usec; - int nlen; - va_list args; - - // --------------------------------------- - // open file - // --------------------------------------- -#ifndef __WIN32__ - fd = ::open("DEV_LOG.log", O_WRONLY|O_APPEND|O_CREAT, 0666); -#else - fd = ::_open("DEV_LOG.log", _O_WRONLY|_O_APPEND|_O_CREAT, 0666); -#endif - - if (fd < 0) - return; - - // --------------------------------------- - // set time string - // --------------------------------------- - gettimeofday (&tv, NULL); - - localtime_r((time_t*) &tv.tv_sec, <m); - - mon = ltm.tm_mon + 1; - day = ltm.tm_mday; - hour = ltm.tm_hour; - min = ltm.tm_min; - sec = ltm.tm_sec; - usec = tv.tv_usec; - - nlen = snprintf(strtime, sizeof(strtime), "%02d%02d %02d:%02d.%02d.%06d", mon, day, hour, min, sec, usec); - - if (nlen < 0 || nlen >= (int) sizeof(strtime)) - nlen = sizeof(strtime) - 1; - - strtime[nlen - 2] = '\0'; - - // --------------------------------------- - // get level string - // --------------------------------------- -#define GET_LEVEL_STRING(level) case L_##level : strlevel = #level; break - switch ( level ) { - GET_LEVEL_STRING ( WARN ); - GET_LEVEL_STRING ( ERR ); - GET_LEVEL_STRING ( CRIT ); - GET_LEVEL_STRING ( INFO ); - - GET_LEVEL_STRING ( MIN ); - GET_LEVEL_STRING ( MAX ); - - GET_LEVEL_STRING ( LIB0 ); - GET_LEVEL_STRING ( LIB1 ); - GET_LEVEL_STRING ( LIB2 ); - GET_LEVEL_STRING ( LIB3 ); - - GET_LEVEL_STRING ( DEB0 ); - GET_LEVEL_STRING ( DEB1 ); - GET_LEVEL_STRING ( DEB2 ); - GET_LEVEL_STRING ( DEB3 ); - - GET_LEVEL_STRING ( USR0 ); - GET_LEVEL_STRING ( USR1 ); - GET_LEVEL_STRING ( USR2 ); - GET_LEVEL_STRING ( USR3 ); - - default : strlevel = "UNKNOWN"; break; - } -#undef GET_LEVEL_STRING - - nlen = snprintf(buf, sizeof(buf), "%s %-4s (%-15s,%4d,%-24s) ", - strtime, strlevel, file, line, function); - - if (nlen < 0 || nlen >= (int) sizeof(buf)) - return; - - // --------------------------------------- - // write_log - // --------------------------------------- - va_start(args, fmt); - int vlen = vsnprintf(buf + nlen, sizeof(buf) - (nlen + 2), fmt, args); - va_end(args); - - if (vlen < 0 || vlen >= (int) sizeof(buf) - (nlen + 2)) - nlen += (sizeof(buf) - (nlen + 2)) - 1; - else - nlen += vlen; - - buf[nlen++] = '\n'; - buf[nlen] = 0; - - ::write(fd, buf, nlen); - ::close(fd); -} - -void dev_log_add_level(int level) -{ - SET_BIT(s_log_mask, level); -} - -void dev_log_del_level(int level) -{ - REMOVE_BIT(s_log_mask, level); -} - -void dev_log_set_level(int mask) -{ - s_log_mask = mask; -} - diff --git a/src/game/src/dev_log.h b/src/game/src/dev_log.h deleted file mode 100644 index 84c08ba..0000000 --- a/src/game/src/dev_log.h +++ /dev/null @@ -1,79 +0,0 @@ -/********************************************************************* - * date : 2006.09.07 - * file : dev_log.h - * author : mhh - * description : °³¹ßÀÚ¿ë ·Î±×ÇÔ¼ö Å×½ºÆ® ¼­¹ö¿¡¼­¸¸ ±â·ÏµÈ´Ù. - * example) - * dev_log(LOG_DEB0, "My Name is %s", name); - */ - -#ifndef _dev_log_h_ -#define _dev_log_h_ - - -// ----------------------------------------------- -// define log level -// ----------------------------------------------- -#define L_WARN (1<<1) -#define L_ERR (1<<2) -#define L_CRIT (1<<3) -#define L_INFO (1<<4) - -#define L_MIN (1<<5) -#define L_MAX (1<<6) - -#define L_LIB0 (1<<7) -#define L_LIB1 (1<<8) -#define L_LIB2 (1<<9) -#define L_LIB3 (1<<10) - -#define L_DEB0 (1<<11) -#define L_DEB1 (1<<12) -#define L_DEB2 (1<<13) -#define L_DEB3 (1<<14) - - -#define L_USR0 (1<<15) -#define L_USR1 (1<<16) -#define L_USR2 (1<<17) -#define L_USR3 (1<<18) - - -// ----------------------------------------------- -// define log level -// ----------------------------------------------- -#define LOG_WARN __FILE__,__LINE__,__FUNCTION__,L_WARN -#define LOG_ERR __FILE__,__LINE__,__FUNCTION__,L_ERR -#define LOG_CRIT __FILE__,__LINE__,__FUNCTION__,L_CRIT -#define LOG_INFO __FILE__,__LINE__,__FUNCTION__,L_INFO - -#define LOG_MIN __FILE__,__LINE__,__FUNCTION__,L_MIN -#define LOG_MAX __FILE__,__LINE__,__FUNCTION__,L_MAX - -#define LOG_LIB0 __FILE__,__LINE__,__FUNCTION__,L_LIB0 -#define LOG_LIB1 __FILE__,__LINE__,__FUNCTION__,L_LIB1 -#define LOG_LIB2 __FILE__,__LINE__,__FUNCTION__,L_LIB2 -#define LOG_LIB3 __FILE__,__LINE__,__FUNCTION__,L_LIB3 - -#define LOG_DEB0 __FILE__,__LINE__,__FUNCTION__,L_DEB0 -#define LOG_DEB1 __FILE__,__LINE__,__FUNCTION__,L_DEB1 -#define LOG_DEB2 __FILE__,__LINE__,__FUNCTION__,L_DEB2 -#define LOG_DEB3 __FILE__,__LINE__,__FUNCTION__,L_DEB3 - - -#define LOG_USR0 __FILE__,__LINE__,__FUNCTION__,L_USR0 -#define LOG_USR1 __FILE__,__LINE__,__FUNCTION__,L_USR1 -#define LOG_USR2 __FILE__,__LINE__,__FUNCTION__,L_USR2 -#define LOG_USR3 __FILE__,__LINE__,__FUNCTION__,L_USR3 - - - - -void dev_log(const char *file, int line, const char *function, int level, const char *fmt, ...); -void dev_log_add_level(int level); -void dev_log_del_level(int level); -void dev_log_set_level(int mask); - - -#endif /* _dev_log_h_ */ - diff --git a/src/game/src/dragon_soul_table.cpp b/src/game/src/dragon_soul_table.cpp index 07079a5..5da74db 100644 --- a/src/game/src/dragon_soul_table.cpp +++ b/src/game/src/dragon_soul_table.cpp @@ -41,7 +41,7 @@ bool DragonSoulTable::ReadDragonSoulTableFile(const char * c_pszFileName) if (false == loader.Load(c_pszFileName)) { - sys_err ("dragon_soul_table.txt load error"); + SPDLOG_ERROR("dragon_soul_table.txt load error"); return false; } @@ -77,7 +77,7 @@ bool DragonSoulTable::ReadDragonSoulTableFile(const char * c_pszFileName) } else { - sys_err ("DragonSoul table Check failed."); + SPDLOG_ERROR("DragonSoul table Check failed."); return false; } } @@ -92,7 +92,7 @@ bool DragonSoulTable::GetDragonSoulGroupName(BYTE bType, std::string& stGroupNam } else { - sys_err ("Invalid DragonSoul Type(%d)", bType); + SPDLOG_ERROR("Invalid DragonSoul Type({})", bType); return false; } } @@ -106,7 +106,7 @@ bool DragonSoulTable::ReadVnumMapper() if (NULL == pGroupNode) { - sys_err ("dragon_soul_table.txt need VnumMapper."); + SPDLOG_ERROR("dragon_soul_table.txt need VnumMapper."); return false; } { @@ -128,18 +128,18 @@ bool DragonSoulTable::ReadVnumMapper() BYTE bType; if (!pRow->GetValue("dragonsoulname", stDragonSoulName)) { - sys_err ("In Group VnumMapper, No DragonSoulName column."); + SPDLOG_ERROR("In Group VnumMapper, No DragonSoulName column."); return false; } if (!pRow->GetValue("type", bType)) { - sys_err ("In Group VnumMapper, %s's Vnum is invalid", stDragonSoulName.c_str()); + SPDLOG_ERROR("In Group VnumMapper, {}'s Vnum is invalid", stDragonSoulName.c_str()); return false; } if (setTypes.end() != setTypes.find(bType)) { - sys_err ("In Group VnumMapper, duplicated vnum exist."); + SPDLOG_ERROR("In Group VnumMapper, duplicated vnum exist."); return false; } m_map_name_to_type.insert(TMapNameToType::value_type(stDragonSoulName, bType)); @@ -157,7 +157,7 @@ bool DragonSoulTable::ReadBasicApplys() if (NULL == pGroupNode) { - sys_err ("dragon_soul_table.txt need BasicApplys."); + SPDLOG_ERROR("dragon_soul_table.txt need BasicApplys."); return false; } @@ -166,7 +166,7 @@ bool DragonSoulTable::ReadBasicApplys() CGroupNode* pChild; if (NULL == (pChild = pGroupNode->GetChildNode(m_vecDragonSoulNames[i]))) { - sys_err ("In Group BasicApplys, %s group is not defined.", m_vecDragonSoulNames[i].c_str()); + SPDLOG_ERROR("In Group BasicApplys, {} group is not defined.", m_vecDragonSoulNames[i].c_str()); return false; } TVecApplys vecApplys; @@ -182,7 +182,7 @@ bool DragonSoulTable::ReadBasicApplys() pChild->GetRow(ss.str(), &pRow); if (NULL == pRow) { - sys_err("In Group BasicApplys, No %d row.", j); + SPDLOG_ERROR("In Group BasicApplys, No {} row.", j); } EApplyTypes at; int av; @@ -190,17 +190,17 @@ bool DragonSoulTable::ReadBasicApplys() std::string stTypeName; if (!pRow->GetValue("apply_type", stTypeName)) { - sys_err ("In Group BasicApplys, %s group's apply_type is empty.", m_vecDragonSoulNames[i].c_str()); + SPDLOG_ERROR("In Group BasicApplys, {} group's apply_type is empty.", m_vecDragonSoulNames[i].c_str()); return false; } if (!(at = (EApplyTypes)FN_get_apply_type(stTypeName.c_str()))) { - sys_err ("In Group BasicApplys, %s group's apply_type %s is invalid.", m_vecDragonSoulNames[i].c_str(), stTypeName.c_str()); + SPDLOG_ERROR("In Group BasicApplys, {} group's apply_type {} is invalid.", m_vecDragonSoulNames[i].c_str(), stTypeName.c_str()); return false; } if (!pRow->GetValue("apply_value", av)) { - sys_err ("In Group BasicApplys, %s group's apply_value %s is invalid.", m_vecDragonSoulNames[i].c_str(), av); + SPDLOG_ERROR("In Group BasicApplys, {} group's apply_value {} is invalid.", m_vecDragonSoulNames[i].c_str(), av); return false; } vecApplys.push_back(SApply(at, av)); @@ -216,7 +216,7 @@ bool DragonSoulTable::ReadAdditionalApplys() CGroupNode* pGroupNode = m_pLoader->GetGroup("additionalapplys"); if (NULL == pGroupNode) { - sys_err ("dragon_soul_table.txt need AdditionalApplys."); + SPDLOG_ERROR("dragon_soul_table.txt need AdditionalApplys."); return false; } @@ -225,7 +225,7 @@ bool DragonSoulTable::ReadAdditionalApplys() CGroupNode* pChild; if (NULL == (pChild = pGroupNode->GetChildNode(m_vecDragonSoulNames[i]))) { - sys_err ("In Group AdditionalApplys, %s group is not defined.", m_vecDragonSoulNames[i].c_str()); + SPDLOG_ERROR("In Group AdditionalApplys, {} group is not defined.", m_vecDragonSoulNames[i].c_str()); return false; } TVecApplys vecApplys; @@ -244,22 +244,22 @@ bool DragonSoulTable::ReadAdditionalApplys() std::string stTypeName; if (!pRow->GetValue("apply_type", stTypeName)) { - sys_err ("In Group AdditionalApplys, %s group's apply_type is empty.", m_vecDragonSoulNames[i].c_str()); + SPDLOG_ERROR("In Group AdditionalApplys, {} group's apply_type is empty.", m_vecDragonSoulNames[i].c_str()); return false; } if (!(at = (EApplyTypes)FN_get_apply_type(stTypeName.c_str()))) { - sys_err ("In Group AdditionalApplys, %s group's apply_type %s is invalid.", m_vecDragonSoulNames[i].c_str(), stTypeName.c_str()); + SPDLOG_ERROR("In Group AdditionalApplys, {} group's apply_type {} is invalid.", m_vecDragonSoulNames[i].c_str(), stTypeName.c_str()); return false; } if (!pRow->GetValue("apply_value", av)) { - sys_err ("In Group AdditionalApplys, %s group's apply_value %s is invalid.", m_vecDragonSoulNames[i].c_str(), av); + SPDLOG_ERROR("In Group AdditionalApplys, {} group's apply_value {} is invalid.", m_vecDragonSoulNames[i].c_str(), av); return false; } if (!pRow->GetValue("prob", prob)) { - sys_err ("In Group AdditionalApplys, %s group's probability %s is invalid.", m_vecDragonSoulNames[i].c_str(), prob); + SPDLOG_ERROR("In Group AdditionalApplys, {} group's probability {} is invalid.", m_vecDragonSoulNames[i].c_str(), prob); return false; } vecApplys.push_back(SApply(at, av, prob)); @@ -275,7 +275,7 @@ bool DragonSoulTable::CheckApplyNumSettings () // Group ApplyNumSettings Reading. if (NULL == m_pApplyNumSettingNode) { - sys_err ("dragon_soul_table.txt need ApplyNumSettings."); + SPDLOG_ERROR("dragon_soul_table.txt need ApplyNumSettings."); return false; } else @@ -287,7 +287,7 @@ bool DragonSoulTable::CheckApplyNumSettings () int basis, add_min, add_max; if (!GetApplyNumSettings(m_vecDragonSoulTypes[i], j, basis, add_min, add_max)) { - sys_err ("In %s group of ApplyNumSettings, values in Grade(%s) row is invalid.", + SPDLOG_ERROR("In {} group of ApplyNumSettings, values in Grade({}) row is invalid.", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); return false; } @@ -303,7 +303,7 @@ bool DragonSoulTable::CheckWeightTables () // Group WeightTables Reading. if (NULL == m_pWeightTableNode) { - sys_err ("dragon_soul_table.txt need WeightTables."); + SPDLOG_ERROR("dragon_soul_table.txt need WeightTables."); return false; } else @@ -319,7 +319,7 @@ bool DragonSoulTable::CheckWeightTables () float fWeight; if (!GetWeight(m_vecDragonSoulTypes[i], j, k, l, fWeight)) { - sys_err ("In %s group of WeightTables, value(Grade(%s), Step(%s), Strength(%d) is invalid.", + SPDLOG_ERROR("In {} group of WeightTables, value(Grade({}), Step({}), Strength({}) is invalid.", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str(), g_astStepName[k].c_str(), l); } } @@ -335,7 +335,7 @@ bool DragonSoulTable::CheckRefineGradeTables() // Group UpgradeTables Reading. if (NULL == m_pRefineGradeTableNode) { - sys_err ("dragon_soul_table.txt need RefineGradeTables."); + SPDLOG_ERROR("dragon_soul_table.txt need RefineGradeTables."); return false; } else @@ -348,32 +348,33 @@ bool DragonSoulTable::CheckRefineGradeTables() std::vector vec_probs; if (!GetRefineGradeValues(m_vecDragonSoulTypes[i], j, need_count, fee, vec_probs)) { - sys_err ("In %s group of RefineGradeTables, values in Grade(%s) row is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); + SPDLOG_ERROR("In {} group of RefineGradeTables, values in Grade({}) row is invalid.", + m_vecDragonSoulNames[i], g_astGradeName[j]); return false; } if (need_count < 1) { - sys_err ("In %s group of RefineGradeTables, need_count of Grade(%s) is less than 1.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); + SPDLOG_ERROR("In {} group of RefineGradeTables, need_count of Grade({}) is less than 1.", + m_vecDragonSoulNames[i], g_astGradeName[j]); return false; } if (fee < 0) { - sys_err ("In %s group of RefineGradeTables, fee of Grade(%s) is less than 0.", - m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); + SPDLOG_ERROR("In {} group of RefineGradeTables, fee of Grade({}) is less than 0.", + m_vecDragonSoulNames[i], g_astGradeName[j]); return false; } if (DRAGON_SOUL_GRADE_MAX != vec_probs.size()) { - sys_err ("In %s group of RefineGradeTables, probability list size is not %d.", DRAGON_SOUL_GRADE_MAX); + SPDLOG_ERROR("In {} group of RefineGradeTables, probability list size is not {}.", + m_vecDragonSoulNames[i], (int) DRAGON_SOUL_GRADE_MAX); return false; } for (int k = 0; k < vec_probs.size(); k++) { if (vec_probs[k] < 0.f) { - sys_err ("In %s group of RefineGradeTables, probability(index : %d) is less than 0.", k); + SPDLOG_ERROR("In {} group of RefineGradeTables, probability(index : {}) is less than 0.", k); return false; } } @@ -389,7 +390,7 @@ bool DragonSoulTable::CheckRefineStepTables () // Group ImproveTables Reading. if (NULL == m_pRefineStrengthTableNode) { - sys_err ("dragon_soul_table.txt need RefineStepTables."); + SPDLOG_ERROR("dragon_soul_table.txt need RefineStepTables."); return false; } else @@ -402,34 +403,34 @@ bool DragonSoulTable::CheckRefineStepTables () std::vector vec_probs; if (!GetRefineStepValues(m_vecDragonSoulTypes[i], j, need_count, fee, vec_probs)) { - sys_err ("In %s group of RefineStepTables, values in Step(%s) row is invalid.", - m_vecDragonSoulNames[i].c_str(), g_astStepName[j].c_str()); + SPDLOG_ERROR("In {} group of RefineStepTables, values in Step({}) row is invalid.", + m_vecDragonSoulNames[i], g_astStepName[j]); return false; } if (need_count < 1) { - sys_err ("In %s group of RefineStepTables, need_count of Step(%s) is less than 1.", - m_vecDragonSoulNames[i].c_str(), g_astStepName[j].c_str()); + SPDLOG_ERROR("In {} group of RefineStepTables, need_count of Step({}) is less than 1.", + m_vecDragonSoulNames[i], g_astStepName[j]); return false; } if (fee < 0) { - sys_err ("In %s group of RefineStepTables, fee of Step(%s) is less than 0.", - m_vecDragonSoulNames[i].c_str(), g_astStepName[j].c_str()); + SPDLOG_ERROR("In {} group of RefineStepTables, fee of Step({}) is less than 0.", + m_vecDragonSoulNames[i], g_astStepName[j]); return false; } if (DRAGON_SOUL_GRADE_MAX != vec_probs.size()) { - sys_err ("In %s group of RefineStepTables, probability list size is not %d.", - m_vecDragonSoulNames[i].c_str(), DRAGON_SOUL_GRADE_MAX); + SPDLOG_ERROR("In {} group of RefineStepTables, probability list size is not {}.", + m_vecDragonSoulNames[i], (int) DRAGON_SOUL_GRADE_MAX); return false; } for (int k = 0; k < vec_probs.size(); k++) { if (vec_probs[k] < 0.f) { - sys_err ("In %s group of RefineStepTables, probability(index : %d) is less than 0.", - m_vecDragonSoulNames[i].c_str(), k); + SPDLOG_ERROR("In {} group of RefineStepTables, probability(index : {}) is less than 0.", + m_vecDragonSoulNames[i], k); return false; } } @@ -447,7 +448,7 @@ bool DragonSoulTable::CheckRefineStrengthTables() // Group RefineTables Reading. if (NULL == pGroupNode) { - sys_err ("dragon_soul_table.txt need RefineStrengthTables."); + SPDLOG_ERROR("dragon_soul_table.txt need RefineStrengthTables."); return false; } for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) @@ -460,19 +461,19 @@ bool DragonSoulTable::CheckRefineStrengthTables() { if (!GetRefineStrengthValues(m_vecDragonSoulTypes[i], j, k, fee, prob)) { - sys_err ("In %s group of RefineStrengthTables, value(Material(%s), Strength(%d)) or fee are invalid.", + SPDLOG_ERROR("In {} group of RefineStrengthTables, value(Material({}), Strength({})) or fee are invalid.", m_vecDragonSoulNames[i].c_str(), g_astMaterialName[j].c_str(), k); return false; } if (fee < 0) { - sys_err ("In %s group of RefineStrengthTables, fee of Material(%s) is less than 0.", + SPDLOG_ERROR("In {} group of RefineStrengthTables, fee of Material({}) is less than 0.", m_vecDragonSoulNames[i].c_str(), g_astMaterialName[j].c_str()); return false; } if (prob < 0.f) { - sys_err ("In %s group of RefineStrengthTables, probability(Material(%s), Strength(%d)) is less than 0.", + SPDLOG_ERROR("In {} group of RefineStrengthTables, probability(Material({}), Strength({})) is less than 0.", m_vecDragonSoulNames[i].c_str(), g_astMaterialName[j].c_str(), k); return false; } @@ -488,7 +489,7 @@ bool DragonSoulTable::CheckDragonHeartExtTables() // Group DragonHeartExtTables Reading. if (NULL == m_pDragonHeartExtTableNode) { - sys_err ("dragon_soul_table.txt need DragonHeartExtTables."); + SPDLOG_ERROR("dragon_soul_table.txt need DragonHeartExtTables."); return false; } for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) @@ -500,13 +501,13 @@ bool DragonSoulTable::CheckDragonHeartExtTables() if (!GetDragonHeartExtValues(m_vecDragonSoulTypes[i], j, vec_chargings, vec_probs)) { - sys_err ("In %s group of DragonHeartExtTables, CHARGING row or Grade(%s) row are invalid.", + SPDLOG_ERROR("In {} group of DragonHeartExtTables, CHARGING row or Grade({}) row are invalid.", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); return false; } if (vec_chargings.size() != vec_probs.size()) { - sys_err ("In %s group of DragonHeartExtTables, CHARGING row size(%d) are not equal Grade(%s) row size(%d).", + SPDLOG_ERROR("In {} group of DragonHeartExtTables, CHARGING row size({}) are not equal Grade({}) row size({}).", m_vecDragonSoulNames[i].c_str(), vec_chargings.size(), vec_probs.size()); return false; } @@ -514,7 +515,7 @@ bool DragonSoulTable::CheckDragonHeartExtTables() { if (vec_chargings[k] < 0.f) { - sys_err ("In %s group of DragonHeartExtTables, CHARGING value(index : %d) is less than 0", + SPDLOG_ERROR("In {} group of DragonHeartExtTables, CHARGING value(index : {}) is less than 0", m_vecDragonSoulNames[i].c_str(), k); return false; } @@ -523,7 +524,7 @@ bool DragonSoulTable::CheckDragonHeartExtTables() { if (vec_probs[k] < 0.f) { - sys_err ("In %s group of DragonHeartExtTables, Probability(Grade : %s, index : %d) is less than 0", + SPDLOG_ERROR("In {} group of DragonHeartExtTables, Probability(Grade : {}, index : {}) is less than 0", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str(), k); return false; } @@ -539,7 +540,7 @@ bool DragonSoulTable::CheckDragonSoulExtTables() // Group DragonSoulExtTables Reading. if (NULL == m_pDragonSoulExtTableNode) { - sys_err ("dragon_soul_table.txt need DragonSoulExtTables."); + SPDLOG_ERROR("dragon_soul_table.txt need DragonSoulExtTables."); return false; } for (int i = 0; i < m_vecDragonSoulTypes.size(); i++) @@ -550,19 +551,19 @@ bool DragonSoulTable::CheckDragonSoulExtTables() DWORD by_product; if (!GetDragonSoulExtValues(m_vecDragonSoulTypes[i], j, prob, by_product)) { - sys_err ("In %s group of DragonSoulExtTables, Grade(%s) row is invalid.", + SPDLOG_ERROR("In {} group of DragonSoulExtTables, Grade({}) row is invalid.", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); return false; } if (prob < 0.f) { - sys_err ("In %s group of DragonSoulExtTables, Probability(Grade : %s) is less than 0", + SPDLOG_ERROR("In {} group of DragonSoulExtTables, Probability(Grade : {}) is less than 0", m_vecDragonSoulNames[i].c_str(), g_astGradeName[j].c_str()); return false; } if (0 != by_product && NULL == ITEM_MANAGER::instance().GetTable(by_product)) { - sys_err ("In %s group of DragonSoulExtTables, ByProduct(%d) of Grade %s is not exist.", + SPDLOG_ERROR("In {} group of DragonSoulExtTables, ByProduct({}) of Grade {} is not exist.", m_vecDragonSoulNames[i].c_str(), by_product, g_astGradeName[j].c_str()); return false; } @@ -597,7 +598,7 @@ bool DragonSoulTable::GetApplyNumSettings(BYTE ds_type, BYTE grade_idx, OUT int& { if (grade_idx >= DRAGON_SOUL_GRADE_MAX) { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); + SPDLOG_ERROR("Invalid dragon soul grade_idx({}).", grade_idx); return false; } @@ -605,25 +606,25 @@ bool DragonSoulTable::GetApplyNumSettings(BYTE ds_type, BYTE grade_idx, OUT int& std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } if (!m_pApplyNumSettingNode->GetGroupValue(stDragonSoulName, "basis", g_astGradeName[grade_idx], basis)) { - sys_err ("Invalid basis value. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid basis value. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } if (!m_pApplyNumSettingNode->GetGroupValue(stDragonSoulName, "add_min", g_astGradeName[grade_idx], add_min)) { - sys_err ("Invalid add_min value. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid add_min value. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } if (!m_pApplyNumSettingNode->GetGroupValue(stDragonSoulName, "add_max", g_astGradeName[grade_idx], add_max)) { - sys_err ("Invalid add_max value. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid add_max value. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } @@ -634,7 +635,7 @@ bool DragonSoulTable::GetWeight(BYTE ds_type, BYTE grade_idx, BYTE step_index, B { if (grade_idx >= DRAGON_SOUL_GRADE_MAX || step_index >= DRAGON_SOUL_STEP_MAX || strength_idx >= DRAGON_SOUL_STRENGTH_MAX) { - sys_err ("Invalid dragon soul grade_idx(%d) step_index(%d) strength_idx(%d).", grade_idx, step_index, strength_idx); + SPDLOG_ERROR("Invalid dragon soul grade_idx({}) step_index({}) strength_idx({}).", grade_idx, step_index, strength_idx); return false; } @@ -642,7 +643,7 @@ bool DragonSoulTable::GetWeight(BYTE ds_type, BYTE grade_idx, BYTE step_index, B std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } @@ -660,13 +661,13 @@ bool DragonSoulTable::GetWeight(BYTE ds_type, BYTE grade_idx, BYTE step_index, B { if (!pDragonSoulGroup->GetGroupValue(g_astGradeName[grade_idx], g_astStepName[step_index], strength_idx, fWeight)) { - sys_err ("Invalid float. DragonSoulGroup(%s) Grade(%s) Row(%s) Col(%d))", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astStepName[step_index].c_str(), strength_idx); + SPDLOG_ERROR("Invalid float. DragonSoulGroup({}) Grade({}) Row({}) Col({}))", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astStepName[step_index].c_str(), strength_idx); return false; } else return true; } - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Row(%s) Col(%d))", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astStepName[step_index].c_str(), strength_idx); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Grade({}) Row({}) Col({}))", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astStepName[step_index].c_str(), strength_idx); return false; } @@ -674,7 +675,7 @@ bool DragonSoulTable::GetRefineGradeValues(BYTE ds_type, BYTE grade_idx, OUT int { if (grade_idx >= DRAGON_SOUL_GRADE_MAX -1) { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); + SPDLOG_ERROR("Invalid dragon soul grade_idx({}).", grade_idx); return false; } @@ -682,26 +683,26 @@ bool DragonSoulTable::GetRefineGradeValues(BYTE ds_type, BYTE grade_idx, OUT int std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } const CGroupNode::CGroupNodeRow * pRow; if (!m_pRefineGradeTableNode->GetGroupRow(stDragonSoulName, g_astGradeName[grade_idx], &pRow)) { - sys_err ("Invalid row. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid row. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } if (!pRow->GetValue("need_count", need_count)) { - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Col(need_count)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Grade({}) Col(need_count)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } if (!pRow->GetValue("fee", fee)) { - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Col(fee)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Grade({}) Col(fee)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } @@ -710,7 +711,7 @@ bool DragonSoulTable::GetRefineGradeValues(BYTE ds_type, BYTE grade_idx, OUT int { if (!pRow->GetValue(g_astGradeName[i], vec_probs[i])) { - sys_err ("Invalid value. DragonSoulGroup(%s) Grade(%s) Col(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astGradeName[i].c_str()); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Grade({}) Col({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astGradeName[i].c_str()); return false; } } @@ -722,7 +723,7 @@ bool DragonSoulTable::GetRefineStepValues(BYTE ds_type, BYTE step_idx, OUT int& { if (step_idx >= DRAGON_SOUL_STEP_MAX - 1) { - sys_err ("Invalid dragon soul step_idx(%d).", step_idx); + SPDLOG_ERROR("Invalid dragon soul step_idx({}).", step_idx); return false; } @@ -730,26 +731,26 @@ bool DragonSoulTable::GetRefineStepValues(BYTE ds_type, BYTE step_idx, OUT int& std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } const CGroupNode::CGroupNodeRow * pRow; if (!m_pRefineStepTableNode->GetGroupRow(stDragonSoulName, g_astStepName[step_idx], &pRow)) { - sys_err ("Invalid row. DragonSoulGroup(%s) Step(%s)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); + SPDLOG_ERROR("Invalid row. DragonSoulGroup({}) Step({})", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); return false; } if (!pRow->GetValue("need_count", need_count)) { - sys_err ("Invalid value. DragonSoulGroup(%s) Step(%s) Col(need_count)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Step({}) Col(need_count)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); return false; } if (!pRow->GetValue("fee", fee)) { - sys_err ("Invalid value. DragonSoulGroup(%s) Step(%s) Col(fee)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Step({}) Col(fee)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str()); return false; } @@ -758,7 +759,7 @@ bool DragonSoulTable::GetRefineStepValues(BYTE ds_type, BYTE step_idx, OUT int& { if (!pRow->GetValue(g_astStepName[i], vec_probs[i])) { - sys_err ("Invalid value. DragonSoulGroup(%s) Step(%s) Col(%s)", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str(), g_astStepName[i].c_str()); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}) Step({}) Col({})", stDragonSoulName.c_str(), g_astStepName[step_idx].c_str(), g_astStepName[i].c_str()); return false; } } @@ -770,7 +771,7 @@ bool DragonSoulTable::GetRefineStrengthValues(BYTE ds_type, BYTE material_type, { if (material_type < MATERIAL_DS_REFINE_NORMAL || material_type > MATERIAL_DS_REFINE_HOLLY) { - sys_err ("Invalid dragon soul material_type(%d).", material_type); + SPDLOG_ERROR("Invalid dragon soul material_type({}).", material_type); return false; } @@ -778,13 +779,13 @@ bool DragonSoulTable::GetRefineStrengthValues(BYTE ds_type, BYTE material_type, std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } if (!m_pRefineStrengthTableNode->GetGroupValue(stDragonSoulName, g_astMaterialName[material_type], "fee", fee)) { - sys_err ("Invalid fee. DragonSoulGroup(%s) Material(%s)", + SPDLOG_ERROR("Invalid fee. DragonSoulGroup({}) Material({})", stDragonSoulName.c_str(), g_astMaterialName[material_type].c_str()); return false; } @@ -792,7 +793,7 @@ bool DragonSoulTable::GetRefineStrengthValues(BYTE ds_type, BYTE material_type, if (!m_pRefineStrengthTableNode->GetGroupValue(stDragonSoulName, g_astMaterialName[material_type], stStrengthIdx, prob)) { - sys_err ("Invalid prob. DragonSoulGroup(%s) Material(%s) Strength(%d)", + SPDLOG_ERROR("Invalid prob. DragonSoulGroup({}) Material({}) Strength({})", stDragonSoulName.c_str(), g_astMaterialName[material_type].c_str(), strength_idx); return false; } @@ -804,21 +805,21 @@ bool DragonSoulTable::GetDragonHeartExtValues(BYTE ds_type, BYTE grade_idx, OUT { if (grade_idx >= DRAGON_SOUL_GRADE_MAX) { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); + SPDLOG_ERROR("Invalid dragon soul grade_idx({}).", grade_idx); return false; } std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } const CGroupNode::CGroupNodeRow * pRow; if (!m_pDragonHeartExtTableNode->GetGroupRow(stDragonSoulName, "charging", &pRow)) { - sys_err ("Invalid CHARGING row. DragonSoulGroup(%s)", stDragonSoulName.c_str()); + SPDLOG_ERROR("Invalid CHARGING row. DragonSoulGroup({})", stDragonSoulName.c_str()); return false; } int n = pRow->GetSize(); @@ -827,21 +828,21 @@ bool DragonSoulTable::GetDragonHeartExtValues(BYTE ds_type, BYTE grade_idx, OUT { if (!pRow->GetValue(i, vec_chargings[i])) { - sys_err ("Invalid CHARGING value. DragonSoulGroup(%s), Col(%d)", stDragonSoulName.c_str(), i); + SPDLOG_ERROR("Invalid CHARGING value. DragonSoulGroup({}), Col({})", stDragonSoulName.c_str(), i); return false; } } if (!m_pDragonHeartExtTableNode->GetGroupRow(stDragonSoulName, g_astGradeName[grade_idx], &pRow)) { - sys_err ("Invalid row. DragonSoulGroup(%s) Grade(%s)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); + SPDLOG_ERROR("Invalid row. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } int m = pRow->GetSize(); if (n != m) { - sys_err ("Invalid row size(%d). It must be same CHARGING row size(%d). DragonSoulGroup(%s) Grade(%s)", m, n, + SPDLOG_ERROR("Invalid row size({}). It must be same CHARGING row size({}). DragonSoulGroup({}) Grade({})", m, n, stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str()); return false; } @@ -850,7 +851,7 @@ bool DragonSoulTable::GetDragonHeartExtValues(BYTE ds_type, BYTE grade_idx, OUT { if (!pRow->GetValue(i, vec_probs[i])) { - sys_err ("Invalid value. DragonSoulGroup(%s), Grade(%s) Col(%d)", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), i); + SPDLOG_ERROR("Invalid value. DragonSoulGroup({}), Grade({}) Col({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), i); return false; } } @@ -862,7 +863,7 @@ bool DragonSoulTable::GetDragonSoulExtValues(BYTE ds_type, BYTE grade_idx, OUT f { if (grade_idx >= DRAGON_SOUL_GRADE_MAX) { - sys_err ("Invalid dragon soul grade_idx(%d).", grade_idx); + SPDLOG_ERROR("Invalid dragon soul grade_idx({}).", grade_idx); return false; } @@ -870,20 +871,20 @@ bool DragonSoulTable::GetDragonSoulExtValues(BYTE ds_type, BYTE grade_idx, OUT f std::string stDragonSoulName; if (!GetDragonSoulGroupName(ds_type, stDragonSoulName)) { - sys_err ("Invalid dragon soul type(%d).", ds_type); + SPDLOG_ERROR("Invalid dragon soul type({}).", ds_type); return false; } if (!m_pDragonSoulExtTableNode->GetGroupValue(stDragonSoulName, g_astGradeName[grade_idx], "prob", prob)) { - sys_err ("Invalid Prob. DragonSoulGroup(%s) Grade(%s)", + SPDLOG_ERROR("Invalid Prob. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), g_astGradeName[grade_idx].c_str()); return false; } if (!m_pDragonSoulExtTableNode->GetGroupValue(stDragonSoulName, g_astGradeName[grade_idx], "byproduct", by_product)) { - sys_err ("Invalid fee. DragonSoulGroup(%s) Grade(%d)", + SPDLOG_ERROR("Invalid fee. DragonSoulGroup({}) Grade({})", stDragonSoulName.c_str(), g_astGradeName[grade_idx].c_str(), grade_idx); return false; } diff --git a/src/game/src/dungeon.cpp b/src/game/src/dungeon.cpp index 8b0b0f3..00e2a79 100644 --- a/src/game/src/dungeon.cpp +++ b/src/game/src/dungeon.cpp @@ -21,7 +21,6 @@ CDungeon::CDungeon(IdType id, int lOriginalMapIndex, int lMapIndex) m_map_Area(SECTREE_MANAGER::instance().GetDungeonArea(lOriginalMapIndex)) { Initialize(); - //sys_log(0,"DUNGEON create orig %d real %d", lOriginalMapIndex, lMapIndex); } CDungeon::~CDungeon() @@ -30,7 +29,6 @@ CDungeon::~CDungeon() { m_pParty->SetDungeon_for_Only_party (NULL); } - //sys_log(0,"DUNGEON destroy orig %d real %d", m_lOrigMapIndex, m_lMapIndex ); ClearRegen(); event_cancel(&deadEvent); // @@ -109,7 +107,7 @@ void CDungeon::SendDestPositionToParty(LPPARTY pParty, int x, int y) { if (m_map_pkParty.find(pParty) == m_map_pkParty.end()) { - sys_err("PARTY %u not in DUNGEON %d", pParty->GetLeaderPID(), m_lMapIndex); + SPDLOG_ERROR("PARTY {} not in DUNGEON {}", pParty->GetLeaderPID(), m_lMapIndex); return; } @@ -143,7 +141,7 @@ struct FWarpToDungeon void CDungeon::Join(LPCHARACTER ch) { if (SECTREE_MANAGER::instance().GetMap(m_lMapIndex) == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } FWarpToDungeon(m_lMapIndex, this) (ch); @@ -155,18 +153,16 @@ void CDungeon::JoinParty(LPPARTY pParty) m_map_pkParty.insert(std::make_pair(pParty,0)); if (SECTREE_MANAGER::instance().GetMap(m_lMapIndex) == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } FWarpToDungeon f(m_lMapIndex, this); pParty->ForEachOnlineMember(f); - //sys_log(0, "DUNGEON-PARTY join %p %p", this, pParty); } void CDungeon::QuitParty(LPPARTY pParty) { pParty->SetDungeon(NULL); - //sys_log(0, "DUNGEON-PARTY quit %p %p", this, pParty); TPartyMap::iterator it = m_map_pkParty.find(pParty); if (it != m_map_pkParty.end()) @@ -189,7 +185,7 @@ EVENTFUNC(dungeon_dead_event) if ( info == NULL ) { - sys_err( "dungeon_dead_event> Null pointer" ); + SPDLOG_ERROR("dungeon_dead_event> Null pointer" ); return 0; } @@ -234,7 +230,6 @@ void CDungeon::DecMember(LPCHARACTER ch) void CDungeon::IncPartyMember(LPPARTY pParty, LPCHARACTER ch) { - //sys_log(0, "DUNGEON-PARTY inc %p %p", this, pParty); TPartyMap::iterator it = m_map_pkParty.find(pParty); if (it != m_map_pkParty.end()) @@ -247,11 +242,10 @@ void CDungeon::IncPartyMember(LPPARTY pParty, LPCHARACTER ch) void CDungeon::DecPartyMember(LPPARTY pParty, LPCHARACTER ch) { - //sys_log(0, "DUNGEON-PARTY dec %p %p", this, pParty); TPartyMap::iterator it = m_map_pkParty.find(pParty); if (it == m_map_pkParty.end()) - sys_err("cannot find party"); + SPDLOG_ERROR("cannot find party"); else { it->second--; @@ -324,7 +318,7 @@ void CDungeon::JumpAll(int lFromMapIndex, int x, int y) if (!pMap) { - sys_err("cannot find map by index %d", lFromMapIndex); + SPDLOG_ERROR("cannot find map by index {}", lFromMapIndex); return; } @@ -343,7 +337,7 @@ void CDungeon::WarpAll(int lFromMapIndex, int x, int y) if (!pMap) { - sys_err("cannot find map by index %d", lFromMapIndex); + SPDLOG_ERROR("cannot find map by index {}", lFromMapIndex); return; } @@ -362,7 +356,7 @@ void CDungeon::JumpParty(LPPARTY pParty, int lFromMapIndex, int x, int y) if (!pMap) { - sys_err("cannot find map by index %d", lFromMapIndex); + SPDLOG_ERROR("cannot find map by index {}", lFromMapIndex); return; } @@ -374,7 +368,7 @@ void CDungeon::JumpParty(LPPARTY pParty, int lFromMapIndex, int x, int y) } else if (m_pParty != pParty) { - sys_err ("Dungeon already has party. Another party cannot jump in dungeon : index %d", GetMapIndex()); + SPDLOG_ERROR("Dungeon already has party. Another party cannot jump in dungeon : index {}", GetMapIndex()); return; } pParty->SetDungeon_for_Only_party (this); @@ -393,7 +387,7 @@ void CDungeon::SetPartyNull() void CDungeonManager::Destroy(CDungeon::IdType dungeon_id) { - sys_log(0, "DUNGEON destroy : map index %u", dungeon_id); + SPDLOG_DEBUG("DUNGEON destroy : map index {}", dungeon_id); LPDUNGEON pDungeon = Find(dungeon_id); if (pDungeon == NULL) { return; @@ -433,7 +427,7 @@ LPDUNGEON CDungeonManager::Create(int lOriginalMapIndex) if (!lMapIndex) { - sys_log( 0, "Fail to Create Dungeon : OrginalMapindex %d NewMapindex %d", lOriginalMapIndex, lMapIndex ); + SPDLOG_ERROR("Fail to Create Dungeon : OrginalMapindex {} NewMapindex {}", lOriginalMapIndex, lMapIndex ); return NULL; } @@ -446,7 +440,7 @@ LPDUNGEON CDungeonManager::Create(int lOriginalMapIndex) LPDUNGEON pDungeon = M2_NEW CDungeon(id, lOriginalMapIndex, lMapIndex); if (!pDungeon) { - sys_err("M2_NEW CDungeon failed"); + SPDLOG_ERROR("M2_NEW CDungeon failed"); return NULL; } m_map_pkDungeon.insert(std::make_pair(id, pDungeon)); @@ -469,7 +463,7 @@ void CDungeon::UniqueSetMaxHP(const std::string& key, int iMaxHP) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key : %s", key.c_str()); + SPDLOG_ERROR("Unknown Key : {}", key.c_str()); return; } it->second->SetMaxHP(iMaxHP); @@ -480,7 +474,7 @@ void CDungeon::UniqueSetHP(const std::string& key, int iHP) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key : %s", key.c_str()); + SPDLOG_ERROR("Unknown Key : {}", key.c_str()); return; } it->second->SetHP(iHP); @@ -491,7 +485,7 @@ void CDungeon::UniqueSetDefGrade(const std::string& key, int iGrade) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key : %s", key.c_str()); + SPDLOG_ERROR("Unknown Key : {}", key.c_str()); return; } it->second->PointChange(POINT_DEF_GRADE,iGrade - it->second->GetPoint(POINT_DEF_GRADE)); @@ -502,14 +496,14 @@ void CDungeon::SpawnMoveUnique(const char* key, DWORD vnum, const char* pos_from TAreaMap::iterator it_to = m_map_Area.find(pos_to); if (it_to == m_map_Area.end()) { - sys_err("Wrong position string : %s", pos_to); + SPDLOG_ERROR("Wrong position string : {}", pos_to); return; } TAreaMap::iterator it_from = m_map_Area.find(pos_from); if (it_from == m_map_Area.end()) { - sys_err("Wrong position string : %s", pos_from); + SPDLOG_ERROR("Wrong position string : {}", pos_from); return; } @@ -521,7 +515,7 @@ void CDungeon::SpawnMoveUnique(const char* key, DWORD vnum, const char* pos_from LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } for (int i=0;i<100;i++) @@ -544,7 +538,7 @@ void CDungeon::SpawnMoveUnique(const char* key, DWORD vnum, const char* pos_from } else { - sys_err("Cannot spawn at %d %d", pkSectreeMap->m_setting.iBaseX+((ai.sx+ai.ex)>>1), pkSectreeMap->m_setting.iBaseY+((ai.sy+ai.ey)>>1)); + SPDLOG_ERROR("Cannot spawn at {} {}", pkSectreeMap->m_setting.iBaseX+((ai.sx+ai.ex)>>1), pkSectreeMap->m_setting.iBaseY+((ai.sy+ai.ey)>>1)); } } @@ -555,7 +549,7 @@ void CDungeon::SpawnUnique(const char* key, DWORD vnum, const char* pos) TAreaMap::iterator it = m_map_Area.find(pos); if (it == m_map_Area.end()) { - sys_err("Wrong position string : %s", pos); + SPDLOG_ERROR("Wrong position string : {}", pos); return; } @@ -566,7 +560,7 @@ void CDungeon::SpawnUnique(const char* key, DWORD vnum, const char* pos) LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } for (int i=0;i<100;i++) @@ -585,7 +579,7 @@ void CDungeon::SpawnUnique(const char* key, DWORD vnum, const char* pos) } else { - sys_err("Cannot spawn at %d %d", pkSectreeMap->m_setting.iBaseX+((ai.sx+ai.ex)>>1), pkSectreeMap->m_setting.iBaseY+((ai.sy+ai.ey)>>1)); + SPDLOG_ERROR("Cannot spawn at {} {}", pkSectreeMap->m_setting.iBaseX+((ai.sx+ai.ex)>>1), pkSectreeMap->m_setting.iBaseY+((ai.sy+ai.ey)>>1)); } } } @@ -618,7 +612,7 @@ void CDungeon::PurgeUnique(const std::string& key) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key or Dead: %s", key.c_str()); + SPDLOG_ERROR("Unknown Key or Dead: {}", key.c_str()); return; } LPCHARACTER ch = it->second; @@ -631,7 +625,7 @@ void CDungeon::KillUnique(const std::string& key) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key or Dead: %s", key.c_str()); + SPDLOG_ERROR("Unknown Key or Dead: {}", key.c_str()); return; } LPCHARACTER ch = it->second; @@ -644,7 +638,7 @@ DWORD CDungeon::GetUniqueVid(const std::string& key) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key or Dead: %s", key.c_str()); + SPDLOG_ERROR("Unknown Key or Dead: {}", key.c_str()); return 0; } LPCHARACTER ch = it->second; @@ -656,7 +650,7 @@ float CDungeon::GetUniqueHpPerc(const std::string& key) TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key : %s", key.c_str()); + SPDLOG_ERROR("Unknown Key : {}", key.c_str()); return false; } return (100.f*it->second->GetHP())/it->second->GetMaxHP(); @@ -671,7 +665,6 @@ void CDungeon::DeadCharacter(LPCHARACTER ch) { if (it->second == ch) { - //sys_log(0,"Dead unique %s", it->first.c_str()); m_map_UniqueMob.erase(it); break; } @@ -686,7 +679,7 @@ bool CDungeon::IsUniqueDead(const std::string& key) if (it == m_map_UniqueMob.end()) { - sys_err("Unknown Key or Dead : %s", key.c_str()); + SPDLOG_ERROR("Unknown Key or Dead : {}", key.c_str()); return true; } @@ -695,12 +688,11 @@ bool CDungeon::IsUniqueDead(const std::string& key) void CDungeon::Spawn(DWORD vnum, const char* pos) { - //sys_log(0,"DUNGEON Spawn %u %s", vnum, pos); TAreaMap::iterator it = m_map_Area.find(pos); if (it == m_map_Area.end()) { - sys_err("Wrong position string : %s", pos); + SPDLOG_ERROR("Wrong position string : {}", pos); return; } @@ -712,7 +704,7 @@ void CDungeon::Spawn(DWORD vnum, const char* pos) LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("cannot find map by index %d", m_lMapIndex); + SPDLOG_ERROR("cannot find map by index {}", m_lMapIndex); return; } int dx = Random::get(ai.sx, ai.ex); @@ -727,17 +719,17 @@ LPCHARACTER CDungeon::SpawnMob(DWORD vnum, int x, int y, int dir) { LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return NULL; } - sys_log(0, "CDungeon::SpawnMob %u %d %d", vnum, x, y); + SPDLOG_DEBUG("CDungeon::SpawnMob {} {} {}", vnum, x, y); LPCHARACTER ch = CHARACTER_MANAGER::instance().SpawnMob(vnum, m_lMapIndex, pkSectreeMap->m_setting.iBaseX+x*100, pkSectreeMap->m_setting.iBaseY+y*100, 0, false, dir == 0 ? -1 : (dir - 1) * 45); if (ch) { ch->SetDungeon(this); - sys_log(0, "CDungeon::SpawnMob name %s", ch->GetName()); + SPDLOG_DEBUG("CDungeon::SpawnMob name {}", ch->GetName()); } return ch; @@ -747,17 +739,17 @@ LPCHARACTER CDungeon::SpawnMob_ac_dir(DWORD vnum, int x, int y, int dir) { LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return NULL; } - sys_log(0, "CDungeon::SpawnMob %u %d %d", vnum, x, y); + SPDLOG_DEBUG("CDungeon::SpawnMob {} {} {}", vnum, x, y); LPCHARACTER ch = CHARACTER_MANAGER::instance().SpawnMob(vnum, m_lMapIndex, pkSectreeMap->m_setting.iBaseX+x*100, pkSectreeMap->m_setting.iBaseY+y*100, 0, false, dir); if (ch) { ch->SetDungeon(this); - sys_log(0, "CDungeon::SpawnMob name %s", ch->GetName()); + SPDLOG_DEBUG("CDungeon::SpawnMob name {}", ch->GetName()); } return ch; @@ -767,7 +759,7 @@ void CDungeon::SpawnNameMob(DWORD vnum, int x, int y, const char* name) { LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } @@ -785,11 +777,11 @@ void CDungeon::SpawnGotoMob(int lFromX, int lFromY, int lToX, int lToY) LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } - sys_log(0, "SpawnGotoMob %d %d to %d %d", lFromX, lFromY, lToX, lToY); + SPDLOG_DEBUG("SpawnGotoMob {} {} to {} {}", lFromX, lFromY, lToX, lToY); lFromX = pkSectreeMap->m_setting.iBaseX+lFromX*100; lFromY = pkSectreeMap->m_setting.iBaseY+lFromY*100; @@ -810,7 +802,7 @@ LPCHARACTER CDungeon::SpawnGroup(DWORD vnum, int x, int y, float radius, bool bA { LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return NULL; } @@ -837,14 +829,14 @@ void CDungeon::SpawnRegen(const char* filename, bool bOnce) { if (!filename) { - sys_err("CDungeon::SpawnRegen(filename=NULL, bOnce=%d) - m_lMapIndex[%d]", bOnce, m_lMapIndex); + SPDLOG_ERROR("CDungeon::SpawnRegen(filename=NULL, bOnce={}) - m_lMapIndex[{}]", bOnce, m_lMapIndex); return; } LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (!pkSectreeMap) { - sys_err("CDungeon::SpawnRegen(filename=%s, bOnce=%d) - m_lMapIndex[%d]", filename, bOnce, m_lMapIndex); + SPDLOG_ERROR("CDungeon::SpawnRegen(filename={}, bOnce={}) - m_lMapIndex[{}]", filename, bOnce, m_lMapIndex); return; } regen_do(filename, m_lMapIndex, pkSectreeMap->m_setting.iBaseX, pkSectreeMap->m_setting.iBaseY, this, bOnce); @@ -883,7 +875,7 @@ void CDungeon::SpawnMoveGroup(DWORD vnum, const char* pos_from, const char* pos_ if (it_to == m_map_Area.end()) { - sys_err("Wrong position string : %s", pos_to); + SPDLOG_ERROR("Wrong position string : {}", pos_to); return; } @@ -891,7 +883,7 @@ void CDungeon::SpawnMoveGroup(DWORD vnum, const char* pos_from, const char* pos_ if (it_from == m_map_Area.end()) { - sys_err("Wrong position string : %s", pos_from); + SPDLOG_ERROR("Wrong position string : {}", pos_from); return; } @@ -904,7 +896,7 @@ void CDungeon::SpawnMoveGroup(DWORD vnum, const char* pos_from, const char* pos_ LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkSectreeMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } @@ -952,7 +944,7 @@ namespace M2_DESTROY_ITEM(item); } else - sys_err("unknown entity type %d is in dungeon", ent->GetType()); + SPDLOG_ERROR("unknown entity type {} is in dungeon", ent->GetType()); } }; } @@ -962,7 +954,7 @@ void CDungeon::KillAll() { LPSECTREE_MAP pkMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } FKillSectree f; @@ -974,7 +966,7 @@ void CDungeon::Purge() { LPSECTREE_MAP pkMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (pkMap == NULL) { - sys_err("CDungeon: SECTREE_MAP not found for #%ld", m_lMapIndex); + SPDLOG_ERROR("CDungeon: SECTREE_MAP not found for #{}", m_lMapIndex); return; } FPurgeSectree f; @@ -1039,7 +1031,7 @@ int CDungeon::CountRealMonster() if (!pMap) { - sys_err("cannot find map by index %d", m_lOrigMapIndex); + SPDLOG_ERROR("cannot find map by index {}", m_lOrigMapIndex); return 0; } @@ -1070,7 +1062,7 @@ void CDungeon::ExitAll() if (!pMap) { - sys_err("cannot find map by index %d", m_lMapIndex); + SPDLOG_ERROR("cannot find map by index {}", m_lMapIndex); return; } @@ -1104,12 +1096,12 @@ namespace void CDungeon::Notice(const char* msg) { - sys_log(0, "XXX Dungeon Notice %p %s", this, msg); + SPDLOG_DEBUG("Dungeon Notice {} {}", (void*) this, msg); LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(m_lMapIndex); if (!pMap) { - sys_err("cannot find map by index %d", m_lMapIndex); + SPDLOG_ERROR("cannot find map by index {}", m_lMapIndex); return; } @@ -1146,7 +1138,7 @@ void CDungeon::ExitAllToStartPosition() if (!pMap) { - sys_err("cannot find map by index %d", m_lMapIndex); + SPDLOG_ERROR("cannot find map by index {}", m_lMapIndex); return; } @@ -1162,7 +1154,7 @@ EVENTFUNC(dungeon_jump_to_event) if ( info == NULL ) { - sys_err( "dungeon_jump_to_event> Null pointer" ); + SPDLOG_ERROR("dungeon_jump_to_event> Null pointer" ); return 0; } @@ -1172,7 +1164,7 @@ EVENTFUNC(dungeon_jump_to_event) if (pDungeon) pDungeon->JumpToEliminateLocation(); else - sys_err("cannot find dungeon with map index %u", info->dungeon_id); + SPDLOG_ERROR("cannot find dungeon with map index {}", info->dungeon_id); return 0; } @@ -1183,7 +1175,7 @@ EVENTFUNC(dungeon_exit_all_event) if ( info == NULL ) { - sys_err( "dungeon_exit_all_event> Null pointer" ); + SPDLOG_ERROR("dungeon_exit_all_event> Null pointer" ); return 0; } @@ -1203,7 +1195,7 @@ void CDungeon::CheckEliminated() if (m_bExitAllAtEliminate) { - sys_log(0, "CheckEliminated: exit"); + SPDLOG_DEBUG("CheckEliminated: exit"); m_bExitAllAtEliminate = false; if (m_iWarpDelay) @@ -1221,7 +1213,7 @@ void CDungeon::CheckEliminated() } else if (m_bWarpAtEliminate) { - sys_log(0, "CheckEliminated: warp"); + SPDLOG_DEBUG("CheckEliminated: warp"); m_bWarpAtEliminate = false; if (m_iWarpDelay) @@ -1238,12 +1230,12 @@ void CDungeon::CheckEliminated() } } else - sys_log(0, "CheckEliminated: none"); + SPDLOG_DEBUG("CheckEliminated: none"); } void CDungeon::SetExitAllAtEliminate(int time) { - sys_log(0, "SetExitAllAtEliminate: time %d", time); + SPDLOG_DEBUG("SetExitAllAtEliminate: time {}", time); m_bExitAllAtEliminate = true; m_iWarpDelay = time; } @@ -1261,7 +1253,7 @@ void CDungeon::SetWarpAtEliminate(int time, int lMapIndex, int x, int y, const c else m_stRegenFile = regen_file; - sys_log(0, "SetWarpAtEliminate: time %d map %d %dx%d regenfile %s", time, lMapIndex, x, y, m_stRegenFile.c_str()); + SPDLOG_DEBUG("SetWarpAtEliminate: time {} map {} {}x{} regenfile {}", time, lMapIndex, x, y, m_stRegenFile.c_str()); } void CDungeon::JumpToEliminateLocation() @@ -1285,7 +1277,7 @@ void CDungeon::JumpToEliminateLocation() if (!pMap) { - sys_err("no map by index %d", m_lMapIndex); + SPDLOG_ERROR("no map by index {}", m_lMapIndex); return; } @@ -1332,7 +1324,7 @@ bool CDungeon::IsAllPCNearTo(int x, int y, int dist) if (!pMap) { - sys_err("cannot find map by index %d", m_lMapIndex); + SPDLOG_ERROR("cannot find map by index {}", m_lMapIndex); return false; } diff --git a/src/game/src/dungeon.h b/src/game/src/dungeon.h index 1be70ce..4743c6a 100644 --- a/src/game/src/dungeon.h +++ b/src/game/src/dungeon.h @@ -36,7 +36,7 @@ class CDungeon void KillAll(); // END_OF_DUNGEON_KILL_ALL_BUG_FIX - void IncMonster() { m_iMonsterCount++; sys_log(0, "MonsterCount %d", m_iMonsterCount); } + void IncMonster() { m_iMonsterCount++; SPDLOG_DEBUG("MonsterCount {}", m_iMonsterCount); } void DecMonster() { m_iMonsterCount--; CheckEliminated(); } int CountMonster() { return m_iMonsterCount; } // µ¥ÀÌÅÍ·Î ¸®Á¨ÇÑ ¸ó½ºÅÍÀÇ ¼ö int CountRealMonster(); // ½ÇÁ¦·Î ¸Ê»ó¿¡ ÀÖ´Â ¸ó½ºÅÍ diff --git a/src/game/src/entity_view.cpp b/src/game/src/entity_view.cpp index b459485..2e3a0fa 100644 --- a/src/game/src/entity_view.cpp +++ b/src/game/src/entity_view.cpp @@ -126,7 +126,7 @@ void CEntity::UpdateSectree() if (IsType(ENTITY_CHARACTER)) { LPCHARACTER tch = (LPCHARACTER) this; - sys_err("null sectree name: %s %d %d", tch->GetName(), GetX(), GetY()); + SPDLOG_ERROR("null sectree name: {} {} {}", tch->GetName(), GetX(), GetY()); } return; diff --git a/src/game/src/event.cpp b/src/game/src/event.cpp index a1e6d1a..880b4d5 100644 --- a/src/game/src/event.cpp +++ b/src/game/src/event.cpp @@ -51,7 +51,7 @@ void event_cancel(LPEVENT * ppevent) if (!ppevent) { - sys_err("null pointer"); + SPDLOG_ERROR("null pointer"); return; } @@ -136,7 +136,6 @@ int event_process(int pulse) } else { - //sys_log(0, "EVENT: %s %d event %p info %p", the_event->file, the_event->line, the_event, the_event->info); new_time = (the_event->func) (get_pointer(the_event), processing_time); if (new_time <= 0 || the_event->is_force_to_end) diff --git a/src/game/src/exchange.cpp b/src/game/src/exchange.cpp index 0d6ec06..4738254 100644 --- a/src/game/src/exchange.cpp +++ b/src/game/src/exchange.cpp @@ -166,13 +166,13 @@ bool CExchange::AddItem(TItemPos item_pos, BYTE display_pos) // ÀÌ¹Ì ±³È¯Ã¢¿¡ Ãß°¡µÈ ¾ÆÀÌÅÛÀΰ¡? if (item->IsExchanging()) { - sys_log(0, "EXCHANGE under exchanging"); + SPDLOG_DEBUG("EXCHANGE under exchanging"); return false; } if (!m_pGrid->IsEmpty(display_pos, 1, item->GetSize())) { - sys_log(0, "EXCHANGE not empty item_pos %d %d %d", display_pos, 1, item->GetSize()); + SPDLOG_DEBUG("EXCHANGE not empty item_pos {} {} {}", display_pos, 1, item->GetSize()); return false; } @@ -207,7 +207,7 @@ bool CExchange::AddItem(TItemPos item_pos, BYTE display_pos) item->GetCount(), item); - sys_log(0, "EXCHANGE AddItem success %s pos(%d, %d) %d", item->GetName(), item_pos.window_type, item_pos.cell, display_pos); + SPDLOG_DEBUG("EXCHANGE AddItem success {} pos({}, {}) {}", item->GetName(), item_pos.window_type, item_pos.cell, display_pos); return true; } @@ -431,7 +431,7 @@ bool CExchange::Done() if (empty_pos < 0) { - sys_err("Exchange::Done : Cannot find blank position in inventory %s <-> %s item %s", + SPDLOG_ERROR("Exchange::Done : Cannot find blank position in inventory {} <-> {} item {}", m_pOwner->GetName(), victim->GetName(), item->GetName()); continue; } @@ -548,7 +548,7 @@ bool CExchange::Accept(bool bAccept) if (!db_clientdesc->IsPhase(PHASE_DBCLIENT)) { - sys_err("Cannot use exchange feature while DB cache connection is dead."); + SPDLOG_ERROR("Cannot use exchange feature while DB cache connection is dead."); victim->ChatPacket(CHAT_TYPE_INFO, "Unknown error"); GetOwner()->ChatPacket(CHAT_TYPE_INFO, "Unknown error"); goto EXCHANGE_END; diff --git a/src/game/src/fishing.cpp b/src/game/src/fishing.cpp index 0d0e801..c241ec5 100644 --- a/src/game/src/fishing.cpp +++ b/src/game/src/fishing.cpp @@ -301,7 +301,7 @@ void Initialize() for (int i = 0; i < MAX_FISH; ++i) { - sys_log(0, "FISH: %-24s vnum %5lu prob %4d %4d %4d %4d len %d %d %d", + SPDLOG_TRACE("FISH: {:24} vnum {:5} prob {:4} {:4} {:4} {:4} len {} {} {}", fish_info[i].name, fish_info[i].vnum, fish_info[i].prob[0], @@ -322,7 +322,7 @@ void Initialize() g_prob_accumulate[j][i] = fish_info[i].prob[j] + g_prob_accumulate[j][i - 1]; g_prob_sum[j] = g_prob_accumulate[j][MAX_FISH - 1]; - sys_log(0, "FISH: prob table %d %d", j, g_prob_sum[j]); + SPDLOG_DEBUG("FISH: prob table {} {}", j, g_prob_sum[j]); } } @@ -472,7 +472,7 @@ EVENTFUNC(fishing_event) if ( info == NULL ) { - sys_err( "fishing_event> Null pointer" ); + SPDLOG_ERROR("fishing_event> Null pointer" ); return 0; } @@ -558,7 +558,7 @@ int Compute(DWORD fish_id, DWORD ms, DWORD* item, int level) if (fish_id >= MAX_FISH) { - sys_err("Wrong FISH ID : %d", fish_id); + SPDLOG_ERROR("Wrong FISH ID : {}", fish_id); return -2; } @@ -857,7 +857,7 @@ int RealRefineRod(LPCHARACTER ch, LPITEM item) // REFINE_ROD_HACK_BUG_FIX if (!RefinableRod(item)) { - sys_err("REFINE_ROD_HACK pid(%u) item(%s:%d)", ch->GetPlayerID(), item->GetName(), item->GetID()); + SPDLOG_ERROR("REFINE_ROD_HACK pid({}) item({}:{})", ch->GetPlayerID(), item->GetName(), item->GetID()); LogManager::instance().RefineLog(ch->GetPlayerID(), item->GetName(), item->GetID(), -1, 1, "ROD_HACK"); diff --git a/src/game/src/gm.cpp b/src/game/src/gm.cpp index e9bdf55..dea53b2 100644 --- a/src/game/src/gm.cpp +++ b/src/game/src/gm.cpp @@ -23,7 +23,7 @@ void gm_new_clear() void gm_new_insert( const tAdminInfo &rAdminInfo ) { - sys_log( 0, "InsertGMList(account:%s, player:%s, contact_ip:%s, server_ip:%s, auth:%d)", + SPDLOG_DEBUG("InsertGMList(account:{}, player:{}, contact_ip:{}, server_ip:{}, auth:{})", rAdminInfo.m_szAccount, rAdminInfo.m_szName, rAdminInfo.m_szContactIP, @@ -35,12 +35,12 @@ void gm_new_insert( const tAdminInfo &rAdminInfo ) if ( strlen( rAdminInfo.m_szContactIP ) == 0 ) { t.pset_Host = &g_set_Host; - sys_log(0, "GM Use ContactIP" ); + SPDLOG_DEBUG("GM Use ContactIP" ); } else { t.pset_Host = NULL; - sys_log(0, "GM Use Default Host List" ); + SPDLOG_DEBUG("GM Use Default Host List" ); } memcpy ( &t.Info, &rAdminInfo, sizeof ( rAdminInfo ) ); @@ -52,7 +52,7 @@ void gm_new_insert( const tAdminInfo &rAdminInfo ) void gm_new_host_inert( const char * host ) { g_set_Host.insert( host ); - sys_log( 0, "InsertGMHost(ip:%s)", host ); + SPDLOG_DEBUG("InsertGMHost(ip:{})", host ); } BYTE gm_new_get_level( const char * name, const char * host, const char* account) @@ -72,11 +72,11 @@ BYTE gm_new_get_level( const char * name, const char * host, const char* account { if ( strcmp ( it->second.Info.m_szAccount, account ) != 0 ) { - sys_log(0, "GM_NEW_GET_LEVEL : BAD ACCOUNT [ACCOUNT:%s/%s", it->second.Info.m_szAccount, account); + SPDLOG_DEBUG("GM_NEW_GET_LEVEL : BAD ACCOUNT [ACCOUNT:{}/{}", it->second.Info.m_szAccount, account); return GM_PLAYER; } } - sys_log(0, "GM_NEW_GET_LEVEL : FIND ACCOUNT"); + SPDLOG_DEBUG("GM_NEW_GET_LEVEL : FIND ACCOUNT"); return it->second.Info.m_Authority; } // END_OF_GERMAN_GM_NOT_CHECK_HOST @@ -89,7 +89,7 @@ BYTE gm_new_get_level( const char * name, const char * host, const char* account { if ( it->second.pset_Host->end() == it->second.pset_Host->find( host ) ) { - sys_log(0, "GM_NEW_GET_LEVEL : BAD HOST IN HOST_LIST"); + SPDLOG_DEBUG("GM_NEW_GET_LEVEL : BAD HOST IN HOST_LIST"); return GM_PLAYER; } } @@ -97,12 +97,12 @@ BYTE gm_new_get_level( const char * name, const char * host, const char* account { if ( strcmp ( it->second.Info.m_szContactIP, host ) != 0 ) { - sys_log(0, "GM_NEW_GET_LEVEL : BAD HOST IN GMLIST"); + SPDLOG_DEBUG("GM_NEW_GET_LEVEL : BAD HOST IN GMLIST"); return GM_PLAYER; } } } - sys_log(0, "GM_NEW_GET_LEVEL : FIND HOST"); + SPDLOG_DEBUG("GM_NEW_GET_LEVEL : FIND HOST"); return it->second.Info.m_Authority; } diff --git a/src/game/src/group_text_parse_tree.cpp b/src/game/src/group_text_parse_tree.cpp index a1f3f9c..c55da8d 100644 --- a/src/game/src/group_text_parse_tree.cpp +++ b/src/game/src/group_text_parse_tree.cpp @@ -75,10 +75,10 @@ bool CGroupTextParseTreeLoader::LoadGroup(CGroupNode * pGroupNode) { if (2 != stTokenVector.size()) { - sys_err("Invalid group syntax token size: %u != 2 (DO NOT SPACE IN NAME)", stTokenVector.size()); + SPDLOG_ERROR("Invalid group syntax token size: {} != 2 (DO NOT SPACE IN NAME)", stTokenVector.size()); for (unsigned int i = 0; i < stTokenVector.size(); ++i) - sys_err(" %u %s", i, stTokenVector[i].c_str()); - exit(1); + SPDLOG_ERROR(" {} {}", i, stTokenVector[i].c_str()); + exit(EXIT_FAILURE); continue; } @@ -108,7 +108,7 @@ bool CGroupTextParseTreeLoader::LoadGroup(CGroupNode * pGroupNode) if (1 == stTokenVector.size()) { - sys_err("CGroupTextParseTreeLoader::LoadGroup : must have a value (filename: %s line: %d key: %s)", + SPDLOG_ERROR("CGroupTextParseTreeLoader::LoadGroup : must have a value (filename: {} line: {} key: {})", m_strFileName.c_str(), m_dwcurLineIndex, key.c_str()); diff --git a/src/game/src/guild.cpp b/src/game/src/guild.cpp index a2ecfc8..a0eed4a 100644 --- a/src/game/src/guild.cpp +++ b/src/game/src/guild.cpp @@ -139,7 +139,7 @@ void CGuild::RequestAddMember(LPCHARACTER ch, int grade) if (m_member.find(ch->GetPlayerID()) != m_member.end()) { - sys_err("Already a member in guild %s[%d]", ch->GetName(), ch->GetPlayerID()); + SPDLOG_ERROR("Already a member in guild {}[{}]", ch->GetName(), ch->GetPlayerID()); return; } @@ -172,8 +172,8 @@ void CGuild::AddMember(TPacketDGGuildMember * p) LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(p->dwPID); - sys_log(0, "GUILD: AddMember PID %u, grade %u, job %u, level %u, offer %u, name %s ptr %p", - p->dwPID, p->bGrade, p->bJob, p->bLevel, p->dwOffer, p->szName, get_pointer(ch)); + SPDLOG_DEBUG("GUILD: AddMember PID {}, grade {}, job {}, level {}, offer {}, name {} ptr {}", + p->dwPID, p->bGrade, p->bJob, p->bLevel, p->dwOffer, p->szName, (void*) get_pointer(ch)); if (ch) LoginMember(ch); @@ -202,7 +202,7 @@ bool CGuild::RequestRemoveMember(DWORD pid) bool CGuild::RemoveMember(DWORD pid) { - sys_log(0, "Receive Guild P2P RemoveMember"); + SPDLOG_DEBUG("Receive Guild P2P RemoveMember"); TGuildMemberContainer::iterator it; if ((it = m_member.find(pid)) == m_member.end()) @@ -240,7 +240,7 @@ void CGuild::P2PLoginMember(DWORD pid) { if (m_member.find(pid) == m_member.end()) { - sys_err("GUILD [%d] is not a memeber of guild.", pid); + SPDLOG_ERROR("GUILD [{}] is not a memeber of guild.", pid); return; } @@ -257,7 +257,7 @@ void CGuild::LoginMember(LPCHARACTER ch) { if (m_member.find(ch->GetPlayerID()) == m_member.end()) { - sys_err("GUILD %s[%d] is not a memeber of guild.", ch->GetName(), ch->GetPlayerID()); + SPDLOG_ERROR("GUILD {}[{}] is not a memeber of guild.", ch->GetName(), ch->GetPlayerID()); return; } @@ -284,7 +284,7 @@ void CGuild::P2PLogoutMember(DWORD pid) { if (m_member.find(pid)==m_member.end()) { - sys_err("GUILD [%d] is not a memeber of guild.", pid); + SPDLOG_ERROR("GUILD [{}] is not a memeber of guild.", pid); return; } @@ -302,7 +302,7 @@ void CGuild::LogoutMember(LPCHARACTER ch) { if (m_member.find(ch->GetPlayerID())==m_member.end()) { - sys_err("GUILD %s[%d] is not a memeber of guild.", ch->GetName(), ch->GetPlayerID()); + SPDLOG_ERROR("GUILD {}[{}] is not a memeber of guild.", ch->GetName(), ch->GetPlayerID()); return; } @@ -450,8 +450,7 @@ void CGuild::SendListPacket(LPCHARACTER ch) buf.write(c, CHARACTER_NAME_MAX_LEN+1 ); - if ( test_server ) - sys_log(0 ,"name %s job %d ", it->second.name.c_str(), it->second.job ); + SPDLOG_TRACE("name {} job {} ", it->second.name.c_str(), it->second.job ); } d->Packet(buf.read_peek(), buf.size()); @@ -564,7 +563,7 @@ void CGuild::LoadGuildGradeData(SQLMsg* pmsg) // 15°³ ¾Æ´Ò °¡´É¼º Á¸Àç if (pmsg->Get()->iNumRows != 15) { - sys_err("Query failed: getting guild grade data. GuildID(%d)", GetID()); + SPDLOG_ERROR("Query failed: getting guild grade data. GuildID({})", GetID()); return; } */ @@ -578,7 +577,6 @@ void CGuild::LoadGuildGradeData(SQLMsg* pmsg) if (grade >= 1 && grade <= 15) { - //sys_log(0, "GuildGradeLoad %s", name); strlcpy(m_data.grade_array[grade-1].grade_name, name, sizeof(m_data.grade_array[grade-1].grade_name)); m_data.grade_array[grade-1].auth_flag = auth; } @@ -588,7 +586,7 @@ void CGuild::LoadGuildData(SQLMsg* pmsg) { if (pmsg->Get()->uiNumRows == 0) { - sys_err("Query failed: getting guild data %s", pmsg->stQuery.c_str()); + SPDLOG_ERROR("Query failed: getting guild data {}", pmsg->stQuery.c_str()); return; } @@ -628,7 +626,7 @@ void CGuild::Load(DWORD guild_id) DBManager::instance().FuncQuery(std::bind1st(std::mem_fun(&CGuild::LoadGuildData), this), "SELECT master, level, exp, name, skill_point, skill, sp, ladder_point, win, draw, loss, gold FROM guild%s WHERE id = %u", get_table_postfix(), m_data.guild_id); - sys_log(0, "GUILD: loading guild id %12s %u", m_data.name, guild_id); + SPDLOG_DEBUG("GUILD: loading guild id {:>12} {}", m_data.name, guild_id); DBManager::instance().FuncQuery(std::bind1st(std::mem_fun(&CGuild::LoadGuildGradeData), this), "SELECT grade, name, auth+0 FROM guild_grade%s WHERE guild_id = %u", get_table_postfix(), m_data.guild_id); @@ -794,7 +792,7 @@ void CGuild::ChangeGradeName(BYTE grade, const char* grade_name) if (grade < 1 || grade > 15) { - sys_err("Wrong guild grade value %d", grade); + SPDLOG_ERROR("Wrong guild grade value {}", grade); return; } @@ -842,7 +840,7 @@ void CGuild::ChangeGradeAuth(BYTE grade, BYTE auth) if (grade < 1 || grade > 15) { - sys_err("Wrong guild grade value %d", grade); + SPDLOG_ERROR("Wrong guild grade value {}", grade); return; } @@ -900,8 +898,8 @@ void CGuild::SendGuildInfoPacket(LPCHARACTER ch) pack_sub.gold = m_data.gold; pack_sub.has_land = HasLand(); - sys_log(0, "GMC guild_name %s", m_data.name); - sys_log(0, "GMC master %d", m_data.master_pid); + SPDLOG_DEBUG("GMC guild_name {}", m_data.name); + SPDLOG_DEBUG("GMC master {}", m_data.master_pid); d->RawPacket(&pack, sizeof(TPacketGCGuild)); d->Packet(&pack_sub, sizeof(TPacketGCGuildInfo)); @@ -928,7 +926,7 @@ bool CGuild::OfferExp(LPCHARACTER ch, int amount) if (ch->GetExp() - (DWORD) amount > ch->GetExp()) { - sys_err("Wrong guild offer amount %d by %s[%u]", amount, ch->GetName(), ch->GetPlayerID()); + SPDLOG_ERROR("Wrong guild offer amount {} by {}[{}]", amount, ch->GetName(), ch->GetPlayerID()); return false; } @@ -974,7 +972,7 @@ bool CGuild::OfferExp(LPCHARACTER ch, int amount) void CGuild::Disband() { - sys_log(0, "GUILD: Disband %s:%u", GetName(), GetID()); + SPDLOG_DEBUG("GUILD: Disband {}:{}", GetName(), GetID()); //building::CLand* pLand = building::CManager::instance().FindLandByGuild(GetID()); //if (pLand) @@ -1193,7 +1191,7 @@ void CGuild::SkillLevelUp(DWORD dwVnum) if (!pkSk) { - sys_err("There is no such guild skill by number %u", dwVnum); + SPDLOG_ERROR("There is no such guild skill by number {}", dwVnum); return; } @@ -1232,7 +1230,7 @@ void CGuild::SkillLevelUp(DWORD dwVnum) for_each(m_memberOnline.begin(), m_memberOnline.end(), std::bind1st(std::mem_fun_ref(&CGuild::SendSkillInfoPacket),*this)); - sys_log(0, "Guild SkillUp: %s %d level %d type %u", GetName(), pkSk->dwVnum, m_data.abySkill[dwRealVnum], pkSk->dwType); + SPDLOG_DEBUG("Guild SkillUp: {} {} level {} type {}", GetName(), pkSk->dwVnum, m_data.abySkill[dwRealVnum], pkSk->dwType); } void CGuild::UseSkill(DWORD dwVnum, LPCHARACTER ch, DWORD pid) @@ -1242,7 +1240,7 @@ void CGuild::UseSkill(DWORD dwVnum, LPCHARACTER ch, DWORD pid) if (!GetMember(ch->GetPlayerID()) || !HasGradeAuth(GetMember(ch->GetPlayerID())->grade, GUILD_AUTH_USE_SKILL)) return; - sys_log(0,"GUILD_USE_SKILL : cname(%s), skill(%d)", ch ? ch->GetName() : "", dwVnum); + SPDLOG_DEBUG("GUILD_USE_SKILL : cname({}), skill({})", ch ? ch->GetName() : "", dwVnum); DWORD dwRealVnum = dwVnum - GUILD_SKILL_START; @@ -1256,7 +1254,7 @@ void CGuild::UseSkill(DWORD dwVnum, LPCHARACTER ch, DWORD pid) if (!pkSk) { - sys_err("There is no such guild skill by number %u", dwVnum); + SPDLOG_ERROR("There is no such guild skill by number {}", dwVnum); return; } @@ -1748,7 +1746,7 @@ void CGuild::SkillUsableChange(DWORD dwSkillVnum, bool bUsable) abSkillUsable[dwRealVnum] = bUsable; // GUILD_SKILL_COOLTIME_BUG_FIX - sys_log(0, "CGuild::SkillUsableChange(guild=%s, skill=%d, usable=%d)", GetName(), dwSkillVnum, bUsable); + SPDLOG_DEBUG("CGuild::SkillUsableChange(guild={}, skill={}, usable={})", GetName(), dwSkillVnum, bUsable); // END_OF_GUILD_SKILL_COOLTIME_BUG_FIX } @@ -1756,7 +1754,7 @@ void CGuild::SkillUsableChange(DWORD dwSkillVnum, bool bUsable) void CGuild::SetMemberCountBonus(int iBonus) { m_iMemberCountBonus = iBonus; - sys_log(0, "GUILD_IS_FULL_BUG : Bonus set to %d(val:%d)", iBonus, m_iMemberCountBonus); + SPDLOG_DEBUG("GUILD_IS_FULL_BUG : Bonus set to {}(val:{})", iBonus, m_iMemberCountBonus); } void CGuild::BroadcastMemberCountBonus() @@ -1827,7 +1825,7 @@ void CGuild::RequestDepositMoney(LPCHARACTER ch, int iGold) LogManager::instance().CharLog(ch, iGold, "GUILD_DEPOSIT", buf); ch->UpdateDepositPulse(); - sys_log(0, "GUILD: DEPOSIT %s:%u player %s[%u] gold %d", GetName(), GetID(), ch->GetName(), ch->GetPlayerID(), iGold); + SPDLOG_DEBUG("GUILD: DEPOSIT {}:{} player {}[{}] gold {}", GetName(), GetID(), ch->GetName(), ch->GetPlayerID(), iGold); } void CGuild::RequestWithdrawMoney(LPCHARACTER ch, int iGold) @@ -1883,7 +1881,7 @@ void CGuild::RecvWithdrawMoneyGive(int iChangeGold) if (ch) { ch->PointChange(POINT_GOLD, iChangeGold); - sys_log(0, "GUILD: WITHDRAW %s:%u player %s[%u] gold %d", GetName(), GetID(), ch->GetName(), ch->GetPlayerID(), iChangeGold); + SPDLOG_DEBUG("GUILD: WITHDRAW {}:{} player {}[{}] gold {}", GetName(), GetID(), ch->GetName(), ch->GetPlayerID(), iChangeGold); } TPacketGDGuildMoneyWithdrawGiveReply p; @@ -1922,7 +1920,7 @@ EVENTFUNC( GuildInviteEvent ) if ( pInfo == NULL ) { - sys_err( "GuildInviteEvent> Null pointer" ); + SPDLOG_ERROR("GuildInviteEvent> Null pointer" ); return 0; } @@ -1930,7 +1928,7 @@ EVENTFUNC( GuildInviteEvent ) if ( pGuild ) { - sys_log( 0, "GuildInviteEvent %s", pGuild->GetName() ); + SPDLOG_DEBUG("GuildInviteEvent {}", pGuild->GetName() ); pGuild->InviteDeny( pInfo->dwInviteePID ); } @@ -1984,7 +1982,7 @@ void CGuild::Invite( LPCHARACTER pchInviter, LPCHARACTER pchInvitee ) case GERR_GUILD_IS_IN_WAR : pchInviter->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÇöÀç ±æµå°¡ ÀüÀï Áß ÀÔ´Ï´Ù.") ); return; case GERR_INVITE_LIMIT : pchInviter->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÇöÀç ½Å±Ô °¡ÀÔ Á¦ÇÑ »óÅ ÀÔ´Ï´Ù.") ); return; - default: sys_err( "ignore guild join error(%d)", errcode ); return; + default: SPDLOG_ERROR("ignore guild join error({})", (int) errcode ); return; } if ( m_GuildInviteEventMap.end() != m_GuildInviteEventMap.find( pchInvitee->GetPlayerID() ) ) @@ -2023,7 +2021,7 @@ void CGuild::InviteAccept( LPCHARACTER pchInvitee ) EventMap::iterator itFind = m_GuildInviteEventMap.find( pchInvitee->GetPlayerID() ); if ( itFind == m_GuildInviteEventMap.end() ) { - sys_log( 0, "GuildInviteAccept from not invited character(invite guild: %s, invitee: %s)", GetName(), pchInvitee->GetName() ); + SPDLOG_DEBUG("GuildInviteAccept from not invited character(invite guild: {}, invitee: {})", GetName(), pchInvitee->GetName() ); return; } @@ -2049,7 +2047,7 @@ void CGuild::InviteAccept( LPCHARACTER pchInvitee ) case GERR_GUILD_IS_IN_WAR : pchInvitee->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÇöÀç ±æµå°¡ ÀüÀï Áß ÀÔ´Ï´Ù.") ); return; case GERR_INVITE_LIMIT : pchInvitee->ChatPacket( CHAT_TYPE_INFO, LC_TEXT("<±æµå> ÇöÀç ½Å±Ô °¡ÀÔ Á¦ÇÑ »óÅ ÀÔ´Ï´Ù.") ); return; - default: sys_err( "ignore guild join error(%d)", errcode ); return; + default: SPDLOG_ERROR("ignore guild join error({})", (int) errcode); return; } RequestAddMember( pchInvitee, 15 ); @@ -2060,7 +2058,7 @@ void CGuild::InviteDeny( DWORD dwPID ) EventMap::iterator itFind = m_GuildInviteEventMap.find( dwPID ); if ( itFind == m_GuildInviteEventMap.end() ) { - sys_log( 0, "GuildInviteDeny from not invited character(invite guild: %s, invitee PID: %d)", GetName(), dwPID ); + SPDLOG_DEBUG("GuildInviteDeny from not invited character(invite guild: {}, invitee PID: {})", GetName(), dwPID ); return; } @@ -2080,7 +2078,7 @@ CGuild::GuildJoinErrCode CGuild::VerifyGuildJoinableCondition( const LPCHARACTER return GERR_ALREADYJOIN; else if ( GetMemberCount() >= GetMaxMemberCount() ) { - sys_log(1, "GuildName = %s, GetMemberCount() = %d, GetMaxMemberCount() = %d (32 + MAX(level(%d)-10, 0) * 2 + bonus(%d)", + SPDLOG_DEBUG("GuildName = {}, GetMemberCount() = {}, GetMaxMemberCount() = {} (32 + MAX(level({})-10, 0) * 2 + bonus({})", GetName(), GetMemberCount(), GetMaxMemberCount(), m_data.level, m_iMemberCountBonus); return GERR_GUILDISFULL; } diff --git a/src/game/src/guild_manager.cpp b/src/game/src/guild_manager.cpp index 3002844..5768cd8 100644 --- a/src/game/src/guild_manager.cpp +++ b/src/game/src/guild_manager.cpp @@ -197,11 +197,11 @@ CGuild* CGuildManager::FindGuildByName(const std::string guild_name) void CGuildManager::Initialize() { - sys_log(0, "Initializing Guild"); + SPDLOG_DEBUG("Initializing Guild"); if (g_bAuthServer) { - sys_log(0, " No need for auth server"); + SPDLOG_DEBUG(" No need for auth server"); return; } @@ -469,7 +469,7 @@ void CGuildManager::GetAroundRankString(DWORD dwMyGuild, char * buffer, size_t b ///////////////////////////////////////////////////////////////////// void CGuildManager::RequestCancelWar(DWORD guild_id1, DWORD guild_id2) { - sys_log(0, "RequestCancelWar %d %d", guild_id1, guild_id2); + SPDLOG_DEBUG("RequestCancelWar {} {}", guild_id1, guild_id2); TPacketGuildWar p; p.bWar = GUILD_WAR_CANCEL; @@ -480,7 +480,7 @@ void CGuildManager::RequestCancelWar(DWORD guild_id1, DWORD guild_id2) void CGuildManager::RequestEndWar(DWORD guild_id1, DWORD guild_id2) { - sys_log(0, "RequestEndWar %d %d", guild_id1, guild_id2); + SPDLOG_DEBUG("RequestEndWar {} {}", guild_id1, guild_id2); TPacketGuildWar p; p.bWar = GUILD_WAR_END; @@ -496,7 +496,7 @@ void CGuildManager::RequestWarOver(DWORD dwGuild1, DWORD dwGuild2, DWORD dwGuild if (g1->GetGuildWarState(g2->GetID()) != GUILD_WAR_ON_WAR) { - sys_log(0, "RequestWarOver : both guild was not in war %u %u", dwGuild1, dwGuild2); + SPDLOG_DEBUG("RequestWarOver : both guild was not in war {} {}", dwGuild1, dwGuild2); RequestEndWar(dwGuild1, dwGuild2); return; } @@ -521,7 +521,7 @@ void CGuildManager::RequestWarOver(DWORD dwGuild1, DWORD dwGuild2, DWORD dwGuild } db_clientdesc->DBPacket(HEADER_GD_GUILD_WAR, 0, &p, sizeof(p)); - sys_log(0, "RequestWarOver : winner %u loser %u draw %u betprice %d", p.dwGuildFrom, p.dwGuildTo, p.bType, p.lWarPrice); + SPDLOG_DEBUG("RequestWarOver : winner {} loser {} draw {} betprice {}", p.dwGuildFrom, p.dwGuildTo, p.bType, p.lWarPrice); } void CGuildManager::DeclareWar(DWORD guild_id1, DWORD guild_id2, BYTE bType) @@ -572,7 +572,7 @@ void CGuildManager::WaitStartWar(DWORD guild_id1, DWORD guild_id2) if (!g1 || !g2) { - sys_log(0, "GuildWar: CGuildManager::WaitStartWar(%d,%d) - something wrong in arg. there is no guild like that.", guild_id1, guild_id2); + SPDLOG_DEBUG("GuildWar: CGuildManager::WaitStartWar({},{}) - something wrong in arg. there is no guild like that.", guild_id1, guild_id2); return; } @@ -677,7 +677,7 @@ bool CGuildManager::EndWar(DWORD guild_id1, DWORD guild_id2) if (m_GuildWar.end() == it) { - sys_log(0, "EndWar(%d,%d) - EndWar request but guild is not in list", guild_id1, guild_id2); + SPDLOG_DEBUG("EndWar({},{}) - EndWar request but guild is not in list", guild_id1, guild_id2); return false; } @@ -760,7 +760,7 @@ void CGuildManager::CancelWar(DWORD guild_id1, DWORD guild_id2) void CGuildManager::ReserveWar(DWORD dwGuild1, DWORD dwGuild2, BYTE bType) // from DB { - sys_log(0, "GuildManager::ReserveWar %u %u", dwGuild1, dwGuild2); + SPDLOG_DEBUG("GuildManager::ReserveWar {} {}", dwGuild1, dwGuild2); CGuild * g1 = FindGuild(dwGuild1); CGuild * g2 = FindGuild(dwGuild2); @@ -822,7 +822,7 @@ void SendGuildWarScore(DWORD dwGuild, DWORD dwGuildOpp, int iDelta, int iBetScor p.lBetScore = iBetScoreDelta; db_clientdesc->DBPacket(HEADER_GD_GUILD_WAR_SCORE, 0, &p, sizeof(TPacketGuildWarScore)); - sys_log(0, "SendGuildWarScore %u %u %d", dwGuild, dwGuildOpp, iDelta); + SPDLOG_DEBUG("SendGuildWarScore {} {} {}", dwGuild, dwGuildOpp, iDelta); } void CGuildManager::Kill(LPCHARACTER killer, LPCHARACTER victim) @@ -885,7 +885,7 @@ void CGuildManager::ReserveWarAdd(TGuildWarReserve * p) memcpy(&pkReserve->data, p, sizeof(TGuildWarReserve)); - sys_log(0, "ReserveWarAdd %u gid1 %u power %d gid2 %u power %d handicap %d", + SPDLOG_DEBUG("ReserveWarAdd {} gid1 {} power {} gid2 {} power {} handicap {}", pkReserve->data.dwID, p->dwGuildFrom, p->lPowerFrom, p->dwGuildTo, p->lPowerTo, p->lHandicap); } @@ -911,7 +911,7 @@ bool CGuildManager::IsBet(DWORD dwID, const char * c_pszLogin) void CGuildManager::ReserveWarDelete(DWORD dwID) { - sys_log(0, "ReserveWarDelete %u", dwID); + SPDLOG_DEBUG("ReserveWarDelete {}", dwID); itertype(m_map_kReserveWar) it = m_map_kReserveWar.find(dwID); if (it == m_map_kReserveWar.end()) diff --git a/src/game/src/guild_war.cpp b/src/game/src/guild_war.cpp index d358b20..f8b5486 100644 --- a/src/game/src/guild_war.cpp +++ b/src/game/src/guild_war.cpp @@ -180,7 +180,7 @@ void CGuild::SetWarScoreAgainstTo(DWORD dwOppGID, int iScore) { DWORD dwSelfGID = GetID(); - sys_log(0, "GuildWarScore Set %u from %u %d", dwSelfGID, dwOppGID, iScore); + SPDLOG_DEBUG("GuildWarScore Set {} from {} {}", dwSelfGID, dwOppGID, iScore); itertype(m_EnemyGuild) it = m_EnemyGuild.find(dwOppGID); if (it != m_EnemyGuild.end()) @@ -226,11 +226,11 @@ int CGuild::GetWarScoreAgainstTo(DWORD dwOppGID) if (it != m_EnemyGuild.end()) { - sys_log(0, "GuildWarScore Get %u from %u %d", GetID(), dwOppGID, it->second.score); + SPDLOG_DEBUG("GuildWarScore Get {} from {} {}", GetID(), dwOppGID, it->second.score); return it->second.score; } - sys_log(0, "GuildWarScore Get %u from %u No data", GetID(), dwOppGID); + SPDLOG_DEBUG("GuildWarScore Get {} from {} No data", GetID(), dwOppGID); return 0; } @@ -294,13 +294,13 @@ void CGuild::RequestDeclareWar(DWORD dwOppGID, BYTE type) { if (dwOppGID == GetID()) { - sys_log(0, "GuildWar.DeclareWar.DECLARE_WAR_SELF id(%d -> %d), type(%d)", GetID(), dwOppGID, type); + SPDLOG_ERROR("GuildWar.DeclareWar.DECLARE_WAR_SELF id({} -> {}), type({})", GetID(), dwOppGID, type); return; } if (type >= GUILD_WAR_TYPE_MAX_NUM) { - sys_log(0, "GuildWar.DeclareWar.UNKNOWN_WAR_TYPE id(%d -> %d), type(%d)", GetID(), dwOppGID, type); + SPDLOG_ERROR("GuildWar.DeclareWar.UNKNOWN_WAR_TYPE id({} -> {}), type({})", GetID(), dwOppGID, type); return; } @@ -309,7 +309,7 @@ void CGuild::RequestDeclareWar(DWORD dwOppGID, BYTE type) { if (!GuildWar_IsWarMap(type)) { - sys_err("GuildWar.DeclareWar.NOT_EXIST_MAP id(%d -> %d), type(%d), map(%d)", + SPDLOG_ERROR("GuildWar.DeclareWar.NOT_EXIST_MAP id({} -> {}), type({}), map({})", GetID(), dwOppGID, type, GuildWar_GetTypeMapIndex(type)); map_allow_log(); @@ -324,7 +324,7 @@ void CGuild::RequestDeclareWar(DWORD dwOppGID, BYTE type) p.dwGuildFrom = GetID(); p.dwGuildTo = dwOppGID; db_clientdesc->DBPacket(HEADER_GD_GUILD_WAR, 0, &p, sizeof(p)); - sys_log(0, "GuildWar.DeclareWar id(%d -> %d), type(%d)", GetID(), dwOppGID, type); + SPDLOG_DEBUG("GuildWar.DeclareWar id({} -> {}), type({})", GetID(), dwOppGID, type); return; } @@ -343,13 +343,13 @@ void CGuild::RequestDeclareWar(DWORD dwOppGID, BYTE type) p.dwGuildFrom = GetID(); p.dwGuildTo = dwOppGID; db_clientdesc->DBPacket(HEADER_GD_GUILD_WAR, 0, &p, sizeof(p)); - sys_log(0, "GuildWar.AcceptWar id(%d -> %d), type(%d)", GetID(), dwOppGID, saved_type); + SPDLOG_DEBUG("GuildWar.AcceptWar id({} -> {}), type({})", GetID(), dwOppGID, saved_type); return; } if (!GuildWar_IsWarMap(saved_type)) { - sys_err("GuildWar.AcceptWar.NOT_EXIST_MAP id(%d -> %d), type(%d), map(%d)", + SPDLOG_ERROR("GuildWar.AcceptWar.NOT_EXIST_MAP id({} -> {}), type({}), map({})", GetID(), dwOppGID, type, GuildWar_GetTypeMapIndex(type)); map_allow_log(); @@ -372,7 +372,7 @@ void CGuild::RequestDeclareWar(DWORD dwOppGID, BYTE type) db_clientdesc->DBPacket(HEADER_GD_GUILD_WAR, 0, &p, sizeof(p)); - sys_log(0, "GuildWar.WaitStartSendToDB id(%d vs %d), type(%d), bet(%d), map_index(%d)", + SPDLOG_DEBUG("GuildWar.WaitStartSendToDB id({} vs {}), type({}), bet({}), map_index({})", GetID(), dwOppGID, saved_type, guildWarInfo.iWarPrice, guildWarInfo.lMapIndex); } @@ -383,7 +383,7 @@ void CGuild::RequestDeclareWar(DWORD dwOppGID, BYTE type) } break; default: - sys_err("GuildWar.DeclareWar.UNKNOWN_STATE[%d]: id(%d vs %d), type(%d), guild(%s:%u)", + SPDLOG_ERROR("GuildWar.DeclareWar.UNKNOWN_STATE[{}]: id({} vs {}), type({}), guild({}:{})", it->second.state, GetID(), dwOppGID, type, GetName(), GetID()); break; } @@ -444,7 +444,7 @@ bool CGuild::WaitStartWar(DWORD dwOppGID) //ÀÚ±âÀÚ½ÅÀ̸é if (dwOppGID == GetID()) { - sys_log(0 ,"GuildWar.WaitStartWar.DECLARE_WAR_SELF id(%u -> %u)", GetID(), dwOppGID); + SPDLOG_ERROR("GuildWar.WaitStartWar.DECLARE_WAR_SELF id({} -> {})", GetID(), dwOppGID); return false; } @@ -452,7 +452,7 @@ bool CGuild::WaitStartWar(DWORD dwOppGID) itertype(m_EnemyGuild) it = m_EnemyGuild.find(dwOppGID); if (it == m_EnemyGuild.end()) { - sys_log(0 ,"GuildWar.WaitStartWar.UNKNOWN_ENEMY id(%u -> %u)", GetID(), dwOppGID); + SPDLOG_ERROR("GuildWar.WaitStartWar.UNKNOWN_ENEMY id({} -> {})", GetID(), dwOppGID); return false; } @@ -461,7 +461,7 @@ bool CGuild::WaitStartWar(DWORD dwOppGID) if (gw.state == GUILD_WAR_WAIT_START) { - sys_log(0 ,"GuildWar.WaitStartWar.UNKNOWN_STATE id(%u -> %u), state(%d)", GetID(), dwOppGID, gw.state); + SPDLOG_ERROR("GuildWar.WaitStartWar.UNKNOWN_STATE id({} -> {}), state({})", GetID(), dwOppGID, gw.state); return false; } @@ -472,7 +472,7 @@ bool CGuild::WaitStartWar(DWORD dwOppGID) CGuild* g = CGuildManager::instance().FindGuild(dwOppGID); if (!g) { - sys_log(0 ,"GuildWar.WaitStartWar.NOT_EXIST_GUILD id(%u -> %u)", GetID(), dwOppGID); + SPDLOG_ERROR("GuildWar.WaitStartWar.NOT_EXIST_GUILD id({} -> {})", GetID(), dwOppGID); return false; } @@ -484,17 +484,17 @@ bool CGuild::WaitStartWar(DWORD dwOppGID) // ÇʵåÇüÀÌ¸é ¸Ê»ý¼º ¾ÈÇÔ if (gw.type == GUILD_WAR_TYPE_FIELD) { - sys_log(0 ,"GuildWar.WaitStartWar.FIELD_TYPE id(%u -> %u)", GetID(), dwOppGID); + SPDLOG_DEBUG("GuildWar.WaitStartWar.FIELD_TYPE id({} -> {})", GetID(), dwOppGID); return true; } // ÀüÀï ¼­¹ö ÀÎÁö È®ÀÎ - sys_log(0 ,"GuildWar.WaitStartWar.CheckWarServer id(%u -> %u), type(%d), map(%d)", + SPDLOG_DEBUG("GuildWar.WaitStartWar.CheckWarServer id({} -> {}), type({}), map({})", GetID(), dwOppGID, gw.type, rkGuildWarInfo.lMapIndex); if (!map_allow_find(rkGuildWarInfo.lMapIndex)) { - sys_log(0 ,"GuildWar.WaitStartWar.SKIP_WAR_MAP id(%u -> %u)", GetID(), dwOppGID); + SPDLOG_DEBUG("GuildWar.WaitStartWar.SKIP_WAR_MAP id({} -> {})", GetID(), dwOppGID); return true; } @@ -509,12 +509,12 @@ bool CGuild::WaitStartWar(DWORD dwOppGID) DWORD lMapIndex = CWarMapManager::instance().CreateWarMap(rkGuildWarInfo, id1, id2); if (!lMapIndex) { - sys_err("GuildWar.WaitStartWar.CREATE_WARMAP_ERROR id(%u vs %u), type(%u), map(%d)", id1, id2, gw.type, rkGuildWarInfo.lMapIndex); + SPDLOG_ERROR("GuildWar.WaitStartWar.CREATE_WARMAP_ERROR id({} vs {}), type({}), map({})", id1, id2, gw.type, rkGuildWarInfo.lMapIndex); CGuildManager::instance().RequestEndWar(GetID(), dwOppGID); return false; } - sys_log(0, "GuildWar.WaitStartWar.CreateMap id(%u vs %u), type(%u), map(%d) -> map_inst(%u)", id1, id2, gw.type, rkGuildWarInfo.lMapIndex, lMapIndex); + SPDLOG_DEBUG("GuildWar.WaitStartWar.CreateMap id({} vs {}), type({}), map({}) -> map_inst({})", id1, id2, gw.type, rkGuildWarInfo.lMapIndex, lMapIndex); //±æµåÀü Á¤º¸¿¡ ¸ÊÀ妽º¸¦ ¼¼Æà gw.map_index = lMapIndex; @@ -588,7 +588,7 @@ void CGuild::ReserveWar(DWORD dwOppGID, BYTE type) else it->second.state = GUILD_WAR_RESERVE; - sys_log(0, "Guild::ReserveWar %u", dwOppGID); + SPDLOG_DEBUG("Guild::ReserveWar {}", dwOppGID); } void CGuild::EndWar(DWORD dwOppGID) @@ -634,7 +634,7 @@ void CGuild::SetGuildWarMapIndex(DWORD dwOppGID, int lMapIndex) return; it->second.map_index = lMapIndex; - sys_log(0, "GuildWar.SetGuildWarMapIndex id(%d -> %d), map(%d)", GetID(), dwOppGID, lMapIndex); + SPDLOG_DEBUG("GuildWar.SetGuildWarMapIndex id({} -> {}), map({})", GetID(), dwOppGID, lMapIndex); } void CGuild::GuildWarEntryAccept(DWORD dwOppGID, LPCHARACTER ch) @@ -675,27 +675,27 @@ void CGuild::GuildWarEntryAsk(DWORD dwOppGID) itertype(m_EnemyGuild) git = m_EnemyGuild.find(dwOppGID); if (git == m_EnemyGuild.end()) { - sys_err("GuildWar.GuildWarEntryAsk.UNKNOWN_ENEMY(%d)", dwOppGID); + SPDLOG_ERROR("GuildWar.GuildWarEntryAsk.UNKNOWN_ENEMY({})", dwOppGID); return; } TGuildWar & gw(git->second); - sys_log(0, "GuildWar.GuildWarEntryAsk id(%d vs %d), map(%d)", GetID(), dwOppGID, gw.map_index); + SPDLOG_DEBUG("GuildWar.GuildWarEntryAsk id({} vs {}), map({})", GetID(), dwOppGID, gw.map_index); if (!gw.map_index) { - sys_err("GuildWar.GuildWarEntryAsk.NOT_EXIST_MAP id(%d vs %d)", GetID(), dwOppGID); + SPDLOG_ERROR("GuildWar.GuildWarEntryAsk.NOT_EXIST_MAP id({} vs {})", GetID(), dwOppGID); return; } PIXEL_POSITION pos; if (!CWarMapManager::instance().GetStartPosition(gw.map_index, GetID() < dwOppGID ? 0 : 1, pos)) { - sys_err("GuildWar.GuildWarEntryAsk.START_POSITION_ERROR id(%d vs %d), pos(%d, %d)", GetID(), dwOppGID, pos.x, pos.y); + SPDLOG_ERROR("GuildWar.GuildWarEntryAsk.START_POSITION_ERROR id({} vs {}), pos({}, {})", GetID(), dwOppGID, pos.x, pos.y); return; } - sys_log(0, "GuildWar.GuildWarEntryAsk.OnlineMemberCount(%d)", m_memberOnline.size()); + SPDLOG_DEBUG("GuildWar.GuildWarEntryAsk.OnlineMemberCount({})", m_memberOnline.size()); itertype(m_memberOnline) it = m_memberOnline.begin(); @@ -707,12 +707,12 @@ void CGuild::GuildWarEntryAsk(DWORD dwOppGID) unsigned int questIndex=CQuestManager::instance().GetQuestIndexByName("guild_war_join"); if (questIndex) { - sys_log(0, "GuildWar.GuildWarEntryAsk.SendLetterToMember pid(%d), qid(%d)", ch->GetPlayerID(), questIndex); + SPDLOG_DEBUG("GuildWar.GuildWarEntryAsk.SendLetterToMember pid({}), qid({})", ch->GetPlayerID(), questIndex); CQuestManager::instance().Letter(ch->GetPlayerID(), questIndex, 0); } else { - sys_err("GuildWar.GuildWarEntryAsk.SendLetterToMember.QUEST_ERROR pid(%d), quest_name('guild_war_join.quest')", + SPDLOG_ERROR("GuildWar.GuildWarEntryAsk.SendLetterToMember.QUEST_ERROR pid({}), quest_name('guild_war_join.quest')", ch->GetPlayerID(), questIndex); break; } diff --git a/src/game/src/horse_rider.cpp b/src/game/src/horse_rider.cpp index a2d0a71..aa3a6c5 100644 --- a/src/game/src/horse_rider.cpp +++ b/src/game/src/horse_rider.cpp @@ -223,7 +223,7 @@ EVENTFUNC(horse_stamina_consume_event) if ( info == NULL ) { - sys_err( "horse_stamina_consume_event> Null pointer" ); + SPDLOG_ERROR("horse_stamina_consume_event> Null pointer" ); return 0; } @@ -247,7 +247,7 @@ EVENTFUNC(horse_stamina_consume_event) } hr->CheckHorseHealthDropTime(); - sys_log(0, "HORSE STAMINA - %p", get_pointer(event)); + SPDLOG_DEBUG("HORSE STAMINA - {}", (void*) get_pointer(event)); return delta; } @@ -257,7 +257,7 @@ EVENTFUNC(horse_stamina_regen_event) if ( info == NULL ) { - sys_err( "horse_stamina_regen_event> Null pointer" ); + SPDLOG_ERROR("horse_stamina_regen_event> Null pointer" ); return 0; } @@ -278,7 +278,7 @@ EVENTFUNC(horse_stamina_regen_event) } hr->CheckHorseHealthDropTime(); - sys_log(0, "HORSE STAMINA + %p", get_pointer(event)); + SPDLOG_DEBUG("HORSE STAMINA + {}", (void*) get_pointer(event)); return delta; @@ -292,7 +292,7 @@ void CHorseRider::StartStaminaConsumeEvent() if (GetHorseHealth() <= 0) return; - sys_log(0,"HORSE STAMINA REGEN EVENT CANCEL %p", get_pointer(m_eventStaminaRegen)); + SPDLOG_DEBUG("HORSE STAMINA REGEN EVENT CANCEL {}", (void*) get_pointer(m_eventStaminaRegen)); event_cancel(&m_eventStaminaRegen); if (m_eventStaminaConsume) @@ -302,7 +302,7 @@ void CHorseRider::StartStaminaConsumeEvent() info->hr = this; m_eventStaminaConsume = event_create(horse_stamina_consume_event, info, PASSES_PER_SEC(HORSE_STAMINA_CONSUME_INTERVAL)); - sys_log(0,"HORSE STAMINA CONSUME EVENT CREATE %p", get_pointer(m_eventStaminaConsume)); + SPDLOG_DEBUG("HORSE STAMINA CONSUME EVENT CREATE {}", (void*) get_pointer(m_eventStaminaConsume)); } void CHorseRider::StartStaminaRegenEvent() @@ -313,7 +313,7 @@ void CHorseRider::StartStaminaRegenEvent() if (GetHorseHealth() <= 0) return; - sys_log(0,"HORSE STAMINA CONSUME EVENT CANCEL %p", get_pointer(m_eventStaminaConsume)); + SPDLOG_DEBUG("HORSE STAMINA CONSUME EVENT CANCEL {}", (void*) get_pointer(m_eventStaminaConsume)); event_cancel(&m_eventStaminaConsume); if (m_eventStaminaRegen) @@ -323,7 +323,7 @@ void CHorseRider::StartStaminaRegenEvent() info->hr = this; m_eventStaminaRegen = event_create(horse_stamina_regen_event, info, PASSES_PER_SEC(HORSE_STAMINA_REGEN_INTERVAL)); - sys_log(0,"HORSE STAMINA REGEN EVENT CREATE %p", get_pointer(m_eventStaminaRegen)); + SPDLOG_DEBUG("HORSE STAMINA REGEN EVENT CREATE {}", (void*) get_pointer(m_eventStaminaRegen)); } // Health @@ -358,7 +358,7 @@ void CHorseRider::UpdateHorseHealth(int iHealth, bool bSend) void CHorseRider::HorseDie() { - sys_log(0, "HORSE DIE %p %p", get_pointer(m_eventStaminaRegen), get_pointer(m_eventStaminaConsume)); + SPDLOG_DEBUG("HORSE DIE {} {}", (void*) get_pointer(m_eventStaminaRegen), (void*) get_pointer(m_eventStaminaConsume)); UpdateHorseStamina(-m_Horse.sStamina); event_cancel(&m_eventStaminaRegen); event_cancel(&m_eventStaminaConsume); diff --git a/src/game/src/horsename_manager.cpp b/src/game/src/horsename_manager.cpp index 63d8a28..9626044 100644 --- a/src/game/src/horsename_manager.cpp +++ b/src/game/src/horsename_manager.cpp @@ -32,11 +32,11 @@ void CHorseNameManager::UpdateHorseName(DWORD dwPlayerID, const char* szHorseNam { if ( szHorseName == NULL ) { - sys_err("HORSE_NAME: NULL NAME (%u)", dwPlayerID); + SPDLOG_ERROR("HORSE_NAME: NULL NAME ({})", dwPlayerID); szHorseName = ""; } - sys_log(0, "HORSENAME: update %u %s", dwPlayerID, szHorseName); + SPDLOG_DEBUG("HORSENAME: update {} {}", dwPlayerID, szHorseName); m_mapHorseNames[dwPlayerID] = szHorseName; diff --git a/src/game/src/input.cpp b/src/game/src/input.cpp index d9ecab5..36329c6 100644 --- a/src/game/src/input.cpp +++ b/src/game/src/input.cpp @@ -16,7 +16,6 @@ #include "TrafficProfiler.h" #include "priv_manager.h" #include "castle.h" -#include "dev_log.h" extern time_t get_global_time(); @@ -64,7 +63,7 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, if (!m_pPacketInfo) { - sys_err("No packet info has been binded to"); + SPDLOG_ERROR("No packet info has been binded to"); return true; } @@ -77,7 +76,7 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, iPacketLen = 1; else if (!m_pPacketInfo->Get(bHeader, &iPacketLen, &c_pszName)) { - sys_err("UNKNOWN HEADER: %d, LAST HEADER: %d(%d), REMAIN BYTES: %d", + SPDLOG_ERROR("UNKNOWN HEADER: {}, LAST HEADER: {}({}), REMAIN BYTES: {}", bHeader, bLastHeader, iLastPacketLen, m_iBufferLeft); //printdata((BYTE *) c_pvOrig, m_iBufferLeft); lpDesc->SetPhase(PHASE_CLOSE); @@ -89,9 +88,6 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, if (bHeader) { - if (test_server && bHeader != HEADER_CG_MOVE) - sys_log(0, "Packet Analyze [Header %d][bufferLeft %d] ", bHeader, m_iBufferLeft); - m_pPacketInfo->Start(); int iExtraPacketSize = Analyze(lpDesc, bHeader, c_pData); @@ -100,7 +96,6 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, return true; iPacketLen += iExtraPacketSize; - lpDesc->Log("%s %d", c_pszName, iPacketLen); m_pPacketInfo->End(); } @@ -110,7 +105,7 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, // END_OF_TRAFFIC_PROFILER if (bHeader == HEADER_CG_PONG) - sys_log(0, "PONG! %u %u", m_pPacketInfo->IsSequence(bHeader), *(BYTE *) (c_pData + iPacketLen - sizeof(BYTE))); + SPDLOG_TRACE("PONG! {} {}", m_pPacketInfo->IsSequence(bHeader), *(BYTE *) (c_pData + iPacketLen - sizeof(BYTE))); if (m_pPacketInfo->IsSequence(bHeader)) { @@ -119,7 +114,7 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, if (bSeq != bSeqReceived) { - sys_err("SEQUENCE %x mismatch 0x%x != 0x%x header %u", get_pointer(lpDesc), bSeq, bSeqReceived, bHeader); + SPDLOG_ERROR("SEQUENCE {} mismatch {:#x} != {:#x} header {}", (void*) get_pointer(lpDesc), bSeq, bSeqReceived, bHeader); LPCHARACTER ch = lpDesc->GetCharacter(); @@ -144,7 +139,7 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, } snprintf(buf + offset, sizeof(buf) - offset, "\t[%03d : 0x%x]\n", bHeader, bSeq); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); lpDesc->SetPhase(PHASE_CLOSE); return true; @@ -153,7 +148,7 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, { lpDesc->push_seq(bHeader, bSeq); lpDesc->SetNextSequence(); - sys_err("SEQUENCE %x match %u next %u header %u", lpDesc, bSeq, lpDesc->GetSequence(), bHeader); + SPDLOG_TRACE("SEQUENCE {} match {} next {} header {}", (void*) lpDesc, bSeq, lpDesc->GetSequence(), bHeader); } } @@ -182,7 +177,7 @@ void CInputProcessor::Handshake(LPDESC d, const char * c_pData) if (d->GetHandshake() != p->dwHandshake) { - sys_err("Invalid Handshake"); + SPDLOG_ERROR("Invalid Handshake"); d->SetPhase(PHASE_CLOSE); } else @@ -208,7 +203,7 @@ void CInputProcessor::Version(LPCHARACTER ch, const char* c_pData) return; TPacketCGClientVersion * p = (TPacketCGClientVersion *) c_pData; - sys_log(0, "VERSION: %s %s %s", ch->GetName(), p->timestamp, p->filename); + SPDLOG_DEBUG("VERSION: {} {} {}", ch->GetName(), p->timestamp, p->filename); ch->GetDesc()->SetClientVersion(p->timestamp); } @@ -272,7 +267,7 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) std::string stBuf; stBuf.assign(c_pData, 0, c_pSep - c_pData); - sys_log(0, "SOCKET_CMD: FROM(%s) CMD(%s)", d->GetHostName(), stBuf.c_str()); + SPDLOG_DEBUG("SOCKET_CMD: FROM({}) CMD({})", d->GetHostName(), stBuf.c_str()); if (!stBuf.compare("IS_SERVER_UP")) { @@ -366,7 +361,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) TPacketDeleteAwardID p; p.dwID = (DWORD)(atoi(msg.c_str())); snprintf(szTmp,sizeof(szTmp),"Sent to DB cache to delete ItemAward, id: %d",p.dwID); - //sys_log(0,"%d",p.dwID); // strlcpy(p.login, msg.c_str(), sizeof(p.login)); db_clientdesc->DBPacket(HEADER_GD_DELETE_AWARDID, 0, &p, sizeof(p)); stResult += szTmp; @@ -390,20 +384,20 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) TPacketGGShutdown p; p.bHeader = HEADER_GG_SHUTDOWN; P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown)); - sys_err("Accept shutdown command from %s.", d->GetHostName()); + SPDLOG_ERROR("Accept shutdown command from {}.", d->GetHostName()); Shutdown(10); } else if (!stBuf.compare("SHUTDOWN_ONLY")) { LogManager::instance().CharLog(0, 0, 0, 2, "SHUTDOWN", "", d->GetHostName()); - sys_err("Accept shutdown only command from %s.", d->GetHostName()); + SPDLOG_ERROR("Accept shutdown only command from {}.", d->GetHostName()); Shutdown(10); } else if (!stBuf.compare(0, 3, "DC ")) { std::string msg = stBuf.substr(3, LOGIN_MAX_LEN); -dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); + SPDLOG_TRACE("DC : '{}'", msg.c_str()); TPacketGGDisconnect pgg; @@ -471,7 +465,7 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); case 'a': db_clientdesc->DBPacket(HEADER_GD_RELOAD_ADMIN, 0, NULL, 0); - sys_log(0, "Reloading admin infomation."); + SPDLOG_INFO("Reloading admin infomation."); break; } } @@ -485,7 +479,7 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); if (!is.fail()) { - sys_log(0, "EXTERNAL EVENT FLAG name %s value %d", strFlagName.c_str(), lValue); + SPDLOG_DEBUG("EXTERNAL EVENT FLAG name {} value {}", strFlagName.c_str(), lValue); quest::CQuestManager::instance().RequestSetEventFlag(strFlagName, lValue); stResult = "EVENT FLAG CHANGE "; stResult += strFlagName; @@ -505,7 +499,7 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); if (!is.fail()) { - sys_log(0, "EXTERNAL BLOCK_CHAT name %s duration %d", strCharName.c_str(), lDuration); + SPDLOG_DEBUG("EXTERNAL BLOCK_CHAT name {} duration {}", strCharName.c_str(), lDuration); do_block_chat(NULL, const_cast(stBuf.c_str() + 11), 0, 0); @@ -543,7 +537,7 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); // ½Ã°£ ´ÜÀ§·Î º¯°æ duration = duration * (60 * 60); - sys_log(0, "_give_empire_privileage(empire=%d, type=%d, value=%d, duration=%d) by web", + SPDLOG_DEBUG("_give_empire_privileage(empire={}, type={}, value={}, duration={}) by web", empire, type, value, duration); CPrivManager::instance().RequestGiveEmpirePriv(empire, type, value, duration); } @@ -559,14 +553,14 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); is >> dummy_string >> cmd >> login_string; - sys_log(0, "block_exception %s:%d", login_string.c_str(), cmd); + SPDLOG_DEBUG("block_exception {}:{}", login_string.c_str(), cmd); DBManager::instance().RequestBlockException(login_string.c_str(), cmd); stResult = "BLOCK_EXCEPTION_YES"; } } } - sys_log(1, "TEXT %s RESULT %s", stBuf.c_str(), stResult.c_str()); + SPDLOG_DEBUG("TEXT {} RESULT {}", stBuf.c_str(), stResult.c_str()); stResult += "\n"; d->Packet(stResult.c_str(), stResult.length()); return (c_pSep - c_pData) + 1; @@ -576,13 +570,13 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); if (!guild_mark_server) { // ²÷¾î¹ö·Á! - ¸¶Å© ¼­¹ö°¡ ¾Æ´Ñµ¥ ¸¶Å©¸¦ ¿äûÇÏ·Á°í? - sys_err("Guild Mark login requested but i'm not a mark server!"); + SPDLOG_ERROR("Guild Mark login requested but i'm not a mark server!"); d->SetPhase(PHASE_CLOSE); return 0; } // ¹«Á¶°Ç ÀÎÁõ --; - sys_log(0, "MARK_SERVER: Login"); + SPDLOG_DEBUG("MARK_SERVER: Login"); d->SetPhase(PHASE_LOGIN); return 0; } @@ -599,7 +593,7 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str()); else if (bHeader == HEADER_CG_HANDSHAKE) Handshake(d, c_pData); else - sys_err("Handshake phase does not handle packet %d", bHeader); + SPDLOG_ERROR("Handshake phase does not handle packet {}", bHeader); return 0; } diff --git a/src/game/src/input_auth.cpp b/src/game/src/input_auth.cpp index a728c19..aa7b5b7 100644 --- a/src/game/src/input_auth.cpp +++ b/src/game/src/input_auth.cpp @@ -106,7 +106,7 @@ void CInputAuth::Login(LPDESC d, const char * c_pData) if (!g_bAuthServer) { - sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.", d->GetHostName()); + SPDLOG_ERROR("CInputAuth class is not for game server. IP {} might be a hacker.", d->GetHostName()); d->DelayedDisconnect(5); return; } @@ -118,14 +118,14 @@ void CInputAuth::Login(LPDESC d, const char * c_pData) char passwd[PASSWD_MAX_LEN + 1]; strlcpy(passwd, pinfo->passwd, sizeof(passwd)); - sys_log(0, "InputAuth::Login : %s(%d) desc %p", - login, strlen(login), get_pointer(d)); + SPDLOG_DEBUG("InputAuth::Login : {}({}) desc {}", + login, strlen(login), (void*) get_pointer(d)); // check login string if (false == FN_IS_VALID_LOGIN_STRING(login)) { - sys_log(0, "InputAuth::Login : IS_NOT_VALID_LOGIN_STRING(%s) desc %p", - login, get_pointer(d)); + SPDLOG_DEBUG("InputAuth::Login : IS_NOT_VALID_LOGIN_STRING({}) desc {}", + login, (void*) get_pointer(d)); LoginFailure(d, "NOID"); return; } @@ -151,7 +151,7 @@ void CInputAuth::Login(LPDESC d, const char * c_pData) DWORD dwPanamaKey = dwKey ^ pinfo->adwClientKey[0] ^ pinfo->adwClientKey[1] ^ pinfo->adwClientKey[2] ^ pinfo->adwClientKey[3]; d->SetPanamaKey(dwPanamaKey); - sys_log(0, "InputAuth::Login : key %u:0x%x login %s", dwKey, dwPanamaKey, login); + SPDLOG_DEBUG("InputAuth::Login : key {}:{} login {}", dwKey, dwPanamaKey, login); TPacketCGLogin3 * p = M2_NEW TPacketCGLogin3; memcpy(p, pinfo, sizeof(TPacketCGLogin3)); @@ -165,7 +165,7 @@ void CInputAuth::Login(LPDESC d, const char * c_pData) // CHANNEL_SERVICE_LOGIN if (Login_IsInChannelService(szLogin)) { - sys_log(0, "ChannelServiceLogin [%s]", szLogin); + SPDLOG_DEBUG("ChannelServiceLogin [{}]", szLogin); DBManager::instance().ReturnQuery(QID_AUTH_LOGIN, dwKey, p, "SELECT '%s',password,securitycode,social_id,id,status,availDt - NOW() > 0," @@ -204,15 +204,14 @@ int CInputAuth::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) if (!g_bAuthServer) { - sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.", d->GetHostName()); + SPDLOG_ERROR("CInputAuth class is not for game server. IP {} might be a hacker.", d->GetHostName()); d->DelayedDisconnect(5); return 0; } int iExtraLen = 0; - if (test_server) - sys_log(0, " InputAuth Analyze Header[%d] ", bHeader); + SPDLOG_TRACE(" InputAuth Analyze Header[{}] ", bHeader); switch (bHeader) { @@ -228,7 +227,7 @@ int CInputAuth::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) break; default: - sys_err("This phase does not handle this header %d (0x%x)(phase: AUTH)", bHeader, bHeader); + SPDLOG_ERROR("This phase does not handle this header {} (0x{})(phase: AUTH)", bHeader, bHeader); break; } diff --git a/src/game/src/input_db.cpp b/src/game/src/input_db.cpp index 57ef9f2..a50047a 100644 --- a/src/game/src/input_db.cpp +++ b/src/game/src/input_db.cpp @@ -35,7 +35,6 @@ #include "block_country.h" #include "motion.h" -#include "dev_log.h" #include "log.h" @@ -78,7 +77,7 @@ bool GetServerLocation(TAccountTable & rTab, BYTE bEmpire) rTab.players[i].lAddr, rTab.players[i].wPort)) { - sys_err("location error name %s mapindex %d %d x %d empire %d", + SPDLOG_ERROR("location error name {} mapindex {} {} x {} empire {}", rTab.players[i].szName, lIndex, rTab.players[i].x, rTab.players[i].y, rTab.bEmpire); rTab.players[i].x = EMPIRE_START_X(rTab.bEmpire); @@ -88,7 +87,7 @@ bool GetServerLocation(TAccountTable & rTab, BYTE bEmpire) if (!CMapLocation::instance().Get(rTab.players[i].x, rTab.players[i].y, lIndex, rTab.players[i].lAddr, rTab.players[i].wPort)) { - sys_err("cannot find server for mapindex %d %d x %d (name %s)", + SPDLOG_ERROR("cannot find server for mapindex {} {} x {} (name {})", lIndex, rTab.players[i].x, rTab.players[i].y, @@ -100,7 +99,7 @@ bool GetServerLocation(TAccountTable & rTab, BYTE bEmpire) struct in_addr in; in.s_addr = rTab.players[i].lAddr; - sys_log(0, "success to %s:%d", inet_ntoa(in), rTab.players[i].wPort); + SPDLOG_DEBUG("success to {}:{}", inet_ntoa(in), rTab.players[i].wPort); } return bFound; @@ -111,14 +110,14 @@ extern std::map g_simByPID; void CInputDB::LoginSuccess(DWORD dwHandle, const char *data) { - sys_log(0, "LoginSuccess"); + SPDLOG_DEBUG("LoginSuccess"); TAccountTable * pTab = (TAccountTable *) data; itertype(g_sim) it = g_sim.find(pTab->id); if (g_sim.end() != it) { - sys_log(0, "CInputDB::LoginSuccess - already exist sim [%s]", pTab->login); + SPDLOG_ERROR("CInputDB::LoginSuccess - already exist sim [{}]", pTab->login); it->second->SendLoad(); return; } @@ -127,7 +126,7 @@ void CInputDB::LoginSuccess(DWORD dwHandle, const char *data) if (!d) { - sys_log(0, "CInputDB::LoginSuccess - cannot find handle [%s]", pTab->login); + SPDLOG_ERROR("CInputDB::LoginSuccess - cannot find handle [{}]", pTab->login); TLogoutPacket pack; @@ -138,7 +137,7 @@ void CInputDB::LoginSuccess(DWORD dwHandle, const char *data) if (strcmp(pTab->status, "OK")) // OK°¡ ¾Æ´Ï¸é { - sys_log(0, "CInputDB::LoginSuccess - status[%s] is not OK [%s]", pTab->status, pTab->login); + SPDLOG_DEBUG("CInputDB::LoginSuccess - status[{}] is not OK [{}]", pTab->status, pTab->login); TLogoutPacket pack; @@ -152,7 +151,7 @@ void CInputDB::LoginSuccess(DWORD dwHandle, const char *data) for (int i = 0; i != PLAYER_PER_ACCOUNT; ++i) { TSimplePlayer& player = pTab->players[i]; - sys_log(0, "\tplayer(%s).job(%d)", player.szName, player.byJob); + SPDLOG_DEBUG("\tplayer({}).job({})", player.szName, player.byJob); } bool bFound = GetServerLocation(*pTab, pTab->bEmpire); @@ -177,7 +176,7 @@ void CInputDB::LoginSuccess(DWORD dwHandle, const char *data) d->SetPhase(PHASE_SELECT); d->SendLoginSuccessPacket(); - sys_log(0, "InputDB::login_success: %s", pTab->login); + SPDLOG_DEBUG("InputDB::login_success: {}", pTab->login); } void CInputDB::PlayerCreateFailure(LPDESC d, BYTE bType) @@ -214,7 +213,7 @@ void CInputDB::PlayerCreateSuccess(LPDESC d, const char * data) pPacketDB->player.lAddr, pPacketDB->player.wPort)) { - sys_err("InputDB::PlayerCreateSuccess: cannot find server for mapindex %d %d x %d (name %s)", + SPDLOG_ERROR("InputDB::PlayerCreateSuccess: cannot find server for mapindex {} {} x {} (name {})", lIndex, pPacketDB->player.x, pPacketDB->player.y, @@ -370,7 +369,7 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data) // by rtsummit if (!SECTREE_MANAGER::instance().GetValidLocation(pTab->lMapIndex, pTab->x, pTab->y, lMapIndex, pos, d->GetEmpire())) { - sys_err("InputDB::PlayerLoad : cannot find valid location %d x %d (name: %s)", pTab->x, pTab->y, pTab->name); + SPDLOG_ERROR("InputDB::PlayerLoad : cannot find valid location {} x {} (name: {})", pTab->x, pTab->y, pTab->name); d->SetPhase(PHASE_CLOSE); return; } @@ -382,13 +381,13 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data) if (d->GetCharacter() || d->IsPhase(PHASE_GAME)) { LPCHARACTER p = d->GetCharacter(); - sys_err("login state already has main state (character %s %p)", p->GetName(), get_pointer(p)); + SPDLOG_ERROR("login state already has main state (character {} {})", p->GetName(), (void*) get_pointer(p)); return; } if (NULL != CHARACTER_MANAGER::Instance().FindPC(pTab->name)) { - sys_err("InputDB: PlayerLoad : %s already exist in game", pTab->name); + SPDLOG_ERROR("InputDB: PlayerLoad : {} already exist in game", pTab->name); return; } @@ -444,7 +443,7 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data) //if (!map_allow_find(lMapIndex >= 10000 ? lMapIndex / 10000 : lMapIndex) || !CheckEmpire(ch, lMapIndex)) if (!map_allow_find(lPublicMapIndex)) { - sys_err("InputDB::PlayerLoad : entering %d map is not allowed here (name: %s, empire %u)", + SPDLOG_ERROR("InputDB::PlayerLoad : entering {} map is not allowed here (name: {}, empire {})", lMapIndex, pTab->name, d->GetEmpire()); ch->SetWarpLocation(EMPIRE_START_MAP(d->GetEmpire()), @@ -463,7 +462,7 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data) ch->PointsPacket(); ch->SkillLevelPacket(); - sys_log(0, "InputDB: player_load %s %dx%dx%d LEVEL %d MOV_SPEED %d JOB %d ATG %d DFG %d GMLv %d", + SPDLOG_DEBUG("InputDB: player_load {} {}x{}x{} LEVEL {} MOV_SPEED {} JOB {} ATG {} DFG {} GMLv {}", pTab->name, ch->GetX(), ch->GetY(), ch->GetZ(), ch->GetLevel(), @@ -488,27 +487,27 @@ void CInputDB::Boot(const char* data) BYTE bVersion = decode_byte(data); data += 1; - sys_log(0, "BOOT: PACKET: %d", dwPacketSize); - sys_log(0, "BOOT: VERSION: %d", bVersion); + SPDLOG_INFO("BOOT: PACKET: {}", dwPacketSize); + SPDLOG_INFO("BOOT: VERSION: {}", bVersion); if (bVersion != 6) { - sys_err("boot version error"); + SPDLOG_ERROR("boot version error"); thecore_shutdown(); } - sys_log(0, "sizeof(TMobTable) = %d", sizeof(TMobTable)); - sys_log(0, "sizeof(TItemTable) = %d", sizeof(TItemTable)); - sys_log(0, "sizeof(TShopTable) = %d", sizeof(TShopTable)); - sys_log(0, "sizeof(TSkillTable) = %d", sizeof(TSkillTable)); - sys_log(0, "sizeof(TRefineTable) = %d", sizeof(TRefineTable)); - sys_log(0, "sizeof(TItemAttrTable) = %d", sizeof(TItemAttrTable)); - sys_log(0, "sizeof(TItemRareTable) = %d", sizeof(TItemAttrTable)); - sys_log(0, "sizeof(TBanwordTable) = %d", sizeof(TBanwordTable)); - sys_log(0, "sizeof(TLand) = %d", sizeof(building::TLand)); - sys_log(0, "sizeof(TObjectProto) = %d", sizeof(building::TObjectProto)); - sys_log(0, "sizeof(TObject) = %d", sizeof(building::TObject)); + SPDLOG_DEBUG("sizeof(TMobTable) = {}", sizeof(TMobTable)); + SPDLOG_DEBUG("sizeof(TItemTable) = {}", sizeof(TItemTable)); + SPDLOG_DEBUG("sizeof(TShopTable) = {}", sizeof(TShopTable)); + SPDLOG_DEBUG("sizeof(TSkillTable) = {}", sizeof(TSkillTable)); + SPDLOG_DEBUG("sizeof(TRefineTable) = {}", sizeof(TRefineTable)); + SPDLOG_DEBUG("sizeof(TItemAttrTable) = {}", sizeof(TItemAttrTable)); + SPDLOG_DEBUG("sizeof(TItemRareTable) = {}", sizeof(TItemAttrTable)); + SPDLOG_DEBUG("sizeof(TBanwordTable) = {}", sizeof(TBanwordTable)); + SPDLOG_DEBUG("sizeof(TLand) = {}", sizeof(building::TLand)); + SPDLOG_DEBUG("sizeof(TObjectProto) = {}", sizeof(building::TObjectProto)); + SPDLOG_DEBUG("sizeof(TObject) = {}", sizeof(building::TObject)); //ADMIN_MANAGER - sys_log(0, "sizeof(TAdminManager) = %d", sizeof (TAdminInfo) ); + SPDLOG_DEBUG("sizeof(TAdminManager) = {}", sizeof (TAdminInfo) ); //END_ADMIN_MANAGER WORD size; @@ -519,7 +518,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data)!=sizeof(TMobTable)) { - sys_err("mob table size error"); + SPDLOG_ERROR("mob table size error"); thecore_shutdown(); return; } @@ -527,7 +526,7 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: MOB: %d", size); + SPDLOG_DEBUG("BOOT: MOB: {}", size); if (size) { @@ -541,7 +540,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TItemTable)) { - sys_err("item table size error"); + SPDLOG_ERROR("item table size error"); thecore_shutdown(); return; } @@ -549,7 +548,7 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: ITEM: %d", size); + SPDLOG_DEBUG("BOOT: ITEM: {}", size); if (size) @@ -564,7 +563,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TShopTable)) { - sys_err("shop table size error"); + SPDLOG_ERROR("shop table size error"); thecore_shutdown(); return; } @@ -572,14 +571,14 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: SHOP: %d", size); + SPDLOG_DEBUG("BOOT: SHOP: {}", size); if (size) { if (!CShopManager::instance().Initialize((TShopTable *) data, size)) { - sys_err("shop table Initialize error"); + SPDLOG_ERROR("shop table Initialize error"); thecore_shutdown(); return; } @@ -592,7 +591,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TSkillTable)) { - sys_err("skill table size error"); + SPDLOG_ERROR("skill table size error"); thecore_shutdown(); return; } @@ -600,13 +599,13 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: SKILL: %d", size); + SPDLOG_DEBUG("BOOT: SKILL: {}", size); if (size) { if (!CSkillManager::instance().Initialize((TSkillTable *) data, size)) { - sys_err("cannot initialize skill table"); + SPDLOG_ERROR("cannot initialize skill table"); thecore_shutdown(); return; } @@ -618,7 +617,7 @@ void CInputDB::Boot(const char* data) */ if (decode_2bytes(data) != sizeof(TRefineTable)) { - sys_err("refine table size error"); + SPDLOG_ERROR("refine table size error"); thecore_shutdown(); return; } @@ -626,7 +625,7 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: REFINE: %d", size); + SPDLOG_DEBUG("BOOT: REFINE: {}", size); if (size) { @@ -639,7 +638,7 @@ void CInputDB::Boot(const char* data) */ if (decode_2bytes(data) != sizeof(TItemAttrTable)) { - sys_err("item attr table size error"); + SPDLOG_ERROR("item attr table size error"); thecore_shutdown(); return; } @@ -647,7 +646,7 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: ITEM_ATTR: %d", size); + SPDLOG_DEBUG("BOOT: ITEM_ATTR: {}", size); if (size) { @@ -659,7 +658,7 @@ void CInputDB::Boot(const char* data) continue; g_map_itemAttr[p->dwApplyIndex] = *p; - sys_log(0, "ITEM_ATTR[%d]: %s %u", p->dwApplyIndex, p->szApply, p->dwProb); + SPDLOG_DEBUG("ITEM_ATTR[{}]: {} {}", p->dwApplyIndex, p->szApply, p->dwProb); } } @@ -671,7 +670,7 @@ void CInputDB::Boot(const char* data) */ if (decode_2bytes(data) != sizeof(TItemAttrTable)) { - sys_err("item rare table size error"); + SPDLOG_ERROR("item rare table size error"); thecore_shutdown(); return; } @@ -679,7 +678,7 @@ void CInputDB::Boot(const char* data) size = decode_2bytes(data); data += 2; - sys_log(0, "BOOT: ITEM_RARE: %d", size); + SPDLOG_DEBUG("BOOT: ITEM_RARE: {}", size); if (size) { @@ -691,7 +690,7 @@ void CInputDB::Boot(const char* data) continue; g_map_itemRare[p->dwApplyIndex] = *p; - sys_log(0, "ITEM_RARE[%d]: %s %u", p->dwApplyIndex, p->szApply, p->dwProb); + SPDLOG_DEBUG("ITEM_RARE[{}]: {} {}", p->dwApplyIndex, p->szApply, p->dwProb); } } @@ -704,7 +703,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TBanwordTable)) { - sys_err("ban word table size error"); + SPDLOG_ERROR("ban word table size error"); thecore_shutdown(); return; } @@ -725,7 +724,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TLand)) { - sys_err("land table size error"); + SPDLOG_ERROR("land table size error"); thecore_shutdown(); return; } @@ -746,7 +745,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TObjectProto)) { - sys_err("object proto table size error"); + SPDLOG_ERROR("object proto table size error"); thecore_shutdown(); return; } @@ -763,7 +762,7 @@ void CInputDB::Boot(const char* data) */ if (decode_2bytes(data) != sizeof(TObject)) { - sys_err("object table size error"); + SPDLOG_ERROR("object table size error"); thecore_shutdown(); return; } @@ -787,7 +786,7 @@ void CInputDB::Boot(const char* data) if (decode_2bytes(data) != sizeof(TItemIDRangeTable) ) { - sys_err("ITEM ID RANGE size error"); + SPDLOG_ERROR("ITEM ID RANGE size error"); thecore_shutdown(); return; } @@ -808,11 +807,11 @@ void CInputDB::Boot(const char* data) data += 2; int HostSize = decode_2bytes(data ); data += 2; - sys_log(0, "GM Value Count %d %d", HostSize, ChunkSize ); + SPDLOG_INFO("GM Value Count {} {}", HostSize, ChunkSize ); for (int n = 0; n < HostSize; ++n ) { gm_new_host_inert(data ); - sys_log(0, "GM HOST : IP[%s] ", data ); + SPDLOG_INFO("GM HOST : IP[{}] ", data ); data += ChunkSize; } @@ -844,7 +843,7 @@ void CInputDB::Boot(const char* data) for (int n = 1; n < 4; ++n) { if (p.name[n] && *p.name[n]) - sys_log(0, "[MONARCH] Empire %d Pid %d Money %d %s", n, p.pid[n], p.money[n], p.name[n]); + SPDLOG_DEBUG("[MONARCH] Empire {} Pid {} Money {} {}", n, p.pid[n], p.money[n], p.name[n]); } int CandidacySize = decode_2bytes(data); @@ -853,8 +852,7 @@ void CInputDB::Boot(const char* data) int CandidacyCount = decode_2bytes(data); data += 2; - if (test_server) - sys_log (0, "[MONARCH] Size %d Count %d", CandidacySize, CandidacyCount); + SPDLOG_TRACE("[MONARCH] Size {} Count {}", CandidacySize, CandidacyCount); data += CandidacySize * CandidacyCount; @@ -864,24 +862,24 @@ void CInputDB::Boot(const char* data) WORD endCheck=decode_2bytes(data); if (endCheck != 0xffff) { - sys_err("boot packet end check error [%x]!=0xffff", endCheck); + SPDLOG_CRITICAL("boot packet end check error [{}]!=0xffff", endCheck); thecore_shutdown(); return; } else - sys_log(0, "boot packet end check ok [%x]==0xffff", endCheck ); + SPDLOG_DEBUG("boot packet end check ok [{}]==0xffff", endCheck ); data +=2; if (!ITEM_MANAGER::instance().SetMaxItemID(*range)) { - sys_err("not enough item id contact your administrator!"); + SPDLOG_CRITICAL("not enough item id contact your administrator!"); thecore_shutdown(); return; } if (!ITEM_MANAGER::instance().SetMaxSpareItemID(*rangespare)) { - sys_err("not enough item id for spare contact your administrator!"); + SPDLOG_CRITICAL("not enough item id for spare contact your administrator!"); thecore_shutdown(); return; } @@ -916,72 +914,72 @@ void CInputDB::Boot(const char* data) snprintf(szDragonSoulTableFileName, sizeof(szDragonSoulTableFileName), "%s/dragon_soul_table.txt", LocaleService_GetBasePath().c_str()); - sys_log(0, "Initializing Informations of Cube System"); + SPDLOG_DEBUG("Initializing Informations of Cube System"); if (!Cube_InformationInitialize()) { - sys_err("cannot init cube infomation."); + SPDLOG_ERROR("cannot init cube infomation."); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: CommonDropItem: %s", szCommonDropItemFileName); + SPDLOG_DEBUG("LoadLocaleFile: CommonDropItem: {}", szCommonDropItemFileName); if (!ITEM_MANAGER::instance().ReadCommonDropItemFile(szCommonDropItemFileName)) { - sys_err("cannot load CommonDropItem: %s", szCommonDropItemFileName); + SPDLOG_ERROR("cannot load CommonDropItem: {}", szCommonDropItemFileName); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: ETCDropItem: %s", szETCDropItemFileName); + SPDLOG_DEBUG("LoadLocaleFile: ETCDropItem: {}", szETCDropItemFileName); if (!ITEM_MANAGER::instance().ReadEtcDropItemFile(szETCDropItemFileName)) { - sys_err("cannot load ETCDropItem: %s", szETCDropItemFileName); + SPDLOG_ERROR("cannot load ETCDropItem: {}", szETCDropItemFileName); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: DropItemGroup: %s", szDropItemGroupFileName); + SPDLOG_DEBUG("LoadLocaleFile: DropItemGroup: {}", szDropItemGroupFileName); if (!ITEM_MANAGER::instance().ReadDropItemGroup(szDropItemGroupFileName)) { - sys_err("cannot load DropItemGroup: %s", szDropItemGroupFileName); + SPDLOG_ERROR("cannot load DropItemGroup: {}", szDropItemGroupFileName); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: SpecialItemGroup: %s", szSpecialItemGroupFileName); + SPDLOG_DEBUG("LoadLocaleFile: SpecialItemGroup: {}", szSpecialItemGroupFileName); if (!ITEM_MANAGER::instance().ReadSpecialDropItemFile(szSpecialItemGroupFileName)) { - sys_err("cannot load SpecialItemGroup: %s", szSpecialItemGroupFileName); + SPDLOG_ERROR("cannot load SpecialItemGroup: {}", szSpecialItemGroupFileName); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: ItemVnumMaskTable : %s", szItemVnumMaskTableFileName); + SPDLOG_DEBUG("LoadLocaleFile: ItemVnumMaskTable : {}", szItemVnumMaskTableFileName); if (!ITEM_MANAGER::instance().ReadItemVnumMaskTable(szItemVnumMaskTableFileName)) { - sys_log(0, "Could not open MaskItemTable"); + SPDLOG_ERROR("Could not open MaskItemTable"); } - sys_log(0, "LoadLocaleFile: MOBDropItemFile: %s", szMOBDropItemFileName); + SPDLOG_DEBUG("LoadLocaleFile: MOBDropItemFile: {}", szMOBDropItemFileName); if (!ITEM_MANAGER::instance().ReadMonsterDropItemGroup(szMOBDropItemFileName)) { - sys_err("cannot load MOBDropItemFile: %s", szMOBDropItemFileName); + SPDLOG_ERROR("cannot load MOBDropItemFile: {}", szMOBDropItemFileName); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: MapIndex: %s", szMapIndexFileName); + SPDLOG_DEBUG("LoadLocaleFile: MapIndex: {}", szMapIndexFileName); if (!SECTREE_MANAGER::instance().Build(szMapIndexFileName, LocaleService_GetMapPath().c_str())) { - sys_err("cannot load MapIndex: %s", szMapIndexFileName); + SPDLOG_ERROR("cannot load MapIndex: {}", szMapIndexFileName); thecore_shutdown(); return; } - sys_log(0, "LoadLocaleFile: DragonSoulTable: %s", szDragonSoulTableFileName); + SPDLOG_DEBUG("LoadLocaleFile: DragonSoulTable: {}", szDragonSoulTableFileName); if (!DSManager::instance().ReadDragonSoulTableFile(szDragonSoulTableFileName)) { - sys_err("cannot load DragonSoulTable: %s", szDragonSoulTableFileName); + SPDLOG_ERROR("cannot load DragonSoulTable: {}", szDragonSoulTableFileName); //thecore_shutdown(); //return; } @@ -1008,7 +1006,7 @@ void CInputDB::Boot(const char* data) // request blocked_country_ip { db_clientdesc->DBPacket(HEADER_GD_BLOCK_COUNTRY_IP, 0, NULL, 0); - dev_log(LOG_DEB0, ""); + SPDLOG_TRACE(""); } } @@ -1028,7 +1026,7 @@ EVENTFUNC(quest_login_event) if ( info == NULL ) { - sys_err( "quest_login_event> Null pointer" ); + SPDLOG_ERROR("quest_login_event> Null pointer" ); return 0; } @@ -1058,13 +1056,13 @@ EVENTFUNC(quest_login_event) } else if (d->IsPhase(PHASE_GAME)) { - sys_log(0, "QUEST_LOAD: Login pc %d by event", ch->GetPlayerID()); + SPDLOG_DEBUG("QUEST_LOAD: Login pc {} by event", ch->GetPlayerID()); quest::CQuestManager::instance().Login(ch->GetPlayerID()); return 0; } else { - sys_err(0, "input_db.cpp:quest_login_event INVALID PHASE pid %d", ch->GetPlayerID()); + SPDLOG_ERROR("input_db.cpp:quest_login_event INVALID PHASE pid {}", ch->GetPlayerID()); return 0; } } @@ -1089,18 +1087,18 @@ void CInputDB::QuestLoad(LPDESC d, const char * c_pData) { if (ch->GetPlayerID() != pQuestTable[0].dwPID) { - sys_err("PID differs %u %u", ch->GetPlayerID(), pQuestTable[0].dwPID); + SPDLOG_ERROR("PID differs {} {}", ch->GetPlayerID(), pQuestTable[0].dwPID); return; } } - sys_log(0, "QUEST_LOAD: count %d", dwCount); + SPDLOG_DEBUG("QUEST_LOAD: count {}", dwCount); quest::PC * pkPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID()); if (!pkPC) { - sys_err("null quest::PC with id %u", pQuestTable[0].dwPID); + SPDLOG_ERROR("null quest::PC with id {}", pQuestTable[0].dwPID); return; } @@ -1114,7 +1112,7 @@ void CInputDB::QuestLoad(LPDESC d, const char * c_pData) st += "."; st += pQuestTable[i].szState; - sys_log(0, " %s %d", st.c_str(), pQuestTable[i].lValue); + SPDLOG_DEBUG(" {} {}", st.c_str(), pQuestTable[i].lValue); pkPC->SetFlag(st.c_str(), pQuestTable[i].lValue, false); } @@ -1123,7 +1121,7 @@ void CInputDB::QuestLoad(LPDESC d, const char * c_pData) if (ch->GetDesc()->IsPhase(PHASE_GAME)) { - sys_log(0, "QUEST_LOAD: Login pc %d", pQuestTable[0].dwPID); + SPDLOG_DEBUG("QUEST_LOAD: Login pc {}", pQuestTable[0].dwPID); quest::CQuestManager::instance().Login(pQuestTable[0].dwPID); } else @@ -1145,7 +1143,7 @@ void CInputDB::SafeboxLoad(LPDESC d, const char * c_pData) if (d->GetAccountTable().id != p->dwID) { - sys_err("SafeboxLoad: safebox has different id %u != %u", d->GetAccountTable().id, p->dwID); + SPDLOG_ERROR("SafeboxLoad: safebox has different id {} != {}", d->GetAccountTable().id, p->dwID); return; } @@ -1237,7 +1235,7 @@ void CInputDB::MallLoad(LPDESC d, const char * c_pData) if (d->GetAccountTable().id != p->dwID) { - sys_err("safebox has different id %u != %u", d->GetAccountTable().id, p->dwID); + SPDLOG_ERROR("safebox has different id {} != {}", d->GetAccountTable().id, p->dwID); return; } @@ -1277,7 +1275,7 @@ void CInputDB::LoginAlready(LPDESC d, const char * c_pData) void CInputDB::EmpireSelect(LPDESC d, const char * c_pData) { - sys_log(0, "EmpireSelect %p", get_pointer(d)); + SPDLOG_DEBUG("EmpireSelect {}", (void*) get_pointer(d)); if (!d) return; @@ -1306,7 +1304,7 @@ void CInputDB::MapLocations(const char * c_pData) { BYTE bCount = *(BYTE *) (c_pData++); - sys_log(0, "InputDB::MapLocations %d", bCount); + SPDLOG_DEBUG("InputDB::MapLocations {}", bCount); TMapLocation * pLoc = (TMapLocation *) c_pData; @@ -1336,7 +1334,7 @@ void CInputDB::P2P(const char * c_pData) if (false == DESC_MANAGER::instance().IsP2PDescExist(p->szHost, p->wPort)) { LPCLIENT_DESC pkDesc = NULL; - sys_log(0, "InputDB:P2P %s:%u", p->szHost, p->wPort); + SPDLOG_DEBUG("InputDB:P2P {}:{}", p->szHost, p->wPort); pkDesc = DESC_MANAGER::instance().CreateConnectionDesc(ev_base, dns_base, p->szHost, p->wPort, PHASE_P2P, false); mgr.RegisterConnector(pkDesc); pkDesc->SetP2P(p->wPort, p->bChannel); @@ -1365,7 +1363,7 @@ void CInputDB::GuildWar(const char* c_pData) { TPacketGuildWar * p = (TPacketGuildWar*) c_pData; - sys_log(0, "InputDB::GuildWar %u %u state %d", p->dwGuildFrom, p->dwGuildTo, p->bWar); + SPDLOG_DEBUG("InputDB::GuildWar {} {} state {}", p->dwGuildFrom, p->dwGuildTo, p->bWar); switch (p->bWar) { @@ -1403,7 +1401,7 @@ void CInputDB::GuildWar(const char* c_pData) break; default: - sys_err("Unknown guild war state"); + SPDLOG_ERROR("Unknown guild war state"); break; } } @@ -1423,7 +1421,7 @@ void CInputDB::GuildSkillRecharge() void CInputDB::GuildExpUpdate(const char* c_pData) { TPacketGuildSkillUpdate * p = (TPacketGuildSkillUpdate *) c_pData; - sys_log(1, "GuildExpUpdate %d", p->amount); + SPDLOG_DEBUG("GuildExpUpdate {}", p->amount); CGuild * g = CGuildManager::instance().TouchGuild(p->guild_id); @@ -1460,7 +1458,7 @@ void CInputDB::GuildChangeGrade(const char* c_pData) void CInputDB::GuildChangeMemberData(const char* c_pData) { - sys_log(0, "Recv GuildChangeMemberData"); + SPDLOG_DEBUG("Recv GuildChangeMemberData"); TPacketGuildChangeMemberData * p = (TPacketGuildChangeMemberData *) c_pData; CGuild * g = CGuildManager::instance().TouchGuild(p->guild_id); @@ -1477,7 +1475,7 @@ void CInputDB::GuildDisband(const char* c_pData) void CInputDB::GuildLadder(const char* c_pData) { TPacketGuildLadder* p = (TPacketGuildLadder*) c_pData; - sys_log(0, "Recv GuildLadder %u %d / w %d d %d l %d", p->dwGuild, p->lLadderPoint, p->lWin, p->lDraw, p->lLoss); + SPDLOG_DEBUG("Recv GuildLadder {} {} / w {} d {} l {}", p->dwGuild, p->lLadderPoint, p->lWin, p->lDraw, p->lLoss); CGuild * g = CGuildManager::instance().TouchGuild(p->dwGuild); g->SetLadderPoint(p->lLadderPoint); @@ -1497,7 +1495,7 @@ void CInputDB::ItemLoad(LPDESC d, const char * c_pData) DWORD dwCount = decode_4bytes(c_pData); c_pData += sizeof(DWORD); - sys_log(0, "ITEM_LOAD: COUNT %s %u", ch->GetName(), dwCount); + SPDLOG_INFO("ITEM_LOAD: COUNT {} {}", ch->GetName(), dwCount); std::vector v; @@ -1509,7 +1507,7 @@ void CInputDB::ItemLoad(LPDESC d, const char * c_pData) if (!item) { - sys_err("cannot create item by vnum %u (name %s id %u)", p->vnum, ch->GetName(), p->id); + SPDLOG_ERROR("cannot create item by vnum {} (name {} id {})", p->vnum, ch->GetName(), p->id); continue; } @@ -1520,7 +1518,7 @@ void CInputDB::ItemLoad(LPDESC d, const char * c_pData) if ((p->window == INVENTORY && ch->GetInventoryItem(p->pos)) || (p->window == EQUIPMENT && ch->GetWear(p->pos))) { - sys_log(0, "ITEM_RESTORE: %s %s", ch->GetName(), item->GetName()); + SPDLOG_INFO("ITEM_RESTORE: {} {}", ch->GetName(), item->GetName()); v.push_back(item); } else @@ -1549,7 +1547,7 @@ void CInputDB::ItemLoad(LPDESC d, const char * c_pData) } if (false == item->OnAfterCreatedItem()) - sys_err("Failed to call ITEM::OnAfterCreatedItem (vnum: %d, id: %d)", item->GetVnum(), item->GetID()); + SPDLOG_ERROR("Failed to call ITEM::OnAfterCreatedItem (vnum: {}, id: {})", item->GetVnum(), item->GetID()); item->SetSkipSave(false); } @@ -1684,7 +1682,7 @@ void CInputDB::ReloadProto(const char * c_pData) */ wSize = decode_2bytes(c_pData); c_pData += 2; - sys_log(0, "RELOAD: ITEM: %d", wSize); + SPDLOG_INFO("RELOAD: ITEM: {}", wSize); if (wSize) { @@ -1697,7 +1695,7 @@ void CInputDB::ReloadProto(const char * c_pData) */ wSize = decode_2bytes(c_pData); c_pData += 2; - sys_log(0, "RELOAD: MOB: %d", wSize); + SPDLOG_INFO("RELOAD: MOB: {}", wSize); if (wSize) { @@ -1751,7 +1749,7 @@ void CInputDB::AuthLogin(LPDESC d, const char * c_pData) ptoc.bResult = bResult; d->Packet(&ptoc, sizeof(TPacketGCAuthSuccess)); - sys_log(0, "AuthLogin result %u key %u", bResult, d->GetLoginKey()); + SPDLOG_INFO("AuthLogin result {} key {}", bResult, d->GetLoginKey()); } void CInputDB::ChangeEmpirePriv(const char* c_pData) @@ -1858,7 +1856,7 @@ void CInputDB::BillingRepair(const char * c_pData) pkLD->SetLogin(p->szLogin); pkLD->SetIP(p->szHost); - sys_log(0, "BILLING: REPAIR %s host %s", p->szLogin, p->szHost); + SPDLOG_INFO("BILLING: REPAIR {} host {}", p->szLogin, p->szHost); } } @@ -1876,7 +1874,7 @@ void CInputDB::BillingExpire(const char * c_pData) if (p->dwRemainSeconds <= 60) { int i = std::max(5, p->dwRemainSeconds); - sys_log(0, "BILLING_EXPIRE: %s %u", p->szLogin, p->dwRemainSeconds); + SPDLOG_INFO("BILLING_EXPIRE: {} {}", p->szLogin, p->dwRemainSeconds); d->DelayedDisconnect(i); } else @@ -1919,7 +1917,7 @@ void CInputDB::BillingCheck(const char * c_pData) DWORD dwKey = *(DWORD *) c_pData; c_pData += sizeof(DWORD); - sys_log(0, "BILLING: NOT_LOGIN %u", dwKey); + SPDLOG_INFO("BILLING: NOT_LOGIN {}", dwKey); DBManager::instance().SetBilling(dwKey, 0, true); } } @@ -1931,7 +1929,7 @@ void CInputDB::Notice(const char * c_pData) char szBuf[256+1]; strlcpy(szBuf, c_pData, sizeof(szBuf)); - sys_log(0, "InputDB:: Notice: %s", szBuf); + SPDLOG_INFO("InputDB:: Notice: {}", szBuf); //SendNotice(LC_TEXT(szBuf)); SendNotice(szBuf); @@ -1941,12 +1939,12 @@ void CInputDB::VCard(const char * c_pData) { TPacketGDVCard * p = (TPacketGDVCard *) c_pData; - sys_log(0, "VCARD: %u %s %s %s %s", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount); + 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) { - sys_log(0, "VCARD_FAIL: no data"); + SPDLOG_ERROR("VCARD_FAIL: no data"); return; } @@ -1954,13 +1952,13 @@ void CInputDB::VCard(const char * c_pData) if (strcmp(row[0], p->szSellAccount)) { - sys_log(0, "VCARD_FAIL: sell account differ %s", row[0]); + SPDLOG_ERROR("VCARD_FAIL: sell account differ {}", row[0]); return; } if (!row[1] || *row[1]) { - sys_log(0, "VCARD_FAIL: buy account already exist"); + SPDLOG_ERROR("VCARD_FAIL: buy account already exist"); return; } @@ -1969,7 +1967,7 @@ void CInputDB::VCard(const char * c_pData) if (!row[2] || time < 0) { - sys_log(0, "VCARD_FAIL: time null"); + SPDLOG_ERROR("VCARD_FAIL: time null"); return; } @@ -1977,7 +1975,7 @@ void CInputDB::VCard(const char * c_pData) if (pmsg1->Get()->uiAffectedRows == 0 || pmsg1->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "VCARD_FAIL: cannot modify GameTime table"); + SPDLOG_ERROR("VCARD_FAIL: cannot modify GameTime table"); return; } @@ -1985,11 +1983,11 @@ void CInputDB::VCard(const char * c_pData) if (pmsg2->Get()->uiAffectedRows == 0 || pmsg2->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "VCARD_FAIL: cannot modify vcard table"); + SPDLOG_ERROR("VCARD_FAIL: cannot modify vcard table"); return; } - sys_log(0, "VCARD_SUCCESS: %s %s", p->szBuyAccount, p->szBuyCharacter); + SPDLOG_DEBUG("VCARD_SUCCESS: {} {}", p->szBuyAccount, p->szBuyCharacter); } void CInputDB::GuildWarReserveAdd(TGuildWarReserve * p) @@ -2009,19 +2007,19 @@ void CInputDB::GuildWarBet(TPacketGDGuildWarBet * p) void CInputDB::MarriageAdd(TPacketMarriageAdd * p) { - sys_log(0, "MarriageAdd %u %u %u %s %s", p->dwPID1, p->dwPID2, (DWORD)p->tMarryTime, p->szName1, p->szName2); + SPDLOG_DEBUG("MarriageAdd {} {} {} {} {}", p->dwPID1, p->dwPID2, (DWORD)p->tMarryTime, p->szName1, p->szName2); marriage::CManager::instance().Add(p->dwPID1, p->dwPID2, p->tMarryTime, p->szName1, p->szName2); } void CInputDB::MarriageUpdate(TPacketMarriageUpdate * p) { - sys_log(0, "MarriageUpdate %u %u %d %d", p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); + SPDLOG_DEBUG("MarriageUpdate {} {} {} {}", p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); marriage::CManager::instance().Update(p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); } void CInputDB::MarriageRemove(TPacketMarriageRemove * p) { - sys_log(0, "MarriageRemove %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("MarriageRemove {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().Remove(p->dwPID1, p->dwPID2); } @@ -2032,19 +2030,19 @@ void CInputDB::WeddingRequest(TPacketWeddingRequest* p) void CInputDB::WeddingReady(TPacketWeddingReady* p) { - sys_log(0, "WeddingReady %u %u %u", p->dwPID1, p->dwPID2, p->dwMapIndex); + SPDLOG_DEBUG("WeddingReady {} {} {}", p->dwPID1, p->dwPID2, p->dwMapIndex); marriage::CManager::instance().WeddingReady(p->dwPID1, p->dwPID2, p->dwMapIndex); } void CInputDB::WeddingStart(TPacketWeddingStart* p) { - sys_log(0, "WeddingStart %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingStart {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().WeddingStart(p->dwPID1, p->dwPID2); } void CInputDB::WeddingEnd(TPacketWeddingEnd* p) { - sys_log(0, "WeddingEnd %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingEnd {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().WeddingEnd(p->dwPID1, p->dwPID2); } @@ -2056,8 +2054,8 @@ void CInputDB::MyshopPricelistRes(LPDESC d, const TPacketMyshopPricelistHeader* if (!d || !(ch = d->GetCharacter()) ) return; - sys_log(0, "RecvMyshopPricelistRes name[%s]", ch->GetName()); - ch->UseSilkBotaryReal(p ); + SPDLOG_DEBUG("RecvMyshopPricelistRes name[{}]", ch->GetName()); + ch->UseSilkBotaryReal(p); } // END_OF_MYSHOP_PRICE_LIST @@ -2150,11 +2148,9 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) break; case HEADER_DG_PLAYER_LOAD_FAILED: - //sys_log(0, "PLAYER_LOAD_FAILED"); break; case HEADER_DG_PLAYER_DELETE_FAILED: - //sys_log(0, "PLAYER_DELETE_FAILED"); PlayerDeleteFail(DESC_MANAGER::instance().FindByHandle(m_dwHandle)); break; @@ -2490,7 +2486,7 @@ bool CInputDB::Process(LPDESC d, const void * orig, int bytes, int & r_iBytesPro m_dwHandle = *((DWORD *) (c_pData + 1)); // 4 iSize = *((DWORD *) (c_pData + 5)); // 4 - sys_log(1, "DBCLIENT: header %d handle %d size %d bytes %d", bHeader, m_dwHandle, iSize, bytes); + SPDLOG_TRACE("DBCLIENT: header {} handle {} size {} bytes {}", bHeader, m_dwHandle, iSize, bytes); if (m_iBufferLeft - 9 < iSize) return true; @@ -2499,7 +2495,7 @@ bool CInputDB::Process(LPDESC d, const void * orig, int bytes, int & r_iBytesPro if (Analyze(d, bHeader, pRealData) < 0) { - sys_err("in InputDB: UNKNOWN HEADER: %d, LAST HEADER: %d(%d), REMAIN BYTES: %d", + SPDLOG_ERROR("in InputDB: UNKNOWN HEADER: {}, LAST HEADER: {}({}), REMAIN BYTES: {}", bHeader, bLastHeader, iLastPacketLen, m_iBufferLeft); //printdata((BYTE*) orig, bytes); @@ -2589,7 +2585,7 @@ void CInputDB::ChangeMonarchLord(TPacketChangeMonarchLordACK* info) void CInputDB::UpdateMonarchInfo(TMonarchInfo* info) { CMonarch::instance().SetMonarchInfo(info); - sys_log(0, "MONARCH INFO UPDATED"); + SPDLOG_INFO("MONARCH INFO UPDATED"); } void CInputDB::AddBlockCountryIp(TPacketBlockCountryIp * data) diff --git a/src/game/src/input_login.cpp b/src/game/src/input_login.cpp index 2db0b38..d9a600a 100644 --- a/src/game/src/input_login.cpp +++ b/src/game/src/input_login.cpp @@ -26,7 +26,6 @@ #include "OXEvent.h" #include "priv_manager.h" #include "block_country.h" -#include "dev_log.h" #include "log.h" #include "horsename_manager.h" #include "MarkManager.h" @@ -89,7 +88,7 @@ void CInputLogin::Login(LPDESC d, const char * data) char login[LOGIN_MAX_LEN + 1]; trim_and_lower(pinfo->login, login, sizeof(login)); - sys_log(0, "InputLogin::Login : %s", login); + SPDLOG_DEBUG("InputLogin::Login : {}", login); TPacketGCLoginFailure failurePacket; @@ -143,16 +142,16 @@ void CInputLogin::LoginByKey(LPDESC d, const char * data) // is blocked ip? { - dev_log(LOG_DEB0, "check_blocked_country_start"); + SPDLOG_TRACE("check_blocked_country_start"); if (!is_block_exception(login) && is_blocked_country_ip(d->GetHostName())) { - sys_log(0, "BLOCK_COUNTRY_IP (%s)", d->GetHostName()); + SPDLOG_DEBUG("BLOCK_COUNTRY_IP ({})", d->GetHostName()); d->SetPhase(PHASE_CLOSE); return; } - dev_log(LOG_DEB0, "check_blocked_country_end"); + SPDLOG_TRACE("check_blocked_country_end"); } if (g_bNoMoreClient) @@ -185,7 +184,7 @@ void CInputLogin::LoginByKey(LPDESC d, const char * data) } } - sys_log(0, "LOGIN_BY_KEY: %s key %u", login, pinfo->dwLoginKey); + SPDLOG_DEBUG("LOGIN_BY_KEY: {} key {}", login, pinfo->dwLoginKey); d->SetLoginKey(pinfo->dwLoginKey); @@ -206,7 +205,7 @@ void CInputLogin::ChangeName(LPDESC d, const char * data) if (!c_r.id) { - sys_err("no account table"); + SPDLOG_ERROR("no account table"); return; } @@ -234,23 +233,23 @@ void CInputLogin::CharacterSelect(LPDESC d, const char * data) struct command_player_select * pinfo = (struct command_player_select *) data; const TAccountTable & c_r = d->GetAccountTable(); - sys_log(0, "player_select: login: %s index: %d", c_r.login, pinfo->index); + SPDLOG_DEBUG("player_select: login: {} index: {}", c_r.login, pinfo->index); if (!c_r.id) { - sys_err("no account table"); + SPDLOG_ERROR("no account table"); return; } if (pinfo->index >= PLAYER_PER_ACCOUNT) { - sys_err("index overflow %d, login: %s", pinfo->index, c_r.login); + SPDLOG_ERROR("index overflow {}, login: {}", pinfo->index, c_r.login); return; } if (c_r.players[pinfo->index].bChangeName) { - sys_err("name must be changed idx %d, login %s, name %s", + SPDLOG_ERROR("name must be changed idx {}, login {}, name {}", pinfo->index, c_r.login, c_r.players[pinfo->index].szName); return; } @@ -379,7 +378,7 @@ bool NewPlayerTable2(TPlayerTable * table, const char * name, BYTE race, BYTE sh { if (race >= MAIN_RACE_MAX_NUM) { - sys_err("NewPlayerTable2.OUT_OF_RACE_RANGE(%d >= max(%d))\n", race, MAIN_RACE_MAX_NUM); + SPDLOG_ERROR("NewPlayerTable2.OUT_OF_RACE_RANGE({} >= max({}))", race, (int) MAIN_RACE_MAX_NUM); return false; } @@ -387,11 +386,11 @@ bool NewPlayerTable2(TPlayerTable * table, const char * name, BYTE race, BYTE sh if (!RaceToJob(race, &job)) { - sys_err("NewPlayerTable2.RACE_TO_JOB_ERROR(%d)\n", race); + SPDLOG_ERROR("NewPlayerTable2.RACE_TO_JOB_ERROR({})", race); return false; } - sys_log(0, "NewPlayerTable2(name=%s, race=%d, job=%d)", name, race, job); + SPDLOG_DEBUG("NewPlayerTable2(name={}, race={}, job={})", name, race, job); memset(table, 0, sizeof(TPlayerTable)); @@ -428,7 +427,7 @@ void CInputLogin::CharacterCreate(LPDESC d, const char * data) struct command_player_create * pinfo = (struct command_player_create *) data; TPlayerCreatePacket player_create_packet; - sys_log(0, "PlayerCreate: name %s pos %d job %d shape %d", + SPDLOG_DEBUG("PlayerCreate: name {} pos {} job {} shape {}", pinfo->name, pinfo->index, pinfo->job, @@ -480,7 +479,7 @@ void CInputLogin::CharacterCreate(LPDESC d, const char * data) if (!NewPlayerTable2(&player_create_packet.player_table, pinfo->name, pinfo->job, pinfo->shape, d->GetEmpire())) { - sys_err("player_prototype error: job %d face %d ", pinfo->job); + SPDLOG_ERROR("player_prototype error: job {} face {} ", pinfo->job); d->Packet(&packFailure, sizeof(packFailure)); return; } @@ -493,7 +492,7 @@ void CInputLogin::CharacterCreate(LPDESC d, const char * data) player_create_packet.account_id = c_rAccountTable.id; player_create_packet.account_index = pinfo->index; - sys_log(0, "PlayerCreate: name %s account_id %d, TPlayerCreatePacketSize(%d), Packet->Gold %d", + SPDLOG_DEBUG("PlayerCreate: name {} account_id {}, TPlayerCreatePacketSize({}), Packet->Gold {}", pinfo->name, pinfo->index, sizeof(TPlayerCreatePacket), @@ -509,21 +508,21 @@ void CInputLogin::CharacterDelete(LPDESC d, const char * data) if (!c_rAccountTable.id) { - sys_err("PlayerDelete: no login data"); + SPDLOG_ERROR("PlayerDelete: no login data"); return; } - sys_log(0, "PlayerDelete: login: %s index: %d, social_id %s", c_rAccountTable.login, pinfo->index, pinfo->private_code); + SPDLOG_DEBUG("PlayerDelete: login: {} index: {}, social_id {}", c_rAccountTable.login, pinfo->index, pinfo->private_code); if (pinfo->index >= PLAYER_PER_ACCOUNT) { - sys_err("PlayerDelete: index overflow %d, login: %s", pinfo->index, c_rAccountTable.login); + SPDLOG_ERROR("PlayerDelete: index overflow {}, login: {}", pinfo->index, c_rAccountTable.login); return; } if (!c_rAccountTable.players[pinfo->index].dwID) { - sys_err("PlayerDelete: Wrong Social ID index %d, login: %s", pinfo->index, c_rAccountTable.login); + SPDLOG_ERROR("PlayerDelete: Wrong Social ID index {}, login: {}", pinfo->index, c_rAccountTable.login); d->Packet(encode_byte(HEADER_GC_CHARACTER_DELETE_WRONG_SOCIAL_ID), 1); return; } @@ -564,7 +563,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) PIXEL_POSITION pos2; SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos2); - sys_err("!GetMovablePosition (name %s %dx%d map %d changed to %dx%d)", + SPDLOG_ERROR("!GetMovablePosition (name {} {}x{} map {} changed to {}x{})", ch->GetName(), pos.x, pos.y, ch->GetMapIndex(), @@ -585,7 +584,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) if(ch->GetItemAward_cmd()) //°ÔÀÓÆäÀÌÁî µé¾î°¡¸é quest::CQuestManager::instance().ItemInformer(ch->GetPlayerID(),ch->GetItemAward_vnum()); //questmanager È£Ãâ - sys_log(0, "ENTERGAME: %s %dx%dx%d %s map_index %d", + SPDLOG_DEBUG("ENTERGAME: {} {}x{}x{} {} map_index {}", ch->GetName(), ch->GetX(), ch->GetY(), ch->GetZ(), d->GetHostName(), ch->GetMapIndex()); if (ch->GetHorseLevel() > 0) @@ -635,7 +634,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) continue; ch->AddAffect(AFFECT_PREMIUM_START + i, POINT_NONE, 0, 0, remain, 0, true); - sys_log(0, "PREMIUM: %s type %d %dmin", ch->GetName(), i, remain); + SPDLOG_DEBUG("PREMIUM: {} type {} {}min", ch->GetName(), i, remain); } if (LC_IsEurope()) @@ -645,7 +644,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) int version = atoi(g_stClientVersion.c_str()); int date = atoi(d->GetClientVersion()); - sys_log(0, "VERSION CHECK %d %d %s %s", version, date, g_stClientVersion.c_str(), d->GetClientVersion()); + SPDLOG_DEBUG("VERSION CHECK {} {} {} {}", version, date, g_stClientVersion.c_str(), d->GetClientVersion()); if (!d->GetClientVersion()) { @@ -660,7 +659,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) d->DelayedDisconnect(10); LogManager::instance().HackLog("VERSION_CONFLICT", ch); - sys_log(0, "VERSION : WRONG VERSION USER : account:%s name:%s hostName:%s server_version:%s client_version:%s", + SPDLOG_WARN("VERSION : WRONG VERSION USER : account:{} name:{} hostName:{} server_version:{} client_version:{}", d->GetAccountTable().login, ch->GetName(), d->GetHostName(), @@ -671,12 +670,12 @@ void CInputLogin::Entergame(LPDESC d, const char * data) } else { - sys_log(0, "VERSION : NO CHECK"); + SPDLOG_WARN("VERSION : NO CHECK"); } } else { - sys_log(0, "VERSION : NO LOGIN"); + SPDLOG_WARN("VERSION : NO LOGIN"); } if (LC_IsEurope() == true) @@ -704,7 +703,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) ch->SetArenaObserverMode(true); if (CArenaManager::instance().RegisterObserverPtr(ch, ch->GetMapIndex(), ch->GetX()/100, ch->GetY()/100)) { - sys_log(0, "ARENA : Observer add failed"); + SPDLOG_ERROR("ARENA : Observer add failed"); } if (ch->IsHorseRiding() == true) @@ -780,7 +779,7 @@ void CInputLogin::Entergame(LPDESC d, const char * data) p.id = d->GetAccountTable().id; g_TeenDesc->Packet(&p, sizeof(p)); - sys_log(0, "TEEN_SEND: (%u, %s)", d->GetAccountTable().id, ch->GetName()); + SPDLOG_DEBUG("TEEN_SEND: ({}, {})", d->GetAccountTable().id, ch->GetName()); } if (ch->GetHorseLevel() > 0) @@ -821,7 +820,7 @@ void CInputLogin::Empire(LPDESC d, const char * c_pData) { if (0 != r.players[i].dwID) { - sys_err("EmpireSelectFailed %d", r.players[i].dwID); + SPDLOG_ERROR("EmpireSelectFailed {}", r.players[i].dwID); return; } } @@ -840,7 +839,7 @@ int CInputLogin::GuildSymbolUpload(LPDESC d, const char* c_pData, size_t uiBytes if (uiBytes < sizeof(TPacketCGGuildSymbolUpload)) return -1; - sys_log(0, "GuildSymbolUpload uiBytes %u", uiBytes); + SPDLOG_DEBUG("GuildSymbolUpload uiBytes {}", uiBytes); TPacketCGGuildSymbolUpload* p = (TPacketCGGuildSymbolUpload*) c_pData; @@ -865,7 +864,7 @@ int CInputLogin::GuildSymbolUpload(LPDESC d, const char* c_pData, size_t uiBytes return 0; } - sys_log(0, "GuildSymbolUpload Do Upload %02X%02X%02X%02X %d", c_pData[7], c_pData[8], c_pData[9], c_pData[10], sizeof(*p)); + SPDLOG_DEBUG("GuildSymbolUpload Do Upload {:02X}{:02X}{:02X}{:02X} {}", c_pData[7], c_pData[8], c_pData[9], c_pData[10], sizeof(*p)); CGuildMarkManager::instance().UploadSymbol(p->guild_id, iSymbolSize, (const BYTE*)(c_pData + sizeof(*p))); CGuildMarkManager::instance().SaveSymbol(GUILD_SYMBOL_FILENAME); @@ -876,14 +875,14 @@ void CInputLogin::GuildSymbolCRC(LPDESC d, const char* c_pData) { const TPacketCGSymbolCRC & CGPacket = *((TPacketCGSymbolCRC *) c_pData); - sys_log(0, "GuildSymbolCRC %u %u %u", CGPacket.guild_id, CGPacket.crc, CGPacket.size); + SPDLOG_DEBUG("GuildSymbolCRC {} {} {}", CGPacket.guild_id, CGPacket.crc, CGPacket.size); const CGuildMarkManager::TGuildSymbol * pkGS = CGuildMarkManager::instance().GetGuildSymbol(CGPacket.guild_id); if (!pkGS) return; - sys_log(0, " Server %u %u", pkGS->crc, pkGS->raw.size()); + SPDLOG_DEBUG(" Server {} {}", pkGS->crc, pkGS->raw.size()); if (pkGS->raw.size() != CGPacket.size || pkGS->crc != CGPacket.crc) { @@ -896,7 +895,7 @@ void CInputLogin::GuildSymbolCRC(LPDESC d, const char* c_pData) d->RawPacket(&GCPacket, sizeof(GCPacket)); d->Packet(&pkGS->raw[0], pkGS->raw.size()); - sys_log(0, "SendGuildSymbolHead %02X%02X%02X%02X Size %d", + SPDLOG_DEBUG("SendGuildSymbolHead {:02X}{:02X}{:02X}{:02X} Size {}", pkGS->raw[0], pkGS->raw[1], pkGS->raw[2], pkGS->raw[3], pkGS->raw.size()); } } @@ -909,19 +908,19 @@ void CInputLogin::GuildMarkUpload(LPDESC d, const char* c_pData) if (!(pkGuild = rkGuildMgr.FindGuild(p->gid))) { - sys_err("MARK_SERVER: GuildMarkUpload: no guild. gid %u", p->gid); + SPDLOG_ERROR("MARK_SERVER: GuildMarkUpload: no guild. gid {}", p->gid); return; } if (pkGuild->GetLevel() < guild_mark_min_level) { - sys_log(0, "MARK_SERVER: GuildMarkUpload: level < %u (%u)", guild_mark_min_level, pkGuild->GetLevel()); + SPDLOG_DEBUG("MARK_SERVER: GuildMarkUpload: level < {} ({})", guild_mark_min_level, pkGuild->GetLevel()); return; } CGuildMarkManager & rkMarkMgr = CGuildMarkManager::instance(); - sys_log(0, "MARK_SERVER: GuildMarkUpload: gid %u", p->gid); + SPDLOG_DEBUG("MARK_SERVER: GuildMarkUpload: gid {}", p->gid); bool isEmpty = true; @@ -962,7 +961,7 @@ void CInputLogin::GuildMarkIDXList(LPDESC d, const char* c_pData) else d->Packet(&p, sizeof(p)); - sys_log(0, "MARK_SERVER: GuildMarkIDXList %d bytes sent.", p.bufSize); + SPDLOG_DEBUG("MARK_SERVER: GuildMarkIDXList {} bytes sent.", p.bufSize); } void CInputLogin::GuildMarkCRCList(LPDESC d, const char* c_pData) @@ -994,7 +993,7 @@ void CInputLogin::GuildMarkCRCList(LPDESC d, const char* c_pData) pGC.bufSize = buf.size() + sizeof(TPacketGCMarkBlock); pGC.count = blockCount; - sys_log(0, "MARK_SERVER: Sending blocks. (imgIdx %u diff %u size %u)", pCG->imgIdx, mapDiffBlocks.size(), pGC.bufSize); + SPDLOG_DEBUG("MARK_SERVER: Sending blocks. (imgIdx {} diff {} size {})", pCG->imgIdx, mapDiffBlocks.size(), pGC.bufSize); if (buf.size() > 0) { @@ -1091,7 +1090,7 @@ int CInputLogin::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) break; default: - sys_err("login phase does not handle this packet! header %d", bHeader); + SPDLOG_ERROR("login phase does not handle this packet! header {}", bHeader); //d->SetPhase(PHASE_CLOSE); return (0); } diff --git a/src/game/src/input_main.cpp b/src/game/src/input_main.cpp index 98e9878..5ca4e06 100644 --- a/src/game/src/input_main.cpp +++ b/src/game/src/input_main.cpp @@ -95,7 +95,7 @@ EVENTFUNC(block_chat_by_ip_event) if ( info == NULL ) { - sys_err( "block_chat_by_ip_event> Null pointer" ); + SPDLOG_ERROR("block_chat_by_ip_event> Null pointer" ); return 0; } @@ -138,7 +138,7 @@ bool SpamBlockCheck(LPCHARACTER ch, const char* const buf, const size_t buflen) it->second.first += score; if (word) - sys_log(0, "SPAM_SCORE: %s text: %s score: %u total: %u word: %s", ch->GetName(), buf, score, it->second.first, word); + SPDLOG_DEBUG("SPAM_SCORE: {} text: {} score: {} total: {} word: {}", ch->GetName(), buf, score, it->second.first, word); extern unsigned int g_uiSpamBlockScore; extern unsigned int g_uiSpamBlockDuration; @@ -149,7 +149,7 @@ bool SpamBlockCheck(LPCHARACTER ch, const char* const buf, const size_t buflen) strlcpy(info->host, ch->GetDesc()->GetHostName(), sizeof(info->host)); it->second.second = event_create(block_chat_by_ip_event, info, PASSES_PER_SEC(g_uiSpamBlockDuration)); - sys_log(0, "SPAM_IP: %s for %u seconds", info->host, g_uiSpamBlockDuration); + SPDLOG_DEBUG("SPAM_IP: {} for {} seconds", info->host, g_uiSpamBlockDuration); LogManager::instance().CharLog(ch, 0, "SPAM", word); @@ -288,7 +288,7 @@ int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes) if (iExtraLen < 0) { - sys_err("invalid packet length (len %d size %u buffer %u)", iExtraLen, pinfo->wSize, uiBytes); + SPDLOG_ERROR("invalid packet length (len {} size {} buffer {})", iExtraLen, pinfo->wSize, uiBytes); ch->GetDesc()->SetPhase(PHASE_CLOSE); return -1; } @@ -311,9 +311,9 @@ int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes) if (test_server) { if (!pkChr) - sys_log(0, "Whisper to %s(%s) from %s", "Null", pinfo->szNameTo, ch->GetName()); + SPDLOG_DEBUG("Whisper to {}({}) from {}", "Null", pinfo->szNameTo, ch->GetName()); else - sys_log(0, "Whisper to %s(%s) from %s", pkChr->GetName(), pinfo->szNameTo, ch->GetName()); + SPDLOG_DEBUG("Whisper to {}({}) from {}", pkChr->GetName(), pinfo->szNameTo, ch->GetName()); } if (ch->IsBlockMode(BLOCK_WHISPER)) @@ -340,8 +340,7 @@ int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes) pkDesc->SetRelay(pinfo->szNameTo); bOpponentEmpire = pkCCI->bEmpire; - if (test_server) - sys_log(0, "Whisper to %s from %s (Channel %d Mapindex %d)", "Null", ch->GetName(), pkCCI->bChannel, pkCCI->lMapIndex); + SPDLOG_TRACE("Whisper to {} from {} (Channel {} Mapindex {})", "Null", ch->GetName(), pkCCI->bChannel, pkCCI->lMapIndex); } } else @@ -361,7 +360,7 @@ int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes) pack.wSize = sizeof(TPacketGCWhisper); strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom)); ch->GetDesc()->Packet(&pack, sizeof(TPacketGCWhisper)); - sys_log(0, "WHISPER: no player"); + SPDLOG_DEBUG("WHISPER: no player"); } } else @@ -467,7 +466,7 @@ int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes) ch->GetDesc()->RawPacket(&pack, sizeof(pack)); ch->GetDesc()->Packet(buf, len); - sys_log(0, "WHISPER: not enough %s: char: %s", pTable->szLocaleName, ch->GetName()); + SPDLOG_DEBUG("WHISPER: not enough {}: char: {}", pTable->szLocaleName, ch->GetName()); } } @@ -499,7 +498,7 @@ int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes) if (LC_IsEurope() != true) { - sys_log(0, "WHISPER: %s -> %s : %s", ch->GetName(), pinfo->szNameTo, buf); + SPDLOG_DEBUG("WHISPER: {} -> {} : {}", ch->GetName(), pinfo->szNameTo, buf); } } } @@ -648,7 +647,7 @@ int CInputMain::Chat(LPCHARACTER ch, const char * data, size_t uiBytes) if (iExtraLen < 0) { - sys_err("invalid packet length (len %d size %u buffer %u)", iExtraLen, pinfo->size, uiBytes); + SPDLOG_ERROR("invalid packet length (len {} size {} buffer {})", iExtraLen, pinfo->size, uiBytes); ch->GetDesc()->SetPhase(PHASE_CLOSE); return -1; } @@ -667,7 +666,7 @@ int CInputMain::Chat(LPCHARACTER ch, const char * data, size_t uiBytes) { if (ch->GetChatCounter() == 10) { - sys_log(0, "CHAT_HACK: %s", ch->GetName()); + SPDLOG_WARN("CHAT_HACK: {}", ch->GetName()); ch->GetDesc()->DelayedDisconnect(5); } @@ -814,7 +813,7 @@ int CInputMain::Chat(LPCHARACTER ch, const char * data, size_t uiBytes) break; default: - sys_err("Unknown chat type %d", pinfo->type); + SPDLOG_ERROR("Unknown chat type {}", pinfo->type); break; } @@ -1003,7 +1002,7 @@ int CInputMain::Messenger(LPCHARACTER ch, const char* c_pData, size_t uiBytes) return CHARACTER_NAME_MAX_LEN; default: - sys_err("CInputMain::Messenger : Unknown subheader %d : %s", p->subheader, ch->GetName()); + SPDLOG_ERROR("CInputMain::Messenger : Unknown subheader {} : {}", p->subheader, ch->GetName()); break; } @@ -1017,8 +1016,7 @@ int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) if (uiBytes < sizeof(TPacketCGShop)) return -1; - if (test_server) - sys_log(0, "CInputMain::Shop() ==> SubHeader %d", p->subheader); + SPDLOG_TRACE("CInputMain::Shop() ==> SubHeader {}", p->subheader); const char * c_pData = data + sizeof(TPacketCGShop); uiBytes -= sizeof(TPacketCGShop); @@ -1026,7 +1024,7 @@ int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) switch (p->subheader) { case SHOP_SUBHEADER_CG_END: - sys_log(1, "INPUT: %s SHOP: END", ch->GetName()); + SPDLOG_DEBUG("INPUT: {} SHOP: END", ch->GetName()); CShopManager::instance().StopShopping(ch); return 0; @@ -1036,7 +1034,7 @@ int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) return -1; BYTE bPos = *(c_pData + 1); - sys_log(1, "INPUT: %s SHOP: BUY %d", ch->GetName(), bPos); + SPDLOG_DEBUG("INPUT: {} SHOP: BUY {}", ch->GetName(), bPos); CShopManager::instance().Buy(ch, bPos); return (sizeof(BYTE) + sizeof(BYTE)); } @@ -1048,7 +1046,7 @@ int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) BYTE pos = *c_pData; - sys_log(0, "INPUT: %s SHOP: SELL", ch->GetName()); + SPDLOG_DEBUG("INPUT: {} SHOP: SELL", ch->GetName()); CShopManager::instance().Sell(ch, pos); return sizeof(BYTE); } @@ -1061,13 +1059,13 @@ int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) BYTE pos = *(c_pData++); BYTE count = *(c_pData); - sys_log(0, "INPUT: %s SHOP: SELL2", ch->GetName()); + SPDLOG_DEBUG("INPUT: {} SHOP: SELL2", ch->GetName()); CShopManager::instance().Sell(ch, pos, count); return sizeof(BYTE) + sizeof(BYTE); } default: - sys_err("CInputMain::Shop : Unknown subheader %d : %s", p->subheader, ch->GetName()); + SPDLOG_ERROR("CInputMain::Shop : Unknown subheader {} : {}", p->subheader, ch->GetName()); break; } @@ -1081,10 +1079,8 @@ void CInputMain::OnClick(LPCHARACTER ch, const char * data) if ((victim = CHARACTER_MANAGER::instance().Find(pinfo->vid))) victim->OnClick(ch); - else if (test_server) - { - sys_err("CInputMain::OnClick %s.Click.NOT_EXIST_VID[%d]", ch->GetName(), pinfo->vid); - } + else + SPDLOG_TRACE("CInputMain::OnClick {}.Click.NOT_EXIST_VID[{}]", ch->GetName(), pinfo->vid); } void CInputMain::Exchange(LPCHARACTER ch, const char * data) @@ -1111,7 +1107,7 @@ void CInputMain::Exchange(LPCHARACTER ch, const char * data) } } - sys_log(0, "CInputMain()::Exchange() SubHeader %d ", pinfo->sub_header); + SPDLOG_DEBUG("CInputMain()::Exchange() SubHeader {} ", pinfo->sub_header); if (iPulse - ch->GetSafeboxLoadTime() < PASSES_PER_SEC(g_nPortalLimitTime)) { @@ -1159,7 +1155,7 @@ void CInputMain::Exchange(LPCHARACTER ch, const char * data) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾×¼ö°¡ 20¾ï ³ÉÀ» ÃÊ°úÇÏ¿© °Å·¡¸¦ ÇÒ¼ö°¡ ¾ø½À´Ï´Ù..")); - sys_err("[OVERFLOG_GOLD] START (%u) id %u name %s ", ch->GetGold(), ch->GetPlayerID(), ch->GetName()); + SPDLOG_ERROR("[OVERFLOG_GOLD] START ({}) id {} name {} ", ch->GetGold(), ch->GetPlayerID(), ch->GetName()); return; } @@ -1167,7 +1163,7 @@ void CInputMain::Exchange(LPCHARACTER ch, const char * data) { if (quest::CQuestManager::instance().GiveItemToPC(ch->GetPlayerID(), to_ch)) { - sys_log(0, "Exchange canceled by quest %s %s", ch->GetName(), to_ch->GetName()); + SPDLOG_DEBUG("Exchange canceled by quest {} {}", ch->GetName(), to_ch->GetName()); return; } } @@ -1209,7 +1205,7 @@ void CInputMain::Exchange(LPCHARACTER ch, const char * data) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÇ Ãѱݾ×ÀÌ 20¾ï ³ÉÀ» ÃÊ°úÇÏ¿© °Å·¡¸¦ ÇÒ¼ö°¡ ¾ø½À´Ï´Ù..")); - sys_err("[OVERFLOW_GOLD] ELK_ADD (%u) id %u name %s ", + SPDLOG_ERROR("[OVERFLOW_GOLD] ELK_ADD ({}) id {} name {} ", ch->GetExchange()->GetCompany()->GetOwner()->GetGold(), ch->GetExchange()->GetCompany()->GetOwner()->GetPlayerID(), ch->GetExchange()->GetCompany()->GetOwner()->GetName()); @@ -1225,7 +1221,7 @@ void CInputMain::Exchange(LPCHARACTER ch, const char * data) case EXCHANGE_SUBHEADER_CG_ACCEPT: // arg1 == not used if (ch->GetExchange()) { - sys_log(0, "CInputMain()::Exchange() ==> ACCEPT "); + SPDLOG_DEBUG("CInputMain()::Exchange() ==> ACCEPT "); ch->GetExchange()->Accept(true); } @@ -1276,7 +1272,7 @@ DWORD ClacValidComboInterval( LPCHARACTER ch, BYTE bArg ) if( !ch ) { - sys_err( "ClacValidComboInterval() ch is NULL"); + SPDLOG_ERROR("ClacValidComboInterval() ch is NULL"); return nInterval; } @@ -1295,7 +1291,7 @@ DWORD ClacValidComboInterval( LPCHARACTER ch, BYTE bArg ) } else { - sys_err( "ClacValidComboInterval() Invalid bArg(%d) ch(%s)", bArg, ch->GetName() ); + SPDLOG_ERROR("ClacValidComboInterval() Invalid bArg({}) ch({})", bArg, ch->GetName() ); } return nInterval; @@ -1316,7 +1312,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack int HackScalar = 0; // ±âº» ½ºÄ®¶ó ´ÜÀ§ 1 // [2013 09 11 CYH] debugging log - /*sys_log(0, "COMBO_TEST_LOG: %s arg:%u interval:%d valid:%u atkspd:%u riding:%s", + /*SPDLOG_DEBUG("COMBO_TEST_LOG: {} arg:{} interval:{} valid:{} atkspd:{} riding:{}", ch->GetName(), bArg, ComboInterval, @@ -1325,7 +1321,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack ch->IsRiding() ? "yes" : "no");*/ #if 0 - sys_log(0, "COMBO: %s arg:%u seq:%u delta:%d checkspeedhack:%d", + SPDLOG_DEBUG("COMBO: {} arg:{} seq:{} delta:{} checkspeedhack:{}", ch->GetName(), bArg, ch->GetComboSequence(), ComboInterval - ch->GetValidComboInterval(), CheckSpeedHack); #endif // bArg 14 ~ 21¹ø ±îÁö ÃÑ 8ÄÞº¸ °¡´É @@ -1342,11 +1338,11 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack // ÀÌ·Î ÀÎÇØ ÄÞº¸ÇÙÀ¸·Î ƨ±â´Â °æ¿ì°¡ ÀÖ¾î ´ÙÀ½ ÄÚµå ºñ È°¼ºÈ­. //HackScalar = 1 + (ch->GetValidComboInterval() - ComboInterval) / 300; - //sys_log(0, "COMBO_HACK: 2 %s arg:%u interval:%d valid:%u atkspd:%u riding:%s", + //SPDLOG_WARN("COMBO_HACK: 2 {} arg:{} interval:{} valid:{} atkspd:{} riding:{}", // ch->GetName(), - // bArg, - // ComboInterval, - // ch->GetValidComboInterval(), + // bArg, + // ComboInterval, + // ch->GetValidComboInterval(), // ch->GetPoint(POINT_ATT_SPEED), // ch->IsRiding() ? "yes" : "no"); } @@ -1365,7 +1361,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack { HackScalar = 1; ch->SetValidComboInterval(300); - sys_log(0, "COMBO_HACK: 5 %s combo_seq:%d", ch->GetName(), ch->GetComboSequence()); + SPDLOG_WARN("COMBO_HACK: 5 {} combo_seq:{}", ch->GetName(), ch->GetComboSequence()); } // ÀÚ°´ ½Ö¼ö ÄÞº¸ ¿¹¿Üó¸® else if (bArg == 21 && @@ -1380,7 +1376,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack HackScalar = 1; ch->SetValidComboInterval(300); - sys_log(0, "COMBO_HACK: 3 %s arg:%u valid:%u combo_idx:%d combo_seq:%d", + SPDLOG_WARN("COMBO_HACK: 3 {} arg:{} valid:{} combo_idx:{} combo_seq:{}", ch->GetName(), bArg, ComboSequenceBySkillLevel[idx][ch->GetComboSequence()], @@ -1393,7 +1389,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack { HackScalar = 1 + (ch->GetValidComboInterval() - ComboInterval) / 100; - sys_log(0, "COMBO_HACK: 2 %s arg:%u interval:%d valid:%u atkspd:%u riding:%s", + SPDLOG_WARN("COMBO_HACK: 2 {} arg:{} interval:{} valid:{} atkspd:{} riding:{}", ch->GetName(), bArg, ComboInterval, @@ -1424,8 +1420,8 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack // ÀÌ·Î ÀÎÇØ ÄÞº¸ÇÙÀ¸·Î ƨ±â´Â °æ¿ì°¡ ÀÖ¾î ´ÙÀ½ ÄÚµå ºñ È°¼ºÈ­. //HackScalar = 1 + (ch->GetValidComboInterval() - ComboInterval) / 100; - //sys_log(0, "COMBO_HACK: 6 %s arg:%u interval:%d valid:%u atkspd:%u", - // ch->GetName(), + //SPDLOG_WARN("COMBO_HACK: 6 {} arg:{} interval:{} valid:{} atkspd:{}", + // ch->GetName(), // bArg, // ComboInterval, // ch->GetValidComboInterval(), @@ -1441,7 +1437,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack const CMotion * pkMotion = CMotionManager::instance().GetMotion(ch->GetRaceNum(), MAKE_MOTION_KEY(MOTION_MODE_GENERAL, MOTION_NORMAL_ATTACK)); if (!pkMotion) - sys_err("cannot find motion by race %u", ch->GetRaceNum()); + SPDLOG_ERROR("cannot find motion by race {}", ch->GetRaceNum()); else { // Á¤»óÀû °è»êÀ̶ó¸é 1000.f¸¦ °öÇØ¾ß ÇÏÁö¸¸ Ŭ¶óÀ̾ðÆ®°¡ ¾Ö´Ï¸ÞÀÌ¼Ç ¼ÓµµÀÇ 90%¿¡¼­ @@ -1466,7 +1462,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack //if (ch->GetDesc()->DelayedDisconnect(Random::get(2, 9))) //{ // LogManager::instance().HackLog("Hacker", ch); - // sys_log(0, "HACKER: %s arg %u", ch->GetName(), bArg); + // SPDLOG_WARN("HACKER: {} arg {}", ch->GetName(), bArg); //} // À§ ÄÚµå·Î ÀÎÇØ, Æú¸®¸ðÇÁ¸¦ Ǫ´Â Áß¿¡ °ø°Ý Çϸé, @@ -1491,7 +1487,7 @@ bool CheckComboHack(LPCHARACTER ch, BYTE bArg, DWORD dwTime, bool CheckSpeedHack if (ch->GetDesc()->DelayedDisconnect(Random::get(2, 9))) { LogManager::instance().HackLog("Hacker", ch); - sys_log(0, "HACKER: %s arg %u", ch->GetName(), bArg); + SPDLOG_WARN("HACKER: {} arg {}", ch->GetName(), bArg); } HackScalar = 10; @@ -1519,7 +1515,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) if (pinfo->bFunc >= FUNC_MAX_NUM && !(pinfo->bFunc & 0x80)) { - sys_err("invalid move type: %s", ch->GetName()); + SPDLOG_ERROR("invalid move type: {}", ch->GetName()); return; } @@ -1551,7 +1547,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) LogManager::instance().HackLog("Teleport", ch); // ºÎÁ¤È®ÇÒ ¼ö ÀÖÀ½ } - sys_log(0, "MOVE: %s trying to move too far (dist: %.1fm) Riding(%d)", ch->GetName(), fDist, ch->IsRiding()); + SPDLOG_WARN("MOVE: {} trying to move too far (dist: {:.1f}m) Riding({})", ch->GetName(), fDist, ch->IsRiding()); ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ()); ch->Stop(); @@ -1575,13 +1571,13 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) // ½Ã°£ÀÌ ´Ê°Ô°£´Ù. ÀÏ´Ü ·Î±×¸¸ ÇصдÙ. ÁøÂ¥ ÀÌ·± »ç¶÷µéÀÌ ¸¹ÀºÁö üũÇؾßÇÔ. TODO if (iDelta >= 30000) { - sys_log(0, "SPEEDHACK: slow timer name %s delta %d", ch->GetName(), iDelta); + SPDLOG_WARN("SPEEDHACK: slow timer name {} delta {}", ch->GetName(), iDelta); ch->GetDesc()->DelayedDisconnect(3); } // 1ÃÊ¿¡ 20msec »¡¸® °¡´Â°Å ±îÁö´Â ÀÌÇØÇÑ´Ù. else if (iDelta < -(iServerDelta / 50)) { - sys_log(0, "SPEEDHACK: DETECTED! %s (delta %d %d)", ch->GetName(), iDelta, iServerDelta); + SPDLOG_WARN("SPEEDHACK: DETECTED! {} (delta {} {})", ch->GetName(), iDelta, iServerDelta); ch->GetDesc()->DelayedDisconnect(3); } } @@ -1623,7 +1619,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) char szBuf[256]; snprintf(szBuf, sizeof(szBuf), "SKILL_HACK: name=%s, job=%d, group=%d, motion=%d", name, job, group, motion); LogManager::instance().HackLog(szBuf, ch->GetDesc()->GetAccountTable().login, ch->GetName(), ch->GetDesc()->GetHostName()); - sys_log(0, "%s", szBuf); + SPDLOG_WARN("{}", szBuf); if (test_server) { @@ -1674,7 +1670,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) } */ /* - sys_log(0, + SPDLOG_TRACE( "MOVE: %s Func:%u Arg:%u Pos:%dx%d Time:%u Dist:%.1f", ch->GetName(), pinfo->bFunc, @@ -1789,14 +1785,14 @@ int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiByt if (iExtraLen < 0) { - sys_err("invalid packet length (len %d size %u buffer %u)", iExtraLen, pinfo->wSize, uiBytes); + SPDLOG_ERROR("invalid packet length (len {} size {} buffer {})", iExtraLen, pinfo->wSize, uiBytes); ch->GetDesc()->SetPhase(PHASE_CLOSE); return -1; } if (0 != (iExtraLen % sizeof(TPacketCGSyncPositionElement))) { - sys_err("invalid packet length %d (name: %s)", pinfo->wSize, ch->GetName()); + SPDLOG_ERROR("invalid packet length {} (name: {})", pinfo->wSize, ch->GetName()); return iExtraLen; } @@ -1810,7 +1806,7 @@ int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiByt if( iCount > nCountLimit ) { //LogManager::instance().HackLog( "SYNC_POSITION_HACK", ch ); - sys_err( "Too many SyncPosition Count(%d) from Name(%s)", iCount, ch->GetName() ); + SPDLOG_ERROR("Too many SyncPosition Count({}) from Name({})", iCount, ch->GetName() ); //ch->GetDesc()->SetPhase(PHASE_CLOSE); //return -1; iCount = nCountLimit; @@ -1866,7 +1862,7 @@ int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiByt { LogManager::instance().HackLog( "SYNC_POSITION_HACK", ch ); - sys_err( "Too far SyncPosition DistanceWithSyncOwner(%f)(%s) from Name(%s) CH(%d,%d) VICTIM(%d,%d) SYNC(%d,%d)", + SPDLOG_ERROR("Too far SyncPosition DistanceWithSyncOwner({})({}) from Name({}) CH({},{}) VICTIM({},{}) SYNC({},{})", fDistWithSyncOwner, victim->GetName(), ch->GetName(), ch->GetX(), ch->GetY(), victim->GetX(), victim->GetY(), e->lX, e->lY ); @@ -1895,7 +1891,7 @@ int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiByt { LogManager::instance().HackLog( "SYNC_POSITION_HACK", ch ); - sys_err( "Too often SyncPosition Interval(%ldms)(%s) from Name(%s) VICTIM(%d,%d) SYNC(%d,%d)", + SPDLOG_ERROR("Too often SyncPosition Interval({}ms)({}) from Name({}) VICTIM({},{}) SYNC({},{})", tvDiff->tv_sec * 1000 + tvDiff->tv_usec / 1000, victim->GetName(), ch->GetName(), victim->GetX(), victim->GetY(), e->lX, e->lY ); @@ -1908,7 +1904,7 @@ int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiByt { LogManager::instance().HackLog( "SYNC_POSITION_HACK", ch ); - sys_err( "Too far SyncPosition Distance(%f)(%s) from Name(%s) CH(%d,%d) VICTIM(%d,%d) SYNC(%d,%d)", + SPDLOG_ERROR("Too far SyncPosition Distance({})({}) from Name({}) CH({},{}) VICTIM({},{}) SYNC({},{})", fDist, victim->GetName(), ch->GetName(), ch->GetX(), ch->GetY(), victim->GetX(), victim->GetY(), e->lX, e->lY ); @@ -1950,7 +1946,7 @@ void CInputMain::UseSkill(LPCHARACTER ch, const char * pcData) void CInputMain::ScriptButton(LPCHARACTER ch, const void* c_pData) { TPacketCGScriptButton * p = (TPacketCGScriptButton *) c_pData; - sys_log(0, "QUEST ScriptButton pid %d idx %u", ch->GetPlayerID(), p->idx); + SPDLOG_DEBUG("QUEST ScriptButton pid {} idx {}", ch->GetPlayerID(), p->idx); quest::PC* pc = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID()); if (pc && pc->IsConfirmWait()) @@ -1970,7 +1966,7 @@ void CInputMain::ScriptButton(LPCHARACTER ch, const void* c_pData) void CInputMain::ScriptAnswer(LPCHARACTER ch, const void* c_pData) { TPacketCGScriptAnswer * p = (TPacketCGScriptAnswer *) c_pData; - sys_log(0, "QUEST ScriptAnswer pid %d answer %d", ch->GetPlayerID(), p->answer); + SPDLOG_DEBUG("QUEST ScriptAnswer pid {} answer {}", ch->GetPlayerID(), p->answer); if (p->answer > 250) // ´ÙÀ½ ¹öÆ°¿¡ ´ëÇÑ ÀÀ´äÀ¸·Î ¿Â ÆÐŶÀÎ °æ¿ì { @@ -1987,7 +1983,7 @@ void CInputMain::ScriptAnswer(LPCHARACTER ch, const void* c_pData) void CInputMain::ScriptSelectItem(LPCHARACTER ch, const void* c_pData) { TPacketCGScriptSelectItem* p = (TPacketCGScriptSelectItem*) c_pData; - sys_log(0, "QUEST ScriptSelectItem pid %d answer %d", ch->GetPlayerID(), p->selection); + SPDLOG_DEBUG("QUEST ScriptSelectItem pid {} answer {}", ch->GetPlayerID(), p->selection); quest::CQuestManager::Instance().SelectItem(ch->GetPlayerID(), p->selection); } // END_OF_SCRIPT_SELECT_ITEM @@ -1998,7 +1994,7 @@ void CInputMain::QuestInputString(LPCHARACTER ch, const void* c_pData) char msg[65]; strlcpy(msg, p->msg, sizeof(msg)); - sys_log(0, "QUEST InputString pid %u msg %s", ch->GetPlayerID(), msg); + SPDLOG_DEBUG("QUEST InputString pid {} msg {}", ch->GetPlayerID(), msg); quest::CQuestManager::Instance().Input(ch->GetPlayerID(), msg); } @@ -2009,7 +2005,7 @@ void CInputMain::QuestConfirm(LPCHARACTER ch, const void* c_pData) LPCHARACTER ch_wait = CHARACTER_MANAGER::instance().FindByPID(p->requestPID); if (p->answer) p->answer = quest::CONFIRM_YES; - sys_log(0, "QuestConfirm from %s pid %u name %s answer %d", ch->GetName(), p->requestPID, (ch_wait)?ch_wait->GetName():"", p->answer); + SPDLOG_DEBUG("QuestConfirm from {} pid {} name {} answer {}", ch->GetName(), p->requestPID, (ch_wait)?ch_wait->GetName():"", p->answer); if (ch_wait) { quest::CQuestManager::Instance().Confirm(ch_wait->GetPlayerID(), (quest::EQuestConfirmType) p->answer, ch->GetPlayerID()); @@ -2164,7 +2160,7 @@ void CInputMain::SafeboxCheckout(LPCHARACTER ch, const char * c_pData, bool bMal { if (NULL == pkItem->GetProto()) { - sys_err ("pkItem->GetProto() == NULL (id : %d)",pkItem->GetID()); + SPDLOG_ERROR("pkItem->GetProto() == NULL (id : {})",pkItem->GetID()); return ; } // 100% È®·ü·Î ¼Ó¼ºÀÌ ºÙ¾î¾ß Çϴµ¥ ¾È ºÙ¾îÀÖ´Ù¸é »õ·Î ºÙÈù´Ù. ............... @@ -2217,7 +2213,7 @@ void CInputMain::PartyInvite(LPCHARACTER ch, const char * c_pData) if (!pInvitee || !ch->GetDesc() || !pInvitee->GetDesc()) { - sys_err("PARTY Cannot find invited character"); + SPDLOG_ERROR("PARTY Cannot find invited character"); return; } @@ -2273,7 +2269,7 @@ void CInputMain::PartySetState(LPCHARACTER ch, const char* c_pData) } DWORD pid = p->pid; - sys_log(0, "PARTY SetRole pid %d to role %d state %s", pid, p->byRole, p->flag ? "on" : "off"); + SPDLOG_DEBUG("PARTY SetRole pid {} to role {} state {}", pid, p->byRole, p->flag ? "on" : "off"); switch (p->byRole) { @@ -2300,7 +2296,7 @@ void CInputMain::PartySetState(LPCHARACTER ch, const char* c_pData) break; default: - sys_err("wrong byRole in PartySetState Packet name %s state %d", ch->GetName(), p->byRole); + SPDLOG_ERROR("wrong byRole in PartySetState Packet name {} state {}", ch->GetName(), p->byRole); break; } } @@ -2778,7 +2774,7 @@ int CInputMain::Guild(LPCHARACTER ch, const char * data, size_t uiBytes) if (length > GUILD_COMMENT_MAX_LEN) { // À߸øµÈ ±æÀÌ.. ²÷¾îÁÖÀÚ. - sys_err("POST_COMMENT: %s comment too long (length: %u)", ch->GetName(), length); + SPDLOG_ERROR("POST_COMMENT: {} comment too long (length: {})", ch->GetName(), length); ch->GetDesc()->SetPhase(PHASE_CLOSE); return -1; } @@ -2919,7 +2915,7 @@ int CInputMain::MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes) if (ch->GetGold() >= GOLD_MAX) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÀ¯ µ·ÀÌ 20¾ï³ÉÀ» ³Ñ¾î °Å·¡¸¦ ÇÛ¼ö°¡ ¾ø½À´Ï´Ù.")); - sys_log(0, "MyShop ==> OverFlow Gold id %u name %s ", ch->GetPlayerID(), ch->GetName()); + SPDLOG_DEBUG("MyShop ==> OverFlow Gold id {} name {} ", ch->GetPlayerID(), ch->GetName()); return (iExtraLen); } @@ -2932,7 +2928,7 @@ int CInputMain::MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes) return (iExtraLen); } - sys_log(0, "MyShop count %d", p->bCount); + SPDLOG_DEBUG("MyShop count {}", p->bCount); ch->OpenMyShop(p->szSign, (TShopItemTable *) (c_pData + sizeof(TPacketCGMyShop)), p->bCount); return (iExtraLen); } @@ -2973,12 +2969,12 @@ void CInputMain::Refine(LPCHARACTER ch, const char* c_pData) if (p->type == REFINE_TYPE_NORMAL) { - sys_log (0, "refine_type_noraml"); + SPDLOG_DEBUG("refine_type_noraml"); ch->DoRefine(item); } else if (p->type == REFINE_TYPE_SCROLL || p->type == REFINE_TYPE_HYUNIRON || p->type == REFINE_TYPE_MUSIN || p->type == REFINE_TYPE_BDRAGON) { - sys_log (0, "refine_type_scroll, ..."); + SPDLOG_DEBUG("refine_type_scroll, ..."); ch->DoRefineWithScroll(item); } else if (p->type == REFINE_TYPE_MONEY_ONLY) @@ -3015,7 +3011,7 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) if (!(ch = d->GetCharacter())) { - sys_err("no character on desc"); + SPDLOG_ERROR("no character on desc"); d->SetPhase(PHASE_CLOSE); return (0); } @@ -3023,7 +3019,7 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) int iExtraLen = 0; if (test_server && bHeader != HEADER_CG_MOVE) - sys_log(0, "CInputMain::Analyze() ==> Header [%d] ", bHeader); + SPDLOG_TRACE("CInputMain::Analyze() ==> Header [{}] ", bHeader); switch (bHeader) { @@ -3039,7 +3035,7 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) if (test_server) { char* pBuf = (char*)c_pData; - sys_log(0, "%s", pBuf + sizeof(TPacketCGChat)); + SPDLOG_DEBUG("{}", pBuf + sizeof(TPacketCGChat)); } if ((iExtraLen = Chat(ch, c_pData, m_iBufferLeft)) < 0) @@ -3074,7 +3070,7 @@ int CInputMain::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) { if (!*d->GetClientVersion()) { - sys_err("Version not recieved name %s", ch->GetName()); + SPDLOG_ERROR("Version not recieved name {}", ch->GetName()); d->SetPhase(PHASE_CLOSE); } } @@ -3308,7 +3304,7 @@ int CInputDead::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) if (!(ch = d->GetCharacter())) { - sys_err("no character on desc"); + SPDLOG_ERROR("no character on desc"); return 0; } diff --git a/src/game/src/input_p2p.cpp b/src/game/src/input_p2p.cpp index b92ea2d..b522058 100644 --- a/src/game/src/input_p2p.cpp +++ b/src/game/src/input_p2p.cpp @@ -15,7 +15,6 @@ #include "xmas_event.h" #include "affect.h" #include "castle.h" -#include "dev_log.h" #include "locale_service.h" #include "questmanager.h" #include "pcbang.h" @@ -50,12 +49,12 @@ int CInputP2P::Relay(LPDESC d, const char * c_pData, size_t uiBytes) if (p->lSize < 0) { - sys_err("invalid packet length %d", p->lSize); + SPDLOG_ERROR("invalid packet length {}", p->lSize); d->SetPhase(PHASE_CLOSE); return -1; } - sys_log(0, "InputP2P::Relay : %s size %d", p->szName, p->lSize); + SPDLOG_INFO("InputP2P::Relay : {} size {}", p->szName, p->lSize); LPCHARACTER pkChr = CHARACTER_MANAGER::instance().FindPC(p->szName); @@ -111,7 +110,7 @@ int CInputP2P::Notice(LPDESC d, const char * c_pData, size_t uiBytes) if (p->lSize < 0) { - sys_err("invalid packet length %d", p->lSize); + SPDLOG_ERROR("invalid packet length {}", p->lSize); d->SetPhase(PHASE_CLOSE); return -1; } @@ -131,7 +130,7 @@ int CInputP2P::MonarchNotice(LPDESC d, const char * c_pData, size_t uiBytes) if (p->lSize < 0) { - sys_err("invalid packet length %d", p->lSize); + SPDLOG_ERROR("invalid packet length {}", p->lSize); d->SetPhase(PHASE_CLOSE); return -1; } @@ -199,7 +198,7 @@ int CInputP2P::Guild(LPDESC d, const char* c_pData, size_t uiBytes) return sizeof(int); } default: - sys_err ("UNKNOWN GUILD SUB PACKET"); + SPDLOG_ERROR("UNKNOWN GUILD SUB PACKET"); break; } return 0; @@ -256,21 +255,21 @@ void CInputP2P::Disconnect(const char * c_pData) void CInputP2P::Setup(LPDESC d, const char * c_pData) { TPacketGGSetup * p = (TPacketGGSetup *) c_pData; - sys_log(0, "P2P: Setup %s:%d", d->GetHostName(), p->wPort); + SPDLOG_INFO("P2P: Setup {}:{}", d->GetHostName(), p->wPort); d->SetP2P(p->wPort, p->bChannel); } void CInputP2P::MessengerAdd(const char * c_pData) { TPacketGGMessenger * p = (TPacketGGMessenger *) c_pData; - sys_log(0, "P2P: Messenger Add %s %s", p->szAccount, p->szCompanion); + SPDLOG_INFO("P2P: Messenger Add {} {}", p->szAccount, p->szCompanion); MessengerManager::instance().__AddToList(p->szAccount, p->szCompanion); } void CInputP2P::MessengerRemove(const char * c_pData) { TPacketGGMessenger * p = (TPacketGGMessenger *) c_pData; - sys_log(0, "P2P: Messenger Remove %s %s", p->szAccount, p->szCompanion); + SPDLOG_INFO("P2P: Messenger Remove {} {}", p->szAccount, p->szCompanion); MessengerManager::instance().__RemoveFromList(p->szAccount, p->szCompanion); } @@ -304,7 +303,7 @@ void CInputP2P::GuildWarZoneMapIndex(const char* c_pData) TPacketGGGuildWarMapIndex * p = (TPacketGGGuildWarMapIndex*) c_pData; CGuildManager & gm = CGuildManager::instance(); - sys_log(0, "P2P: GuildWarZoneMapIndex g1(%u) vs g2(%u), mapIndex(%d)", p->dwGuildID1, p->dwGuildID2, p->lMapIndex); + SPDLOG_DEBUG("P2P: GuildWarZoneMapIndex g1({}) vs g2({}), mapIndex({})", p->dwGuildID1, p->dwGuildID2, p->lMapIndex); CGuild * g1 = gm.FindGuild(p->dwGuildID1); CGuild * g2 = gm.FindGuild(p->dwGuildID2); @@ -386,12 +385,12 @@ void CInputP2P::BlockChat(const char * c_pData) if (ch) { - sys_log(0, "BLOCK CHAT apply name %s dur %d", p->szName, p->lBlockDuration); + SPDLOG_DEBUG("BLOCK CHAT apply name {} dur {}", p->szName, p->lBlockDuration); ch->AddAffect(AFFECT_BLOCK_CHAT, POINT_NONE, 0, AFF_NONE, p->lBlockDuration, 0, true); } else { - sys_log(0, "BLOCK CHAT fail name %s dur %d", p->szName, p->lBlockDuration); + SPDLOG_DEBUG("BLOCK CHAT fail name {} dur {}", p->szName, p->lBlockDuration); } } // END_OF_BLOCK_CHAT @@ -408,13 +407,12 @@ void CInputP2P::IamAwake(LPDESC d, const char * c_pData) { std::string hostNames; P2P_MANAGER::instance().GetP2PHostNames(hostNames); - sys_log(0, "P2P Awakeness check from %s. My P2P connection number is %d. and details...\n%s", d->GetHostName(), P2P_MANAGER::instance().GetDescCount(), hostNames.c_str()); + SPDLOG_INFO("P2P Awakeness check from {}. My P2P connection number is {}. and details...\n{}", d->GetHostName(), P2P_MANAGER::instance().GetDescCount(), hostNames.c_str()); } int CInputP2P::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) { - if (test_server) - sys_log(0, "CInputP2P::Anlayze[Header %d]", bHeader); + SPDLOG_TRACE("CInputP2P::Anlayze[Header {}]", bHeader); int iExtraLen = 0; @@ -443,7 +441,7 @@ int CInputP2P::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) break; case HEADER_GG_SHUTDOWN: - sys_err("Accept shutdown p2p command from %s.", d->GetHostName()); + SPDLOG_ERROR("Accept shutdown p2p command from {}.", d->GetHostName()); Shutdown(10); break; diff --git a/src/game/src/input_teen.cpp b/src/game/src/input_teen.cpp index 1e64ead..db8327b 100644 --- a/src/game/src/input_teen.cpp +++ b/src/game/src/input_teen.cpp @@ -16,7 +16,6 @@ #include "db.h" #include "protocol.h" #include "char.h" -#include "dev_log.h" #define HANDSHAKE_XOR 0x6AB3D224 diff --git a/src/game/src/item.cpp b/src/game/src/item.cpp index 076a831..116b996 100644 --- a/src/game/src/item.cpp +++ b/src/game/src/item.cpp @@ -12,7 +12,6 @@ #include "profiler.h" #include "marriage.h" #include "item_addon.h" -#include "dev_log.h" #include "locale_service.h" #include "item.h" #include "item_manager.h" @@ -86,14 +85,14 @@ EVENTFUNC(item_destroy_event) if ( info == NULL ) { - sys_err( "item_destroy_event> Null pointer" ); + SPDLOG_ERROR("item_destroy_event> Null pointer" ); return 0; } LPITEM pkItem = info->item; if (pkItem->GetOwner()) - sys_err("item_destroy_event: Owner exist. (item %s owner %s)", pkItem->GetName(), pkItem->GetOwner()->GetName()); + SPDLOG_ERROR("item_destroy_event: Owner exist. (item {} owner {})", pkItem->GetName(), pkItem->GetOwner()->GetName()); pkItem->SetDestroyEvent(NULL); M2_DESTROY_ITEM(pkItem); @@ -143,7 +142,7 @@ void CItem::EncodeInsertPacket(LPENTITY ent) if ( info == NULL ) { - sys_err( "CItem::EncodeInsertPacket> Null pointer" ); + SPDLOG_ERROR("CItem::EncodeInsertPacket> Null pointer" ); return; } @@ -170,7 +169,7 @@ void CItem::EncodeRemovePacket(LPENTITY ent) pack.dwVID = m_dwVID; d->Packet(&pack, sizeof(pack)); - sys_log(2, "Item::EncodeRemovePacket %s to %s", GetName(), ((LPCHARACTER) ent)->GetName()); + SPDLOG_TRACE("Item::EncodeRemovePacket {} to {}", GetName(), ((LPCHARACTER) ent)->GetName()); } void CItem::SetProto(const TItemTable * table) @@ -218,7 +217,7 @@ void CItem::UpdatePacket() memcpy(pack.aAttr, GetAttributes(), sizeof(pack.aAttr)); - sys_log(2, "UpdatePacket %s -> %s", GetName(), m_pOwner->GetName()); + SPDLOG_TRACE("UpdatePacket {} -> {}", GetName(), m_pOwner->GetName()); m_pOwner->GetDesc()->Packet(&pack, sizeof(pack)); } @@ -289,7 +288,7 @@ LPITEM CItem::RemoveFromCharacter() { if (!m_pOwner) { - sys_err("Item::RemoveFromCharacter owner null"); + SPDLOG_ERROR("Item::RemoveFromCharacter owner null"); return (this); } @@ -311,7 +310,7 @@ LPITEM CItem::RemoveFromCharacter() if (IsDragonSoul()) { if (m_wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) - sys_err("CItem::RemoveFromCharacter: pos >= DRAGON_SOUL_INVENTORY_MAX_NUM"); + SPDLOG_ERROR("CItem::RemoveFromCharacter: pos >= DRAGON_SOUL_INVENTORY_MAX_NUM"); else pOwner->SetItem(TItemPos(m_bWindow, m_wCell), NULL); } @@ -320,7 +319,7 @@ LPITEM CItem::RemoveFromCharacter() TItemPos cell(INVENTORY, m_wCell); if (false == cell.IsDefaultInventoryPosition() && false == cell.IsBeltInventoryPosition()) // ¾Æ´Ï¸é ¼ÒÁöÇ°¿¡? - sys_err("CItem::RemoveFromCharacter: Invalid Item Position"); + SPDLOG_ERROR("CItem::RemoveFromCharacter: Invalid Item Position"); else { pOwner->SetItem(cell, NULL); @@ -348,7 +347,7 @@ bool CItem::AddToCharacter(LPCHARACTER ch, TItemPos Cell) { if (m_wCell >= INVENTORY_MAX_NUM && BELT_INVENTORY_SLOT_START > m_wCell) { - sys_err("CItem::AddToCharacter: cell overflow: %s to %s cell %d", m_pProto->szName, ch->GetName(), m_wCell); + SPDLOG_ERROR("CItem::AddToCharacter: cell overflow: {} to {} cell {}", m_pProto->szName, ch->GetName(), m_wCell); return false; } } @@ -356,7 +355,7 @@ bool CItem::AddToCharacter(LPCHARACTER ch, TItemPos Cell) { if (m_wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) { - sys_err("CItem::AddToCharacter: cell overflow: %s to %s cell %d", m_pProto->szName, ch->GetName(), m_wCell); + SPDLOG_ERROR("CItem::AddToCharacter: cell overflow: {} to {} cell {}", m_pProto->szName, ch->GetName(), m_wCell); return false; } } @@ -393,19 +392,19 @@ bool CItem::AddToGround(int lMapIndex, const PIXEL_POSITION & pos, bool skipOwne { if (0 == lMapIndex) { - sys_err("wrong map index argument: %d", lMapIndex); + SPDLOG_ERROR("wrong map index argument: {}", lMapIndex); return false; } if (GetSectree()) { - sys_err("sectree already assigned"); + SPDLOG_ERROR("sectree already assigned"); return false; } if (!skipOwnerCheck && m_pOwner) { - sys_err("owner pointer not null"); + SPDLOG_ERROR("owner pointer not null"); return false; } @@ -413,7 +412,7 @@ bool CItem::AddToGround(int lMapIndex, const PIXEL_POSITION & pos, bool skipOwne if (!tree) { - sys_err("cannot find sectree by %dx%d", pos.x, pos.y); + SPDLOG_ERROR("cannot find sectree by {}x{}", pos.x, pos.y); return false; } @@ -605,7 +604,7 @@ void CItem::ModifyPoints(bool bAdd) if (!p) { - sys_err("cannot find table by vnum %u", dwVnum); + SPDLOG_ERROR("cannot find table by vnum {}", dwVnum); continue; } @@ -817,7 +816,7 @@ bool CItem::EquipTo(LPCHARACTER ch, BYTE bWearCell) { if (!ch) { - sys_err("EquipTo: nil character"); + SPDLOG_ERROR("EquipTo: nil character"); return false; } @@ -826,7 +825,7 @@ bool CItem::EquipTo(LPCHARACTER ch, BYTE bWearCell) { if (bWearCell < WEAR_MAX_NUM || bWearCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX) { - sys_err("EquipTo: invalid dragon soul cell (this: #%d %s wearflag: %d cell: %d)", GetOriginalVnum(), GetName(), GetSubType(), bWearCell - WEAR_MAX_NUM); + SPDLOG_ERROR("EquipTo: invalid dragon soul cell (this: #{} {} wearflag: {} cell: {})", GetOriginalVnum(), GetName(), GetSubType(), bWearCell - WEAR_MAX_NUM); return false; } } @@ -834,14 +833,14 @@ bool CItem::EquipTo(LPCHARACTER ch, BYTE bWearCell) { if (bWearCell >= WEAR_MAX_NUM) { - sys_err("EquipTo: invalid wear cell (this: #%d %s wearflag: %d cell: %d)", GetOriginalVnum(), GetName(), GetWearFlag(), bWearCell); + SPDLOG_ERROR("EquipTo: invalid wear cell (this: #{} {} wearflag: {} cell: {})", GetOriginalVnum(), GetName(), GetWearFlag(), bWearCell); return false; } } if (ch->GetWear(bWearCell)) { - sys_err("EquipTo: item already exist (this: #%d %s cell: %d %s)", GetOriginalVnum(), GetName(), bWearCell, ch->GetWear(bWearCell)->GetName()); + SPDLOG_ERROR("EquipTo: item already exist (this: #{} {} cell: {} {})", GetOriginalVnum(), GetName(), bWearCell, ch->GetWear(bWearCell)->GetName()); return false; } @@ -894,15 +893,15 @@ bool CItem::Unequip() if (!m_pOwner || GetCell() < INVENTORY_MAX_NUM) { // ITEM_OWNER_INVALID_PTR_BUG - sys_err("%s %u m_pOwner %p, GetCell %d", - GetName(), GetID(), get_pointer(m_pOwner), GetCell()); + SPDLOG_ERROR("{} {} m_pOwner {}, GetCell {}", + GetName(), GetID(), (void*) get_pointer(m_pOwner), GetCell()); // END_OF_ITEM_OWNER_INVALID_PTR_BUG return false; } if (this != m_pOwner->GetWear(GetCell() - INVENTORY_MAX_NUM)) { - sys_err("m_pOwner->GetWear() != this"); + SPDLOG_ERROR("m_pOwner->GetWear() != this"); return false; } @@ -977,7 +976,7 @@ bool CItem::CreateSocket(BYTE bSlot, BYTE bGold) if (m_alSockets[bSlot] != 0) { - sys_err("Item::CreateSocket : socket already exist %s %d", GetName(), bSlot); + SPDLOG_ERROR("Item::CreateSocket : socket already exist {} {}", GetName(), bSlot); return false; } @@ -1040,7 +1039,7 @@ EVENTFUNC(ownership_event) if ( info == NULL ) { - sys_err( "ownership_event> Null pointer" ); + SPDLOG_ERROR("ownership_event> Null pointer" ); return 0; } @@ -1132,7 +1131,7 @@ void CItem::AlterToSocketItem(int iSocketCount) { if (iSocketCount >= ITEM_SOCKET_MAX_NUM) { - sys_log(0, "Invalid Socket Count %d, set to maximum", ITEM_SOCKET_MAX_NUM); + SPDLOG_ERROR("Invalid Socket Count {}, set to maximum", (int) ITEM_SOCKET_MAX_NUM); iSocketCount = ITEM_SOCKET_MAX_NUM; } @@ -1245,7 +1244,7 @@ int CItem::GetRefineLevel() str_to_number(locale_rtn, p+1); if (locale_rtn != rtn) { - sys_err("refine_level_based_on_NAME(%d) is not equal to refine_level_based_on_LOCALE_NAME(%d).", rtn, locale_rtn); + SPDLOG_ERROR("refine_level_based_on_NAME({}) is not equal to refine_level_based_on_LOCALE_NAME({}).", rtn, locale_rtn); } } @@ -1263,7 +1262,7 @@ EVENTFUNC(unique_expire_event) if ( info == NULL ) { - sys_err( "unique_expire_event> Null pointer" ); + SPDLOG_ERROR("unique_expire_event> Null pointer" ); return 0; } @@ -1273,7 +1272,7 @@ EVENTFUNC(unique_expire_event) { if (pkItem->GetSocket(ITEM_SOCKET_UNIQUE_REMAIN_TIME) <= 1) { - sys_log(0, "UNIQUE_ITEM: expire %s %u", pkItem->GetName(), pkItem->GetID()); + SPDLOG_DEBUG("UNIQUE_ITEM: expire {} {}", pkItem->GetName(), pkItem->GetID()); pkItem->SetUniqueExpireEvent(NULL); ITEM_MANAGER::instance().RemoveItem(pkItem, "UNIQUE_EXPIRE"); return 0; @@ -1316,7 +1315,7 @@ EVENTFUNC(timer_based_on_wear_expire_event) if ( info == NULL ) { - sys_err( "expire_event Null pointer" ); + SPDLOG_ERROR("expire_event Null pointer" ); return 0; } @@ -1324,7 +1323,7 @@ EVENTFUNC(timer_based_on_wear_expire_event) int remain_time = pkItem->GetSocket(ITEM_SOCKET_REMAIN_SEC) - processing_time/passes_per_sec; if (remain_time <= 0) { - sys_log(0, "ITEM EXPIRED : expired %s %u", pkItem->GetName(), pkItem->GetID()); + SPDLOG_DEBUG("ITEM EXPIRED : expired {} {}", pkItem->GetName(), pkItem->GetID()); pkItem->SetTimerBasedOnWearExpireEvent(NULL); pkItem->SetSocket(ITEM_SOCKET_REMAIN_SEC, 0); @@ -1393,7 +1392,7 @@ void CItem::StartRealTimeExpireEvent() m_pkRealTimeExpireEvent = event_create( real_time_expire_event, info, PASSES_PER_SEC(1)); - sys_log(0, "REAL_TIME_EXPIRE: StartRealTimeExpireEvent"); + SPDLOG_DEBUG("REAL_TIME_EXPIRE: StartRealTimeExpireEvent"); return; } @@ -1554,7 +1553,7 @@ EVENTFUNC(accessory_socket_expire_event) if ( info == NULL ) { - sys_err( "accessory_socket_expire_event> Null pointer" ); + SPDLOG_ERROR("accessory_socket_expire_event> Null pointer" ); return 0; } @@ -1957,13 +1956,13 @@ bool CItem::MoveToAuction() LPCHARACTER owner = GetOwner(); if (owner == NULL) { - sys_err ("Item those owner is not exist cannot regist in auction"); + SPDLOG_ERROR("Item those owner is not exist cannot regist in auction"); return false; } if (GetWindow() == AUCTION) { - sys_err ("Item is already in auction."); + SPDLOG_ERROR("Item is already in auction."); } SetWindow(AUCTION); diff --git a/src/game/src/item_addon.cpp b/src/game/src/item_addon.cpp index 43443c2..5e66ff4 100644 --- a/src/game/src/item_addon.cpp +++ b/src/game/src/item_addon.cpp @@ -16,7 +16,7 @@ void CItemAddonManager::ApplyAddonTo(int iAddonType, LPITEM pItem) { if (!pItem) { - sys_err("ITEM pointer null"); + SPDLOG_ERROR("ITEM pointer null"); return; } diff --git a/src/game/src/item_attribute.cpp b/src/game/src/item_attribute.cpp index 4e1ab95..095b1cc 100644 --- a/src/game/src/item_attribute.cpp +++ b/src/game/src/item_attribute.cpp @@ -81,7 +81,7 @@ void CItem::AddAttribute(BYTE bApply, short sValue) int i = GetAttributeCount(); if (i >= MAX_NORM_ATTR_NUM) - sys_err("item attribute overflow!"); + SPDLOG_ERROR("item attribute overflow!"); else { if (sValue) @@ -100,7 +100,7 @@ void CItem::AddAttr(BYTE bApply, BYTE bLevel) int i = GetAttributeCount(); if (i == MAX_NORM_ATTR_NUM) - sys_err("item attribute overflow!"); + SPDLOG_ERROR("item attribute overflow!"); else { const TItemAttrTable & r = g_map_itemAttr[bApply]; @@ -156,7 +156,7 @@ void CItem::PutAttributeWithLevel(BYTE bLevel) if (!attr_idx) { - sys_err("Cannot put item attribute %d %d", iAttributeSet, bLevel); + SPDLOG_ERROR("Cannot put item attribute {} {}", iAttributeSet, bLevel); return; } diff --git a/src/game/src/item_manager.cpp b/src/game/src/item_manager.cpp index f6b6ca0..e8ff4d7 100644 --- a/src/game/src/item_manager.cpp +++ b/src/game/src/item_manager.cpp @@ -13,7 +13,6 @@ #include "unique_item.h" #include "safebox.h" #include "blend_item.h" -#include "dev_log.h" #include "locale_service.h" #include "item.h" #include "item_manager.h" @@ -85,9 +84,8 @@ bool ITEM_MANAGER::Initialize(TItemTable * table, int size) if (m_vec_prototype[i].bType == ITEM_QUEST || IS_SET(m_vec_prototype[i].dwFlags, ITEM_FLAG_QUEST_USE | ITEM_FLAG_QUEST_USE_MULTIPLE)) quest::CQuestManager::instance().RegisterNPCVnum(m_vec_prototype[i].dwVnum); - m_map_vid.insert( std::map::value_type( m_vec_prototype[i].dwVnum, m_vec_prototype[i] ) ); - if ( test_server ) - sys_log( 0, "ITEM_INFO %d %s ", m_vec_prototype[i].dwVnum, m_vec_prototype[i].szName ); + m_map_vid.insert( std::map::value_type( m_vec_prototype[i].dwVnum, m_vec_prototype[i] ) ); + SPDLOG_TRACE("ITEM_INFO {} {} ", m_vec_prototype[i].dwVnum, m_vec_prototype[i].szName ); } int len = 0, len2; @@ -104,8 +102,7 @@ bool ITEM_MANAGER::Initialize(TItemTable * table, int size) if (!((i + 1) % 4)) { - if ( !test_server ) - sys_log(0, "%s", buf); + SPDLOG_TRACE("{}", buf); len = 0; } else @@ -117,13 +114,12 @@ bool ITEM_MANAGER::Initialize(TItemTable * table, int size) if ((i + 1) % 4) { - if ( !test_server ) - sys_log(0, "%s", buf); + SPDLOG_TRACE("{}", buf); } ITEM_VID_MAP::iterator it = m_VIDMap.begin(); - sys_log (1, "ITEM_VID_MAP %d", m_VIDMap.size() ); + SPDLOG_DEBUG("ITEM_VID_MAP {}", m_VIDMap.size() ); while (it != m_VIDMap.end()) { @@ -134,7 +130,7 @@ bool ITEM_MANAGER::Initialize(TItemTable * table, int size) if (NULL == tableInfo) { - sys_err("cannot reset item table"); + SPDLOG_ERROR("cannot reset item table"); item->SetProto(NULL); } @@ -190,7 +186,7 @@ LPITEM ITEM_MANAGER::CreateItem(DWORD vnum, DWORD count, DWORD id, bool bTryMagi { item = m_map_pkItemByID[id]; LPCHARACTER owner = item->GetOwner(); - sys_err("ITEM_ID_DUP: %u %s owner %p", id, item->GetName(), get_pointer(owner)); + SPDLOG_ERROR("ITEM_ID_DUP: {} {} owner {}", id, item->GetName(), (void*) get_pointer(owner)); return NULL; } @@ -446,11 +442,11 @@ void ITEM_MANAGER::SaveSingleItem(LPITEM item) db_clientdesc->Packet(&dwID, sizeof(DWORD)); db_clientdesc->Packet(&dwOwnerID, sizeof(DWORD)); - sys_log(1, "ITEM_DELETE %s:%u", item->GetName(), dwID); + SPDLOG_DEBUG("ITEM_DELETE {}:{}", item->GetName(), dwID); return; } - sys_log(1, "ITEM_SAVE %s:%d in %s window %d", item->GetName(), item->GetID(), item->GetOwner()->GetName(), item->GetWindow()); + SPDLOG_DEBUG("ITEM_SAVE {}:{} in {} window {}", item->GetName(), item->GetID(), item->GetOwner()->GetName(), item->GetWindow()); TPlayerItem t; @@ -531,12 +527,12 @@ void ITEM_MANAGER::DestroyItem(LPITEM item, const char* file, size_t line) { if (CHARACTER_MANAGER::instance().Find(item->GetOwner()->GetPlayerID()) != NULL) { - sys_err("DestroyItem: GetOwner %s %s!!", item->GetName(), item->GetOwner()->GetName()); + SPDLOG_ERROR("DestroyItem: GetOwner {} {}!!", item->GetName(), item->GetOwner()->GetName()); item->RemoveFromCharacter(); } else { - sys_err ("WTH! Invalid item owner. owner pointer : %p", item->GetOwner()); + SPDLOG_ERROR("WTH! Invalid item owner. owner pointer : {}", (void*) item->GetOwner()); } } @@ -546,7 +542,7 @@ void ITEM_MANAGER::DestroyItem(LPITEM item, const char* file, size_t line) m_set_pkItemForDelayedSave.erase(it); DWORD dwID = item->GetID(); - sys_log(2, "ITEM_DESTROY %s:%u", item->GetName(), dwID); + SPDLOG_TRACE("ITEM_DESTROY {}:{}", item->GetName(), dwID); if (!item->GetSkipSave() && dwID) { @@ -558,7 +554,7 @@ void ITEM_MANAGER::DestroyItem(LPITEM item, const char* file, size_t line) } else { - sys_log(2, "ITEM_DESTROY_SKIP %s:%u (skip=%d)", item->GetName(), dwID, item->GetSkipSave()); + SPDLOG_TRACE("ITEM_DESTROY_SKIP {}:{} (skip={})", item->GetName(), dwID, item->GetSkipSave()); } if (dwID) @@ -810,7 +806,7 @@ bool ITEM_MANAGER::GetDropPct(LPCHARACTER pkChr, LPCHARACTER pkKiller, OUT int& else if (1 == Random::get(1, 10000)) iDeltaPercent += 500; - sys_log(3, "CreateDropItem for level: %d rank: %u pct: %d", iLevel, bRank, iDeltaPercent); + SPDLOG_TRACE("CreateDropItem for level: {} rank: {} pct: {}", iLevel, bRank, iDeltaPercent); iDeltaPercent = iDeltaPercent * CHARACTER_MANAGER::instance().GetMobItemRate(pkKiller) / 100; //if (pkKiller->GetPoint(POINT_MALL_ITEMBONUS) > 0) @@ -862,7 +858,7 @@ bool ITEM_MANAGER::CreateDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, std:: continue; int iPercent = (c_rInfo.m_iPercent * iDeltaPercent) / 100; - sys_log(3, "CreateDropItem %d ~ %d %d(%d)", c_rInfo.m_iLevelStart, c_rInfo.m_iLevelEnd, c_rInfo.m_dwVnum, iPercent, c_rInfo.m_iPercent); + SPDLOG_TRACE("CreateDropItem {} ~ {} {}({})", c_rInfo.m_iLevelStart, c_rInfo.m_iLevelEnd, c_rInfo.m_dwVnum, iPercent, c_rInfo.m_iPercent); if (iPercent >= Random::get(1, iRandRange)) { @@ -1035,7 +1031,7 @@ bool ITEM_MANAGER::CreateDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, std:: if (pkKiller->IsHorseRiding() && GetDropPerKillPct(1000, 1000000, iDeltaPercent, "horse_skill_book_drop") >= Random::get(1, iRandRange)) { - sys_log(0, "EVENT HORSE_SKILL_BOOK_DROP"); + SPDLOG_DEBUG("EVENT HORSE_SKILL_BOOK_DROP"); if ((item = CreateItem(ITEM_HORSE_SKILL_TRAIN_BOOK, 1, 0, true))) vec_item.push_back(item); @@ -1227,9 +1223,9 @@ bool DropEvent_CharStone_SetValue(const std::string& name, int value) gs_dropEvent_charStone.alive = value; if (value) - sys_log(0, "dropevent.drop_char_stone = on"); + SPDLOG_DEBUG("dropevent.drop_char_stone = on"); else - sys_log(0, "dropevent.drop_char_stone = off"); + SPDLOG_DEBUG("dropevent.drop_char_stone = off"); } else if (name == "drop_char_stone.percent_lv01_10") @@ -1243,11 +1239,11 @@ bool DropEvent_CharStone_SetValue(const std::string& name, int value) else return false; - sys_log(0, "dropevent.drop_char_stone: %d", gs_dropEvent_charStone.alive ? true : false); - sys_log(0, "dropevent.drop_char_stone.percent_lv01_10: %f", gs_dropEvent_charStone.percent_lv01_10/100.0f); - sys_log(0, "dropevent.drop_char_stone.percent_lv11_30: %f", gs_dropEvent_charStone.percent_lv11_30/100.0f); - sys_log(0, "dropevent.drop_char_stone.percent_lv31_MX: %f", gs_dropEvent_charStone.percent_lv31_MX/100.0f); - sys_log(0, "dropevent.drop_char_stone.level_range: %d", gs_dropEvent_charStone.level_range); + SPDLOG_DEBUG("dropevent.drop_char_stone: {}", gs_dropEvent_charStone.alive ? true : false); + SPDLOG_DEBUG("dropevent.drop_char_stone.percent_lv01_10: {}", gs_dropEvent_charStone.percent_lv01_10/100.0f); + SPDLOG_DEBUG("dropevent.drop_char_stone.percent_lv11_30: {}", gs_dropEvent_charStone.percent_lv11_30/100.0f); + SPDLOG_DEBUG("dropevent.drop_char_stone.percent_lv31_MX: {}", gs_dropEvent_charStone.percent_lv31_MX/100.0f); + SPDLOG_DEBUG("dropevent.drop_char_stone.level_range: {}", gs_dropEvent_charStone.level_range); return true; } @@ -1355,9 +1351,9 @@ bool DropEvent_RefineBox_SetValue(const std::string& name, int value) gs_dropEvent_refineBox.alive = value; if (value) - sys_log(0, "refine_box_drop = on"); + SPDLOG_DEBUG("refine_box_drop = on"); else - sys_log(0, "refine_box_drop = off"); + SPDLOG_DEBUG("refine_box_drop = off"); } else if (name == "refine_box_low") @@ -1371,11 +1367,10 @@ bool DropEvent_RefineBox_SetValue(const std::string& name, int value) else return false; - sys_log(0, "refine_box_drop: %d", gs_dropEvent_refineBox.alive ? true : false); - sys_log(0, "refine_box_low: %d", gs_dropEvent_refineBox.percent_low); - sys_log(0, "refine_box_mid: %d", gs_dropEvent_refineBox.percent_mid); - sys_log(0, "refine_box_high: %d", gs_dropEvent_refineBox.percent_high); - //sys_log(0, "refine_box_low_level_range: %d", gs_dropEvent_refineBox.level_range); + SPDLOG_DEBUG("refine_box_drop: {}", gs_dropEvent_refineBox.alive ? true : false); + SPDLOG_DEBUG("refine_box_low: {}", gs_dropEvent_refineBox.percent_low); + SPDLOG_DEBUG("refine_box_mid: {}", gs_dropEvent_refineBox.percent_mid); + SPDLOG_DEBUG("refine_box_high: {}", gs_dropEvent_refineBox.percent_high); return true; } @@ -1392,7 +1387,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, if (!pkKiller) return; - sys_log(1, "CreateQuestDropItem victim(%s), killer(%s)", pkChr->GetName(), pkKiller->GetName() ); + SPDLOG_DEBUG("CreateQuestDropItem victim({}), killer({})", pkChr->GetName(), pkKiller->GetName() ); // DROPEVENT_CHARSTONE __DropEvent_CharStone_DropItem(*pkKiller, *pkChr, *this, vec_item); @@ -1432,7 +1427,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, iPercent *= 10; } - sys_log(0, "SOCK DROP %d %d", iPercent, iRandRange); + SPDLOG_DEBUG("SOCK DROP {} {}", iPercent, iRandRange); if (iPercent >= Random::get(1, iRandRange)) { if ((item = CreateItem(SOCK_ITEM_VNUM, 1, 0, true))) @@ -1490,7 +1485,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, //À°°¢º¸ÇÕ if (GetDropPerKillPct(100, g_iUseLocale ? 2000 : 800, iDeltaPercent, "2006_drop") >= Random::get(1, iRandRange)) { - sys_log(0, "À°°¢º¸ÇÕ DROP EVENT "); + SPDLOG_DEBUG("À°°¢º¸ÇÕ DROP EVENT "); const static DWORD dwVnum = 50037; @@ -1502,7 +1497,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, //À°°¢º¸ÇÕ+ if (GetDropPerKillPct(100, g_iUseLocale ? 2000 : 800, iDeltaPercent, "2007_drop") >= Random::get(1, iRandRange)) { - sys_log(0, "À°°¢º¸ÇÕ DROP EVENT "); + SPDLOG_DEBUG("À°°¢º¸ÇÕ DROP EVENT "); const static DWORD dwVnum = 50043; @@ -1523,7 +1518,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, // »õÇØ ´ëº¸¸§ ¿ø¼Ò À̺¥Æ® if (GetDropPerKillPct(100, 500, iDeltaPercent, "newyear_moon") >= Random::get(1, iRandRange)) { - sys_log(0, "EVENT NEWYEAR_MOON DROP"); + SPDLOG_DEBUG("EVENT NEWYEAR_MOON DROP"); const static DWORD wonso_items[6] = { 50016, 50017, 50018, 50019, 50019, 50019, }; DWORD dwVnum = wonso_items[Random::get(0, 5)]; @@ -1535,7 +1530,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, // ¹ß·»Å¸ÀÎ µ¥ÀÌ À̺¥Æ®. OGEÀÇ ¿ä±¸¿¡ µû¶ó event ÃÖ¼Ò°ªÀ» 1·Î º¯°æ.(´Ù¸¥ À̺¥Æ®´Â ÀÏ´Ü ±×´ë·Î µÒ.) if (GetDropPerKillPct(1, g_iUseLocale ? 2000 : 800, iDeltaPercent, "valentine_drop") >= Random::get(1, iRandRange)) { - sys_log(0, "EVENT VALENTINE_DROP"); + SPDLOG_DEBUG("EVENT VALENTINE_DROP"); const static DWORD valentine_items[2] = { 50024, 50025 }; DWORD dwVnum = valentine_items[Random::get(0, 1)]; @@ -1610,7 +1605,7 @@ void ITEM_MANAGER::CreateQuestDropItem(LPCHARACTER pkChr, LPCHARACTER pkKiller, // È­ÀÌÆ® µ¥ÀÌ À̺¥Æ® if (GetDropPerKillPct(100, g_iUseLocale ? 2000 : 800, iDeltaPercent, "whiteday_drop") >= Random::get(1, iRandRange)) { - sys_log(0, "EVENT WHITEDAY_DROP"); + SPDLOG_DEBUG("EVENT WHITEDAY_DROP"); const static DWORD whiteday_items[2] = { ITEM_WHITEDAY_ROSE, ITEM_WHITEDAY_CANDY }; DWORD dwVnum = whiteday_items[Random::get(0, 1)]; diff --git a/src/game/src/item_manager_idrange.cpp b/src/game/src/item_manager_idrange.cpp index 55c6fa1..21f1fcf 100644 --- a/src/game/src/item_manager_idrange.cpp +++ b/src/game/src/item_manager_idrange.cpp @@ -9,7 +9,7 @@ int touch(const char *path) if ( !(fp = fopen(path, "a")) ) { - sys_err("touch failed"); + SPDLOG_ERROR("touch failed"); return (-1); } @@ -25,14 +25,14 @@ DWORD ITEM_MANAGER::GetNewID() { if ( m_ItemIDSpareRange.dwMin == 0 || m_ItemIDSpareRange.dwMax == 0 || m_ItemIDSpareRange.dwUsableItemIDMin == 0 ) { - for ( int i=0; i < 10; i++ ) sys_err("ItemIDRange: FATAL ERROR!!! no more item id"); + for ( int i=0; i < 10; i++ ) SPDLOG_ERROR("ItemIDRange: FATAL ERROR!!! no more item id"); touch(".killscript"); thecore_shutdown(); return 0; } else { - sys_log(0, "ItemIDRange: First Range is full. Change to SpareRange %u ~ %u %u", + SPDLOG_WARN("ItemIDRange: First Range is full. Change to SpareRange {} ~ {} {}", m_ItemIDSpareRange.dwMin, m_ItemIDSpareRange.dwMax, m_ItemIDSpareRange.dwUsableItemIDMin); db_clientdesc->DBPacket(HEADER_GD_REQ_SPARE_ITEM_ID_RANGE, 0, &m_ItemIDRange.dwMax, sizeof(DWORD)); @@ -54,7 +54,7 @@ bool ITEM_MANAGER::SetMaxItemID(TItemIDRangeTable range) if ( m_ItemIDRange.dwMin == 0 || m_ItemIDRange.dwMax == 0 || m_ItemIDRange.dwUsableItemIDMin == 0 ) { - for ( int i=0; i < 10; i++ ) sys_err("ItemIDRange: FATAL ERROR!!! ITEM ID RANGE is not set."); + for ( int i=0; i < 10; i++ ) SPDLOG_ERROR("ItemIDRange: FATAL ERROR!!! ITEM ID RANGE is not set."); touch(".killscript"); thecore_shutdown(); return false; @@ -62,7 +62,7 @@ bool ITEM_MANAGER::SetMaxItemID(TItemIDRangeTable range) m_dwCurrentID = range.dwUsableItemIDMin; - sys_log(0, "ItemIDRange: %u ~ %u %u", m_ItemIDRange.dwMin, m_ItemIDRange.dwMax, m_dwCurrentID); + SPDLOG_DEBUG("ItemIDRange: {} ~ {} {}", m_ItemIDRange.dwMin, m_ItemIDRange.dwMax, m_dwCurrentID); return true; } @@ -71,13 +71,13 @@ bool ITEM_MANAGER::SetMaxSpareItemID(TItemIDRangeTable range) { if ( range.dwMin == 0 || range.dwMax == 0 || range.dwUsableItemIDMin == 0 ) { - for ( int i=0; i < 10; i++ ) sys_err("ItemIDRange: FATAL ERROR!!! Spare ITEM ID RANGE is not set"); + for ( int i=0; i < 10; i++ ) SPDLOG_ERROR("ItemIDRange: FATAL ERROR!!! Spare ITEM ID RANGE is not set"); return false; } m_ItemIDSpareRange = range; - sys_log(0, "ItemIDRange: New Spare ItemID Range Recv %u ~ %u %u", + SPDLOG_DEBUG("ItemIDRange: New Spare ItemID Range Recv {} ~ {} {}", m_ItemIDSpareRange.dwMin, m_ItemIDSpareRange.dwMax, m_ItemIDSpareRange.dwUsableItemIDMin); return true; diff --git a/src/game/src/item_manager_read_tables.cpp b/src/game/src/item_manager_read_tables.cpp index 3bb2ff8..819be0c 100644 --- a/src/game/src/item_manager_read_tables.cpp +++ b/src/game/src/item_manager_read_tables.cpp @@ -13,7 +13,6 @@ #include "unique_item.h" #include "safebox.h" #include "blend_item.h" -#include "dev_log.h" #include "locale_service.h" #include "item.h" #include "item_manager.h" @@ -28,7 +27,7 @@ bool ITEM_MANAGER::ReadCommonDropItemFile(const char * c_pszFileName) if (!fp) { - sys_err("Cannot open %s", c_pszFileName); + SPDLOG_ERROR("Cannot open {}", c_pszFileName); return false; } @@ -83,7 +82,7 @@ bool ITEM_MANAGER::ReadCommonDropItemFile(const char * c_pszFileName) str_to_number(dwItemVnum, d[i].szItemName); if (!ITEM_MANAGER::instance().GetTable(dwItemVnum)) { - sys_err("No such an item (name: %s)", d[i].szItemName); + SPDLOG_ERROR("No such an item (name: {})", d[i].szItemName); fclose(fp); return false; } @@ -105,12 +104,12 @@ bool ITEM_MANAGER::ReadCommonDropItemFile(const char * c_pszFileName) std::vector::iterator it = v.begin(); - sys_log(1, "CommonItemDrop rank %d", i); + SPDLOG_DEBUG("CommonItemDrop rank {}", i); while (it != v.end()) { const CItemDropInfo & c = *(it++); - sys_log(1, "CommonItemDrop %d %d %d %u", c.m_iLevelStart, c.m_iLevelEnd, c.m_iPercent, c.m_dwVnum); + SPDLOG_TRACE("CommonItemDrop {} {} {} {}", c.m_iLevelStart, c.m_iLevelEnd, c.m_iPercent, c.m_dwVnum); } } @@ -136,12 +135,12 @@ bool ITEM_MANAGER::ReadSpecialDropItemFile(const char * c_pszFileName) if (!loader.GetTokenInteger("vnum", &iVnum)) { - sys_err("ReadSpecialDropItemFile : Syntax error %s : no vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadSpecialDropItemFile : Syntax error {} : no vnum, node {}", c_pszFileName, stName); loader.SetParentNode(); return false; } - sys_log(0,"DROP_ITEM_GROUP %s %d", stName.c_str(), iVnum); + SPDLOG_DEBUG("DROP_ITEM_GROUP {} {}", stName, iVnum); TTokenVector * pTok; @@ -184,14 +183,14 @@ bool ITEM_MANAGER::ReadSpecialDropItemFile(const char * c_pszFileName) apply_type = FN_get_apply_type(pTok->at(0).c_str()); if (0 == apply_type) { - sys_err ("Invalid APPLY_TYPE %s in Special Item Group Vnum %d", pTok->at(0).c_str(), iVnum); + SPDLOG_ERROR("Invalid APPLY_TYPE {} in Special Item Group Vnum {}", pTok->at(0).c_str(), iVnum); return false; } } str_to_number(apply_value, pTok->at(1).c_str()); if (apply_type > MAX_APPLY_NUM) { - sys_err ("Invalid APPLY_TYPE %u in Special Item Group Vnum %d", apply_type, iVnum); + SPDLOG_ERROR("Invalid APPLY_TYPE {} in Special Item Group Vnum {}", apply_type, iVnum); M2_DELETE(pkGroup); return false; } @@ -253,7 +252,7 @@ bool ITEM_MANAGER::ReadSpecialDropItemFile(const char * c_pszFileName) str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { - sys_err("ReadSpecialDropItemFile : there is no item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadSpecialDropItemFile : there is no item {} : node {}", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; @@ -272,7 +271,7 @@ bool ITEM_MANAGER::ReadSpecialDropItemFile(const char * c_pszFileName) str_to_number(iRarePct, pTok->at(3).c_str()); } - sys_log(0," name %s count %d prob %d rare %d", name.c_str(), iCount, iProb, iRarePct); + SPDLOG_TRACE(" name {} count {} prob {} rare {}", name.c_str(), iCount, iProb, iRarePct); pkGroup->AddItem(dwVnum, iCount, iProb, iRarePct); // CHECK_UNIQUE_GROUP @@ -312,7 +311,7 @@ bool ITEM_MANAGER::ConvSpecialDropItemFile() FILE *fp = fopen("special_item_group_vnum.txt", "w"); if (!fp) { - sys_err("could not open file (%s)", "special_item_group_vnum.txt"); + SPDLOG_ERROR("could not open file ({})", "special_item_group_vnum.txt"); return false; } @@ -336,7 +335,7 @@ bool ITEM_MANAGER::ConvSpecialDropItemFile() if (!loader.GetTokenInteger("vnum", &iVnum)) { - sys_err("ConvSpecialDropItemFile : Syntax error %s : no vnum, node %s", szSpecialItemGroupFileName, stName.c_str()); + SPDLOG_ERROR("ConvSpecialDropItemFile : Syntax error {} : no vnum, node {}", szSpecialItemGroupFileName, stName.c_str()); loader.SetParentNode(); fclose(fp); return false; @@ -387,7 +386,7 @@ bool ITEM_MANAGER::ConvSpecialDropItemFile() str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { - sys_err("ReadSpecialDropItemFile : there is no item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadSpecialDropItemFile : there is no item {} : node {}", name.c_str(), stName.c_str()); fclose(fp); return false; @@ -433,7 +432,7 @@ bool ITEM_MANAGER::ReadEtcDropItemFile(const char * c_pszFileName) if (!fp) { - sys_err("Cannot open %s", c_pszFileName); + SPDLOG_ERROR("Cannot open {}", c_pszFileName); return false; } @@ -467,13 +466,13 @@ bool ITEM_MANAGER::ReadEtcDropItemFile(const char * c_pszFileName) if (!ITEM_MANAGER::instance().GetVnumByOriginalName(szItemName, dwItemVnum)) { - sys_err("No such an item (name: %s)", szItemName); + SPDLOG_ERROR("No such an item (name: {})", szItemName); fclose(fp); return false; } m_map_dwEtcItemDropProb[dwItemVnum] = (DWORD) (fProb * 10000.0f); - sys_log(0, "ETC_DROP_ITEM: %s prob %f", szItemName, fProb); + SPDLOG_DEBUG("ETC_DROP_ITEM: {} prob {}", szItemName, fProb); } fclose(fp); @@ -515,14 +514,14 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) if (!loader.GetTokenString("type", &strType)) { - sys_err("ReadMonsterDropItemGroup : Syntax error %s : no type (kill|drop), node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadMonsterDropItemGroup : Syntax error {} : no type (kill|drop), node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); return false; } if (!loader.GetTokenInteger("mob", &iMobVnum)) { - sys_err("ReadMonsterDropItemGroup : Syntax error %s : no mob vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadMonsterDropItemGroup : Syntax error {} : no mob vnum, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); return false; } @@ -531,7 +530,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) { if (!loader.GetTokenInteger("kill_drop", &iKillDrop)) { - sys_err("ReadMonsterDropItemGroup : Syntax error %s : no kill drop count, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadMonsterDropItemGroup : Syntax error {} : no kill drop count, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); return false; } @@ -545,7 +544,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) { if ( !loader.GetTokenInteger("level_limit", &iLevelLimit) ) { - sys_err("ReadmonsterDropItemGroup : Syntax error %s : no level_limit, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadmonsterDropItemGroup : Syntax error {} : no level_limit, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); return false; } @@ -555,7 +554,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) iLevelLimit = 0; } - sys_log(0,"MOB_ITEM_GROUP %s [%s] %d %d", stName.c_str(), strType.c_str(), iMobVnum, iKillDrop); + SPDLOG_DEBUG("MOB_ITEM_GROUP {} [{}] {} {}", stName.c_str(), strType.c_str(), iMobVnum, iKillDrop); if (iKillDrop == 0) { @@ -576,7 +575,6 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) if (loader.GetTokenVector(buf, &pTok)) { - //sys_log(1, " %s %s", pTok->at(0).c_str(), pTok->at(1).c_str()); std::string& name = pTok->at(0); DWORD dwVnum = 0; @@ -585,7 +583,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { - sys_err("ReadMonsterDropItemGroup : there is no item %s : node %s : vnum %d", name.c_str(), stName.c_str(), dwVnum); + SPDLOG_ERROR("ReadMonsterDropItemGroup : there is no item {} : node {} : vnum {}", name.c_str(), stName.c_str(), dwVnum); return false; } } @@ -595,7 +593,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) if (iCount<1) { - sys_err("ReadMonsterDropItemGroup : there is no count for item %s : node %s : vnum %d, count %d", name.c_str(), stName.c_str(), dwVnum, iCount); + SPDLOG_ERROR("ReadMonsterDropItemGroup : there is no count for item {} : node {} : vnum {}, count {}", name.c_str(), stName.c_str(), dwVnum, iCount); return false; } @@ -604,7 +602,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) if (iPartPct == 0) { - sys_err("ReadMonsterDropItemGroup : there is no drop percent for item %s : node %s : vnum %d, count %d, pct %d", name.c_str(), stName.c_str(), iPartPct); + SPDLOG_ERROR("ReadMonsterDropItemGroup : there is no drop percent for item {} : node {} : vnum {}, count {}, pct {}", name.c_str(), stName.c_str(), iPartPct); return false; } @@ -612,7 +610,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) str_to_number(iRarePct, pTok->at(3).c_str()); iRarePct = std::clamp(iRarePct, 0, 100); - sys_log(0," %s count %d rare %d", name.c_str(), iCount, iRarePct); + SPDLOG_TRACE(" {} count {} rare {}", name.c_str(), iCount, iRarePct); pkGroup->AddItem(dwVnum, iCount, iPartPct, iRarePct); continue; } @@ -652,7 +650,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { - sys_err("ReadDropItemGroup : there is no item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadDropItemGroup : there is no item {} : node {}", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; @@ -664,7 +662,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) if (iCount < 1) { - sys_err("ReadMonsterDropItemGroup : there is no count for item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadMonsterDropItemGroup : there is no count for item {} : node {}", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; @@ -674,7 +672,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) DWORD dwPct = (DWORD)(10000.0f * fPercent); - sys_log(0," name %s pct %d count %d", name.c_str(), dwPct, iCount); + SPDLOG_TRACE(" name {} pct {} count {}", name.c_str(), dwPct, iCount); pkGroup->AddItem(dwVnum, dwPct, iCount); continue; @@ -751,7 +749,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { - sys_err("ReadDropItemGroup : there is no item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadDropItemGroup : there is no item {} : node {}", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; @@ -763,7 +761,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) if (iCount < 1) { - sys_err("ReadMonsterDropItemGroup : there is no count for item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadMonsterDropItemGroup : there is no count for item {} : node {}", name.c_str(), stName.c_str()); M2_DELETE(pkGroup); return false; @@ -773,7 +771,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) DWORD dwPct = (DWORD)(10000.0f * fPercent); - sys_log(0," name %s pct %d count %d", name.c_str(), dwPct, iCount); + SPDLOG_TRACE(" name {} pct {} count {}", name.c_str(), dwPct, iCount); pkGroup->AddItem(dwVnum, dwPct, iCount); continue; @@ -786,7 +784,7 @@ bool ITEM_MANAGER::ReadMonsterDropItemGroup(const char * c_pszFileName) } else { - sys_err("ReadMonsterDropItemGroup : Syntax error %s : invalid type %s (kill|drop), node %s", c_pszFileName, strType.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadMonsterDropItemGroup : Syntax error {} : invalid type {} (kill|drop), node {}", c_pszFileName, strType.c_str(), stName.c_str()); loader.SetParentNode(); return false; } @@ -817,19 +815,19 @@ bool ITEM_MANAGER::ReadDropItemGroup(const char * c_pszFileName) if (!loader.GetTokenInteger("vnum", &iVnum)) { - sys_err("ReadDropItemGroup : Syntax error %s : no vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadDropItemGroup : Syntax error {} : no vnum, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); return false; } if (!loader.GetTokenInteger("mob", &iMobVnum)) { - sys_err("ReadDropItemGroup : Syntax error %s : no mob vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("ReadDropItemGroup : Syntax error {} : no mob vnum, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); return false; } - sys_log(0,"DROP_ITEM_GROUP %s %d", stName.c_str(), iMobVnum); + SPDLOG_DEBUG("DROP_ITEM_GROUP {} {}", stName.c_str(), iMobVnum); TTokenVector * pTok; @@ -857,7 +855,7 @@ bool ITEM_MANAGER::ReadDropItemGroup(const char * c_pszFileName) str_to_number(dwVnum, name.c_str()); if (!ITEM_MANAGER::instance().GetTable(dwVnum)) { - sys_err("ReadDropItemGroup : there is no item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadDropItemGroup : there is no item {} : node {}", name.c_str(), stName.c_str()); if (it == m_map_pkDropItemGroup.end()) M2_DELETE(pkGroup); @@ -876,7 +874,7 @@ bool ITEM_MANAGER::ReadDropItemGroup(const char * c_pszFileName) if (iCount < 1) { - sys_err("ReadDropItemGroup : there is no count for item %s : node %s", name.c_str(), stName.c_str()); + SPDLOG_ERROR("ReadDropItemGroup : there is no count for item {} : node {}", name.c_str(), stName.c_str()); if (it == m_map_pkDropItemGroup.end()) M2_DELETE(pkGroup); @@ -884,7 +882,7 @@ bool ITEM_MANAGER::ReadDropItemGroup(const char * c_pszFileName) return false; } - sys_log(0," %s %d %d", name.c_str(), dwPct, iCount); + SPDLOG_TRACE(" {} {} {}", name.c_str(), dwPct, iCount); pkGroup->AddItem(dwVnum, dwPct, iCount); continue; } diff --git a/src/game/src/locale.cpp b/src/game/src/locale.cpp index d46c7e4..74397a7 100644 --- a/src/game/src/locale.cpp +++ b/src/game/src/locale.cpp @@ -32,7 +32,7 @@ const char * locale_find(const char *string) static char s_line[1024] = "@0949"; strlcpy(s_line + 5, string, sizeof(s_line) - 5); - sys_err("LOCALE_ERROR: \"%s\";", string); + SPDLOG_ERROR("LOCALE_ERROR: \"{}\";", string); return s_line; } @@ -157,8 +157,8 @@ void locale_init(const char *filename) if (!buf) { - sys_err("locale_read: no file %s", filename); - exit(1); + SPDLOG_ERROR("locale_read: no file {}", filename); + exit(EXIT_FAILURE); } tmp = buf; @@ -185,7 +185,7 @@ void locale_init(const char *filename) if (*tmp != '"') { - sys_err("locale_init: invalid format filename %s", filename); + SPDLOG_ERROR("locale_init: invalid format filename {}", filename); break; } } diff --git a/src/game/src/locale_service.cpp b/src/game/src/locale_service.cpp index b5c5919..4b3b7cf 100644 --- a/src/game/src/locale_service.cpp +++ b/src/game/src/locale_service.cpp @@ -67,10 +67,7 @@ int is_twobyte_big5(const char * str) if ((b12 < 0xa440 || b12 > 0xc67e) && (b12 < 0xc940 || b12 > 0xf9d5)) { - if (test_server) - { - sys_log(0, "twobyte_big5 %x %x", b1, b2); - } + SPDLOG_TRACE("twobyte_big5 {} {}", b1, b2); return 0; } @@ -204,9 +201,7 @@ int check_name_big5(const char * str ) if ((b12 < 0xa440 || b12 > 0xc67e) && (b12 < 0xc940 || b12 > 0xf9d5)) { - if (test_server) - sys_log(0, "check_name_big5[%d][%s] %x %x %x", i - 2, str, b1, b2, b12); - + SPDLOG_TRACE("check_name_big5[{}][{}] {} {} {}", i - 2, str, b1, b2, b12); return 0; } } @@ -377,7 +372,7 @@ void LocaleService_LoadLocaleStringFile() if (g_bAuthServer) return; - fprintf(stderr, "LocaleService %s\n", g_stLocaleFilename.c_str()); + SPDLOG_INFO("LocaleService {}", g_stLocaleFilename); locale_init(g_stLocaleFilename.c_str()); } @@ -389,7 +384,7 @@ void LocaleService_LoadEmpireTextConvertTables() for (int iEmpire = 1; iEmpire <= 3; ++iEmpire) { snprintf(szFileName, sizeof(szFileName), "%s/lang%d.cvt", LocaleService_GetBasePath().c_str(), iEmpire); - sys_log(0, "Load %s", szFileName); + SPDLOG_INFO("Load {}", szFileName); LoadEmpireTextConvertTable(iEmpire, szFileName); } @@ -987,8 +982,8 @@ static void __CheckPlayerSlot(const std::string& service_name) { if (PLAYER_PER_ACCOUNT != 4) { - printf(" PLAYER_PER_ACCOUNT = %d\n", PLAYER_PER_ACCOUNT); - exit(0); + SPDLOG_CRITICAL(" PLAYER_PER_ACCOUNT = {}", (int) PLAYER_PER_ACCOUNT); + exit(EXIT_FAILURE); } } @@ -996,7 +991,7 @@ bool LocaleService_Init(const std::string& c_rstServiceName) { if (!g_stServiceName.empty()) { - sys_err("ALREADY exist service"); + SPDLOG_ERROR("ALREADY exist service"); return false; } @@ -1139,7 +1134,7 @@ bool LocaleService_Init(const std::string& c_rstServiceName) __LocaleService_Init_DEFAULT(); } - fprintf(stdout, "Setting Locale \"%s\" (Path: %s)\n", g_stServiceName.c_str(), g_stServiceBasePath.c_str()); + SPDLOG_INFO("Setting Locale \"{}\" (Path: {})", g_stServiceName.c_str(), g_stServiceBasePath.c_str()); __CheckPlayerSlot(g_stServiceName); @@ -1161,7 +1156,7 @@ void LocaleService_TransferDefaultSetting() exp_table = exp_table_common; if (!CTableBySkill::instance().Check()) - exit(1); + exit(EXIT_FAILURE); if (!aiPercentByDeltaLevForBoss) aiPercentByDeltaLevForBoss = aiPercentByDeltaLevForBoss_euckr; diff --git a/src/game/src/log.cpp b/src/game/src/log.cpp index a7c48dc..f462170 100644 --- a/src/game/src/log.cpp +++ b/src/game/src/log.cpp @@ -35,8 +35,7 @@ void LogManager::Query(const char * c_pszFormat, ...) vsnprintf(szQuery, sizeof(szQuery), c_pszFormat, args); va_end(args); - if (test_server) - sys_log(0, "LOG: %s", szQuery); + SPDLOG_TRACE("LOG: {}", szQuery); m_sql.AsyncQuery(szQuery); } @@ -58,7 +57,7 @@ void LogManager::ItemLog(LPCHARACTER ch, LPITEM item, const char * c_pszText, co { if (NULL == ch || NULL == item) { - sys_err("character or item nil (ch %p item %p text %s)", get_pointer(ch), get_pointer(item), c_pszText); + SPDLOG_ERROR("character or item nil (ch {} item {} text {})", (void*) get_pointer(ch), (void*) get_pointer(item), c_pszText); return; } @@ -99,7 +98,7 @@ void LogManager::MoneyLog(BYTE type, DWORD vnum, int gold) { if (type == MONEY_LOG_RESERVED || type >= MONEY_LOG_TYPE_MAX_NUM) { - sys_err("TYPE ERROR: type %d vnum %u gold %d", type, vnum, gold); + SPDLOG_ERROR("TYPE ERROR: type {} vnum {} gold {}", type, vnum, gold); return; } diff --git a/src/game/src/login_data.cpp b/src/game/src/login_data.cpp index 94f2b6c..6031e13 100644 --- a/src/game/src/login_data.cpp +++ b/src/game/src/login_data.cpp @@ -92,7 +92,7 @@ const char * CLoginData::GetIP() void CLoginData::SetRemainSecs(int l) { m_lRemainSecs = l; - sys_log(0, "SetRemainSecs %s %d type %u", m_stLogin.c_str(), m_lRemainSecs, m_bBillType); + SPDLOG_DEBUG("SetRemainSecs {} {} type {}", m_stLogin, m_lRemainSecs, m_bBillType); } int CLoginData::GetRemainSecs() @@ -104,11 +104,11 @@ void CLoginData::SetBilling(bool bOn) { if (bOn) { - sys_log(0, "BILLING: ON %s key %u ptr %p", m_stLogin.c_str(), m_dwKey, this); + SPDLOG_DEBUG("BILLING: ON {} key {} ptr {}", m_stLogin, m_dwKey, (void*) this); SetLogonTime(); } else - sys_log(0, "BILLING: OFF %s key %u ptr %p", m_stLogin.c_str(), m_dwKey, this); + SPDLOG_DEBUG("BILLING: OFF {} key {} ptr {}", m_stLogin, m_dwKey, (void*) this); m_bBilling = bOn; } diff --git a/src/game/src/login_sim.h b/src/game/src/login_sim.h index 36f93bb..6d47380 100644 --- a/src/game/src/login_sim.h +++ b/src/game/src/login_sim.h @@ -19,7 +19,7 @@ class CLoginSim void AddPlayer(DWORD dwID) { vecID.push_back(dwID); - sys_log(0, "AddPlayer %lu", dwID); + SPDLOG_DEBUG("AddPlayer {}", dwID); } bool IsCheck() diff --git a/src/game/src/lzo_manager.cpp b/src/game/src/lzo_manager.cpp index 872d23d..a142b8e 100644 --- a/src/game/src/lzo_manager.cpp +++ b/src/game/src/lzo_manager.cpp @@ -5,7 +5,7 @@ LZOManager::LZOManager() { if (lzo_init() != LZO_E_OK) { - fprintf(stderr, "lzo_init() failed\n"); + SPDLOG_CRITICAL("lzo_init() failed"); abort(); } diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index f05b915..7284f2c 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -152,9 +152,9 @@ void ContinueOnFatalError() free(symbols); - sys_err("FatalError on %s", oss.str().c_str()); + SPDLOG_ERROR("FatalError on {}", oss.str().c_str()); #else - sys_err("FatalError"); + SPDLOG_ERROR("FatalError"); #endif } @@ -572,11 +572,11 @@ int start(int argc, char **argv) case '?': if (strchr("Ipln", optopt)) - fprintf(stderr, "Option -%c requires an argument.\n", optopt); + SPDLOG_ERROR("Option -{} requires an argument.", optopt); else if (isprint (optopt)) - fprintf(stderr, "Unknown option `-%c'.\n", optopt); + SPDLOG_ERROR("Unknown option `-{}'.", optopt); else - fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); + SPDLOG_ERROR("Unknown option character `\\x{}'.", optopt); default: usage(); return 1; diff --git a/src/game/src/map_location.cpp b/src/game/src/map_location.cpp index 5d8a835..3aafbb7 100644 --- a/src/game/src/map_location.cpp +++ b/src/game/src/map_location.cpp @@ -18,7 +18,7 @@ bool CMapLocation::Get(int iIndex, LONG & lAddr, WORD & wPort) { if (iIndex == 0) { - sys_log(0, "CMapLocation::Get - Error MapIndex[%d]", iIndex); + SPDLOG_ERROR("CMapLocation::Get - Error MapIndex[{}]", iIndex); return false; } @@ -26,11 +26,11 @@ bool CMapLocation::Get(int iIndex, LONG & lAddr, WORD & wPort) if (m_map_address.end() == it) { - sys_log(0, "CMapLocation::Get - Error MapIndex[%d]", iIndex); + SPDLOG_ERROR("CMapLocation::Get - Error MapIndex[{}]", iIndex); std::map::iterator i; for ( i = m_map_address.begin(); i != m_map_address.end(); ++i) { - sys_log(0, "Map(%d): Server(%x:%d)", i->first, i->second.addr, i->second.port); + SPDLOG_ERROR("Map({}): Server({}:{})", i->first, i->second.addr, i->second.port); } return false; } @@ -48,6 +48,6 @@ void CMapLocation::Insert(int lIndex, const char * c_pszHost, WORD wPort) loc.port = wPort; m_map_address.insert(std::make_pair(lIndex, loc)); - sys_log(0, "MapLocation::Insert : %d %s %d", lIndex, c_pszHost, wPort); + SPDLOG_DEBUG("MapLocation::Insert : {} {} {}", lIndex, c_pszHost, wPort); } diff --git a/src/game/src/marriage.cpp b/src/game/src/marriage.cpp index 6e910fa..dade791 100644 --- a/src/game/src/marriage.cpp +++ b/src/game/src/marriage.cpp @@ -253,7 +253,7 @@ namespace marriage { d1->ChatPacket(CHAT_TYPE_COMMAND, "lover_login"); d2->ChatPacket(CHAT_TYPE_COMMAND, "lover_login"); - sys_log(0, "lover_login %u %u", m_pid1, m_pid2); + SPDLOG_DEBUG("lover_login {} {}", m_pid1, m_pid2); } } } @@ -329,7 +329,7 @@ namespace marriage StopNearCheckEvent(); return; } - sys_log(0, "NearCheck %u %u %d %d %d", m_pid1, m_pid2, IsNear(), isLastNear, byLastLovePoint, GetMarriagePoint()); + SPDLOG_DEBUG("NearCheck {} {} {} {} {}", m_pid1, m_pid2, IsNear(), isLastNear, byLastLovePoint, GetMarriagePoint()); if (IsNear() && !isLastNear) { @@ -372,7 +372,7 @@ namespace marriage if ( info == NULL ) { - sys_err( "near_check_event> Null pointer" ); + SPDLOG_ERROR("near_check_event> Null pointer" ); return 0; } @@ -399,7 +399,7 @@ namespace marriage void TMarriage::Save() { - sys_log(0, "TMarriage::Save() - RequestUpdate.bSave=%d", bSave); + SPDLOG_DEBUG("TMarriage::Save() - RequestUpdate.bSave={}", bSave); if (bSave) { CManager::instance().RequestUpdate(m_pid1, m_pid2, love_point, is_married); @@ -459,7 +459,7 @@ namespace marriage PIXEL_POSITION pos; if (!SECTREE_MANAGER::instance().GetRecallPositionByEmpire(pWeddingInfo->dwMapIndex/10000, 0, pos)) { - sys_err("cannot get warp position"); + SPDLOG_ERROR("cannot get warp position"); return; } ch->SaveExitLocation(); @@ -561,7 +561,7 @@ namespace marriage { if (IsEngagedOrMarried(dwPID1) || IsEngagedOrMarried(dwPID2)) { - sys_err("cannot marry already married character. %d - %d", dwPID1, dwPID2); + SPDLOG_ERROR("cannot marry already married character. {} - {}", dwPID1, dwPID2); return; } @@ -608,7 +608,7 @@ namespace marriage if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("not under marriage : %u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : {} {}", dwPID1, dwPID2); return; } @@ -631,7 +631,7 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("not under marriage : %u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : {} {}", dwPID1, dwPID2); return; } @@ -673,7 +673,7 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("wrong marriage %u, %u", dwPID1, dwPID2); + SPDLOG_ERROR("wrong marriage {}, {}", dwPID1, dwPID2); return; } @@ -694,7 +694,7 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("wrong marriage %u, %u", dwPID1, dwPID2); + SPDLOG_ERROR("wrong marriage {}, {}", dwPID1, dwPID2); return; } @@ -716,13 +716,13 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("wrong marriage %u, %u", dwPID1, dwPID2); + SPDLOG_ERROR("wrong marriage {}, {}", dwPID1, dwPID2); return; } if (!pMarriage->pWeddingInfo) { - sys_err("not under wedding %u, %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under wedding {}, {}", dwPID1, dwPID2); return; } @@ -730,7 +730,7 @@ namespace marriage if (map_allow_find(WEDDING_MAP_INDEX)) if (!WeddingManager::instance().End(pMarriage->pWeddingInfo->dwMapIndex)) { - sys_err("wedding map error: map_index=%d", pMarriage->pWeddingInfo->dwMapIndex); + SPDLOG_ERROR("wedding map error: map_index={}", pMarriage->pWeddingInfo->dwMapIndex); return; } diff --git a/src/game/src/matrix_card.cpp b/src/game/src/matrix_card.cpp index 9f38779..80212fa 100644 --- a/src/game/src/matrix_card.cpp +++ b/src/game/src/matrix_card.cpp @@ -89,7 +89,7 @@ bool ChkCoordinate(const unsigned int rows, const unsigned int cols, const char* if (max_lens != MAX_LENS || answer_lens != ASLENGTH) { - sys_err("MATRIX_CARD: length error matrix %d answer %d", max_lens, answer_lens); + SPDLOG_ERROR("MATRIX_CARD: length error matrix {} answer {}", max_lens, answer_lens); return false; } @@ -117,7 +117,7 @@ bool MatrixCardCheck(const char * src, const char * answer, unsigned int rows, u char decode_result[MAX_LENS+1]; DecodeMatrix(src, szpasswd, decode_result, sizeof(decode_result)); - sys_log(0, "MatrixCardCheck %c%d %c%d %c%d %c%d answer %s", + SPDLOG_DEBUG("MatrixCardCheck {}{} {}{} {}{} {}{} answer {}", MATRIX_CARD_ROW(rows, 0) + 'A', MATRIX_CARD_COL(cols, 0) + 1, MATRIX_CARD_ROW(rows, 1) + 'A', diff --git a/src/game/src/messenger_manager.cpp b/src/game/src/messenger_manager.cpp index 15b1e55..e30b7b5 100644 --- a/src/game/src/messenger_manager.cpp +++ b/src/game/src/messenger_manager.cpp @@ -62,7 +62,7 @@ void MessengerManager::LoadList(SQLMsg * msg) std::string account; - sys_log(1, "Messenger::LoadList"); + SPDLOG_DEBUG("Messenger::LoadList"); for (uint i = 0; i < msg->Get()->uiNumRows; ++i) { @@ -149,7 +149,7 @@ void MessengerManager::AuthToAdd(MessengerManager::keyA account, MessengerManage if (m_set_requestToAdd.find(dwComplex) == m_set_requestToAdd.end()) { - sys_log(0, "MessengerManager::AuthToAdd : request not exist %s -> %s", companion.c_str(), account.c_str()); + SPDLOG_ERROR("MessengerManager::AuthToAdd : request not exist {} -> {}", companion.c_str(), account.c_str()); return; } @@ -191,7 +191,7 @@ void MessengerManager::AddToList(MessengerManager::keyA account, MessengerManage if (m_Relation[account].find(companion) != m_Relation[account].end()) return; - sys_log(0, "Messenger Add %s %s", account.c_str(), companion.c_str()); + SPDLOG_DEBUG("Messenger Add {} {}", account.c_str(), companion.c_str()); DBManager::instance().Query("INSERT INTO messenger_list%s VALUES ('%s', '%s')", get_table_postfix(), account.c_str(), companion.c_str()); @@ -222,7 +222,7 @@ void MessengerManager::RemoveFromList(MessengerManager::keyA account, MessengerM if (companion.size() == 0) return; - sys_log(1, "Messenger Remove %s %s", account.c_str(), companion.c_str()); + SPDLOG_DEBUG("Messenger Remove {} {}", account.c_str(), companion.c_str()); DBManager::instance().Query("DELETE FROM messenger_list%s WHERE account='%s' AND companion = '%s'", get_table_postfix(), account.c_str(), companion.c_str()); diff --git a/src/game/src/mining.cpp b/src/game/src/mining.cpp index c702dfe..ba92d93 100644 --- a/src/game/src/mining.cpp +++ b/src/game/src/mining.cpp @@ -124,7 +124,7 @@ namespace mining if (iFractionCount == 0) { - sys_err("Wrong ore fraction count"); + SPDLOG_ERROR("Wrong ore fraction count"); return; } @@ -132,7 +132,7 @@ namespace mining if (!item) { - sys_err("cannot create item vnum %d", dwRawOreVnum); + SPDLOG_ERROR("cannot create item vnum {}", dwRawOreVnum); return; } @@ -231,7 +231,7 @@ namespace mining if (!Pick_Check(*item)) { - sys_err("REFINE_PICK_HACK pid(%u) item(%s:%d) type(%d)", ch->GetPlayerID(), item->GetName(), item->GetID(), item->GetType()); + SPDLOG_ERROR("REFINE_PICK_HACK pid({}) item({}:{}) type({})", ch->GetPlayerID(), item->GetName(), item->GetID(), item->GetType()); rkLogMgr.RefineLog(ch->GetPlayerID(), item->GetName(), item->GetID(), -1, 1, "PICK_HACK"); return 2; } @@ -338,7 +338,7 @@ namespace mining if ( info == NULL ) { - sys_err( "mining_event_info> Null pointer" ); + SPDLOG_ERROR("mining_event_info> Null pointer" ); return 0; } @@ -399,13 +399,13 @@ namespace mining if (item->GetOwner() != ch) { - sys_err("wrong owner"); + SPDLOG_ERROR("wrong owner"); return false; } if (item->GetCount() < ORE_COUNT_FOR_REFINE) { - sys_err("not enough count"); + SPDLOG_ERROR("not enough count"); return false; } diff --git a/src/game/src/mob_manager.cpp b/src/game/src/mob_manager.cpp index b8b157b..e6424a9 100644 --- a/src/game/src/mob_manager.cpp +++ b/src/game/src/mob_manager.cpp @@ -30,7 +30,7 @@ void CMob::AddSkillSplash(int iIndex, DWORD dwTiming, DWORD dwHitDistance) if (iIndex >= MOB_SKILL_MAX_NUM || iIndex < 0) return; - sys_log(0, "MOB_SPLASH %s idx %d timing %u hit_distance %u", + SPDLOG_TRACE("MOB_SPLASH {} idx {} timing {} hit_distance {}", m_table.szLocaleName, iIndex, dwTiming, dwHitDistance); m_mobSkillInfo[iIndex].vecSplashAttack.push_back(TMobSplashAttackInfo(dwTiming, dwHitDistance)); @@ -76,7 +76,7 @@ bool CMobManager::Initialize(TMobTable * pTable, int iSize) if (pkMob->m_table.Skills[j].dwVnum) ++SkillCount; - sys_log(0, "MOB: #%-5d %-30s LEVEL %u HP %u DEF %u EXP %u DROP_ITEM_VNUM %u SKILL_COUNT %d", + SPDLOG_TRACE("MOB: #{:5} {:30} LEVEL {} HP {} DEF {} EXP {} DROP_ITEM_VNUM {} SKILL_COUNT {}", t->dwVnum, t->szLocaleName, t->bLevel, t->dwMaxHP, t->wDef, t->dwExp, t->dwDropItemVnum, SkillCount); if (t->bType == CHAR_TYPE_NPC || t->bType == CHAR_TYPE_WARP || t->bType == CHAR_TYPE_GOTO) @@ -98,17 +98,17 @@ bool CMobManager::Initialize(TMobTable * pTable, int iSize) if (!LoadGroup(szGroupFileName)) { - sys_err("cannot load %s", szGroupFileName); + SPDLOG_ERROR("cannot load {}", szGroupFileName); thecore_shutdown(); } if (!LoadGroupGroup(szGroupGroupFileName)) { - sys_err("cannot load %s", szGroupGroupFileName); + SPDLOG_ERROR("cannot load {}", szGroupGroupFileName); thecore_shutdown(); } // END_OF_LOCALE_SERVICE - //exit(1); + //exit(EXIT_FAILURE); CHARACTER_MANAGER::instance().for_each_pc(std::bind1st(std::mem_fun(&CMobManager::RebindMobProto),this)); return true; } @@ -264,7 +264,7 @@ bool CMobManager::LoadGroupGroup(const char * c_pszFileName) if (!loader.GetTokenInteger("vnum", &iVnum)) { - sys_err("LoadGroupGroup : Syntax error %s : no vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("LoadGroupGroup : Syntax error {} : no vnum, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); continue; } @@ -325,7 +325,7 @@ bool CMobManager::LoadGroup(const char * c_pszFileName) if (!loader.GetTokenInteger("vnum", &iVnum)) { - sys_err("LoadGroup : Syntax error %s : no vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("LoadGroup : Syntax error {} : no vnum, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); continue; } @@ -334,14 +334,14 @@ bool CMobManager::LoadGroup(const char * c_pszFileName) if (!loader.GetTokenVector("leader", &pTok)) { - sys_err("LoadGroup : Syntax error %s : no leader, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("LoadGroup : Syntax error {} : no leader, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); continue; } if (pTok->size() < 2) { - sys_err("LoadGroup : Syntax error %s : no leader vnum, node %s", c_pszFileName, stName.c_str()); + SPDLOG_ERROR("LoadGroup : Syntax error {} : no leader vnum, node {}", c_pszFileName, stName.c_str()); loader.SetParentNode(); continue; } @@ -353,8 +353,8 @@ bool CMobManager::LoadGroup(const char * c_pszFileName) str_to_number(vnum, pTok->at(1).c_str()); pkGroup->AddMember(vnum); - sys_log(0, "GROUP: %-5d %s", iVnum, stName.c_str()); - sys_log(0, " %s %s", pTok->at(0).c_str(), pTok->at(1).c_str()); + SPDLOG_TRACE("GROUP: {:<5} {}", iVnum, stName); + SPDLOG_TRACE(" {} {}", pTok->at(0), pTok->at(1)); for (int k = 1; k < 256; ++k) { @@ -363,7 +363,7 @@ bool CMobManager::LoadGroup(const char * c_pszFileName) if (loader.GetTokenVector(buf, &pTok)) { - sys_log(0, " %s %s", pTok->at(0).c_str(), pTok->at(1).c_str()); + SPDLOG_TRACE(" {} {}", pTok->at(0), pTok->at(1)); DWORD vnum = 0; str_to_number(vnum, pTok->at(1).c_str()); pkGroup->AddMember(vnum); diff --git a/src/game/src/monarch.cpp b/src/game/src/monarch.cpp index 49e04e2..27a9be6 100644 --- a/src/game/src/monarch.cpp +++ b/src/game/src/monarch.cpp @@ -4,7 +4,6 @@ #include "char.h" #include "sectree_manager.h" #include "desc_client.h" -#include "dev_log.h" extern int test_server; extern int passes_per_sec; @@ -56,14 +55,14 @@ int CMonarch::HealMyEmpire(LPCHARACTER ch ,DWORD price) BYTE Empire = ch->GetEmpire(); DWORD pid = ch->GetPlayerID(); - sys_log(0, "HealMyEmpire[%d] pid:%d price %d", pid, Empire, price); + SPDLOG_DEBUG("HealMyEmpire[{}] pid:{} price {}", pid, Empire, price); if (IsMonarch(pid, Empire) == 0) { if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", pid); + SPDLOG_ERROR("No Monarch pid {} ", pid); return 0; } } @@ -113,7 +112,7 @@ bool CMonarch::IsMonarch(DWORD pid, BYTE bEmpire) bool CMonarch::IsMoneyOk(int price, BYTE bEmpire) { - dev_log(LOG_DEB1, "GetMoney(%d), price = (%d,%d)", bEmpire, GetMoney(bEmpire), price); + SPDLOG_TRACE("GetMoney({}), price = ({},{})", bEmpire, GetMoney(bEmpire), price); return (GetMoney(bEmpire) >= price); } @@ -209,8 +208,7 @@ bool CMonarch::CheckPowerUpCT(BYTE Empire) if (m_PowerUpCT[Empire] > thecore_pulse()) { - if (test_server) - sys_log(0, "[TEST_ONLY] : CheckPowerUpCT CT%d Now%d 60sec %d", m_PowerUpCT[Empire], thecore_pulse(), PASSES_PER_SEC(60 * 10)); + SPDLOG_TRACE("[TEST_ONLY] : CheckPowerUpCT CT{} Now{} 60sec {}", m_PowerUpCT[Empire], thecore_pulse(), PASSES_PER_SEC(60 * 10)); return false; } @@ -224,8 +222,7 @@ bool CMonarch::CheckDefenseUpCT(BYTE Empire) if (m_DefenseUpCT[Empire] > thecore_pulse()) { - if (test_server) - sys_log(0, "[TEST_ONLY] : CheckPowerUpCT CT%d Now%d 60sec %d", m_PowerUpCT[Empire], thecore_pulse(), PASSES_PER_SEC(60 * 10)); + SPDLOG_TRACE("[TEST_ONLY] : CheckPowerUpCT CT{} Now{} 60sec {}", m_PowerUpCT[Empire], thecore_pulse(), PASSES_PER_SEC(60 * 10)); return false; } diff --git a/src/game/src/motion.cpp b/src/game/src/motion.cpp index 83319b4..6c60509 100644 --- a/src/game/src/motion.cpp +++ b/src/game/src/motion.cpp @@ -95,7 +95,7 @@ static const char* GetMotionFileName(TMobTable* mobTable, EPublicMotion motion) default: fclose(fp); - sys_err("Motion: no process for this motion(%d) vnum(%d)", motion, mobTable->dwVnum); + SPDLOG_ERROR("Motion: no process for this motion({}) vnum({})", (int) motion, mobTable->dwVnum); return NULL; } @@ -124,7 +124,7 @@ static const char* GetMotionFileName(TMobTable* mobTable, EPublicMotion motion) } else { - sys_err("Motion: %s have not motlist.txt vnum(%d) folder(%s)", folder, mobTable->dwVnum, mobTable->szFolder); + SPDLOG_ERROR("Motion: {} have not motlist.txt vnum({}) folder({})", folder, mobTable->dwVnum, mobTable->szFolder); } return NULL; @@ -145,14 +145,14 @@ static void LoadMotion(CMotionSet* pMotionSet, TMobTable* mob_table, EPublicMoti { if (motion == MOTION_RUN) if (0.0f == pMotion->GetAccumVector().y) - sys_err("cannot find accumulation data in file '%s'", cpFileName); + SPDLOG_ERROR("cannot find accumulation data in file '{}'", cpFileName); pMotionSet->Insert(MAKE_MOTION_KEY(MOTION_MODE_GENERAL, motion), pMotion); } else { M2_DELETE(pMotion); - sys_err("Motion: Load failed vnum(%d) motion(%d) file(%s)", mob_table->dwVnum, motion, cpFileName); + SPDLOG_ERROR("Motion: Load failed vnum({}) motion({}) file({})", mob_table->dwVnum, (int) motion, cpFileName); } } @@ -189,7 +189,7 @@ static void LoadSkillMotion(CMotionSet* pMotionSet, CMob* pMob, EPublicMotion mo { if (mob_table->Skills[idx].dwVnum != 0) { - sys_err("Motion: Skill exist but no motion data for index %d mob %u skill %u", + SPDLOG_ERROR("Motion: Skill exist but no motion data for index {} mob {} skill {}", idx, mob_table->dwVnum, mob_table->Skills[idx].dwVnum); } M2_DELETE(pMotion); @@ -347,7 +347,7 @@ bool CMotionManager::Build() // POLYMORPH_BUG_FIX float normalAttackDuration = MOB_GetNormalAttackDuration(t); - sys_log(0, "mob_normal_attack_duration:%d:%s:%.2f", t->dwVnum, t->szFolder, normalAttackDuration); + SPDLOG_TRACE("mob_normal_attack_duration:{}:{}:{:.2f}", t->dwVnum, t->szFolder, normalAttackDuration); m_map_normalAttackDuration.insert(std::map::value_type(t->dwVnum, normalAttackDuration)); // END_OF_POLYMORPH_BUG_FIX } @@ -422,7 +422,7 @@ bool CMotion::LoadMobSkillFromFile(const char * c_pszFileName, CMob* pMob, int i if (!rkTextFileLoader.GetTokenFloat("motionduration", &m_fDuration)) { - sys_err("Motion: no motion duration %s", c_pszFileName); + SPDLOG_ERROR("Motion: no motion duration {}", c_pszFileName); return false; } @@ -448,14 +448,14 @@ bool CMotion::LoadMobSkillFromFile(const char * c_pszFileName, CMob* pMob, int i { if (!rkTextFileLoader.SetChildNode("event", j)) { - sys_err("Motion: no event data %d %s", j, c_pszFileName); + SPDLOG_ERROR("Motion: no event data {} {}", j, c_pszFileName); return false; } int iType; if (!rkTextFileLoader.GetTokenInteger("motioneventtype", &iType)) { - sys_err("Motion: no motioneventtype data %s", c_pszFileName); + SPDLOG_ERROR("Motion: no motioneventtype data {}", c_pszFileName); return false; } @@ -479,7 +479,7 @@ bool CMotion::LoadMobSkillFromFile(const char * c_pszFileName, CMob* pMob, int i // ±¸ µ¥ÀÌÅÍ´Â Çϳª ¶ó°í °¡Á¤ if (!rkTextFileLoader.SetChildNode("spheredata", 0)) { - sys_err("Motion: no sphere data %s", c_pszFileName); + SPDLOG_ERROR("Motion: no sphere data {}", c_pszFileName); return false; } @@ -487,7 +487,7 @@ bool CMotion::LoadMobSkillFromFile(const char * c_pszFileName, CMob* pMob, int i //return false; if (!rkTextFileLoader.GetTokenPosition("position", &v3Position)) { - sys_err("Motion: no position data %s", c_pszFileName); + SPDLOG_ERROR("Motion: no position data {}", c_pszFileName); return false; } @@ -503,7 +503,7 @@ bool CMotion::LoadMobSkillFromFile(const char * c_pszFileName, CMob* pMob, int i if (!rkTextFileLoader.GetTokenFloat("startingtime", &fStartingTime)) { - sys_err("Motion: no startingtime data %s", c_pszFileName); + SPDLOG_ERROR("Motion: no startingtime data {}", c_pszFileName); return false; } @@ -527,20 +527,20 @@ bool CMotion::LoadFromFile(const char * c_pszFileName) if (!loader.Load(c_pszFileName)) { - sys_log(0, "Motion: LoadFromFile fail: %s", c_pszFileName); + SPDLOG_ERROR("Motion: LoadFromFile fail: {}", c_pszFileName); return false; } if (!loader.GetTokenFloat("motionduration", &m_fDuration)) { - sys_err("Motion: %s does not have a duration", c_pszFileName); + SPDLOG_ERROR("Motion: {} does not have a duration", c_pszFileName); return false; } if (loader.GetTokenPosition("accumulation", &m_vec3Accumulation)) m_isAccumulation = true; - sys_log(1, "%-48s %.3f %f", strchr(c_pszFileName, '/') + 1, GetDuration(), GetAccumVector().y); + SPDLOG_TRACE("{:48} {:.3f} {}", strchr(c_pszFileName, '/') + 1, GetDuration(), GetAccumVector().y); m_isEmpty = false; return true; diff --git a/src/game/src/p2p.cpp b/src/game/src/p2p.cpp index 02d90f1..193e09f 100644 --- a/src/game/src/p2p.cpp +++ b/src/game/src/p2p.cpp @@ -64,21 +64,21 @@ void P2P_MANAGER::FlushOutput() void P2P_MANAGER::RegisterAcceptor(LPDESC d) { - sys_log(0, "P2P Acceptor opened (host %s)", d->GetHostName()); + SPDLOG_INFO("P2P Acceptor opened (host {})", d->GetHostName()); m_set_pkPeers.insert(d); Boot(d); } void P2P_MANAGER::UnregisterAcceptor(LPDESC d) { - sys_log(0, "P2P Acceptor closed (host %s)", d->GetHostName()); + SPDLOG_INFO("P2P Acceptor closed (host {})", d->GetHostName()); EraseUserByDesc(d); m_set_pkPeers.erase(d); } void P2P_MANAGER::RegisterConnector(LPDESC d) { - sys_log(0, "P2P Connector opened (host %s)", d->GetHostName()); + SPDLOG_INFO("P2P Connector opened (host {})", d->GetHostName()); m_set_pkPeers.insert(d); Boot(d); @@ -95,7 +95,7 @@ void P2P_MANAGER::UnregisterConnector(LPDESC d) if (it != m_set_pkPeers.end()) { - sys_log(0, "P2P Connector closed (host %s)", d->GetHostName()); + SPDLOG_INFO("P2P Connector closed (host {})", d->GetHostName()); EraseUserByDesc(d); m_set_pkPeers.erase(it); } @@ -157,7 +157,7 @@ void P2P_MANAGER::Login(LPDESC d, const TPacketGGLogin * p) } else { - sys_err("LOGIN_EMPIRE_ERROR: %d >= MAX(%d)", pkCCI->bEmpire, EMPIRE_MAX_NUM); + SPDLOG_ERROR("LOGIN_EMPIRE_ERROR: {} >= MAX({})", pkCCI->bEmpire, (int) EMPIRE_MAX_NUM); } } @@ -168,7 +168,7 @@ void P2P_MANAGER::Login(LPDESC d, const TPacketGGLogin * p) pkCCI->lMapIndex = p->lMapIndex; pkCCI->pkDesc = d; pkCCI->bChannel = p->bChannel; - sys_log(0, "P2P: Login %s", pkCCI->szName); + SPDLOG_INFO("P2P: Login {}", pkCCI->szName); CGuildManager::instance().P2PLoginMember(pkCCI->dwPID); CPartyManager::instance().P2PLogin(pkCCI->dwPID, pkCCI->szName); @@ -189,12 +189,12 @@ void P2P_MANAGER::Logout(CCI * pkCCI) --m_aiEmpireUserCount[pkCCI->bEmpire]; if (m_aiEmpireUserCount[pkCCI->bEmpire] < 0) { - sys_err("m_aiEmpireUserCount[%d] < 0", pkCCI->bEmpire); + SPDLOG_ERROR("m_aiEmpireUserCount[{}] < 0", pkCCI->bEmpire); } } else { - sys_err("LOGOUT_EMPIRE_ERROR: %d >= MAX(%d)", pkCCI->bEmpire, EMPIRE_MAX_NUM); + SPDLOG_ERROR("LOGOUT_EMPIRE_ERROR: {} >= MAX({})", pkCCI->bEmpire, (int) EMPIRE_MAX_NUM); } } @@ -218,7 +218,7 @@ void P2P_MANAGER::Logout(const char * c_pszName) return; Logout(pkCCI); - sys_log(0, "P2P: Logout %s", c_pszName); + SPDLOG_INFO("P2P: Logout {}", c_pszName); } CCI * P2P_MANAGER::FindByPID(DWORD pid) diff --git a/src/game/src/panama.cpp b/src/game/src/panama.cpp index 408c34a..e37bd18 100644 --- a/src/game/src/panama.cpp +++ b/src/game/src/panama.cpp @@ -29,14 +29,14 @@ size_t PanamaLoad() if (!fpIV) { - sys_err("cannot open iv file %s", szIVFileName); + SPDLOG_ERROR("cannot open iv file {}", szIVFileName); continue; } BYTE abIV[32]; if (32 != fread(abIV, sizeof(BYTE), 32, fpIV)) - sys_err("IV file format error! %s", szIVFileName); + SPDLOG_ERROR("IV file format error! {}", szIVFileName); else { char szHex[64 + 1]; @@ -44,7 +44,7 @@ size_t PanamaLoad() for (int i = 0; i < 32; ++i) snprintf(szHex + i * 2, sizeof(szHex) - i * 2, "%02x", abIV[i]); - sys_log(0, "PANAMA: %s %s", szPackName, szHex); + SPDLOG_DEBUG("PANAMA: {} {}", szPackName, szHex); s_panamaVector.push_back(std::make_pair(szPackName, M2_NEW BYTE[32])); memcpy(s_panamaVector[s_panamaVector.size() - 1].second, abIV, 32); diff --git a/src/game/src/party.cpp b/src/game/src/party.cpp index 58d10f2..eab00a7 100644 --- a/src/game/src/party.cpp +++ b/src/game/src/party.cpp @@ -80,7 +80,7 @@ void CPartyManager::P2PJoinParty(DWORD leader, DWORD pid, BYTE role) } else { - sys_err("No such party with leader [%d]", leader); + SPDLOG_ERROR("No such party with leader [{}]", leader); } } @@ -94,7 +94,7 @@ void CPartyManager::P2PQuitParty(DWORD pid) } else { - sys_err("No such party with member [%d]", pid); + SPDLOG_ERROR("No such party with member [{}]", pid); } } @@ -125,7 +125,7 @@ void CPartyManager::P2PDeleteParty(DWORD pid) M2_DELETE(it->second); } else - sys_err("PARTY P2PDeleteParty Cannot find party [%u]", pid); + SPDLOG_ERROR("PARTY P2PDeleteParty Cannot find party [{}]", pid); } LPPARTY CPartyManager::CreateParty(LPCHARACTER pLeader) @@ -147,7 +147,7 @@ LPPARTY CPartyManager::CreateParty(LPCHARACTER pLeader) db_clientdesc->DBPacket(HEADER_GD_PARTY_CREATE, 0, &p, sizeof(TPacketPartyCreate)); - sys_log(0, "PARTY: Create %s pid %u", pLeader->GetName(), pLeader->GetPlayerID()); + SPDLOG_DEBUG("PARTY: Create {} pid {}", pLeader->GetName(), pLeader->GetPlayerID()); pParty->SetPCParty(true); pParty->Join(pLeader->GetPlayerID()); @@ -224,7 +224,7 @@ EVENTFUNC(party_update_event) if ( info == NULL ) { - sys_err( "party_update_event> Null pointer" ); + SPDLOG_ERROR("party_update_event> Null pointer" ); return 0; } @@ -254,7 +254,7 @@ CParty::~CParty() void CParty::Initialize() { - sys_log(2, "Party::Initialize"); + SPDLOG_TRACE("Party::Initialize"); m_iExpDistributionMode = PARTY_EXP_DISTRIBUTION_NON_PARITY; m_pkChrExpCentralize = NULL; @@ -293,7 +293,7 @@ void CParty::Initialize() void CParty::Destroy() { - sys_log(2, "Party::Destroy"); + SPDLOG_TRACE("Party::Destroy"); // PC°¡ ¸¸µç ÆÄƼ¸é ÆÄƼ¸Å´ÏÀú¿¡ ¸Ê¿¡¼­ PID¸¦ »èÁ¦ÇØ¾ß ÇÑ´Ù. if (m_bPCParty) @@ -406,7 +406,7 @@ void CParty::P2PJoin(DWORD dwPID) if (ch) { - sys_log(0, "PARTY: Join %s pid %u leader %u", ch->GetName(), dwPID, m_dwLeaderPID); + SPDLOG_DEBUG("PARTY: Join {} pid {} leader {}", ch->GetName(), dwPID, m_dwLeaderPID); Member.strName = ch->GetName(); if (Member.bRole == PARTY_ROLE_LEADER) @@ -420,11 +420,11 @@ void CParty::P2PJoin(DWORD dwPID) else if (pcci->bChannel == g_bChannel) Member.strName = pcci->szName; else - sys_err("member is not in same channel PID: %u channel %d, this channel %d", dwPID, pcci->bChannel, g_bChannel); + SPDLOG_ERROR("member is not in same channel PID: {} channel {}, this channel {}", dwPID, pcci->bChannel, g_bChannel); } } - sys_log(2, "PARTY[%d] MemberCountChange %d -> %d", GetLeaderPID(), GetMemberCount(), GetMemberCount()+1); + SPDLOG_TRACE("PARTY[{}] MemberCountChange {} -> {}", GetLeaderPID(), GetMemberCount(), GetMemberCount()+1); m_memberMap.insert(TMemberMap::value_type(dwPID, Member)); @@ -484,7 +484,7 @@ void CParty::P2PQuit(DWORD dwPID) m_memberMap.erase(it); - sys_log(2, "PARTY[%d] MemberCountChange %d -> %d", GetLeaderPID(), GetMemberCount(), GetMemberCount() - 1); + SPDLOG_TRACE("PARTY[{}] MemberCountChange {} -> {}", GetLeaderPID(), GetMemberCount(), GetMemberCount() - 1); if (bRole < PARTY_ROLE_MAX_NUM) { @@ -492,7 +492,7 @@ void CParty::P2PQuit(DWORD dwPID) } else { - sys_err("ROLE_COUNT_QUIT_ERROR: INDEX(%d) > MAX(%d)", bRole, PARTY_ROLE_MAX_NUM); + SPDLOG_ERROR("ROLE_COUNT_QUIT_ERROR: INDEX({}) > MAX({})", bRole, (int) PARTY_ROLE_MAX_NUM); } if (ch) @@ -542,7 +542,7 @@ void CParty::Link(LPCHARACTER pkChr) if (it == m_memberMap.end()) { - sys_err("%s is not member of this party", pkChr->GetName()); + SPDLOG_ERROR("{} is not member of this party", pkChr->GetName()); return; } @@ -557,7 +557,7 @@ void CParty::Link(LPCHARACTER pkChr) if (it->second.bRole == PARTY_ROLE_LEADER) m_pkChrLeader = pkChr; - sys_log(2, "PARTY[%d] %s linked to party", GetLeaderPID(), pkChr->GetName()); + SPDLOG_TRACE("PARTY[{}] {} linked to party", GetLeaderPID(), pkChr->GetName()); it->second.pCharacter = pkChr; pkChr->SetParty(this); @@ -579,7 +579,6 @@ void CParty::Link(LPCHARACTER pkChr) SendParameter(pkChr); - //sys_log(0, "PARTY-DUNGEON connect %p %p", this, GetDungeon()); if (GetDungeon() && GetDungeon()->GetMapIndex() == pkChr->GetMapIndex()) { pkChr->SetDungeon(GetDungeon()); @@ -606,7 +605,7 @@ void CParty::P2PSetMemberLevel(DWORD pid, BYTE level) TMemberMap::iterator it; - sys_log(0, "PARTY P2PSetMemberLevel leader %d pid %d level %d", GetLeaderPID(), pid, level); + SPDLOG_DEBUG("PARTY P2PSetMemberLevel leader {} pid {} level {}", GetLeaderPID(), pid, level); it = m_memberMap.find(pid); if (it != m_memberMap.end()) @@ -637,7 +636,7 @@ void CParty::Unlink(LPCHARACTER pkChr) if (it == m_memberMap.end()) { - sys_err("%s is not member of this party", pkChr->GetName()); + SPDLOG_ERROR("{} is not member of this party", pkChr->GetName()); return; } @@ -804,7 +803,6 @@ void CParty::SendPartyInfoOneToAll(DWORD pid) { if ((it->second.pCharacter) && (it->second.pCharacter->GetDesc())) { - //sys_log(2, "PARTY send info %s[%d] to %s[%d]", ch->GetName(), (DWORD)ch->GetVID(), it->second.pCharacter->GetName(), (DWORD)it->second.pCharacter->GetVID()); it->second.pCharacter->GetDesc()->Packet(&p, sizeof(p)); } } @@ -825,7 +823,7 @@ void CParty::SendPartyInfoOneToAll(LPCHARACTER ch) { if ((it->second.pCharacter) && (it->second.pCharacter->GetDesc())) { - sys_log(2, "PARTY send info %s[%d] to %s[%d]", ch->GetName(), (DWORD)ch->GetVID(), it->second.pCharacter->GetName(), (DWORD)it->second.pCharacter->GetVID()); + SPDLOG_TRACE("PARTY send info {}[{}] to {}[{}]", ch->GetName(), (DWORD)ch->GetVID(), it->second.pCharacter->GetName(), (DWORD)it->second.pCharacter->GetVID()); it->second.pCharacter->GetDesc()->Packet(&p, sizeof(p)); } } @@ -852,7 +850,7 @@ void CParty::SendPartyInfoAllToOne(LPCHARACTER ch) } it->second.pCharacter->BuildUpdatePartyPacket(p); - sys_log(2, "PARTY send info %s[%d] to %s[%d]", it->second.pCharacter->GetName(), (DWORD)it->second.pCharacter->GetVID(), ch->GetName(), (DWORD)ch->GetVID()); + SPDLOG_TRACE("PARTY send info {}[{}] to {}[{}]", it->second.pCharacter->GetName(), (DWORD)it->second.pCharacter->GetVID(), ch->GetName(), (DWORD)ch->GetVID()); ch->GetDesc()->Packet(&p, sizeof(p)); } } @@ -861,7 +859,7 @@ void CParty::SendMessage(LPCHARACTER ch, BYTE bMsg, DWORD dwArg1, DWORD dwArg2) { if (ch->GetParty() != this) { - sys_err("%s is not member of this party %p", ch->GetName(), this); + SPDLOG_ERROR("{} is not member of this party {}", ch->GetName(), (void*) this); return; } @@ -892,7 +890,7 @@ void CParty::SendMessage(LPCHARACTER ch, BYTE bMsg, DWORD dwArg1, DWORD dwArg2) if (pkChr->Goto(x, y)) { LPCHARACTER victim = pkChr->GetVictim(); - sys_log(0, "%s %p RETURN victim %p", pkChr->GetName(), get_pointer(pkChr), get_pointer(victim)); + SPDLOG_DEBUG("{} {} RETURN victim {}", pkChr->GetName(), (void*) get_pointer(pkChr), (void*) get_pointer(victim)); pkChr->SendMovePacket(FUNC_WAIT, 0, 0, 0, 0); } } @@ -987,7 +985,7 @@ bool CParty::SetRole(DWORD dwPID, BYTE bRole, bool bSet) } else { - sys_err("ROLE_COUNT_INC_ERROR: INDEX(%d) > MAX(%d)", bRole, PARTY_ROLE_MAX_NUM); + SPDLOG_ERROR("ROLE_COUNT_INC_ERROR: INDEX({}) > MAX({})", bRole, (int) PARTY_ROLE_MAX_NUM); } } else @@ -1009,7 +1007,7 @@ bool CParty::SetRole(DWORD dwPID, BYTE bRole, bool bSet) } else { - sys_err("ROLE_COUNT_DEC_ERROR: INDEX(%d) > MAX(%d)", bRole, PARTY_ROLE_MAX_NUM); + SPDLOG_ERROR("ROLE_COUNT_DEC_ERROR: INDEX({}) > MAX({})", bRole, (int) PARTY_ROLE_MAX_NUM); } } @@ -1222,8 +1220,6 @@ void CParty::ComputeRolePoint(LPCHARACTER ch, BYTE bRole, bool bAdd) //SKILL_POWER_BY_LEVEL float k = (float) ch->GetSkillPowerByLevel(std::min(SKILL_MAX_LEVEL, m_iLeadership)) / 100.0f; //float k = (float) aiSkillPowerByLevel[std::min(SKILL_MAX_LEVEL, m_iLeadership)] / 100.0f; - // - //sys_log(0,"ComputeRolePoint %fi %d, %d ", k, SKILL_MAX_LEVEL, m_iLeadership ); //END_SKILL_POWER_BY_LEVEL switch (bRole) @@ -1300,7 +1296,7 @@ void CParty::ComputeRolePoint(LPCHARACTER ch, BYTE bRole, bool bAdd) void CParty::Update() { - sys_log(1, "PARTY::Update"); + SPDLOG_DEBUG("PARTY::Update"); LPCHARACTER l = GetLeaderCharacter(); @@ -1329,7 +1325,6 @@ void CParty::Update() if (it->second.bNear) { ++iNearMember; - //sys_log(0,"NEAR %s", ch->GetName()); } } @@ -1471,11 +1466,9 @@ int CParty::GetFlag(const std::string& name) if (it != m_map_iFlag.end()) { - //sys_log(0,"PARTY GetFlag %s %d", name.c_str(), it->second); return it->second; } - //sys_log(0,"PARTY GetFlag %s 0", name.c_str()); return 0; } @@ -1483,7 +1476,6 @@ void CParty::SetFlag(const std::string& name, int value) { TFlagMap::iterator it = m_map_iFlag.find(name); - //sys_log(0,"PARTY SetFlag %s %d", name.c_str(), value); if (it == m_map_iFlag.end()) { m_map_iFlag.insert(make_pair(name, value)); @@ -1602,7 +1594,7 @@ void CParty::SetParameter(int iMode) { if (iMode >= PARTY_EXP_DISTRIBUTION_MAX_NUM) { - sys_err("Invalid exp distribution mode %d", iMode); + SPDLOG_ERROR("Invalid exp distribution mode {}", iMode); return; } diff --git a/src/game/src/party.h b/src/game/src/party.h index 809bdc8..116c3b2 100644 --- a/src/game/src/party.h +++ b/src/game/src/party.h @@ -49,8 +49,8 @@ class CPartyManager : public singleton //void SendPartyToDB(); - void EnablePCParty() { m_bEnablePCParty = true; sys_log(0,"PARTY Enable"); } - void DisablePCParty() { m_bEnablePCParty = false; sys_log(0,"PARTY Disable"); } + void EnablePCParty() { m_bEnablePCParty = true; SPDLOG_DEBUG("PARTY Enable"); } + void DisablePCParty() { m_bEnablePCParty = false; SPDLOG_DEBUG("PARTY Disable"); } bool IsEnablePCParty() { return m_bEnablePCParty; } LPPARTY CreateParty(LPCHARACTER pkLeader); diff --git a/src/game/src/polymorph.cpp b/src/game/src/polymorph.cpp index e9ab167..48448b3 100644 --- a/src/game/src/polymorph.cpp +++ b/src/game/src/polymorph.cpp @@ -135,7 +135,7 @@ bool CPolymorphUtils::GiveBook(LPCHARACTER pChar, DWORD dwMobVnum, DWORD dwPract if (CMobManager::instance().Get(dwMobVnum) == NULL) { - sys_err("Wrong Polymorph vnum passed: CPolymorphUtils::GiveBook(PID(%d), %d %d %d %d)", + SPDLOG_ERROR("Wrong Polymorph vnum passed: CPolymorphUtils::GiveBook(PID({}), {} {} {} {})", pChar->GetPlayerID(), dwMobVnum, dwPracticeCount, BookLevel, LevelLimit); return false; } diff --git a/src/game/src/priv_manager.cpp b/src/game/src/priv_manager.cpp index 18a97e4..8a52c2c 100644 --- a/src/game/src/priv_manager.cpp +++ b/src/game/src/priv_manager.cpp @@ -28,7 +28,7 @@ void CPrivManager::RequestGiveGuildPriv(DWORD guild_id, BYTE type, int value, ti { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: RequestGiveGuildPriv: wrong guild priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: RequestGiveGuildPriv: wrong guild priv type({})", type); return; } @@ -48,7 +48,7 @@ void CPrivManager::RequestGiveEmpirePriv(BYTE empire, BYTE type, int value, time { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: RequestGiveEmpirePriv: wrong empire priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: RequestGiveEmpirePriv: wrong empire priv type({})", type); return; } @@ -68,7 +68,7 @@ void CPrivManager::RequestGiveCharacterPriv(DWORD pid, BYTE type, int value) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: RequestGiveCharacterPriv: wrong char priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: RequestGiveCharacterPriv: wrong char priv type({})", type); return; } @@ -86,11 +86,11 @@ void CPrivManager::GiveGuildPriv(DWORD guild_id, BYTE type, int value, BYTE bLog { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: GiveGuildPriv: wrong guild priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: GiveGuildPriv: wrong guild priv type({})", type); return; } - sys_log(0,"Set Guild Priv: guild_id(%u) type(%d) value(%d) duration_sec(%d)", guild_id, type, value, end_time_sec - get_global_time()); + SPDLOG_DEBUG("Set Guild Priv: guild_id({}) type({}) value({}) duration_sec({})", guild_id, type, value, end_time_sec - get_global_time()); value = std::clamp(value, 0, 50); end_time_sec = std::clamp(end_time_sec, 0, get_global_time()+60*60*24*7); @@ -126,11 +126,11 @@ void CPrivManager::GiveCharacterPriv(DWORD pid, BYTE type, int value, BYTE bLog) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: GiveCharacterPriv: wrong char priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: GiveCharacterPriv: wrong char priv type({})", type); return; } - sys_log(0,"Set Character Priv %u %d %d", pid, type, value); + SPDLOG_DEBUG("Set Character Priv {} {} {}", pid, type, value); value = std::clamp(value, 0, 100); @@ -144,11 +144,11 @@ void CPrivManager::GiveEmpirePriv(BYTE empire, BYTE type, int value, BYTE bLog, { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: GiveEmpirePriv: wrong empire priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: GiveEmpirePriv: wrong empire priv type({})", type); return; } - sys_log(0, "Set Empire Priv: empire(%d) type(%d) value(%d) duration_sec(%d)", empire, type, value, end_time_sec-get_global_time()); + SPDLOG_DEBUG("Set Empire Priv: empire({}) type({}) value({}) duration_sec({})", empire, type, value, end_time_sec-get_global_time()); value = std::clamp(value, 0, 200); end_time_sec = std::clamp(end_time_sec, 0, get_global_time()+60*60*24*7); @@ -188,7 +188,7 @@ void CPrivManager::RemoveGuildPriv(DWORD guild_id, BYTE type) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: RemoveGuildPriv: wrong guild priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: RemoveGuildPriv: wrong guild priv type({})", type); return; } @@ -200,7 +200,7 @@ void CPrivManager::RemoveEmpirePriv(BYTE empire, BYTE type) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: RemoveEmpirePriv: wrong empire priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: RemoveEmpirePriv: wrong empire priv type({})", type); return; } @@ -213,7 +213,7 @@ void CPrivManager::RemoveCharacterPriv(DWORD pid, BYTE type) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: RemoveCharacterPriv: wrong char priv type(%u)", type); + SPDLOG_ERROR("PRIV_MANAGER: RemoveCharacterPriv: wrong char priv type({})", type); return; } diff --git a/src/game/src/profiler.h b/src/game/src/profiler.h index a53964f..7080da8 100644 --- a/src/game/src/profiler.h +++ b/src/game/src/profiler.h @@ -193,7 +193,7 @@ class CProfiler : public singleton if (!GetProfileStackDataPointer(c_szName, &pProfileStackData)) return; - sys_log(0, "%-10s: %3d", pProfileStackData->strName.c_str(), pProfileStackData->iEndTime - pProfileStackData->iStartTime); + SPDLOG_DEBUG("{:10}: {:3}", pProfileStackData->strName, pProfileStackData->iEndTime - pProfileStackData->iStartTime); } void PrintOneAccumData(const char * c_szName) @@ -205,7 +205,7 @@ class CProfiler : public singleton TProfileAccumData & rData = it->second; - sys_log(0, "%-10s : [CollapsedTime : %3d] / [CallingCount : %3d]", + SPDLOG_DEBUG("{:10} : [CollapsedTime : {:3}] / [CallingCount : {:3}]", rData.strName.c_str(), rData.iCollapsedTime, rData.iCallingCount); diff --git a/src/game/src/pvp.cpp b/src/game/src/pvp.cpp index 280be47..364c28c 100644 --- a/src/game/src/pvp.cpp +++ b/src/game/src/pvp.cpp @@ -58,7 +58,7 @@ void CPVP::Packet(bool bDelete) if (!m_players[0].dwVID || !m_players[1].dwVID) { if (bDelete) - sys_err("null vid when removing %u %u", m_players[0].dwVID, m_players[0].dwVID); + SPDLOG_ERROR("null vid when removing {} {}", m_players[0].dwVID, m_players[0].dwVID); return; } @@ -265,7 +265,7 @@ void CPVPManager::GiveUp(LPCHARACTER pkChr, DWORD dwKillerPID) // This method is if (it == m_map_pkPVPSetByID.end()) return; - sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID()); + SPDLOG_DEBUG("PVPManager::Dead {}", pkChr->GetPlayerID()); std::unordered_set::iterator it2 = it->second.begin(); while (it2 != it->second.end()) @@ -310,7 +310,7 @@ bool CPVPManager::Dead(LPCHARACTER pkChr, DWORD dwKillerPID) bool found = false; - sys_log(1, "PVPManager::Dead %d", pkChr->GetPlayerID()); + SPDLOG_DEBUG("PVPManager::Dead {}", pkChr->GetPlayerID()); std::unordered_set::iterator it2 = it->second.begin(); while (it2 != it->second.end()) @@ -616,7 +616,7 @@ void CPVPManager::SendList(LPDESC d) } d->Packet(&pack, sizeof(pack)); - sys_log(1, "PVPManager::SendList %d %d", pack.dwVIDSrc, pack.dwVIDDst); + SPDLOG_DEBUG("PVPManager::SendList {} {}", pack.dwVIDSrc, pack.dwVIDDst); if (pkPVP->m_players[0].dwVID == dwVID) { diff --git a/src/game/src/questevent.cpp b/src/game/src/questevent.cpp index 2c2713e..96933ba 100644 --- a/src/game/src/questevent.cpp +++ b/src/game/src/questevent.cpp @@ -26,7 +26,7 @@ namespace quest if ( info == NULL ) { - sys_err( "quest_server_timer_event> Null pointer" ); + SPDLOG_ERROR("quest_server_timer_event> Null pointer" ); return 0; } @@ -51,7 +51,7 @@ namespace quest if ( info == NULL ) { - sys_err( "quest_timer_event> Null pointer" ); + SPDLOG_ERROR("quest_timer_event> Null pointer" ); return 0; } @@ -73,7 +73,7 @@ END_OF_TIMER_EVENT: if (pPC) pPC->RemoveTimerNotCancel(info->name); else - sys_err("quest::PC pointer null. player_id: %u", info->player_id); + SPDLOG_ERROR("quest::PC pointer null. player_id: {}", info->player_id); M2_DELETE_ARRAY(info->name); info->name = NULL; @@ -117,7 +117,7 @@ END_OF_TIMER_EVENT: if (info->name) strlcpy(info->name, name, nameCapacity); - sys_log(0, "QUEST timer name %s cycle %d pc %u npc %u loop? %d", name ? name : "", ltime_cycle, player_id, npc_id, loop ? 1 : 0); + SPDLOG_DEBUG("QUEST timer name {} cycle {} pc {} npc {} loop? {}", name ? name : "", ltime_cycle, player_id, npc_id, loop ? 1 : 0); info->time_cycle = loop ? ltime_cycle : 0; return event_create(quest_timer_event, info, ltime_cycle); diff --git a/src/game/src/questlua.cpp b/src/game/src/questlua.cpp index d20ebff..2b78367 100644 --- a/src/game/src/questlua.cpp +++ b/src/game/src/questlua.cpp @@ -19,13 +19,6 @@ #include "guild_manager.h" #include "sectree_manager.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - namespace quest { using namespace std; @@ -44,7 +37,7 @@ namespace quest } else { - sys_err("LUA ScriptRunError (code:%d src:[%s])", errcode, str.c_str()); + quest_err("LUA ScriptRunError (code:%d src:[%s])", errcode, str.c_str()); } lua_settop(L,x); return retstr; @@ -181,7 +174,7 @@ namespace quest { char buf[100]; snprintf(buf, sizeof(buf), "LUA ScriptRunError (code:%%d src:[%%%ds])", size); - sys_err(buf, errcode, code); + quest_err(buf, errcode, code); } lua_settop(L,x); return bStart != 0; @@ -265,7 +258,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L, 4)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -280,7 +273,7 @@ namespace quest count = 1; else if (count > 10) { - sys_err("count bigger than 10"); + quest_err("count bigger than 10"); count = 10; } @@ -335,7 +328,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L, 4) || !lua_isnumber(L, 6)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushnumber(L, 0); return 1; } @@ -351,7 +344,7 @@ namespace quest count = 1; else if (count > 10) { - sys_err("count bigger than 10"); + quest_err("count bigger than 10"); count = 10; } @@ -428,7 +421,7 @@ namespace quest if (lua_isnil(L,-1)) { - sys_err("QUEST wrong quest state file for quest %s",questName); + quest_err("QUEST wrong quest state file for quest %s",questName); lua_settop(L,x); return; } @@ -536,10 +529,10 @@ namespace quest snprintf(settingsFileName, sizeof(settingsFileName), "%s/settings.lua", LocaleService_GetBasePath().c_str()); int settingsLoadingResult = lua_dofile(L, settingsFileName); - sys_log(0, "LoadSettings(%s), returns %d", settingsFileName, settingsLoadingResult); + SPDLOG_DEBUG("LoadSettings({}), returns {}", settingsFileName, settingsLoadingResult); if (settingsLoadingResult != 0) { - sys_err("LOAD_SETTINS_FAILURE(%s)", settingsFileName); + quest_err("LOAD_SETTINS_FAILURE(%s)", settingsFileName); return false; } } @@ -549,10 +542,10 @@ namespace quest snprintf(questlibFileName, sizeof(questlibFileName), "%s/questlib.lua", LocaleService_GetQuestPath().c_str()); int questlibLoadingResult = lua_dofile(L, questlibFileName); - sys_log(0, "LoadQuestlib(%s), returns %d", questlibFileName, questlibLoadingResult); + SPDLOG_DEBUG("LoadQuestlib({}), returns {}", questlibFileName, questlibLoadingResult); if (questlibLoadingResult != 0) { - sys_err("LOAD_QUESTLIB_FAILURE(%s)", questlibFileName); + quest_err("LOAD_QUESTLIB_FAILURE(%s)", questlibFileName); return false; } } @@ -563,10 +556,10 @@ namespace quest snprintf(translateFileName, sizeof(translateFileName), "%s/translate.lua", LocaleService_GetBasePath().c_str()); int translateLoadingResult = lua_dofile(L, translateFileName); - sys_log(0, "LoadTranslate(%s), returns %d", translateFileName, translateLoadingResult); + SPDLOG_DEBUG("LoadTranslate({}), returns {}", translateFileName, translateLoadingResult); if (translateLoadingResult != 0) { - sys_err("LOAD_TRANSLATE_ERROR(%s)", translateFileName); + quest_err("LOAD_TRANSLATE_ERROR(%s)", translateFileName); return false; } } @@ -583,10 +576,10 @@ namespace quest } int questLocaleLoadingResult = lua_dofile(L, questLocaleFileName); - sys_log(0, "LoadQuestLocale(%s), returns %d", questLocaleFileName, questLocaleLoadingResult); + SPDLOG_DEBUG("LoadQuestLocale({}), returns {}", questLocaleFileName, questLocaleLoadingResult); if (questLocaleLoadingResult != 0) { - sys_err("LoadQuestLocale(%s) FAILURE", questLocaleFileName); + quest_err("LoadQuestLocale(%s) FAILURE", questLocaleFileName); return false; } } @@ -613,7 +606,7 @@ namespace quest RegisterQuest(pde->d_name, ++iQuestIdx); int ret = lua_dofile(L, (stQuestObjectDir + "/state/" + pde->d_name).c_str()); - sys_log(0, "QUEST: loading %s, returns %d", (stQuestObjectDir + "/state/" + pde->d_name).c_str(), ret); + SPDLOG_TRACE("QUEST: loading {}, returns {}", (stQuestObjectDir + "/state/" + pde->d_name).c_str(), ret); BuildStateIndexToName(pde->d_name); } @@ -654,8 +647,8 @@ namespace quest } else { - sys_err("SELECT wrong data %s", lua_typename(qs.co, -1)); - sys_err("here"); + quest_err("SELECT wrong data %s", lua_typename(qs.co, -1)); + quest_err("here"); } lua_pop(qs.co,1); } @@ -664,8 +657,7 @@ namespace quest AddScript(os.str()); qs.suspend_state = SUSPEND_STATE_SELECT; - if ( test_server ) - sys_log( 0, "%s", m_strScript.c_str() ); + SPDLOG_TRACE("{}", m_strScript); SendScript(); } @@ -687,7 +679,7 @@ namespace quest if ( info == NULL ) { - sys_err( "confirm_timeout_event> Null pointer" ); + quest_err( "confirm_timeout_event> Null pointer" ); return 0; } @@ -714,7 +706,7 @@ namespace quest const char* szMsg = lua_tostring(qs.co, -2); int iTimeout = (int) lua_tonumber(qs.co, -1); - sys_log(0, "GotoConfirmState vid %u msg '%s', timeout %d", dwVID, szMsg, iTimeout); + SPDLOG_DEBUG("GotoConfirmState vid {} msg '{}', timeout {}", dwVID, szMsg, iTimeout); // 1. »ó´ë¹æ¿¡°Ô È®ÀÎâ ¶ç¿ò // 2. ³ª¿¡°Ô È®ÀÎ ±â´Ù¸°´Ù°í Ç¥½ÃÇϴ â ¶ç¿ò @@ -843,7 +835,7 @@ namespace quest } else { - sys_err("LUA_ERROR: %s", lua_tostring(qs.co, 1)); + quest_err("LUA_ERROR: %s", lua_tostring(qs.co, 1)); } WriteRunningStateToSyserr(); diff --git a/src/game/src/questlua_affect.cpp b/src/game/src/questlua_affect.cpp index c7b6227..20c0cf2 100644 --- a/src/game/src/questlua_affect.cpp +++ b/src/game/src/questlua_affect.cpp @@ -15,7 +15,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); return 0; } @@ -27,7 +27,7 @@ namespace quest if (applyOn >= MAX_APPLY_NUM || applyOn < 1) { - sys_err("apply is out of range : %d", applyOn); + SPDLOG_ERROR("apply is out of range : {}", applyOn); return 0; } @@ -80,7 +80,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); return 0; } @@ -92,7 +92,7 @@ namespace quest if (applyOn >= MAX_APPLY_NUM || applyOn < 1) { - sys_err("apply is out of range : %d", applyOn); + SPDLOG_ERROR("apply is out of range : {}", applyOn); return 0; } @@ -131,7 +131,7 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); return 0; } @@ -152,7 +152,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); return 0; } @@ -164,7 +164,7 @@ namespace quest if (applyOn >= MAX_APPLY_NUM || applyOn < 1) { - sys_err("apply is out of range : %d", applyOn); + SPDLOG_ERROR("apply is out of range : {}", applyOn); return 0; } @@ -180,7 +180,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); return 0; } @@ -192,7 +192,7 @@ namespace quest if (point_type >= POINT_MAX_NUM || point_type < 1) { - sys_err("point is out of range : %d", point_type); + SPDLOG_ERROR("point is out of range : {}", point_type); return 0; } diff --git a/src/game/src/questlua_arena.cpp b/src/game/src/questlua_arena.cpp index abf94c0..563d78c 100644 --- a/src/game/src/questlua_arena.cpp +++ b/src/game/src/questlua_arena.cpp @@ -71,11 +71,11 @@ namespace quest if ( CArenaManager::instance().AddArena(mapIdx, startposAX, startposAY, startposBX, startposBY) == false ) { - sys_log(0, "Failed to load arena map info(map:%d AX:%d AY:%d BX:%d BY:%d", mapIdx, startposAX, startposAY, startposBX, startposBY); + SPDLOG_ERROR("Failed to load arena map info(map:{} AX:{} AY:{} BX:{} BY:{}", mapIdx, startposAX, startposAY, startposBX, startposBY); } else { - sys_log(0, "Add Arena Map:%d startA(%d,%d) startB(%d,%d)", mapIdx, startposAX, startposAY, startposBX, startposBY); + SPDLOG_DEBUG("Add Arena Map:{} startA({},{}) startB({},{})", mapIdx, startposAX, startposAY, startposBX, startposBY); } return 1; diff --git a/src/game/src/questlua_building.cpp b/src/game/src/questlua_building.cpp index 24c84b0..4007b1e 100644 --- a/src/game/src/questlua_building.cpp +++ b/src/game/src/questlua_building.cpp @@ -18,7 +18,7 @@ namespace quest if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); lua_pushnumber(L, 0); return 1; } @@ -50,7 +50,7 @@ namespace quest } } else - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); lua_pushnumber(L, price); lua_pushnumber(L, owner); @@ -62,7 +62,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); return 0; } @@ -85,7 +85,7 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + SPDLOG_ERROR("invalid argument"); lua_pushboolean(L, true); return 1; } diff --git a/src/game/src/questlua_dragonsoul.cpp b/src/game/src/questlua_dragonsoul.cpp index 3073b85..cf0ad02 100644 --- a/src/game/src/questlua_dragonsoul.cpp +++ b/src/game/src/questlua_dragonsoul.cpp @@ -4,13 +4,6 @@ #include "questmanager.h" #include "char.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - namespace quest { int ds_open_refine_window(lua_State* L) @@ -18,7 +11,7 @@ namespace quest const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (NULL == ch) { - sys_err ("NULL POINT ERROR"); + quest_err ("NULL POINT ERROR"); return 0; } if (ch->DragonSoul_IsQualified()) @@ -32,7 +25,7 @@ namespace quest const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (NULL == ch) { - sys_err ("NULL POINT ERROR"); + quest_err ("NULL POINT ERROR"); return 0; } ch->DragonSoul_GiveQualification(); @@ -45,7 +38,7 @@ namespace quest const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (NULL == ch) { - sys_err ("NULL POINT ERROR"); + quest_err ("NULL POINT ERROR"); lua_pushnumber(L, 0); return 1; } diff --git a/src/game/src/questlua_dungeon.cpp b/src/game/src/questlua_dungeon.cpp index e459ff9..3f9e8ba 100644 --- a/src/game/src/questlua_dungeon.cpp +++ b/src/game/src/questlua_dungeon.cpp @@ -11,21 +11,13 @@ #include "desc_client.h" #include "desc_manager.h" - -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - template Func CDungeon::ForEachMember(Func f) { itertype(m_set_pkCharacter) it; for (it = m_set_pkCharacter.begin(); it != m_set_pkCharacter.end(); ++it) { - sys_log(0, "Dungeon ForEachMember %s", (*it)->GetName()); + SPDLOG_DEBUG("Dungeon ForEachMember {}", (*it)->GetName()); f(*it); } return f; @@ -70,7 +62,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isnumber(L,2)) { - sys_err("wrong set flag"); + quest_err("wrong set flag"); } else { @@ -85,7 +77,7 @@ namespace quest } else { - sys_err("no dungeon !!!"); + quest_err("no dungeon !!!"); } } return 0; @@ -95,7 +87,7 @@ namespace quest { if (!lua_isstring(L,1)) { - sys_err("wrong get flag"); + quest_err("wrong get flag"); } CQuestManager& q = CQuestManager::instance(); @@ -108,7 +100,7 @@ namespace quest } else { - sys_err("no dungeon !!!"); + quest_err("no dungeon !!!"); lua_pushnumber(L, 0); } @@ -119,7 +111,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isnumber(L,2)) { - sys_err("wrong get flag"); + quest_err("wrong get flag"); } DWORD dwMapIndex = (DWORD) lua_tonumber(L, 2); @@ -133,7 +125,7 @@ namespace quest } else { - sys_err("no dungeon !!!"); + quest_err("no dungeon !!!"); lua_pushnumber(L, 0); } } @@ -151,12 +143,12 @@ namespace quest if (pDungeon) { - sys_log(0, "Dungeon GetMapIndex %d",pDungeon->GetMapIndex()); + SPDLOG_DEBUG("Dungeon GetMapIndex {}",pDungeon->GetMapIndex()); lua_pushnumber(L, pDungeon->GetMapIndex()); } else { - sys_err("no dungeon !!!"); + quest_err("no dungeon !!!"); lua_pushnumber(L, 0); } @@ -167,7 +159,7 @@ namespace quest { if (!lua_isstring(L,1)) { - sys_err("wrong filename"); + quest_err("wrong filename"); return 0; } @@ -184,7 +176,7 @@ namespace quest { if (!lua_isstring(L,1)) { - sys_err("wrong filename"); + quest_err("wrong filename"); return 0; } CQuestManager& q = CQuestManager::instance(); @@ -217,7 +209,7 @@ namespace quest { if (!lua_isnumber(L,1)) { - sys_err("wrong time"); + quest_err("wrong time"); return 0; } @@ -234,25 +226,25 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("wrong time"); + quest_err("wrong time"); return 0; } if (!lua_isnumber(L, 2)) { - sys_err("wrong map index"); + quest_err("wrong map index"); return 0; } if (!lua_isnumber(L, 3)) { - sys_err("wrong X"); + quest_err("wrong X"); return 0; } if (!lua_isnumber(L, 4)) { - sys_err("wrong Y"); + quest_err("wrong Y"); return 0; } @@ -273,7 +265,7 @@ namespace quest c_pszRegenFile); } else - sys_err("cannot find dungeon"); + quest_err("cannot find dungeon"); return 0; } @@ -282,13 +274,13 @@ namespace quest { if (lua_gettop(L) < 3) { - sys_err("not enough argument"); + quest_err("not enough argument"); return 0; } if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("wrong argument"); + quest_err("wrong argument"); return 0; } @@ -298,7 +290,7 @@ namespace quest if (!pDungeon) { - sys_err("cannot create dungeon %d", lMapIndex); + quest_err("cannot create dungeon %d", lMapIndex); return 0; } @@ -313,7 +305,7 @@ namespace quest { if (lua_gettop(L)<3 || !lua_isnumber(L,1) || !lua_isnumber(L, 2) || !lua_isnumber(L,3)) { - sys_err("not enough argument"); + quest_err("not enough argument"); return 0; } @@ -323,7 +315,7 @@ namespace quest if (!pDungeon) { - sys_err("cannot create dungeon %d", lMapIndex); + quest_err("cannot create dungeon %d", lMapIndex); return 0; } @@ -338,7 +330,7 @@ namespace quest { if (lua_gettop(L)<3 || !lua_isnumber(L,1) || !lua_isnumber(L, 2) || !lua_isnumber(L,3)) { - sys_err("not enough argument"); + quest_err("not enough argument"); return 0; } @@ -348,7 +340,7 @@ namespace quest if (!pDungeon) { - sys_err("cannot create dungeon %d", lMapIndex); + quest_err("cannot create dungeon %d", lMapIndex); return 0; } @@ -356,7 +348,7 @@ namespace quest if (ch->GetParty() == NULL) { - sys_err ("cannot go to dungeon alone."); + quest_err ("cannot go to dungeon alone."); return 0; } pDungeon->JumpParty(ch->GetParty(), ch->GetMapIndex(), (int)lua_tonumber(L, 2), (int)lua_tonumber(L, 3)); @@ -582,7 +574,7 @@ namespace quest { if (!lua_isstring(L,1)) return 0; - sys_log(0,"QUEST_DUNGEON_PURGE_UNIQUE %s", lua_tostring(L,1)); + SPDLOG_DEBUG("QUEST_DUNGEON_PURGE_UNIQUE {}", lua_tostring(L,1)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -627,7 +619,7 @@ namespace quest { if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4)) return 0; - sys_log(0,"QUEST_DUNGEON_PURGE_AREA"); + SPDLOG_DEBUG("QUEST_DUNGEON_PURGE_AREA"); int x1 = lua_tonumber(L, 1); int y1 = lua_tonumber(L, 2); @@ -641,7 +633,7 @@ namespace quest if (0 == mapIndex) { - sys_err("_purge_area: cannot get a map index with (%u, %u)", x1, y1); + quest_err("_purge_area: cannot get a map index with (%u, %u)", x1, y1); return 0; } @@ -661,7 +653,7 @@ namespace quest { if (!lua_isstring(L,1)) return 0; - sys_log(0,"QUEST_DUNGEON_KILL_UNIQUE %s", lua_tostring(L,1)); + SPDLOG_DEBUG("QUEST_DUNGEON_KILL_UNIQUE {}", lua_tostring(L,1)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -676,7 +668,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isstring(L,2)) return 0; - sys_log(0,"QUEST_DUNGEON_SPAWN_STONE_DOOR %s %s", lua_tostring(L,1), lua_tostring(L,2)); + SPDLOG_DEBUG("QUEST_DUNGEON_SPAWN_STONE_DOOR {} {}", lua_tostring(L,1), lua_tostring(L,2)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -691,7 +683,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isstring(L,2)) return 0; - sys_log(0,"QUEST_DUNGEON_SPAWN_WOODEN_DOOR %s %s", lua_tostring(L,1), lua_tostring(L,2)); + SPDLOG_DEBUG("QUEST_DUNGEON_SPAWN_WOODEN_DOOR {} {}", lua_tostring(L,1), lua_tostring(L,2)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -706,7 +698,7 @@ namespace quest { if (!lua_isnumber(L,1) || !lua_isstring(L,2) || !lua_isstring(L,3)) return 0; - sys_log(0,"QUEST_DUNGEON_SPAWN_MOVE_GROUP %d %s %s", (int)lua_tonumber(L,1), lua_tostring(L,2), lua_tostring(L,3)); + SPDLOG_DEBUG("QUEST_DUNGEON_SPAWN_MOVE_GROUP {} {} {}", (int)lua_tonumber(L,1), lua_tostring(L,2), lua_tostring(L,3)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -721,7 +713,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isnumber(L,2) || !lua_isstring(L,3) || !lua_isstring(L,4)) return 0; - sys_log(0,"QUEST_DUNGEON_SPAWN_MOVE_UNIQUE %s %d %s %s", lua_tostring(L,1), (int)lua_tonumber(L,2), lua_tostring(L,3), lua_tostring(L,4)); + SPDLOG_DEBUG("QUEST_DUNGEON_SPAWN_MOVE_UNIQUE {} {} {} {}", lua_tostring(L,1), (int)lua_tonumber(L,2), lua_tostring(L,3), lua_tostring(L,4)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -736,7 +728,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isnumber(L,2) || !lua_isstring(L,3)) return 0; - sys_log(0,"QUEST_DUNGEON_SPAWN_UNIQUE %s %d %s", lua_tostring(L,1), (int)lua_tonumber(L,2), lua_tostring(L,3)); + SPDLOG_DEBUG("QUEST_DUNGEON_SPAWN_UNIQUE {} {} {}", lua_tostring(L,1), (int)lua_tonumber(L,2), lua_tostring(L,3)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -751,7 +743,7 @@ namespace quest { if (!lua_isnumber(L,1) || !lua_isstring(L,2)) return 0; - sys_log(0,"QUEST_DUNGEON_SPAWN %d %s", (int)lua_tonumber(L,1), lua_tostring(L,2)); + SPDLOG_DEBUG("QUEST_DUNGEON_SPAWN {} {}", (int)lua_tonumber(L,1), lua_tostring(L,2)); CQuestManager& q = CQuestManager::instance(); LPDUNGEON pDungeon = q.GetCurrentDungeon(); @@ -802,7 +794,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -819,7 +811,7 @@ namespace quest float radius = lua_isnumber(L, 4) ? (float) lua_tonumber(L, 4) : 0; DWORD count = (lua_isnumber(L, 5)) ? (DWORD) lua_tonumber(L, 5) : 1; - sys_log(0, "dungeon_spawn_mob %u %d %d", dwVnum, x, y); + SPDLOG_DEBUG("dungeon_spawn_mob {} {} {}", dwVnum, x, y); if (count == 0) count = 1; @@ -855,7 +847,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L, 4)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -883,7 +875,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L, 4)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -951,7 +943,7 @@ namespace quest // if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L, 4) || !lua_isnumber(L, 6)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -1068,7 +1060,7 @@ namespace quest { if (!lua_isstring(L, 1) || !lua_isstring(L, 2) || !lua_isstring(L, 3)) { - sys_log(0, "QUEST wrong set flag"); + SPDLOG_ERROR("QUEST wrong set flag"); return 0; } @@ -1077,7 +1069,7 @@ namespace quest if(!pDungeon) { - sys_err("QUEST : no dungeon"); + quest_err("QUEST : no dungeon"); return 0; } @@ -1085,18 +1077,18 @@ namespace quest if (!pMap) { - sys_err("cannot find map by index %d", pDungeon->GetMapIndex()); + quest_err("cannot find map by index %d", pDungeon->GetMapIndex()); return 0; } FSayDungeonByItemGroup f; - sys_log (0,"diff_by_item"); + SPDLOG_DEBUG("diff_by_item"); std::string group_name (lua_tostring (L, 1)); f.item_group = pDungeon->GetItemGroup (group_name); if (f.item_group == NULL) { - sys_err ("invalid item group"); + quest_err ("invalid item group"); return 0; } @@ -1139,7 +1131,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_log(0, "QUEST wrong set flag"); + SPDLOG_ERROR("QUEST wrong set flag"); return 0; } @@ -1148,7 +1140,7 @@ namespace quest if(!pDungeon) { - sys_err("QUEST : no dungeon"); + quest_err("QUEST : no dungeon"); return 0; } @@ -1156,7 +1148,7 @@ namespace quest if (!pMap) { - sys_err("cannot find map by index %d", pDungeon->GetMapIndex()); + quest_err("cannot find map by index %d", pDungeon->GetMapIndex()); return 0; } FExitDungeonByItemGroup f; @@ -1166,7 +1158,7 @@ namespace quest if (f.item_group == NULL) { - sys_err ("invalid item group"); + quest_err ("invalid item group"); return 0; } @@ -1204,7 +1196,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_log(0, "QUEST wrong set flag"); + SPDLOG_ERROR("QUEST wrong set flag"); return 0; } @@ -1213,7 +1205,7 @@ namespace quest if(!pDungeon) { - sys_err("QUEST : no dungeon"); + quest_err("QUEST : no dungeon"); return 0; } @@ -1221,7 +1213,7 @@ namespace quest if (!pMap) { - sys_err("cannot find map by index %d", pDungeon->GetMapIndex()); + quest_err("cannot find map by index %d", pDungeon->GetMapIndex()); return 0; } FDeleteItemInItemGroup f; @@ -1231,7 +1223,7 @@ namespace quest if (f.item_group == NULL) { - sys_err ("invalid item group"); + quest_err ("invalid item group"); return 0; } @@ -1283,7 +1275,7 @@ namespace quest lua_pushnumber(L, pDungeon->CountMonster()); else { - sys_err("not in a dungeon"); + quest_err("not in a dungeon"); lua_pushnumber(L, INT_MAX); } @@ -1411,7 +1403,7 @@ namespace quest if (!lua_isstring(L, 1) || !lua_isstring(L, 2) || !lua_isnumber(L, 3)) { - sys_err("Invalid Argument"); + quest_err("Invalid Argument"); } f.flagname = string (lua_tostring(L, 1)) + "." + lua_tostring(L, 2); diff --git a/src/game/src/questlua_forked.cpp b/src/game/src/questlua_forked.cpp index 175da55..2d0fd01 100644 --- a/src/game/src/questlua_forked.cpp +++ b/src/game/src/questlua_forked.cpp @@ -93,10 +93,9 @@ namespace quest int forked_sungzi_mapindex (lua_State *L ) { - lua_pushnumber( L, GetSungziMapIndex() ); + lua_pushnumber( L, GetSungziMapIndex() ); - if ( test_server ) - sys_log ( 0, "forked_sungzi_map_index_by_empire %d", GetSungziMapIndex() ); + SPDLOG_TRACE("forked_sungzi_map_index_by_empire {}", GetSungziMapIndex() ); return 1; } @@ -113,7 +112,7 @@ namespace quest lua_pushstring( L, GetPassMapPath( ch->GetEmpire() ) ); - sys_log (0, "[PASS_PATH] Empire %d Path %s", ch->GetEmpire(), GetPassMapPath( ch->GetEmpire() ) ); + SPDLOG_DEBUG("[PASS_PATH] Empire {} Path {}", ch->GetEmpire(), GetPassMapPath( ch->GetEmpire() ) ); return 1; } @@ -122,7 +121,7 @@ namespace quest int iEmpire = (int)lua_tonumber(L, 1); lua_pushstring( L, GetPassMapPath(iEmpire) ); - sys_log (0, "[PASS_PATH] Empire %d Path %s", iEmpire, GetPassMapPath( iEmpire ) ); + SPDLOG_DEBUG("[PASS_PATH] Empire {} Path {}", iEmpire, GetPassMapPath( iEmpire ) ); return 1; } @@ -181,7 +180,7 @@ namespace quest if ( info == NULL ) { - sys_err( "warp_all_to_map_event> Null pointer" ); + SPDLOG_ERROR("warp_all_to_map_event> Null pointer" ); return 0; } diff --git a/src/game/src/questlua_game.cpp b/src/game/src/questlua_game.cpp index 3b41194..f69c7bd 100644 --- a/src/game/src/questlua_game.cpp +++ b/src/game/src/questlua_game.cpp @@ -8,13 +8,6 @@ #include "cmd.h" #include "packet.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - extern ACMD(do_in_game_mall); namespace quest @@ -108,7 +101,7 @@ namespace quest if (!item) { - sys_err("cannot create item vnum %d count %d", item_vnum, count); + quest_err("cannot create item vnum %d count %d", item_vnum, count); return 0; } diff --git a/src/game/src/questlua_global.cpp b/src/game/src/questlua_global.cpp index 596570e..50daeba 100644 --- a/src/game/src/questlua_global.cpp +++ b/src/game/src/questlua_global.cpp @@ -24,14 +24,6 @@ #include "guild_manager.h" #include "sectree_manager.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) - -#endif - extern ACMD(do_block_chat); namespace quest @@ -127,7 +119,7 @@ namespace quest } else { - sys_err("QUEST wrong skin index"); + quest_err("QUEST wrong skin index"); } return 0; @@ -139,7 +131,7 @@ namespace quest if ((n != 2 || !lua_isnumber(L, 2) || !lua_isstring(L, 1)) && (n != 3 || !lua_isstring(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))) { - sys_err("QUEST set_server_timer argument count wrong."); + quest_err("QUEST set_server_timer argument count wrong."); return 0; } @@ -165,7 +157,7 @@ namespace quest if ((n != 2 || !lua_isnumber(L, 2) || !lua_isstring(L, 1)) && (n != 3 || !lua_isstring(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))) { - sys_err("QUEST set_server_timer argument count wrong."); + quest_err("QUEST set_server_timer argument count wrong."); return 0; } const char * name = lua_tostring(L, 1); @@ -197,7 +189,7 @@ namespace quest int n = lua_gettop(L); if (n != 2 || !lua_isnumber(L, -1) || !lua_isstring(L, -2)) - sys_err("QUEST set_timer argument count wrong."); + quest_err("QUEST set_timer argument count wrong."); else { const char * name = lua_tostring(L, -2); @@ -220,7 +212,7 @@ namespace quest int _set_timer(lua_State* L) { if (lua_gettop(L) != 1 || !lua_isnumber(L, -1)) - sys_err("QUEST invalid argument."); + quest_err("QUEST invalid argument."); else { double t = lua_tonumber(L, -1); @@ -238,7 +230,7 @@ namespace quest if (n != 2 || !lua_isnumber(L, -1) || !lua_isstring(L, -2)) { - sys_err("QUEST set_timer argument count wrong."); + quest_err("QUEST set_timer argument count wrong."); } else { @@ -266,7 +258,7 @@ namespace quest int n = lua_gettop(L); if (n != 1 || !lua_isstring(L, -1)) - sys_err("QUEST set_timer argument count wrong."); + quest_err("QUEST set_timer argument count wrong."); else { CQuestManager & q = CQuestManager::instance(); @@ -298,12 +290,11 @@ namespace quest int _raw_script(lua_State* L) { - if ( test_server ) - sys_log ( 0, "_raw_script : %s ", lua_tostring(L,-1)); + SPDLOG_TRACE("_raw_script : {} ", lua_tostring(L,-1)); if (lua_isstring(L, -1)) CQuestManager::Instance().AddScript(lua_tostring(L,-1)); else - sys_err("QUEST wrong argument: questname: %s", CQuestManager::instance().GetCurrentQuestName().c_str()); + quest_err("QUEST wrong argument: questname: %s", CQuestManager::instance().GetCurrentQuestName().c_str()); return 0; } @@ -367,7 +358,7 @@ namespace quest if (!ch) return 0; - sys_log(0, "QUEST: quest: %s player: %s : %s", pc->GetCurrentQuestName().c_str(), ch->GetName(), lua_tostring(L, 2)); + SPDLOG_DEBUG("QUEST: quest: {} player: {} : {}", pc->GetCurrentQuestName().c_str(), ch->GetName(), lua_tostring(L, 2)); if (true == test_server) { @@ -392,7 +383,7 @@ namespace quest if (!ch) return 0; - sys_err("QUEST: quest: %s player: %s : %s", pc->GetCurrentQuestName().c_str(), ch->GetName(), lua_tostring(L, 1)); + quest_err("QUEST: quest: %s player: %s : %s", pc->GetCurrentQuestName().c_str(), ch->GetName(), lua_tostring(L, 1)); ch->ChatPacket(CHAT_TYPE_INFO, "QUEST_SYSERR %s", lua_tostring(L, 1)); return 0; } @@ -482,7 +473,7 @@ namespace quest if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: _give_char_privilege: wrong empire priv type(%u)", type); + quest_err("PRIV_MANAGER: _give_char_privilege: wrong empire priv type(%u)", type); return 0; } @@ -501,15 +492,15 @@ namespace quest if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: _give_empire_privilege: wrong empire priv type(%u)", type); + quest_err("PRIV_MANAGER: _give_empire_privilege: wrong empire priv type(%u)", type); return 0; } if (ch) - sys_log(0, "_give_empire_privileage(empire=%d, type=%d, value=%d, time=%d), by quest, %s", + SPDLOG_DEBUG("_give_empire_privileage(empire={}, type={}, value={}, time={}), by quest, {}", empire, type, value, time, ch->GetName()); else - sys_log(0, "_give_empire_privileage(empire=%d, type=%d, value=%d, time=%d), by quest, NULL", + SPDLOG_DEBUG("_give_empire_privileage(empire={}, type={}, value={}, time={}), by quest, NULL", empire, type, value, time); CPrivManager::instance().RequestGiveEmpirePriv(empire, type, value, time); @@ -525,11 +516,11 @@ namespace quest if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: _give_guild_privilege: wrong empire priv type(%u)", type); + quest_err("PRIV_MANAGER: _give_guild_privilege: wrong empire priv type(%u)", type); return 0; } - sys_log(0, "_give_guild_privileage(empire=%d, type=%d, value=%d, time=%d)", + SPDLOG_DEBUG("_give_guild_privileage(empire={}, type={}, value={}, time={})", guild_id, type, value, time); CPrivManager::instance().RequestGiveGuildPriv(guild_id,type,value,time); @@ -611,7 +602,7 @@ namespace quest int _get_guildid_byname( lua_State* L ) { if ( !lua_isstring( L, 1 ) ) { - sys_err( "_get_guildid_byname() - invalud argument" ); + quest_err( "_get_guildid_byname() - invalud argument" ); lua_pushnumber( L, 0 ); return 1; } @@ -722,7 +713,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushnumber(L, 0); return 1; } @@ -737,7 +728,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushnumber(L, 0); return 1; } @@ -749,13 +740,10 @@ namespace quest LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); LPCHARACTER tch; - if (test_server) - { - sys_log(0, "find_pc_cond map=%d, job=%d, level=%d~%d", - ch->GetMapIndex(), - uiJobFlag, - iMinLev, iMaxLev); - } + SPDLOG_TRACE("find_pc_cond map={}, job={}, level={}~{}", + ch->GetMapIndex(), + uiJobFlag, + iMinLev, iMaxLev); tch = CHARACTER_MANAGER::instance().FindSpecifyPC(uiJobFlag, ch->GetMapIndex(), @@ -771,7 +759,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushnumber(L, 0); return 1; } @@ -796,7 +784,7 @@ namespace quest } } - //sys_err("not find(race=%d)", race); + //quest_err("not find(race=%d)", race); lua_pushnumber(L, 0); return 1; @@ -815,7 +803,7 @@ namespace quest if (L!=pqs->co) { luaL_error(L, "running thread != current thread???"); - sys_log(0,"running thread != current thread???"); + SPDLOG_DEBUG("running thread != current thread???"); return -1; } if (pPC) @@ -824,8 +812,7 @@ namespace quest //const char* szStateName = lua_tostring(L, 2); const string stQuestName(lua_tostring(L, 1)); const string stStateName(lua_tostring(L, 2)); - if ( test_server ) - sys_log(0,"set_state %s %s ", stQuestName.c_str(), stStateName.c_str() ); + SPDLOG_TRACE("set_state {} {} ", stQuestName.c_str(), stStateName.c_str() ); if (pPC->GetCurrentQuestName() == stQuestName) { pqs->st = q.GetQuestStateIndex(pPC->GetCurrentQuestName(), lua_tostring(L, -1)); @@ -856,13 +843,11 @@ namespace quest lua_pushnumber(L, nRet ); - if ( test_server ) - sys_log(0,"Get_quest_state name %s value %d", stQuestName.c_str(), nRet ); + SPDLOG_TRACE("Get_quest_state name {} value {}", stQuestName.c_str(), nRet ); } else { - if ( test_server ) - sys_log(0,"PC == 0 "); + SPDLOG_TRACE("PC == 0"); lua_pushnumber(L, 0); } @@ -911,7 +896,7 @@ namespace quest BYTE bEmpire = ch->GetEmpire(); if ( bEmpire == 0 ) { - sys_err( "Unkonwn Empire %s %d ", ch->GetName(), ch->GetPlayerID() ); + quest_err( "Unkonwn Empire %s %d ", ch->GetName(), ch->GetPlayerID() ); return; } @@ -927,7 +912,7 @@ namespace quest if ( info == NULL ) { - sys_err( "warp_all_to_village_event> Null pointer" ); + quest_err( "warp_all_to_village_event> Null pointer" ); return 0; } @@ -1064,7 +1049,7 @@ namespace quest if ( COXEventManager::instance().AddQuiz(level, quiz, answer) == false ) { - sys_log(0, "OXEVENT : Cannot add quiz. %d %s %d", level, quiz, answer); + SPDLOG_ERROR("OXEVENT : Cannot add quiz. {} {} {}", level, quiz, answer); } return 1; @@ -1076,7 +1061,7 @@ namespace quest if ( info == NULL ) { - sys_err( "warp_all_to_map_my_empire_event> Null pointer" ); + quest_err( "warp_all_to_map_my_empire_event> Null pointer" ); return 0; } @@ -1161,7 +1146,7 @@ namespace quest } } - sys_log(0, "QUEST Spawn Monstster: VNUM(%u) COUNT(%u) isAggresive(%b)", dwVnum, SpawnCount, isAggresive); + SPDLOG_DEBUG("QUEST Spawn Monstster: VNUM({}) COUNT({}) isAggresive({})", dwVnum, SpawnCount, isAggresive); } lua_pushnumber(L, SpawnCount); @@ -1229,7 +1214,7 @@ namespace quest if (0 == mapIndex) { - sys_err("_purge_area: cannot get a map index with (%u, %u)", x1, y1); + quest_err("_purge_area: cannot get a map index with (%u, %u)", x1, y1); return 0; } @@ -1292,7 +1277,7 @@ namespace quest if (0 == mapIndex) { - sys_err("_warp_all_in_area_to_area: cannot get a map index with (%u, %u)", from_x1, from_y1); + quest_err("_warp_all_in_area_to_area: cannot get a map index with (%u, %u)", from_x1, from_y1); lua_pushnumber(L, 0); return 1; } @@ -1306,13 +1291,13 @@ namespace quest pSectree->for_each(func); lua_pushnumber(L, func.warpCount); - sys_log(0, "_warp_all_in_area_to_area: %u character warp", func.warpCount); + SPDLOG_DEBUG("_warp_all_in_area_to_area: {} character warp", func.warpCount); return 1; } else { lua_pushnumber(L, 0); - sys_err("_warp_all_in_area_to_area: no sectree"); + quest_err("_warp_all_in_area_to_area: no sectree"); return 1; } } @@ -1323,7 +1308,7 @@ namespace quest luaL_reg global_functions[] = { - { "sys_err", _syserr }, + { "quest_err", _syserr }, { "sys_log", _syslog }, { "char_log", _char_log }, { "item_log", _item_log }, diff --git a/src/game/src/questlua_guild.cpp b/src/game/src/questlua_guild.cpp index c2c5ed3..8ed5f97 100644 --- a/src/game/src/questlua_guild.cpp +++ b/src/game/src/questlua_guild.cpp @@ -9,13 +9,6 @@ #include "guild.h" #include "guild_manager.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - namespace quest { // @@ -85,7 +78,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -103,7 +96,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -135,7 +128,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -182,7 +175,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -195,7 +188,7 @@ namespace quest p.dwGuild = (DWORD) lua_tonumber(L, 2); p.dwGold = (DWORD) lua_tonumber(L, 3); - sys_log(0, "GUILD_WAR_BET: %s login %s war_id %u guild %u gold %u", + SPDLOG_DEBUG("GUILD_WAR_BET: {} login {} war_id {} guild {} gold {}", ch->GetName(), p.szLogin, p.dwWarID, p.dwGuild, p.dwGold); db_clientdesc->DBPacket(HEADER_GD_GUILD_WAR_BET, 0, &p, sizeof(p)); @@ -206,7 +199,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushboolean(L, true); return 1; } @@ -232,7 +225,7 @@ namespace quest int i = 0; std::vector::iterator it = con.begin(); - sys_log(0, "con.size(): %d", con.size()); + SPDLOG_DEBUG("con.size(): {}", con.size()); // stack : table1 lua_newtable(L); @@ -246,7 +239,7 @@ namespace quest lua_newtable(L); - sys_log(0, "con.size(): %u %u %u handi %d", p->dwID, p->dwGuildFrom, p->dwGuildTo, p->lHandicap); + SPDLOG_DEBUG("con.size(): {} {} {} handi {}", p->dwID, p->dwGuildFrom, p->dwGuildTo, p->lHandicap); // stack : table1 table2 lua_pushnumber(L, p->dwID); diff --git a/src/game/src/questlua_horse.cpp b/src/game/src/questlua_horse.cpp index da46282..1f44735 100644 --- a/src/game/src/questlua_horse.cpp +++ b/src/game/src/questlua_horse.cpp @@ -8,13 +8,6 @@ #include "config.h" #include "utils.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - extern int (*check_name) (const char * str); namespace quest @@ -146,7 +139,7 @@ namespace quest LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); int pct = std::clamp(ch->GetHorseHealth() * 100 / ch->GetHorseMaxHealth(), 0, 100); - sys_log(1, "horse.get_health_pct %d", pct); + SPDLOG_DEBUG("horse.get_health_pct {}", pct); if (ch->GetHorseLevel()) lua_pushnumber(L, pct); @@ -172,7 +165,7 @@ namespace quest { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); int pct = std::clamp(ch->GetHorseStamina() * 100 / ch->GetHorseMaxStamina(), 0, 100); - sys_log(1, "horse.get_stamina_pct %d", pct); + SPDLOG_DEBUG("horse.get_stamina_pct {}", pct); if (ch->GetHorseLevel()) lua_pushnumber(L, pct); diff --git a/src/game/src/questlua_item.cpp b/src/game/src/questlua_item.cpp index da0ac35..c5e0978 100644 --- a/src/game/src/questlua_item.cpp +++ b/src/game/src/questlua_item.cpp @@ -6,13 +6,6 @@ #include "over9refine.h" #include "log.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - namespace quest { // @@ -97,7 +90,7 @@ namespace quest if (q.GetCurrentCharacterPtr() == item->GetOwner()) { ITEM_MANAGER::instance().RemoveItem(item); } else { - sys_err("Tried to remove invalid item %p", get_pointer(item)); + quest_err("Tried to remove invalid item %p", get_pointer(item)); } q.ClearCurrentItem(); } @@ -156,7 +149,7 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("flag is not a number."); + quest_err("flag is not a number."); lua_pushboolean(L, 0); return 1; } @@ -186,7 +179,7 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("index is not a number"); + quest_err("index is not a number"); lua_pushnumber(L, 0); return 1; } @@ -195,7 +188,7 @@ namespace quest if (index < 0 || index >= ITEM_VALUES_MAX_NUM) { - sys_err("index(%d) is out of range (0..%d)", index, ITEM_VALUES_MAX_NUM); + quest_err("index(%d) is out of range (0..%d)", index, ITEM_VALUES_MAX_NUM); lua_pushnumber(L, 0); } else @@ -217,7 +210,7 @@ namespace quest if (false == (lua_isnumber(L, 1) && lua_isnumber(L, 2) && lua_isnumber(L, 3))) { - sys_err("index is not a number"); + quest_err("index is not a number"); lua_pushnumber(L, 0); return 1; } @@ -322,7 +315,7 @@ namespace quest } else { - sys_err("Cannot find item table of vnum %u", vnum); + quest_err("Cannot find item table of vnum %u", vnum); lua_pushnumber(L, 0); } return 1; diff --git a/src/game/src/questlua_marriage.cpp b/src/game/src/questlua_marriage.cpp index fb08d54..cbe769e 100644 --- a/src/game/src/questlua_marriage.cpp +++ b/src/game/src/questlua_marriage.cpp @@ -6,13 +6,6 @@ #include "utils.h" #include "config.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - extern int g_nPortalLimitTime; namespace quest @@ -35,7 +28,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } marriage::CManager::instance().RequestRemove(ch->GetPlayerID(), pMarriage->GetOther(ch->GetPlayerID())); @@ -48,7 +41,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } pMarriage->SetMarried(); @@ -109,7 +102,7 @@ namespace quest { if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) { - sys_err("invalid player id for wedding map"); + quest_err("invalid player id for wedding map"); return 0; } @@ -121,12 +114,12 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(pid1); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->GetOther(pid1) != pid2) { - sys_err("not married %u %u", pid1, pid2); + quest_err("not married %u %u", pid1, pid2); return 0; } //PREVENT_HACK @@ -144,7 +137,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } @@ -164,7 +157,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->pWeddingInfo) @@ -179,7 +172,7 @@ namespace quest { if (!lua_isboolean(L, 1)) { - sys_err("invalid argument 1 : must be boolean"); + quest_err("invalid argument 1 : must be boolean"); return 0; } LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); @@ -187,7 +180,7 @@ namespace quest if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->pWeddingInfo) @@ -203,7 +196,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_err("invalid argument 1 : must be string"); + quest_err("invalid argument 1 : must be string"); return 0; } @@ -211,7 +204,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->pWeddingInfo) @@ -229,7 +222,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->pWeddingInfo) @@ -248,12 +241,12 @@ namespace quest { if (!lua_isboolean(L, 1)) { - sys_err("invalid argument 1 : must be boolean"); + quest_err("invalid argument 1 : must be boolean"); return 0; } if (!lua_isstring(L, 2)) { - sys_err("invalid argument 2 : must be string"); + quest_err("invalid argument 2 : must be string"); return 0; } @@ -261,7 +254,7 @@ namespace quest marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->pWeddingInfo) @@ -278,14 +271,14 @@ namespace quest { if (!lua_isboolean(L, 1)) { - sys_err("invalid argument 1 : must be boolean"); + quest_err("invalid argument 1 : must be boolean"); return 0; } LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(ch->GetPlayerID()); if (!pMarriage) { - sys_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); + quest_err("pid[%d:%s] is not exist couple", ch->GetPlayerID(), ch->GetName()); return 0; } if (pMarriage->pWeddingInfo) @@ -318,7 +311,7 @@ namespace quest if (!pMarriage) { - sys_err("trying to get time for not married character"); + quest_err("trying to get time for not married character"); lua_pushnumber(L, 0); return 1; } diff --git a/src/game/src/questlua_monarch.cpp b/src/game/src/questlua_monarch.cpp index 96868b0..53142fe 100644 --- a/src/game/src/questlua_monarch.cpp +++ b/src/game/src/questlua_monarch.cpp @@ -8,7 +8,6 @@ #include "config.h" #include "mob_manager.h" #include "castle.h" -#include "dev_log.h" #include "char.h" #include "char_manager.h" #include "utils.h" @@ -16,13 +15,6 @@ #include "guild.h" #include "sectree_manager.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - ACMD(do_monarch_mob); namespace quest @@ -60,7 +52,7 @@ namespace quest if ( info == NULL ) { - sys_err( "monarch_powerup_event> Null pointer" ); + quest_err( "monarch_powerup_event> Null pointer" ); return 0; } @@ -84,7 +76,7 @@ namespace quest if ( info == NULL ) { - sys_err( "monarch_defenseup_event> Null pointer" ); + quest_err( "monarch_defenseup_event> Null pointer" ); return 0; } @@ -104,7 +96,7 @@ namespace quest int nEmpire = ch->GetEmpire(); nMoney = nMoney * 10000; - sys_log(0 ,"[MONARCH] Take Money Empire(%d) pid(%d) Money(%d)", ch->GetEmpire(), ch->GetPlayerID(), nMoney); + SPDLOG_DEBUG("[MONARCH] Take Money Empire({}) pid({}) Money({})", ch->GetEmpire(), ch->GetPlayerID(), nMoney); db_clientdesc->DBPacketHeader(HEADER_GD_TAKE_MONARCH_MONEY, ch->GetDesc()->GetHandle(), sizeof(int) * 3); @@ -146,7 +138,7 @@ namespace quest if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", ch->GetPlayerID()); + quest_err("No Monarch pid %d ", ch->GetPlayerID()); return 0; } } @@ -182,7 +174,7 @@ namespace quest if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", ch->GetPlayerID()); + quest_err("No Monarch pid %d ", ch->GetPlayerID()); return 0; } } @@ -240,7 +232,7 @@ namespace quest if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", ch->GetPlayerID()); + quest_err("No Monarch pid %d ", ch->GetPlayerID()); return 0; } } @@ -295,7 +287,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -320,7 +312,7 @@ namespace quest if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", ch->GetPlayerID()); + quest_err("No Monarch pid %d ", ch->GetPlayerID()); return 0; } } @@ -382,7 +374,7 @@ namespace quest // mob_level(0-2), region(0~3) if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -408,7 +400,7 @@ namespace quest if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", ch->GetPlayerID()); + quest_err("No Monarch pid %d ", ch->GetPlayerID()); return 0; } } @@ -457,7 +449,7 @@ namespace quest if (!ch->IsGM()) { ch->ChatPacket(CHAT_TYPE_INFO ,LC_TEXT("±ºÁÖÀÇ ÀÚ°ÝÀ» °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù")); - sys_err("No Monarch pid %d ", ch->GetPlayerID()); + quest_err("No Monarch pid %d ", ch->GetPlayerID()); return 0; } } @@ -481,7 +473,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -637,7 +629,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } @@ -804,7 +796,7 @@ namespace quest if ( info == NULL ) { - sys_err( "monarch_transfer2_event> Null pointer" ); + quest_err( "monarch_transfer2_event> Null pointer" ); return 0; } diff --git a/src/game/src/questlua_npc.cpp b/src/game/src/questlua_npc.cpp index 270cf39..5752f2c 100644 --- a/src/game/src/questlua_npc.cpp +++ b/src/game/src/questlua_npc.cpp @@ -190,7 +190,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid vid"); + SPDLOG_ERROR("invalid vid"); lua_pushboolean(L, 0); return 1; } diff --git a/src/game/src/questlua_party.cpp b/src/game/src/questlua_party.cpp index 16ed660..607377e 100644 --- a/src/game/src/questlua_party.cpp +++ b/src/game/src/questlua_party.cpp @@ -8,13 +8,6 @@ #include "questmanager.h" #include "packet.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - namespace quest { using namespace std; @@ -66,11 +59,11 @@ namespace quest void operator()(LPCHARACTER ch) { - sys_log(0, "CINEMASEND_TRY %s", ch->GetName()); + SPDLOG_DEBUG("CINEMASEND_TRY {}", ch->GetName()); if (ch->GetDesc()) { - sys_log(0, "CINEMASEND %s", ch->GetName()); + SPDLOG_DEBUG("CINEMASEND {}", ch->GetName()); ch->GetDesc()->RawPacket(&pack, sizeof(struct packet_script)); ch->GetDesc()->Packet(data.c_str(),data.size()); } @@ -82,7 +75,7 @@ namespace quest if (!lua_isstring(L, 1)) return 0; - sys_log(0, "RUN_CINEMA %s", lua_tostring(L, 1)); + SPDLOG_DEBUG("RUN_CINEMA {}", lua_tostring(L, 1)); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (ch->GetParty()) @@ -115,11 +108,11 @@ namespace quest void operator()(LPCHARACTER ch) { - sys_log(0, "CINEMASEND_TRY %s", ch->GetName()); + SPDLOG_DEBUG("CINEMASEND_TRY {}", ch->GetName()); if (ch->GetDesc()) { - sys_log(0, "CINEMASEND %s", ch->GetName()); + SPDLOG_DEBUG("CINEMASEND {}", ch->GetName()); ch->GetDesc()->RawPacket(&packet_script, sizeof(struct packet_script)); ch->GetDesc()->Packet(str,len); } @@ -131,7 +124,7 @@ namespace quest if (!lua_isstring(L, 1)) return 0; - sys_log(0, "CINEMA %s", lua_tostring(L, 1)); + SPDLOG_DEBUG("CINEMA {}", lua_tostring(L, 1)); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (ch->GetParty()) diff --git a/src/game/src/questlua_pc.cpp b/src/game/src/questlua_pc.cpp index 55a8c87..3d0e3a8 100644 --- a/src/game/src/questlua_pc.cpp +++ b/src/game/src/questlua_pc.cpp @@ -24,12 +24,6 @@ #include "mob_manager.h" #include -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif extern int g_nPortalLimitTime; extern LPCLIENT_DESC db_clientdesc; @@ -76,7 +70,7 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("wrong skill index"); + quest_err("wrong skill index"); return 0; } @@ -90,13 +84,13 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("wrong map index"); + quest_err("wrong map index"); return 0; } if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("wrong coodinate"); + quest_err("wrong coodinate"); return 0; } @@ -110,13 +104,13 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("wrong map index"); + quest_err("wrong map index"); return 0; } if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("wrong coodinate"); + quest_err("wrong coodinate"); return 0; } @@ -125,7 +119,7 @@ namespace quest if (!region) { - sys_err("invalid map index %d", lMapIndex); + quest_err("invalid map index %d", lMapIndex); return 0; } @@ -134,13 +128,13 @@ namespace quest if (x > region->ex - region->sx) { - sys_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x); + quest_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x); return 0; } if (y > region->ey - region->sy) { - sys_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y); + quest_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y); return 0; } @@ -195,13 +189,13 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("no map index argument"); + quest_err("no map index argument"); return 0; } if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("no coodinate argument"); + quest_err("no coodinate argument"); return 0; } @@ -210,7 +204,7 @@ namespace quest if (!region) { - sys_err("invalid map index %d", lMapIndex); + quest_err("invalid map index %d", lMapIndex); return 0; } @@ -219,13 +213,13 @@ namespace quest if (x > region->ex - region->sx) { - sys_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x); + quest_err("x coordinate overflow max: %d input: %d", region->ex - region->sx, x); return 0; } if (y > region->ey - region->sy) { - sys_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y); + quest_err("y coordinate overflow max: %d input: %d", region->ey - region->sy, y); return 0; } @@ -329,7 +323,7 @@ namespace quest if (!lua_isnumber(L, 1)) { - sys_err("QUEST : wrong argument"); + quest_err("QUEST : wrong argument"); return 0; } @@ -337,7 +331,7 @@ namespace quest if (iAmount <= 0) { - sys_err("QUEST : gold amount less then zero"); + quest_err("QUEST : gold amount less then zero"); return 0; } @@ -447,7 +441,7 @@ namespace quest if (!lua_isstring(L, 1) || !(lua_isstring(L, 2)||lua_isnumber(L, 2))) { - sys_err("QUEST : wrong argument"); + quest_err("QUEST : wrong argument"); return 0; } @@ -457,7 +451,7 @@ namespace quest dwVnum = (int) lua_tonumber(L, 2); else if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L, 2), dwVnum)) { - sys_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1)); + quest_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1)); return 0; } @@ -469,7 +463,7 @@ namespace quest if (icount <= 0) { - sys_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L, 2)); + quest_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L, 2)); return 0; } } @@ -486,7 +480,7 @@ namespace quest if (!lua_isstring(L, 1) && !lua_isnumber(L, 1)) { - sys_err("QUEST Make item call error : wrong argument"); + quest_err("QUEST Make item call error : wrong argument"); lua_pushnumber (L, 0); return 1; } @@ -499,7 +493,7 @@ namespace quest } else if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L, 1), dwVnum)) { - sys_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1)); + quest_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1)); lua_pushnumber (L, 0); return 1; @@ -511,13 +505,13 @@ namespace quest icount = (int)rint(lua_tonumber(L,2)); if (icount<=0) { - sys_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L,2)); + quest_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L,2)); lua_pushnumber (L, 0); return 1; } } - sys_log(0, "QUEST [REWARD] item %s to %s", lua_tostring(L, 1), ch->GetName()); + SPDLOG_DEBUG("QUEST [REWARD] item {} to {}", lua_tostring(L, 1), ch->GetName()); PC* pPC = CQuestManager::instance().GetCurrentPC(); @@ -543,7 +537,7 @@ namespace quest if (!lua_isstring(L, 1) && !lua_isnumber(L, 1)) { - sys_err("QUEST Make item call error : wrong argument"); + quest_err("QUEST Make item call error : wrong argument"); return 0; } @@ -555,7 +549,7 @@ namespace quest } else if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L, 1), dwVnum)) { - sys_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1)); + quest_err("QUEST Make item call error : wrong item name : %s", lua_tostring(L,1)); return 0; } @@ -565,12 +559,12 @@ namespace quest icount = (int)rint(lua_tonumber(L,2)); if (icount<=0) { - sys_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L,2)); + quest_err("QUEST Make item call error : wrong item count : %g", lua_tonumber(L,2)); return 0; } } - sys_log(0, "QUEST [REWARD] item %s to %s", lua_tostring(L, 1), ch->GetName()); + SPDLOG_DEBUG("QUEST [REWARD] item {} to {}", lua_tostring(L, 1), ch->GetName()); PC* pPC = CQuestManager::instance().GetCurrentPC(); @@ -645,7 +639,7 @@ namespace quest if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L,1), item_vnum)) { - sys_err("QUEST count_item call error : wrong item name : %s", lua_tostring(L,1)); + quest_err("QUEST count_item call error : wrong item name : %s", lua_tostring(L,1)); lua_pushnumber(L, 0); } else @@ -673,17 +667,17 @@ namespace quest { if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L,1), item_vnum)) { - sys_err("QUEST remove_item call error : wrong item name : %s", lua_tostring(L,1)); + quest_err("QUEST remove_item call error : wrong item name : %s", lua_tostring(L,1)); return 0; } } else { - sys_err("QUEST remove_item wrong argument"); + quest_err("QUEST remove_item wrong argument"); return 0; } - sys_log(0,"QUEST remove a item vnum %d of %s[%d]", item_vnum, CQuestManager::instance().GetCurrentCharacterPtr()->GetName(), CQuestManager::instance().GetCurrentCharacterPtr()->GetPlayerID()); + SPDLOG_DEBUG("QUEST remove a item vnum {} of {}[{}]", item_vnum, CQuestManager::instance().GetCurrentCharacterPtr()->GetName(), CQuestManager::instance().GetCurrentCharacterPtr()->GetPlayerID()); CQuestManager::instance().GetCurrentCharacterPtr()->RemoveSpecifyItem(item_vnum); } else if (lua_gettop(L) == 2) @@ -698,18 +692,18 @@ namespace quest { if (!ITEM_MANAGER::instance().GetVnum(lua_tostring(L,1), item_vnum)) { - sys_err("QUEST remove_item call error : wrong item name : %s", lua_tostring(L,1)); + quest_err("QUEST remove_item call error : wrong item name : %s", lua_tostring(L,1)); return 0; } } else { - sys_err("QUEST remove_item wrong argument"); + quest_err("QUEST remove_item wrong argument"); return 0; } DWORD item_count = (DWORD) lua_tonumber(L, 2); - sys_log(0, "QUEST remove items(vnum %d) count %d of %s[%d]", + SPDLOG_DEBUG("QUEST remove items(vnum {}) count {} of {}[{}]", item_vnum, item_count, CQuestManager::instance().GetCurrentCharacterPtr()->GetName(), @@ -795,7 +789,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushboolean(L, 0); return 1; } @@ -849,7 +843,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); return 0; } else @@ -858,7 +852,7 @@ namespace quest LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); - sys_log(0,"QUEST [LEVEL] %s jumpint to level %d", ch->GetName(), (int)rint(lua_tonumber(L,1))); + SPDLOG_DEBUG("QUEST [LEVEL] {} jumpint to level {}", ch->GetName(), (int)rint(lua_tonumber(L,1))); PC* pPC = CQuestManager::instance().GetCurrentPC(); LogManager::instance().QuestRewardLog(pPC->GetCurrentQuestName().c_str(), ch->GetPlayerID(), ch->GetLevel(), newLevel, 0); @@ -914,7 +908,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("QUEST wrong set flag"); + quest_err("QUEST wrong set flag"); return 0; } @@ -967,7 +961,7 @@ namespace quest LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (gold + ch->GetGold() < 0) - sys_err("QUEST wrong ChangeGold %d (now %d)", gold, ch->GetGold()); + quest_err("QUEST wrong ChangeGold %d (now %d)", gold, ch->GetGold()); else { DBManager::instance().SendMoneyLog(MONEY_LOG_QUEST, ch->GetPlayerID(), gold); @@ -981,7 +975,7 @@ namespace quest { if (!lua_isstring(L, 1) || !lua_isstring(L, 2) || !lua_isnumber(L, 3)) { - sys_err("QUEST wrong set flag"); + quest_err("QUEST wrong set flag"); return 0; } else @@ -999,7 +993,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isstring(L,2)) { - sys_err("QUEST wrong get flag"); + quest_err("QUEST wrong get flag"); return 0; } else @@ -1021,7 +1015,7 @@ namespace quest { if (!lua_isstring(L,-1)) { - sys_err("QUEST wrong get flag"); + quest_err("QUEST wrong get flag"); return 0; } else @@ -1038,7 +1032,7 @@ namespace quest { if (!lua_isstring(L,-1)) { - sys_err("QUEST wrong get flag"); + quest_err("QUEST wrong get flag"); return 0; } else @@ -1047,8 +1041,7 @@ namespace quest CQuestManager& q = CQuestManager::Instance(); PC* pPC = q.GetCurrentPC(); lua_pushnumber(L,pPC->GetFlag(pPC->GetCurrentQuestName() + "."+sz)); - if ( test_server ) - sys_log( 0 ,"GetQF ( %s . %s )", pPC->GetCurrentQuestName().c_str(), sz ); + SPDLOG_TRACE("GetQF ( {} . {} )", pPC->GetCurrentQuestName().c_str(), sz ); } return 1; } @@ -1057,7 +1050,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isnumber(L,2)) { - sys_err("QUEST wrong set flag"); + quest_err("QUEST wrong set flag"); } else { @@ -1073,7 +1066,7 @@ namespace quest { if (!lua_isstring(L,1) || !lua_isnumber(L,2)) { - sys_err("QUEST wrong set flag"); + quest_err("QUEST wrong set flag"); } else { @@ -1089,7 +1082,7 @@ namespace quest { if (!lua_isstring(L, 1)) { - sys_err("argument error"); + quest_err("argument error"); return 0; } @@ -1106,7 +1099,7 @@ namespace quest if (!lua_isnumber(L,1)) return 0; - sys_log(0,"QUEST [REWARD] %s give exp2 %d", ch->GetName(), (int)rint(lua_tonumber(L,1))); + SPDLOG_DEBUG("QUEST [REWARD] {} give exp2 {}", ch->GetName(), (int)rint(lua_tonumber(L,1))); DWORD exp = (DWORD)rint(lua_tonumber(L,1)); @@ -1124,7 +1117,7 @@ namespace quest CQuestManager& q = CQuestManager::instance(); LPCHARACTER ch = q.GetCurrentCharacterPtr(); - sys_log(0,"QUEST [REWARD] %s give exp %s %d", ch->GetName(), lua_tostring(L,1), (int)rint(lua_tonumber(L,2))); + SPDLOG_DEBUG("QUEST [REWARD] {} give exp {} {}", ch->GetName(), lua_tostring(L,1), (int)rint(lua_tonumber(L,2))); DWORD exp = (DWORD)rint(lua_tonumber(L,2)); @@ -1147,7 +1140,7 @@ namespace quest int lev = (int)rint(lua_tonumber(L,2)); double proc = (lua_tonumber(L,3)); - sys_log(0, "QUEST [REWARD] %s give exp %s lev %d percent %g%%", ch->GetName(), lua_tostring(L, 1), lev, proc); + SPDLOG_DEBUG("QUEST [REWARD] {} give exp {} lev {} percent {}%", ch->GetName(), lua_tostring(L, 1), lev, proc); DWORD exp = (DWORD)((exp_table[std::clamp(lev, 0, PLAYER_EXP_TABLE_MAX)] * proc) / 100); PC * pPC = CQuestManager::instance().GetCurrentPC(); @@ -1202,7 +1195,7 @@ namespace quest int pc_set_skillgroup(lua_State* L) { if (!lua_isnumber(L, 1)) - sys_err("QUEST wrong skillgroup number"); + quest_err("QUEST wrong skillgroup number"); else { CQuestManager & q = CQuestManager::Instance(); @@ -1434,14 +1427,14 @@ namespace quest if (!lua_isnumber(L,1) || !lua_isnumber(L,2)) { - sys_err("invalid x y position"); + quest_err("invalid x y position"); lua_pushboolean(L, 0); return 1; } if (!lua_isnumber(L,2)) { - sys_err("invalid radius"); + quest_err("invalid radius"); lua_pushboolean(L, 0); return 1; } @@ -1481,7 +1474,7 @@ namespace quest int cell = (int) lua_tonumber(L, 1); if (cell < 0 || cell >= WEAR_MAX_NUM) { - sys_err("invalid wear position %d", cell); + quest_err("invalid wear position %d", cell); lua_pushnumber(L, 0); return 1; } @@ -1502,7 +1495,7 @@ namespace quest LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushboolean(L, 0); return 1; } @@ -1580,7 +1573,7 @@ namespace quest { if (!lua_isnumber(L, 1)) { - sys_err("invalid argument"); + quest_err("invalid argument"); lua_pushnumber(L, 0); return 1; } @@ -1598,7 +1591,7 @@ namespace quest CQuestManager& q = CQuestManager::instance(); LPCHARACTER ch = q.GetCurrentCharacterPtr(); - sys_log(0, "TRY GIVE LOTTO TO pid %u", ch->GetPlayerID()); + SPDLOG_DEBUG("TRY GIVE LOTTO TO pid {}", ch->GetPlayerID()); DWORD * pdw = M2_NEW DWORD[3]; @@ -1819,17 +1812,17 @@ namespace quest int pc_clear_one_skill(lua_State* L) { int vnum = (int)lua_tonumber(L, 1); - sys_log(0, "%d skill clear", vnum); + SPDLOG_DEBUG("{} skill clear", vnum); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if ( ch == NULL ) { - sys_log(0, "skill clear fail"); + SPDLOG_ERROR("skill clear fail"); lua_pushnumber(L, 0); return 1; } - sys_log(0, "%d skill clear", vnum); + SPDLOG_DEBUG("{} skill clear", vnum); ch->ResetOneSkill(vnum); @@ -1967,7 +1960,7 @@ teleport_area: { if ( lua_isnumber(L, 1) != true && lua_isnumber(L, 2) != true && lua_isnumber(L, 3) != true && lua_isnumber(L, 4) != true ) { - sys_err("Wrong Quest Function Arguments: pc_give_polymorph_book"); + quest_err("Wrong Quest Function Arguments: pc_give_polymorph_book"); return 0; } @@ -1998,7 +1991,7 @@ teleport_area: if (!lua_isnumber(L, 1)) { - sys_err("wrong premium index (is not number)"); + quest_err("wrong premium index (is not number)"); return 0; } @@ -2015,7 +2008,7 @@ teleport_area: break; default: - sys_err("wrong premium index %d", premium_type); + quest_err("wrong premium index %d", premium_type); return 0; } @@ -2696,7 +2689,7 @@ teleport_area: if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isstring(L, 3) ) { - sys_err("QUEST give award call error : wrong argument"); + quest_err("QUEST give award call error : wrong argument"); lua_pushnumber (L, 0); return 1; } @@ -2705,7 +2698,7 @@ teleport_area: int icount = (int) lua_tonumber(L, 2); - sys_log(0, "QUEST [award] item %d to login %s", dwVnum, ch->GetDesc()->GetAccountTable().login); + SPDLOG_DEBUG("QUEST [award] item {} to login {}", dwVnum, ch->GetDesc()->GetAccountTable().login); DBManager::instance().Query("INSERT INTO item_award (login, vnum, count, given_time, why, mall)select '%s', %d, %d, now(), '%s', 1 from DUAL where not exists (select login, why from item_award where login = '%s' and why = '%s') ;", ch->GetDesc()->GetAccountTable().login, @@ -2724,7 +2717,7 @@ teleport_area: if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isstring(L, 3) || !lua_isstring(L, 4) || !lua_isstring(L, 5) || !lua_isstring(L, 6) ) { - sys_err("QUEST give award call error : wrong argument"); + quest_err("QUEST give award call error : wrong argument"); lua_pushnumber (L, 0); return 1; } @@ -2733,7 +2726,7 @@ teleport_area: int icount = (int) lua_tonumber(L, 2); - sys_log(0, "QUEST [award] item %d to login %s", dwVnum, ch->GetDesc()->GetAccountTable().login); + SPDLOG_DEBUG("QUEST [award] item {} to login {}", dwVnum, ch->GetDesc()->GetAccountTable().login); DBManager::instance().Query("INSERT INTO item_award (login, vnum, count, given_time, why, mall, socket0, socket1, socket2)select '%s', %d, %d, now(), '%s', 1, %s, %s, %s from DUAL where not exists (select login, why from item_award where login = '%s' and why = '%s') ;", ch->GetDesc()->GetAccountTable().login, @@ -2756,7 +2749,7 @@ teleport_area: if( pChar != NULL ) { - //sys_err("quest cmd test %s", pChar->GetItemAward_cmd() ); + //quest_err("quest cmd test %s", pChar->GetItemAward_cmd() ); lua_pushstring(L, pChar->GetItemAward_cmd() ); } else @@ -2787,7 +2780,7 @@ teleport_area: int iDeltaPercent, iRandRange; if (NULL == pKillee || !ITEM_MANAGER::instance().GetDropPct(pKillee, pChar, iDeltaPercent, iRandRange)) { - sys_err("killee is null"); + quest_err("killee is null"); lua_pushnumber(L, -1); lua_pushnumber(L, -1); diff --git a/src/game/src/questlua_pet.cpp b/src/game/src/questlua_pet.cpp index 87ccefd..d5c62dd 100644 --- a/src/game/src/questlua_pet.cpp +++ b/src/game/src/questlua_pet.cpp @@ -10,13 +10,6 @@ #include "PetSystem.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - extern int (*check_name) (const char * str); namespace quest diff --git a/src/game/src/questlua_quest.cpp b/src/game/src/questlua_quest.cpp index e20fa19..b442cb5 100644 --- a/src/game/src/questlua_quest.cpp +++ b/src/game/src/questlua_quest.cpp @@ -3,13 +3,6 @@ #include "questlua.h" #include "questmanager.h" -#undef sys_err -#ifndef __WIN32__ -#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif - namespace quest { // @@ -113,7 +106,7 @@ namespace quest { if (lua_tostring(L, -1)==NULL) { - sys_err("state name is empty"); + quest_err("state name is empty"); return 0; } @@ -125,8 +118,7 @@ namespace quest if (L!=pqs->co) { luaL_error(L, "running thread != current thread???"); - if ( test_server ) - sys_log(0 ,"running thread != current thread???"); + SPDLOG_ERROR("running thread != current thread???"); return 0; } @@ -138,8 +130,7 @@ namespace quest //cerr << endl; // std::string stCurrentState = lua_tostring(L,-1); - if ( test_server ) - sys_log ( 0 ,"questlua->setstate( %s, %s )", pPC->GetCurrentQuestName().c_str(), stCurrentState.c_str() ); + SPDLOG_TRACE("questlua->setstate( {}, {} )", pPC->GetCurrentQuestName().c_str(), stCurrentState.c_str() ); pqs->st = q.GetQuestStateIndex(pPC->GetCurrentQuestName(), stCurrentState); pPC->SetCurrentQuestStateName(stCurrentState ); } @@ -152,21 +143,21 @@ namespace quest // other_pc_block ³»ºÎ¿¡¼­´Â yield°¡ ÀϾ¼­´Â ¾ÈµÈ´Ù. Àý´ë·Î. if (q.IsInOtherPCBlock()) { - sys_err("FATAL ERROR! Yield occur in other_pc_block."); + quest_err("FATAL ERROR! Yield occur in other_pc_block."); PC* pPC = q.GetOtherPCBlockRootPC(); if (NULL == pPC) { - sys_err(" ... FFFAAATTTAAALLL Error. RootPC is NULL"); + quest_err(" ... FFFAAATTTAAALLL Error. RootPC is NULL"); return 0; } QuestState* pQS = pPC->GetRunningQuestState(); if (NULL == pQS || NULL == q.GetQuestStateName(pPC->GetCurrentQuestName(), pQS->st)) { - sys_err(" ... WHO AM I? WHERE AM I? I only know QuestName(%s)...", pPC->GetCurrentQuestName().c_str()); + quest_err(" ... WHO AM I? WHERE AM I? I only know QuestName(%s)...", pPC->GetCurrentQuestName().c_str()); } else { - sys_err(" Current Quest(%s). State(%s)", pPC->GetCurrentQuestName().c_str(), q.GetQuestStateName(pPC->GetCurrentQuestName(), pQS->st)); + quest_err(" Current Quest(%s). State(%s)", pPC->GetCurrentQuestName().c_str(), q.GetQuestStateName(pPC->GetCurrentQuestName(), pQS->st)); } return 0; } diff --git a/src/game/src/questlua_speedserver.cpp b/src/game/src/questlua_speedserver.cpp index 17163ab..1fd8c68 100644 --- a/src/game/src/questlua_speedserver.cpp +++ b/src/game/src/questlua_speedserver.cpp @@ -11,14 +11,14 @@ namespace quest { if (!lua_isnumber(L,1) || !lua_isnumber(L,2)) { - sys_err("wrong argument"); + SPDLOG_ERROR("wrong argument"); } BYTE empire = lua_tonumber(L,1); if (empire > 3) { - sys_err("invalid empire"); + SPDLOG_ERROR("invalid empire"); return 0; } @@ -26,11 +26,11 @@ namespace quest if (wday < 0 || wday > 6) { - sys_err ("wrong day"); + SPDLOG_ERROR("wrong day"); return 0; } - sys_log (0, "empire %d wday %d",empire, wday); + SPDLOG_DEBUG("empire {} wday {}",empire, wday); std::list time_lst = CSpeedServerManager::instance().GetWdayExpTableOfEmpire(empire, wday); @@ -38,7 +38,7 @@ namespace quest for (std::list ::iterator it = time_lst.begin(); it != time_lst.end(); it++) { - sys_log (0, "%d",i); + SPDLOG_DEBUG("{}",i); lua_pushnumber (L, it->hour); lua_pushnumber (L, it->min); lua_pushnumber (L, it->exp); @@ -65,14 +65,14 @@ namespace quest { if (!lua_isnumber (L, 1) || !lua_isnumber (L, 2)) { - sys_err ("invalid argument."); + SPDLOG_ERROR("invalid argument."); return 0; } BYTE empire = lua_tonumber (L, 1); int wday = lua_tonumber (L, 2); - sys_log (0, "init_wday %d %d",empire, wday); + SPDLOG_DEBUG("init_wday {} {}",empire, wday); CSpeedServerManager::instance().InitWdayExpTableOfEmpire (empire, wday - 1); @@ -83,20 +83,20 @@ namespace quest { if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4)) { - sys_err("wrong argument"); + SPDLOG_ERROR("wrong argument"); } BYTE empire = lua_tonumber(L,1); if (empire > 4) { - sys_err("invalid empire"); + SPDLOG_ERROR("invalid empire"); return 0; } Date date = Date (lua_tonumber(L,2) - 1900, lua_tonumber(L,3) - 1, lua_tonumber(L,4)); - sys_log (0, "empire %d date %d %d %d", empire, date.year, date.mon, date.day); + SPDLOG_DEBUG("empire {} date {} {} {}", empire, date.year, date.mon, date.day); bool is_exist; @@ -125,7 +125,7 @@ namespace quest if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4) || !lua_isnumber(L,5) || !lua_isnumber(L,6) || !lua_isnumber(L,7)) { - sys_err("wrong argument"); + SPDLOG_ERROR("wrong argument"); } BYTE empire = lua_tonumber (L, 1); @@ -134,7 +134,7 @@ namespace quest BYTE end_minite = lua_tonumber(L, 6); int exp_percent = lua_tonumber(L, 7); - sys_log (0,"h %d m %d e %d", end_hour, end_minite, exp_percent); + SPDLOG_DEBUG("h {} m {} e {}", end_hour, end_minite, exp_percent); CSpeedServerManager::instance().SetHolidayExpTableOfEmpire (empire, date, HME (end_hour, end_minite, exp_percent)); @@ -145,7 +145,7 @@ namespace quest { if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4)) { - sys_err("wrong argument"); + SPDLOG_ERROR("wrong argument"); } BYTE empire = lua_tonumber (L, 1); @@ -160,7 +160,7 @@ namespace quest { if (!lua_isnumber (L, 1)) { - sys_err ("invalid empire"); + SPDLOG_ERROR("invalid empire"); return 0; } BYTE empire = lua_tonumber(L, 1); @@ -176,7 +176,7 @@ namespace quest lua_pushnumber (L, duration); lua_pushboolean (L, is_change); - sys_log (0, "empire : %d is_change : %d",empire, is_change); + SPDLOG_DEBUG("empire : {} is_change : {}",empire, is_change); return 5; } diff --git a/src/game/src/questlua_target.cpp b/src/game/src/questlua_target.cpp index 165bb71..2f7264b 100644 --- a/src/game/src/questlua_target.cpp +++ b/src/game/src/questlua_target.cpp @@ -16,7 +16,7 @@ namespace quest if (!lua_isstring(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) { - sys_err("invalid argument, name: %s, quest_index %d", ch->GetName(), iQuestIndex); + SPDLOG_ERROR("invalid argument, name: {}, quest_index {}", ch->GetName(), iQuestIndex); return 0; } @@ -24,7 +24,7 @@ namespace quest if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), pos)) { - sys_err("cannot find base position in this map %d", ch->GetMapIndex()); + SPDLOG_ERROR("cannot find base position in this map {}", ch->GetMapIndex()); return 0; } @@ -51,7 +51,7 @@ namespace quest if (!lua_isstring(L, 1) || !lua_isnumber(L, 2)) { - sys_err("invalid argument, name: %s, quest_index %d", ch->GetName(), iQuestIndex); + SPDLOG_ERROR("invalid argument, name: {}, quest_index {}", ch->GetName(), iQuestIndex); return 0; } @@ -77,7 +77,7 @@ namespace quest if (!lua_isstring(L, 1)) { - sys_err("invalid argument, name: %s, quest_index %d", ch->GetName(), iQuestIndex); + SPDLOG_ERROR("invalid argument, name: {}, quest_index {}", ch->GetName(), iQuestIndex); return 0; } @@ -104,7 +104,7 @@ namespace quest if (!lua_isstring(L, 1)) { - sys_err("invalid argument, name: %s, quest_index %u", ch->GetName(), dwQuestIndex); + SPDLOG_ERROR("invalid argument, name: {}, quest_index {}", ch->GetName(), dwQuestIndex); lua_pushnumber(L, 0); return 1; } @@ -117,7 +117,7 @@ namespace quest if ( pInfo == NULL ) { - sys_err( "target_id> Null pointer" ); + SPDLOG_ERROR("target_id> Null pointer" ); lua_pushnumber(L, 0); return 1; } diff --git a/src/game/src/questmanager.cpp b/src/game/src/questmanager.cpp index a4526f2..054b62a 100644 --- a/src/game/src/questmanager.cpp +++ b/src/game/src/questmanager.cpp @@ -90,9 +90,9 @@ namespace quest int line = 0; if (!inf.is_open()) - sys_err( "QUEST Cannot open 'questnpc.txt'"); + SPDLOG_ERROR("QUEST Cannot open 'questnpc.txt'"); else - sys_log(0, "QUEST can open 'questnpc.txt' (%s)", g_stQuestDir.c_str() ); + SPDLOG_DEBUG("QUEST can open 'questnpc.txt' ({})", g_stQuestDir.c_str() ); while (1) { @@ -113,7 +113,7 @@ namespace quest if (ri < li) { - sys_err("QUEST questnpc.txt:%d:npc name error",line); + SPDLOG_ERROR("QUEST questnpc.txt:{}:npc name error",line); continue; } @@ -124,9 +124,7 @@ namespace quest if (n) continue; - //cout << '-' << s << '-' << endl; - if ( test_server ) - sys_log(0, "QUEST reading script of %s(%d)", s.c_str(), vnum); + SPDLOG_TRACE("QUEST reading script of {}({})", s.c_str(), vnum); m_mapNPC[vnum].Set(vnum, s); m_mapNPCNameID[s] = vnum; } @@ -177,19 +175,19 @@ namespace quest if (!pPC->IsRunning()) { - sys_err("no quest running for pc, cannot process input : %u", pc); + SPDLOG_ERROR("no quest running for pc, cannot process input : {}", pc); return; } if (pPC->GetRunningQuestState()->suspend_state != SUSPEND_STATE_CONFIRM) { - sys_err("not wait for a confirm : %u %d", pc, pPC->GetRunningQuestState()->suspend_state); + SPDLOG_ERROR("not wait for a confirm : {} {}", pc, pPC->GetRunningQuestState()->suspend_state); return; } if (pc2 && !pPC->IsConfirmWait(pc2)) { - sys_err("not wait for a confirm : %u %d", pc, pPC->GetRunningQuestState()->suspend_state); + SPDLOG_ERROR("not wait for a confirm : {} {}", pc, pPC->GetRunningQuestState()->suspend_state); return; } @@ -217,19 +215,19 @@ namespace quest PC* pPC = GetPC(pc); if (!pPC) { - sys_err("no pc! : %u",pc); + SPDLOG_ERROR("no pc! : {}",pc); return; } if (!pPC->IsRunning()) { - sys_err("no quest running for pc, cannot process input : %u", pc); + SPDLOG_ERROR("no quest running for pc, cannot process input : {}", pc); return; } if (pPC->GetRunningQuestState()->suspend_state != SUSPEND_STATE_INPUT) { - sys_err("not wait for a input : %u %d", pc, pPC->GetRunningQuestState()->suspend_state); + SPDLOG_ERROR("not wait for a input : {} {}", pc, pPC->GetRunningQuestState()->suspend_state); return; } @@ -288,7 +286,7 @@ namespace quest } else { - sys_err("wrong QUEST_SELECT request! : %d",pc); + SPDLOG_ERROR("wrong QUEST_SELECT request! : {}",pc); } } @@ -314,7 +312,7 @@ namespace quest //cerr << pPC->GetRunningQuestState()->suspend_state; //cerr << SUSPEND_STATE_WAIT << endl; //cerr << "wrong QUEST_WAIT request! : " << pc << endl; - sys_err("wrong QUEST_WAIT request! : %d",pc); + SPDLOG_ERROR("wrong QUEST_WAIT request! : {}",pc); } } @@ -329,7 +327,7 @@ namespace quest m_mapNPC[QUEST_NO_NPC].OnEnterState(*pPC, quest_index, state); } else - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } void CQuestManager::LeaveState(DWORD pc, DWORD quest_index, int state) @@ -343,7 +341,7 @@ namespace quest m_mapNPC[QUEST_NO_NPC].OnLeaveState(*pPC, quest_index, state); } else - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } void CQuestManager::Letter(DWORD pc, DWORD quest_index, int state) @@ -357,7 +355,7 @@ namespace quest m_mapNPC[QUEST_NO_NPC].OnLetter(*pPC, quest_index, state); } else - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } void CQuestManager::LogoutPC(LPCHARACTER ch) @@ -398,7 +396,7 @@ namespace quest } else { - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } } @@ -414,7 +412,7 @@ namespace quest m_mapNPC[QUEST_NO_NPC].OnLogout(*pPC); } else - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } void CQuestManager::Kill(unsigned int pc, unsigned int npc) @@ -422,7 +420,7 @@ namespace quest //m_CurrentNPCRace = npc; PC * pPC; - sys_log(0, "CQuestManager::Kill QUEST_KILL_EVENT (pc=%d, npc=%d)", pc, npc); + SPDLOG_DEBUG("CQuestManager::Kill QUEST_KILL_EVENT (pc={}, npc={})", pc, npc); if ((pPC = GetPC(pc))) { @@ -460,13 +458,13 @@ namespace quest } } else - sys_err("QUEST: no such pc id : %d", pc); + SPDLOG_ERROR("QUEST: no such pc id : {}", pc); } bool CQuestManager::ServerTimer(unsigned int npc, unsigned int arg) { SetServerTimerArg(arg); - sys_log(0, "XXX ServerTimer Call NPC %p", GetPCForce(0)); + SPDLOG_DEBUG("XXX ServerTimer Call NPC {}", (void*) GetPCForce(0)); m_pCurrentPC = GetPCForce(0); m_pCurrentCharacter = NULL; m_pSelectedDungeon = NULL; @@ -489,7 +487,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST TIMER_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST TIMER_EVENT no such pc id : {}", pc); return false; } //cerr << "QUEST TIMER" << endl; @@ -508,7 +506,7 @@ namespace quest } else { - sys_err("QUEST LEVELUP_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST LEVELUP_EVENT no such pc id : {}", pc); } } @@ -527,7 +525,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } } @@ -547,7 +545,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } } @@ -589,7 +587,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST INFO_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST INFO_EVENT no such pc id : {}", pc); } } @@ -613,7 +611,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST CLICK_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST CLICK_EVENT no such pc id : {}", pc); } } @@ -640,15 +638,14 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST USE_ITEM_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST USE_ITEM_EVENT no such pc id : {}", pc); return false; } } bool CQuestManager::UseItem(unsigned int pc, LPITEM item, bool bReceiveAll) { - if (test_server) - sys_log( 0, "questmanager::UseItem Start : itemVnum : %d PC : %d", item->GetOriginalVnum(), pc); + SPDLOG_TRACE("questmanager::UseItem Start : itemVnum : {} PC : {}", item->GetOriginalVnum(), pc); PC* pPC; if ((pPC = GetPC(pc))) { @@ -666,16 +663,15 @@ namespace quest /* if (test_server) { - sys_log( 0, "Quest UseItem Start : itemVnum : %d PC : %d", item->GetOriginalVnum(), pc); + SPDLOG_DEBUG("Quest UseItem Start : itemVnum : {} PC : {}", item->GetOriginalVnum(), pc); itertype(m_mapNPC) it = m_mapNPC.begin(); itertype(m_mapNPC) end = m_mapNPC.end(); for( ; it != end ; ++it) { - sys_log( 0, "Quest UseItem : vnum : %d item Vnum : %d", it->first, item->GetOriginalVnum()); + SPDLOG_DEBUG("Quest UseItem : vnum : {} item Vnum : {}", it->first, item->GetOriginalVnum()); } } - if(test_server) - sys_log( 0, "questmanager:useItem: mapNPCVnum : %d\n", m_mapNPC[item->GetVnum()].GetVnum()); + SPDLOG_TRACE("questmanager:useItem: mapNPCVnum : {}", m_mapNPC[item->GetVnum()].GetVnum()); */ return m_mapNPC[item->GetVnum()].OnUseItem(*pPC, bReceiveAll); @@ -683,7 +679,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST USE_ITEM_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST USE_ITEM_EVENT no such pc id : {}", pc); return false; } } @@ -691,8 +687,7 @@ namespace quest // Speical Item Group¿¡ Á¤ÀÇµÈ Group Use bool CQuestManager::SIGUse(unsigned int pc, DWORD sig_vnum, LPITEM item, bool bReceiveAll) { - if (test_server) - sys_log( 0, "questmanager::SIGUse Start : itemVnum : %d PC : %d", item->GetOriginalVnum(), pc); + SPDLOG_TRACE("questmanager::SIGUse Start : itemVnum : {} PC : {}", item->GetOriginalVnum(), pc); PC* pPC; if ((pPC = GetPC(pc))) { @@ -713,7 +708,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST USE_ITEM_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST USE_ITEM_EVENT no such pc id : {}", pc); return false; } } @@ -761,10 +756,7 @@ namespace quest } TargetInfo * pInfo = CTargetManager::instance().GetTargetInfo(pc, TARGET_TYPE_VID, pkChrTarget->GetVID()); - if (test_server) - { - sys_log(0, "CQuestManager::Click(pid=%d, npc_name=%s) - target_info(%x)", pc, pkChrTarget->GetName(), pInfo); - } + SPDLOG_TRACE("CQuestManager::Click(pid={}, npc_name={}) - target_info({})", pc, pkChrTarget->GetName(), (void*) pInfo); if (pInfo) { @@ -781,7 +773,7 @@ namespace quest if (it == m_mapNPC.end()) { - sys_err("CQuestManager::Click(pid=%d, target_npc_name=%s) - NOT EXIST NPC RACE VNUM[%d]", + SPDLOG_ERROR("CQuestManager::Click(pid={}, target_npc_name={}) - NOT EXIST NPC RACE VNUM[{}]", pc, pkChrTarget->GetName(), dwCurrentNPCRace); @@ -792,13 +784,11 @@ namespace quest if (it->second.HasChat()) { // if have chat, give chat - if (test_server) - sys_log(0, "CQuestManager::Click->OnChat"); + SPDLOG_TRACE("CQuestManager::Click->OnChat"); if (!it->second.OnChat(*pPC)) { - if (test_server) - sys_log(0, "CQuestManager::Click->OnChat Failed"); + SPDLOG_TRACE("CQuestManager::Click->OnChat Failed"); return it->second.OnClick(*pPC); } @@ -816,7 +806,7 @@ namespace quest else { //cout << "no such pc id : " << pc; - sys_err("QUEST CLICK_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST CLICK_EVENT no such pc id : {}", pc); return false; } //cerr << "QUEST CLICk" << endl; @@ -834,7 +824,7 @@ namespace quest m_mapNPC[QUEST_NO_NPC].OnUnmount(*pPC); } else - sys_err("QUEST no such pc id : %d", pc); + SPDLOG_ERROR("QUEST no such pc id : {}", pc); } //µ¶ÀÏ ¼±¹° ±â´É Å×½ºÆ® void CQuestManager::ItemInformer(unsigned int pc,unsigned int vnum) @@ -860,7 +850,7 @@ namespace quest if (inf.is_open()) { - sys_log(0, "QUEST loading begin condition for %s", quest_name.c_str()); + SPDLOG_DEBUG("QUEST loading begin condition for {}", quest_name.c_str()); istreambuf_iterator ib(inf), ie; copy(ib, ie, back_inserter(m_hmQuestStartScript[idx])); @@ -958,7 +948,6 @@ namespace quest m_iCurrentSkin = QUEST_SKIN_NOWINDOW; } - //sys_log(0, "Send Quest Script to %s", GetCurrentCharacterPtr()->GetName()); //send -_-! struct ::packet_script packet_script; @@ -973,8 +962,7 @@ namespace quest GetCurrentCharacterPtr()->GetDesc()->Packet(buf.read_peek(), buf.size()); - if (test_server) - sys_log(0, "m_strScript %s size %d", m_strScript.c_str(), buf.size()); + SPDLOG_TRACE("m_strScript {} size {}", m_strScript.c_str(), buf.size()); ClearScript(); } @@ -985,7 +973,7 @@ namespace quest lua_getglobal(L, quest_name.c_str()); if (lua_isnil(L,-1)) { - sys_err("QUEST wrong quest state file %s.%d", quest_name.c_str(), state_index); + SPDLOG_ERROR("QUEST wrong quest state file {}.{}", quest_name.c_str(), state_index); lua_settop(L,x); return ""; } @@ -1003,7 +991,7 @@ namespace quest lua_getglobal(L, quest_name.c_str()); if (lua_isnil(L,-1)) { - sys_err("QUEST wrong quest state file %s.%s",quest_name.c_str(),state_name.c_str() ); + SPDLOG_ERROR("QUEST wrong quest state file {}.{}",quest_name.c_str(),state_name.c_str() ); lua_settop(L,x); return 0; } @@ -1012,8 +1000,7 @@ namespace quest int v = (int)rint(lua_tonumber(L,-1)); lua_settop(L, x); - if ( test_server ) - sys_log( 0,"[QUESTMANAGER] GetQuestStateIndex x(%d) v(%d) %s %s", v,x, quest_name.c_str(), state_name.c_str() ); + SPDLOG_TRACE("[QUESTMANAGER] GetQuestStateIndex x({}) v({}) {} {}", v,x, quest_name.c_str(), state_name.c_str() ); return v; } @@ -1104,7 +1091,7 @@ namespace quest LoadStartQuest(stQuestName, idx); m_mapQuestNameByIndex.insert(make_pair(idx, stQuestName)); - sys_log(0, "QUEST: Register %4u %s", idx, stQuestName.c_str()); + SPDLOG_DEBUG("QUEST: Register {:4} {}", idx, stQuestName.c_str()); } unsigned int CQuestManager::GetQuestIndexByName(const string& name) @@ -1123,7 +1110,7 @@ namespace quest if ((it = m_mapQuestNameByIndex.find(idx)) == m_mapQuestNameByIndex.end()) { - sys_err("cannot find quest name by index %u", idx); + SPDLOG_ERROR("cannot find quest name by index {}", idx); assert(!"cannot find quest name by index"); static std::string st = ""; @@ -1167,7 +1154,7 @@ namespace quest int prev_value = m_mapEventFlag[name]; - sys_log(0, "QUEST eventflag %s %d prev_value %d", name.c_str(), value, m_mapEventFlag[name]); + SPDLOG_TRACE("QUEST eventflag {} {} prev_value {}", name, value, m_mapEventFlag[name]); m_mapEventFlag[name] = value; if (name == "mob_item") @@ -1307,7 +1294,7 @@ namespace quest PIXEL_POSITION posBase; if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(p->lMapIndex, posBase)) { - sys_err("cannot get map base position %d", p->lMapIndex); + SPDLOG_ERROR("cannot get map base position {}", p->lMapIndex); ++p; continue; } @@ -1360,7 +1347,7 @@ namespace quest if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(pPosition->lMapIndex, pos)) { - sys_err("cannot get map base position %d", pPosition->lMapIndex); + SPDLOG_ERROR("cannot get map base position {}", pPosition->lMapIndex); ++pPosition; continue; } @@ -1619,13 +1606,13 @@ namespace quest { const string& stQuestObjectDir = *it; snprintf(buf, sizeof(buf), "%s/%u", stQuestObjectDir.c_str(), dwVnum); - sys_log(0, "%s", buf); + SPDLOG_TRACE("{}", buf); if ((dir = opendir(buf))) { closedir(dir); snprintf(buf, sizeof(buf), "%u", dwVnum); - sys_log(0, "%s", buf); + SPDLOG_TRACE("{}", buf); m_mapNPC[dwVnum].Set(dwVnum, buf); } @@ -1646,7 +1633,7 @@ namespace quest } } - sys_err("LUA_ERROR: quest %s.%s %s", GetCurrentQuestName().c_str(), state_name, event_index_name.c_str() ); + SPDLOG_ERROR("LUA_ERROR: quest {}.{} {}", GetCurrentQuestName().c_str(), state_name, event_index_name.c_str() ); if (GetCurrentCharacterPtr() && test_server) GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_PARTY, "LUA_ERROR: quest %s.%s %s", GetCurrentQuestName().c_str(), state_name, event_index_name.c_str() ); } @@ -1682,7 +1669,7 @@ namespace quest vsnprintf(szMsg, sizeof(szMsg), fmt, args); va_end(args); - _sys_err(func, line, "%s", szMsg); + _SPDLOG_ERROR(func, line, "%s", szMsg); if (test_server) { LPCHARACTER ch = GetCurrentCharacterPtr(); @@ -1697,10 +1684,10 @@ namespace quest void CQuestManager::AddServerTimer(const std::string& name, DWORD arg, LPEVENT event) { - sys_log(0, "XXX AddServerTimer %s %d %p", name.c_str(), arg, get_pointer(event)); + SPDLOG_DEBUG("XXX AddServerTimer {} {} {}", name, arg, (void*) get_pointer(event)); if (m_mapServerTimer.find(make_pair(name, arg)) != m_mapServerTimer.end()) { - sys_err("already registered server timer name:%s arg:%u", name.c_str(), arg); + SPDLOG_ERROR("already registered server timer name:{} arg:{}", name, arg); return; } m_mapServerTimer.insert(make_pair(make_pair(name, arg), event)); @@ -1757,8 +1744,7 @@ namespace quest bool CQuestManager::PickupItem(unsigned int pc, LPITEM item) { - if (test_server) - sys_log( 0, "questmanager::PickupItem Start : itemVnum : %d PC : %d", item->GetOriginalVnum(), pc); + SPDLOG_TRACE("questmanager::PickupItem Start : itemVnum : {} PC : {}", item->GetOriginalVnum(), pc); PC* pPC; if ((pPC = GetPC(pc))) { @@ -1778,7 +1764,7 @@ namespace quest } else { - sys_err("QUEST PICK_ITEM_EVENT no such pc id : %d", pc); + SPDLOG_ERROR("QUEST PICK_ITEM_EVENT no such pc id : {}", pc); return false; } } @@ -1787,7 +1773,7 @@ namespace quest LPCHARACTER ch = GetCurrentCharacterPtr(); if (NULL == ch) { - sys_err("NULL?"); + SPDLOG_ERROR("NULL?"); return; } /* @@ -1812,7 +1798,7 @@ namespace quest { if (m_vecPCStack.size() == 0) { - sys_err("m_vecPCStack is alread empty. CurrentQuest{Name(%s), State(%s)}", GetCurrentQuestName().c_str(), GetCurrentState()->_title.c_str()); + SPDLOG_ERROR("m_vecPCStack is alread empty. CurrentQuest{Name({}), State({})}", GetCurrentQuestName().c_str(), GetCurrentState()->_title.c_str()); return; } DWORD pc = m_vecPCStack.back(); diff --git a/src/game/src/questmanager.h b/src/game/src/questmanager.h index b946b53..efac155 100644 --- a/src/game/src/questmanager.h +++ b/src/game/src/questmanager.h @@ -5,6 +5,12 @@ #include "questnpc.h" +#ifndef __WIN32__ +#define quest_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args) +#else +#define quest_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) +#endif + class ITEM; class CHARACTER; class CDungeon; diff --git a/src/game/src/questnpc.cpp b/src/game/src/questnpc.cpp index aad71d8..864912f 100644 --- a/src/game/src/questnpc.cpp +++ b/src/game/src/questnpc.cpp @@ -42,7 +42,6 @@ namespace quest if (is < 0 || is >= (int) sizeof(buf)) is = sizeof(buf) - 1; - //sys_log(0, "XXX %s", buf); int event_index = it->second; DIR * pdir = opendir(buf); @@ -60,7 +59,7 @@ namespace quest if (!strncasecmp(pde->d_name, "CVS", 3)) continue; - sys_log(1, "QUEST reading %s", pde->d_name); + SPDLOG_TRACE("QUEST reading {}", pde->d_name); strlcpy(buf + is, pde->d_name, sizeof(buf) - is); LoadStateScript(event_index, buf, pde->d_name); } @@ -95,7 +94,7 @@ namespace quest if (quest_index == 0) { - fprintf(stderr, "cannot find quest index for %s\n", stQuestName.c_str()); + SPDLOG_ERROR("cannot find quest index for {}", stQuestName.c_str()); assert(!"cannot find quest index"); return; } @@ -115,7 +114,7 @@ namespace quest int state_index = q.GetQuestStateIndex(stQuestName, stStateName); /////////////////////////////////////////////////////////////////////////// - sys_log(0, "QUEST loading %s : %s [STATE] %s", + SPDLOG_TRACE("QUEST loading {} : {} [STATE] {}", filename, stQuestName.c_str(), stStateName.c_str()); if (i == s.npos) @@ -138,7 +137,7 @@ namespace quest if (i == s.npos) { - sys_err("invalid QUEST STATE index [%s] [%s]",filename, script_name); + SPDLOG_ERROR("invalid QUEST STATE index [{}] [{}]",filename, script_name); return; } @@ -150,7 +149,7 @@ namespace quest if (i != s.npos) { - sys_err("invalid QUEST STATE name [%s] [%s]",filename, script_name); + SPDLOG_ERROR("invalid QUEST STATE name [{}] [{}]",filename, script_name); return; } @@ -202,7 +201,7 @@ namespace quest bool NPC::OnTarget(PC & pc, DWORD dwQuestIndex, const char * c_pszTargetName, const char * c_pszVerb, bool & bRet) { - sys_log(1, "OnTarget begin %s verb %s qi %u", c_pszTargetName, c_pszVerb, dwQuestIndex); + SPDLOG_DEBUG("OnTarget begin {} verb {} qi {}", c_pszTargetName, c_pszVerb, dwQuestIndex); bRet = false; @@ -210,7 +209,7 @@ namespace quest if (itPCQuest == pc.quest_end()) { - sys_log(1, "no quest"); + SPDLOG_DEBUG("no quest"); return false; } @@ -221,7 +220,7 @@ namespace quest if (it == r.end()) { - sys_log(1, "no target event, state %d", iState); + SPDLOG_DEBUG("no target event, state {}", iState); return false; } @@ -234,7 +233,7 @@ namespace quest AArgScript & argScript = *(it_vec++); const char * c_pszArg = argScript.arg.c_str(); - sys_log(1, "OnTarget compare %s %d", c_pszArg, argScript.arg.length()); + SPDLOG_DEBUG("OnTarget compare {} {}", c_pszArg, argScript.arg.length()); if (strncmp(c_pszArg, c_pszTargetName, iTargetLen)) continue; @@ -248,12 +247,12 @@ namespace quest continue; if (argScript.when_condition.size() > 0) - sys_log(1, "OnTarget when %s size %d", &argScript.when_condition[0], argScript.when_condition.size()); + SPDLOG_DEBUG("OnTarget when {} size {}", &argScript.when_condition[0], argScript.when_condition.size()); if (argScript.when_condition.size() != 0 && !IsScriptTrue(&argScript.when_condition[0], argScript.when_condition.size())) continue; - sys_log(1, "OnTarget execute qi %u st %d code %s", dwQuestIndex, iState, (const char *) argScript.script.GetCode()); + SPDLOG_DEBUG("OnTarget execute qi {} st {} code {}", dwQuestIndex, iState, (const char *) argScript.script.GetCode()); bRet = CQuestManager::ExecuteQuestScript(pc, dwQuestIndex, iState, argScript.script.GetCode(), argScript.script.GetSize()); bRet = true; return true; @@ -375,10 +374,10 @@ namespace quest ++qmit; } - sys_err("Cannot find any code for %s", c_pszQuestName); + SPDLOG_ERROR("Cannot find any code for {}", c_pszQuestName); } else - sys_err("Cannot find quest index by %s", c_pszQuestName); + SPDLOG_ERROR("Cannot find quest index by {}", c_pszQuestName); } */ bool bRet = HandleReceiveAllNoWaitEvent(pc, QUEST_LOGIN_EVENT); @@ -467,7 +466,7 @@ namespace quest { if (EventIndex < 0 || EventIndex >= QUEST_EVENT_COUNT) { - sys_err("QUEST invalid EventIndex : %d", EventIndex); + SPDLOG_ERROR("QUEST invalid EventIndex : {}", EventIndex); return false; } @@ -477,7 +476,7 @@ namespace quest { CQuestManager & mgr = CQuestManager::instance(); - sys_err("QUEST There's suspended quest state, can't run new quest state (quest: %s pc: %s)", + SPDLOG_ERROR("QUEST There's suspended quest state, can't run new quest state (quest: {} pc: {})", pc.GetCurrentQuestName().c_str(), mgr.GetCurrentCharacterPtr() ? mgr.GetCurrentCharacterPtr()->GetName() : ""); } @@ -588,7 +587,7 @@ namespace quest { if (EventIndex < 0 || EventIndex >= QUEST_EVENT_COUNT) { - sys_err("QUEST invalid EventIndex : %d", EventIndex); + SPDLOG_ERROR("QUEST invalid EventIndex : {}", EventIndex); return false; } @@ -598,7 +597,7 @@ namespace quest { CQuestManager & mgr = CQuestManager::instance(); - sys_err("QUEST There's suspended quest state, can't run new quest state (quest: %s pc: %s)", + SPDLOG_ERROR("QUEST There's suspended quest state, can't run new quest state (quest: {} pc: {})", pc.GetCurrentQuestName().c_str(), mgr.GetCurrentCharacterPtr() ? mgr.GetCurrentCharacterPtr()->GetName() : ""); } @@ -649,7 +648,7 @@ namespace quest it->second.GetCode(), it->second.GetSize())) { - sys_err("QUEST NOT END RUNNING on Login/Logout - %s", + SPDLOG_ERROR("QUEST NOT END RUNNING on Login/Logout - {}", CQuestManager::instance().GetQuestNameByIndex(itQuestMap->first).c_str()); QuestState& rqs = *pPC->GetRunningQuestState(); @@ -687,7 +686,7 @@ namespace quest itQuestScript->second.GetCode(), itQuestScript->second.GetSize())) { - sys_err("QUEST NOT END RUNNING on Login/Logout - %s", + SPDLOG_ERROR("QUEST NOT END RUNNING on Login/Logout - {}", CQuestManager::instance().GetQuestNameByIndex(itQuestMap->first).c_str()); QuestState& rqs = *pPC->GetRunningQuestState(); @@ -704,7 +703,7 @@ namespace quest //cerr << EventIndex << endl; if (EventIndex<0 || EventIndex>=QUEST_EVENT_COUNT) { - sys_err("QUEST invalid EventIndex : %d", EventIndex); + SPDLOG_ERROR("QUEST invalid EventIndex : {}", EventIndex); return false; } @@ -715,7 +714,7 @@ namespace quest { CQuestManager & mgr = CQuestManager::instance(); - sys_err("QUEST There's suspended quest state, can't run new quest state (quest: %s pc: %s)", + SPDLOG_ERROR("QUEST There's suspended quest state, can't run new quest state (quest: {} pc: {})", pc.GetCurrentQuestName().c_str(), mgr.GetCurrentCharacterPtr() ? mgr.GetCurrentCharacterPtr()->GetName() : ""); } @@ -744,7 +743,7 @@ namespace quest { CQuestManager & mgr = CQuestManager::instance(); - sys_err("QUEST There's suspended quest state, can't run new quest state (quest: %s pc: %s)", + SPDLOG_ERROR("QUEST There's suspended quest state, can't run new quest state (quest: {} pc: {})", pc.GetCurrentQuestName().c_str(), mgr.GetCurrentCharacterPtr() ? mgr.GetCurrentCharacterPtr()->GetName() : ""); } @@ -756,7 +755,7 @@ namespace quest if (pc.quest_end() == itPCQuest) { - sys_err("QUEST no quest by (quest %u)", quest_index); + SPDLOG_ERROR("QUEST no quest by (quest {})", quest_index); return false; } @@ -767,7 +766,7 @@ namespace quest if (itQuestMap == rmapEventOwnQuest.end()) { - sys_err("QUEST no info event (quest %s)", questName); + SPDLOG_ERROR("QUEST no info event (quest {})", questName); return false; } @@ -775,7 +774,7 @@ namespace quest if (itQuestScript == itQuestMap->second.end()) { - sys_err("QUEST no info script by state %d (quest %s)", itPCQuest->second.st, questName); + SPDLOG_ERROR("QUEST no info script by state {} (quest {})", itPCQuest->second.st, questName); return false; } @@ -793,7 +792,7 @@ namespace quest { CQuestManager & mgr = CQuestManager::instance(); - sys_err("QUEST There's suspended quest state, can't run new quest state (quest: %s pc: %s)", + SPDLOG_ERROR("QUEST There's suspended quest state, can't run new quest state (quest: {} pc: {})", pc.GetCurrentQuestName().c_str(), mgr.GetCurrentCharacterPtr() ? mgr.GetCurrentCharacterPtr()->GetName() : ""); } @@ -890,7 +889,7 @@ namespace quest { CQuestManager & mgr = CQuestManager::instance(); - sys_err("QUEST There's suspended quest state, can't run new quest state (quest: %s pc: %s)", + SPDLOG_ERROR("QUEST There's suspended quest state, can't run new quest state (quest: {} pc: {})", pc.GetCurrentQuestName().c_str(), mgr.GetCurrentCharacterPtr() ? mgr.GetCurrentCharacterPtr()->GetName() : ""); } @@ -939,7 +938,7 @@ namespace quest itertype(rQuest) itQuest = rQuest.find(dwQuestIndex); if (itQuest == rQuest.end()) { - sys_log(0, "ExecuteEventScript ei %d qi %u is %d - NO QUEST", EventIndex, dwQuestIndex, iState); + SPDLOG_WARN("ExecuteEventScript ei {} qi {} is {} - NO QUEST", EventIndex, dwQuestIndex, iState); return false; } @@ -947,11 +946,11 @@ namespace quest itertype(itQuest->second) itState = rScript.find(iState); if (itState == rScript.end()) { - sys_log(0, "ExecuteEventScript ei %d qi %u is %d - NO STATE", EventIndex, dwQuestIndex, iState); + SPDLOG_WARN("ExecuteEventScript ei {} qi {} is {} - NO STATE", EventIndex, dwQuestIndex, iState); return false; } - sys_log(0, "ExecuteEventScript ei %d qi %u is %d", EventIndex, dwQuestIndex, iState); + SPDLOG_DEBUG("ExecuteEventScript ei {} qi {} is {}", EventIndex, dwQuestIndex, iState); CQuestManager::instance().SetCurrentEventIndex(EventIndex); return CQuestManager::ExecuteQuestScript(pc, dwQuestIndex, iState, itState->second.GetCode(), itState->second.GetSize()); } diff --git a/src/game/src/questnpc.h b/src/game/src/questnpc.h index 6b88f9a..c28515c 100644 --- a/src/game/src/questnpc.h +++ b/src/game/src/questnpc.h @@ -106,8 +106,7 @@ namespace quest template void NPC::MatchingQuest(PC& pc, TQuestMapType& QuestMap, FuncMatch& fMatch, FuncMiss& fMiss) { - if (test_server) - sys_log(0, "Click Quest : MatchingQuest"); + SPDLOG_TRACE("Click Quest : MatchingQuest"); PC::QuestInfoIterator itPCQuest = pc.quest_begin(); typename TQuestMapType::iterator itQuestMap = QuestMap.begin(); diff --git a/src/game/src/questpc.cpp b/src/game/src/questpc.cpp index 1a731d3..5d14925 100644 --- a/src/game/src/questpc.cpp +++ b/src/game/src/questpc.cpp @@ -52,10 +52,7 @@ namespace quest void PC::SetFlag(const string& name, int value, bool bSkipSave) { - if ( test_server ) - sys_log(0, "QUEST Setting flag %s %d", name.c_str(),value); - else - sys_log(1, "QUEST Setting flag %s %d", name.c_str(),value); + SPDLOG_TRACE("QUEST Setting flag {} {}", name.c_str(),value); if (value == 0) { @@ -96,7 +93,7 @@ namespace quest if (it != m_FlagMap.end()) { - sys_log(1, "QUEST getting flag %s %d", name.c_str(),it->second); + SPDLOG_DEBUG("QUEST getting flag {} {}", name.c_str(),it->second); return it->second; } return 0; @@ -134,13 +131,12 @@ namespace quest void PC::AddQuestStateChange(const string& quest_name, int prev_state, int next_state) { DWORD dwQuestIndex = CQuestManager::instance().GetQuestIndexByName(quest_name); - sys_log(0, "QUEST reserve Quest State Change quest %s[%u] from %d to %d", quest_name.c_str(), dwQuestIndex, prev_state, next_state); + SPDLOG_DEBUG("QUEST reserve Quest State Change quest {}[{}] from {} to {}", quest_name.c_str(), dwQuestIndex, prev_state, next_state); m_QuestStateChange.push_back(TQuestStateChangeInfo(dwQuestIndex, prev_state, next_state)); } void PC::SetQuest(const string& quest_name, QuestState& qs) { - //sys_log(0, "PC SetQuest %s", quest_name.c_str()); unsigned int qi = CQuestManager::instance().GetQuestIndexByName(quest_name); QuestInfo::iterator it = m_QuestInfo.find(qi); @@ -169,7 +165,7 @@ namespace quest { RemoveTimer(name); m_TimerMap.insert(make_pair(name, pEvent)); - sys_log(0, "QUEST add timer %p %d", get_pointer(pEvent), m_TimerMap.size()); + SPDLOG_DEBUG("QUEST add timer {} {}", (void*) get_pointer(pEvent), m_TimerMap.size()); } void PC::RemoveTimerNotCancel(const string & name) @@ -178,11 +174,11 @@ namespace quest if (it != m_TimerMap.end()) { - sys_log(0, "QUEST remove with no cancel %p", get_pointer(it->second)); + SPDLOG_DEBUG("QUEST remove with no cancel {}", (void*) get_pointer(it->second)); m_TimerMap.erase(it); } - sys_log(1, "QUEST timer map size %d by RemoveTimerNotCancel", m_TimerMap.size()); + SPDLOG_DEBUG("QUEST timer map size {} by RemoveTimerNotCancel", m_TimerMap.size()); } void PC::RemoveTimer(const string & name) @@ -191,17 +187,17 @@ namespace quest if (it != m_TimerMap.end()) { - sys_log(0, "QUEST remove timer %p", get_pointer(it->second)); + SPDLOG_DEBUG("QUEST remove timer {}", (void*) get_pointer(it->second)); CancelTimerEvent(&it->second); m_TimerMap.erase(it); } - sys_log(1, "QUEST timer map size %d by RemoveTimer", m_TimerMap.size()); + SPDLOG_DEBUG("QUEST timer map size {} by RemoveTimer", m_TimerMap.size()); } void PC::ClearTimer() { - sys_log(0, "QUEST clear timer %d", m_TimerMap.size()); + SPDLOG_DEBUG("QUEST clear timer {}", m_TimerMap.size()); TTimerMap::iterator it = m_TimerMap.begin(); while (it != m_TimerMap.end()) @@ -250,7 +246,7 @@ namespace quest buf.write(&temp,1); qi.size+=1; - sys_log(1, "QUEST BeginFlag %d", (int)temp); + SPDLOG_DEBUG("QUEST BeginFlag {}", (int)temp); } if (m_iSendToClient & QUEST_SEND_TITLE) { @@ -258,7 +254,7 @@ namespace quest buf.write(m_RunningQuestState->_title.c_str(), 30+1); qi.size+=30+1; - sys_log(1, "QUEST Title %s", m_RunningQuestState->_title.c_str()); + SPDLOG_DEBUG("QUEST Title {}", m_RunningQuestState->_title.c_str()); } if (m_iSendToClient & QUEST_SEND_CLOCK_NAME) { @@ -266,14 +262,14 @@ namespace quest buf.write(m_RunningQuestState->_clock_name.c_str(), 16+1); qi.size+=16+1; - sys_log(1, "QUEST Clock Name %s", m_RunningQuestState->_clock_name.c_str()); + SPDLOG_DEBUG("QUEST Clock Name {}", m_RunningQuestState->_clock_name.c_str()); } if (m_iSendToClient & QUEST_SEND_CLOCK_VALUE) { buf.write(&m_RunningQuestState->_clock_value, sizeof(int)); qi.size+=4; - sys_log(1, "QUEST Clock Value %d", m_RunningQuestState->_clock_value); + SPDLOG_DEBUG("QUEST Clock Value {}", m_RunningQuestState->_clock_value); } if (m_iSendToClient & QUEST_SEND_COUNTER_NAME) { @@ -281,14 +277,14 @@ namespace quest buf.write(m_RunningQuestState->_counter_name.c_str(), 16+1); qi.size+=16+1; - sys_log(1, "QUEST Counter Name %s", m_RunningQuestState->_counter_name.c_str()); + SPDLOG_DEBUG("QUEST Counter Name {}", m_RunningQuestState->_counter_name.c_str()); } if (m_iSendToClient & QUEST_SEND_COUNTER_VALUE) { buf.write(&m_RunningQuestState->_counter_value, sizeof(int)); qi.size+=4; - sys_log(1, "QUEST Counter Value %d", m_RunningQuestState->_counter_value); + SPDLOG_DEBUG("QUEST Counter Value {}", m_RunningQuestState->_counter_value); } if (m_iSendToClient & QUEST_SEND_ICON_FILE) { @@ -296,7 +292,7 @@ namespace quest buf.write(m_RunningQuestState->_icon_file.c_str(), 24+1); qi.size+=24+1; - sys_log(1, "QUEST Icon File %s", m_RunningQuestState->_icon_file.c_str()); + SPDLOG_DEBUG("QUEST Icon File {}", m_RunningQuestState->_icon_file.c_str()); } CQuestManager::instance().GetCurrentCharacterPtr()->GetDesc()->Packet(buf.read_peek(),buf.size()); @@ -318,7 +314,7 @@ namespace quest if (ch->GetPlayerID() == npc->GetQuestNPCID()) { npc->SetQuestNPCID(0); - sys_log(0, "QUEST NPC lock isn't unlocked : pid %u", ch->GetPlayerID()); + SPDLOG_WARN("QUEST NPC lock isn't unlocked : pid {}", ch->GetPlayerID()); CQuestManager::instance().WriteRunningStateToSyserr(); } } @@ -339,12 +335,12 @@ namespace quest if (m_iSendToClient) { - sys_log(1, "QUEST end running %d", m_iSendToClient); + SPDLOG_DEBUG("QUEST end running {}", m_iSendToClient); SendQuestInfoPakcet(); } if (m_RunningQuestState == NULL) { - sys_log(0, "Entered PC::EndRunning() with invalid running quest state"); + SPDLOG_ERROR("Entered PC::EndRunning() with invalid running quest state"); return; } QuestState * pOldState = m_RunningQuestState; @@ -400,7 +396,7 @@ namespace quest it = quest_find(dwQuestIdx); } - sys_log(0, "QUEST change reserved Quest State Change quest %u from %d to %d (%d %d)", dwQuestIdx, rInfo.prev_state, rInfo.next_state, it->second.st, rInfo.prev_state ); + SPDLOG_DEBUG("QUEST change reserved Quest State Change quest {} from {} to {} ({} {})", dwQuestIdx, rInfo.prev_state, rInfo.next_state, it->second.st, rInfo.prev_state ); assert(it->second.st == rInfo.prev_state); @@ -538,7 +534,7 @@ namespace quest if (iPos < 0) { - sys_err("quest::PC::Save : cannot find . in FlagMap"); + SPDLOG_ERROR("quest::PC::Save : cannot find . in FlagMap"); continue; } @@ -550,21 +546,21 @@ namespace quest if (stName.length() == 0 || stState.length() == 0) { - sys_err("quest::PC::Save : invalid quest data: %s", stComp.c_str()); + SPDLOG_ERROR("quest::PC::Save : invalid quest data: {}", stComp.c_str()); continue; } - sys_log(1, "QUEST Save Flag %s, %s %d (%d)", stName.c_str(), stState.c_str(), lValue, i); + SPDLOG_DEBUG("QUEST Save Flag {}, {} {} ({})", stName.c_str(), stState.c_str(), lValue, i); if (stName.length() >= QUEST_NAME_MAX_LEN) { - sys_err("quest::PC::Save : quest name overflow"); + SPDLOG_ERROR("quest::PC::Save : quest name overflow"); continue; } if (stState.length() >= QUEST_STATE_MAX_LEN) { - sys_err("quest::PC::Save : quest state overflow"); + SPDLOG_ERROR("quest::PC::Save : quest state overflow"); continue; } @@ -578,7 +574,7 @@ namespace quest if (i > 0) { - sys_log(1, "QuestPC::Save %d", i); + SPDLOG_DEBUG("QuestPC::Save {}", i); db_clientdesc->DBPacketHeader(HEADER_GD_QUEST_SAVE, 0, sizeof(TQuestTable) * i); db_clientdesc->Packet(&s_table[0], sizeof(TQuestTable) * i); } @@ -600,7 +596,7 @@ namespace quest void PC::GiveItem(const string& label, DWORD dwVnum, int count) { - sys_log(1, "QUEST GiveItem %s %d %d", label.c_str(),dwVnum,count); + SPDLOG_DEBUG("QUEST GiveItem {} {} {}", label.c_str(),dwVnum,count); if (!GetFlag(m_stCurQuest+"."+label)) { m_vRewardData.push_back(RewardData(RewardData::REWARD_TYPE_ITEM, dwVnum, count)); @@ -612,7 +608,7 @@ namespace quest void PC::GiveExp(const string& label, DWORD exp) { - sys_log(1, "QUEST GiveExp %s %d", label.c_str(),exp); + SPDLOG_DEBUG("QUEST GiveExp {} {}", label.c_str(),exp); if (!GetFlag(m_stCurQuest+"."+label)) { @@ -636,7 +632,7 @@ namespace quest switch (it->type) { case RewardData::REWARD_TYPE_EXP: - sys_log(0, "EXP cur %d add %d next %d",ch->GetExp(), it->value1, ch->GetNextExp()); + SPDLOG_DEBUG("EXP cur {} add {} next {}",ch->GetExp(), it->value1, ch->GetNextExp()); if (ch->GetExp() + it->value1 > ch->GetNextExp()) ch->PointChange(POINT_EXP, ch->GetNextExp() - 1 - ch->GetExp()); @@ -651,7 +647,7 @@ namespace quest case RewardData::REWARD_TYPE_NONE: default: - sys_err("Invalid RewardData type"); + SPDLOG_ERROR("Invalid RewardData type"); break; } } diff --git a/src/game/src/refine.cpp b/src/game/src/refine.cpp index 8a11d3e..ddc3577 100644 --- a/src/game/src/refine.cpp +++ b/src/game/src/refine.cpp @@ -13,11 +13,11 @@ bool CRefineManager::Initialize(TRefineTable * table, int size) { for (int i = 0; i < size; ++i, ++table) { - sys_log(0, "REFINE %d prob %d cost %d", table->id, table->prob, table->cost); + SPDLOG_TRACE("REFINE {} prob {} cost {}", table->id, table->prob, table->cost); m_map_RefineRecipe.insert(std::make_pair(table->id, *table)); } - sys_log(0, "REFINE: COUNT %d", m_map_RefineRecipe.size()); + SPDLOG_DEBUG("REFINE: COUNT {}", m_map_RefineRecipe.size()); return true; } @@ -27,7 +27,7 @@ const TRefineTable* CRefineManager::GetRefineRecipe(DWORD vnum) return NULL; itertype(m_map_RefineRecipe) it = m_map_RefineRecipe.find(vnum); - sys_log(0, "REFINE: FIND %u %s", vnum, it == m_map_RefineRecipe.end() ? "FALSE" : "TRUE"); + SPDLOG_DEBUG("REFINE: FIND {} {}", vnum, it == m_map_RefineRecipe.end() ? "FALSE" : "TRUE"); if (it == m_map_RefineRecipe.end()) { diff --git a/src/game/src/regen.cpp b/src/game/src/regen.cpp index 8401bb1..eaff2b3 100644 --- a/src/game/src/regen.cpp +++ b/src/game/src/regen.cpp @@ -122,8 +122,8 @@ static bool read_line(FILE *fp, LPREGEN regen) regen->type = REGEN_TYPE_ANYWHERE; else { - sys_err("read_line: unknown regen type %c", szTmp[0]); - exit(1); + SPDLOG_ERROR("read_line: unknown regen type {}", szTmp[0]); + exit(EXIT_FAILURE); } ++mode; @@ -388,7 +388,7 @@ EVENTFUNC(dungeon_regen_event) if ( info == NULL ) { - sys_err( "dungeon_regen_event> Null pointer" ); + SPDLOG_ERROR("dungeon_regen_event> Null pointer" ); return 0; } @@ -420,7 +420,7 @@ bool regen_do(const char* filename, int lMapIndex, int base_x, int base_y, LPDUN if (NULL == fp) { - sys_err("SYSTEM: regen_do: %s: file not found", filename); + SPDLOG_ERROR("SYSTEM: regen_do: {}: file not found", filename); return false; } @@ -478,7 +478,7 @@ bool regen_do(const char* filename, int lMapIndex, int base_x, int base_y, LPDUN if (!p) { - sys_err("No mob data by vnum %u", regen->vnum); + SPDLOG_ERROR("No mob data by vnum {}", regen->vnum); if (!bOnce) { M2_DELETE(regen); } @@ -520,7 +520,7 @@ bool regen_load_in_file(const char* filename, int lMapIndex, int base_x, int bas if (NULL == fp) { - sys_err("SYSTEM: regen_do: %s: file not found", filename); + SPDLOG_ERROR("SYSTEM: regen_do: {}: file not found", filename); return false; } @@ -571,7 +571,7 @@ bool regen_load_in_file(const char* filename, int lMapIndex, int base_x, int bas if (!p) { - sys_err("No mob data by vnum %u", regen->vnum); + SPDLOG_ERROR("No mob data by vnum {}", regen->vnum); continue; } } @@ -591,7 +591,7 @@ EVENTFUNC(regen_event) if ( info == NULL ) { - sys_err( "regen_event> Null pointer" ); + SPDLOG_ERROR("regen_event> Null pointer" ); return 0; } @@ -614,7 +614,7 @@ bool regen_load(const char* filename, int lMapIndex, int base_x, int base_y) if (NULL == fp) { - sys_log(0, "SYSTEM: regen_load: %s: file not found", filename); + SPDLOG_ERROR("SYSTEM: regen_load: {}: file not found", filename); return false; } @@ -670,7 +670,7 @@ bool regen_load(const char* filename, int lMapIndex, int base_x, int base_y) if (!p) { - sys_err("No mob data by vnum %u", regen->vnum); + SPDLOG_ERROR("No mob data by vnum {}", regen->vnum); } else if (p->m_table.bType == CHAR_TYPE_NPC || p->m_table.bType == CHAR_TYPE_WARP || p->m_table.bType == CHAR_TYPE_GOTO) { diff --git a/src/game/src/safebox.cpp b/src/game/src/safebox.cpp index 244cc75..0586fe5 100644 --- a/src/game/src/safebox.cpp +++ b/src/game/src/safebox.cpp @@ -56,7 +56,7 @@ bool CSafebox::Add(DWORD dwPos, LPITEM pkItem) { if (!IsValidPosition(dwPos)) { - sys_err("SAFEBOX: item on wrong position at %d (size of grid = %d)", dwPos, m_pkGrid->GetSize()); + SPDLOG_ERROR("SAFEBOX: item on wrong position at {} (size of grid = {})", dwPos, m_pkGrid->GetSize()); return false; } @@ -80,7 +80,7 @@ bool CSafebox::Add(DWORD dwPos, LPITEM pkItem) memcpy(pack.aAttr, pkItem->GetAttributes(), sizeof(pack.aAttr)); m_pkChrOwner->GetDesc()->Packet(&pack, sizeof(pack)); - sys_log(1, "SAFEBOX: ADD %s %s count %d", m_pkChrOwner->GetName(), pkItem->GetName(), pkItem->GetCount()); + SPDLOG_DEBUG("SAFEBOX: ADD {} {} count {}", m_pkChrOwner->GetName(), pkItem->GetName(), pkItem->GetCount()); return true; } @@ -100,7 +100,7 @@ LPITEM CSafebox::Remove(DWORD dwPos) return NULL; if (!m_pkGrid) - sys_err("Safebox::Remove : nil grid"); + SPDLOG_ERROR("Safebox::Remove : nil grid"); else m_pkGrid->Get(dwPos, 1, pkItem->GetSize()); @@ -114,7 +114,7 @@ LPITEM CSafebox::Remove(DWORD dwPos) pack.pos = dwPos; m_pkChrOwner->GetDesc()->Packet(&pack, sizeof(pack)); - sys_log(1, "SAFEBOX: REMOVE %s %s count %d", m_pkChrOwner->GetName(), pkItem->GetName(), pkItem->GetCount()); + SPDLOG_DEBUG("SAFEBOX: REMOVE {} {} count {}", m_pkChrOwner->GetName(), pkItem->GetName(), pkItem->GetCount()); return pkItem; } @@ -128,7 +128,7 @@ void CSafebox::Save() t.dwGold = m_lGold; db_clientdesc->DBPacket(HEADER_GD_SAFEBOX_SAVE, 0, &t, sizeof(TSafeboxTable)); - sys_log(1, "SAFEBOX: SAVE %s", m_pkChrOwner->GetName()); + SPDLOG_DEBUG("SAFEBOX: SAVE {}", m_pkChrOwner->GetName()); } bool CSafebox::IsEmpty(DWORD dwPos, BYTE bSize) @@ -159,7 +159,7 @@ LPITEM CSafebox::GetItem(BYTE bCell) { if (bCell >= 5 * m_iSize) { - sys_err("CHARACTER::GetItem: invalid item cell %d", bCell); + SPDLOG_ERROR("CHARACTER::GetItem: invalid item cell {}", bCell); return NULL; } @@ -206,7 +206,7 @@ bool CSafebox::MoveItem(BYTE bCell, BYTE bDestCell, BYTE count) item->SetCount(item->GetCount() - count); item2->SetCount(item2->GetCount() + count); - sys_log(1, "SAFEBOX: STACK %s %d -> %d %s count %d", m_pkChrOwner->GetName(), bCell, bDestCell, item2->GetName(), item2->GetCount()); + SPDLOG_DEBUG("SAFEBOX: STACK {} {} -> {} {} count {}", m_pkChrOwner->GetName(), bCell, bDestCell, item2->GetName(), item2->GetCount()); return true; } @@ -226,7 +226,7 @@ bool CSafebox::MoveItem(BYTE bCell, BYTE bDestCell, BYTE count) m_pkGrid->Put(bCell, 1, item->GetSize()); } - sys_log(1, "SAFEBOX: MOVE %s %d -> %d %s count %d", m_pkChrOwner->GetName(), bCell, bDestCell, item->GetName(), item->GetCount()); + SPDLOG_DEBUG("SAFEBOX: MOVE {} {} -> {} {} count {}", m_pkChrOwner->GetName(), bCell, bDestCell, item->GetName(), item->GetCount()); Remove(bCell); Add(bDestCell, item); diff --git a/src/game/src/sectree.cpp b/src/game/src/sectree.cpp index 8d1e548..7273d1e 100644 --- a/src/game/src/sectree.cpp +++ b/src/game/src/sectree.cpp @@ -30,7 +30,7 @@ void SECTREE::Destroy() { if (!m_set_entity.empty()) { - sys_err("Sectree: entity set not empty!!"); + SPDLOG_ERROR("Sectree: entity set not empty!!"); ENTITY_SET::iterator it = m_set_entity.begin(); @@ -42,7 +42,7 @@ void SECTREE::Destroy() { LPCHARACTER ch = (LPCHARACTER) ent; - sys_err("Sectree: destroying character: %s is_pc %d", ch->GetName(), ch->IsPC() ? 1 : 0); + SPDLOG_ERROR("Sectree: destroying character: {} is_pc {}", ch->GetName(), ch->IsPC() ? 1 : 0); if (ch->GetDesc()) DESC_MANAGER::instance().DestroyDesc(ch->GetDesc()); @@ -53,12 +53,12 @@ void SECTREE::Destroy() { LPITEM item = (LPITEM) ent; - sys_err("Sectree: destroying Item: %s", item->GetName()); + SPDLOG_ERROR("Sectree: destroying Item: {}", item->GetName()); M2_DESTROY_ITEM(item); } else - sys_err("Sectree: unknown type: %d", ent->GetType()); + SPDLOG_ERROR("Sectree: unknown type: {}", ent->GetType()); } } m_set_entity.clear(); @@ -98,7 +98,7 @@ void SECTREE::DecreasePC() { if (tree->m_iPCCount < 0) { - sys_err("tree pc count lower than zero (value %d coord %d %d)", tree->m_iPCCount, tree->m_id.coord.x, tree->m_id.coord.y); + SPDLOG_ERROR("tree pc count lower than zero (value {} coord {} {})", tree->m_iPCCount, (int) tree->m_id.coord.x, (int) tree->m_id.coord.y); tree->m_iPCCount = 0; } @@ -126,7 +126,7 @@ bool SECTREE::InsertEntity(LPENTITY pkEnt) return false; if (m_set_entity.find(pkEnt) != m_set_entity.end()) { - sys_err("entity %p already exist in this sectree!", get_pointer(pkEnt)); + SPDLOG_ERROR("entity {} already exist in this sectree!", (void*) get_pointer(pkEnt)); return false; } diff --git a/src/game/src/sectree.h b/src/game/src/sectree.h index 0e8dd3d..eb67503 100644 --- a/src/game/src/sectree.h +++ b/src/game/src/sectree.h @@ -39,7 +39,7 @@ struct FCollectEntity { DWORD vid = character->GetVID(); LPCHARACTER found = CHARACTER_MANGAER::instance().Find(vid); if (found == NULL || vid != found->GetVID()) { - sys_err(" Invalid character %p", get_pointer(character)); + SPDLOG_ERROR(" Invalid character {}", get_pointer(character)); return; } } else if (entity->IsType(ENTITY_ITEM)) { @@ -47,7 +47,7 @@ struct FCollectEntity { DWORD vid = item->GetVID(); LPITEM found = ITEM_MANGAER::instance().FindByVID(vid); if (found == NULL || vid != found->GetVID()) { - sys_err(" Invalid item %p", get_pointer(item)); + SPDLOG_ERROR(" Invalid item {}", get_pointer(item)); return; } } else if (entity->IsType(ENTITY_OBJECT)) { @@ -55,11 +55,11 @@ struct FCollectEntity { DWORD vid = object->GetVID(); LPOBJECT found = CManager::instance().FindObjectByVID(vid); if (found == NULL || vid != found->GetVID()) { - sys_err(" Invalid object %p", get_pointer(object)); + SPDLOG_ERROR(" Invalid object {}", get_pointer(object)); return; } } else { - sys_err(" Invalid entity type %p", get_pointer(entity)); + SPDLOG_ERROR(" Invalid entity type {}", get_pointer(entity)); return; } */ @@ -191,7 +191,7 @@ class SECTREE LPENTITY entity = *it; // Sanity check if (entity->GetSectree() != this) { - sys_err(" SECTREE-ENTITY relationship mismatch"); + SPDLOG_ERROR(" SECTREE-ENTITY relationship mismatch"); m_set_entity.erase(it); continue; } diff --git a/src/game/src/sectree_manager.cpp b/src/game/src/sectree_manager.cpp index bb96bec..80374b7 100644 --- a/src/game/src/sectree_manager.cpp +++ b/src/game/src/sectree_manager.cpp @@ -16,7 +16,6 @@ #include "buffer_manager.h" #include "packet.h" #include "start_position.h" -#include "dev_log.h" WORD SECTREE_MANAGER::current_sectree_version = MAKEWORD(0, 3); @@ -117,7 +116,7 @@ void SECTREE_MAP::Build() tree->m_neighbor_list.push_back(tree); // ÀÚ½ÅÀ» ³Ö´Â´Ù. - sys_log(3, "%dx%d", tree->m_id.coord.x, tree->m_id.coord.y); + SPDLOG_TRACE("{}x{}", (int) tree->m_id.coord.x, (int) tree->m_id.coord.y); int x = tree->m_id.coord.x * SECTREE_SIZE; int y = tree->m_id.coord.y * SECTREE_SIZE; @@ -128,7 +127,7 @@ void SECTREE_MAP::Build() if (tree2) { - sys_log(3, " %d %dx%d", i, tree2->m_id.coord.x, tree2->m_id.coord.y); + SPDLOG_TRACE(" {} {}x{}", i, (int) tree2->m_id.coord.x, (int) tree2->m_id.coord.y); tree->m_neighbor_list.push_back(tree2); } } @@ -164,7 +163,7 @@ void SECTREE_MAP::Build() tree->m_neighbor_list.push_back(tree); // ÀÚ½ÅÀ» ³Ö´Â´Ù. - sys_log(3, "%dx%d", tree->m_id.coord.x, tree->m_id.coord.y); + SPDLOG_TRACE("{}x{}", (int) tree->m_id.coord.x, (int) tree->m_id.coord.y); int x = tree->m_id.coord.x * SECTREE_SIZE; int y = tree->m_id.coord.y * SECTREE_SIZE; @@ -175,7 +174,7 @@ void SECTREE_MAP::Build() if (tree2) { - sys_log(3, " %d %dx%d", i, tree2->m_id.coord.x, tree2->m_id.coord.y); + SPDLOG_TRACE(" {} {}x{}", i, (int) tree2->m_id.coord.x, (int) tree2->m_id.coord.y); tree->m_neighbor_list.push_back(tree2); } } @@ -241,7 +240,7 @@ int SECTREE_MANAGER::LoadSettingFile(int lMapIndex, const char * c_pszSettingFil if (!fp) { - sys_err("cannot open file: %s", c_pszSettingFileName); + SPDLOG_ERROR("cannot open file: {}", c_pszSettingFileName); return 0; } @@ -270,7 +269,7 @@ int SECTREE_MANAGER::LoadSettingFile(int lMapIndex, const char * c_pszSettingFil if ((iWidth == 0 && iHeight == 0) || r_setting.iCellScale == 0) { - sys_err("Invalid Settings file: %s", c_pszSettingFileName); + SPDLOG_ERROR("Invalid Settings file: {}", c_pszSettingFileName); return 0; } @@ -297,7 +296,7 @@ LPSECTREE_MAP SECTREE_MANAGER::BuildSectreeFromSetting(TMapSetting & r_setting) tree->m_id.coord.x = x / SECTREE_SIZE; tree->m_id.coord.y = y / SECTREE_SIZE; pkMapSectree->Add(tree->m_id.package, tree); - sys_log(3, "new sectree %d x %d", tree->m_id.coord.x, tree->m_id.coord.y); + SPDLOG_TRACE("new sectree {} x {}", (int) tree->m_id.coord.x, (int) tree->m_id.coord.y); } } @@ -362,7 +361,7 @@ void SECTREE_MANAGER::LoadDungeon(int iIndex, const char * c_pszFileName) fclose(fp); - sys_log(0, "Dungeon Position Load [%3d]%s count %d", iIndex, c_pszFileName, count); + SPDLOG_DEBUG("Dungeon Position Load [{:3}]{} count {}", iIndex, c_pszFileName, count); } // Fix me @@ -375,8 +374,7 @@ bool SECTREE_MANAGER::LoadMapRegion(const char * c_pszFileName, TMapSetting & r_ { FILE * fp = fopen(c_pszFileName, "r"); - if ( test_server ) - sys_log( 0, "[LoadMapRegion] file(%s)", c_pszFileName ); + SPDLOG_TRACE("[LoadMapRegion] file({})", c_pszFileName ); if (!fp) return false; @@ -396,11 +394,11 @@ bool SECTREE_MANAGER::LoadMapRegion(const char * c_pszFileName, TMapSetting & r_ if( iEmpirePositionCount == 6 ) { for ( int n = 0; n < 3; ++n ) - sys_log( 0 ,"LoadMapRegion %d %d ", pos[n].x, pos[n].y ); + SPDLOG_DEBUG("LoadMapRegion {} {} ", pos[n].x, pos[n].y ); } else { - sys_log( 0, "LoadMapRegion no empire specific start point" ); + SPDLOG_DEBUG("LoadMapRegion no empire specific start point" ); } TMapRegion region; @@ -418,7 +416,7 @@ bool SECTREE_MANAGER::LoadMapRegion(const char * c_pszFileName, TMapSetting & r_ r_setting.posSpawn = region.posSpawn; - sys_log(0, "LoadMapRegion %d x %d ~ %d y %d ~ %d, town %d %d", + SPDLOG_DEBUG("LoadMapRegion {} x {} ~ {} y {} ~ {}, town {} {}", region.index, region.sx, region.ex, @@ -444,7 +442,7 @@ bool SECTREE_MANAGER::LoadMapRegion(const char * c_pszFileName, TMapSetting & r_ m_vec_mapRegion.push_back(region); - sys_log(0,"LoadMapRegion %d End", region.index); + SPDLOG_DEBUG("LoadMapRegion {} End", region.index); return true; } @@ -454,7 +452,7 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p if (!fp) { - sys_err("SECTREE_MANAGER::LoadAttribute : cannot open %s", c_pszFileName); + SPDLOG_ERROR("SECTREE_MANAGER::LoadAttribute : cannot open {}", c_pszFileName); return false; } @@ -484,10 +482,10 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p // SERVER_ATTR_LOAD_ERROR if (tree == nullptr) { - sys_err("FATAL ERROR! LoadAttribute(%s) - cannot find sectree(package=%x, coord=(%u, %u), map_index=%u, map_base=(%u, %u))", - c_pszFileName, id.package, id.coord.x, id.coord.y, r_setting.iIndex, r_setting.iBaseX, r_setting.iBaseY); - sys_err("ERROR_ATTR_POS(%d, %d) attr_size(%d, %d)", x, y, iWidth, iHeight); - sys_err("CHECK! 'Setting.txt' and 'server_attr' MAP_SIZE!!"); + SPDLOG_ERROR("FATAL ERROR! LoadAttribute({}) - cannot find sectree(package={}, coord=({}, {}), map_index={}, map_base=({}, {}))", + c_pszFileName, id.package, (int) id.coord.x, (int) id.coord.y, r_setting.iIndex, r_setting.iBaseX, r_setting.iBaseY); + SPDLOG_ERROR("ERROR_ATTR_POS({}, {}) attr_size({}, {})", x, y, iWidth, iHeight); + SPDLOG_ERROR("CHECK! 'Setting.txt' and 'server_attr' MAP_SIZE!!"); pkMapSectree->DumpAllToSysErr(); abort(); @@ -501,7 +499,7 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p if (tree->m_id.package != id.package) { - sys_err("returned tree id mismatch! return %u, request %u", + SPDLOG_ERROR("returned tree id mismatch! return {}, request {}", tree->m_id.package, id.package); fclose(fp); @@ -520,8 +518,8 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p if (uiDestSize != sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE)) { - sys_err("SECTREE_MANAGER::LoadAttribute : %s : %d %d size mismatch! %d", - c_pszFileName, tree->m_id.coord.x, tree->m_id.coord.y, uiDestSize); + SPDLOG_ERROR("SECTREE_MANAGER::LoadAttribute : {} : {} {} size mismatch! {}", + c_pszFileName, (int) tree->m_id.coord.x, (int) tree->m_id.coord.y, uiDestSize); fclose(fp); M2_DELETE_ARRAY(attr); @@ -712,13 +710,13 @@ int SECTREE_MANAGER::GetMapIndex(int x, int y) return rRegion.index; } - sys_log(0, "SECTREE_MANAGER::GetMapIndex(%d, %d)", x, y); + SPDLOG_DEBUG("SECTREE_MANAGER::GetMapIndex({}, {})", x, y); std::vector::iterator i; for (i = m_vec_mapRegion.begin(); i !=m_vec_mapRegion.end(); ++i) { TMapRegion & rRegion = *i; - sys_log(0, "%d: (%d, %d) ~ (%d, %d)", rRegion.index, rRegion.sx, rRegion.sy, rRegion.ex, rRegion.ey); + SPDLOG_DEBUG("{}: ({}, {}) ~ ({}, {})", rRegion.index, rRegion.sx, rRegion.sy, rRegion.ex, rRegion.ey); } return 0; @@ -726,10 +724,7 @@ int SECTREE_MANAGER::GetMapIndex(int x, int y) int SECTREE_MANAGER::Build(const char * c_pszListFileName, const char* c_pszMapBasePath) { - if (true == test_server) - { - sys_log ( 0, "[BUILD] Build %s %s ", c_pszListFileName, c_pszMapBasePath ); - } + SPDLOG_TRACE("[BUILD] Build {} {} ", c_pszListFileName, c_pszMapBasePath ); FILE* fp = fopen(c_pszListFileName, "r"); @@ -757,7 +752,7 @@ int SECTREE_MANAGER::Build(const char * c_pszListFileName, const char* c_pszMapB if (!LoadSettingFile(iIndex, szFilename, setting)) { - sys_err("can't load file %s in LoadSettingFile", szFilename); + SPDLOG_ERROR("can't load file {} in LoadSettingFile", szFilename); fclose(fp); return 0; } @@ -766,13 +761,12 @@ int SECTREE_MANAGER::Build(const char * c_pszListFileName, const char* c_pszMapB if (!LoadMapRegion(szFilename, setting, szMapName)) { - sys_err("can't load file %s in LoadMapRegion", szFilename); + SPDLOG_ERROR("can't load file {} in LoadMapRegion", szFilename); fclose(fp); return 0; } - if (true == test_server) - sys_log ( 0,"[BUILD] Build %s %s %d ",c_pszMapBasePath, szMapName, iIndex ); + SPDLOG_TRACE("[BUILD] Build {} {} {} ",c_pszMapBasePath, szMapName, iIndex ); // ¸ÕÀú ÀÌ ¼­¹ö¿¡¼­ ÀÌ ¸ÊÀÇ ¸ó½ºÅ͸¦ ½ºÆùÇØ¾ß Çϴ°¡ È®ÀÎ ÇÑ´Ù. if (map_allow_find(iIndex)) @@ -867,7 +861,7 @@ bool SECTREE_MANAGER::GetValidLocation(int lMapIndex, int x, int y, int & r_lVal } else { - sys_err("cannot find sectree_map by map index %d", lMapIndex); + SPDLOG_ERROR("cannot find sectree_map by map index {}", lMapIndex); return false; } } @@ -889,7 +883,7 @@ bool SECTREE_MANAGER::GetValidLocation(int lMapIndex, int x, int y, int & r_lVal if (!tree) { - sys_err("cannot find tree by %d %d (map index %d)", x, y, lMapIndex); + SPDLOG_ERROR("cannot find tree by {} {} (map index {})", x, y, lMapIndex); return false; } @@ -900,7 +894,7 @@ bool SECTREE_MANAGER::GetValidLocation(int lMapIndex, int x, int y, int & r_lVal } } - sys_err("invalid location (map index %d %d x %d)", lRealMapIndex, x, y); + SPDLOG_ERROR("invalid location (map index {} {} x {})", lRealMapIndex, x, y); return false; } @@ -980,7 +974,7 @@ int SECTREE_MANAGER::CreatePrivateMap(int lMapIndex) if (!pkMapSectree) { - sys_err("Cannot find map index %d", lMapIndex); + SPDLOG_ERROR("Cannot find map index {}", lMapIndex); return 0; } @@ -1021,9 +1015,8 @@ int SECTREE_MANAGER::CreatePrivateMap(int lMapIndex) if (!GetMap((lMapIndex * 10000) + i)) break; } - - if ( test_server ) - sys_log( 0, "Create Dungeon : OrginalMapindex %d NewMapindex %d", lMapIndex, i ); + + SPDLOG_TRACE("Create Dungeon : OrginalMapindex {} NewMapindex {}", lMapIndex, i ); if ( lMapIndex == 107 || lMapIndex == 108 || lMapIndex == 109 ) { @@ -1042,7 +1035,7 @@ int SECTREE_MANAGER::CreatePrivateMap(int lMapIndex) if (i == 10000) { - sys_err("not enough private map index (map_index %d)", lMapIndex); + SPDLOG_ERROR("not enough private map index (map_index {})", lMapIndex); return 0; } @@ -1052,7 +1045,7 @@ int SECTREE_MANAGER::CreatePrivateMap(int lMapIndex) pkMapSectree = M2_NEW SECTREE_MAP(*pkMapSectree); m_map_pkSectree.insert(std::map::value_type(lNewMapIndex, pkMapSectree)); - sys_log(0, "PRIVATE_MAP: %d created (original %d)", lNewMapIndex, lMapIndex); + SPDLOG_DEBUG("PRIVATE_MAP: {} created (original {})", lNewMapIndex, lMapIndex); return lNewMapIndex; } @@ -1063,7 +1056,7 @@ struct FDestroyPrivateMapEntity if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) ent; - sys_log(0, "PRIVAE_MAP: removing character %s", ch->GetName()); + SPDLOG_DEBUG("PRIVAE_MAP: removing character {}", ch->GetName()); if (ch->GetDesc()) DESC_MANAGER::instance().DestroyDesc(ch->GetDesc()); @@ -1073,12 +1066,12 @@ struct FDestroyPrivateMapEntity else if (ent->IsType(ENTITY_ITEM)) { LPITEM item = (LPITEM) ent; - sys_log(0, "PRIVATE_MAP: removing item %s", item->GetName()); + SPDLOG_DEBUG("PRIVATE_MAP: removing item {}", item->GetName()); M2_DESTROY_ITEM(item); } else - sys_err("PRIVAE_MAP: trying to remove unknown entity %d", ent->GetType()); + SPDLOG_ERROR("PRIVAE_MAP: trying to remove unknown entity {}", ent->GetType()); } }; @@ -1103,7 +1096,7 @@ void SECTREE_MANAGER::DestroyPrivateMap(int lMapIndex) m_map_pkSectree.erase(lMapIndex); M2_DELETE(pkMapSectree); - sys_log(0, "PRIVATE_MAP: %d destroyed", lMapIndex); + SPDLOG_DEBUG("PRIVATE_MAP: {} destroyed", lMapIndex); } TAreaMap& SECTREE_MANAGER::GetDungeonArea(int lMapIndex) @@ -1264,7 +1257,7 @@ bool SECTREE_MANAGER::ForAttrRegionCell( int lMapIndex, int lCX, int lCY, DWORD break; default: - sys_err("Unknown region mode %u", mode); + SPDLOG_ERROR("Unknown region mode {}", (int) mode); break; } @@ -1316,7 +1309,7 @@ bool SECTREE_MANAGER::ForAttrRegionFreeAngle( int lMapIndex, int lCX, int lCY, i if (0 == fdx1 || 0 == fdx2) { - sys_err( "SECTREE_MANAGER::ForAttrRegion - Unhandled exception. MapIndex: %d", lMapIndex ); + SPDLOG_ERROR("SECTREE_MANAGER::ForAttrRegion - Unhandled exception. MapIndex: {}", lMapIndex ); return false; } @@ -1363,7 +1356,7 @@ bool SECTREE_MANAGER::ForAttrRegion(int lMapIndex, int lStartX, int lStartY, int if (!pkMapSectree) { - sys_err("Cannot find SECTREE_MAP by map index %d", lMapIndex); + SPDLOG_ERROR("Cannot find SECTREE_MAP by map index {}", lMapIndex); return mode == ATTR_REGION_MODE_CHECK ? true : false; } @@ -1385,7 +1378,7 @@ bool SECTREE_MANAGER::ForAttrRegion(int lMapIndex, int lStartX, int lStartY, int int lCW = (lEndX - lStartX) / CELL_SIZE; int lCH = (lEndY - lStartY) / CELL_SIZE; - sys_log(1, "ForAttrRegion %d %d ~ %d %d", lStartX, lStartY, lEndX, lEndY); + SPDLOG_DEBUG("ForAttrRegion {} {} ~ {} {}", lStartX, lStartY, lEndX, lEndY); lRotate = lRotate % 360; @@ -1405,7 +1398,7 @@ bool SECTREE_MANAGER::SaveAttributeToImage(int lMapIndex, const char * c_pszFile pMap = pMapSrc; else { - sys_err("cannot find sectree_map %d", lMapIndex); + SPDLOG_ERROR("cannot find sectree_map {}", lMapIndex); return false; } } @@ -1415,26 +1408,22 @@ bool SECTREE_MANAGER::SaveAttributeToImage(int lMapIndex, const char * c_pszFile if (iMapHeight < 0 || iMapWidth < 0) { - sys_err("map size error w %d h %d", iMapWidth, iMapHeight); + SPDLOG_ERROR("map size error w {} h {}", iMapWidth, iMapHeight); return false; } - sys_log(0, "SaveAttributeToImage w %d h %d file %s", iMapWidth, iMapHeight, c_pszFileName); + SPDLOG_DEBUG("SaveAttributeToImage w {} h {} file {}", iMapWidth, iMapHeight, c_pszFileName); CTargaImage image; image.Create(512 * iMapWidth, 512 * iMapHeight); - sys_log(0, "1"); - DWORD * pdwDest = (DWORD *) image.GetBasePointer(); int pixels = 0; int x, x2; int y, y2; - sys_log(0, "2 %p", pdwDest); - DWORD * pdwLine = M2_NEW DWORD[SECTREE_SIZE / CELL_SIZE]; for (y = 0; y < 4 * iMapHeight; ++y) @@ -1452,7 +1441,7 @@ bool SECTREE_MANAGER::SaveAttributeToImage(int lMapIndex, const char * c_pszFile if (!pSec) { - sys_err("cannot get sectree for %d %d %d %d", id.coord.x, id.coord.y, pMap->m_setting.iBaseX, pMap->m_setting.iBaseY); + SPDLOG_ERROR("cannot get sectree for {} {} {} {}", (int) id.coord.x, (int) id.coord.y, pMap->m_setting.iBaseX, pMap->m_setting.iBaseY); continue; } @@ -1460,7 +1449,7 @@ bool SECTREE_MANAGER::SaveAttributeToImage(int lMapIndex, const char * c_pszFile if (!pdwLine) { - sys_err("cannot get attribute line pointer"); + SPDLOG_ERROR("cannot get attribute line pointer"); M2_DELETE_ARRAY(pdwLine); continue; } @@ -1486,16 +1475,15 @@ bool SECTREE_MANAGER::SaveAttributeToImage(int lMapIndex, const char * c_pszFile } M2_DELETE_ARRAY(pdwLine); - sys_log(0, "3"); if (image.Save(c_pszFileName)) { - sys_log(0, "SECTREE: map %d attribute saved to %s (%d bytes)", lMapIndex, c_pszFileName, pixels); + SPDLOG_DEBUG("SECTREE: map {} attribute saved to {} ({} bytes)", lMapIndex, c_pszFileName, pixels); return true; } else { - sys_err("cannot save file, map_index %d filename %s", lMapIndex, c_pszFileName); + SPDLOG_ERROR("cannot save file, map_index {} filename {}", lMapIndex, c_pszFileName); return false; } } diff --git a/src/game/src/sectree_manager.h b/src/game/src/sectree_manager.h index 6f5d081..7b6b99e 100644 --- a/src/game/src/sectree_manager.h +++ b/src/game/src/sectree_manager.h @@ -93,7 +93,7 @@ class SECTREE_MAP SECTREE_MAP::MapType::iterator i; for (i = map_.begin(); i != map_.end(); ++i) { - sys_err("SECTREE %x(%u, %u)", i->first, i->first & 0xffff, i->first >> 16); + SPDLOG_ERROR("SECTREE {}({}, {})", i->first, i->first & 0xffff, i->first >> 16); } } diff --git a/src/game/src/shop.cpp b/src/game/src/shop.cpp index d47809b..1224556 100644 --- a/src/game/src/shop.cpp +++ b/src/game/src/shop.cpp @@ -60,11 +60,11 @@ bool CShop::Create(DWORD dwVnum, DWORD dwNPCVnum, TShopItemTable * pTable) /* if (NULL == CMobManager::instance().Get(dwNPCVnum)) { - sys_err("No such a npc by vnum %d", dwNPCVnum); + SPDLOG_ERROR("No such a npc by vnum {}", dwNPCVnum); return false; } */ - sys_log(0, "SHOP #%d (Shopkeeper %d)", dwVnum, dwNPCVnum); + SPDLOG_DEBUG("SHOP #{} (Shopkeeper {})", dwVnum, dwNPCVnum); m_dwVnum = dwVnum; m_dwNPCVnum = dwNPCVnum; @@ -100,7 +100,7 @@ void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) if (!pkItem) { - sys_err("cannot find item on pos (%d, %d) (name: %s)", pTable->pos.window_type, pTable->pos.cell, m_pkPC->GetName()); + SPDLOG_ERROR("cannot find item on pos ({}, {}) (name: {})", pTable->pos.window_type, pTable->pos.cell, m_pkPC->GetName()); continue; } @@ -116,7 +116,7 @@ void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) if (!item_table) { - sys_err("Shop: no item table by item vnum #%d", pTable->vnum); + SPDLOG_ERROR("Shop: no item table by item vnum #{}", pTable->vnum); continue; } @@ -124,7 +124,7 @@ void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) if (IsPCShop()) { - sys_log(0, "MyShop: use position %d", pTable->display_pos); + SPDLOG_DEBUG("MyShop: use position {}", pTable->display_pos); iPos = pTable->display_pos; } else @@ -132,7 +132,7 @@ void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) if (iPos < 0) { - sys_err("not enough shop window"); + SPDLOG_ERROR("not enough shop window"); continue; } @@ -140,11 +140,11 @@ void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) { if (IsPCShop()) { - sys_err("not empty position for pc shop %s[%d]", m_pkPC->GetName(), m_pkPC->GetPlayerID()); + SPDLOG_ERROR("not empty position for pc shop {}[{}]", m_pkPC->GetName(), m_pkPC->GetPlayerID()); } else { - sys_err("not empty position for npc shop"); + SPDLOG_ERROR("not empty position for npc shop"); } continue; } @@ -179,10 +179,7 @@ void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) item.price = item_table->dwGold * item.count; } - char name[64]; - snprintf(name, sizeof(name), "%-20s(#%-5d) (x %d)", item_table->szName, (int) item.vnum, item.count); - - sys_log(0, "SHOP_ITEM: %-36s PRICE %-5d", name, item.price); + SPDLOG_DEBUG("SHOP_ITEM: {:20}(#{:5}) (x {}) PRICE {}", item_table->szName, (int) item.vnum, item.count, item.price); ++pTable; } } @@ -191,11 +188,11 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) { if (pos >= m_itemVector.size()) { - sys_log(0, "Shop::Buy : invalid position %d : %s", pos, ch->GetName()); + SPDLOG_ERROR("Shop::Buy : invalid position {} : {}", pos, ch->GetName()); return SHOP_SUBHEADER_GC_INVALID_POS; } - sys_log(0, "Shop::Buy : name %s pos %d", ch->GetName(), pos); + SPDLOG_DEBUG("Shop::Buy : name {} pos {}", ch->GetName(), pos); GuestMapType::iterator it = m_map_guest.find(ch); @@ -216,7 +213,7 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) { if (!pkSelectedItem) { - sys_log(0, "Shop::Buy : Critical: This user seems to be a hacker : invalid pcshop item : BuyerPID:%d SellerPID:%d", + SPDLOG_WARN("Shop::Buy : Critical: This user seems to be a hacker : invalid pcshop item : BuyerPID:{} SellerPID:{}", ch->GetPlayerID(), m_pkPC->GetPlayerID()); @@ -225,7 +222,7 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) if ((pkSelectedItem->GetOwner() != m_pkPC)) { - sys_log(0, "Shop::Buy : Critical: This user seems to be a hacker : invalid pcshop item : BuyerPID:%d SellerPID:%d", + SPDLOG_WARN("Shop::Buy : Critical: This user seems to be a hacker : invalid pcshop item : BuyerPID:{} SellerPID:{}", ch->GetPlayerID(), m_pkPC->GetPlayerID()); @@ -240,7 +237,7 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) if (ch->GetGold() < (int) dwPrice) { - sys_log(1, "Shop::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice); + SPDLOG_DEBUG("Shop::Buy : Not enough money : {} has {}, price {}", ch->GetName(), ch->GetGold(), dwPrice); return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY; } @@ -280,12 +277,12 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) { if (m_pkPC) { - sys_log(1, "Shop::Buy at PC Shop : Inventory full : %s size %d", ch->GetName(), item->GetSize()); + SPDLOG_DEBUG("Shop::Buy at PC Shop : Inventory full : {} size {}", ch->GetName(), item->GetSize()); return SHOP_SUBHEADER_GC_INVENTORY_FULL; } else { - sys_log(1, "Shop::Buy : Inventory full : %s size %d", ch->GetName(), item->GetSize()); + SPDLOG_DEBUG("Shop::Buy : Inventory full : {} size {}", ch->GetName(), item->GetSize()); M2_DESTROY_ITEM(item); return SHOP_SUBHEADER_GC_INVENTORY_FULL; } @@ -403,7 +400,7 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos) } if (item) - sys_log(0, "SHOP: BUY: name %s %s(x %d):%u price %u", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice); + SPDLOG_DEBUG("SHOP: BUY: name {} {}(x {}):{} price {}", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice); ch->Save(); @@ -494,7 +491,7 @@ void CShop::RemoveGuest(LPCHARACTER ch) void CShop::Broadcast(const void * data, int bytes) { - sys_log(1, "Shop::Broadcast %p %d", data, bytes); + SPDLOG_DEBUG("Shop::Broadcast {} {}", data, bytes); GuestMapType::iterator it; diff --git a/src/game/src/shopEx.cpp b/src/game/src/shopEx.cpp index 2d0ea04..e9e9ac4 100644 --- a/src/game/src/shopEx.cpp +++ b/src/game/src/shopEx.cpp @@ -119,11 +119,11 @@ int CShopEx::Buy(LPCHARACTER ch, BYTE pos) BYTE slotPos = pos % SHOP_HOST_ITEM_MAX_NUM; if (tabIdx >= GetTabCount()) { - sys_log(0, "ShopEx::Buy : invalid position %d : %s", pos, ch->GetName()); + SPDLOG_ERROR("ShopEx::Buy : invalid position {} : {}", pos, ch->GetName()); return SHOP_SUBHEADER_GC_INVALID_POS; } - sys_log(0, "ShopEx::Buy : name %s pos %d", ch->GetName(), pos); + SPDLOG_DEBUG("ShopEx::Buy : name {} pos {}", ch->GetName(), pos); GuestMapType::iterator it = m_map_guest.find(ch); @@ -149,7 +149,7 @@ int CShopEx::Buy(LPCHARACTER ch, BYTE pos) if (ch->GetGold() < (int) dwPrice) { - sys_log(1, "ShopEx::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice); + SPDLOG_DEBUG("ShopEx::Buy : Not enough money : {} has {}, price {}", ch->GetName(), ch->GetGold(), dwPrice); return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY; } break; @@ -158,7 +158,7 @@ int CShopEx::Buy(LPCHARACTER ch, BYTE pos) int count = ch->CountSpecifyTypeItem(ITEM_SECONDARY_COIN); if (count < dwPrice) { - sys_log(1, "ShopEx::Buy : Not enough myeongdojun : %s has %d, price %d", ch->GetName(), count, dwPrice); + SPDLOG_DEBUG("ShopEx::Buy : Not enough myeongdojun : {} has {}, price {}", ch->GetName(), count, dwPrice); return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY_EX; } } @@ -184,7 +184,7 @@ int CShopEx::Buy(LPCHARACTER ch, BYTE pos) if (iEmptyPos < 0) { - sys_log(1, "ShopEx::Buy : Inventory full : %s size %d", ch->GetName(), item->GetSize()); + SPDLOG_DEBUG("ShopEx::Buy : Inventory full : {} size {}", ch->GetName(), item->GetSize()); M2_DESTROY_ITEM(item); return SHOP_SUBHEADER_GC_INVENTORY_FULL; } @@ -216,7 +216,7 @@ int CShopEx::Buy(LPCHARACTER ch, BYTE pos) DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), -dwPrice); if (item) - sys_log(0, "ShopEx: BUY: name %s %s(x %d):%u price %u", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice); + SPDLOG_DEBUG("ShopEx: BUY: name {} {}(x {}):{} price {}", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice); if (LC_IsBrazil()) { diff --git a/src/game/src/shop_manager.cpp b/src/game/src/shop_manager.cpp index e3d8a48..e8cdace 100644 --- a/src/game/src/shop_manager.cpp +++ b/src/game/src/shop_manager.cpp @@ -121,7 +121,7 @@ bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper, if (distance >= SHOP_MAX_DISTANCE) { - sys_log(1, "SHOP: TOO_FAR: %s distance %d", pkChr->GetName(), distance); + SPDLOG_DEBUG("SHOP: TOO_FAR: {} distance {}", pkChr->GetName(), distance); return false; } @@ -134,7 +134,7 @@ bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper, if (!pkShop) { - sys_log(1, "SHOP: NO SHOP"); + SPDLOG_DEBUG("SHOP: NO SHOP"); return false; } @@ -145,7 +145,7 @@ bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper, pkShop->AddGuest(pkChr, pkChrShopKeeper->GetVID(), bOtherEmpire); pkChr->SetShopOwner(pkChrShopKeeper); - sys_log(0, "SHOP: START: %s", pkChr->GetName()); + SPDLOG_DEBUG("SHOP: START: {}", pkChr->GetName()); return true; } @@ -200,7 +200,7 @@ void CShopManager::StopShopping(LPCHARACTER ch) //END_PREVENT_ITEM_COPY shop->RemoveGuest(ch); - sys_log(0, "SHOP: END: %s", ch->GetName()); + SPDLOG_DEBUG("SHOP: END: {}", ch->GetName()); } // ¾ÆÀÌÅÛ ±¸ÀÔ @@ -328,20 +328,19 @@ void CShopManager::Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount) dwPrice -= dwTax; } - if (test_server) - sys_log(0, "Sell Item price id %d %s itemid %d", ch->GetPlayerID(), ch->GetName(), item->GetID()); + SPDLOG_TRACE("Sell Item price id {} {} itemid {}", ch->GetPlayerID(), ch->GetName(), item->GetID()); const int64_t nTotalMoney = static_cast(ch->GetGold()) + static_cast(dwPrice); if (GOLD_MAX <= nTotalMoney) { - sys_err("[OVERFLOW_GOLD] id %u name %s gold %u", ch->GetPlayerID(), ch->GetName(), ch->GetGold()); + SPDLOG_ERROR("[OVERFLOW_GOLD] id {} name {} gold {}", ch->GetPlayerID(), ch->GetName(), ch->GetGold()); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20¾ï³ÉÀÌ ÃÊ°úÇÏ¿© ¹°Ç°À» Æȼö ¾ø½À´Ï´Ù.")); return; } // 20050802.myevan.»óÁ¡ ÆǸŠ·Î±×¿¡ ¾ÆÀÌÅÛ ID Ãß°¡ - sys_log(0, "SHOP: SELL: %s item name: %s(x%d):%u price: %u", ch->GetName(), item->GetName(), bCount, item->GetID(), dwPrice); + SPDLOG_DEBUG("SHOP: SELL: {} item name: {}(x{}):{} price: {}", ch->GetName(), item->GetName(), bCount, item->GetID(), dwPrice); if (iVal > 0) ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÆǸűݾ×ÀÇ %d %% °¡ ¼¼±ÝÀ¸·Î ³ª°¡°ÔµË´Ï´Ù"), iVal); @@ -380,19 +379,19 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable) { if (!pNode->GetValue("vnum", 0, shopTable.dwVnum)) { - sys_err("Group %s does not have vnum.", pNode->GetNodeName().c_str()); + SPDLOG_ERROR("Group {} does not have vnum.", pNode->GetNodeName()); return false; } if (!pNode->GetValue("name", 0, shopTable.name)) { - sys_err("Group %s does not have name.", pNode->GetNodeName().c_str()); + SPDLOG_ERROR("Group {} does not have name.", pNode->GetNodeName()); return false; } if (shopTable.name.length() >= SHOP_TAB_NAME_MAX) { - sys_err("Shop name length must be less than %d. Error in Group %s, name %s", SHOP_TAB_NAME_MAX, pNode->GetNodeName().c_str(), shopTable.name.c_str()); + SPDLOG_ERROR("Shop name length must be less than {}. Error in Group {}, name {}", (int) SHOP_TAB_NAME_MAX, pNode->GetNodeName(), shopTable.name); return false; } @@ -412,14 +411,14 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable) } else { - sys_err("Group %s has undefine cointype(%s).", pNode->GetNodeName().c_str(), stCoinType.c_str()); + SPDLOG_ERROR("Group {} has undefine cointype({}).", pNode->GetNodeName(), stCoinType); return false; } CGroupNode* pItemGroup = pNode->GetChildNode("items"); if (!pItemGroup) { - sys_err("Group %s does not have 'group items'.", pNode->GetNodeName().c_str()); + SPDLOG_ERROR("Group {} does not have 'group items'.", pNode->GetNodeName()); return false; } @@ -427,7 +426,7 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable) std::vector shopItems(itemGroupSize); if (itemGroupSize >= SHOP_HOST_ITEM_MAX_NUM) { - sys_err("count(%d) of rows of group items of group %s must be smaller than %d", itemGroupSize, pNode->GetNodeName().c_str(), SHOP_HOST_ITEM_MAX_NUM); + SPDLOG_ERROR("count({}) of rows of group items of group {} must be smaller than {}", itemGroupSize, pNode->GetNodeName(), (int) SHOP_HOST_ITEM_MAX_NUM); return false; } @@ -435,18 +434,18 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable) { if (!pItemGroup->GetValue(i, "vnum", shopItems[i].vnum)) { - sys_err("row(%d) of group items of group %s does not have vnum column", i, pNode->GetNodeName().c_str()); + SPDLOG_ERROR("row({}) of group items of group {} does not have vnum column", i, pNode->GetNodeName()); return false; } if (!pItemGroup->GetValue(i, "count", shopItems[i].count)) { - sys_err("row(%d) of group items of group %s does not have count column", i, pNode->GetNodeName().c_str()); + SPDLOG_ERROR("row({}) of group items of group {} does not have count column", i, pNode->GetNodeName()); return false; } if (!pItemGroup->GetValue(i, "price", shopItems[i].price)) { - sys_err("row(%d) of group items of group %s does not have price column", i, pNode->GetNodeName().c_str()); + SPDLOG_ERROR("row({}) of group items of group {} does not have price column", i, pNode->GetNodeName()); return false; } } @@ -475,7 +474,7 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable) TItemTable * item_table = ITEM_MANAGER::instance().GetTable(shopItems[i].vnum); if (!item_table) { - sys_err("vnum(%d) of group items of group %s does not exist", shopItems[i].vnum, pNode->GetNodeName().c_str()); + SPDLOG_ERROR("vnum({}) of group items of group {} does not exist", shopItems[i].vnum, pNode->GetNodeName().c_str()); return false; } @@ -501,14 +500,14 @@ bool CShopManager::ReadShopTableEx(const char* stFileName) CGroupTextParseTreeLoader loader; if (!loader.Load(stFileName)) { - sys_err("%s Load fail.", stFileName); + SPDLOG_ERROR("{} Load fail.", stFileName); return false; } CGroupNode* pShopNPCGroup = loader.GetGroup("shopnpc"); if (NULL == pShopNPCGroup) { - sys_err("Group ShopNPC is not exist."); + SPDLOG_ERROR("Group ShopNPC is not exist."); return false; } @@ -520,25 +519,25 @@ bool CShopManager::ReadShopTableEx(const char* stFileName) std::string shopName; if (!pShopNPCGroup->GetValue(i, "npc", npcVnum) || !pShopNPCGroup->GetValue(i, "group", shopName)) { - sys_err("Invalid row(%d). Group ShopNPC rows must have 'npc', 'group' columns", i); + SPDLOG_ERROR("Invalid row({}). Group ShopNPC rows must have 'npc', 'group' columns", i); return false; } std::transform(shopName.begin(), shopName.end(), shopName.begin(), (int(*)(int))std::tolower); CGroupNode* pShopGroup = loader.GetGroup(shopName.c_str()); if (!pShopGroup) { - sys_err("Group %s is not exist.", shopName.c_str()); + SPDLOG_ERROR("Group {} is not exist.", shopName.c_str()); return false; } TShopTableEx table; if (!ConvertToShopItemTable(pShopGroup, table)) { - sys_err("Cannot read Group %s.", shopName.c_str()); + SPDLOG_ERROR("Cannot read Group {}.", shopName.c_str()); return false; } if (m_map_pkShopByNPCVnum.find(npcVnum) != m_map_pkShopByNPCVnum.end()) { - sys_err("%d cannot have both original shop and extended shop", npcVnum); + SPDLOG_ERROR("{} cannot have both original shop and extended shop", npcVnum); return false; } @@ -551,7 +550,7 @@ bool CShopManager::ReadShopTableEx(const char* stFileName) TShopTableEx& table = it->second; if (m_map_pkShop.find(table.dwVnum) != m_map_pkShop.end()) { - sys_err("Shop vnum(%d) already exists", table.dwVnum); + SPDLOG_ERROR("Shop vnum({}) already exists", table.dwVnum); return false; } TShopMap::iterator shop_it = m_map_pkShopByNPCVnum.find(npcVnum); @@ -568,20 +567,20 @@ bool CShopManager::ReadShopTableEx(const char* stFileName) pkShopEx = dynamic_cast (shop_it->second); if (NULL == pkShopEx) { - sys_err("WTF!!! It can't be happend. NPC(%d) Shop is not extended version.", shop_it->first); + SPDLOG_ERROR("WTF!!! It can't be happend. NPC({}) Shop is not extended version.", shop_it->first); return false; } } if (pkShopEx->GetTabCount() >= SHOP_TAB_COUNT_MAX) { - sys_err("ShopEx cannot have tab more than %d", SHOP_TAB_COUNT_MAX); + SPDLOG_ERROR("ShopEx cannot have tab more than {}", (int) SHOP_TAB_COUNT_MAX); return false; } if (pkShopEx->GetVnum() != 0 && m_map_pkShop.find(pkShopEx->GetVnum()) != m_map_pkShop.end()) { - sys_err("Shop vnum(%d) already exist.", pkShopEx->GetVnum()); + SPDLOG_ERROR("Shop vnum({}) already exist.", pkShopEx->GetVnum()); return false; } m_map_pkShop.insert(TShopMap::value_type (pkShopEx->GetVnum(), pkShopEx)); diff --git a/src/game/src/skill.cpp b/src/game/src/skill.cpp index 5fc79b0..d402423 100644 --- a/src/game/src/skill.cpp +++ b/src/game/src/skill.cpp @@ -124,7 +124,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (iIdx < 0) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : cannot find point type on skill: %s szPointOn: %s", t->szName, t->szPointOn); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -138,7 +138,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (iIdx2 < 0) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : cannot find point type on skill: %s szPointOn2: %s", t->szName, t->szPointOn2); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -158,7 +158,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) else { snprintf(buf, sizeof(buf), "SkillManager::Initialize : cannot find point type on skill: %s szPointOn3: %s", t->szName, t->szPointOn3); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -171,7 +171,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kSplashAroundDamageAdjustPoly.Analyze(t->szSplashAroundDamageAdjustPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szSplashAroundDamageAdjustPoly: %s", t->szName, t->szSplashAroundDamageAdjustPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -181,7 +181,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kPointPoly.Analyze(t->szPointPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szPointPoly: %s", t->szName, t->szPointPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -191,7 +191,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kPointPoly2.Analyze(t->szPointPoly2)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szPointPoly2: %s", t->szName, t->szPointPoly2); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -201,7 +201,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kPointPoly3.Analyze(t->szPointPoly3)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szPointPoly3: %s", t->szName, t->szPointPoly3); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -211,7 +211,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kSPCostPoly.Analyze(t->szSPCostPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szSPCostPoly: %s", t->szName, t->szSPCostPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -221,7 +221,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kGrandMasterAddSPCostPoly.Analyze(t->szGrandMasterAddSPCostPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szGrandMasterAddSPCostPoly: %s", t->szName, t->szGrandMasterAddSPCostPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -231,7 +231,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kDurationPoly.Analyze(t->szDurationPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szDurationPoly: %s", t->szName, t->szDurationPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -241,7 +241,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kDurationPoly2.Analyze(t->szDurationPoly2)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szDurationPoly2: %s", t->szName, t->szDurationPoly2); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -251,7 +251,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kDurationPoly3.Analyze(t->szDurationPoly3)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szDurationPoly3: %s", t->szName, t->szDurationPoly3); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -261,7 +261,7 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kDurationSPCostPoly.Analyze(t->szDurationSPCostPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szDurationSPCostPoly: %s", t->szName, t->szDurationSPCostPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); @@ -271,25 +271,25 @@ bool CSkillManager::Initialize(TSkillTable * pTab, int iSize) if (!pkProto->kCooldownPoly.Analyze(t->szCooldownPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szCooldownPoly: %s", t->szName, t->szCooldownPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); continue; } - sys_log(0, "Master %s", t->szMasterBonusPoly); + SPDLOG_DEBUG("Master {}", t->szMasterBonusPoly); if (!pkProto->kMasterBonusPoly.Analyze(t->szMasterBonusPoly)) { snprintf(buf, sizeof(buf), "SkillManager::Initialize : syntax error skill: %s szMasterBonusPoly: %s", t->szName, t->szMasterBonusPoly); - sys_err("%s", buf); + SPDLOG_ERROR("{}", buf); SendLog(buf); bError = true; M2_DELETE(pkProto); continue; } - sys_log(0, "#%-3d %-24s type %u flag %u affect %u point_poly: %s", + SPDLOG_DEBUG("#{:<3} {:24} type {} flag {} affect {} point_poly: {}", pkProto->dwVnum, pkProto->szName, pkProto->dwType, pkProto->dwFlag, pkProto->dwAffectFlag, t->szPointPoly); map_pkSkillProto.insert(std::map::value_type(pkProto->dwVnum, pkProto)); diff --git a/src/game/src/skill_power.cpp b/src/game/src/skill_power.cpp index 96d45f1..a5954a8 100644 --- a/src/game/src/skill_power.cpp +++ b/src/game/src/skill_power.cpp @@ -11,7 +11,7 @@ bool CTableBySkill::Check() const { if (!m_aiSkillPowerByLevelFromType[job]) { - fprintf( stderr, "[NO SETTING SKILL] aiSkillPowerByLevelFromType[%d]", job); + SPDLOG_ERROR("[NO SETTING SKILL] aiSkillPowerByLevelFromType[{}]", job); return false; } } diff --git a/src/game/src/spam.h b/src/game/src/spam.h index 7fd0e89..3de44f5 100644 --- a/src/game/src/spam.h +++ b/src/game/src/spam.h @@ -43,7 +43,7 @@ class SpamManager : public singleton inline void Insert(const char * str, unsigned int score = 10) { m_vec_word.push_back(std::make_pair(str, score)); - sys_log(0, "SPAM: %2d %s", score, str); + SPDLOG_DEBUG("SPAM: {:2} {}", score, str); } private: diff --git a/src/game/src/target.cpp b/src/game/src/target.cpp index 773461a..49bb45e 100644 --- a/src/game/src/target.cpp +++ b/src/game/src/target.cpp @@ -35,7 +35,7 @@ pck.lID = iID; pck.lX = x; pck.lY = y; d->Packet(&pck, sizeof(TPacketGCTargetUpdate)); -sys_log(0, "SendTargetUpdatePacket %d %dx%d", iID, x, y); +SPDLOG_DEBUG("SendTargetUpdatePacket {} {}x{}", iID, x, y); } void SendTargetDeletePacket(LPDESC d, int iID) @@ -60,7 +60,7 @@ EVENTFUNC(target_event) if ( info == NULL ) { - sys_err( "target_event> Null pointer" ); + SPDLOG_ERROR("target_event> Null pointer" ); return 0; } @@ -112,7 +112,7 @@ EVENTFUNC(target_event) if (event->is_force_to_end) { - sys_log(0, "target_event: event canceled"); + SPDLOG_DEBUG("target_event: event canceled"); return 0; } @@ -141,14 +141,14 @@ void CTargetManager::CreateTarget(DWORD dwPID, const char * c_pszTargetDesc, int iSendFlag) { - sys_log(0, "CreateTarget : target pid %u quest %u name %s arg %d %d %d", + SPDLOG_DEBUG("CreateTarget : target pid {} quest {} name {} arg {} {} {}", dwPID, dwQuestIndex, c_pszTargetName, iType, iArg1, iArg2); LPCHARACTER pkChr = CHARACTER_MANAGER::instance().FindByPID(dwPID); if (!pkChr) { - sys_err("Cannot find character ptr by PID %u", dwPID); + SPDLOG_ERROR("Cannot find character ptr by PID {}", dwPID); return; } @@ -168,13 +168,13 @@ void CTargetManager::CreateTarget(DWORD dwPID, if (NULL == existInfo) { - sys_err("CreateTarget : event already exist, but have no info"); + SPDLOG_ERROR("CreateTarget : event already exist, but have no info"); return; } if (existInfo->dwQuestIndex == dwQuestIndex && !strcmp(existInfo->szTargetName, c_pszTargetName)) { - sys_log(0, "CreateTarget : same target will be replaced"); + SPDLOG_DEBUG("CreateTarget : same target will be replaced"); if (existInfo->bSendToClient) SendTargetDeletePacket(pkChr->GetDesc(), existInfo->iID); @@ -253,7 +253,7 @@ void CTargetManager::DeleteTarget(DWORD dwPID, DWORD dwQuestIndex, const char * if ( info == NULL ) { - sys_err( "CTargetManager::DeleteTarget> Null pointer" ); + SPDLOG_ERROR("CTargetManager::DeleteTarget> Null pointer" ); ++it2; continue; } @@ -297,7 +297,7 @@ LPEVENT CTargetManager::GetTargetEvent(DWORD dwPID, DWORD dwQuestIndex, const ch if ( info == NULL ) { - sys_err( "CTargetManager::GetTargetEvent> Null pointer" ); + SPDLOG_ERROR("CTargetManager::GetTargetEvent> Null pointer" ); continue; } @@ -330,7 +330,7 @@ TargetInfo * CTargetManager::GetTargetInfo(DWORD dwPID, int iType, int iArg1) if ( info == NULL ) { - sys_err( "CTargetManager::GetTargetInfo> Null pointer" ); + SPDLOG_ERROR("CTargetManager::GetTargetInfo> Null pointer" ); continue; } diff --git a/src/game/src/text_file_loader.cpp b/src/game/src/text_file_loader.cpp index 8ff2397..7247254 100644 --- a/src/game/src/text_file_loader.cpp +++ b/src/game/src/text_file_loader.cpp @@ -74,10 +74,10 @@ bool CTextFileLoader::LoadGroup(TGroupNode * pGroupNode) { if (2 != stTokenVector.size()) { - sys_err("Invalid group syntax token size: %u != 2 (DO NOT SPACE IN NAME)", stTokenVector.size()); + SPDLOG_ERROR("Invalid group syntax token size: {} != 2 (DO NOT SPACE IN NAME)", stTokenVector.size()); for (unsigned int i = 0; i < stTokenVector.size(); ++i) - sys_err(" %u %s", i, stTokenVector[i].c_str()); - exit(1); + SPDLOG_ERROR(" {} {}", i, stTokenVector[i].c_str()); + exit(EXIT_FAILURE); continue; } @@ -132,7 +132,7 @@ bool CTextFileLoader::LoadGroup(TGroupNode * pGroupNode) if (1 == stTokenVector.size()) { - sys_err("CTextFileLoader::LoadGroup : must have a value (filename: %s line: %d key: %s)", + SPDLOG_ERROR("CTextFileLoader::LoadGroup : must have a value (filename: {} line: {} key: {})", m_strFileName.c_str(), m_dwcurLineIndex, key.c_str()); @@ -263,7 +263,7 @@ BOOL CTextFileLoader::GetTokenVector(const std::string & c_rstrKey, TTokenVector TTokenVectorMap::iterator it = m_pcurNode->LocalTokenVectorMap.find(c_rstrKey); if (m_pcurNode->LocalTokenVectorMap.end() == it) { - sys_log(2, " CTextFileLoader::GetTokenVector - Failed to find the key %s [%s :: %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenVector - Failed to find the key {} [{} :: {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -280,7 +280,7 @@ BOOL CTextFileLoader::GetTokenBoolean(const std::string & c_rstrKey, BOOL * pDat if (pTokenVector->empty()) { - sys_log(2, " CTextFileLoader::GetTokenBoolean - Failed to find the value %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenBoolean - Failed to find the value {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -299,7 +299,7 @@ BOOL CTextFileLoader::GetTokenByte(const std::string & c_rstrKey, BYTE * pData) if (pTokenVector->empty()) { - sys_log(2, " CTextFileLoader::GetTokenByte - Failed to find the value %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenByte - Failed to find the value {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -318,7 +318,7 @@ BOOL CTextFileLoader::GetTokenWord(const std::string & c_rstrKey, WORD * pData) if (pTokenVector->empty()) { - sys_log(2, " CTextFileLoader::GetTokenWord - Failed to find the value %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenWord - Failed to find the value {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -337,7 +337,7 @@ BOOL CTextFileLoader::GetTokenInteger(const std::string & c_rstrKey, int * pData if (pTokenVector->empty()) { - sys_log(2, " CTextFileLoader::GetTokenInteger - Failed to find the value %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenInteger - Failed to find the value {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -361,7 +361,7 @@ BOOL CTextFileLoader::GetTokenFloat(const std::string & c_rstrKey, float * pData if (pTokenVector->empty()) { - sys_log(2, " CTextFileLoader::GetTokenFloat - Failed to find the value %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenFloat - Failed to find the value {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -378,7 +378,7 @@ BOOL CTextFileLoader::GetTokenVector2(const std::string & c_rstrKey, D3DXVECTOR2 if (pTokenVector->size() != 2) { - sys_log(2, " CTextFileLoader::GetTokenVector2 - This key should have 2 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenVector2 - This key should have 2 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -396,7 +396,7 @@ BOOL CTextFileLoader::GetTokenVector3(const std::string & c_rstrKey, D3DXVECTOR3 if (pTokenVector->size() != 3) { - sys_log(2, " CTextFileLoader::GetTokenVector3 - This key should have 3 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenVector3 - This key should have 3 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -415,7 +415,7 @@ BOOL CTextFileLoader::GetTokenVector4(const std::string & c_rstrKey, D3DXVECTOR4 if (pTokenVector->size() != 4) { - sys_log(2, " CTextFileLoader::GetTokenVector3 - This key should have 3 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenVector3 - This key should have 3 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -441,7 +441,7 @@ BOOL CTextFileLoader::GetTokenQuaternion(const std::string & c_rstrKey, D3DXQUAT if (pTokenVector->size() != 4) { - sys_log(2, " CTextFileLoader::GetTokenVector3 - This key should have 3 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenVector3 - This key should have 3 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -460,7 +460,7 @@ BOOL CTextFileLoader::GetTokenDirection(const std::string & c_rstrKey, D3DVECTOR if (pTokenVector->size() != 3) { - sys_log(2, " CTextFileLoader::GetTokenDirection - This key should have 3 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenDirection - This key should have 3 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -478,7 +478,7 @@ BOOL CTextFileLoader::GetTokenColor(const std::string & c_rstrKey, D3DXCOLOR * p if (pTokenVector->size() != 4) { - sys_log(2, " CTextFileLoader::GetTokenColor - This key should have 4 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_WARN(" CTextFileLoader::GetTokenColor - This key should have 4 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -498,7 +498,7 @@ BOOL CTextFileLoader::GetTokenColor(const std::string & c_rstrKey, D3DCOLORVALUE if (pTokenVector->size() != 4) { - sys_log(2, " CTextFileLoader::GetTokenColor - This key should have 4 values %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_TRACE(" CTextFileLoader::GetTokenColor - This key should have 4 values {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } @@ -518,7 +518,7 @@ BOOL CTextFileLoader::GetTokenString(const std::string & c_rstrKey, std::string if (pTokenVector->empty()) { - sys_log(2, " CTextFileLoader::GetTokenString - Failed to find the value %s [%s : %s]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); + SPDLOG_TRACE(" CTextFileLoader::GetTokenString - Failed to find the value {} [{} : {}]", m_strFileName.c_str(), m_pcurNode->strGroupName.c_str(), c_rstrKey.c_str()); return false; } diff --git a/src/game/src/threeway_war.cpp b/src/game/src/threeway_war.cpp index 2787e41..9cdabba 100644 --- a/src/game/src/threeway_war.cpp +++ b/src/game/src/threeway_war.cpp @@ -35,7 +35,7 @@ EVENTFUNC(regen_mob_event) if ( info == NULL ) { - sys_err( "regen_mob_event> Null pointer" ); + SPDLOG_ERROR("regen_mob_event> Null pointer" ); return 0; } @@ -93,7 +93,7 @@ int CThreeWayWar::GetKillScore( BYTE empire ) const { if( empire <= 0 || empire >= EMPIRE_MAX_NUM ) { - sys_err("ThreeWayWar::GetKillScore Wrong Empire variable"); + SPDLOG_ERROR("ThreeWayWar::GetKillScore Wrong Empire variable"); return 0; } @@ -104,7 +104,7 @@ void CThreeWayWar::SetKillScore( BYTE empire, int count ) { if( empire <= 0 || empire >= EMPIRE_MAX_NUM ) { - sys_err("ThreeWayWar::SetKillScore Wrong Empire variable"); + SPDLOG_ERROR("ThreeWayWar::SetKillScore Wrong Empire variable"); return; } @@ -144,7 +144,7 @@ bool CThreeWayWar::LoadSetting(const char* szFileName) if (NULL == pf) { - sys_err("[INIT_FORKED] Do not open file (%s)", szPath ); + SPDLOG_ERROR("[INIT_FORKED] Do not open file ({})", szPath ); return false; } diff --git a/src/game/src/trigger.cpp b/src/game/src/trigger.cpp index 059fccf..ceb1a51 100644 --- a/src/game/src/trigger.cpp +++ b/src/game/src/trigger.cpp @@ -28,7 +28,7 @@ void CHARACTER::AssignTriggers(const TMobTable * table) { if (table->bOnClickType >= ON_CLICK_MAX_NUM) { - sys_err("%s has invalid OnClick value %d", GetName(), table->bOnClickType); + SPDLOG_ERROR("{} has invalid OnClick value {}", GetName(), table->bOnClickType); abort(); } diff --git a/src/game/src/utils.cpp b/src/game/src/utils.cpp index f1e2c8f..12294a9 100644 --- a/src/game/src/utils.cpp +++ b/src/game/src/utils.cpp @@ -14,7 +14,7 @@ void set_global_time(time_t t) char time_str_buf[32]; snprintf(time_str_buf, sizeof(time_str_buf), "%s", time_str(get_global_time())); - sys_log(0, "GLOBAL_TIME: %s time_gap %d", time_str_buf, global_time_gap); + SPDLOG_INFO("GLOBAL_TIME: {} time_gap {}", time_str_buf, global_time_gap); } size_t str_lower(const char * src, char * dest, size_t dest_size) @@ -58,7 +58,7 @@ const char *one_argument(const char *argument, char *first_arg, size_t first_siz if (!argument || 0 == first_size) { - sys_err("one_argument received a NULL pointer!"); + SPDLOG_ERROR("one_argument received a NULL pointer!"); *first_arg = '\0'; return NULL; } diff --git a/src/game/src/war_map.cpp b/src/game/src/war_map.cpp index 81456a6..87cdb14 100644 --- a/src/game/src/war_map.cpp +++ b/src/game/src/war_map.cpp @@ -32,7 +32,7 @@ EVENTFUNC(war_begin_event) if ( info == NULL ) { - sys_err( "war_begin_event> Null pointer" ); + SPDLOG_ERROR("war_begin_event> Null pointer" ); return 0; } @@ -47,7 +47,7 @@ EVENTFUNC(war_end_event) if ( info == NULL ) { - sys_err( "war_end_event> Null pointer" ); + SPDLOG_ERROR("war_end_event> Null pointer" ); return 0; } @@ -73,7 +73,7 @@ EVENTFUNC(war_timeout_event) if ( info == NULL ) { - sys_err( "war_timeout_event> Null pointer" ); + SPDLOG_ERROR("war_timeout_event> Null pointer" ); return 0; } @@ -138,7 +138,7 @@ CWarMap::~CWarMap() event_cancel(&m_pkTimeoutEvent); event_cancel(&m_pkResetFlagEvent); - sys_log(0, "WarMap::~WarMap : map index %d", GetMapIndex()); + SPDLOG_DEBUG("WarMap::~WarMap : map index {}", GetMapIndex()); itertype(m_set_pkChr) it = m_set_pkChr.begin(); @@ -148,7 +148,7 @@ CWarMap::~CWarMap() if (ch->GetDesc()) { - sys_log(0, "WarMap::~WarMap : disconnecting %s", ch->GetName()); + SPDLOG_DEBUG("WarMap::~WarMap : disconnecting {}", ch->GetName()); DESC_MANAGER::instance().DestroyDesc(ch->GetDesc()); } } @@ -344,7 +344,7 @@ void CWarMap::IncMember(LPCHARACTER ch) if (!ch->IsPC()) return; - sys_log(0, "WarMap::IncMember"); + SPDLOG_DEBUG("WarMap::IncMember"); DWORD gid = 0; if (ch->GetGuild()) @@ -373,14 +373,14 @@ void CWarMap::IncMember(LPCHARACTER ch) event_cancel(&m_pkTimeoutEvent); - sys_log(0, "WarMap +m %u(cur:%d, acc:%d) vs %u(cur:%d, acc:%d)", + SPDLOG_DEBUG("WarMap +m {}(cur:{}, acc:{}) vs {}(cur:{}, acc:{})", m_TeamData[0].dwID, m_TeamData[0].GetCurJointerCount(), m_TeamData[0].GetAccumulatedJoinerCount(), m_TeamData[1].dwID, m_TeamData[1].GetCurJointerCount(), m_TeamData[1].GetAccumulatedJoinerCount()); } else { ++m_iObserverCount; - sys_log(0, "WarMap +o %d", m_iObserverCount); + SPDLOG_DEBUG("WarMap +o {}", m_iObserverCount); ch->SetObserverMode(true); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°üÀü ¸ðµå·Î ±æµåÀü¿¡ Âü°¡Çϼ̽À´Ï´Ù.")); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÚ½ÅÀ» ¼±ÅÃÇÏ½Ã¸é ¹ÛÀ¸·Î ³ª°¥ ¼ö ÀÖ´Â <°ü¶÷ Á¾·á> ¹öÆ°ÀÌ ³ª¿É´Ï´Ù.")); @@ -402,7 +402,7 @@ void CWarMap::DecMember(LPCHARACTER ch) if (!ch->IsPC()) return; - sys_log(0, "WarMap::DecMember"); + SPDLOG_DEBUG("WarMap::DecMember"); DWORD gid = 0; if (ch->GetGuild()) @@ -430,7 +430,7 @@ void CWarMap::DecMember(LPCHARACTER ch) } } - sys_log(0, "WarMap -m %u(cur:%d, acc:%d) vs %u(cur:%d, acc:%d)", + SPDLOG_DEBUG("WarMap -m {}(cur:{}, acc:{}) vs {}(cur:{}, acc:{})", m_TeamData[0].dwID, m_TeamData[0].GetCurJointerCount(), m_TeamData[0].GetAccumulatedJoinerCount(), m_TeamData[1].dwID, m_TeamData[1].GetCurJointerCount(), m_TeamData[1].GetAccumulatedJoinerCount()); @@ -441,7 +441,7 @@ void CWarMap::DecMember(LPCHARACTER ch) { --m_iObserverCount; - sys_log(0, "WarMap -o %d", m_iObserverCount); + SPDLOG_DEBUG("WarMap -o {}", m_iObserverCount); ch->SetObserverMode(false); } @@ -483,7 +483,7 @@ void CWarMap::CheckWarEnd() Notice(LC_TEXT("±æµåÀü¿¡ Âü°¡ÇÑ »ó´ë¹æ ±æµå¿øÀÌ ¾Æ¹«µµ ¾ø½À´Ï´Ù.")); Notice(LC_TEXT("1ºÐ À̳»¿¡ ¾Æ¹«µµ Á¢¼ÓÇÏÁö ¾ÊÀ¸¸é ±æµåÀüÀÌ ÀÚµ¿ Á¾·áµË´Ï´Ù.")); - sys_log(0, "CheckWarEnd: Timeout begin %u vs %u", m_TeamData[0].dwID, m_TeamData[1].dwID); + SPDLOG_DEBUG("CheckWarEnd: Timeout begin {} vs {}", m_TeamData[0].dwID, m_TeamData[1].dwID); war_map_info* info = AllocEventInfo(); info->pWarMap = this; @@ -551,7 +551,7 @@ void CWarMap::Timeout() dwLoser = m_TeamData[0].dwID; } - sys_err("WarMap: member count is not zero, guild1 %u %d guild2 %u %d, winner %u", + SPDLOG_ERROR("WarMap: member count is not zero, guild1 {} {} guild2 {} {}, winner {}", m_TeamData[0].dwID, m_TeamData[0].iMemberCount, m_TeamData[1].dwID, m_TeamData[1].iMemberCount, dwWinner); @@ -565,7 +565,7 @@ void CWarMap::Timeout() } } - sys_log(0, "WarMap: Timeout %u %u winner %u loser %u reward %d map %d", + SPDLOG_DEBUG("WarMap: Timeout {} {} winner {} loser {} reward {} map {}", m_TeamData[0].dwID, m_TeamData[1].dwID, dwWinner, dwLoser, iRewardGold, m_kMapInfo.lMapIndex); if (dwWinner) @@ -723,7 +723,7 @@ bool CWarMap::CheckScore() else if (dwWinner == m_TeamData[1].dwID) iRewardGold = GetRewardGold(1); - sys_log(0, "WarMap::CheckScore end score %d guild1 %u score guild2 %d %u score %d winner %u reward %d", + SPDLOG_DEBUG("WarMap::CheckScore end score {} guild1 {} score guild2 {} {} score {} winner {} reward {}", iEndScore, m_TeamData[0].dwID, m_TeamData[0].iScore, @@ -738,7 +738,7 @@ bool CWarMap::CheckScore() bool CWarMap::SetEnded() { - sys_log(0, "WarMap::SetEnded %d", m_kMapInfo.lMapIndex); + SPDLOG_DEBUG("WarMap::SetEnded {}", m_kMapInfo.lMapIndex); if (m_pkEndEvent) return false; @@ -794,7 +794,7 @@ void CWarMap::OnKill(LPCHARACTER killer, LPCHARACTER ch) BYTE idx; - sys_log(0, "WarMap::OnKill %u %u", dwKillerGuild, dwDeadGuild); + SPDLOG_DEBUG("WarMap::OnKill {} {}", dwKillerGuild, dwDeadGuild); if (!GetTeamIndex(dwKillerGuild, idx)) return; @@ -823,7 +823,7 @@ void CWarMap::OnKill(LPCHARACTER killer, LPCHARACTER ch) break; default: - sys_err("unknown war map type %u index %d", m_kMapInfo.bType, m_kMapInfo.lMapIndex); + SPDLOG_ERROR("unknown war map type {} index {}", m_kMapInfo.bType, m_kMapInfo.lMapIndex); break; } } @@ -847,7 +847,7 @@ void CWarMap::AddFlagBase(BYTE bIdx, DWORD x, DWORD y) } r.pkChrFlagBase = CHARACTER_MANAGER::instance().SpawnMob(warmap::WAR_FLAG_BASE_VNUM, m_kMapInfo.lMapIndex, x, y, 0); - sys_log(0, "WarMap::AddFlagBase %u %p id %u", bIdx, get_pointer(r.pkChrFlagBase), r.dwID); + SPDLOG_DEBUG("WarMap::AddFlagBase {} {} id {}", bIdx, (void*) get_pointer(r.pkChrFlagBase), r.dwID); r.pkChrFlagBase->SetPoint(POINT_STAT, r.dwID); r.pkChrFlagBase->SetWarMap(this); @@ -872,7 +872,7 @@ void CWarMap::AddFlag(BYTE bIdx, DWORD x, DWORD y) } r.pkChrFlag = CHARACTER_MANAGER::instance().SpawnMob(bIdx == 0 ? warmap::WAR_FLAG_VNUM0 : warmap::WAR_FLAG_VNUM1, m_kMapInfo.lMapIndex, x, y, 0); - sys_log(0, "WarMap::AddFlag %u %p id %u", bIdx, get_pointer(r.pkChrFlag), r.dwID); + SPDLOG_DEBUG("WarMap::AddFlag {} {} id {}", bIdx, (void*) get_pointer(r.pkChrFlag), r.dwID); r.pkChrFlag->SetPoint(POINT_STAT, r.dwID); r.pkChrFlag->SetWarMap(this); @@ -887,7 +887,7 @@ void CWarMap::RemoveFlag(BYTE bIdx) if (!r.pkChrFlag) return; - sys_log(0, "WarMap::RemoveFlag %u %p", bIdx, get_pointer(r.pkChrFlag)); + SPDLOG_DEBUG("WarMap::RemoveFlag {} {}", bIdx, (void*) get_pointer(r.pkChrFlag)); r.pkChrFlag->Dead(NULL, true); r.pkChrFlag = NULL; @@ -916,7 +916,7 @@ EVENTFUNC(war_reset_flag_event) if ( info == NULL ) { - sys_err( "war_reset_flag_event> Null pointer" ); + SPDLOG_ERROR("war_reset_flag_event> Null pointer" ); return 0; } @@ -1024,13 +1024,13 @@ bool CWarMapManager::GetStartPosition(int lMapIndex, BYTE bIdx, PIXEL_POSITION & if (!pi) { - sys_log(0, "GetStartPosition FAILED [%d] WarMapInfoSize(%d)", lMapIndex, m_map_kWarMapInfo.size()); + SPDLOG_ERROR("GetStartPosition FAILED [{}] WarMapInfoSize({})", lMapIndex, m_map_kWarMapInfo.size()); itertype(m_map_kWarMapInfo) it; for (it = m_map_kWarMapInfo.begin(); it != m_map_kWarMapInfo.end(); ++it) { PIXEL_POSITION& cur=it->second->posStart[bIdx]; - sys_log(0, "WarMap[%d]=Pos(%d, %d)", it->first, cur.x, cur.y); + SPDLOG_ERROR("WarMap[{}]=Pos({}, {})", it->first, cur.x, cur.y); } return false; } @@ -1044,7 +1044,7 @@ int CWarMapManager::CreateWarMap(const TGuildWarInfo& guildWarInfo, DWORD dwGuil TWarMapInfo * pkInfo = GetWarMapInfo(guildWarInfo.lMapIndex); if (!pkInfo) { - sys_err("GuildWar.CreateWarMap.NOT_FOUND_MAPINFO[%d]", guildWarInfo.lMapIndex); + SPDLOG_ERROR("GuildWar.CreateWarMap.NOT_FOUND_MAPINFO[{}]", guildWarInfo.lMapIndex); return 0; } @@ -1075,7 +1075,7 @@ void CWarMapManager::DestroyWarMap(CWarMap* pMap) { int mapIdx = pMap->GetMapIndex(); - sys_log(0, "WarMap::DestroyWarMap : %d", mapIdx); + SPDLOG_DEBUG("WarMap::DestroyWarMap : {}", mapIdx); m_mapWarMap.erase(pMap->GetMapIndex()); M2_DELETE(pMap); diff --git a/src/game/src/wedding.cpp b/src/game/src/wedding.cpp index 7dc71c1..be15a3a 100644 --- a/src/game/src/wedding.cpp +++ b/src/game/src/wedding.cpp @@ -31,7 +31,7 @@ namespace marriage if ( info == NULL ) { - sys_err( "wedding_end_event> Null pointer" ); + SPDLOG_ERROR("wedding_end_event> Null pointer" ); return 0; } @@ -68,7 +68,7 @@ namespace marriage { if (m_pEndEvent) { - sys_err("WeddingMap::SetEnded - ALREADY EndEvent(m_pEndEvent=%x)", get_pointer(m_pEndEvent)); + SPDLOG_ERROR("WeddingMap::SetEnded - ALREADY EndEvent(m_pEndEvent={})", (void*) get_pointer(m_pEndEvent)); return; } @@ -140,7 +140,7 @@ namespace marriage { void operator() (LPCHARACTER ch) { - sys_log(0, "WeddingMap::DestroyAll: %s", ch->GetName()); + SPDLOG_DEBUG("WeddingMap::DestroyAll: {}", ch->GetName()); if (ch->GetDesc()) DESC_MANAGER::instance().DestroyDesc(ch->GetDesc()); @@ -151,7 +151,7 @@ namespace marriage void WeddingMap::DestroyAll() { - sys_log(0, "WeddingMap::DestroyAll: m_set_pkChr size %zu", m_set_pkChr.size()); + SPDLOG_DEBUG("WeddingMap::DestroyAll: m_set_pkChr size {}", m_set_pkChr.size()); FDestroyEveryone f; @@ -164,7 +164,6 @@ namespace marriage if (IsMember(ch) == true) return; - //sys_log(0, "WeddingMap: IncMember %s", ch->GetName()); m_set_pkChr.insert(ch); SendLocalEvent(ch); @@ -180,7 +179,6 @@ namespace marriage if (IsMember(ch) == false) return; - //sys_log(0, "WeddingMap: DecMember %s", ch->GetName()); m_set_pkChr.erase(ch); if (ch->GetLevel() < 10) @@ -312,7 +310,7 @@ namespace marriage if (!dwMapIndex) { - sys_err("CreateWeddingMap(pid1=%d, pid2=%d) / CreatePrivateMap(%d) FAILED", dwPID1, dwPID2, WEDDING_MAP_INDEX); + SPDLOG_ERROR("CreateWeddingMap(pid1={}, pid2={}) / CreatePrivateMap({}) FAILED", dwPID1, dwPID2, WEDDING_MAP_INDEX); return 0; } @@ -331,11 +329,11 @@ namespace marriage if (!regen_do(st_weddingMapRegenFileName.c_str(), dwMapIndex, pkSectreeMap->m_setting.iBaseX, pkSectreeMap->m_setting.iBaseY, NULL, true)) { - sys_err("CreateWeddingMap(pid1=%d, pid2=%d) / regen_do(fileName=%s, mapIndex=%d, basePos=(%d, %d)) FAILED", dwPID1, dwPID2, st_weddingMapRegenFileName.c_str(), dwMapIndex, pkSectreeMap->m_setting.iBaseX, pkSectreeMap->m_setting.iBaseY); + SPDLOG_ERROR("CreateWeddingMap(pid1={}, pid2={}) / regen_do(fileName={}, mapIndex={}, basePos=({}, {})) FAILED", dwPID1, dwPID2, st_weddingMapRegenFileName.c_str(), dwMapIndex, pkSectreeMap->m_setting.iBaseX, pkSectreeMap->m_setting.iBaseY); } else { - sys_log(0, "CreateWeddingMap(pid1=%d, pid2=%d) / regen_do(fileName=%s, mapIndex=%d, basePos=(%d, %d)) ok", dwPID1, dwPID2, st_weddingMapRegenFileName.c_str(), dwMapIndex, pkSectreeMap->m_setting.iBaseX, pkSectreeMap->m_setting.iBaseY); + SPDLOG_DEBUG("CreateWeddingMap(pid1={}, pid2={}) / regen_do(fileName={}, mapIndex={}, basePos=({}, {})) ok", dwPID1, dwPID2, st_weddingMapRegenFileName.c_str(), dwMapIndex, pkSectreeMap->m_setting.iBaseX, pkSectreeMap->m_setting.iBaseY); } // END_OF_LOCALE_SERVICE @@ -344,7 +342,7 @@ namespace marriage void WeddingManager::DestroyWeddingMap(WeddingMap* pMap) { - sys_log(0, "DestroyWeddingMap(index=%u)", pMap->GetMapIndex()); + SPDLOG_DEBUG("DestroyWeddingMap(index={})", pMap->GetMapIndex()); pMap->DestroyAll(); m_mapWedding.erase(pMap->GetMapIndex()); SECTREE_MANAGER::instance().DestroyPrivateMap(pMap->GetMapIndex()); @@ -370,7 +368,7 @@ namespace marriage if (!dwMapIndex) { - sys_err("cannot create wedding map for %u, %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot create wedding map for {}, {}", dwPID1, dwPID2); return; } diff --git a/src/game/src/xmas_event.cpp b/src/game/src/xmas_event.cpp index 8985db7..0fa73dd 100644 --- a/src/game/src/xmas_event.cpp +++ b/src/game/src/xmas_event.cpp @@ -118,7 +118,7 @@ namespace xmas if ( info == NULL ) { - sys_err( "spawn_santa_event> Null pointer" ); + SPDLOG_ERROR("spawn_santa_event> Null pointer" ); return 0; } @@ -134,7 +134,7 @@ namespace xmas if (CHARACTER_MANAGER::instance().SpawnMobRandomPosition(xmas::MOB_SANTA_VNUM, lMapIndex)) { - sys_log(0, "santa comes to town!"); + SPDLOG_DEBUG("santa comes to town!"); return 0; } @@ -148,7 +148,7 @@ namespace xmas iTimeGapSec /= 60; } - sys_log(0, "santa respawn time = %d", iTimeGapSec); + SPDLOG_DEBUG("santa respawn time = {}", iTimeGapSec); spawn_santa_info* info = AllocEventInfo(); info->lMapIndex = lMapIndex; @@ -184,7 +184,7 @@ namespace xmas PIXEL_POSITION posBase; if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(p->lMapIndex, posBase)) { - sys_err("cannot get map base position %d", p->lMapIndex); + SPDLOG_ERROR("cannot get map base position {}", p->lMapIndex); p++; continue; } From feac4c05981852b6b7678a6162420d1a72c493ab Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 7 Jan 2024 22:05:51 +0200 Subject: [PATCH 3/5] Applied changes on the db executable. Removed old logging functions. Various global changes. --- src/common/utils.h | 5 + src/db/CMakeLists.txt | 4 - src/db/src/AuctionManager.cpp | 42 +- src/db/src/BlockCountry.cpp | 14 +- src/db/src/Cache.cpp | 23 +- src/db/src/ClientManager.cpp | 652 ++++++++++++-------------- src/db/src/ClientManagerBoot.cpp | 114 ++--- src/db/src/ClientManagerEventFlag.cpp | 6 +- src/db/src/ClientManagerGuild.cpp | 40 +- src/db/src/ClientManagerLogin.cpp | 38 +- src/db/src/ClientManagerParty.cpp | 32 +- src/db/src/ClientManagerPlayer.cpp | 91 ++-- src/db/src/Config.cpp | 2 +- src/db/src/DBManager.cpp | 2 +- src/db/src/GuildManager.cpp | 126 ++--- src/db/src/HB.cpp | 6 +- src/db/src/ItemAwardManager.cpp | 6 +- src/db/src/ItemIDRangeManager.cpp | 8 +- src/db/src/ItemIDRangeManager.h | 14 +- src/db/src/LoginData.cpp | 4 +- src/db/src/Main.cpp | 58 +-- src/db/src/Marriage.cpp | 36 +- src/db/src/Monarch.cpp | 16 +- src/db/src/Peer.cpp | 24 +- src/db/src/PeerBase.cpp | 18 +- src/db/src/PrivManager.cpp | 12 +- src/db/src/ProtoReader.cpp | 12 +- src/db/src/stdafx.h | 2 - src/game/CMakeLists.txt | 4 - src/game/src/dragon_soul_table.cpp | 2 +- src/game/src/input_main.cpp | 2 +- src/game/src/item_manager.cpp | 19 +- src/game/src/main.cpp | 4 +- src/game/src/questmanager.cpp | 2 +- src/game/src/stdafx.h | 2 - src/libsql/src/CAsyncSQL.cpp | 54 +-- src/libsql/src/CStatement.cpp | 10 +- src/libthecore/CMakeLists.txt | 8 + src/libthecore/include/log.h | 45 +- src/libthecore/include/stdafx.h | 3 + src/libthecore/include/utils.h | 2 +- src/libthecore/src/buffer.cpp | 14 +- src/libthecore/src/heart.cpp | 12 +- src/libthecore/src/log.cpp | 436 +---------------- src/libthecore/src/main.cpp | 7 +- src/libthecore/src/utils.cpp | 14 +- 46 files changed, 748 insertions(+), 1299 deletions(-) diff --git a/src/common/utils.h b/src/common/utils.h index 9069c90..251b6fb 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -1,3 +1,6 @@ +#ifndef __INC_METIN2_UTILS_H__ +#define __INC_METIN2_UTILS_H__ + /*----- atoi function -----*/ inline bool str_to_number (bool& out, const char *in) { @@ -72,3 +75,5 @@ inline bool str_to_number (float& out, const char *in) } /*----- atoi function -----*/ + +#endif diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt index 9fe330f..f9d0bae 100644 --- a/src/db/CMakeLists.txt +++ b/src/db/CMakeLists.txt @@ -33,10 +33,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random) find_package(fmt CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -# spdlog -find_package(spdlog CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) - # # System-provided dependencies # diff --git a/src/db/src/AuctionManager.cpp b/src/db/src/AuctionManager.cpp index 699e3e8..a28bb3e 100644 --- a/src/db/src/AuctionManager.cpp +++ b/src/db/src/AuctionManager.cpp @@ -406,13 +406,13 @@ AuctionResult AuctionManager::EnrollInAuction(CItemCache* item_cache, TAuctionIt CItemCache* c = GetItemCache (item_info.item_id); if (c != NULL) { - sys_err ("item id : %d is already in AuctionManager", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in AuctionManager", item_info.item_id); return AUCTION_FAIL; } if (!Auction.InsertItemInfo (&item_info)) { - sys_err ("item id : %d is already in AuctionBoard", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in AuctionBoard", item_info.item_id); return AUCTION_FAIL; } @@ -429,19 +429,19 @@ AuctionResult AuctionManager::EnrollInSale(CItemCache* item_cache, TSaleItemInfo CItemCache* c = GetItemCache (item_info.item_id); if (c != NULL) { - sys_err ("item id : %d is already in AuctionManager", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in AuctionManager", item_info.item_id); return AUCTION_FAIL; } if (!Wish.GetItemInfoCache (WishBoard::Key (item_info.item_num, item_info.wisher_id))) { - sys_err ("item_num : %d, wisher_id : %d is not in wish auction.", item_info.item_num, item_info.wisher_id); + SPDLOG_ERROR("item_num : {}, wisher_id : {} is not in wish auction.", item_info.item_num, item_info.wisher_id); return AUCTION_FAIL; } if (!Sale.InsertItemInfo (&item_info)) { - sys_err ("item id : %d is already in SaleBoard", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in SaleBoard", item_info.item_id); return AUCTION_FAIL; } @@ -457,7 +457,7 @@ AuctionResult AuctionManager::EnrollInWish(TWishItemInfo &item_info) { if (!Wish.InsertItemInfo (&item_info)) { - sys_err ("wisher_id : %d, item_num : %d is already in WishBoard", item_info.offer_id, item_info.item_num); + SPDLOG_ERROR("wisher_id : {}, item_num : {} is already in WishBoard", item_info.offer_id, item_info.item_num); return AUCTION_FAIL; } @@ -469,7 +469,7 @@ AuctionResult AuctionManager::Bid(DWORD bidder_id, const char* bidder_name, DWOR CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } @@ -506,7 +506,7 @@ AuctionResult AuctionManager::Impur(DWORD purchaser_id, const char* purchaser_na CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } @@ -533,14 +533,14 @@ AuctionResult AuctionManager::GetAuctionedItem (DWORD actor_id, DWORD item_id, T CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } @@ -561,14 +561,14 @@ AuctionResult AuctionManager::BuySoldItem (DWORD actor_id, DWORD item_id, TPlaye CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } @@ -584,14 +584,14 @@ AuctionResult AuctionManager::CancelAuction (DWORD actor_id, DWORD item_id, TPla CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } TAuctionItemInfo* item_info = item_info_cache->Get(false); @@ -618,14 +618,14 @@ AuctionResult AuctionManager::CancelSale (DWORD actor_id, DWORD item_id, TPlayer CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } TSaleItemInfo* item_info = item_info_cache->Get(false); @@ -639,13 +639,13 @@ AuctionResult AuctionManager::DeleteAuctionItem (DWORD actor_id, DWORD item_id) { if (DeleteItemCache (item_id) == false) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } if (Auction.DeleteItemInfoCache (item_id) == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } return AUCTION_SUCCESS; @@ -655,13 +655,13 @@ AuctionResult AuctionManager::DeleteSaleItem (DWORD actor_id, DWORD item_id) { if (DeleteItemCache (item_id) == false) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } if (Sale.DeleteItemInfoCache (item_id) == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } return AUCTION_SUCCESS; @@ -672,7 +672,7 @@ AuctionResult AuctionManager::ReBid(DWORD bidder_id, const char* bidder_name, DW CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } diff --git a/src/db/src/BlockCountry.cpp b/src/db/src/BlockCountry.cpp index c28fdb6..bb69e80 100644 --- a/src/db/src/BlockCountry.cpp +++ b/src/db/src/BlockCountry.cpp @@ -50,7 +50,7 @@ bool CBlockCountry::Load() if (pMsg->Get()->uiNumRows == 0) { - sys_err(" DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR(" DirectQuery failed({})", szQuery); delete pMsg; return false; } @@ -64,7 +64,7 @@ bool CBlockCountry::Load() strlcpy(block_ip->country, row[2], sizeof(block_ip->country)); m_block_ip.push_back(block_ip); - sys_log(0, "BLOCKED_IP : %u - %u", block_ip->ip_from, block_ip->ip_to); + SPDLOG_DEBUG("BLOCKED_IP : {} - {}", block_ip->ip_from, block_ip->ip_to); } delete pMsg; @@ -79,7 +79,7 @@ bool CBlockCountry::Load() if (pMsg->Get()->uiNumRows == 0) { - sys_err(" DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR(" DirectQuery failed({})", szQuery); delete pMsg; return true; } @@ -91,7 +91,7 @@ bool CBlockCountry::Load() m_block_exception.push_back(strdup(login)); - sys_log(0, "BLOCK_EXCEPTION = %s", login); + SPDLOG_DEBUG("BLOCK_EXCEPTION = {}", login); } delete pMsg; @@ -129,7 +129,7 @@ bool CBlockCountry::IsBlockedCountryIp(const char *user_ip) void CBlockCountry::SendBlockedCountryIp(CPeer *peer) { - sys_log(0, "SendBlockedCountryIp start"); + SPDLOG_DEBUG("SendBlockedCountryIp start"); BLOCK_IP *block_ip; BLOCK_IP_VECTOR::iterator iter; TPacketBlockCountryIp packet; @@ -145,9 +145,9 @@ void CBlockCountry::SendBlockedCountryIp(CPeer *peer) peer->Encode(&packet, sizeof(packet)); } - sys_log(0, "[DONE] CBlockCountry::SendBlockedCountryIp() : count = %d", + SPDLOG_DEBUG("[DONE] CBlockCountry::SendBlockedCountryIp() : count = {}", m_block_ip.size()); - sys_log(0, "SendBlockedCountryIp end"); + SPDLOG_DEBUG("SendBlockedCountryIp end"); } /* end of CBlockCountry::SendBlockedCountryIp() */ diff --git a/src/db/src/Cache.cpp b/src/db/src/Cache.cpp index 5c6cd54..106afae 100644 --- a/src/db/src/Cache.cpp +++ b/src/db/src/Cache.cpp @@ -44,8 +44,7 @@ void CItemCache::Delete() //char szQuery[QUERY_MAX_LEN]; //szQuery[QUERY_MAX_LEN] = '\0'; - if (g_test_server) - sys_log(0, "ItemCache::Delete : DELETE %u", m_data.id); + SPDLOG_TRACE("ItemCache::Delete : DELETE {}", m_data.id); m_data.vnum = 0; m_bNeedQuery = true; @@ -64,8 +63,7 @@ void CItemCache::OnFlush() snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), m_data.id); CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL); - if (g_test_server) - sys_log(0, "ItemCache::Flush : DELETE %u %s", m_data.id, szQuery); + SPDLOG_TRACE("ItemCache::Flush : DELETE {} {}", m_data.id, szQuery); } else { @@ -141,8 +139,7 @@ void CItemCache::OnFlush() char szItemQuery[QUERY_MAX_LEN + QUERY_MAX_LEN + 100]; snprintf(szItemQuery, sizeof(szItemQuery), "REPLACE INTO item%s (%s) VALUES(%s)", GetTablePostfix(), szColumns, szValues); - if (g_test_server) - sys_log(0, "ItemCache::Flush :REPLACE (%s)", szItemQuery); + SPDLOG_TRACE("ItemCache::Flush :REPLACE ({})", szItemQuery); CDBManager::instance().ReturnQuery(szItemQuery, QID_ITEM_SAVE, 0, NULL); @@ -167,8 +164,7 @@ CPlayerTableCache::~CPlayerTableCache() void CPlayerTableCache::OnFlush() { - if (g_test_server) - sys_log(0, "PlayerTableCache::Flush : %s", m_data.name); + SPDLOG_TRACE("PlayerTableCache::Flush : {}", m_data.name); char szQuery[QUERY_MAX_LEN]; CreatePlayerSaveQuery(szQuery, sizeof(szQuery), &m_data); @@ -211,7 +207,7 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList if (pUpdateList->byCount > SHOP_PRICELIST_MAX_NUM) { - sys_err("Count overflow!"); + SPDLOG_ERROR("Count overflow!"); return; } @@ -238,8 +234,8 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList m_bNeedQuery = true; - sys_log(0, - "ItemPriceListTableCache::UpdateList : OwnerID[%u] Update [%u] Items, Delete [%u] Items, Total [%u] Items", + SPDLOG_DEBUG( + "ItemPriceListTableCache::UpdateList : OwnerID[{}] Update [{}] Items, Delete [{}] Items, Total [{}] Items", m_data.dwOwnerID, pUpdateList->byCount, nDeletedNum, m_data.byCount); } @@ -266,7 +262,7 @@ void CItemPriceListTableCache::OnFlush() CDBManager::instance().ReturnQuery(szQuery, QID_ITEMPRICE_SAVE, 0, NULL); } - sys_log(0, "ItemPriceListTableCache::Flush : OwnerID[%u] Update [%u]Items", m_data.dwOwnerID, m_data.byCount); + SPDLOG_DEBUG("ItemPriceListTableCache::Flush : OwnerID[{}] Update [{}]Items", m_data.dwOwnerID, m_data.byCount); m_bNeedQuery = false; } @@ -287,8 +283,7 @@ void CAuctionItemInfoCache::Delete() if (m_data.item_num == 0) return; - if (g_test_server) - sys_log(0, "CAuctionItemInfoCache::Delete : DELETE %u", m_data.item_id); + SPDLOG_TRACE("CAuctionItemInfoCache::Delete : DELETE {}", m_data.item_id); m_data.item_num = 0; m_bNeedQuery = true; diff --git a/src/db/src/ClientManager.cpp b/src/db/src/ClientManager.cpp index b0a8ce7..45d4c51 100644 --- a/src/db/src/ClientManager.cpp +++ b/src/db/src/ClientManager.cpp @@ -26,7 +26,6 @@ extern int g_iPlayerCacheFlushSeconds; extern int g_iItemCacheFlushSeconds; extern int g_test_server; -extern int g_log; extern std::string g_stLocale; extern std::string g_stLocaleNameColumn; bool CreateItemTableFromRes(MYSQL_RES * res, std::vector * pVec, DWORD dwPID); @@ -67,18 +66,16 @@ static void AcceptConnection( static void AcceptError(evconnlistener *listener, void *ctx) { struct event_base *base = evconnlistener_get_base(listener); int err = EVUTIL_SOCKET_ERROR(); - fprintf(stderr, "Got an error %d (%s) on the listener. " - "Shutting down.\n", err, evutil_socket_error_to_string(err)); + SPDLOG_CRITICAL("Got an error {} ({}) on the listener. Shutting down.", err, evutil_socket_error_to_string(err)); - event_base_loopexit(base, NULL); + event_base_loopexit(base, nullptr); } static void DescReadHandler(bufferevent *bev, void *ctx) { auto* peer = (CPeer*) ctx; if (peer == CClientManager::Instance().GetAuthPeer()) - if (g_log) - sys_log(0, "AUTH_PEER_READ: size %d", peer->GetRecvLength()); + SPDLOG_TRACE("AUTH_PEER_READ: size {}", peer->GetRecvLength()); CClientManager::Instance().ProcessPackets(peer); } @@ -87,18 +84,17 @@ static void DescWriteHandler(bufferevent *bev, void *ctx) { auto* peer = (CPeer*) ctx; if (peer == CClientManager::Instance().GetAuthPeer()) - if (g_log) - sys_log(0, "AUTH_PEER_WRITE: size %d", peer->GetSendLength()); + SPDLOG_TRACE("AUTH_PEER_WRITE: size {}", peer->GetSendLength()); } static void DescEventHandler(bufferevent *bev, short events, void *ctx) { auto* peer = (CPeer*) ctx; if (events & BEV_EVENT_ERROR) - sys_err("PEER libevent error, handle: %d", peer->GetHandle()); + SPDLOG_ERROR("PEER libevent error, handle: {}", peer->GetHandle()); if (events & BEV_EVENT_EOF) - sys_log(0, "PEER disconnected: handle %d", peer->GetHandle()); + SPDLOG_DEBUG("PEER disconnected: handle {}", peer->GetHandle()); // Either the socket was closed or an error occured, therefore we can disconnect this peer. if (events & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) @@ -164,7 +160,7 @@ bool CClientManager::Initialize() //BOOT_LOCALIZATION if (!InitializeLocalization()) { - fprintf(stderr, "Failed Localization Infomation so exit\n"); + SPDLOG_ERROR("Failed Localization Infomation so exit"); return false; } @@ -173,14 +169,14 @@ bool CClientManager::Initialize() if (!InitializeNowItemID()) { - fprintf(stderr, " Item range Initialize Failed. Exit DBCache Server\n"); + SPDLOG_ERROR(" Item range Initialize Failed. Exit DBCache Server"); return false; } //END_ITEM_UNIQUE_ID if (!InitializeTables()) { - sys_err("Table Initialize FAILED"); + SPDLOG_ERROR("Table Initialize FAILED"); return false; } @@ -197,7 +193,7 @@ bool CClientManager::Initialize() // Create a new libevent base and listen for new connections m_base = event_base_new(); if (!m_base) { - sys_err("Libevent base initialization FAILED!"); + SPDLOG_ERROR("Libevent base initialization FAILED!"); return false; } @@ -216,7 +212,7 @@ bool CClientManager::Initialize() (const sockaddr*)&sin, sizeof(sin) ); if (!m_listener) { - sys_err("Libevent listener initialization FAILED!"); + SPDLOG_ERROR("Libevent listener initialization FAILED!"); return false; } evconnlistener_set_error_cb(m_listener, AcceptError); @@ -228,7 +224,7 @@ bool CClientManager::Initialize() if (!CConfig::instance().GetValue("PLAYER_DELETE_LEVEL_LIMIT", &m_iPlayerDeleteLevelLimit)) { - sys_err("conf.txt: Cannot find PLAYER_DELETE_LEVEL_LIMIT, use default level %d", PLAYER_MAX_LEVEL_CONST + 1); + SPDLOG_ERROR("conf.txt: Cannot find PLAYER_DELETE_LEVEL_LIMIT, use default level {}", PLAYER_MAX_LEVEL_CONST + 1); m_iPlayerDeleteLevelLimit = PLAYER_MAX_LEVEL_CONST + 1; } @@ -237,8 +233,8 @@ bool CClientManager::Initialize() m_iPlayerDeleteLevelLimitLower = 0; } - sys_log(0, "PLAYER_DELETE_LEVEL_LIMIT set to %d", m_iPlayerDeleteLevelLimit); - sys_log(0, "PLAYER_DELETE_LEVEL_LIMIT_LOWER set to %d", m_iPlayerDeleteLevelLimitLower); + SPDLOG_DEBUG("PLAYER_DELETE_LEVEL_LIMIT set to {}", m_iPlayerDeleteLevelLimit); + SPDLOG_DEBUG("PLAYER_DELETE_LEVEL_LIMIT_LOWER set to {}", m_iPlayerDeleteLevelLimitLower); m_bChinaEventServer = false; @@ -247,7 +243,7 @@ bool CClientManager::Initialize() if (CConfig::instance().GetValue("CHINA_EVENT_SERVER", &iChinaEventServer)) m_bChinaEventServer = (iChinaEventServer); - sys_log(0, "CHINA_EVENT_SERVER %s", CClientManager::instance().IsChinaEventServer()?"true":"false"); + SPDLOG_DEBUG("CHINA_EVENT_SERVER {}", CClientManager::instance().IsChinaEventServer()?"true":"false"); LoadEventFlag(); @@ -263,7 +259,7 @@ void CClientManager::MainLoop() { SQLMsg * tmp; - sys_log(0, "ClientManager pointer is %p", this); + SPDLOG_DEBUG("ClientManager pointer is {}", (void*) this); // ¸ÞÀηçÇÁ while (!m_bShutdowned) @@ -276,14 +272,12 @@ void CClientManager::MainLoop() if (!Process()) break; - - log_rotate(); - } + } // // ¸ÞÀηçÇÁ Á¾·áó¸® // - sys_log(0, "MainLoop exited, Starting cache flushing"); + SPDLOG_DEBUG("MainLoop exited, Starting cache flushing"); signal_timer_disable(); @@ -341,7 +335,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) __GetHostInfo(vHost); __GetAdminInfo(p->szIP, vAdmin); - sys_log(0, "QUERY_BOOT : AdminInfo (Request ServerIp %s) ", p->szIP); + SPDLOG_DEBUG("QUERY_BOOT : AdminInfo (Request ServerIp {}) ", p->szIP); DWORD dwPacketSize = sizeof(DWORD) + @@ -378,24 +372,24 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) peer->Encode(&dwPacketSize, sizeof(DWORD)); peer->Encode(&bPacketVersion, sizeof(BYTE)); - sys_log(0, "BOOT: PACKET: %d", dwPacketSize); - sys_log(0, "BOOT: VERSION: %d", bPacketVersion); + SPDLOG_DEBUG("BOOT: PACKET: {}", dwPacketSize); + SPDLOG_DEBUG("BOOT: VERSION: {}", bPacketVersion); - sys_log(0, "sizeof(TMobTable) = %d", sizeof(TMobTable)); - sys_log(0, "sizeof(TItemTable) = %d", sizeof(TItemTable)); - sys_log(0, "sizeof(TShopTable) = %d", sizeof(TShopTable)); - sys_log(0, "sizeof(TSkillTable) = %d", sizeof(TSkillTable)); - sys_log(0, "sizeof(TRefineTable) = %d", sizeof(TRefineTable)); - sys_log(0, "sizeof(TItemAttrTable) = %d", sizeof(TItemAttrTable)); - sys_log(0, "sizeof(TItemRareTable) = %d", sizeof(TItemAttrTable)); - sys_log(0, "sizeof(TBanwordTable) = %d", sizeof(TBanwordTable)); - sys_log(0, "sizeof(TLand) = %d", sizeof(building::TLand)); - sys_log(0, "sizeof(TObjectProto) = %d", sizeof(building::TObjectProto)); - sys_log(0, "sizeof(TObject) = %d", sizeof(building::TObject)); + SPDLOG_DEBUG("sizeof(TMobTable) = {}", sizeof(TMobTable)); + SPDLOG_DEBUG("sizeof(TItemTable) = {}", sizeof(TItemTable)); + SPDLOG_DEBUG("sizeof(TShopTable) = {}", sizeof(TShopTable)); + SPDLOG_DEBUG("sizeof(TSkillTable) = {}", sizeof(TSkillTable)); + SPDLOG_DEBUG("sizeof(TRefineTable) = {}", sizeof(TRefineTable)); + SPDLOG_DEBUG("sizeof(TItemAttrTable) = {}", sizeof(TItemAttrTable)); + SPDLOG_DEBUG("sizeof(TItemRareTable) = {}", sizeof(TItemAttrTable)); + SPDLOG_DEBUG("sizeof(TBanwordTable) = {}", sizeof(TBanwordTable)); + SPDLOG_DEBUG("sizeof(TLand) = {}", sizeof(building::TLand)); + SPDLOG_DEBUG("sizeof(TObjectProto) = {}", sizeof(building::TObjectProto)); + SPDLOG_DEBUG("sizeof(TObject) = {}", sizeof(building::TObject)); //ADMIN_MANAGER - sys_log(0, "sizeof(tAdminInfo) = %d * %d ", sizeof(tAdminInfo) * vAdmin.size()); + SPDLOG_DEBUG("sizeof(tAdminInfo) = {} * {} ", sizeof(tAdminInfo) * vAdmin.size()); //END_ADMIN_MANAGER - sys_log(0, "sizeof(TMonarchInfo) = %d * %d", sizeof(TMonarchInfo)); + SPDLOG_DEBUG("sizeof(TMonarchInfo) = {} * {}", sizeof(TMonarchInfo)); peer->EncodeWORD(sizeof(TMobTable)); peer->EncodeWORD(m_vec_mobTable.size()); @@ -470,7 +464,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) for (size_t n = 0; n < vHost.size(); ++n) { peer->Encode(vHost[n].c_str(), 16); - sys_log(0, "GMHosts %s", vHost[n].c_str()); + SPDLOG_DEBUG("GMHosts {}", vHost[n].c_str()); } peer->EncodeWORD(sizeof(tAdminInfo)); @@ -479,7 +473,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) for (size_t n = 0; n < vAdmin.size(); ++n) { peer->Encode(&vAdmin[n], sizeof(tAdminInfo)); - sys_log(0, "Admin name %s ConntactIP %s", vAdmin[n].m_szName, vAdmin[n].m_szContactIP); + SPDLOG_DEBUG("Admin name {} ConntactIP {}", vAdmin[n].m_szName, vAdmin[n].m_szContactIP); } //END_ADMIN_MANAGER @@ -498,8 +492,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) } //END_MONARCE - if (g_test_server) - sys_log(0, "MONARCHCandidacy Size %d", CMonarch::instance().MonarchCandidacySize()); + SPDLOG_TRACE("MONARCHCandidacy Size {}", CMonarch::instance().MonarchCandidacySize()); peer->EncodeWORD(0xffff); } @@ -510,13 +503,13 @@ void CClientManager::SendPartyOnSetup(CPeer* pkPeer) for (itertype(pm) it_party = pm.begin(); it_party != pm.end(); ++it_party) { - sys_log(0, "PARTY SendPartyOnSetup Party [%u]", it_party->first); + SPDLOG_DEBUG("PARTY SendPartyOnSetup Party [{}]", it_party->first); pkPeer->EncodeHeader(HEADER_DG_PARTY_CREATE, 0, sizeof(TPacketPartyCreate)); pkPeer->Encode(&it_party->first, sizeof(DWORD)); for (itertype(it_party->second) it_member = it_party->second.begin(); it_member != it_party->second.end(); ++it_member) { - sys_log(0, "PARTY SendPartyOnSetup Party [%u] Member [%u]", it_party->first, it_member->first); + SPDLOG_DEBUG("PARTY SendPartyOnSetup Party [{}] Member [{}]", it_party->first, it_member->first); pkPeer->EncodeHeader(HEADER_DG_PARTY_ADD, 0, sizeof(TPacketPartyAdd)); pkPeer->Encode(&it_party->first, sizeof(DWORD)); pkPeer->Encode(&it_member->first, sizeof(DWORD)); @@ -539,7 +532,7 @@ void CClientManager::QUERY_QUEST_SAVE(CPeer * pkPeer, TQuestTable * pTable, DWOR { if (0 != (dwLen % sizeof(TQuestTable))) { - sys_err("invalid packet size %d, sizeof(TQuestTable) == %d", dwLen, sizeof(TQuestTable)); + SPDLOG_ERROR("invalid packet size {}, sizeof(TQuestTable) == {}", dwLen, sizeof(TQuestTable)); return; } @@ -579,9 +572,8 @@ void CClientManager::QUERY_SAFEBOX_LOAD(CPeer * pkPeer, DWORD dwHandle, TSafebox snprintf(szQuery, sizeof(szQuery), "SELECT account_id, size, password FROM safebox%s WHERE account_id=%u", GetTablePostfix(), packet->dwID); - - if (g_log) - sys_log(0, "HEADER_GD_SAFEBOX_LOAD (handle: %d account.id %u is_mall %d)", dwHandle, packet->dwID, bMall ? 1 : 0); + + SPDLOG_TRACE("HEADER_GD_SAFEBOX_LOAD (handle: {} account.id {} is_mall {})", dwHandle, packet->dwID, bMall ? 1 : 0); CDBManager::instance().ReturnQuery(szQuery, QID_SAFEBOX_LOAD, pkPeer->GetHandle(), pi); } @@ -646,10 +638,10 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (pi->ip[0] == 1) { pSafebox->bSize = 1; - sys_log(0, "MALL id[%d] size[%d]", pSafebox->dwID, pSafebox->bSize); + SPDLOG_DEBUG("MALL id[{}] size[{}]", pSafebox->dwID, pSafebox->bSize); } else - sys_log(0, "SAFEBOX id[%d] size[%d]", pSafebox->dwID, pSafebox->bSize); + SPDLOG_DEBUG("SAFEBOX id[{}] size[{}]", pSafebox->dwID, pSafebox->bSize); } if (0 == pSafebox->dwID) @@ -679,7 +671,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (!pi->pSafebox) { - sys_err("null safebox pointer!"); + SPDLOG_ERROR("null safebox pointer!"); delete pi; return; } @@ -689,7 +681,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) // º¸À̱⠶§¹®¿¡ â°í°¡ ¾Æ¾ê ¾È¿­¸®´Â°Ô ³ªÀ½ if (!msg->Get()->pSQLResult) { - sys_err("null safebox result"); + SPDLOG_ERROR("null safebox result"); delete pi; return; } @@ -714,7 +706,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (it == m_map_itemTableByVnum.end()) { bEscape = true; - sys_err("invalid item vnum %u in safebox: login %s", r.vnum, pi->login); + SPDLOG_ERROR("invalid item vnum {} in safebox: login {}", r.vnum, pi->login); break; } @@ -747,7 +739,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (it == m_map_itemTableByVnum.end()) { - sys_err("invalid item vnum %u in item_award: login %s", pItemAward->dwVnum, pi->login); + SPDLOG_ERROR("invalid item vnum {} in item_award: login {}", pItemAward->dwVnum, pi->login); continue; } @@ -813,7 +805,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (GetItemID () > m_itemRange.dwMax) { - sys_err("UNIQUE ID OVERFLOW!!"); + SPDLOG_ERROR("UNIQUE ID OVERFLOW!!"); break; } @@ -821,13 +813,13 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) itertype(m_map_itemTableByVnum) it = m_map_itemTableByVnum.find (dwItemVnum); if (it == m_map_itemTableByVnum.end()) { - sys_err ("Invalid item(vnum : %d). It is not in m_map_itemTableByVnum.", dwItemVnum); + SPDLOG_ERROR("Invalid item(vnum : {}). It is not in m_map_itemTableByVnum.", dwItemVnum); continue; } TItemTable* item_table = it->second; if (item_table == NULL) { - sys_err ("Invalid item_table (vnum : %d). It's value is NULL in m_map_itemTableByVnum.", dwItemVnum); + SPDLOG_ERROR("Invalid item_table (vnum : {}). It's value is NULL in m_map_itemTableByVnum.", dwItemVnum); continue; } if (0 == pItemAward->dwSocket0) @@ -868,7 +860,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) std::unique_ptr pmsg(CDBManager::instance().DirectQuery(szQuery)); SQLResult * pRes = pmsg->Get(); - sys_log(0, "SAFEBOX Query : [%s]", szQuery); + SPDLOG_DEBUG("SAFEBOX Query : [{}]", szQuery); if (pRes->uiAffectedRows == 0 || pRes->uiInsertID == 0 || pRes->uiAffectedRows == (uint32_t)-1) break; @@ -1029,7 +1021,7 @@ void CClientManager::RESULT_PRICELIST_LOAD(CPeer* peer, SQLMsg* pMsg) peer->Encode(&header, sizeof(header)); peer->Encode(table.aPriceInfo, sizePriceListSize); - sys_log(0, "Load MyShopPricelist handle[%d] pid[%d] count[%d]", pReqInfo->first, pReqInfo->second, header.byCount); + SPDLOG_DEBUG("Load MyShopPricelist handle[{}] pid[{}] count[{}]", pReqInfo->first, pReqInfo->second, header.byCount); delete pReqInfo; } @@ -1082,7 +1074,7 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE id=%u", GetTablePostfix(), p->bEmpire, p->dwAccountID); delete CDBManager::instance().DirectQuery(szQuery); - sys_log(0, "EmpireSelect: %s", szQuery); + SPDLOG_DEBUG("EmpireSelect: {}", szQuery); { snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4 FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID); @@ -1093,7 +1085,7 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire if (pRes->uiNumRows) { - sys_log(0, "EMPIRE %lu", pRes->uiNumRows); + SPDLOG_DEBUG("EMPIRE {}", pRes->uiNumRows); MYSQL_ROW row = mysql_fetch_row(pRes->pSQLResult); DWORD pids[3]; @@ -1118,11 +1110,11 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire for (int i = 0; i < 3; ++i) { str_to_number(pids[i], row[i]); - sys_log(0, "EMPIRE PIDS[%d]", pids[i]); + SPDLOG_DEBUG("EMPIRE PIDS[{}]", pids[i]); if (pids[i]) { - sys_log(0, "EMPIRE move to pid[%d] to villiage of %u, map_index %d", + SPDLOG_DEBUG("EMPIRE move to pid[{}] to villiage of {}, map_index {}", pids[i], p->bEmpire, g_start_map[p->bEmpire]); snprintf(szQuery, sizeof(szQuery), "UPDATE player%s SET map_index=%u,x=%u,y=%u WHERE id=%u", @@ -1149,7 +1141,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD if (p->bAuthServer) { - sys_log(0, "AUTH_PEER ptr %p", peer); + SPDLOG_DEBUG("AUTH_PEER ptr {}", (void*) peer); m_pkAuthPeer = peer; SendAllLoginToBilling(); @@ -1272,7 +1264,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD // // ¼Â¾÷ : Á¢¼ÓÇÑ ÇǾ ´Ù¸¥ ÇǾîµéÀÌ Á¢¼ÓÇÏ°Ô ¸¸µç´Ù. (P2P ÄÁ³Ø¼Ç »ý¼º) // - sys_log(0, "SETUP: channel %u listen %u p2p %u count %u", peer->GetChannel(), p->wListenPort, p->wP2PPort, bMapCount); + SPDLOG_DEBUG("SETUP: channel {} listen {} p2p {} count {}", peer->GetChannel(), p->wListenPort, p->wP2PPort, bMapCount); TPacketDGP2P p2pSetupPacket; p2pSetupPacket.wPort = peer->GetP2PPort(); @@ -1319,7 +1311,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD if (InsertLogonAccount(pck->szLogin, peer->GetHandle(), pck->szHost)) { - sys_log(0, "SETUP: login %u %s login_key %u host %s", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost); + SPDLOG_DEBUG("SETUP: login {} {} login_key {} host {}", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost); pkLD->SetPlay(true); if (m_pkAuthPeer) @@ -1332,12 +1324,12 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD } } else - sys_log(0, "SETUP: login_fail %u %s login_key %u", pck->dwID, pck->szLogin, pck->dwLoginKey); + SPDLOG_DEBUG("SETUP: login_fail {} {} login_key {}", pck->dwID, pck->szLogin, pck->dwLoginKey); } if (m_pkAuthPeer && !vec_repair.empty()) { - sys_log(0, "REPAIR size %d", vec_repair.size()); + 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()); @@ -1355,8 +1347,7 @@ void CClientManager::QUERY_ITEM_FLUSH(CPeer * pkPeer, const char * c_pData) { DWORD dwID = *(DWORD *) c_pData; - if (g_log) - sys_log(0, "HEADER_GD_ITEM_FLUSH: %u", dwID); + SPDLOG_TRACE("HEADER_GD_ITEM_FLUSH: {}", dwID); CItemCache * c = GetItemCache(dwID); @@ -1381,8 +1372,7 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData) if (it != m_map_pkItemCacheSetPtr.end()) { - if (g_test_server) - sys_log(0, "ITEM_CACHE: safebox owner %u id %u", c->Get()->owner, c->Get()->id); + SPDLOG_TRACE("ITEM_CACHE: safebox owner {} id {}", c->Get()->owner, c->Get()->id); it->second->erase(c); } @@ -1426,14 +1416,13 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData) #ifdef __AUCTION__ else if (p->window == AUCTION) { - sys_err("invalid window. how can you enter this route?"); + SPDLOG_ERROR("invalid window. how can you enter this route?"); return ; } #endif else { - if (g_test_server) - sys_log(0, "QUERY_ITEM_SAVE => PutItemCache() owner %d id %d vnum %d ", p->owner, p->id, p->vnum); + SPDLOG_TRACE("QUERY_ITEM_SAVE => PutItemCache() owner {} id {} vnum {} ", p->owner, p->id, p->vnum); PutItemCache(p); } @@ -1457,8 +1446,7 @@ void CClientManager::CreateItemCacheSet(DWORD pid) TItemCacheSet * pSet = new TItemCacheSet; m_map_pkItemCacheSetPtr.insert(TItemCacheSetPtrMap::value_type(pid, pSet)); - if (g_log) - sys_log(0, "ITEM_CACHE: new cache %u", pid); + SPDLOG_TRACE("ITEM_CACHE: new cache {}", pid); } void CClientManager::FlushItemCacheSet(DWORD pid) @@ -1467,7 +1455,7 @@ void CClientManager::FlushItemCacheSet(DWORD pid) if (it == m_map_pkItemCacheSetPtr.end()) { - sys_log(0, "FLUSH_ITEMCACHESET : No ItemCacheSet pid(%d)", pid); + SPDLOG_DEBUG("FLUSH_ITEMCACHESET : No ItemCacheSet pid({})", pid); return; } @@ -1488,8 +1476,7 @@ void CClientManager::FlushItemCacheSet(DWORD pid) m_map_pkItemCacheSetPtr.erase(it); - if (g_log) - sys_log(0, "FLUSH_ITEMCACHESET : Deleted pid(%d)", pid); + SPDLOG_TRACE("FLUSH_ITEMCACHESET : Deleted pid({})", pid); } CItemCache * CClientManager::GetItemCache(DWORD id) @@ -1511,8 +1498,7 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) // ¾ÆÀÌÅÛ »õ·Î »ý¼º if (!c) { - if (g_log) - sys_log(0, "ITEM_CACHE: PutItemCache ==> New CItemCache id%d vnum%d new owner%d", pNew->id, pNew->vnum, pNew->owner); + SPDLOG_TRACE("ITEM_CACHE: PutItemCache ==> New CItemCache id{} vnum{} new owner{}", pNew->id, pNew->vnum, pNew->owner); c = new CItemCache; m_map_itemCache.insert(TItemCacheMap::value_type(pNew->id, c)); @@ -1520,8 +1506,8 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) // ÀÖÀ»½Ã else { - if (g_log) - sys_log(0, "ITEM_CACHE: PutItemCache ==> Have Cache"); + SPDLOG_TRACE("ITEM_CACHE: PutItemCache ==> Have Cache"); + // ¼ÒÀ¯ÀÚ°¡ Ʋ¸®¸é if (pNew->owner != c->Get()->owner) { @@ -1530,8 +1516,7 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) if (it != m_map_pkItemCacheSetPtr.end()) { - if (g_log) - sys_log(0, "ITEM_CACHE: delete owner %u id %u new owner %u", c->Get()->owner, c->Get()->id, pNew->owner); + SPDLOG_TRACE("ITEM_CACHE: delete owner {} id {} new owner {}", c->Get()->owner, c->Get()->id, pNew->owner); it->second->erase(c); } } @@ -1544,20 +1529,14 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) if (it != m_map_pkItemCacheSetPtr.end()) { - if (g_log) - sys_log(0, "ITEM_CACHE: save %u id %u", c->Get()->owner, c->Get()->id); - else - sys_log(1, "ITEM_CACHE: save %u id %u", c->Get()->owner, c->Get()->id); + SPDLOG_TRACE("ITEM_CACHE: save {} id {}", c->Get()->owner, c->Get()->id); it->second->insert(c); } else { // ÇöÀç ¼ÒÀ¯ÀÚ°¡ ¾øÀ¸¹Ç·Î ¹Ù·Î ÀúÀåÇØ¾ß ´ÙÀ½ Á¢¼ÓÀÌ ¿Ã ¶§ SQL¿¡ Äõ¸®ÇÏ¿© // ¹ÞÀ» ¼ö ÀÖÀ¸¹Ç·Î ¹Ù·Î ÀúÀåÇÑ´Ù. - if (g_log) - sys_log(0, "ITEM_CACHE: direct save %u id %u", c->Get()->owner, c->Get()->id); - else - sys_log(1, "ITEM_CACHE: direct save %u id %u", c->Get()->owner, c->Get()->id); + SPDLOG_TRACE("ITEM_CACHE: direct save {} id {}", c->Get()->owner, c->Get()->id); c->OnFlush(); } @@ -1608,8 +1587,7 @@ void CClientManager::UpdatePlayerCache() if (c->CheckTimeout()) { - if (g_log) - sys_log(0, "UPDATE : UpdatePlayerCache() ==> FlushPlayerCache %d %s ", c->Get(false)->id, c->Get(false)->name); + SPDLOG_TRACE("UPDATE : UpdatePlayerCache() ==> FlushPlayerCache {} {} ", c->Get(false)->id, c->Get(false)->name); c->Flush(); @@ -1625,7 +1603,7 @@ void CClientManager::UpdatePlayerCache() void CClientManager::SetCacheFlushCountLimit(int iLimit) { m_iCacheFlushCountLimit = std::max(10, iLimit); - sys_log(0, "CACHE_FLUSH_LIMIT_PER_SECOND: %d", m_iCacheFlushCountLimit); + SPDLOG_DEBUG("CACHE_FLUSH_LIMIT_PER_SECOND: {}", m_iCacheFlushCountLimit); } void CClientManager::UpdateItemCache() @@ -1642,8 +1620,7 @@ void CClientManager::UpdateItemCache() // ¾ÆÀÌÅÛÀº Flush¸¸ ÇÑ´Ù. if (c->CheckFlushTimeout()) { - if (g_test_server) - sys_log(0, "UpdateItemCache ==> Flush() vnum %d id owner %d", c->Get()->vnum, c->Get()->id, c->Get()->owner); + SPDLOG_TRACE("UpdateItemCache ==> Flush() vnum {} id owner {}", c->Get()->vnum, c->Get()->id, c->Get()->owner); c->Flush(); @@ -1683,8 +1660,7 @@ void CClientManager::QUERY_ITEM_DESTROY(CPeer * pkPeer, const char * c_pData) char szQuery[64]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), dwID); - if (g_log) - sys_log(0, "HEADER_GD_ITEM_DESTROY: PID %u ID %u", dwPID, dwID); + SPDLOG_TRACE("HEADER_GD_ITEM_DESTROY: PID {} ID {}", dwPID, dwID); if (dwPID == 0) // ¾Æ¹«µµ °¡Áø »ç¶÷ÀÌ ¾ø¾ú´Ù¸é, ºñµ¿±â Äõ¸® CDBManager::instance().AsyncQuery(szQuery); @@ -1702,7 +1678,7 @@ void CClientManager::QUERY_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData) if (!pkCache) return; - sys_log(0, "FLUSH_CACHE: %u", dwPID); + SPDLOG_DEBUG("FLUSH_CACHE: {}", dwPID); pkCache->Flush(); FlushItemCacheSet(dwPID); @@ -1731,7 +1707,7 @@ void CClientManager::QUERY_RELOAD_PROTO() { if (!InitializeTables()) { - sys_err("QUERY_RELOAD_PROTO: cannot load tables"); + SPDLOG_ERROR("QUERY_RELOAD_PROTO: cannot load tables"); return; } @@ -1844,8 +1820,7 @@ void CClientManager::DeleteLoginData(CLoginData * pkLD) void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDAuthLogin * p) { - if (g_test_server) - sys_log(0, "QUERY_AUTH_LOGIN %d %d %s", p->dwID, p->dwLoginKey, p->szLogin); + SPDLOG_TRACE("QUERY_AUTH_LOGIN {} {} {}", p->dwID, p->dwLoginKey, p->szLogin); CLoginData * pkLD = GetLoginDataByLogin(p->szLogin); if (pkLD) @@ -1857,7 +1832,7 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA if (GetLoginData(p->dwLoginKey)) { - sys_err("LoginData already exist key %u login %s", p->dwLoginKey, p->szLogin); + SPDLOG_ERROR("LoginData already exist key {} login {}", p->dwLoginKey, p->szLogin); bResult = 0; pkPeer->EncodeHeader(HEADER_DG_AUTH_LOGIN, dwHandle, sizeof(BYTE)); @@ -1880,7 +1855,7 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA strlcpy(r.social_id, p->szSocialID, sizeof(r.social_id)); strlcpy(r.passwd, "TEMP", sizeof(r.passwd)); - sys_log(0, "AUTH_LOGIN id(%u) login(%s) social_id(%s) login_key(%u), client_key(%u %u %u %u)", + SPDLOG_DEBUG("AUTH_LOGIN id({}) login({}) social_id({}) login_key({}), client_key({} {} {} {})", p->dwID, p->szLogin, p->szSocialID, p->dwLoginKey, p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3]); @@ -1961,20 +1936,20 @@ void CClientManager::BillingCheck(const char * data) std::vector vec; - sys_log(0, "BillingCheck: size %u", dwCount); + SPDLOG_DEBUG("BillingCheck: size {}", dwCount); for (DWORD i = 0; i < dwCount; ++i) { DWORD dwKey = *(DWORD *) data; data += sizeof(DWORD); - sys_log(0, "BillingCheck: %u", dwKey); + SPDLOG_DEBUG("BillingCheck: {}", dwKey); TLoginDataByLoginKey::iterator it = m_map_pkLoginData.find(dwKey); if (it == m_map_pkLoginData.end()) { - sys_log(0, "BillingCheck: key not exist: %u", dwKey); + SPDLOG_DEBUG("BillingCheck: key not exist: {}", dwKey); vec.push_back(dwKey); } else @@ -1983,7 +1958,7 @@ void CClientManager::BillingCheck(const char * data) if (!pkLD->IsPlay() && curTime - pkLD->GetLastPlayTime() > 180) { - sys_log(0, "BillingCheck: not login: %u", dwKey); + SPDLOG_DEBUG("BillingCheck: not login: {}", dwKey); vec.push_back(dwKey); } } @@ -2033,7 +2008,7 @@ void CClientManager::SendAllLoginToBilling() p.dwLoginKey = pkLD->GetKey(); strlcpy(p.szLogin, pkLD->GetAccountRef().login, sizeof(p.szLogin)); strlcpy(p.szHost, pkLD->GetIP(), sizeof(p.szHost)); - sys_log(0, "SendAllLoginToBilling %s %s", pkLD->GetAccountRef().login, pkLD->GetIP()); + SPDLOG_DEBUG("SendAllLoginToBilling {} {}", pkLD->GetAccountRef().login, pkLD->GetIP()); vec.push_back(p); } @@ -2075,7 +2050,7 @@ void CClientManager::CreateObject(TPacketGDCreateObject * p) if (pmsg->Get()->uiInsertID == 0) { - sys_err("cannot insert object"); + SPDLOG_ERROR("cannot insert object"); return; } @@ -2109,7 +2084,7 @@ void CClientManager::DeleteObject(DWORD dwID) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_err("no object by id %u", dwID); + SPDLOG_ERROR("no object by id {}", dwID); return; } @@ -2152,7 +2127,7 @@ void CClientManager::UpdateLand(DWORD * pdw) void CClientManager::VCard(TPacketGDVCard * p) { - sys_log(0, "VCARD: %u %s %s %s %s", + SPDLOG_DEBUG("VCARD: {} {} {} {} {}", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount); m_queue_vcard.push(*p); @@ -2208,39 +2183,39 @@ void CClientManager::BlockChat(TPacketBlockChat* p) void CClientManager::MarriageAdd(TPacketMarriageAdd * p) { - sys_log(0, "MarriageAdd %u %u %s %s", p->dwPID1, p->dwPID2, p->szName1, p->szName2); + SPDLOG_DEBUG("MarriageAdd {} {} {} {}", p->dwPID1, p->dwPID2, p->szName1, p->szName2); marriage::CManager::instance().Add(p->dwPID1, p->dwPID2, p->szName1, p->szName2); } void CClientManager::MarriageUpdate(TPacketMarriageUpdate * p) { - sys_log(0, "MarriageUpdate PID:%u %u LP:%d ST:%d", p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); + SPDLOG_DEBUG("MarriageUpdate PID:{} {} LP:{} ST:{}", p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); marriage::CManager::instance().Update(p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); } void CClientManager::MarriageRemove(TPacketMarriageRemove * p) { - sys_log(0, "MarriageRemove %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("MarriageRemove {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().Remove(p->dwPID1, p->dwPID2); } void CClientManager::WeddingRequest(TPacketWeddingRequest * p) { - sys_log(0, "WeddingRequest %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingRequest {} {}", p->dwPID1, p->dwPID2); ForwardPacket(HEADER_DG_WEDDING_REQUEST, p, sizeof(TPacketWeddingRequest)); //marriage::CManager::instance().RegisterWedding(p->dwPID1, p->szName1, p->dwPID2, p->szName2); } void CClientManager::WeddingReady(TPacketWeddingReady * p) { - sys_log(0, "WeddingReady %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingReady {} {}", p->dwPID1, p->dwPID2); ForwardPacket(HEADER_DG_WEDDING_READY, p, sizeof(TPacketWeddingReady)); marriage::CManager::instance().ReadyWedding(p->dwMapIndex, p->dwPID1, p->dwPID2); } void CClientManager::WeddingEnd(TPacketWeddingEnd * p) { - sys_log(0, "WeddingEnd %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingEnd {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().EndWedding(p->dwPID1, p->dwPID2); } @@ -2252,7 +2227,7 @@ void CClientManager::MyshopPricelistUpdate(const TPacketMyshopPricelistHeader* p { if (pPacket->byCount > SHOP_PRICELIST_MAX_NUM) { - sys_err("count overflow!"); + SPDLOG_ERROR("count overflow!"); return; } @@ -2293,7 +2268,7 @@ void CClientManager::MyshopPricelistRequest(CPeer* peer, DWORD dwHandle, DWORD d { if (CItemPriceListTableCache* pCache = GetItemPriceListCache(dwPlayerID)) { - sys_log(0, "Cache MyShopPricelist handle[%d] pid[%d]", dwHandle, dwPlayerID); + SPDLOG_DEBUG("Cache MyShopPricelist handle[{}] pid[{}]", dwHandle, dwPlayerID); TItemPriceListTable* pTable = pCache->Get(false); @@ -2312,7 +2287,7 @@ void CClientManager::MyshopPricelistRequest(CPeer* peer, DWORD dwHandle, DWORD d } else { - sys_log(0, "Query MyShopPricelist handle[%d] pid[%d]", dwHandle, dwPlayerID); + SPDLOG_DEBUG("Query MyShopPricelist handle[{}] pid[{}]", dwHandle, dwPlayerID); char szQuery[QUERY_MAX_LEN]; snprintf(szQuery, sizeof(szQuery), "SELECT item_vnum, price FROM myshop_pricelist%s WHERE owner_id=%u", GetTablePostfix(), dwPlayerID); @@ -2347,29 +2322,9 @@ void CClientManager::ProcessPackets(CPeer * peer) while (peer->PeekPacket(i, header, dwHandle, dwLength, &data)) { - // DISABLE_DB_HEADER_LOG - // sys_log(0, "header %d %p size %d", header, this, dwLength); - // END_OF_DISABLE_DB_HEADER_LOG m_bLastHeader = header; ++iCount; -#ifdef _TEST - if (header != 10) - sys_log(0, " ProcessPacket Header [%d] Handle[%d] Length[%d] iCount[%d]", header, dwHandle, dwLength, iCount); -#endif - if (g_test_server) - { - if (header != 10) - sys_log(0, " ProcessPacket Header [%d] Handle[%d] Length[%d] iCount[%d]", header, dwHandle, dwLength, iCount); - } - - - // test log by mhh - { - if (HEADER_GD_BLOCK_COUNTRY_IP == header) - sys_log(0, "recved : HEADER_GD_BLOCK_COUNTRY_IP"); - } - switch (header) { case HEADER_GD_BOOT: @@ -2384,28 +2339,28 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_LOGOUT: - //sys_log(0, "HEADER_GD_LOGOUT (handle: %d length: %d)", dwHandle, dwLength); + //SPDLOG_DEBUG("HEADER_GD_LOGOUT (handle: {} length: {})", dwHandle, dwLength); QUERY_LOGOUT(peer, dwHandle, data); break; case HEADER_GD_PLAYER_LOAD: - sys_log(1, "HEADER_GD_PLAYER_LOAD (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_PLAYER_LOAD (handle: {} length: {})", dwHandle, dwLength); QUERY_PLAYER_LOAD(peer, dwHandle, (TPlayerLoadPacket *) data); break; case HEADER_GD_PLAYER_SAVE: - sys_log(1, "HEADER_GD_PLAYER_SAVE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_PLAYER_SAVE (handle: {} length: {})", dwHandle, dwLength); QUERY_PLAYER_SAVE(peer, dwHandle, (TPlayerTable *) data); break; case HEADER_GD_PLAYER_CREATE: - sys_log(0, "HEADER_GD_PLAYER_CREATE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_DEBUG("HEADER_GD_PLAYER_CREATE (handle: {} length: {})", dwHandle, dwLength); __QUERY_PLAYER_CREATE(peer, dwHandle, (TPlayerCreatePacket *) data); - sys_log(0, "END"); + SPDLOG_DEBUG("END"); break; case HEADER_GD_PLAYER_DELETE: - sys_log(1, "HEADER_GD_PLAYER_DELETE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_PLAYER_DELETE (handle: {} length: {})", dwHandle, dwLength); __QUERY_PLAYER_DELETE(peer, dwHandle, (TPlayerDeletePacket *) data); break; @@ -2414,7 +2369,7 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_QUEST_SAVE: - sys_log(1, "HEADER_GD_QUEST_SAVE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_QUEST_SAVE (handle: {} length: {})", dwHandle, dwLength); QUERY_QUEST_SAVE(peer, (TQuestTable *) data, dwLength); break; @@ -2423,7 +2378,7 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_SAFEBOX_SAVE: - sys_log(1, "HEADER_GD_SAFEBOX_SAVE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_SAFEBOX_SAVE (handle: {} length: {})", dwHandle, dwLength); QUERY_SAFEBOX_SAVE(peer, (TSafeboxTable *) data); break; @@ -2512,12 +2467,12 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_ADD_AFFECT: - sys_log(1, "HEADER_GD_ADD_AFFECT"); + SPDLOG_TRACE("HEADER_GD_ADD_AFFECT"); QUERY_ADD_AFFECT(peer, (TPacketGDAddAffect *) data); break; case HEADER_GD_REMOVE_AFFECT: - sys_log(1, "HEADER_GD_REMOVE_AFFECT"); + SPDLOG_TRACE("HEADER_GD_REMOVE_AFFECT"); QUERY_REMOVE_AFFECT(peer, (TPacketGDRemoveAffect *) data); break; @@ -2718,13 +2673,13 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_BLOCK_COUNTRY_IP: - sys_log(0, "HEADER_GD_BLOCK_COUNTRY_IP received"); + SPDLOG_DEBUG("HEADER_GD_BLOCK_COUNTRY_IP received"); CBlockCountry::instance().SendBlockedCountryIp(peer); CBlockCountry::instance().SendBlockException(peer); break; case HEADER_GD_BLOCK_EXCEPTION: - sys_log(0, "HEADER_GD_BLOCK_EXCEPTION received"); + SPDLOG_DEBUG("HEADER_GD_BLOCK_EXCEPTION received"); BlockException((TPacketBlockException*) data); break; @@ -2823,7 +2778,7 @@ void CClientManager::ProcessPackets(CPeer * peer) break; #endif default: - sys_err("Unknown header (header: %d handle: %d length: %d)", header, dwHandle, dwLength); + SPDLOG_ERROR("Unknown header (header: {} handle: {} length: {})", header, dwHandle, dwLength); break; } } @@ -2868,7 +2823,7 @@ void CClientManager::RemovePeer(CPeer * pPeer) if (pkLD->IsDeleted()) { - sys_log(0, "DELETING LoginData"); + SPDLOG_DEBUG("DELETING LoginData"); delete pkLD; } @@ -2919,7 +2874,7 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) #ifdef _TEST if (qi->iType != QID_ITEM_AWARD_LOAD) - sys_log(0, "AnalyzeQueryResult %d", qi->iType); + SPDLOG_DEBUG("AnalyzeQueryResult {}", qi->iType); #endif switch (qi->iType) { @@ -2941,7 +2896,7 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) if (!peer) { - //sys_err("CClientManager::AnalyzeQueryResult: peer not exist anymore. (ident: %d)", qi->dwIdent); + //SPDLOG_ERROR("CClientManager::AnalyzeQueryResult: peer not exist anymore. (ident: {})", qi->dwIdent); delete qi; return true; } @@ -2960,27 +2915,27 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) break; case QID_SAFEBOX_LOAD: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_LOAD"); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_LOAD"); RESULT_SAFEBOX_LOAD(peer, msg); break; case QID_SAFEBOX_CHANGE_SIZE: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_SIZE"); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_SIZE"); RESULT_SAFEBOX_CHANGE_SIZE(peer, msg); break; case QID_SAFEBOX_CHANGE_PASSWORD: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD %p", msg); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD {}", (void*) msg); RESULT_SAFEBOX_CHANGE_PASSWORD(peer, msg); break; case QID_SAFEBOX_CHANGE_PASSWORD_SECOND: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD %p", msg); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD {}", (void*) msg); RESULT_SAFEBOX_CHANGE_PASSWORD_SECOND(peer, msg); break; case QID_HIGHSCORE_REGISTER: - sys_log(0, "QUERY_RESULT: HEADER_GD_HIGHSCORE_REGISTER %p", msg); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_HIGHSCORE_REGISTER {}", (void*) msg); RESULT_HIGHSCORE_REGISTER(peer, msg); break; @@ -3013,7 +2968,7 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) // END_OF_MYSHOP_PRICE_LIST default: - sys_log(0, "CClientManager::AnalyzeQueryResult unknown query result type: %d, str: %s", qi->iType, msg->stQuery.c_str()); + SPDLOG_DEBUG("CClientManager::AnalyzeQueryResult unknown query result type: {}, str: {}", qi->iType, msg->stQuery); break; } @@ -3067,7 +3022,7 @@ int CClientManager::Process() { g_iPlayerCacheFlushSeconds = std::max(60, rand() % 180); g_iItemCacheFlushSeconds = std::max(60, rand() % 180); - sys_log(0, "[SAVE_TIME]Change saving time item %d player %d", g_iPlayerCacheFlushSeconds, g_iItemCacheFlushSeconds); + SPDLOG_DEBUG("[SAVE_TIME]Change saving time item {} player {}", g_iPlayerCacheFlushSeconds, g_iItemCacheFlushSeconds); } */ @@ -3079,7 +3034,7 @@ int CClientManager::Process() if (!(thecore_heart->pulse % thecore_heart->passes_per_sec * 10)) { - pt_log("[%9d] return %d/%d/%d/%d async %d/%d/%d/%d", + SPDLOG_TRACE("[{:9}] return {}/{}/{}/{} async {}/{}/{}/{}", thecore_heart->pulse, CDBManager::instance().CountReturnQuery(SQL_PLAYER), CDBManager::instance().CountReturnResult(SQL_PLAYER), @@ -3090,8 +3045,8 @@ int CClientManager::Process() CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER), CDBManager::instance().CountAsyncCopiedQuery(SQL_PLAYER)); - if ((thecore_heart->pulse % 50) == 0) - sys_log(0, "[%9d] return %d/%d/%d async %d/%d/%d", + if ((thecore_heart->pulse % 50) == 0) + SPDLOG_TRACE("[{:9}] return {}/{}/{} async {}/{}/{}", thecore_heart->pulse, CDBManager::instance().CountReturnQuery(SQL_PLAYER), CDBManager::instance().CountReturnResult(SQL_PLAYER), @@ -3103,7 +3058,7 @@ int CClientManager::Process() } else { - pt_log("[%9d] return %d/%d/%d/%d async %d/%d/%d%/%d", + SPDLOG_TRACE("[{:9}] return {}/{}/{}/{} async {}/{}/{}/{}", thecore_heart->pulse, CDBManager::instance().CountReturnQuery(SQL_PLAYER), CDBManager::instance().CountReturnResult(SQL_PLAYER), @@ -3114,16 +3069,16 @@ int CClientManager::Process() CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER), CDBManager::instance().CountAsyncCopiedQuery(SQL_PLAYER)); - if ((thecore_heart->pulse % 50) == 0) - sys_log(0, "[%9d] return %d/%d/%d async %d/%d/%d", - thecore_heart->pulse, - CDBManager::instance().CountReturnQuery(SQL_PLAYER), - CDBManager::instance().CountReturnResult(SQL_PLAYER), - CDBManager::instance().CountReturnQueryFinished(SQL_PLAYER), - CDBManager::instance().CountAsyncQuery(SQL_PLAYER), - CDBManager::instance().CountAsyncResult(SQL_PLAYER), - CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER)); - } + if ((thecore_heart->pulse % 50) == 0) + SPDLOG_TRACE("[{:9}] return {}/{}/{} async {}/{}/{}", + thecore_heart->pulse, + CDBManager::instance().CountReturnQuery(SQL_PLAYER), + CDBManager::instance().CountReturnResult(SQL_PLAYER), + CDBManager::instance().CountReturnQueryFinished(SQL_PLAYER), + CDBManager::instance().CountAsyncQuery(SQL_PLAYER), + CDBManager::instance().CountAsyncResult(SQL_PLAYER), + CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER)); + } CDBManager::instance().ResetCounter(); @@ -3183,46 +3138,46 @@ int CClientManager::Process() it++; } - pt_log("QUERY:\n%s-------------------- MAX : %d\n", buf, count); + SPDLOG_TRACE("QUERY:\n{}-------------------- MAX : {}", buf, count); g_query_info.Reset(); */ - pt_log("QUERY: MAIN[%d] ASYNC[%d]", g_query_count[0], g_query_count[1]); - g_query_count[0] = 0; - g_query_count[1] = 0; - ///////////////////////////////////////////////////////////////// + SPDLOG_TRACE("QUERY: MAIN[{}] ASYNC[{}]", g_query_count[0], g_query_count[1]); + g_query_count[0] = 0; + g_query_count[1] = 0; + ///////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - /* - buf[0] = '\0'; - len = 0; + ///////////////////////////////////////////////////////////////// + /* + buf[0] = '\0'; + len = 0; - it = g_item_info.m_map_info.begin(); + it = g_item_info.m_map_info.begin(); - count = 0; - while (it != g_item_info.m_map_info.end()) - { - len += snprintf(buf + len, sizeof(buf) - len, "%5d %3d\n", it->first, it->second); - count += it->second; - it++; - } + count = 0; + while (it != g_item_info.m_map_info.end()) + { + len += snprintf(buf + len, sizeof(buf) - len, "%5d %3d\n", it->first, it->second); + count += it->second; + it++; + } - pt_log("ITEM:\n%s-------------------- MAX : %d\n", buf, count); - g_item_info.Reset(); - */ - pt_log("ITEM:%d\n", g_item_count); - g_item_count = 0; - ///////////////////////////////////////////////////////////////// - } + SPDLOG_TRACE("ITEM:\n{}-------------------- MAX : {}", buf, count); + g_item_info.Reset(); + */ + SPDLOG_TRACE("ITEM:{}", g_item_count); + g_item_count = 0; + ///////////////////////////////////////////////////////////////// + } - if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 60))) // 60ÃÊ¿¡ Çѹø - { - // À¯´ÏÅ© ¾ÆÀÌÅÛÀ» À§ÇÑ ½Ã°£À» º¸³½´Ù. - CClientManager::instance().SendTime(); - } + if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 60))) // 60ÃÊ¿¡ Çѹø + { + // À¯´ÏÅ© ¾ÆÀÌÅÛÀ» À§ÇÑ ½Ã°£À» º¸³½´Ù. + CClientManager::instance().SendTime(); + } - if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 3600))) // Çѽ𣿡 Çѹø - { - CMoneyLog::instance().Save(); + if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 3600))) // Çѽ𣿡 Çѹø + { + CMoneyLog::instance().Save(); } } @@ -3298,19 +3253,19 @@ bool CClientManager::InitializeNowItemID() //¾ÆÀÌÅÛ ID¸¦ ÃʱâÈ­ ÇÑ´Ù. if (!CConfig::instance().GetTwoValue("ITEM_ID_RANGE", &dwMin, &dwMax)) { - sys_err("conf.txt: Cannot find ITEM_ID_RANGE [start_item_id] [end_item_id]"); + SPDLOG_ERROR("conf.txt: Cannot find ITEM_ID_RANGE [start_item_id] [end_item_id]"); return false; } - sys_log(0, "ItemRange From File %u ~ %u ", dwMin, dwMax); + SPDLOG_DEBUG("ItemRange From File {} ~ {} ", dwMin, dwMax); if (CItemIDRangeManager::instance().BuildRange(dwMin, dwMax, m_itemRange) == false) { - sys_err("Can not build ITEM_ID_RANGE"); + SPDLOG_ERROR("Can not build ITEM_ID_RANGE"); return false; } - sys_log(0, " Init Success Start %u End %u Now %u\n", m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); + SPDLOG_DEBUG(" Init Success Start {} End {} Now {}", m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); return true; } @@ -3335,12 +3290,12 @@ bool CClientManager::InitializeLocalization() if (pMsg->Get()->uiNumRows == 0) { - sys_err("InitializeLocalization() ==> DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR("InitializeLocalization() ==> DirectQuery failed({})", szQuery); delete pMsg; return false; } - sys_log(0, "InitializeLocalization() - LoadLocaleTable(count:%d)", pMsg->Get()->uiNumRows); + SPDLOG_DEBUG("InitializeLocalization() - LoadLocaleTable(count:{})", pMsg->Get()->uiNumRows); m_vec_Locale.clear(); @@ -3359,346 +3314,346 @@ bool CClientManager::InitializeLocalization() { if (strcmp(locale.szValue, "cibn") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "gb2312"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "gb2312"); g_stLocale = "gb2312"; g_stLocaleNameColumn = "gb2312name"; } else if (strcmp(locale.szValue, "ymir") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "euckr"; g_stLocaleNameColumn = "name"; } else if (strcmp(locale.szValue, "japan") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "sjis"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "sjis"); g_stLocale = "sjis"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "english") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = ""; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "germany") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "france") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "italy") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "spain") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "uk") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "turkey") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin5"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "poland") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "portugal") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "hongkong") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "big5"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "big5"); g_stLocale = "big5"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "newcibn") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "gb2312"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "gb2312"); g_stLocale = "gb2312"; g_stLocaleNameColumn = "gb2312name"; } else if (strcmp(locale.szValue, "korea") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "euckr"; g_stLocaleNameColumn = "name"; } else if (strcmp(locale.szValue, "canada") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "gb2312name"; } else if (strcmp(locale.szValue, "brazil") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "greek") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "greek"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "russia") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "cp1251"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "denmark") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "bulgaria") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "cp1251"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "croatia") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "cp1251"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "mexico") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "arabia") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "cp1256"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "czech") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "hungary") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "romania") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "netherlands") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "singapore") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "vietnam") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "thailand") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "usa") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "we_korea") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "euckr"; g_stLocaleNameColumn = "name"; } else if (strcmp(locale.szValue, "taiwan") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "big5"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "big5"); g_stLocale = "big5"; g_stLocaleNameColumn = "locale_name"; } else { - sys_err("locale[LOCALE] = UNKNOWN(%s)", locale.szValue); + SPDLOG_ERROR("locale[LOCALE] = UNKNOWN({})", locale.szValue); exit(0); } @@ -3706,12 +3661,12 @@ bool CClientManager::InitializeLocalization() } else if (strcmp(locale.szKey, "DB_NAME_COLUMN") == 0) { - sys_log(0, "locale[DB_NAME_COLUMN] = %s", locale.szValue); + SPDLOG_DEBUG("locale[DB_NAME_COLUMN] = {}", locale.szValue); g_stLocaleNameColumn = locale.szValue; } else { - sys_log(0, "locale[UNKNOWN_KEY(%s)] = %s", locale.szKey, locale.szValue); + SPDLOG_DEBUG("locale[UNKNOWN_KEY({})] = {}", locale.szKey, locale.szValue); } m_vec_Locale.push_back(locale); } @@ -3735,7 +3690,7 @@ bool CClientManager::__GetAdminInfo(const char *szIP, std::vector & if (pMsg->Get()->uiNumRows == 0) { - sys_err("__GetAdminInfo() ==> DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR("__GetAdminInfo() ==> DirectQuery failed({})", szQuery); delete pMsg; return false; } @@ -3770,7 +3725,7 @@ bool CClientManager::__GetAdminInfo(const char *szIP, std::vector & rAdminVec.push_back(Info); - sys_log(0, "GM: PID %u Login %s Character %s ContactIP %s ServerIP %s Authority %d[%s]", + SPDLOG_DEBUG("GM: PID {} Login {} Character {} ContactIP {} ServerIP {} Authority {}[{}]", Info.m_ID, Info.m_szAccount, Info.m_szName, Info.m_szContactIP, Info.m_szServerIP, Info.m_Authority, stAuth.c_str()); } @@ -3787,7 +3742,7 @@ bool CClientManager::__GetHostInfo(std::vector & rIPVec) if (pMsg->Get()->uiNumRows == 0) { - sys_err("__GetHostInfo() ==> DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR("__GetHostInfo() ==> DirectQuery failed({})", szQuery); delete pMsg; return false; } @@ -3801,7 +3756,7 @@ bool CClientManager::__GetHostInfo(std::vector & rIPVec) if (row[0] && *row[0]) { rIPVec.push_back(row[0]); - sys_log(0, "GMHOST: %s", row[0]); + SPDLOG_DEBUG("GMHOST: {}", row[0]); } } @@ -3843,7 +3798,7 @@ void CClientManager::ReloadAdmin(CPeer*, TPacketReloadAdmin* p) peer->Encode(&vAdmin[n], sizeof(tAdminInfo)); } - sys_log(0, "ReloadAdmin End %s", p->szIP); + SPDLOG_DEBUG("ReloadAdmin End {}", p->szIP); } //BREAK_MARRIAGE @@ -3857,7 +3812,7 @@ void CClientManager::BreakMarriage(CPeer * peer, const char * data) pid2 = *(int *) data; data += sizeof(int); - sys_log(0, "Breaking off a marriage engagement! pid %d and pid %d", pid1, pid2); + SPDLOG_DEBUG("Breaking off a marriage engagement! pid {} and pid {}", pid1, pid2); marriage::CManager::instance().Remove(pid1, pid2); } //END_BREAK_MARIIAGE @@ -3868,8 +3823,7 @@ void CClientManager::UpdateItemCacheSet(DWORD pid) if (it == m_map_pkItemCacheSetPtr.end()) { - if (g_test_server) - sys_log(0, "UPDATE_ITEMCACHESET : UpdateItemCacheSet ==> No ItemCacheSet pid(%d)", pid); + SPDLOG_TRACE("UPDATE_ITEMCACHESET : UpdateItemCacheSet ==> No ItemCacheSet pid({})", pid); return; } @@ -3882,8 +3836,7 @@ void CClientManager::UpdateItemCacheSet(DWORD pid) c->Flush(); } - if (g_log) - sys_log(0, "UPDATE_ITEMCACHESET : UpdateItemCachsSet pid(%d)", pid); + SPDLOG_TRACE("UPDATE_ITEMCACHESET : UpdateItemCachsSet pid({})", pid); } void CClientManager::Election(CPeer * peer, DWORD dwHandle, const char* data) @@ -3901,16 +3854,14 @@ void CClientManager::Election(CPeer * peer, DWORD dwHandle, const char* data) if (!(Success = CMonarch::instance().VoteMonarch(selectingpid, idx))) { - if (g_test_server) - sys_log(0, "[MONARCH_VOTE] Failed %d %d", idx, selectingpid); + SPDLOG_TRACE("[MONARCH_VOTE] Failed {} {}", idx, selectingpid); peer->EncodeHeader(HEADER_DG_ELECT_MONARCH, dwHandle, sizeof(int)); peer->Encode(&Success, sizeof(int)); return; } else { - if (g_test_server) - sys_log(0, "[MONARCH_VOTE] Success %d %d", idx, selectingpid); + SPDLOG_TRACE("[MONARCH_VOTE] Success {} {}", idx, selectingpid); peer->EncodeHeader(HEADER_DG_ELECT_MONARCH, dwHandle, sizeof(int)); peer->Encode(&Success, sizeof(int)); return; @@ -3926,8 +3877,7 @@ void CClientManager::Candidacy(CPeer * peer, DWORD dwHandle, const char* data) if (!CMonarch::instance().AddCandidacy(pid, data)) { - if (g_test_server) - sys_log(0, "[MONARCH_CANDIDACY] Failed %d %s", pid, data); + SPDLOG_TRACE("[MONARCH_CANDIDACY] Failed {} {}", pid, data); peer->EncodeHeader(HEADER_DG_CANDIDACY, dwHandle, sizeof(int) + 32); peer->Encode(0, sizeof(int)); @@ -3936,8 +3886,7 @@ void CClientManager::Candidacy(CPeer * peer, DWORD dwHandle, const char* data) } else { - if (g_test_server) - sys_log(0, "[MONARCH_CANDIDACY] Success %d %s", pid, data); + SPDLOG_TRACE("[MONARCH_CANDIDACY] Success {} {}", pid, data); for (itertype(m_peerList) it = m_peerList.begin(); it != m_peerList.end(); ++it) { @@ -3973,8 +3922,7 @@ void CClientManager::AddMonarchMoney(CPeer * peer, DWORD dwHandle, const char * int Money = *(int *) data; data += sizeof(int); - if (g_test_server) - sys_log(0, "[MONARCH] Add money Empire(%d) Money(%d)", Empire, Money); + SPDLOG_TRACE("[MONARCH] Add money Empire({}) Money({})", Empire, Money); CMonarch::instance().AddMoney(Empire, Money); @@ -4008,8 +3956,7 @@ void CClientManager::DecMonarchMoney(CPeer * peer, DWORD dwHandle, const char * int Money = *(int *) data; data += sizeof(int); - if (g_test_server) - sys_log(0, "[MONARCH] Dec money Empire(%d) Money(%d)", Empire, Money); + SPDLOG_TRACE("[MONARCH] Dec money Empire({}) Money({})", Empire, Money); CMonarch::instance().DecMoney(Empire, Money); @@ -4046,8 +3993,7 @@ void CClientManager::TakeMonarchMoney(CPeer * peer, DWORD dwHandle, const char * int Money = *(int *) data; data += sizeof(int); - if (g_test_server) - sys_log(0, "[MONARCH] Take money Empire(%d) Money(%d)", Empire, Money); + SPDLOG_TRACE("[MONARCH] Take money Empire({}) Money({})", Empire, Money); if (CMonarch::instance().TakeMoney(Empire, pid, Money) == true) { @@ -4074,7 +4020,7 @@ void CClientManager::RMCandidacy(CPeer * peer, DWORD dwHandle, const char * data char szName[32]; strlcpy(szName, data, sizeof(szName)); - sys_log(0, "[MONARCH_GM] Remove candidacy name(%s)", szName); + SPDLOG_DEBUG("[MONARCH_GM] Remove candidacy name({})", szName); int iRet = CMonarch::instance().DelCandidacy(szName) ? 1 : 0; @@ -4116,8 +4062,7 @@ void CClientManager::SetMonarch(CPeer * peer, DWORD dwHandle, const char * data) strlcpy(szName, data, sizeof(szName)); - if (g_test_server) - sys_log(0, "[MONARCH_GM] Set Monarch name(%s)", szName); + SPDLOG_TRACE("[MONARCH_GM] Set Monarch name({})", szName); int iRet = CMonarch::instance().SetMonarch(szName) ? 1 : 0; @@ -4159,8 +4104,7 @@ void CClientManager::RMMonarch(CPeer * peer, DWORD dwHandle, const char * data) strlcpy(szName, data, sizeof(szName)); - if (g_test_server) - sys_log(0, "[MONARCH_GM] Remove Monarch name(%s)", szName); + SPDLOG_TRACE("[MONARCH_GM] Remove Monarch name({})", szName); CMonarch::instance().DelMonarch(szName); @@ -4248,7 +4192,7 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan void CClientManager::BlockException(TPacketBlockException *data) { - sys_log(0, "[BLOCK_EXCEPTION] CMD(%d) login(%s)", data->cmd, data->login); + SPDLOG_DEBUG("[BLOCK_EXCEPTION] CMD({}) login({})", data->cmd, data->login); // save sql { @@ -4310,19 +4254,19 @@ void CClientManager::DeleteLoginKey(TPacketDC *data) // delete gift notify icon void CClientManager::DeleteAwardId(TPacketDeleteAwardID *data) { - //sys_log(0,"data from game server arrived %d",data->dwID); + //SPDLOG_DEBUG("data from game server arrived {}", data->dwID); std::map::iterator it; it = ItemAwardManager::Instance().GetMapAward().find(data->dwID); if ( it != ItemAwardManager::Instance().GetMapAward().end() ) { std::set & kSet = ItemAwardManager::Instance().GetMapkSetAwardByLogin()[it->second->szLogin]; if(kSet.erase(it->second)) - sys_log(0,"erase ItemAward id: %d from cache", data->dwID); + SPDLOG_DEBUG("erase ItemAward id: {} from cache", data->dwID); ItemAwardManager::Instance().GetMapAward().erase(data->dwID); } else { - sys_log(0,"DELETE_AWARDID : could not find the id: %d", data->dwID); + SPDLOG_DEBUG("DELETE_AWARDID : could not find the id: {}", data->dwID); } } @@ -4369,11 +4313,11 @@ void CClientManager::ChargeCash(const TRequestChargeCash* packet) sprintf(szQuery, "update account set `mileage` = `mileage` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID); else { - sys_err ("Invalid request charge type (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID); + SPDLOG_ERROR("Invalid request charge type (type : {}, amount : {}, aid : {})", (int) packet->eChargeType, packet->dwAmount, packet->dwAID); return; } - sys_err ("Request Charge (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID); + SPDLOG_ERROR("Request Charge (type : {}, amount : {}, aid : {})", (int) packet->eChargeType, packet->dwAmount, packet->dwAID); CDBManager::Instance().AsyncQuery(szQuery, SQL_ACCOUNT); } @@ -4385,21 +4329,21 @@ void CClientManager::EnrollInAuction (CPeer * peer, DWORD owner_id, AuctionEnrol if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", owner_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", owner_id); return; } CItemCache* c = GetItemCache (data->get_item_id()); if (c == NULL) { - sys_err ("Item %d doesn't exist in db cache.", data->get_item_id()); + SPDLOG_ERROR("Item {} doesn't exist in db cache.", data->get_item_id()); return; } TPlayerItem* item = c->Get(false); if (item->owner != owner_id) { - sys_err ("Player id %d doesn't have item %d.", owner_id, data->get_item_id()); + SPDLOG_ERROR("Player id {} doesn't have item {}.", owner_id, data->get_item_id()); return; } // ÇöÀç ½Ã°¢ + 24½Ã°£ ÈÄ. @@ -4429,7 +4373,7 @@ void CClientManager::EnrollInAuction (CPeer * peer, DWORD owner_id, AuctionEnrol it->second->erase(c); } m_map_itemCache.erase(item->id); - sys_log(0, "Enroll In Auction Success. owner_id item_id %d %d", owner_id, item->id); + SPDLOG_DEBUG("Enroll In Auction Success. owner_id item_id {} {}", owner_id, item->id); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_AUC; @@ -4453,7 +4397,7 @@ void CClientManager::EnrollInSale (CPeer * peer, DWORD owner_id, AuctionEnrollSa if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", owner_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", owner_id); return; } @@ -4464,14 +4408,14 @@ void CClientManager::EnrollInSale (CPeer * peer, DWORD owner_id, AuctionEnrollSa if (c == NULL) { - sys_err ("Item %d doesn't exist in db cache.", data->get_item_id()); + SPDLOG_ERROR("Item {} doesn't exist in db cache.", data->get_item_id()); return; } TPlayerItem* item = c->Get(false); if (item->owner != owner_id) { - sys_err ("Player id %d doesn't have item %d.", owner_id, data->get_item_id()); + SPDLOG_ERROR("Player id {} doesn't have item {}.", owner_id, data->get_item_id()); return; } // ÇöÀç ½Ã°¢ + 24½Ã°£ ÈÄ. @@ -4501,7 +4445,7 @@ void CClientManager::EnrollInSale (CPeer * peer, DWORD owner_id, AuctionEnrollSa it->second->erase(c); } m_map_itemCache.erase(item->id); - sys_log(0, "Enroll In Sale Success. owner_id item_id %d %d", owner_id, item->id); + SPDLOG_DEBUG("Enroll In Sale Success. owner_id item_id {} {}", owner_id, item->id); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_SALE; @@ -4526,7 +4470,7 @@ void CClientManager::EnrollInWish (CPeer * peer, DWORD wisher_id, AuctionEnrollW if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", wisher_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", wisher_id); return; } @@ -4541,7 +4485,7 @@ void CClientManager::EnrollInWish (CPeer * peer, DWORD wisher_id, AuctionEnrollW if (result <= AUCTION_FAIL) { - sys_log(0, "Enroll In Wish Success. wisher_id item_num %d %d", wisher_id, data->get_item_num()); + SPDLOG_DEBUG("Enroll In Wish Success. wisher_id item_num {} {}", wisher_id, data->get_item_num()); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_WISH; @@ -4552,7 +4496,7 @@ void CClientManager::EnrollInWish (CPeer * peer, DWORD wisher_id, AuctionEnrollW } else { - sys_log(0, "Enroll In Wish Fail. wisher_id item_num %d %d", wisher_id, data->get_item_num()); + SPDLOG_DEBUG("Enroll In Wish Fail. wisher_id item_num {} {}", wisher_id, data->get_item_num()); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_WISH; @@ -4576,7 +4520,7 @@ void CClientManager::AuctionBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo* if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", bidder_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", bidder_id); return; } @@ -4587,11 +4531,11 @@ void CClientManager::AuctionBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo* if (result == AUCTION_FAIL) { - sys_log(0, "Bid Fail. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("Bid Fail. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } else { - sys_log(0, "Bid Success. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("Bid Success. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } if (result <= AUCTION_FAIL) @@ -4630,7 +4574,7 @@ void CClientManager::AuctionImpur (CPeer * peer, DWORD purchaser_id, AuctionImpu if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", purchaser_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", purchaser_id); return; } @@ -4641,11 +4585,11 @@ void CClientManager::AuctionImpur (CPeer * peer, DWORD purchaser_id, AuctionImpu if (result == AUCTION_FAIL) { - sys_log(0, "Impur Fail. purchaser_id item_id %d %d", purchaser_id, data->get_item_id()); + SPDLOG_DEBUG("Impur Fail. purchaser_id item_id {} {}", purchaser_id, data->get_item_id()); } else { - sys_log(0, "Impur Success. purchaser_id item_id %d %d", purchaser_id, data->get_item_id()); + SPDLOG_DEBUG("Impur Success. purchaser_id item_id {} {}", purchaser_id, data->get_item_id()); } if (result <= AUCTION_FAIL) @@ -4682,7 +4626,7 @@ void CClientManager::AuctionGetAuctionedItem (CPeer * peer, DWORD actor_id, DWOR AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4722,7 +4666,7 @@ void CClientManager::AuctionBuySoldItem (CPeer * peer, DWORD actor_id, DWORD ite AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4762,7 +4706,7 @@ void CClientManager::AuctionCancelAuction (CPeer * peer, DWORD actor_id, DWORD i AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4802,7 +4746,7 @@ void CClientManager::AuctionCancelWish (CPeer * peer, DWORD actor_id, DWORD item AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4841,7 +4785,7 @@ void CClientManager::AuctionCancelSale (CPeer * peer, DWORD actor_id, DWORD item AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4881,7 +4825,7 @@ void CClientManager::AuctionDeleteAuctionItem (CPeer * peer, DWORD actor_id, DWO AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4893,7 +4837,7 @@ void CClientManager::AuctionDeleteSaleItem (CPeer * peer, DWORD actor_id, DWORD AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4912,7 +4856,7 @@ void CClientManager::AuctionReBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", bidder_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", bidder_id); return; } @@ -4923,11 +4867,11 @@ void CClientManager::AuctionReBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo if (result == AUCTION_FAIL) { - sys_log(0, "ReBid Fail. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("ReBid Fail. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } else { - sys_log(0, "ReBid Success. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("ReBid Success. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } // ÀÌ°Ç FAILÀÌ ¶°¼­´Â ¾ÈµÅ. // FAILÀÌ ¶ã ¼ö°¡ ¾ø´Â°Ô, MyBid¿¡ ÀÖ´Â bidder_id¿¡ ´ëÇÑ ÄÁÅÙÃ÷´Â bidder_id¸¸ÀÌ Á¢±Ù ÇÒ ¼ö Àְŵç? diff --git a/src/db/src/ClientManagerBoot.cpp b/src/db/src/ClientManagerBoot.cpp index c52b97d..3b410ae 100644 --- a/src/db/src/ClientManagerBoot.cpp +++ b/src/db/src/ClientManagerBoot.cpp @@ -16,84 +16,84 @@ bool CClientManager::InitializeTables() { if (!InitializeMobTable()) { - sys_err("InitializeMobTable FAILED"); + SPDLOG_ERROR("InitializeMobTable FAILED"); return false; } if (!MirrorMobTableIntoDB()) { - sys_err("MirrorMobTableIntoDB FAILED"); + SPDLOG_ERROR("MirrorMobTableIntoDB FAILED"); return false; } if (!InitializeItemTable()) { - sys_err("InitializeItemTable FAILED"); + SPDLOG_ERROR("InitializeItemTable FAILED"); return false; } if (!MirrorItemTableIntoDB()) { - sys_err("MirrorItemTableIntoDB FAILED"); + SPDLOG_ERROR("MirrorItemTableIntoDB FAILED"); return false; } if (!InitializeShopTable()) { - sys_err("InitializeShopTable FAILED"); + SPDLOG_ERROR("InitializeShopTable FAILED"); return false; } if (!InitializeSkillTable()) { - sys_err("InitializeSkillTable FAILED"); + SPDLOG_ERROR("InitializeSkillTable FAILED"); return false; } if (!InitializeRefineTable()) { - sys_err("InitializeRefineTable FAILED"); + SPDLOG_ERROR("InitializeRefineTable FAILED"); return false; } if (!InitializeItemAttrTable()) { - sys_err("InitializeItemAttrTable FAILED"); + SPDLOG_ERROR("InitializeItemAttrTable FAILED"); return false; } if (!InitializeItemRareTable()) { - sys_err("InitializeItemRareTable FAILED"); + SPDLOG_ERROR("InitializeItemRareTable FAILED"); return false; } if (!InitializeBanwordTable()) { - sys_err("InitializeBanwordTable FAILED"); + SPDLOG_ERROR("InitializeBanwordTable FAILED"); return false; } if (!InitializeLandTable()) { - sys_err("InitializeLandTable FAILED"); + SPDLOG_ERROR("InitializeLandTable FAILED"); return false; } if (!InitializeObjectProto()) { - sys_err("InitializeObjectProto FAILED"); + SPDLOG_ERROR("InitializeObjectProto FAILED"); return false; } if (!InitializeObjectTable()) { - sys_err("InitializeObjectTable FAILED"); + SPDLOG_ERROR("InitializeObjectTable FAILED"); return false; } if (!InitializeMonarch()) { - sys_err("InitializeMonarch FAILED"); + SPDLOG_ERROR("InitializeMonarch FAILED"); return false; } @@ -117,7 +117,7 @@ bool CClientManager::InitializeRefineTable() if (m_pRefineTable) { - sys_log(0, "RELOAD: refine_proto"); + SPDLOG_DEBUG("RELOAD: refine_proto"); delete [] m_pRefineTable; m_pRefineTable = NULL; } @@ -153,7 +153,7 @@ bool CClientManager::InitializeRefineTable() } } - sys_log(0, "REFINE: id %ld cost %d prob %d mat1 %lu cnt1 %d", prt->id, prt->cost, prt->prob, prt->materials[0].vnum, prt->materials[0].count); + SPDLOG_TRACE("REFINE: id {} cost {} prob {} mat1 {} cnt1 {}", prt->id, prt->cost, prt->prob, prt->materials[0].vnum, prt->materials[0].count); prt++; } @@ -203,7 +203,7 @@ bool CClientManager::InitializeMobTable() cCsvTable nameData; if(!nameData.Load("mob_names.txt",'\t')) { - fprintf(stderr, "mob_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("mob_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); isNameFile = false; } else { nameData.Next(); //¼³¸írow »ý·«. @@ -224,7 +224,7 @@ bool CClientManager::InitializeMobTable() cCsvTable test_data; if(!test_data.Load("mob_proto_test.txt",'\t')) { - fprintf(stderr, "Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù.\n"); + SPDLOG_ERROR("Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù."); isTestFile = false; } //2. (c)[test_map_mobTableByVnum](vnum:TMobTable) ¸Ê »ý¼º. @@ -243,7 +243,7 @@ bool CClientManager::InitializeMobTable() if (!Set_Proto_Mob_Table(test_mob_table, test_data, localMap)) { - fprintf(stderr, "¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } test_map_mobTableByVnum.insert(std::map::value_type(test_mob_table->dwVnum, test_mob_table)); @@ -264,7 +264,7 @@ bool CClientManager::InitializeMobTable() //1. ÆÄÀÏ Àбâ. cCsvTable data; if(!data.Load("mob_proto.txt",'\t')) { - fprintf(stderr, "mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¼³¸í row ³Ñ¾î°¡±â @@ -283,14 +283,14 @@ bool CClientManager::InitializeMobTable() data.Destroy(); if(!data.Load("mob_proto.txt",'\t')) { - fprintf(stderr, "mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ) //2.2 Å©±â¿¡ ¸Â°Ô mob_table »ý¼º if (!m_vec_mobTable.empty()) { - sys_log(0, "RELOAD: mob_proto"); + SPDLOG_DEBUG("RELOAD: mob_proto"); m_vec_mobTable.clear(); } m_vec_mobTable.resize(data.m_File.GetRowCount()-1 + addNumber); @@ -378,7 +378,7 @@ bool CClientManager::InitializeMobTable() if (!Set_Proto_Mob_Table(mob_table, data, localMap)) { - fprintf(stderr, "¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } @@ -388,7 +388,7 @@ bool CClientManager::InitializeMobTable() vnumSet.insert(mob_table->dwVnum); - sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); + SPDLOG_TRACE("MOB #{:<5} {:24} {:24} level: {:<3} rank: {} empire: {}", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); ++mob_table; } @@ -402,7 +402,7 @@ bool CClientManager::InitializeMobTable() test_data; if(!test_data.Load("mob_proto_test.txt",'\t')) { - fprintf(stderr, "Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù.\n"); + SPDLOG_ERROR("Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù."); isTestFile = false; } if(isTestFile) { @@ -419,10 +419,10 @@ bool CClientManager::InitializeMobTable() if (!Set_Proto_Mob_Table(mob_table, test_data, localMap)) { - fprintf(stderr, "¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } - sys_log(0, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); + SPDLOG_DEBUG("MOB #{:<5} {:24} {:24} level: {:<3} rank: {} empire: {}", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); ++mob_table; } @@ -453,7 +453,7 @@ bool CClientManager::InitializeShopTable() if (!pRes2->uiNumRows) { - sys_err("InitializeShopTable : Table count is zero."); + SPDLOG_ERROR("InitializeShopTable : Table count is zero."); return false; } @@ -508,7 +508,7 @@ bool CClientManager::InitializeShopTable() while (it != map_shop.end()) { memcpy((m_pShopTable + i), (it++)->second, sizeof(TShopTable)); - sys_log(0, "SHOP: #%d items: %d", (m_pShopTable + i)->dwVnum, (m_pShopTable + i)->byItemCount); + SPDLOG_DEBUG("SHOP: #{} items: {}", (m_pShopTable + i)->dwVnum, (m_pShopTable + i)->byItemCount); ++i; } @@ -529,7 +529,7 @@ bool CClientManager::InitializeQuestItemTable() if (!pRes->uiNumRows) { - sys_err("query error or no rows: %s", query); + SPDLOG_ERROR("query error or no rows: {}", query); return false; } @@ -556,7 +556,7 @@ bool CClientManager::InitializeQuestItemTable() if (m_map_itemTableByVnum.find(tbl.dwVnum) != m_map_itemTableByVnum.end()) { - sys_err("QUEST_ITEM_ERROR! %lu vnum already exist! (name %s)", tbl.dwVnum, tbl.szLocaleName); + SPDLOG_ERROR("QUEST_ITEM_ERROR! {} vnum already exist! (name {})", tbl.dwVnum, tbl.szLocaleName); continue; } @@ -603,7 +603,7 @@ bool CClientManager::InitializeItemTable() cCsvTable nameData; if(!nameData.Load("item_names.txt",'\t')) { - fprintf(stderr, "item_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); isNameFile = false; } else { nameData.Next(); @@ -622,7 +622,7 @@ bool CClientManager::InitializeItemTable() cCsvTable test_data; if(!test_data.Load("item_proto_test.txt",'\t')) { - fprintf(stderr, "item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); //return false; } else { test_data.Next(); //¼³¸í ·Î¿ì ³Ñ¾î°¡±â. @@ -639,7 +639,7 @@ bool CClientManager::InitializeItemTable() if (!Set_Proto_Item_Table(test_item_table, test_data, localMap)) { - fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } test_map_itemTableByVnum.insert(std::map::value_type(test_item_table->dwVnum, test_item_table)); @@ -666,14 +666,14 @@ bool CClientManager::InitializeItemTable() cCsvTable data; if(!data.Load("item_proto.txt",'\t')) { - fprintf(stderr, "item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ) if (!m_vec_itemTable.empty()) { - sys_log(0, "RELOAD: item_proto"); + SPDLOG_DEBUG("RELOAD: item_proto"); m_vec_itemTable.clear(); m_map_itemTableByVnum.clear(); } @@ -693,7 +693,7 @@ bool CClientManager::InitializeItemTable() data.Destroy(); if(!data.Load("item_proto.txt",'\t')) { - fprintf(stderr, "item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ) @@ -715,7 +715,7 @@ bool CClientManager::InitializeItemTable() if (!Set_Proto_Item_Table(item_table, data, localMap)) { - fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } @@ -782,7 +782,7 @@ bool CClientManager::InitializeItemTable() test_data.Destroy(); if(!test_data.Load("item_proto_test.txt",'\t')) { - fprintf(stderr, "item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); //return false; } else { test_data.Next(); //¼³¸í ·Î¿ì ³Ñ¾î°¡±â. @@ -798,7 +798,7 @@ bool CClientManager::InitializeItemTable() if (!Set_Proto_Item_Table(item_table, test_data, localMap)) { - fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } @@ -823,7 +823,7 @@ bool CClientManager::InitializeItemTable() { TItemTable * item_table = &(*(it++)); - sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u", + SPDLOG_TRACE("ITEM: #{:<5} {:24} {:24} VAL: {} {} {} {} {} {} WEAR {} ANTI {} IMMUNE {} REFINE {} REFINE_SET {} MAGIC_PCT {}", item_table->dwVnum, item_table->szName, item_table->szLocaleName, @@ -865,13 +865,13 @@ bool CClientManager::InitializeSkillTable() if (!pRes->uiNumRows) { - sys_err("no result from skill_proto"); + SPDLOG_ERROR("no result from skill_proto"); return false; } if (!m_vec_skillTable.empty()) { - sys_log(0, "RELOAD: skill_proto"); + SPDLOG_DEBUG("RELOAD: skill_proto"); m_vec_skillTable.clear(); } @@ -929,7 +929,7 @@ bool CClientManager::InitializeSkillTable() str_to_number(t.bSkillAttrType, data[col++]); str_to_number(t.dwTargetRange, data[col++]); - sys_log(0, "SKILL: #%d %s flag %u point %s affect %u cooldown %s", t.dwVnum, t.szName, t.dwFlag, t.szPointOn, t.dwAffectFlag, t.szCooldownPoly); + SPDLOG_TRACE("SKILL: #{} {} flag {} point {} affect {} cooldown {}", t.dwVnum, t.szName, t.dwFlag, t.szPointOn, t.dwAffectFlag, t.szCooldownPoly); m_vec_skillTable.push_back(t); } @@ -961,7 +961,7 @@ bool CClientManager::InitializeBanwordTable() } } - sys_log(0, "BANWORD: total %d", m_vec_banwordTable.size()); + SPDLOG_DEBUG("BANWORD: total {}", m_vec_banwordTable.size()); return true; } @@ -977,13 +977,13 @@ bool CClientManager::InitializeItemAttrTable() if (!pRes->uiNumRows) { - sys_err("no result from item_attr"); + SPDLOG_ERROR("no result from item_attr"); return false; } if (!m_vec_itemAttrTable.empty()) { - sys_log(0, "RELOAD: item_attr"); + SPDLOG_DEBUG("RELOAD: item_attr"); m_vec_itemAttrTable.clear(); } @@ -1016,7 +1016,7 @@ bool CClientManager::InitializeItemAttrTable() str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_SHIELD], data[col++]); str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_EAR], data[col++]); - sys_log(0, "ITEM_ATTR: %-20s %4lu { %3d %3d %3d %3d %3d } { %d %d %d %d %d %d %d }", + SPDLOG_TRACE("ITEM_ATTR: {:20} {:4} ( {:3} {:3} {:3} {:3} {:3} ) ( {} {} {} {} {} {} {} )", t.szApply, t.dwProb, t.lValues[0], @@ -1051,13 +1051,13 @@ bool CClientManager::InitializeItemRareTable() if (!pRes->uiNumRows) { - sys_err("no result from item_attr_rare"); + SPDLOG_ERROR("no result from item_attr_rare"); return false; } if (!m_vec_itemRareTable.empty()) { - sys_log(0, "RELOAD: item_attr_rare"); + SPDLOG_DEBUG("RELOAD: item_attr_rare"); m_vec_itemRareTable.clear(); } @@ -1090,7 +1090,7 @@ bool CClientManager::InitializeItemRareTable() str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_SHIELD], data[col++]); str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_EAR], data[col++]); - sys_log(0, "ITEM_RARE: %-20s %4lu { %3d %3d %3d %3d %3d } { %d %d %d %d %d %d %d }", + SPDLOG_TRACE("ITEM_RARE: {:20} {:4} ( {:3} {:3} {:3} {:3} {:3} ) ( {} {} {} {} {} {} {} )", t.szApply, t.dwProb, t.lValues[0], @@ -1129,7 +1129,7 @@ bool CClientManager::InitializeLandTable() if (!m_vec_kLandTable.empty()) { - sys_log(0, "RELOAD: land"); + SPDLOG_DEBUG("RELOAD: land"); m_vec_kLandTable.clear(); } @@ -1156,7 +1156,7 @@ bool CClientManager::InitializeLandTable() str_to_number(t.bGuildLevelLimit, data[col++]); str_to_number(t.dwPrice, data[col++]); - sys_log(0, "LAND: %lu map %-4ld %7ldx%-7ld w %-4ld h %-4ld", t.dwID, t.lMapIndex, t.x, t.y, t.width, t.height); + SPDLOG_TRACE("LAND: {} map {:<4} {:7}x{:<7} w {:<4} h {:<4}", t.dwID, t.lMapIndex, t.x, t.y, t.width, t.height); m_vec_kLandTable.push_back(t); } @@ -1232,7 +1232,7 @@ bool CClientManager::InitializeObjectProto() if (!m_vec_kObjectProto.empty()) { - sys_log(0, "RELOAD: object_proto"); + SPDLOG_DEBUG("RELOAD: object_proto"); m_vec_kObjectProto.clear(); } @@ -1280,7 +1280,7 @@ bool CClientManager::InitializeObjectProto() t.lNPCY = std::max(t.lRegion[1], t.lRegion[3])+300; // END_OF_ADD_BUILDING_NPC - sys_log(0, "OBJ_PROTO: vnum %lu price %lu mat %lu %lu", + SPDLOG_TRACE("OBJ_PROTO: vnum {} price {} mat {} {}", t.dwVnum, t.dwPrice, t.kMaterials[0].dwItemVnum, t.kMaterials[0].dwCount); m_vec_kObjectProto.push_back(t); @@ -1301,7 +1301,7 @@ bool CClientManager::InitializeObjectTable() if (!m_map_pkObjectTable.empty()) { - sys_log(0, "RELOAD: object"); + SPDLOG_DEBUG("RELOAD: object"); m_map_pkObjectTable.clear(); } @@ -1327,7 +1327,7 @@ bool CClientManager::InitializeObjectTable() str_to_number(k->zRot, data[col++]); str_to_number(k->lLife, data[col++]); - sys_log(0, "OBJ: %lu vnum %lu map %-4ld %7ldx%-7ld life %ld", + SPDLOG_DEBUG("OBJ: {} vnum {} map {:<4} {:7}x{:<7} life {}", k->dwID, k->dwVnum, k->lMapIndex, k->x, k->y, k->lLife); m_map_pkObjectTable.insert(std::make_pair(k->dwID, k)); diff --git a/src/db/src/ClientManagerEventFlag.cpp b/src/db/src/ClientManagerEventFlag.cpp index 3f50203..1d6eb54 100644 --- a/src/db/src/ClientManagerEventFlag.cpp +++ b/src/db/src/ClientManagerEventFlag.cpp @@ -21,7 +21,7 @@ void CClientManager::LoadEventFlag() TPacketSetEventFlag p; strlcpy(p.szFlagName, row[0], sizeof(p.szFlagName)); str_to_number(p.lValue, row[1]); - sys_log(0, "EventFlag Load %s %d", p.szFlagName, p.lValue); + SPDLOG_DEBUG("EventFlag Load {} {}", p.szFlagName, p.lValue); m_map_lEventFlag.insert(std::make_pair(std::string(p.szFlagName), p.lValue)); ForwardPacket(HEADER_DG_SET_EVENT_FLAG, &p, sizeof(TPacketSetEventFlag)); } @@ -56,10 +56,10 @@ void CClientManager::SetEventFlag(TPacketSetEventFlag* p) //CDBManager::instance().ReturnQuery(szQuery, QID_QUEST_SAVE, 0, NULL); CDBManager::instance().AsyncQuery(szQuery); - sys_log(0, "HEADER_GD_SET_EVENT_FLAG : Changed CClientmanager::SetEventFlag(%s %d) ", p->szFlagName, p->lValue); + SPDLOG_DEBUG("HEADER_GD_SET_EVENT_FLAG : Changed CClientmanager::SetEventFlag({} {}) ", p->szFlagName, p->lValue); return; } - sys_log(0, "HEADER_GD_SET_EVENT_FLAG : No Changed CClientmanager::SetEventFlag(%s %d) ", p->szFlagName, p->lValue); + SPDLOG_DEBUG("HEADER_GD_SET_EVENT_FLAG : No Changed CClientmanager::SetEventFlag({} {}) ", p->szFlagName, p->lValue); } void CClientManager::SendEventFlagsOnSetup(CPeer* peer) diff --git a/src/db/src/ClientManagerGuild.cpp b/src/db/src/ClientManagerGuild.cpp index e65b6cb..b706c60 100644 --- a/src/db/src/ClientManagerGuild.cpp +++ b/src/db/src/ClientManagerGuild.cpp @@ -10,7 +10,7 @@ void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID) { - sys_log(0, "GuildCreate %u", dwGuildID); + SPDLOG_DEBUG("GuildCreate {}", dwGuildID); ForwardPacket(HEADER_DG_GUILD_LOAD, &dwGuildID, sizeof(DWORD)); CGuildManager::instance().Load(dwGuildID); @@ -18,14 +18,14 @@ void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID) void CClientManager::GuildChangeGrade(CPeer* peer, TPacketGuild* p) { - sys_log(0, "GuildChangeGrade %u %u", p->dwGuild, p->dwInfo); + SPDLOG_DEBUG("GuildChangeGrade {} {}", p->dwGuild, p->dwInfo); ForwardPacket(HEADER_DG_GUILD_CHANGE_GRADE, p, sizeof(TPacketGuild)); } void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p) { CGuildManager::instance().TouchGuild(p->dwGuild); - sys_log(0, "GuildAddMember %u %u", p->dwGuild, p->dwPID); + SPDLOG_DEBUG("GuildAddMember {} {}", p->dwGuild, p->dwPID); char szQuery[512]; @@ -42,7 +42,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p) if (pmsg->Get()->uiNumRows == 0) { - sys_err("Query failed when getting guild member data %s", pmsg->stQuery.c_str()); + SPDLOG_ERROR("Query failed when getting guild member data {}", pmsg->stQuery.c_str()); return; } @@ -67,7 +67,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p) void CClientManager::GuildRemoveMember(CPeer* peer, TPacketGuild* p) { - sys_log(0, "GuildRemoveMember %u %u", p->dwGuild, p->dwInfo); + SPDLOG_DEBUG("GuildRemoveMember {} {}", p->dwGuild, p->dwInfo); char szQuery[512]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_member%s WHERE pid=%u and guild_id=%u", GetTablePostfix(), p->dwInfo, p->dwGuild); @@ -81,25 +81,25 @@ void CClientManager::GuildRemoveMember(CPeer* peer, TPacketGuild* p) void CClientManager::GuildSkillUpdate(CPeer* peer, TPacketGuildSkillUpdate* p) { - sys_log(0, "GuildSkillUpdate %d", p->amount); + SPDLOG_DEBUG("GuildSkillUpdate {}", p->amount); ForwardPacket(HEADER_DG_GUILD_SKILL_UPDATE, p, sizeof(TPacketGuildSkillUpdate)); } void CClientManager::GuildExpUpdate(CPeer* peer, TPacketGuildExpUpdate* p) { - sys_log(0, "GuildExpUpdate %d", p->amount); + SPDLOG_DEBUG("GuildExpUpdate {}", p->amount); ForwardPacket(HEADER_DG_GUILD_EXP_UPDATE, p, sizeof(TPacketGuildExpUpdate), 0, peer); } void CClientManager::GuildChangeMemberData(CPeer* peer, TPacketGuildChangeMemberData* p) { - sys_log(0, "GuildChangeMemberData %u %u %d %d", p->pid, p->offer, p->level, p->grade); + SPDLOG_DEBUG("GuildChangeMemberData {} {} {} {}", p->pid, p->offer, p->level, p->grade); ForwardPacket(HEADER_DG_GUILD_CHANGE_MEMBER_DATA, p, sizeof(TPacketGuildChangeMemberData), 0, peer); } void CClientManager::GuildDisband(CPeer* peer, TPacketGuild* p) { - sys_log(0, "GuildDisband %u", p->dwGuild); + SPDLOG_DEBUG("GuildDisband {}", p->dwGuild); char szQuery[512]; @@ -141,12 +141,12 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p) switch (p->bWar) { case GUILD_WAR_SEND_DECLARE: - sys_log(0, "GuildWar: GUILD_WAR_SEND_DECLARE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_SEND_DECLARE type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().AddDeclare(p->bType, p->dwGuildFrom, p->dwGuildTo); break; case GUILD_WAR_REFUSE: - sys_log(0, "GuildWar: GUILD_WAR_REFUSE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_REFUSE type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo); break; /* @@ -160,10 +160,10 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p) */ case GUILD_WAR_WAIT_START: - sys_log(0, "GuildWar: GUILD_WAR_WAIT_START type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_WAIT_START type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); case GUILD_WAR_RESERVE: // ±æµåÀü ¿¹¾à if (p->bWar != GUILD_WAR_WAIT_START) - sys_log(0, "GuildWar: GUILD_WAR_RESERVE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_RESERVE type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo); if (!CGuildManager::instance().ReserveWar(p)) @@ -174,23 +174,23 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p) break; case GUILD_WAR_ON_WAR: // ±æµåÀüÀ» ½ÃÀÛ ½ÃŲ´Ù. (ÇʵåÀüÀº ¹Ù·Î ½ÃÀÛ µÊ) - sys_log(0, "GuildWar: GUILD_WAR_ON_WAR type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_ON_WAR type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().StartWar(p->bType, p->dwGuildFrom, p->dwGuildTo); break; case GUILD_WAR_OVER: // ±æµåÀü Á¤»ó Á¾·á - sys_log(0, "GuildWar: GUILD_WAR_OVER type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_OVER type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RecvWarOver(p->dwGuildFrom, p->dwGuildTo, p->bType, p->lWarPrice); break; case GUILD_WAR_END: // ±æµåÀü ºñÁ¤»ó Á¾·á - sys_log(0, "GuildWar: GUILD_WAR_END type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_END type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RecvWarEnd(p->dwGuildFrom, p->dwGuildTo); return; // NOTE: RecvWarEnd¿¡¼­ ÆÐŶÀ» º¸³»¹Ç·Î µû·Î ºê·Îµåij½ºÆà ÇÏÁö ¾Ê´Â´Ù. case GUILD_WAR_CANCEL : - sys_log(0, "GuildWar: GUILD_WAR_CANCEL type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_CANCEL type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().CancelWar(p->dwGuildFrom, p->dwGuildTo); break; } @@ -205,20 +205,20 @@ void CClientManager::GuildWarScore(CPeer* peer, TPacketGuildWarScore * p) void CClientManager::GuildChangeLadderPoint(TPacketGuildLadderPoint* p) { - sys_log(0, "GuildChangeLadderPoint Recv %u %d", p->dwGuild, p->lChange); + SPDLOG_DEBUG("GuildChangeLadderPoint Recv {} {}", p->dwGuild, p->lChange); CGuildManager::instance().ChangeLadderPoint(p->dwGuild, p->lChange); } void CClientManager::GuildUseSkill(TPacketGuildUseSkill* p) { - sys_log(0, "GuildUseSkill Recv %u %d", p->dwGuild, p->dwSkillVnum); + SPDLOG_DEBUG("GuildUseSkill Recv {} {}", p->dwGuild, p->dwSkillVnum); CGuildManager::instance().UseSkill(p->dwGuild, p->dwSkillVnum, p->dwCooltime); SendGuildSkillUsable(p->dwGuild, p->dwSkillVnum, false); } void CClientManager::SendGuildSkillUsable(DWORD guild_id, DWORD dwSkillVnum, bool bUsable) { - sys_log(0, "SendGuildSkillUsable Send %u %d %s", guild_id, dwSkillVnum, bUsable?"true":"false"); + SPDLOG_DEBUG("SendGuildSkillUsable Send {} {} {}", guild_id, dwSkillVnum, bUsable?"true":"false"); TPacketGuildSkillUsableChange p; diff --git a/src/db/src/ClientManagerLogin.cpp b/src/db/src/ClientManagerLogin.cpp index a27539f..280dc4e 100644 --- a/src/db/src/ClientManagerLogin.cpp +++ b/src/db/src/ClientManagerLogin.cpp @@ -11,7 +11,6 @@ extern std::string g_stLocale; extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab); extern int g_test_server; -extern int g_log; bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP) { @@ -49,7 +48,7 @@ bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle) if (pkLD->GetConnectedPeerHandle() != dwHandle) { - sys_err("%s tried to logout in other peer handle %lu, current handle %lu", szLogin, dwHandle, pkLD->GetConnectedPeerHandle()); + SPDLOG_ERROR("{} tried to logout in other peer handle {}, current handle {}", szLogin, dwHandle, pkLD->GetConnectedPeerHandle()); return false; } @@ -87,7 +86,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG if (!pkLoginData) { - sys_log(0, "LOGIN_BY_KEY key not exist %s %lu", szLogin, p->dwLoginKey); + SPDLOG_DEBUG("LOGIN_BY_KEY key not exist {} {}", szLogin, p->dwLoginKey); pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle); return; } @@ -96,7 +95,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG if (FindLogonAccount(r.login)) { - sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey); + SPDLOG_DEBUG("LOGIN_BY_KEY already login {} {}", r.login, p->dwLoginKey); TPacketDGLoginAlready ptog; strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin)); pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready)); @@ -106,7 +105,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG if (strcasecmp(r.login, szLogin)) { - sys_log(0, "LOGIN_BY_KEY login differ %s %lu input %s", r.login, p->dwLoginKey, szLogin); + SPDLOG_DEBUG("LOGIN_BY_KEY login differ {} {} input {}", r.login, p->dwLoginKey, szLogin); pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle); return; } @@ -115,7 +114,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG { const DWORD * pdwClientKey = pkLoginData->GetClientKey(); - sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu", + SPDLOG_DEBUG("LOGIN_BY_KEY client key differ {} {} {} {} {}, {} {} {} {}", r.login, p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3], pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[3]); @@ -137,7 +136,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG info->pAccountTable = pkTab; strlcpy(info->ip, p->szIP, sizeof(info->ip)); - sys_log(0, "LOGIN_BY_KEY success %s %lu %s", r.login, p->dwLoginKey, info->ip); + SPDLOG_DEBUG("LOGIN_BY_KEY success {} {} {}", r.login, p->dwLoginKey, info->ip); char szQuery[QUERY_MAX_LEN]; snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id); CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info); @@ -164,11 +163,11 @@ void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg) snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id); std::unique_ptr pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER)); - sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id); + SPDLOG_DEBUG("RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:{}", account_id); if (pMsg->Get()->uiNumRows == 0) { - sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id); + SPDLOG_DEBUG("RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:{}", account_id); // PLAYER_INDEX_CREATE_BUG_FIX //snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id); @@ -332,14 +331,14 @@ void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab) str_to_number(pkTab->players[j].bChangeName, row[col++]); } - sys_log(0, "%s %lu %lu hair %u", + SPDLOG_DEBUG("{} {} {} hair {}", pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart); break; } } /* if (j == PLAYER_PER_ACCOUNT) - sys_err("cannot find player_id on this account (login: %s id %lu account %lu %lu %lu)", + SPDLOG_ERROR("cannot find player_id on this account (login: {} id {} account {} {} {})", pkTab->login, player_id, pkTab->players[0].dwID, pkTab->players[1].dwID, @@ -358,7 +357,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) // °èÁ¤ÀÌ ¾ø³×? if (msg->Get()->uiNumRows == 0) { - sys_log(0, "RESULT_LOGIN: no account"); + SPDLOG_DEBUG("RESULT_LOGIN: no account"); peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0); delete info; return; @@ -368,7 +367,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) if (!info->pAccountTable) { - sys_log(0, "RESULT_LOGIN: no account : WRONG_PASSWD"); + SPDLOG_DEBUG("RESULT_LOGIN: no account : WRONG_PASSWD"); peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle); delete info; } @@ -407,7 +406,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) // ´Ù¸¥ ÄÁ³Ø¼ÇÀÌ ÀÌ¹Ì ·Î±×ÀÎ Çعö·È´Ù¸é.. ÀÌ¹Ì Á¢¼ÓÇß´Ù°í º¸³»¾ß ÇÑ´Ù. if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip)) { - sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login); + SPDLOG_DEBUG("RESULT_LOGIN: already logon {}", info->pAccountTable->login); TPacketDGLoginAlready p; strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin)); @@ -417,7 +416,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) } else { - sys_log(0, "RESULT_LOGIN: login success %s rows: %lu", info->pAccountTable->login, msg->Get()->uiNumRows); + SPDLOG_DEBUG("RESULT_LOGIN: login success {} rows: {}", info->pAccountTable->login, msg->Get()->uiNumRows); if (msg->Get()->uiNumRows > 0) CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable); @@ -456,23 +455,20 @@ void CClientManager::QUERY_LOGOUT(CPeer * peer, DWORD dwHandle,const char * data { if (pLoginData->GetAccountRef().players[n].dwID == 0) { - if (g_test_server) - sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID); + SPDLOG_TRACE("LOGOUT {} {}", packet->login, pLoginData->GetAccountRef().players[n].dwID); continue; } pid[n] = pLoginData->GetAccountRef().players[n].dwID; - if (g_log) - sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]); + SPDLOG_TRACE("LOGOUT InsertLogoutPlayer {} {}", packet->login, pid[n]); InsertLogoutPlayer(pid[n]); } if (DeleteLogonAccount(packet->login, peer->GetHandle())) { - if (g_log) - sys_log(0, "LOGOUT %s ", packet->login); + SPDLOG_TRACE("LOGOUT {} ", packet->login); } } diff --git a/src/db/src/ClientManagerParty.cpp b/src/db/src/ClientManagerParty.cpp index 2e719a6..6065d80 100644 --- a/src/db/src/ClientManagerParty.cpp +++ b/src/db/src/ClientManagerParty.cpp @@ -13,11 +13,11 @@ void CClientManager::QUERY_PARTY_CREATE(CPeer* peer, TPacketPartyCreate* p) { pm.insert(make_pair(p->dwLeaderPID, TPartyMember())); ForwardPacket(HEADER_DG_PARTY_CREATE, p, sizeof(TPacketPartyCreate), peer->GetChannel(), peer); - sys_log(0, "PARTY Create [%lu]", p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Create [{}]", p->dwLeaderPID); } else { - sys_err("PARTY Create - Already exists [%lu]", p->dwLeaderPID); + SPDLOG_ERROR("PARTY Create - Already exists [{}]", p->dwLeaderPID); } } @@ -28,13 +28,13 @@ void CClientManager::QUERY_PARTY_DELETE(CPeer* peer, TPacketPartyDelete* p) if (it == pm.end()) { - sys_err("PARTY Delete - Non exists [%lu]", p->dwLeaderPID); + SPDLOG_ERROR("PARTY Delete - Non exists [{}]", p->dwLeaderPID); return; } pm.erase(it); ForwardPacket(HEADER_DG_PARTY_DELETE, p, sizeof(TPacketPartyDelete), peer->GetChannel(), peer); - sys_log(0, "PARTY Delete [%lu]", p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Delete [{}]", p->dwLeaderPID); } void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p) @@ -44,7 +44,7 @@ void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p) if (it == pm.end()) { - sys_err("PARTY Add - Non exists [%lu]", p->dwLeaderPID); + SPDLOG_ERROR("PARTY Add - Non exists [{}]", p->dwLeaderPID); return; } @@ -52,10 +52,10 @@ void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p) { it->second.insert(std::make_pair(p->dwPID, TPartyInfo())); ForwardPacket(HEADER_DG_PARTY_ADD, p, sizeof(TPacketPartyAdd), peer->GetChannel(), peer); - sys_log(0, "PARTY Add [%lu] to [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Add [{}] to [{}]", p->dwPID, p->dwLeaderPID); } else - sys_err("PARTY Add - Already [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY Add - Already [{}] in party [{}]", p->dwPID, p->dwLeaderPID); } void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p) @@ -65,7 +65,7 @@ void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p) if (it == pm.end()) { - sys_err("PARTY Remove - Non exists [%lu] cannot remove [%lu]",p->dwLeaderPID, p->dwPID); + SPDLOG_ERROR("PARTY Remove - Non exists [{}] cannot remove [{}]",p->dwLeaderPID, p->dwPID); return; } @@ -75,10 +75,10 @@ void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p) { it->second.erase(pit); ForwardPacket(HEADER_DG_PARTY_REMOVE, p, sizeof(TPacketPartyRemove), peer->GetChannel(), peer); - sys_log(0, "PARTY Remove [%lu] to [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Remove [{}] to [{}]", p->dwPID, p->dwLeaderPID); } else - sys_err("PARTY Remove - Cannot find [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY Remove - Cannot find [{}] in party [{}]", p->dwPID, p->dwLeaderPID); } void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChange* p) @@ -88,7 +88,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan if (it == pm.end()) { - sys_err("PARTY StateChange - Non exists [%lu] cannot state change [%lu]",p->dwLeaderPID, p->dwPID); + SPDLOG_ERROR("PARTY StateChange - Non exists [{}] cannot state change [{}]",p->dwLeaderPID, p->dwPID); return; } @@ -96,7 +96,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan if (pit == it->second.end()) { - sys_err("PARTY StateChange - Cannot find [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY StateChange - Cannot find [{}] in party [{}]", p->dwPID, p->dwLeaderPID); return; } @@ -106,7 +106,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan pit->second.bRole = 0; ForwardPacket(HEADER_DG_PARTY_STATE_CHANGE, p, sizeof(TPacketPartyStateChange), peer->GetChannel(), peer); - sys_log(0, "PARTY StateChange [%lu] at [%lu] from %d %d",p->dwPID, p->dwLeaderPID, p->bRole, p->bFlag); + SPDLOG_DEBUG("PARTY StateChange [{}] at [{}] from {} {}",p->dwPID, p->dwLeaderPID, p->bRole, p->bFlag); } void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMemberLevel* p) @@ -116,7 +116,7 @@ void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMe if (it == pm.end()) { - sys_err("PARTY SetMemberLevel - Non exists [%lu] cannot level change [%lu]",p->dwLeaderPID, p->dwPID); + SPDLOG_ERROR("PARTY SetMemberLevel - Non exists [{}] cannot level change [{}]",p->dwLeaderPID, p->dwPID); return; } @@ -124,12 +124,12 @@ void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMe if (pit == it->second.end()) { - sys_err("PARTY SetMemberLevel - Cannot find [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY SetMemberLevel - Cannot find [{}] in party [{}]", p->dwPID, p->dwLeaderPID); return; } pit->second.bLevel = p->bLevel; ForwardPacket(HEADER_DG_PARTY_SET_MEMBER_LEVEL, p, sizeof(TPacketPartySetMemberLevel), peer->GetChannel()); - sys_log(0, "PARTY SetMemberLevel pid [%lu] level %d",p->dwPID, p->bLevel); + SPDLOG_DEBUG("PARTY SetMemberLevel pid [{}] level {}",p->dwPID, p->bLevel); } diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index fc2af0c..944da6e 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -13,7 +13,6 @@ extern bool g_bHotBackup; extern std::string g_stLocale; extern int g_test_server; -extern int g_log; // // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -236,7 +235,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad if (!pkLD || pkLD->IsPlay()) { - sys_log(0, "PLAYER_LOAD_ERROR: LoginData %p IsPlay %d", pkLD, pkLD ? pkLD->IsPlay() : 0); + SPDLOG_DEBUG("PLAYER_LOAD_ERROR: LoginData {} IsPlay {}", (void*) pkLD, pkLD ? pkLD->IsPlay() : 0); peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_FAILED, dwHandle, 0); return; } @@ -265,7 +264,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad TItemCacheSet * pSet = GetItemCacheSet(pTab->id); - sys_log(0, "[PLAYER_LOAD] ID %s pid %d gold %d ", pTab->name, pTab->id, pTab->gold); + SPDLOG_DEBUG("[PLAYER_LOAD] ID {} pid {} gold {} ", pTab->name, pTab->id, pTab->gold); //-------------------------------------------- // ¾ÆÀÌÅÛ & AFFECT & QUEST ·Îµù : @@ -293,8 +292,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad memcpy(&s_items[dwCount++], p, sizeof(TPlayerItem)); } - if (g_test_server) - sys_log(0, "ITEM_CACHE: HIT! %s count: %u", pTab->name, dwCount); + SPDLOG_TRACE("ITEM_CACHE: HIT! {} count: {}", pTab->name, dwCount); peer->EncodeHeader(HEADER_DG_ITEM_LOAD, dwHandle, sizeof(DWORD) + sizeof(TPlayerItem) * dwCount); peer->EncodeDWORD(dwCount); @@ -354,7 +352,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad //---------------------------------- else { - sys_log(0, "[PLAYER_LOAD] Load from PlayerDB pid[%d]", packet->player_id); + SPDLOG_DEBUG("[PLAYER_LOAD] Load from PlayerDB pid[{}]", packet->player_id); char queryStr[QUERY_MAX_LEN]; @@ -554,26 +552,26 @@ void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD MYSQL_RES * pSQLResult = pMsg->Get()->pSQLResult; if (!pSQLResult) { - sys_err("null MYSQL_RES QID %u", dwQID); + SPDLOG_ERROR("null MYSQL_RES QID {}", dwQID); return; } switch (dwQID) { case QID_PLAYER: - sys_log(0, "QID_PLAYER %u %u", info->dwHandle, info->player_id); + SPDLOG_DEBUG("QID_PLAYER {} {}", info->dwHandle, info->player_id); RESULT_PLAYER_LOAD(peer, pSQLResult, info.get()); break; case QID_ITEM: - sys_log(0, "QID_ITEM %u", info->dwHandle); + SPDLOG_DEBUG("QID_ITEM {}", info->dwHandle); RESULT_ITEM_LOAD(peer, pSQLResult, info->dwHandle, info->player_id); break; case QID_QUEST: { - sys_log(0, "QID_QUEST %u", info->dwHandle); + SPDLOG_DEBUG("QID_QUEST {}", info->dwHandle); RESULT_QUEST_LOAD(peer, pSQLResult, info->dwHandle, info->player_id); //aid¾ò±â ClientHandleInfo* temp1 = info.get(); @@ -586,42 +584,42 @@ void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD break; if( pLoginData1 == NULL ) break; - sys_log(0,"info of pLoginData1 before call ItemAwardfunction %d",pLoginData1); + SPDLOG_DEBUG("info of pLoginData1 before call ItemAwardfunction {}", (void*) pLoginData1); ItemAward(peer,pLoginData1->GetAccountRef().login); } break; case QID_AFFECT: - sys_log(0, "QID_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_AFFECT {}", info->dwHandle); RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle); break; /* case QID_PLAYER_ITEM_QUEST_AFFECT: - sys_log(0, "QID_PLAYER_ITEM_QUEST_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_PLAYER_ITEM_QUEST_AFFECT {}", info->dwHandle); RESULT_PLAYER_LOAD(peer, pSQLResult, info->dwHandle); if (!pMsg->Next()) { - sys_err("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: ITEM FAILED"); + SPDLOG_ERROR("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: ITEM FAILED"); return; } case QID_ITEM_QUEST_AFFECT: - sys_log(0, "QID_ITEM_QUEST_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_ITEM_QUEST_AFFECT {}", info->dwHandle); RESULT_ITEM_LOAD(peer, pSQLResult, info->dwHandle, info->player_id); if (!pMsg->Next()) { - sys_err("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: QUEST FAILED"); + SPDLOG_ERROR("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: QUEST FAILED"); return; } case QID_QUEST_AFFECT: - sys_log(0, "QID_QUEST_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_QUEST_AFFECT {}", info->dwHandle); RESULT_QUEST_LOAD(peer, pSQLResult, info->dwHandle); if (!pMsg->Next()) - sys_err("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: AFFECT FAILED"); + SPDLOG_ERROR("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: AFFECT FAILED"); else RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle); @@ -645,7 +643,7 @@ void CClientManager::RESULT_PLAYER_LOAD(CPeer * peer, MYSQL_RES * pRes, ClientHa if (!pkLD || pkLD->IsPlay()) { - sys_log(0, "PLAYER_LOAD_ERROR: LoginData %p IsPlay %d", pkLD, pkLD ? pkLD->IsPlay() : 0); + SPDLOG_DEBUG("PLAYER_LOAD_ERROR: LoginData {} IsPlay {}", (void*) pkLD, pkLD ? pkLD->IsPlay() : 0); peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_FAILED, pkInfo->dwHandle, 0); return; } @@ -683,7 +681,7 @@ void CClientManager::RESULT_ITEM_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwHa CreateItemCacheSet(dwPID); // ITEM_LOAD_LOG_ATTACH_PID - sys_log(0, "ITEM_LOAD: count %u pid %u", dwCount, dwPID); + SPDLOG_DEBUG("ITEM_LOAD: count {} pid {}", dwCount, dwPID); // END_OF_ITEM_LOAD_LOG_ATTACH_PID if (dwCount) @@ -725,7 +723,7 @@ void CClientManager::RESULT_AFFECT_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dw str_to_number(r.lSPCost, row[6]); } - sys_log(0, "AFFECT_LOAD: count %d PID %u", s_elements.size(), dwPID); + SPDLOG_DEBUG("AFFECT_LOAD: count {} PID {}", s_elements.size(), dwPID); DWORD dwCount = s_elements.size(); @@ -764,7 +762,7 @@ void CClientManager::RESULT_QUEST_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwH str_to_number(r.lValue, row[3]); } - sys_log(0, "QUEST_LOAD: count %d PID %u", s_table.size(), s_table[0].dwPID); + SPDLOG_DEBUG("QUEST_LOAD: count {} PID {}", s_table.size(), s_table[0].dwPID); DWORD dwCount = s_table.size(); @@ -778,8 +776,7 @@ void CClientManager::RESULT_QUEST_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwH */ void CClientManager::QUERY_PLAYER_SAVE(CPeer * peer, DWORD dwHandle, TPlayerTable * pkTab) { - if (g_test_server) - sys_log(0, "PLAYER_SAVE: %s", pkTab->name); + SPDLOG_TRACE("PLAYER_SAVE: {}", pkTab->name); PutPlayerCache(pkTab); } @@ -829,7 +826,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC if (row[0] && dwPID > 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); - sys_log(0, "ALREADY EXIST AccountChrIdx %d ID %d", packet->account_index, dwPID); + SPDLOG_DEBUG("ALREADY EXIST AccountChrIdx {} ID {}", packet->account_index, dwPID); return; } } @@ -861,7 +858,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC if (*row[0] != '0') { - sys_log(0, "ALREADY EXIST name %s, row[0] %s query %s", packet->player_table.name, row[0], queryStr); + SPDLOG_DEBUG("ALREADY EXIST name {}, row[0] {} query {}", packet->player_table.name, row[0], queryStr); peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); return; } @@ -886,7 +883,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC packet->player_table.job, packet->player_table.voice, packet->player_table.dir, packet->player_table.x, packet->player_table.y, packet->player_table.z, packet->player_table.hp, packet->player_table.sp, packet->player_table.sRandomHP, packet->player_table.sRandomSP, packet->player_table.stat_point, packet->player_table.stamina, packet->player_table.part_base, packet->player_table.part_base, packet->player_table.gold); - sys_log(0, "PlayerCreate accountid %d name %s level %d gold %d, st %d ht %d job %d", + SPDLOG_DEBUG("PlayerCreate accountid {} name {} level {} gold {}, st {} ht {} job {}", packet->account_id, packet->player_table.name, packet->player_table.level, @@ -899,20 +896,18 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC CDBManager::instance().EscapeString(text, packet->player_table.skills, sizeof(packet->player_table.skills)); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s', ", text); - if (g_test_server) - sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); + SPDLOG_TRACE("Create_Player queryLen[{}] TEXT[{}]", queryLen, text); CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot)); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text); std::unique_ptr pMsg2(CDBManager::instance().DirectQuery(queryStr)); - if (g_test_server) - sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); + SPDLOG_TRACE("Create_Player queryLen[{}] TEXT[{}]", queryLen, text); if (pMsg2->Get()->uiAffectedRows <= 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); - sys_log(0, "ALREADY EXIST3 query: %s AffectedRows %lu", queryStr, pMsg2->Get()->uiAffectedRows); + SPDLOG_DEBUG("ALREADY EXIST3 query: {} AffectedRows {}", queryStr, pMsg2->Get()->uiAffectedRows); return; } @@ -924,7 +919,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC if (pMsg3->Get()->uiAffectedRows <= 0) { - sys_err("QUERY_ERROR: %s", queryStr); + SPDLOG_ERROR("QUERY_ERROR: {}", queryStr); snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), player_id); CDBManager::instance().DirectQuery(queryStr); @@ -954,7 +949,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_SUCCESS, dwHandle, sizeof(TPacketDGCreateSuccess)); peer->Encode(&pack, sizeof(TPacketDGCreateSuccess)); - sys_log(0, "7 name %s job %d", pack.player.szName, pack.player.byJob); + SPDLOG_DEBUG("7 name {} job {}", pack.player.szName, pack.player.byJob); s_createTimeByAccountID[packet->account_id] = time(0); } @@ -985,7 +980,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD { if (strlen(r.social_id) < 7 || strncmp(packet->private_code, r.social_id + strlen(r.social_id) - 7, 7)) { - sys_log(0, "PLAYER_DELETE FAILED len(%d)", strlen(r.social_id)); + SPDLOG_DEBUG("PLAYER_DELETE FAILED len({})", strlen(r.social_id)); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1); peer->EncodeBYTE(packet->account_index); return; @@ -998,7 +993,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD if (pTab->level >= m_iPlayerDeleteLevelLimit) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u >= DELETE LIMIT %d", pTab->level, m_iPlayerDeleteLevelLimit); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} >= DELETE LIMIT {}", pTab->level, m_iPlayerDeleteLevelLimit); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1); peer->EncodeBYTE(packet->account_index); return; @@ -1006,7 +1001,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD if (pTab->level < m_iPlayerDeleteLevelLimitLower) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u < DELETE LIMIT %d", pTab->level, m_iPlayerDeleteLevelLimitLower); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} < DELETE LIMIT {}", pTab->level, m_iPlayerDeleteLevelLimitLower); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1); peer->EncodeBYTE(packet->account_index); return; @@ -1022,7 +1017,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD ClientHandleInfo * pi = new ClientHandleInfo(dwHandle, packet->player_id); pi->account_index = packet->account_index; - sys_log(0, "PLAYER_DELETE TRY: %s %d pid%d", packet->login, packet->player_id, packet->account_index + 1); + SPDLOG_DEBUG("PLAYER_DELETE TRY: {} {} pid{}", packet->login, packet->player_id, packet->account_index + 1); CDBManager::instance().ReturnQuery(szQuery, QID_PLAYER_DELETE, peer->GetHandle(), pi); } @@ -1049,7 +1044,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (deletedLevelLimit >= m_iPlayerDeleteLevelLimit && !IsChinaEventServer()) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u >= DELETE LIMIT %d", deletedLevelLimit, m_iPlayerDeleteLevelLimit); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} >= DELETE LIMIT {}", deletedLevelLimit, m_iPlayerDeleteLevelLimit); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); return; @@ -1057,7 +1052,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (deletedLevelLimit < m_iPlayerDeleteLevelLimitLower) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u < DELETE LIMIT %d", deletedLevelLimit, m_iPlayerDeleteLevelLimitLower); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} < DELETE LIMIT {}", deletedLevelLimit, m_iPlayerDeleteLevelLimitLower); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); return; @@ -1071,7 +1066,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "PLAYER_DELETE FAILED %u CANNOT INSERT TO player%s_deleted", dwPID, GetTablePostfix()); + SPDLOG_DEBUG("PLAYER_DELETE FAILED {} CANNOT INSERT TO player{}_deleted", dwPID, GetTablePostfix()); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); @@ -1079,7 +1074,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) } // »èÁ¦ ¼º°ø - sys_log(0, "PLAYER_DELETE SUCCESS %u", dwPID); + SPDLOG_DEBUG("PLAYER_DELETE SUCCESS {}", dwPID); char account_index_string[16]; @@ -1123,7 +1118,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (pMsg->Get()->uiAffectedRows == 0 || pMsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "PLAYER_DELETE FAIL WHEN UPDATE account table"); + SPDLOG_DEBUG("PLAYER_DELETE FAIL WHEN UPDATE account table"); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); return; @@ -1158,7 +1153,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) else { // »èÁ¦ ½ÇÆÐ - sys_log(0, "PLAYER_DELETE FAIL NO ROW"); + SPDLOG_DEBUG("PLAYER_DELETE FAIL NO ROW"); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); } @@ -1217,7 +1212,7 @@ void CClientManager::QUERY_HIGHSCORE_REGISTER(CPeer* peer, TPacketGDHighscore * char szQuery[128]; snprintf(szQuery, sizeof(szQuery), "SELECT value FROM highscore%s WHERE board='%s' AND pid = %u", GetTablePostfix(), data->szBoard, data->dwPID); - sys_log(0, "HEADER_GD_HIGHSCORE_REGISTER: PID %u", data->dwPID); + SPDLOG_DEBUG("HEADER_GD_HIGHSCORE_REGISTER: PID {}", data->dwPID); ClientHandleInfo * pi = new ClientHandleInfo(0); strlcpy(pi->login, data->szBoard, sizeof(pi->login)); @@ -1289,8 +1284,7 @@ void CClientManager::InsertLogoutPlayer(DWORD pid) if (it != m_map_logout.end()) { // Á¸ÀçÇÒ°æ¿ì ½Ã°£¸¸ °»½Å - if (g_log) - sys_log(0, "LOGOUT: Update player time pid(%d)", pid); + SPDLOG_TRACE("LOGOUT: Update player time pid({})", pid); it->second->time = time(0); return; @@ -1301,8 +1295,7 @@ void CClientManager::InsertLogoutPlayer(DWORD pid) pLogout->time = time(0); m_map_logout.insert(std::make_pair(pid, pLogout)); - if (g_log) - sys_log(0, "LOGOUT: Insert player pid(%d)", pid); + SPDLOG_TRACE("LOGOUT: Insert player pid({})", pid); } void CClientManager::DeleteLogoutPlayer(DWORD pid) diff --git a/src/db/src/Config.cpp b/src/db/src/Config.cpp index d35633b..216f122 100644 --- a/src/db/src/Config.cpp +++ b/src/db/src/Config.cpp @@ -171,7 +171,7 @@ bool CConfig::GetParam(const char*key, int index, DWORD *Param) str_to_number(*Param, szParam[index]); - sys_log(0, "GetParam %d", *Param); + SPDLOG_DEBUG("GetParam {}", *Param); return true; } const char * CConfig::Get(const char* key) diff --git a/src/db/src/DBManager.cpp b/src/db/src/DBManager.cpp index bc8c402..663021a 100644 --- a/src/db/src/DBManager.cpp +++ b/src/db/src/DBManager.cpp @@ -137,7 +137,7 @@ extern int g_query_count[2]; void CDBManager::ReturnQuery(const char * c_pszQuery, int iType, IDENT dwIdent, void * udata, int iSlot) { assert(iSlot < SQL_MAX_NUM); - //sys_log(0, "ReturnQuery %s", c_pszQuery); + //SPDLOG_DEBUG("ReturnQuery {}", c_pszQuery); CQueryInfo * p = new CQueryInfo; p->iType = iType; diff --git a/src/db/src/GuildManager.cpp b/src/db/src/GuildManager.cpp index f3cd6d4..75c08e1 100644 --- a/src/db/src/GuildManager.cpp +++ b/src/db/src/GuildManager.cpp @@ -145,8 +145,8 @@ void CGuildManager::ParseResult(SQLResult * pRes) str_to_number(r_info.gold, row[6]); str_to_number(r_info.level, row[7]); - sys_log(0, - "GuildWar: %-24s ladder %-5d win %-3d draw %-3d loss %-3d", + SPDLOG_DEBUG( + "GuildWar: {:24} ladder {:<5} win {:<3} draw {:<3} loss {:<3}", r_info.szName, r_info.ladder_point, r_info.win, @@ -170,17 +170,17 @@ void CGuildManager::Initialize() *str = '\0'; if (!polyPower.Analyze(str)) - sys_err("cannot set power poly: %s", str); + SPDLOG_ERROR("cannot set power poly: {}", str); else - sys_log(0, "POWER_POLY: %s", str); + SPDLOG_DEBUG("POWER_POLY: {}", str); if (!CConfig::instance().GetValue("POLY_HANDICAP", str, sizeof(str))) *str = '\0'; if (!polyHandicap.Analyze(str)) - sys_err("cannot set handicap poly: %s", str); + SPDLOG_ERROR("cannot set handicap poly: {}", str); else - sys_log(0, "HANDICAP_POLY: %s", str); + SPDLOG_DEBUG("HANDICAP_POLY: {}", str); QueryRanking(); } @@ -234,7 +234,7 @@ void CGuildManager::ResultRanking(MYSQL_RES * pRes) if (iLadderPoint != iLastLadderPoint) ++iRank; - sys_log(0, "GUILD_RANK: %-24s %2d %d", row[1], iRank, iLadderPoint); + SPDLOG_DEBUG("GUILD_RANK: {:24} {:2} {}", row[1], iRank, iLadderPoint); map_kLadderPointRankingByGID.insert(std::make_pair(dwGID, iRank)); } @@ -250,7 +250,7 @@ void CGuildManager::Update() { // UNKNOWN_GUILD_MANAGE_UPDATE_LOG /* - sys_log(0, "GuildManager::Update size %d now %d top %d, %s(%u) vs %s(%u)", + SPDLOG_DEBUG("GuildManager::Update size {} now {} top {}, {}({}) vs {}({})", m_WarMap.size(), now, m_pqOnWar.top().first, @@ -307,7 +307,7 @@ void CGuildManager::Update() p.dwGuildTo = ws.GID[1]; CClientManager::instance().ForwardPacket(HEADER_DG_GUILD_WAR, &p, sizeof(p)); - sys_log(0, "GuildWar: GUILD sending start of wait start war %d %d", ws.GID[0], ws.GID[1]); + SPDLOG_DEBUG("GuildWar: GUILD sending start of wait start war {} {}", ws.GID[0], ws.GID[1]); } } @@ -402,7 +402,7 @@ bool CGuildManager::IsHalfWinLadderPoint(DWORD dwGuildWinner, DWORD dwGuildLoser void CGuildManager::ProcessDraw(DWORD dwGuildID1, DWORD dwGuildID2) { - sys_log(0, "GuildWar: \tThe war between %d and %d is ended in draw", dwGuildID1, dwGuildID2); + SPDLOG_DEBUG("GuildWar: \tThe war between {} and {} is ended in draw", dwGuildID1, dwGuildID2); GuildWarDraw(dwGuildID1); GuildWarDraw(dwGuildID2); @@ -416,7 +416,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser) { GuildWarWin(dwGuildWinner); GuildWarLose(dwGuildLoser); - sys_log(0, "GuildWar: \tWinner : %d Loser : %d", dwGuildWinner, dwGuildLoser); + SPDLOG_DEBUG("GuildWar: \tWinner : {} Loser : {}", dwGuildWinner, dwGuildLoser); int iPoint = GetLadderPoint(dwGuildLoser); int gain = (int)(iPoint * 0.05); @@ -425,7 +425,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser) if (IsHalfWinLadderPoint(dwGuildWinner, dwGuildLoser)) gain /= 2; - sys_log(0, "GuildWar: \tgain : %d loss : %d", gain, loss); + SPDLOG_DEBUG("GuildWar: \tgain : {} loss : {}", gain, loss); ChangeLadderPoint(dwGuildWinner, gain); ChangeLadderPoint(dwGuildLoser, -loss); @@ -435,7 +435,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser) void CGuildManager::RemoveWar(DWORD GID1, DWORD GID2) { - sys_log(0, "GuildWar: RemoveWar(%d, %d)", GID1, GID2); + SPDLOG_DEBUG("GuildWar: RemoveWar({}, {})", GID1, GID2); if (GID1 > GID2) std::swap(GID2, GID1); @@ -469,13 +469,13 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw) if (GID1 > GID2) std::swap(GID2, GID1); - sys_log(0, "GuildWar: WarEnd %d %d", GID1, GID2); + SPDLOG_DEBUG("GuildWar: WarEnd {} {}", GID1, GID2); itertype(m_WarMap[GID1]) itWarMap = m_WarMap[GID1].find(GID2); if (itWarMap == m_WarMap[GID1].end()) { - sys_err("GuildWar: war not exist or already ended. [1]"); + SPDLOG_ERROR("GuildWar: war not exist or already ended. [1]"); return; } @@ -484,7 +484,7 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw) if (!pData || pData->bEnd) { - sys_err("GuildWar: war not exist or already ended. [2]"); + SPDLOG_ERROR("GuildWar: war not exist or already ended. [2]"); return; } @@ -527,7 +527,7 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw) // void CGuildManager::RecvWarOver(DWORD dwGuildWinner, DWORD dwGuildLoser, bool bDraw, int lWarPrice) { - sys_log(0, "GuildWar: RecvWarOver : winner %u vs %u draw? %d war_price %d", dwGuildWinner, dwGuildLoser, bDraw ? 1 : 0, lWarPrice); + SPDLOG_DEBUG("GuildWar: RecvWarOver : winner {} vs {} draw? {} war_price {}", dwGuildWinner, dwGuildLoser, bDraw ? 1 : 0, lWarPrice); DWORD GID1 = dwGuildWinner; DWORD GID2 = dwGuildLoser; @@ -570,13 +570,13 @@ void CGuildManager::RecvWarOver(DWORD dwGuildWinner, DWORD dwGuildLoser, bool bD void CGuildManager::RecvWarEnd(DWORD GID1, DWORD GID2) { - sys_log(0, "GuildWar: RecvWarEnded : %u vs %u", GID1, GID2); + SPDLOG_DEBUG("GuildWar: RecvWarEnded : {} vs {}", GID1, GID2); WarEnd(GID1, GID2, true); // ¹«Á¶°Ç ºñÁ¤»ó Á¾·á ½ÃÄÑ¾ß ÇÑ´Ù. } void CGuildManager::StartWar(BYTE bType, DWORD GID1, DWORD GID2, CGuildWarReserve * pkReserve) { - sys_log(0, "GuildWar: StartWar(%d,%d,%d)", bType, GID1, GID2); + SPDLOG_DEBUG("GuildWar: StartWar({},{},{})", bType, GID1, GID2); if (GID1 > GID2) std::swap(GID1, GID2); @@ -610,7 +610,7 @@ void CGuildManager::UpdateScore(DWORD dwGainGID, DWORD dwOppGID, int iScoreDelta if (!p || p->bEnd) { - sys_err("GuildWar: war not exist or already ended."); + SPDLOG_ERROR("GuildWar: war not exist or already ended."); return; } @@ -634,7 +634,7 @@ void CGuildManager::UpdateScore(DWORD dwGainGID, DWORD dwOppGID, int iScoreDelta iNewBetScore = p->iBetScore[1]; } - sys_log(0, "GuildWar: SendGuildWarScore guild %u wartype %u score_delta %d betscore_delta %d result %u, %u", + SPDLOG_DEBUG("GuildWar: SendGuildWarScore guild {} wartype {} score_delta {} betscore_delta {} result {}, {}", dwGainGID, p->bType, iScoreDelta, iBetScoreDelta, iNewScore, iNewBetScore); CClientManager::instance().for_each_peer(FSendGuildWarScore(dwGainGID, dwOppGID, iNewScore, iNewBetScore)); @@ -648,7 +648,7 @@ void CGuildManager::AddDeclare(BYTE bType, DWORD guild_from, DWORD guild_to) if (m_DeclareMap.find(di) == m_DeclareMap.end()) m_DeclareMap.insert(di); - sys_log(0, "GuildWar: AddDeclare(Type:%d,from:%d,to:%d)", bType, guild_from, guild_to); + SPDLOG_DEBUG("GuildWar: AddDeclare(Type:{},from:{},to:{})", bType, guild_from, guild_to); } void CGuildManager::RemoveDeclare(DWORD guild_from, DWORD guild_to) @@ -663,7 +663,7 @@ void CGuildManager::RemoveDeclare(DWORD guild_from, DWORD guild_to) if (it != m_DeclareMap.end()) m_DeclareMap.erase(it); - sys_log(0, "GuildWar: RemoveDeclare(from:%d,to:%d)", guild_from, guild_to); + SPDLOG_DEBUG("GuildWar: RemoveDeclare(from:{},to:{})", guild_from, guild_to); } bool CGuildManager::TakeBetPrice(DWORD dwGuildTo, DWORD dwGuildFrom, int lWarPrice) @@ -673,14 +673,14 @@ bool CGuildManager::TakeBetPrice(DWORD dwGuildTo, DWORD dwGuildFrom, int lWarPri if (it_from == m_map_kGuild.end() || it_to == m_map_kGuild.end()) { - sys_log(0, "TakeBetPrice: guild not exist %u %u", + SPDLOG_DEBUG("TakeBetPrice: guild not exist {} {}", dwGuildFrom, dwGuildTo); return false; } if (it_from->second.gold < lWarPrice || it_to->second.gold < lWarPrice) { - sys_log(0, "TakeBetPrice: not enough gold %u %d to %u %d", + SPDLOG_DEBUG("TakeBetPrice: not enough gold {} {} to {} {}", dwGuildFrom, it_from->second.gold, dwGuildTo, it_to->second.gold); return false; } @@ -704,8 +704,8 @@ bool CGuildManager::WaitStart(TPacketGuildWar * p) TGuildWaitStartInfo info(p->bType, p->dwGuildFrom, p->dwGuildTo, p->lWarPrice, p->lInitialScore, NULL); m_pqWaitStart.push(std::make_pair(dwCurTime + GetGuildWarWaitStartDuration(), info)); - sys_log(0, - "GuildWar: WaitStart g1 %d g2 %d price %d start at %u", + SPDLOG_DEBUG( + "GuildWar: WaitStart g1 {} g2 {} price {} start at {}", p->dwGuildFrom, p->dwGuildTo, p->lWarPrice, @@ -742,8 +742,8 @@ void CGuildManager::ChangeLadderPoint(DWORD GID, int change) snprintf(buf, sizeof(buf), "UPDATE guild%s SET ladder_point=%d WHERE id=%u", GetTablePostfix(), r.ladder_point, GID); CDBManager::instance().AsyncQuery(buf); - sys_log(0, "GuildManager::ChangeLadderPoint %u %d", GID, r.ladder_point); - sys_log(0, "%s", buf); + SPDLOG_DEBUG("GuildManager::ChangeLadderPoint {} {}", GID, r.ladder_point); + SPDLOG_DEBUG("{}", buf); // Packet º¸³»±â TPacketGuildLadder p; @@ -760,14 +760,14 @@ void CGuildManager::ChangeLadderPoint(DWORD GID, int change) void CGuildManager::UseSkill(DWORD GID, DWORD dwSkillVnum, DWORD dwCooltime) { // GUILD_SKILL_COOLTIME_BUG_FIX - sys_log(0, "UseSkill(gid=%d, skill=%d) CoolTime(%d:%d)", GID, dwSkillVnum, dwCooltime, CClientManager::instance().GetCurrentTime() + dwCooltime); + SPDLOG_DEBUG("UseSkill(gid={}, skill={}) CoolTime({}:{})", GID, dwSkillVnum, dwCooltime, CClientManager::instance().GetCurrentTime() + dwCooltime); m_pqSkill.push(std::make_pair(CClientManager::instance().GetCurrentTime() + dwCooltime, TGuildSkillUsed(GID, dwSkillVnum))); // END_OF_GUILD_SKILL_COOLTIME_BUG_FIX } void CGuildManager::MoneyChange(DWORD dwGuild, DWORD dwGold) { - sys_log(0, "GuildManager::MoneyChange %d %d", dwGuild, dwGold); + SPDLOG_DEBUG("GuildManager::MoneyChange {} {}", dwGuild, dwGold); TPacketDGGuildMoneyChange p; p.dwGuild = dwGuild; @@ -788,12 +788,12 @@ void CGuildManager::DepositMoney(DWORD dwGuild, INT iGold) if (it == m_map_kGuild.end()) { - sys_err("No guild by id %u", dwGuild); + SPDLOG_ERROR("No guild by id {}", dwGuild); return; } it->second.gold += iGold; - sys_log(0, "GUILD: %u Deposit %u Total %d", dwGuild, iGold, it->second.gold); + SPDLOG_DEBUG("GUILD: {} Deposit {} Total {}", dwGuild, iGold, it->second.gold); MoneyChange(dwGuild, it->second.gold); } @@ -804,7 +804,7 @@ void CGuildManager::WithdrawMoney(CPeer* peer, DWORD dwGuild, INT iGold) if (it == m_map_kGuild.end()) { - sys_err("No guild by id %u", dwGuild); + SPDLOG_ERROR("No guild by id {}", dwGuild); return; } @@ -812,7 +812,7 @@ void CGuildManager::WithdrawMoney(CPeer* peer, DWORD dwGuild, INT iGold) if (it->second.gold >= iGold) { it->second.gold -= iGold; - sys_log(0, "GUILD: %u Withdraw %d Total %d", dwGuild, iGold, it->second.gold); + SPDLOG_DEBUG("GUILD: {} Withdraw {} Total {}", dwGuild, iGold, it->second.gold); TPacketDGGuildMoneyWithdraw p; p.dwGuild = dwGuild; @@ -830,7 +830,7 @@ void CGuildManager::WithdrawMoneyReply(DWORD dwGuild, BYTE bGiveSuccess, INT iGo if (it == m_map_kGuild.end()) return; - sys_log(0, "GuildManager::WithdrawMoneyReply : guild %u success %d gold %d", dwGuild, bGiveSuccess, iGold); + SPDLOG_DEBUG("GuildManager::WithdrawMoneyReply : guild {} success {} gold {}", dwGuild, bGiveSuccess, iGold); if (!bGiveSuccess) it->second.gold += iGold; @@ -938,16 +938,16 @@ void CGuildManager::BootReserveWar() if (i == 0 || (int) t.dwTime - CClientManager::instance().GetCurrentTime() < 0) { if (i == 0) - sys_log(0, "%s : DB was shutdowned while war is being.", buf); + SPDLOG_DEBUG("{} : DB was shutdowned while war is being.", buf); else - sys_log(0, "%s : left time lower than 5 minutes, will be canceled", buf); + SPDLOG_DEBUG("{} : left time lower than 5 minutes, will be canceled", buf); pkReserve->Draw(); delete pkReserve; } else { - sys_log(0, "%s : OK", buf); + SPDLOG_DEBUG("{} : OK", buf); m_map_kWarReserve.insert(std::make_pair(t.dwID, pkReserve)); } } @@ -1024,7 +1024,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) polyPower.SetVar("mc", mc); t.lPowerFrom = (int) polyPower.Eval(); - sys_log(0, "GuildWar: %u lvp %d rkp %d alv %d mc %d power %d", GID1, lvp, rkp, alv, mc, t.lPowerFrom); + SPDLOG_DEBUG("GuildWar: {} lvp {} rkp {} alv {} mc {} power {}", GID1, lvp, rkp, alv, mc, t.lPowerFrom); // ÆÄ¿ö °è»ê TGuild & k2 = TouchGuild(GID2); @@ -1040,7 +1040,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) polyPower.SetVar("mc", mc); t.lPowerTo = (int) polyPower.Eval(); - sys_log(0, "GuildWar: %u lvp %d rkp %d alv %d mc %d power %d", GID2, lvp, rkp, alv, mc, t.lPowerTo); + SPDLOG_DEBUG("GuildWar: {} lvp {} rkp {} alv {} mc {} power {}", GID2, lvp, rkp, alv, mc, t.lPowerTo); // ÇÚµðĸ °è»ê if (t.lPowerTo > t.lPowerFrom) @@ -1055,7 +1055,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) } t.lHandicap = (int) polyHandicap.Eval(); - sys_log(0, "GuildWar: handicap %d", t.lHandicap); + SPDLOG_DEBUG("GuildWar: handicap {}", t.lHandicap); // Äõ¸® char szQuery[512]; @@ -1069,7 +1069,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiInsertID == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_err("GuildWar: Cannot insert row"); + SPDLOG_ERROR("GuildWar: Cannot insert row"); return false; } @@ -1101,7 +1101,7 @@ void CGuildManager::ProcessReserveWar() TGuild & r_1 = m_map_kGuild[r.dwGuildFrom]; TGuild & r_2 = m_map_kGuild[r.dwGuildTo]; - sys_log(0, "GuildWar: started GID1 %u GID2 %u %d time %d min %d", r.dwGuildFrom, r.dwGuildTo, r.bStarted, dwCurTime - r.dwTime, iMin); + SPDLOG_DEBUG("GuildWar: started GID1 {} GID2 {} {} time {} min {}", r.dwGuildFrom, r.dwGuildTo, r.bStarted, dwCurTime - r.dwTime, iMin); if (iMin <= 0) { @@ -1152,7 +1152,7 @@ bool CGuildManager::Bet(DWORD dwID, const char * c_pszLogin, DWORD dwGold, DWORD if (it == m_map_kWarReserve.end()) { - sys_log(0, "WAR_RESERVE: Bet: cannot find reserve war by id %u", dwID); + SPDLOG_DEBUG("WAR_RESERVE: Bet: cannot find reserve war by id {}", dwID); snprintf(szQuery, sizeof(szQuery), "INSERT INTO item_award (login, vnum, socket0, given_time) VALUES('%s', %d, %u, NOW())", c_pszLogin, ITEM_ELK_VNUM, dwGold); CDBManager::instance().AsyncQuery(szQuery); @@ -1161,7 +1161,7 @@ bool CGuildManager::Bet(DWORD dwID, const char * c_pszLogin, DWORD dwGold, DWORD if (!it->second->Bet(c_pszLogin, dwGold, dwGuild)) { - sys_log(0, "WAR_RESERVE: Bet: cannot bet id %u, login %s, gold %u, guild %u", dwID, c_pszLogin, dwGold, dwGuild); + SPDLOG_DEBUG("WAR_RESERVE: Bet: cannot bet id {}, login {}, gold {}, guild {}", dwID, c_pszLogin, dwGold, dwGuild); snprintf(szQuery, sizeof(szQuery), "INSERT INTO item_award (login, vnum, socket0, given_time) VALUES('%s', %d, %u, NOW())", c_pszLogin, ITEM_ELK_VNUM, dwGold); CDBManager::instance().AsyncQuery(szQuery); @@ -1271,19 +1271,19 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild) if (m_data.dwGuildFrom != dwGuild && m_data.dwGuildTo != dwGuild) { - sys_log(0, "GuildWarReserve::Bet: invalid guild id"); + SPDLOG_DEBUG("GuildWarReserve::Bet: invalid guild id"); return false; } if (m_data.bStarted) { - sys_log(0, "GuildWarReserve::Bet: war is already started"); + SPDLOG_DEBUG("GuildWarReserve::Bet: war is already started"); return false; } if (mapBet.find(pszLogin) != mapBet.end()) { - sys_log(0, "GuildWarReserve::Bet: failed. already bet"); + SPDLOG_DEBUG("GuildWarReserve::Bet: failed. already bet"); return false; } @@ -1295,7 +1295,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "GuildWarReserve::Bet: failed. cannot insert row to guild_war_bet table"); + SPDLOG_DEBUG("GuildWarReserve::Bet: failed. cannot insert row to guild_war_bet table"); return false; } @@ -1311,7 +1311,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild) CDBManager::instance().AsyncQuery(szQuery); - sys_log(0, "GuildWarReserve::Bet: success. %s %u war_id %u bet %u : %u", pszLogin, dwGuild, m_data.dwID, m_data.dwBetFrom, m_data.dwBetTo); + SPDLOG_DEBUG("GuildWarReserve::Bet: success. {} {} war_id {} bet {} : {}", pszLogin, dwGuild, m_data.dwID, m_data.dwBetFrom, m_data.dwBetTo); mapBet.insert(std::make_pair(pszLogin, std::make_pair(dwGuild, dwGold))); TPacketGDGuildWarBet pckBet; @@ -1338,7 +1338,7 @@ void CGuildWarReserve::Draw() if (mapBet.empty()) return; - sys_log(0, "WAR_REWARD: Draw. war_id %u", m_data.dwID); + SPDLOG_DEBUG("WAR_REWARD: Draw. war_id {}", m_data.dwID); itertype(mapBet) it = mapBet.begin(); @@ -1368,7 +1368,7 @@ void CGuildWarReserve::Draw() if (iRow > 0) { - sys_log(0, "WAR_REWARD: QUERY: %s", szQuery); + SPDLOG_DEBUG("WAR_REWARD: QUERY: {}", szQuery); CDBManager::instance().AsyncQuery(szQuery); } @@ -1381,18 +1381,18 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) { DWORD dwWinner; - sys_log(0, "WAR_REWARD: End: From %u %d To %u %d", m_data.dwGuildFrom, iScoreFrom, m_data.dwGuildTo, iScoreTo); + SPDLOG_DEBUG("WAR_REWARD: End: From {} {} To {} {}", m_data.dwGuildFrom, iScoreFrom, m_data.dwGuildTo, iScoreTo); if (m_data.lPowerFrom > m_data.lPowerTo) { if (m_data.lHandicap > iScoreFrom - iScoreTo) { - sys_log(0, "WAR_REWARD: End: failed to overcome handicap, From is strong but To won"); + SPDLOG_DEBUG("WAR_REWARD: End: failed to overcome handicap, From is strong but To won"); dwWinner = m_data.dwGuildTo; } else { - sys_log(0, "WAR_REWARD: End: success to overcome handicap, From win!"); + SPDLOG_DEBUG("WAR_REWARD: End: success to overcome handicap, From win!"); dwWinner = m_data.dwGuildFrom; } } @@ -1400,12 +1400,12 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) { if (m_data.lHandicap > iScoreTo - iScoreFrom) { - sys_log(0, "WAR_REWARD: End: failed to overcome handicap, To is strong but From won"); + SPDLOG_DEBUG("WAR_REWARD: End: failed to overcome handicap, To is strong but From won"); dwWinner = m_data.dwGuildFrom; } else { - sys_log(0, "WAR_REWARD: End: success to overcome handicap, To win!"); + SPDLOG_DEBUG("WAR_REWARD: End: success to overcome handicap, To win!"); dwWinner = m_data.dwGuildTo; } } @@ -1427,17 +1427,17 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) dwWinnerBet = m_data.dwBetTo; else { - sys_err("WAR_REWARD: fatal error, winner does not exist!"); + SPDLOG_ERROR("WAR_REWARD: fatal error, winner does not exist!"); return; } if (dwWinnerBet == 0) { - sys_err("WAR_REWARD: total bet money on winner is zero"); + SPDLOG_ERROR("WAR_REWARD: total bet money on winner is zero"); return; } - sys_log(0, "WAR_REWARD: End: Total bet: %u, Winner bet: %u", dwTotalBet, dwWinnerBet); + SPDLOG_DEBUG("WAR_REWARD: End: Total bet: {}, Winner bet: {}", dwTotalBet, dwWinnerBet); itertype(mapBet) it = mapBet.begin(); @@ -1459,7 +1459,7 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) double ratio = (double) it->second.second / dwWinnerBet; // 10% ¼¼±Ý °øÁ¦ ÈÄ ºÐ¹è - sys_log(0, "WAR_REWARD: %s %u ratio %f", it->first.c_str(), it->second.second, ratio); + SPDLOG_DEBUG("WAR_REWARD: {} {} ratio {}", it->first.c_str(), it->second.second, ratio); DWORD dwGold = (DWORD) (dwTotalBet * ratio * 0.9); @@ -1480,7 +1480,7 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) if (iRow > 0) { - sys_log(0, "WAR_REWARD: query: %s", szQuery); + SPDLOG_DEBUG("WAR_REWARD: query: {}", szQuery); CDBManager::instance().AsyncQuery(szQuery); } diff --git a/src/db/src/HB.cpp b/src/db/src/HB.cpp index 4caea8a..8e899fe 100644 --- a/src/db/src/HB.cpp +++ b/src/db/src/HB.cpp @@ -68,13 +68,13 @@ bool PlayerHB::Query(DWORD id) if (pos < 0) { - sys_err("cannot find %s ", szFind); - // sys_err("cannot find %s in %s", szFind, m_stCreateTableQuery.c_str()); + 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)); - // sys_log(0, "%s", szQuery); + // SPDLOG_DEBUG("{}", szQuery); std::unique_ptr pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP)); m_stTableName = szTableName; } diff --git a/src/db/src/ItemAwardManager.cpp b/src/db/src/ItemAwardManager.cpp index 6dc07a7..7012130 100644 --- a/src/db/src/ItemAwardManager.cpp +++ b/src/db/src/ItemAwardManager.cpp @@ -60,7 +60,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg) strcpy(cmdStr,whyStr); //¸í·É¾î ¾ò´Â °úÁ¤¿¡¼­ ÅäÅ«¾²¸é ¿øº»µµ ÅäÅ«È­ µÇ±â ¶§¹® char command[20] = ""; strcpy(command,CClientManager::instance().GetCommand(cmdStr).c_str()); // command ¾ò±â - //sys_err("%d, %s",pItemAward->dwID,command); + //SPDLOG_ERROR("{}, {}",pItemAward->dwID,command); if( !(strcmp(command,"GIFT") )) // command °¡ GIFTÀ̸é { TPacketItemAwardInfromer giftData; @@ -74,7 +74,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg) m_map_award.insert(std::make_pair(dwID, kData)); printf("ITEM_AWARD load id %u bMall %d \n", kData->dwID, kData->bMall); - sys_log(0, "ITEM_AWARD: load id %lu login %s vnum %lu count %u socket %lu", kData->dwID, kData->szLogin, kData->dwVnum, kData->dwCount, kData->dwSocket0); + SPDLOG_DEBUG("ITEM_AWARD: load id {} login {} vnum {} count {} socket {}", kData->dwID, kData->szLogin, kData->dwVnum, kData->dwCount, kData->dwSocket0); std::set & kSet = m_map_kSetAwardByLogin[kData->szLogin]; kSet.insert(kData); @@ -99,7 +99,7 @@ void ItemAwardManager::Taken(DWORD dwAwardID, DWORD dwItemID) if (it == m_map_award.end()) { - sys_log(0, "ITEM_AWARD: Taken ID not exist %lu", dwAwardID); + SPDLOG_DEBUG("ITEM_AWARD: Taken ID not exist {}", dwAwardID); return; } diff --git a/src/db/src/ItemIDRangeManager.cpp b/src/db/src/ItemIDRangeManager.cpp index 099765b..f4cf045 100644 --- a/src/db/src/ItemIDRangeManager.cpp +++ b/src/db/src/ItemIDRangeManager.cpp @@ -79,7 +79,7 @@ TItemIDRangeTable CItemIDRangeManager::GetRange() } for (int i = 0; i < 10; ++i) - sys_err("ItemIDRange: NO MORE ITEM ID RANGE"); + SPDLOG_ERROR("ItemIDRange: NO MORE ITEM ID RANGE"); return ret; } @@ -112,7 +112,7 @@ bool CItemIDRangeManager::BuildRange(DWORD dwMin, DWORD dwMax, TItemIDRangeTable if ((dwMax < dwItemMaxID) || (dwMax - dwItemMaxID < cs_dwMinimumRemainCount)) { - sys_log(0, "ItemIDRange: Build %u ~ %u start: %u\tNOT USE remain count is below %u", + SPDLOG_DEBUG("ItemIDRange: Build {} ~ {} start: {}\tNOT USE remain count is below {}", dwMin, dwMax, dwItemMaxID, cs_dwMinimumRemainCount); } else @@ -136,12 +136,12 @@ bool CItemIDRangeManager::BuildRange(DWORD dwMin, DWORD dwMax, TItemIDRangeTable if (count > 0) { - sys_err("ItemIDRange: Build: %u ~ %u\thave a item", range.dwUsableItemIDMin, range.dwMax); + SPDLOG_ERROR("ItemIDRange: Build: {} ~ {}\thave a item", range.dwUsableItemIDMin, range.dwMax); return false; } else { - sys_log(0, "ItemIDRange: Build: %u ~ %u start:%u", range.dwMin, range.dwMax, range.dwUsableItemIDMin); + SPDLOG_TRACE("ItemIDRange: Build: {} ~ {} start:{}", range.dwMin, range.dwMax, range.dwUsableItemIDMin); return true; } } diff --git a/src/db/src/ItemIDRangeManager.h b/src/db/src/ItemIDRangeManager.h index d15cd01..5ab5506 100644 --- a/src/db/src/ItemIDRangeManager.h +++ b/src/db/src/ItemIDRangeManager.h @@ -2,16 +2,18 @@ #ifndef __INC_METIN_II_ITEM_ID_RANGE_MANAGER_H__ #define __INC_METIN_II_ITEM_ID_RANGE_MANAGER_H__ +namespace { + static const uint32_t cs_dwMaxItemID = 4290000000UL; + static const uint32_t cs_dwMinimumRange = 10000000UL; + static const uint32_t cs_dwMinimumRemainCount = 10000UL; +} + class CItemIDRangeManager : public singleton { - private : - const static DWORD cs_dwMaxItemID = 4290000000UL; - const static DWORD cs_dwMinimumRange = 10000000UL; - const static DWORD cs_dwMinimumRemainCount = 10000UL; - + private: std::list m_listData; - public : + public: CItemIDRangeManager(); void Build(); diff --git a/src/db/src/LoginData.cpp b/src/db/src/LoginData.cpp index 60a683f..dbcec54 100644 --- a/src/db/src/LoginData.cpp +++ b/src/db/src/LoginData.cpp @@ -78,11 +78,11 @@ void CLoginData::SetPlay(bool bOn) { if (bOn) { - sys_log(0, "SetPlay on %lu %s", GetKey(), m_data.login); + SPDLOG_DEBUG("SetPlay on {} {}", GetKey(), m_data.login); SetLogonTime(); } else - sys_log(0, "SetPlay off %lu %s", GetKey(), m_data.login); + SPDLOG_DEBUG("SetPlay off {} {}", GetKey(), m_data.login); m_bPlay = bOn; m_lastPlayTime = CClientManager::instance().GetCurrentTime(); diff --git a/src/db/src/Main.cpp b/src/db/src/Main.cpp index a51d836..e08eaad 100644 --- a/src/db/src/Main.cpp +++ b/src/db/src/Main.cpp @@ -38,8 +38,6 @@ int g_iItemCacheFlushSeconds = 60*5; //g_iLogoutSeconds ¼öÄ¡´Â g_iPlayerCacheFlushSeconds ¿Í g_iItemCacheFlushSeconds º¸´Ù ±æ¾î¾ß ÇÑ´Ù. int g_iLogoutSeconds = 60*10; -int g_log = 1; - // MYSHOP_PRICE_LIST int g_iItemPriceListTableCacheFlushSeconds = 540; @@ -52,9 +50,9 @@ extern const char * _malloc_options; void emergency_sig(int sig) { if (sig == SIGSEGV) - sys_log(0, "SIGNAL: SIGSEGV"); + SPDLOG_DEBUG("SIGNAL: SIGSEGV"); else if (sig == SIGUSR1) - sys_log(0, "SIGNAL: SIGUSR1"); + SPDLOG_DEBUG("SIGNAL: SIGUSR1"); if (sig == SIGSEGV) abort(); @@ -93,7 +91,7 @@ int main() #ifdef __AUCTION__ AuctionManager::instance().Initialize(); #endif - sys_log(0, "Metin2DBCacheServer Start\n"); + SPDLOG_DEBUG("Metin2DBCacheServer Start"); CClientManager::instance().MainLoop(); @@ -113,7 +111,7 @@ int main() break; usleep(1000); - sys_log(0, "WAITING_QUERY_COUNT %d", iCount); + SPDLOG_DEBUG("WAITING_QUERY_COUNT {}", iCount); } return 1; @@ -144,18 +142,6 @@ int Start() else SPDLOG_INFO("Test Server"); - if (!CConfig::instance().GetValue("LOG", &g_log)) - { - SPDLOG_INFO("Log Off"); - g_log= 0; - } - else - { - g_log = 1; - SPDLOG_INFO("Log On"); - } - - int tmpValue; int heart_beat = 50; @@ -286,7 +272,7 @@ int Start() if (CConfig::instance().GetValue("SQL_ACCOUNT", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (account)"); + SPDLOG_DEBUG("connecting to MySQL server (account)"); int iRetry = 5; @@ -294,26 +280,26 @@ int Start() { if (CDBManager::instance().Connect(SQL_ACCOUNT, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_DEBUG(" OK"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_DEBUG(" failed, retrying in 5 seconds"); + SPDLOG_ERROR(" failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success ACCOUNT\n"); + SPDLOG_INFO("Success ACCOUNT"); } else { - sys_err("SQL_ACCOUNT not configured"); + SPDLOG_ERROR("SQL_ACCOUNT not configured"); return false; } if (CConfig::instance().GetValue("SQL_COMMON", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (common)"); + SPDLOG_DEBUG("connecting to MySQL server (common)"); int iRetry = 5; @@ -321,26 +307,26 @@ int Start() { if (CDBManager::instance().Connect(SQL_COMMON, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_DEBUG(" OK"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_DEBUG(" failed, retrying in 5 seconds"); + SPDLOG_ERROR(" failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success COMMON\n"); + SPDLOG_INFO("Success COMMON"); } else { - sys_err("SQL_COMMON not configured"); + SPDLOG_ERROR("SQL_COMMON not configured"); return false; } if (CConfig::instance().GetValue("SQL_HOTBACKUP", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (hotbackup)"); + SPDLOG_DEBUG("connecting to MySQL server (hotbackup)"); int iRetry = 5; @@ -348,21 +334,21 @@ int Start() { if (CDBManager::instance().Connect(SQL_HOTBACKUP, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_DEBUG(" OK"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_DEBUG(" failed, retrying in 5 seconds"); + SPDLOG_ERROR(" failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success HOTBACKUP\n"); + SPDLOG_INFO("Success HOTBACKUP"); } else { - sys_err("SQL_HOTBACKUP not configured"); + SPDLOG_ERROR("SQL_HOTBACKUP not configured"); return false; } diff --git a/src/db/src/Marriage.cpp b/src/db/src/Marriage.cpp index d094ed2..f42df95 100644 --- a/src/db/src/Marriage.cpp +++ b/src/db/src/Marriage.cpp @@ -44,7 +44,7 @@ namespace marriage unique_ptr pmsg(CDBManager::instance().DirectQuery(szQuery)); SQLResult * pRes = pmsg->Get(); - sys_log(0, "MarriageList(size=%lu)", pRes->uiNumRows); + SPDLOG_DEBUG("MarriageList(size={})", pRes->uiNumRows); if (pRes->uiNumRows > 0) { @@ -65,7 +65,7 @@ namespace marriage m_MarriageByPID.insert(make_pair(pid1, pMarriage)); m_MarriageByPID.insert(make_pair(pid2, pMarriage)); - sys_log(0, "Marriage %lu: LP:%d TM:%u ST:%d %10lu:%16s %10lu:%16s ", uiRow, love_point, time, is_married, pid1, name1, pid2, name2); + SPDLOG_DEBUG("Marriage {}: LP:{} TM:{} ST:{} {:10}:{:16} {:10}:{:16} ", uiRow, love_point, time, is_married, pid1, name1, pid2, name2); } } return true; @@ -92,7 +92,7 @@ namespace marriage DWORD now = CClientManager::instance().GetCurrentTime(); if (IsMarried(dwPID1) || IsMarried(dwPID2)) { - sys_err("cannot marry already married character. %d - %d", dwPID1, dwPID2); + SPDLOG_ERROR("cannot marry already married character. {} - {}", dwPID1, dwPID2); return; } @@ -106,11 +106,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot insert marriage"); + SPDLOG_ERROR("cannot insert marriage"); return; } - sys_log(0, "MARRIAGE ADD %u %u", dwPID1, dwPID2); + SPDLOG_DEBUG("MARRIAGE ADD {} {}", dwPID1, dwPID2); TMarriage* pMarriage = new TMarriage(dwPID1, dwPID2, 0, now, 0, szName1, szName2); m_Marriages.insert(pMarriage); @@ -131,7 +131,7 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("not under marriage : %u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : {} {}", dwPID1, dwPID2); return; } @@ -146,11 +146,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot update marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot update marriage : PID:{} {}", dwPID1, dwPID2); return; } - sys_log(0, "MARRIAGE UPDATE PID:%u %u LP:%u ST:%d", dwPID1, dwPID2, iLovePoint, byMarried); + SPDLOG_DEBUG("MARRIAGE UPDATE PID:{} {} LP:{} ST:{}", dwPID1, dwPID2, iLovePoint, byMarried); pMarriage->love_point = iLovePoint; pMarriage->is_married = byMarried; @@ -168,7 +168,7 @@ namespace marriage if (pMarriage) { - sys_log(0, "Break Marriage pid1 %d pid2 %d Other %d", dwPID1, dwPID2, pMarriage->GetOther(dwPID1)); + SPDLOG_DEBUG("Break Marriage pid1 {} pid2 {} Other {}", dwPID1, dwPID2, pMarriage->GetOther(dwPID1)); } if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { @@ -176,9 +176,9 @@ namespace marriage for (; it != m_MarriageByPID.end(); ++it) { - sys_log(0, "Marriage List pid1 %d pid2 %d", it->second->pid1, it->second->pid2); + SPDLOG_DEBUG("Marriage List pid1 {} pid2 {}", it->second->pid1, it->second->pid2); } - sys_err("not under marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : PID:{} {}", dwPID1, dwPID2); return; } @@ -192,11 +192,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot delete marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot delete marriage : PID:{} {}", dwPID1, dwPID2); return; } - sys_log(0, "MARRIAGE REMOVE PID:%u %u", dwPID1, dwPID2); + SPDLOG_DEBUG("MARRIAGE REMOVE PID:{} {}", dwPID1, dwPID2); m_Marriages.erase(pMarriage); m_MarriageByPID.erase(dwPID1); @@ -215,13 +215,13 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("not under marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : PID:{} {}", dwPID1, dwPID2); return; } if (pMarriage->is_married) { - sys_err("already married, cannot change engage to marry : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("already married, cannot change engage to marry : PID:{} {}", dwPID1, dwPID2); return; } @@ -236,11 +236,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot change engage to marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot change engage to marriage : PID:{} {}", dwPID1, dwPID2); return; } - sys_log(0, "MARRIAGE ENGAGE->MARRIAGE PID:%u %u", dwPID1, dwPID2); + SPDLOG_DEBUG("MARRIAGE ENGAGE->MARRIAGE PID:{} {}", dwPID1, dwPID2); pMarriage->is_married = 1; TPacketMarriageUpdate p; @@ -313,7 +313,7 @@ namespace marriage itertype(m_mapRunningWedding) it = m_mapRunningWedding.find(make_pair(dwPID1, dwPID2)); if (it == m_mapRunningWedding.end()) { - sys_err("try to end wedding %u %u", dwPID1, dwPID2); + SPDLOG_ERROR("try to end wedding {} {}", dwPID1, dwPID2); return; } diff --git a/src/db/src/Monarch.cpp b/src/db/src/Monarch.cpp index 13b2968..3c38fe7 100644 --- a/src/db/src/Monarch.cpp +++ b/src/db/src/Monarch.cpp @@ -1,3 +1,5 @@ +#include "stdafx.h" + #include "Monarch.h" #include #include "Main.h" @@ -53,8 +55,7 @@ void CMonarch::ElectMonarch() ++s[idx]; - if (g_test_server) - sys_log (0, "[MONARCH_VOTE] pid(%d) come to vote candidacy pid(%d)", it->second->pid, m_vec_MonarchCandidacy[idx].pid); + SPDLOG_TRACE("[MONARCH_VOTE] pid({}) come to vote candidacy pid({})", it->second->pid, m_vec_MonarchCandidacy[idx].pid); } delete [] s; @@ -167,8 +168,7 @@ bool CMonarch::TakeMoney(int Empire, DWORD pid, int64_t Money) CDBManager::instance().AsyncQuery(szQuery); - if (g_test_server) - sys_log(0, "[MONARCH] Take money empire(%d) money(%lld)", Empire, m_MonarchInfo.money[Empire]); + SPDLOG_TRACE("[MONARCH] Take money empire({}) money({})", Empire, m_MonarchInfo.money[Empire]); return true; } @@ -197,8 +197,7 @@ bool CMonarch::LoadMonarch() str_to_number(p->money[Empire], row[idx++]); strlcpy(p->date[Empire], row[idx++], sizeof(p->date[Empire])); - if (g_test_server) - sys_log(0, "[LOAD_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); + SPDLOG_TRACE("[LOAD_MONARCH] Empire {} pid {} money {} windate {}", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); } delete pMsg; @@ -230,8 +229,7 @@ bool CMonarch::SetMonarch(const char * name) strlcpy(p->name[Empire], row[idx++], sizeof(p->name[Empire])); p->money[Empire] = atoll(row[idx++]); - if (g_test_server) - sys_log(0, "[Set_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); + SPDLOG_TRACE("[Set_MONARCH] Empire {} pid {} money {} windate {}", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); } delete pMsg; @@ -278,7 +276,7 @@ bool CMonarch::DelMonarch(const char * name) if (pMsg->Get()->uiNumRows == 0) { - sys_err(" DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR(" DirectQuery failed({})", szQuery); delete pMsg; return false; } diff --git a/src/db/src/Peer.cpp b/src/db/src/Peer.cpp index 1801102..bcbe2cc 100644 --- a/src/db/src/Peer.cpp +++ b/src/db/src/Peer.cpp @@ -29,15 +29,15 @@ void CPeer::OnAccept() static DWORD current_handle = 0; m_dwHandle = ++current_handle; - sys_log(0, "Connection accepted. (host: %s handle: %u)", m_host, m_dwHandle); + SPDLOG_DEBUG("Connection accepted. (host: {} handle: {})", m_host, m_dwHandle); } void CPeer::OnClose() { m_state = STATE_CLOSE; - sys_log(0, "Connection closed. (host: %s)", m_host); - sys_log(0, "ItemIDRange: returned. %u ~ %u", m_itemRange.dwMin, m_itemRange.dwMax); + SPDLOG_DEBUG("Connection closed. (host: {})", m_host); + SPDLOG_DEBUG("ItemIDRange: returned. {} ~ {}", m_itemRange.dwMin, m_itemRange.dwMax); CItemIDRangeManager::instance().UpdateRange(m_itemRange.dwMin, m_itemRange.dwMax); @@ -69,7 +69,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO const char * buf = (const char *) GetRecvBuffer(iBytesProceed + 9); if (!buf) { - sys_err("PeekPacket: Failed to get network buffer!"); + SPDLOG_ERROR("PeekPacket: Failed to get network buffer!"); return false; } @@ -87,7 +87,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO // Ensure that all the data was fully received if (iBytesProceed + dwLength + 9 > (DWORD) GetRecvLength()) { - sys_log(0, "PeekPacket: not enough buffer size: len %u, recv %d", + SPDLOG_DEBUG("PeekPacket: not enough buffer size: len {}, recv {}", 9+dwLength, GetRecvLength()-iBytesProceed); return false; } @@ -95,7 +95,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO // Ensure that all the required data is available in a contiguous area buf = (const char *) GetRecvBuffer(iBytesProceed + dwLength + 9); if (!buf) { - sys_err("PeekPacket: Failed to get network buffer!"); + SPDLOG_ERROR("PeekPacket: Failed to get network buffer!"); return false; } @@ -112,7 +112,7 @@ void CPeer::EncodeHeader(BYTE header, DWORD dwHandle, DWORD dwSize) { HEADER h; - sys_log(1, "EncodeHeader %u handle %u size %u", header, dwHandle, dwSize); + SPDLOG_TRACE("EncodeHeader {} handle {} size {}", header, dwHandle, dwSize); h.bHeader = header; h.dwHandle = dwHandle; @@ -149,7 +149,7 @@ void CPeer::SendSpareItemIDRange() if (SetSpareItemIDRange(CItemIDRangeManager::instance().GetRange()) == false) { - sys_log(0, "ItemIDRange: spare range set error"); + SPDLOG_DEBUG("ItemIDRange: spare range set error"); m_itemSpareRange.dwMin = m_itemSpareRange.dwMax = m_itemSpareRange.dwUsableItemIDMin = 0; } @@ -163,7 +163,7 @@ bool CPeer::SetItemIDRange(TItemIDRangeTable itemRange) if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false; m_itemRange = itemRange; - sys_log(0, "ItemIDRange: SET %s %u ~ %u start: %u", GetPublicIP(), m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); + SPDLOG_DEBUG("ItemIDRange: SET {} {} ~ {} start: {}", GetPublicIP(), m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); return true; } @@ -173,7 +173,7 @@ bool CPeer::SetSpareItemIDRange(TItemIDRangeTable itemRange) if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false; m_itemSpareRange = itemRange; - sys_log(0, "ItemIDRange: SPARE SET %s %u ~ %u start: %u", GetPublicIP(), m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, + SPDLOG_DEBUG("ItemIDRange: SPARE SET {} {} ~ {} start: {}", GetPublicIP(), m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, m_itemSpareRange.dwUsableItemIDMin); return true; @@ -183,14 +183,14 @@ bool CPeer::CheckItemIDRangeCollision(TItemIDRangeTable itemRange) { if (m_itemRange.dwMin < itemRange.dwMax && m_itemRange.dwMax > itemRange.dwMin) { - sys_err("ItemIDRange: Collision!! this %u ~ %u check %u ~ %u", + SPDLOG_ERROR("ItemIDRange: Collision!! this {} ~ {} check {} ~ {}", m_itemRange.dwMin, m_itemRange.dwMax, itemRange.dwMin, itemRange.dwMax); return false; } if (m_itemSpareRange.dwMin < itemRange.dwMax && m_itemSpareRange.dwMax > itemRange.dwMin) { - sys_err("ItemIDRange: Collision with spare range this %u ~ %u check %u ~ %u", + SPDLOG_ERROR("ItemIDRange: Collision with spare range this {} ~ {} check {} ~ {}", m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, itemRange.dwMin, itemRange.dwMax); return false; } diff --git a/src/db/src/PeerBase.cpp b/src/db/src/PeerBase.cpp index 1e039d2..7335f74 100644 --- a/src/db/src/PeerBase.cpp +++ b/src/db/src/PeerBase.cpp @@ -23,12 +23,12 @@ void CPeerBase::Destroy() bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr) { if (!bufev) { - sys_err("Cannot accept empty bufferevent!"); + SPDLOG_ERROR("Cannot accept empty bufferevent!"); return false; } if (m_bufferevent != nullptr) { - sys_err("Peer is already initialized"); + SPDLOG_ERROR("Peer is already initialized"); return false; } @@ -57,7 +57,7 @@ bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr) // Trigger the OnAccept event OnAccept(); - sys_log(0, "ACCEPT FROM %s", m_host); + SPDLOG_DEBUG("ACCEPT FROM {}", m_host); return true; } @@ -86,12 +86,12 @@ void CPeerBase::Encode(const void* data, size_t size) { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return; } if (bufferevent_write(m_bufferevent, data, size) != 0) { - sys_err("Buffer write error!"); + SPDLOG_ERROR("Buffer write error!"); return; } } @@ -100,7 +100,7 @@ void CPeerBase::RecvEnd(size_t proceed_bytes) { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return; } @@ -112,7 +112,7 @@ size_t CPeerBase::GetRecvLength() { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return 0; } @@ -124,7 +124,7 @@ const void * CPeerBase::GetRecvBuffer(ssize_t ensure_bytes) { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return nullptr; } @@ -136,7 +136,7 @@ size_t CPeerBase::GetSendLength() { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return 0; } diff --git a/src/db/src/PrivManager.cpp b/src/db/src/PrivManager.cpp index c3a373f..ede3c4e 100644 --- a/src/db/src/PrivManager.cpp +++ b/src/db/src/PrivManager.cpp @@ -84,7 +84,7 @@ void CPrivManager::AddCharPriv(DWORD pid, BYTE type, int value) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: AddCharPriv: wrong char priv type(%u) recved", type); + SPDLOG_ERROR("PRIV_MANAGER: AddCharPriv: wrong char priv type({}) recved", type); return; } @@ -108,7 +108,7 @@ void CPrivManager::AddCharPriv(DWORD pid, BYTE type, int value) m_aPrivChar[type].insert(std::make_pair(pid, p)); // TODO send packet - sys_log(0, "AddCharPriv %d %d %d", pid, type, value); + SPDLOG_DEBUG("AddCharPriv {} {} {}", pid, type, value); SendChangeCharPriv(pid, type, value); } @@ -119,7 +119,7 @@ void CPrivManager::AddGuildPriv(DWORD guild_id, BYTE type, int value, time_t dur { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: AddGuildPriv: wrong guild priv type(%u) recved", type); + SPDLOG_ERROR("PRIV_MANAGER: AddGuildPriv: wrong guild priv type({}) recved", type); return; } @@ -141,14 +141,14 @@ void CPrivManager::AddGuildPriv(DWORD guild_id, BYTE type, int value, time_t dur SendChangeGuildPriv(guild_id, type, value, end); // END_OF_ADD_GUILD_PRIV_TIME - sys_log(0, "Guild Priv guild(%d) type(%d) value(%d) duration_sec(%d)", guild_id, type, value, duration_sec); + SPDLOG_DEBUG("Guild Priv guild({}) type({}) value({}) duration_sec({})", guild_id, type, value, duration_sec); } void CPrivManager::AddEmpirePriv(BYTE empire, BYTE type, int value, time_t duration_sec) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: AddEmpirePriv: wrong empire priv type(%u) recved", type); + SPDLOG_ERROR("PRIV_MANAGER: AddEmpirePriv: wrong empire priv type({}) recved", type); return; } @@ -173,7 +173,7 @@ void CPrivManager::AddEmpirePriv(BYTE empire, BYTE type, int value, time_t durat SendChangeEmpirePriv(empire, type, value, end); // END_OF_ADD_EMPIRE_PRIV_TIME - sys_log(0, "Empire Priv empire(%d) type(%d) value(%d) duration_sec(%d)", empire, type, value, duration_sec); + SPDLOG_DEBUG("Empire Priv empire({}) type({}) value({}) duration_sec({})", empire, type, value, duration_sec); } /** diff --git a/src/db/src/ProtoReader.cpp b/src/db/src/ProtoReader.cpp index 859215f..21cdb22 100644 --- a/src/db/src/ProtoReader.cpp +++ b/src/db/src/ProtoReader.cpp @@ -206,7 +206,7 @@ int get_Item_SubType_Value(int type_value, string inputString) // assert ¾È ¸ÔÈ÷´Â µí.. if (_countof(arSubType) <= type_value) { - sys_err("SubType : Out of range!! (type_value: %d, count of registered subtype: %d", type_value, _countof(arSubType)); + SPDLOG_ERROR("SubType : Out of range!! (type_value: {}, count of registered subtype: {}", type_value, _countof(arSubType)); return -1; } @@ -683,7 +683,7 @@ bool Set_Proto_Mob_Table(TMobTable *mobTable, cCsvTable &csvTable,std::mapbDeathBlowPoint, csvTable.AsStringByIndex(col++)); str_to_number(mobTable->bRevivePoint, csvTable.AsStringByIndex(col++)); - sys_log(0, "MOB #%-5d %-24s level: %-3u rank: %u empire: %d", mobTable->dwVnum, mobTable->szLocaleName, mobTable->bLevel, mobTable->bRank, mobTable->bEmpire); + SPDLOG_TRACE("MOB #{:<5} {:24} level: {:<3} rank: {} empire: {}", mobTable->dwVnum, mobTable->szLocaleName, mobTable->bLevel, mobTable->bRank, mobTable->bEmpire); return true; } @@ -739,9 +739,9 @@ bool Set_Proto_Item_Table(TItemTable *itemTable, cCsvTable &csvTable,std::mapdwVnum = start_vnum; diff --git a/src/db/src/stdafx.h b/src/db/src/stdafx.h index 6d90277..df0b38d 100644 --- a/src/db/src/stdafx.h +++ b/src/db/src/stdafx.h @@ -17,8 +17,6 @@ #include #include -#include - #include #include #include diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index fb95bdf..d38d96d 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -47,10 +47,6 @@ target_link_libraries(${PROJECT_NAME} effolkronium_random) find_package(fmt CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} fmt::fmt) -# spdlog -find_package(spdlog CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} spdlog::spdlog) - # # System-provided dependencies # diff --git a/src/game/src/dragon_soul_table.cpp b/src/game/src/dragon_soul_table.cpp index 5da74db..e9909e3 100644 --- a/src/game/src/dragon_soul_table.cpp +++ b/src/game/src/dragon_soul_table.cpp @@ -113,7 +113,7 @@ bool DragonSoulTable::ReadVnumMapper() int n = pGroupNode->GetRowCount(); if (0 == n) { - sys_err ("Group VnumMapper is Empty."); + SPDLOG_ERROR("Group VnumMapper is Empty."); return false; } diff --git a/src/game/src/input_main.cpp b/src/game/src/input_main.cpp index 5ca4e06..dd137e6 100644 --- a/src/game/src/input_main.cpp +++ b/src/game/src/input_main.cpp @@ -1671,7 +1671,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) */ /* SPDLOG_TRACE( - "MOVE: %s Func:%u Arg:%u Pos:%dx%d Time:%u Dist:%.1f", + "MOVE: {} Func:{} Arg:{} Pos:{}x{} Time:{} Dist:{:.1f}", ch->GetName(), pinfo->bFunc, pinfo->bArg, diff --git a/src/game/src/item_manager.cpp b/src/game/src/item_manager.cpp index e8ff4d7..90e0d53 100644 --- a/src/game/src/item_manager.cpp +++ b/src/game/src/item_manager.cpp @@ -1188,14 +1188,13 @@ static void __DropEvent_CharStone_DropItem(CHARACTER & killer, CHARACTER & victi if (Random::get(1, MaxRange) <= dropPercent) { - int log_level = (test_server || killer.GetGMLevel() >= GM_LOW_WIZARD) ? 0 : 1; int victim_level = victim.GetLevel(); int level_diff = victim_level - killer_level; if (level_diff >= +gs_dropEvent_charStone.level_range || level_diff <= -gs_dropEvent_charStone.level_range) { - sys_log(log_level, - "dropevent.drop_char_stone.level_range_over: killer(%s: lv%d), victim(%s: lv:%d), level_diff(%d)", + SPDLOG_DEBUG( + "dropevent.drop_char_stone.level_range_over: killer({}: lv{}), victim({}: lv:{}), level_diff({})", killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff); return; } @@ -1209,8 +1208,8 @@ static void __DropEvent_CharStone_DropItem(CHARACTER & killer, CHARACTER & victi { vec_item.push_back(p_item); - sys_log(log_level, - "dropevent.drop_char_stone.item_drop: killer(%s: lv%d), victim(%s: lv:%d), item_name(%s)", + SPDLOG_DEBUG( + "dropevent.drop_char_stone.item_drop: killer({}: lv{}), victim({}: lv:{}), item_name({})", killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName()); } } @@ -1295,8 +1294,8 @@ static LPITEM __DropEvent_RefineBox_GetDropItem(CHARACTER & killer, CHARACTER & //if (level_diff >= +gs_dropEvent_refineBox.level_range || level_diff <= -gs_dropEvent_refineBox.level_range) //{ - // sys_log(log_level, - // "dropevent.drop_refine_box.level_range_over: killer(%s: lv%d), victim(%s: lv:%d), level_diff(%d)", + // SPDLOG_DEBUG( + // "dropevent.drop_refine_box.level_range_over: killer({}: lv{}), victim({}: lv:{}), level_diff({})", // killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff); // return NULL; //} @@ -1330,16 +1329,14 @@ static void __DropEvent_RefineBox_DropItem(CHARACTER & killer, CHARACTER & victi if (!gs_dropEvent_refineBox.alive) return; - int log_level = (test_server || killer.GetGMLevel() >= GM_LOW_WIZARD) ? 0 : 1; - LPITEM p_item = __DropEvent_RefineBox_GetDropItem(killer, victim, itemMgr); if (p_item) { vec_item.push_back(p_item); - sys_log(log_level, - "dropevent.drop_refine_box.item_drop: killer(%s: lv%d), victim(%s: lv:%d), item_name(%s)", + SPDLOG_DEBUG( + "dropevent.drop_refine_box.item_drop: killer({}: lv{}), victim({}: lv:{}), item_name({})", killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName()); } } diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index 7284f2c..fd79c68 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -790,14 +790,12 @@ int idle() if (!io_loop(ev_base)) return 0; s_dwProfiler[PROF_IO] += (get_dword_time() - t); - log_rotate(); - gettimeofday(&now, (struct timezone *) 0); ++process_time_count; if (now.tv_sec - pta.tv_sec > 0) { - pt_log("[%3d] event %5d/%-5d idle %-4ld event %-4ld heartbeat %-4ld I/O %-4ld chrUpate %-4ld | WRITE: %-7d | PULSE: %d", + SPDLOG_TRACE("[{:3}] event {:5}/{:<5} idle {:<4} event {:<4} heartbeat {:<4} I/O {:<4} chrUpate {:<4} | WRITE: {:<7} | PULSE: {}", process_time_count, num_events_called, event_count(), diff --git a/src/game/src/questmanager.cpp b/src/game/src/questmanager.cpp index 054b62a..e9ceb2f 100644 --- a/src/game/src/questmanager.cpp +++ b/src/game/src/questmanager.cpp @@ -1648,7 +1648,7 @@ namespace quest vsnprintf(szMsg, sizeof(szMsg), fmt, args); va_end(args); - _sys_err(func, line, "%s", szMsg); + SPDLOG_ERROR("Quest error occurred in [{}:{}}]: {}", func, line, szMsg); if (test_server) { LPCHARACTER ch = GetCurrentCharacterPtr(); diff --git a/src/game/src/stdafx.h b/src/game/src/stdafx.h index bdd77ca..375c48c 100644 --- a/src/game/src/stdafx.h +++ b/src/game/src/stdafx.h @@ -14,8 +14,6 @@ #include #include -#include - #include #include #include diff --git a/src/libsql/src/CAsyncSQL.cpp b/src/libsql/src/CAsyncSQL.cpp index 2e8ba64..2d42506 100644 --- a/src/libsql/src/CAsyncSQL.cpp +++ b/src/libsql/src/CAsyncSQL.cpp @@ -44,7 +44,7 @@ void CAsyncSQL::Destroy() { if (m_hDB.host) { - sys_log(0, "AsyncSQL: closing mysql connection."); + SPDLOG_INFO("AsyncSQL: closing mysql connection."); mysql_close(&m_hDB); m_hDB.host = NULL; } @@ -91,23 +91,23 @@ bool CAsyncSQL::QueryLocaleSet() { if (0 == m_stLocale.length()) { - sys_err("m_stLocale == 0"); + SPDLOG_TRACE("m_stLocale == 0"); return true; } else if (m_stLocale == "ascii") { - sys_err("m_stLocale == ascii"); + SPDLOG_TRACE("m_stLocale == ascii"); return true; } if (mysql_set_character_set(&m_hDB, m_stLocale.c_str())) { - sys_err("cannot set locale %s by 'mysql_set_character_set', errno %u %s", m_stLocale.c_str(), mysql_errno(&m_hDB) , mysql_error(&m_hDB)); + SPDLOG_ERROR("cannot set locale {} by 'mysql_set_character_set', errno {} {}", m_stLocale, mysql_errno(&m_hDB) , mysql_error(&m_hDB)); return false; } - sys_log(0, "\t--mysql_set_character_set(%s)", m_stLocale.c_str()); + SPDLOG_TRACE("\t--mysql_set_character_set({})", m_stLocale); return true; } @@ -116,7 +116,7 @@ bool CAsyncSQL::Connect() { if (0 == mysql_init(&m_hDB)) { - fprintf(stderr, "mysql_init failed\n"); + SPDLOG_CRITICAL("mysql_init failed"); return false; } @@ -128,22 +128,22 @@ bool CAsyncSQL::Connect() //mysql_options(&m_hDB, MYSQL_SET_CHARSET_DIR , "/usr/local/share/mysql"); if (mysql_options(&m_hDB, MYSQL_SET_CHARSET_NAME, m_stLocale.c_str()) != 0) { - fprintf(stderr, "mysql_option failed : MYSQL_SET_CHARSET_NAME %s ", mysql_error(&m_hDB)); + SPDLOG_ERROR("Setting MYSQL_SET_CHARSET_NAME via mysql_options failed: {}", mysql_error(&m_hDB)); } } if (!mysql_real_connect(&m_hDB, m_stHost.c_str(), m_stUser.c_str(), m_stPassword.c_str(), m_stDB.c_str(), m_iPort, NULL, CLIENT_MULTI_STATEMENTS)) { - fprintf(stderr, "mysql_real_connect: %s\n", mysql_error(&m_hDB)); + SPDLOG_ERROR("MySQL connection failed: {}", mysql_error(&m_hDB)); return false; } bool reconnect = true; if (0 != mysql_options(&m_hDB, MYSQL_OPT_RECONNECT, &reconnect)) - fprintf(stderr, "mysql_option: %s\n", mysql_error(&m_hDB)); + SPDLOG_ERROR("Setting MYSQL_OPT_RECONNECT via mysql_options failed: {}", mysql_error(&m_hDB)); - fprintf(stdout, "AsyncSQL: connected to %s (reconnect %d)\n", m_stHost.c_str(), m_hDB.reconnect); + SPDLOG_INFO("AsyncSQL: connected to {} (reconnect {})", m_stHost, m_hDB.reconnect); // db cache´Â common dbÀÇ LOCALE Å×ÀÌºí¿¡¼­ localeÀ» ¾Ë¾Æ¿À°í, ÀÌÈÄ character setÀ» ¼öÁ¤ÇÑ´Ù. // µû¶ó¼­ ÃÖÃÊ ConnectionÀ» ¸ÎÀ» ¶§¿¡´Â localeÀ» ¸ð¸£±â ¶§¹®¿¡ character setÀ» Á¤ÇÒ ¼ö°¡ ¾øÀ½¿¡µµ ºÒ±¸ÇÏ°í, @@ -178,7 +178,7 @@ bool CAsyncSQL::Setup(const char * c_pszHost, const char * c_pszUser, const char if (c_pszLocale) { m_stLocale = c_pszLocale; - sys_log(0, "AsyncSQL: locale %s", m_stLocale.c_str()); + SPDLOG_DEBUG("AsyncSQL: locale {}", m_stLocale); } if (!bNoThread) @@ -250,7 +250,7 @@ SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery) { if (m_ulThreadID != mysql_thread_id(&m_hDB)) { - sys_err("MySQL connection was reconnected. querying locale set"); + SPDLOG_WARN("MySQL connection was reconnected. querying locale set"); while (!QueryLocaleSet()); m_ulThreadID = mysql_thread_id(&m_hDB); } @@ -263,13 +263,7 @@ SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery) if (mysql_real_query(&m_hDB, p->stQuery.c_str(), p->stQuery.length())) { - char buf[1024]; - - snprintf(buf, sizeof(buf), - "AsyncSQL::DirectQuery : mysql_query error: %s\nquery: %s", - mysql_error(&m_hDB), p->stQuery.c_str()); - - sys_err(buf); + SPDLOG_ERROR("AsyncSQL::DirectQuery : mysql_query error: {}\nquery: {}", mysql_error(&m_hDB), p->stQuery); p->uiSQLErrno = mysql_errno(&m_hDB); } @@ -554,7 +548,7 @@ void CAsyncSQL::ChildLoop() if (m_ulThreadID != mysql_thread_id(&m_hDB)) { - sys_err("MySQL connection was reconnected. querying locale set"); + SPDLOG_WARN("MySQL connection was reconnected. querying locale set"); while (!QueryLocaleSet()); m_ulThreadID = mysql_thread_id(&m_hDB); } @@ -563,8 +557,8 @@ void CAsyncSQL::ChildLoop() { p->uiSQLErrno = mysql_errno(&m_hDB); - sys_err("AsyncSQL: query failed: %s (query: %s errno: %d)", - mysql_error(&m_hDB), p->stQuery.c_str(), p->uiSQLErrno); + SPDLOG_ERROR("AsyncSQL: query failed: {} (query: {} errno: {})", + mysql_error(&m_hDB), p->stQuery, p->uiSQLErrno); switch (p->uiSQLErrno) { @@ -584,7 +578,7 @@ void CAsyncSQL::ChildLoop() case ER_CANT_CREATE_THREAD: case ER_INVALID_USE_OF_NULL: m_sem.Release(); - sys_err("AsyncSQL: retrying"); + SPDLOG_WARN("AsyncSQL: retrying"); continue; } } @@ -593,8 +587,8 @@ void CAsyncSQL::ChildLoop() // 0.5ÃÊ ÀÌ»ó °É·ÈÀ¸¸é ·Î±×¿¡ ³²±â±â if (!profiler.IsOk()) - sys_log(0, "[QUERY : LONG INTERVAL(OverSec %ld.%ld)] : %s", - profiler.GetResultSec(), profiler.GetResultUSec(), p->stQuery.c_str()); + SPDLOG_TRACE("[QUERY : LONG INTERVAL(OverSec {}.{})] : {}", + profiler.GetResultSec(), profiler.GetResultUSec(), p->stQuery); PopQueryFromCopyQueue(); @@ -616,7 +610,7 @@ void CAsyncSQL::ChildLoop() { if (m_ulThreadID != mysql_thread_id(&m_hDB)) { - sys_err("MySQL connection was reconnected. querying locale set"); + SPDLOG_WARN("MySQL connection was reconnected. querying locale set"); while (!QueryLocaleSet()); m_ulThreadID = mysql_thread_id(&m_hDB); } @@ -625,8 +619,8 @@ void CAsyncSQL::ChildLoop() { p->uiSQLErrno = mysql_errno(&m_hDB); - sys_err("AsyncSQL::ChildLoop : mysql_query error: %s:\nquery: %s", - mysql_error(&m_hDB), p->stQuery.c_str()); + SPDLOG_ERROR("AsyncSQL::ChildLoop : mysql_query error: {}:\nquery: {}", + mysql_error(&m_hDB), p->stQuery); switch (p->uiSQLErrno) { @@ -649,7 +643,7 @@ void CAsyncSQL::ChildLoop() } } - sys_log(0, "QUERY_FLUSH: %s", p->stQuery.c_str()); + SPDLOG_TRACE("QUERY_FLUSH: {}", p->stQuery); PopQuery(p->iID); @@ -698,7 +692,7 @@ size_t CAsyncSQL::EscapeString(char* dst, size_t dstSize, const char *src, size_ size_t tmpLen = sizeof(tmp) > srcSize ? srcSize : sizeof(tmp); // µÑ Áß¿¡ ÀÛÀº Å©±â strlcpy(tmp, src, tmpLen); - sys_err("FATAL ERROR!! not enough buffer size (dstSize %u srcSize %u src%s: %s)", + SPDLOG_CRITICAL("FATAL ERROR!! not enough buffer size (dstSize {} srcSize {} src{}: {})", dstSize, srcSize, tmpLen != srcSize ? "(trimmed to 255 characters)" : "", tmp); dst[0] = '\0'; diff --git a/src/libsql/src/CStatement.cpp b/src/libsql/src/CStatement.cpp index 2bb5348..4f666ed 100644 --- a/src/libsql/src/CStatement.cpp +++ b/src/libsql/src/CStatement.cpp @@ -34,7 +34,7 @@ void CStmt::Destroy() void CStmt::Error(const char * c_pszMsg) { - sys_log(0, "SYSERR: %s: [%d] %s", c_pszMsg, mysql_stmt_errno(m_pkStmt), mysql_stmt_error(m_pkStmt)); + SPDLOG_ERROR("SYSERR: {}: [{}] {}", c_pszMsg, mysql_stmt_errno(m_pkStmt), mysql_stmt_error(m_pkStmt)); } bool CStmt::Prepare(CAsyncSQL * sql, const char * c_pszQuery) @@ -78,7 +78,7 @@ bool CStmt::BindParam(enum_field_types type, void * p, int iMaxLen) { if (m_uiParamCount >= m_vec_param.size()) { - sys_err("too many parameter in query: %s", m_stQuery.c_str()); + SPDLOG_ERROR("too many parameter in query: {}", m_stQuery); return false; } @@ -105,7 +105,7 @@ bool CStmt::BindResult(enum_field_types type, void * p, int iMaxLen) { if (m_uiResultCount >= m_vec_result.size()) { - sys_err("too many result in query: %s", m_stQuery.c_str()); + SPDLOG_ERROR("too many result in query: {}", m_stQuery); return false; } @@ -121,7 +121,7 @@ int CStmt::Execute() { if (m_uiParamCount != m_vec_param.size()) { - sys_log(0, "Parameter not enough %d, expected %d query: %s", m_uiParamCount, m_vec_param.size(), m_stQuery.c_str()); + SPDLOG_ERROR("Parameter not enough {}, expected {} query: {}", m_uiParamCount, m_vec_param.size(), m_stQuery); return 0; } @@ -132,7 +132,7 @@ int CStmt::Execute() if (bind->buffer_type == MYSQL_TYPE_STRING) { *(m_puiParamLen + i) = strlen((const char *) bind->buffer); - sys_log(0, "param %d len %d buf %s", i, *m_puiParamLen, (const char *) bind->buffer); + SPDLOG_TRACE("param {} len {} buf {}", i, *m_puiParamLen, (const char *) bind->buffer); } } diff --git a/src/libthecore/CMakeLists.txt b/src/libthecore/CMakeLists.txt index 7ac98e8..8a95011 100644 --- a/src/libthecore/CMakeLists.txt +++ b/src/libthecore/CMakeLists.txt @@ -18,3 +18,11 @@ add_library(${PROJECT_NAME} STATIC ${SOURCES}) find_package(Boost REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES}) + +# fmt +find_package(fmt CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) + +# spdlog +find_package(spdlog CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) diff --git a/src/libthecore/include/log.h b/src/libthecore/include/log.h index e759144..16cb696 100644 --- a/src/libthecore/include/log.h +++ b/src/libthecore/include/log.h @@ -1,39 +1,12 @@ -#ifndef __INC_LIBTHECORE_LOG_H__ -#define __INC_LIBTHECORE_LOG_H__ +#pragma once -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - extern int log_init(void); - extern void log_destroy(void); - extern void log_rotate(void); +extern int log_init(void); +extern void log_destroy(void); - // ·Î±× ·¹º§ ó¸® (·¹º§Àº bitvector·Î 󸮵ȴÙ) - extern void log_set_level(unsigned int level); - extern void log_unset_level(unsigned int level); +// ·Î±× ·¹º§ ó¸® (·¹º§Àº bitvector·Î 󸮵ȴÙ) +extern void log_set_level(unsigned int level); +extern void log_unset_level(unsigned int level); - // ·Î±× ÆÄÀÏÀ» ¾ó¸¸Å­ º¸°üÇϴ°¡¿¡ ´ëÇÑ ÇÔ¼ö - extern void log_set_expiration_days(unsigned int days); - extern int log_get_expiration_days(void); - -#ifndef __WIN32__ - extern void _sys_err(const char *func, int line, const char *format, ...); -#else - extern void _sys_err(const char *func, int line, const char *format, ...); -#endif - extern void sys_log_header(const char *header); - extern void sys_log(unsigned int lv, const char *format, ...); - extern void pt_log(const char *format, ...); - -#ifndef __WIN32__ -#define sys_err(fmt, args...) _sys_err(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) _sys_err(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif // __WIN32__ - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // __INC_LOG_H__ +// ·Î±× ÆÄÀÏÀ» ¾ó¸¸Å­ º¸°üÇϴ°¡¿¡ ´ëÇÑ ÇÔ¼ö +extern void log_set_expiration_days(unsigned int days); +extern int log_get_expiration_days(void); diff --git a/src/libthecore/include/stdafx.h b/src/libthecore/include/stdafx.h index fee89a7..3146ad9 100644 --- a/src/libthecore/include/stdafx.h +++ b/src/libthecore/include/stdafx.h @@ -28,6 +28,9 @@ #include +#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE +#include + #include #include diff --git a/src/libthecore/include/utils.h b/src/libthecore/include/utils.h index b1ec6ec..c560f38 100644 --- a/src/libthecore/include/utils.h +++ b/src/libthecore/include/utils.h @@ -42,7 +42,7 @@ using Random = effolkronium::random_static; #define CREATE(result, type, number) do { \ if (!((result) = (type *) calloc ((number), sizeof(type)))) { \ - sys_err("calloc failed [%d] %s", errno, strerror(errno)); \ + SPDLOG_CRITICAL("calloc failed [{}] {}", errno, strerror(errno)); \ abort(); } } while(0) #define RECREATE(result,type,number) do { \ diff --git a/src/libthecore/src/buffer.cpp b/src/libthecore/src/buffer.cpp index 7f71ce3..ba38d11 100644 --- a/src/libthecore/src/buffer.cpp +++ b/src/libthecore/src/buffer.cpp @@ -71,7 +71,7 @@ bool safe_create(char** pdata, int number) { if (!((*pdata) = (char *) calloc (number, sizeof(char)))) { - sys_err("calloc failed [%d] %s", errno, strerror(errno)); + SPDLOG_ERROR("calloc failed [{}] {}", errno, strerror(errno)); return false; } else @@ -111,7 +111,7 @@ LPBUFFER buffer_new(int size) // ½ÇÆÐÇϸé ÃÖÈÄÀÇ ¼ö´ÜÀ¸·Î, ¸ðµç poolÀ» ÇØÁ¦ÇÑ´Ù. buffer_pool_free(); CREATE(buffer->mem_data, char, size); - sys_err ("buffer pool free success."); + SPDLOG_ERROR("buffer pool free success."); } } assert(buffer != NULL); @@ -206,10 +206,10 @@ void buffer_read_proceed(LPBUFFER buffer, int length) return; if (length < 0) - sys_err("buffer_proceed: length argument lower than zero (length: %d)", length); + SPDLOG_ERROR("buffer_proceed: length argument lower than zero (length: {})", length); else if (length > buffer->length) { - sys_err("buffer_proceed: length argument bigger than buffer (length: %d, buffer: %d)", length, buffer->length); + SPDLOG_ERROR("buffer_proceed: length argument bigger than buffer (length: {}, buffer: {})", length, buffer->length); length = buffer->length; } @@ -219,7 +219,7 @@ void buffer_read_proceed(LPBUFFER buffer, int length) // write_point ¿Í pos ´Â ±×´ë·Î µÎ°í read_point ¸¸ Áõ°¡ ½ÃŲ´Ù. if (buffer->read_point + length - buffer->mem_data > buffer->mem_size) { - sys_err("buffer_read_proceed: buffer overflow! length %d read_point %d", length, buffer->read_point - buffer->mem_data); + SPDLOG_ERROR("buffer_read_proceed: buffer overflow! length {} read_point {}", length, buffer->read_point - buffer->mem_data); abort(); } @@ -254,7 +254,7 @@ void buffer_adjust_size(LPBUFFER& buffer, int add_size) if (buffer->mem_size >= buffer->write_point_pos + add_size) return; - sys_log(0, "buffer_adjust %d current %d/%d", add_size, buffer->length, buffer->mem_size); + SPDLOG_TRACE("buffer_adjust {} current {}/{}", add_size, buffer->length, buffer->mem_size); buffer_realloc(buffer, buffer->mem_size + add_size); } @@ -276,7 +276,7 @@ void buffer_realloc(LPBUFFER& buffer, int length) return; temp = buffer_new (length); - sys_log(0, "reallocating buffer to %d, current %d", temp->mem_size, buffer->mem_size); + SPDLOG_TRACE("reallocating buffer to {}, current {}", temp->mem_size, buffer->mem_size); memcpy(temp->mem_data, buffer->mem_data, buffer->mem_size); read_point_pos = buffer->read_point - buffer->mem_data; diff --git a/src/libthecore/src/heart.cpp b/src/libthecore/src/heart.cpp index b6b5a87..649c3d9 100644 --- a/src/libthecore/src/heart.cpp +++ b/src/libthecore/src/heart.cpp @@ -15,8 +15,8 @@ LPHEART heart_new(int opt_usec, HEARTFUNC func) if (!func) { - sys_err("no function defined"); - return NULL; + SPDLOG_ERROR("no function defined"); + return NULL; } CREATE(ht, HEART, 1); @@ -80,14 +80,14 @@ int heart_idle(LPHEART ht) if (missed_pulse <= 0) { - sys_err("missed_pulse is not positive! (%d)", missed_pulse); - missed_pulse = 1; + SPDLOG_ERROR("missed_pulse is not positive! ({})", missed_pulse); + missed_pulse = 1; } if (missed_pulse > (30 * ht->passes_per_sec)) { - sys_err("losing %d seconds. (lag occured)", missed_pulse / ht->passes_per_sec); - missed_pulse = 30 * ht->passes_per_sec; + SPDLOG_ERROR("losing {} seconds. (lag occured)", missed_pulse / ht->passes_per_sec); + missed_pulse = 30 * ht->passes_per_sec; } return missed_pulse; diff --git a/src/libthecore/src/log.cpp b/src/libthecore/src/log.cpp index 2ecde97..b9591f5 100644 --- a/src/libthecore/src/log.cpp +++ b/src/libthecore/src/log.cpp @@ -1,57 +1,19 @@ -/* - * Filename: log.c - * Description: local log file °ü·Ã - * - * Author: ºñ¿± aka. Cronan - */ #define __LIBTHECORE__ #include "stdafx.h" +#include "spdlog/sinks/stdout_color_sinks.h" -#ifndef __WIN32__ -#define SYSLOG_FILENAME "syslog" -#define SYSERR_FILENAME "syserr" -#define PTS_FILENAME "PTS" -#else #define SYSLOG_FILENAME "syslog.txt" #define SYSERR_FILENAME "syserr.txt" -#define PTS_FILENAME "PTS.txt" -#endif -typedef struct log_file_s * LPLOGFILE; -typedef struct log_file_s LOGFILE; - -struct log_file_s -{ - char* filename; - FILE* fp; - - int last_hour; - int last_day; -}; - -LPLOGFILE log_file_sys = NULL; -LPLOGFILE log_file_err = NULL; -LPLOGFILE log_file_pt = NULL; -static char log_dir[32] = { 0, }; unsigned int log_keep_days = 3; -// Internal functions -LPLOGFILE log_file_init(const char* filename, const char *openmode); -void log_file_destroy(LPLOGFILE logfile); -void log_file_rotate(LPLOGFILE logfile); -void log_file_check(LPLOGFILE logfile); -void log_file_set_dir(const char *dir); - -static unsigned int log_level_bits = 7; void log_set_level(unsigned int bit) { - log_level_bits |= bit; } void log_unset_level(unsigned int bit) { - log_level_bits &= ~bit; } void log_set_expiration_days(unsigned int days) @@ -66,404 +28,12 @@ int log_get_expiration_days(void) int log_init(void) { - log_file_set_dir("./log"); + //spdlog::set_level(spdlog::level::debug); - do - { - log_file_sys = log_file_init(SYSLOG_FILENAME, "a+"); - if( NULL == log_file_sys ) break; - - log_file_err = log_file_init(SYSERR_FILENAME, "a+"); - if( NULL == log_file_err ) break; - - log_file_pt = log_file_init(PTS_FILENAME, "w"); - if( NULL == log_file_pt ) break; - - return true; - } - while( false ); - - return false; + return 1; } void log_destroy(void) { - log_file_destroy(log_file_sys); - log_file_destroy(log_file_err); - log_file_destroy(log_file_pt); - log_file_sys = NULL; - log_file_err = NULL; - log_file_pt = NULL; -} - -void log_rotate(void) -{ - log_file_check(log_file_sys); - log_file_check(log_file_err); - log_file_check(log_file_pt); - - log_file_rotate(log_file_sys); -} - -#ifndef __WIN32__ -void _sys_err(const char *func, int line, const char *format, ...) -{ - va_list args; - time_t ct = time(0); - char *time_s = asctime(localtime(&ct)); - - struct timeval tv; - int nMiliSec = 0; - gettimeofday(&tv, NULL); - - - - char buf[1024 + 2]; // \nÀ» ºÙÀ̱â À§ÇØ.. - int len; - - if (!log_file_err) - return; - - time_s[strlen(time_s) - 1] = '\0'; - len = snprintf(buf, 1024, "SYSERR: %-15.15s.%ld :: %s: ", time_s + 4, tv.tv_usec, func); - buf[1025] = '\0'; - - if (len < 1024) - { - va_start(args, format); - vsnprintf(buf + len, 1024 - len, format, args); - va_end(args); - } - - strcat(buf, "\n"); - - // log_file_err ¿¡ Ãâ·Â - fputs(buf, log_file_err->fp); - fflush(log_file_err->fp); - - // log_file_sys ¿¡µµ Ãâ·Â - fputs(buf, log_file_sys->fp); - fflush(log_file_sys->fp); -} -#else -void _sys_err(const char *func, int line, const char *format, ...) -{ - va_list args; - time_t ct = time(0); - char *time_s = asctime(localtime(&ct)); - - char buf[1024 + 2]; // \nÀ» ºÙÀ̱â À§ÇØ.. - int len; - - if (!log_file_err) - return; - - time_s[strlen(time_s) - 1] = '\0'; - len = snprintf(buf, 1024, "SYSERR: %-15.15s :: %s: ", time_s + 4, func); - buf[1025] = '\0'; - - if (len < 1024) - { - va_start(args, format); - vsnprintf(buf + len, 1024 - len, format, args); - va_end(args); - } - - strcat(buf, "\n"); - - // log_file_err ¿¡ Ãâ·Â - fputs(buf, log_file_err->fp); - fflush(log_file_err->fp); - - // log_file_sys ¿¡µµ Ãâ·Â - fputs(buf, log_file_sys->fp); - fflush(log_file_sys->fp); - - fputs(buf, stdout); - fflush(stdout); -} -#endif - -static char sys_log_header_string[33] = ""; - -void sys_log_header(const char *header) -{ - strncpy(sys_log_header_string, header, 32); -} - -void sys_log(unsigned int bit, const char *format, ...) -{ - va_list args; - - struct timeval tv; - int nMiliSec = 0; - gettimeofday(&tv, NULL); - - if (bit != 0 && !(log_level_bits & bit)) - return; - - if (log_file_sys) - { - time_t ct = time(0); - char *time_s = asctime(localtime(&ct)); - - fprintf(log_file_sys->fp, sys_log_header_string); - - time_s[strlen(time_s) - 1] = '\0'; - fprintf(log_file_sys->fp, "%-15.15s.%ld :: ", time_s + 4, tv.tv_usec ); - - va_start(args, format); - vfprintf(log_file_sys->fp, format, args); - va_end(args); - - fputc('\n', log_file_sys->fp); - fflush(log_file_sys->fp); - } - -#ifndef __WIN32__ - // log_levelÀÌ 1 ÀÌ»óÀÏ °æ¿ì¿¡´Â Å×½ºÆ®ÀÏ °æ¿ì°¡ ¸¹À¸´Ï stdout¿¡µµ Ãâ·ÂÇÑ´Ù. - if (log_level_bits > 1) - { -#endif - fprintf(stdout, sys_log_header_string); - - va_start(args, format); - vfprintf(stdout, format, args); - va_end(args); - - fputc('\n', stdout); - fflush(stdout); -#ifndef __WIN32__ - } -#endif -} - -void pt_log(const char *format, ...) -{ - va_list args; - - if (!log_file_pt) - return; - - va_start(args, format); - vfprintf(log_file_pt->fp, format, args); - va_end(args); - - fputc('\n', log_file_pt->fp); - fflush(log_file_pt->fp); -} - -LPLOGFILE log_file_init(const char * filename, const char * openmode) -{ - LPLOGFILE logfile; - FILE * fp; - struct tm curr_tm; - time_t time_s; - - time_s = time(0); - curr_tm = *localtime(&time_s); - - fp = fopen(filename, openmode); - - if (!fp) - return NULL; - - logfile = (LPLOGFILE) malloc(sizeof(LOGFILE)); - logfile->filename = strdup(filename); - logfile->fp = fp; - logfile->last_hour = curr_tm.tm_hour; - logfile->last_day = curr_tm.tm_mday; - - return (logfile); -} - -void log_file_destroy(LPLOGFILE logfile) -{ - if (logfile == NULL) { - return; - } - - if (logfile->filename) - { - free(logfile->filename); - logfile->filename = NULL; - } - - if (logfile->fp) - { - fclose(logfile->fp); - logfile->fp = NULL; - } - - free(logfile); -} - -void log_file_check(LPLOGFILE logfile) -{ - struct stat sb; - - // ÆÄÀÏÀÌ ¾øÀ¸¹Ç·Î ´Ù½Ã ¿¬´Ù. - if (stat(logfile->filename, &sb) != 0 && errno == ENOENT) - { - fclose(logfile->fp); - logfile->fp = fopen(logfile->filename, "a+"); - } -} - -void log_file_delete_old(const char *filename) -{ - struct stat sb; - int num1, num2; - char buf[32]; - char system_cmd[512]; - struct tm new_tm; - - if (stat(filename, &sb) == -1) - { - perror("log_file_delete_old: stat"); - return; - } - - if (!S_ISDIR(sb.st_mode)) - return; - - new_tm = *tm_calc(NULL, -log_keep_days); - sprintf(buf, "%04d%02d%02d", new_tm.tm_year + 1900, new_tm.tm_mon + 1, new_tm.tm_mday); - num1 = atoi(buf); -#ifndef __WIN32__ - { - struct dirent ** namelist; - int n; - - n = scandir(filename, &namelist, 0, alphasort); - - if (n < 0) - perror("scandir"); - else - { - char name[MAXNAMLEN+1]; - - while (n-- > 0) - { - strncpy(name, namelist[n]->d_name, 255); - name[255] = '\0'; - - free(namelist[n]); - - if (*name == '.') - continue; - - if (!isdigit(*name)) - continue; - - num2 = atoi(name); - - if (num2 <= num1) - { - snprintf(system_cmd, sizeof(system_cmd), "rm -rf %s/%s", filename, name); - system(system_cmd); - - sys_log(0, "%s: SYSTEM_CMD: %s", __FUNCTION__, system_cmd); - fprintf(stderr, "%s: SYSTEM_CMD: %s %s:%d %s:%d\n", __FUNCTION__, system_cmd, buf, num1, name, num2); - } - } - } - - free(namelist); - } -#else - { - WIN32_FIND_DATA fdata; - HANDLE hFind; - if ((hFind = FindFirstFile(filename, &fdata)) != INVALID_HANDLE_VALUE) - { - do - { - if (!isdigit(*fdata.cFileName)) - continue; - - num2 = atoi(fdata.cFileName); - - if (num2 <= num1) - { - sprintf(system_cmd, "del %s\\%s", filename, fdata.cFileName); - system(system_cmd); - - sys_log(0, "SYSTEM_CMD: %s", system_cmd); - } - } - while (FindNextFile(hFind, &fdata)); - } - } -#endif -} - -void log_file_rotate(LPLOGFILE logfile) -{ - struct tm curr_tm; - time_t time_s; - char dir[256]; - char system_cmd[512]; - - time_s = time(0); - curr_tm = *localtime(&time_s); - - if (curr_tm.tm_mday != logfile->last_day) - { - struct tm new_tm; - new_tm = *tm_calc(&curr_tm, -3); - -#ifndef __WIN32__ - sprintf(system_cmd, "rm -rf %s/%04d%02d%02d", log_dir, new_tm.tm_year + 1900, new_tm.tm_mon + 1, new_tm.tm_mday); -#else - sprintf(system_cmd, "del %s\\%04d%02d%02d", log_dir, new_tm.tm_year + 1900, new_tm.tm_mon + 1, new_tm.tm_mday); -#endif - system(system_cmd); - - sys_log(0, "SYSTEM_CMD: %s", system_cmd); - - logfile->last_day = curr_tm.tm_mday; - } - - if (curr_tm.tm_hour != logfile->last_hour) - { - struct stat stat_buf; - snprintf(dir, sizeof(dir), "%s/%04d%02d%02d", log_dir, curr_tm.tm_year + 1900, curr_tm.tm_mon + 1, curr_tm.tm_mday); - - if (stat(dir, &stat_buf) != 0 || S_ISDIR(stat_buf.st_mode)) - { -#ifdef __WIN32__ - CreateDirectory(dir, NULL); -#else - mkdir(dir, S_IRWXU); -#endif - } - - sys_log(0, "SYSTEM: LOG ROTATE (%04d-%02d-%02d %d)", - curr_tm.tm_year + 1900, curr_tm.tm_mon + 1, curr_tm.tm_mday, logfile->last_hour); - - // ·Î±× ÆÄÀÏÀ» ´Ý°í - fclose(logfile->fp); - - // ¿Å±ä´Ù. -#ifndef __WIN32__ - snprintf(system_cmd, sizeof(system_cmd), "mv %s %s/%s.%02d", logfile->filename, dir, logfile->filename, logfile->last_hour); -#else - snprintf(system_cmd, sizeof(system_cmd), "move %s %s\\%s.%02d", logfile->filename, dir, logfile->filename, logfile->last_hour); -#endif - system(system_cmd); - - // ¸¶Áö¸· ÀúÀå½Ã°£ ÀúÀå - logfile->last_hour = curr_tm.tm_hour; - - // ·Î±× ÆÄÀÏÀ» ´Ù½Ã ¿¬´Ù. - logfile->fp = fopen(logfile->filename, "a+"); - } -} - -void log_file_set_dir(const char *dir) -{ - strcpy(log_dir, dir); - log_file_delete_old(log_dir); } diff --git a/src/libthecore/src/main.cpp b/src/libthecore/src/main.cpp index dcac751..2c2aa3a 100644 --- a/src/libthecore/src/main.cpp +++ b/src/libthecore/src/main.cpp @@ -24,12 +24,11 @@ static int pid_init(void) { fprintf(fp, "%d", getpid()); fclose(fp); - sys_err("\nStart of pid: %d\n", getpid()); + SPDLOG_INFO("Start of pid: {}", getpid()); } else { - printf("pid_init(): could not open file for writing. (filename: ./pid)"); - sys_err("\nError writing pid file\n"); + SPDLOG_ERROR("pid_init(): could not open file for writing. (filename: ./pid)"); return false; } return true; @@ -42,7 +41,7 @@ static void pid_deinit(void) return; #else remove("./pid"); - sys_err("\nEnd of pid\n"); + SPDLOG_INFO("End of pid"); #endif } diff --git a/src/libthecore/src/utils.cpp b/src/libthecore/src/utils.cpp index 083f344..f3a23cb 100644 --- a/src/libthecore/src/utils.cpp +++ b/src/libthecore/src/utils.cpp @@ -215,11 +215,11 @@ void thecore_sleep(struct timeval* timeout) { if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0) { - if (errno != EINTR) - { - sys_err("select sleep %s", strerror(errno)); - return; - } + if (errno != EINTR) + { + SPDLOG_ERROR("select sleep {}", strerror(errno)); + return; + } } } @@ -232,8 +232,8 @@ void thecore_msleep(DWORD dwMillisecond) } void core_dump_unix(const char *who, WORD line) -{ - sys_err("*** Dumping Core %s:%d ***", who, line); +{ + SPDLOG_CRITICAL("*** Dumping Core {}:{} ***", who, line); fflush(stdout); fflush(stderr); From a7f4e4e54d3a18fa14aaba00bd2a49bd3592e055 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 3 Mar 2024 18:51:51 +0200 Subject: [PATCH 4/5] Rewrote the log initialization functions, logs are now saved in rotating files, implemented configurable log levels --- src/db/CMakeLists.txt | 12 +++-- src/db/src/Main.cpp | 13 ++--- src/game/CMakeLists.txt | 13 +++-- src/game/src/config.cpp | 8 +--- src/game/src/main.cpp | 16 ++----- src/game/src/threeway_war.cpp | 2 +- src/libthecore/CMakeLists.txt | 6 ++- src/libthecore/include/log.h | 10 +--- src/libthecore/include/stdafx.h | 1 - src/libthecore/src/log.cpp | 85 +++++++++++++++++++++++---------- src/libthecore/src/main.cpp | 37 -------------- 11 files changed, 95 insertions(+), 108 deletions(-) diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt index f9d0bae..b2fc2e5 100644 --- a/src/db/CMakeLists.txt +++ b/src/db/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.8) project(db CXX) file(GLOB_RECURSE sources - src/*.cpp src/*.h + src/*.cpp src/*.h ) # Add the src directory to the include path @@ -11,6 +11,12 @@ include_directories(src) add_executable(${PROJECT_NAME} ${sources}) +# Set the default log level based on the build type +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "This is a debug build. Log level will be set to 'trace' for target '${PROJECT_NAME}'.") + target_compile_definitions(${PROJECT_NAME} PRIVATE SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE) +endif() + # Find dependencies # @@ -29,10 +35,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core libevent::extra lib find_package(effolkronium_random CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random) -# fmt -find_package(fmt CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) - # # System-provided dependencies # diff --git a/src/db/src/Main.cpp b/src/db/src/Main.cpp index e08eaad..ac392cb 100644 --- a/src/db/src/Main.cpp +++ b/src/db/src/Main.cpp @@ -61,6 +61,7 @@ void emergency_sig(int sig) int main() { WriteVersion(); + log_init(); #ifdef __FreeBSD__ _malloc_options = "A"; @@ -114,6 +115,8 @@ int main() SPDLOG_DEBUG("WAITING_QUERY_COUNT {}", iCount); } + log_destroy(); + return 1; } @@ -151,13 +154,11 @@ int Start() return false; } - log_set_expiration_days(3); - - if (CConfig::instance().GetValue("LOG_KEEP_DAYS", &tmpValue)) + if (CConfig::instance().GetValue("LOG_LEVEL", &tmpValue)) { - tmpValue = std::clamp(tmpValue, 3, 30); - log_set_expiration_days(tmpValue); - SPDLOG_INFO("Setting log keeping days to {}", tmpValue); + SPDLOG_INFO("Setting log level to {}", tmpValue); + tmpValue = std::clamp(tmpValue, SPDLOG_LEVEL_TRACE, SPDLOG_LEVEL_OFF); + log_set_level(tmpValue); } thecore_init(heart_beat, emptybeat); diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index d38d96d..8951355 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -3,13 +3,20 @@ cmake_minimum_required(VERSION 3.8) project(game CXX) file(GLOB_RECURSE sources - src/*.cpp src/*.h + src/*.cpp src/*.h ) # Add the src directory to the include path include_directories(src) + add_executable(${PROJECT_NAME} ${sources}) +# Set the default log level based on the build type +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "This is a debug build. Log level will be set to 'trace' for target '${PROJECT_NAME}'.") + target_compile_definitions(${PROJECT_NAME} PRIVATE SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE) +endif() + # Find dependencies # @@ -43,10 +50,6 @@ endif (LZO_FOUND) find_package(effolkronium_random CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} effolkronium_random) -# fmt -find_package(fmt CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} fmt::fmt) - # # System-provided dependencies # diff --git a/src/game/src/config.cpp b/src/game/src/config.cpp index 7da6204..0818d29 100644 --- a/src/game/src/config.cpp +++ b/src/game/src/config.cpp @@ -663,10 +663,6 @@ void config_init(const string& st_localeServiceName) } // END_SKILL_POWER_BY_LEVEL - // LOG_KEEP_DAYS_EXTEND - log_set_expiration_days(2); - // END_OF_LOG_KEEP_DAYS_EXTEND - while (fgets(buf, 256, fp)) { parse_token(buf, token_string, value_string); @@ -692,11 +688,11 @@ void config_init(const string& st_localeServiceName) continue; } - TOKEN("log_keep_days") + TOKEN("log_level") { int i = 0; str_to_number(i, value_string); - log_set_expiration_days(std::clamp(i, 1, 90)); + log_set_level(std::clamp(i, SPDLOG_LEVEL_TRACE, SPDLOG_LEVEL_OFF)); continue; } diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index fd79c68..7380068 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -332,6 +332,7 @@ int main(int argc, char **argv) ilInit(); // DevIL Initialize WriteVersion(); + log_init(); SECTREE_MANAGER sectree_manager; CHARACTER_MANAGER char_manager; @@ -486,6 +487,7 @@ int main(int argc, char **argv) trafficProfiler.Flush(); destroy(); + log_destroy(); #ifdef DEBUG_ALLOC DebugAllocator::StaticTearDown(); @@ -499,7 +501,6 @@ void usage() printf("Option list\n" "-p : bind port number (port must be over 1024)\n" "-l : sets log level\n" - "-v : log to stdout\n" "-r : do not load regen tables\n" "-t : traffic proflie on\n"); } @@ -508,15 +509,13 @@ int start(int argc, char **argv) { std::string st_localeServiceName; - bool bVerbose = false; - //_malloc_options = "A"; #if defined(__FreeBSD__) && defined(DEBUG_ALLOC) _malloc_message = WriteMallocMessage; #endif int ch; - while ((ch = getopt(argc, argv, "n:p:verl:tI:")) != -1) + while ((ch = getopt(argc, argv, "n:p:erl:tI:")) != -1) { char* ep = NULL; @@ -556,10 +555,6 @@ int start(int argc, char **argv) break; // END_OF_LOCALE_SERVICE - case 'v': // verbose - bVerbose = true; - break; - case 'r': g_bNoRegen = true; break; @@ -588,11 +583,6 @@ int start(int argc, char **argv) config_init(st_localeServiceName); // END_OF_LOCALE_SERVICE -#ifdef __WIN32__ - // In Windows dev mode, "verbose" option is [on] by default. - bVerbose = true; -#endif - bool is_thecore_initialized = thecore_init(25, heartbeat); if (!is_thecore_initialized) diff --git a/src/game/src/threeway_war.cpp b/src/game/src/threeway_war.cpp index 9cdabba..611d8d7 100644 --- a/src/game/src/threeway_war.cpp +++ b/src/game/src/threeway_war.cpp @@ -41,7 +41,7 @@ EVENTFUNC(regen_mob_event) int iMapIndex = info->dwMapIndex; - char filename[128]; + char filename[256]; std::string szFilename(GetSungziMapPath()); diff --git a/src/libthecore/CMakeLists.txt b/src/libthecore/CMakeLists.txt index 8a95011..490d549 100644 --- a/src/libthecore/CMakeLists.txt +++ b/src/libthecore/CMakeLists.txt @@ -14,7 +14,11 @@ include_directories("include") # Create shared library add_library(${PROJECT_NAME} STATIC ${SOURCES}) -# Find dependencies +# +# vcpkg dependencies +# + +# Boost find_package(Boost REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES}) diff --git a/src/libthecore/include/log.h b/src/libthecore/include/log.h index 16cb696..c1db6f4 100644 --- a/src/libthecore/include/log.h +++ b/src/libthecore/include/log.h @@ -1,12 +1,6 @@ #pragma once -extern int log_init(void); -extern void log_destroy(void); +extern int log_init(); +extern void log_destroy(); -// ·Î±× ·¹º§ ó¸® (·¹º§Àº bitvector·Î 󸮵ȴÙ) extern void log_set_level(unsigned int level); -extern void log_unset_level(unsigned int level); - -// ·Î±× ÆÄÀÏÀ» ¾ó¸¸Å­ º¸°üÇϴ°¡¿¡ ´ëÇÑ ÇÔ¼ö -extern void log_set_expiration_days(unsigned int days); -extern int log_get_expiration_days(void); diff --git a/src/libthecore/include/stdafx.h b/src/libthecore/include/stdafx.h index 3146ad9..37b5b80 100644 --- a/src/libthecore/include/stdafx.h +++ b/src/libthecore/include/stdafx.h @@ -28,7 +28,6 @@ #include -#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE #include #include diff --git a/src/libthecore/src/log.cpp b/src/libthecore/src/log.cpp index b9591f5..91cf882 100644 --- a/src/libthecore/src/log.cpp +++ b/src/libthecore/src/log.cpp @@ -1,39 +1,74 @@ #define __LIBTHECORE__ #include "stdafx.h" -#include "spdlog/sinks/stdout_color_sinks.h" +#include "spdlog/sinks/daily_file_sink.h" +#include "spdlog/sinks/stdout_sinks.h" -#define SYSLOG_FILENAME "syslog.txt" -#define SYSERR_FILENAME "syserr.txt" - -unsigned int log_keep_days = 3; - - -void log_set_level(unsigned int bit) +int log_init() { -} -void log_unset_level(unsigned int bit) -{ -} + // Replace the default logger with a placeholder in order to avoid a name clash + spdlog::set_default_logger(spdlog::stderr_logger_mt("placeholder_name")); -void log_set_expiration_days(unsigned int days) -{ - log_keep_days = days; -} + // Create the new logger + std::vector sinks; + sinks.push_back(std::make_shared()); + sinks.push_back(std::make_shared("log/daily", 23, 59)); + auto combined_logger = std::make_shared("", begin(sinks), end(sinks)); -int log_get_expiration_days(void) -{ - return log_keep_days; -} + //register it if you need to access it globally + //spdlog::register_logger(combined_logger); -int log_init(void) -{ - //spdlog::set_level(spdlog::level::debug); + // Set the new logger as default + spdlog::set_default_logger(combined_logger); + + // Set flush period and default log level + spdlog::flush_every(std::chrono::seconds(5)); + spdlog::set_level(spdlog::level::info); return 1; } -void log_destroy(void) +void log_destroy() { - + spdlog::shutdown(); } + +void log_set_level(unsigned int level) +{ + spdlog::level::level_enum spdlog_level; + + switch (level) { + case SPDLOG_LEVEL_TRACE: + spdlog_level = spdlog::level::trace; + break; + + case SPDLOG_LEVEL_DEBUG: + spdlog_level = spdlog::level::debug; + break; + + case SPDLOG_LEVEL_INFO: + spdlog_level = spdlog::level::info; + break; + + case SPDLOG_LEVEL_WARN: + spdlog_level = spdlog::level::warn; + break; + + case SPDLOG_LEVEL_ERROR: + spdlog_level = spdlog::level::err; + break; + + case SPDLOG_LEVEL_CRITICAL: + spdlog_level = spdlog::level::critical; + break; + + case SPDLOG_LEVEL_OFF: + spdlog_level = spdlog::level::off; + break; + + default: + return; + } + + spdlog::set_level(spdlog_level); +} \ No newline at end of file diff --git a/src/libthecore/src/main.cpp b/src/libthecore/src/main.cpp index 2c2aa3a..6d73ecd 100644 --- a/src/libthecore/src/main.cpp +++ b/src/libthecore/src/main.cpp @@ -6,7 +6,6 @@ */ #define __LIBTHECORE__ #include "stdafx.h" -#include "memory.h" LPHEART thecore_heart = NULL; @@ -14,37 +13,6 @@ volatile int shutdowned = false; volatile int tics = 0; unsigned int thecore_profiler[NUM_PF]; -static int pid_init(void) -{ -#ifdef __WIN32__ - return true; -#else - FILE* fp; - if ((fp = fopen("pid", "w"))) - { - fprintf(fp, "%d", getpid()); - fclose(fp); - SPDLOG_INFO("Start of pid: {}", getpid()); - } - else - { - SPDLOG_ERROR("pid_init(): could not open file for writing. (filename: ./pid)"); - return false; - } - return true; -#endif -} - -static void pid_deinit(void) -{ -#ifdef __WIN32__ - return; -#else - remove("./pid"); - SPDLOG_INFO("End of pid"); -#endif -} - int thecore_init(int fps, HEARTFUNC heartbeat_func) { #if defined(__WIN32__) || defined(__linux__) @@ -55,9 +23,6 @@ int thecore_init(int fps, HEARTFUNC heartbeat_func) #endif signal_setup(); - if (!log_init() || !pid_init()) - return false; - thecore_heart = heart_new(1000000 / fps, heartbeat_func); return true; } @@ -89,8 +54,6 @@ int thecore_idle(void) void thecore_destroy(void) { - pid_deinit(); - log_destroy(); } int thecore_pulse(void) From 9fba85f9475878a80aa45bd90cdbaf7ba4856f45 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 3 Mar 2024 18:55:48 +0200 Subject: [PATCH 5/5] Updated README.md with the latest changes --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 612241b..1419029 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Install `vcpkg` according to the [lastest instructions](https://vcpkg.io/en/gett Build and install the required libraries: ```shell -vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo +vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog ``` Then, it's time to build your binaries. Your commands should look along the lines of: @@ -80,6 +80,7 @@ goodies you wish. Also, a lot of time. - Switched to the [effolkronium/random PRNG](https://github.com/effolkronium/random) instead of the standard C functions. - Refactored macros to modern C++ functions. - Network settings are manually configurable through the `PUBLIC_IP`, `PUBLIC_BIND_IP`, `INTERNAL_IP`, `INTERNAL_BIND_IP` settings in the `CONFIG` file. (Might need further work) +- Refactored logging to use [spdlog](https://github.com/gabime/spdlog) for more consistent function calls. ## 4. Bugfixes **WARNING: This project is based on the "kraizy" leak. That was over 10 years ago.