forked from metin2/server
Applied changes on the db executable. Removed old logging functions. Various global changes.
This commit is contained in:
parent
2f829ae2dc
commit
feac4c0598
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef __INC_METIN2_UTILS_H__
|
||||||
|
#define __INC_METIN2_UTILS_H__
|
||||||
|
|
||||||
/*----- atoi function -----*/
|
/*----- atoi function -----*/
|
||||||
inline bool str_to_number (bool& out, const char *in)
|
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 -----*/
|
/*----- atoi function -----*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -33,10 +33,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random)
|
||||||
find_package(fmt CONFIG REQUIRED)
|
find_package(fmt CONFIG REQUIRED)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt)
|
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
|
# System-provided dependencies
|
||||||
#
|
#
|
||||||
|
|
|
@ -406,13 +406,13 @@ AuctionResult AuctionManager::EnrollInAuction(CItemCache* item_cache, TAuctionIt
|
||||||
CItemCache* c = GetItemCache (item_info.item_id);
|
CItemCache* c = GetItemCache (item_info.item_id);
|
||||||
if (c != NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Auction.InsertItemInfo (&item_info))
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,19 +429,19 @@ AuctionResult AuctionManager::EnrollInSale(CItemCache* item_cache, TSaleItemInfo
|
||||||
CItemCache* c = GetItemCache (item_info.item_id);
|
CItemCache* c = GetItemCache (item_info.item_id);
|
||||||
if (c != NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Wish.GetItemInfoCache (WishBoard::Key (item_info.item_num, item_info.wisher_id)))
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Sale.InsertItemInfo (&item_info))
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ AuctionResult AuctionManager::EnrollInWish(TWishItemInfo &item_info)
|
||||||
{
|
{
|
||||||
if (!Wish.InsertItemInfo (&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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ AuctionResult AuctionManager::Bid(DWORD bidder_id, const char* bidder_name, DWOR
|
||||||
CItemCache* c = GetItemCache (item_id);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ AuctionResult AuctionManager::Impur(DWORD purchaser_id, const char* purchaser_na
|
||||||
CItemCache* c = GetItemCache (item_id);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,14 +533,14 @@ AuctionResult AuctionManager::GetAuctionedItem (DWORD actor_id, DWORD item_id, T
|
||||||
CItemCache* c = GetItemCache (item_id);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id);
|
CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id);
|
||||||
if (item_info_cache == NULL)
|
if (item_info_cache == NULL)
|
||||||
{
|
{
|
||||||
sys_err ("how can this accident happen?");
|
SPDLOG_ERROR("how can this accident happen?");
|
||||||
return AUCTION_FAIL;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,14 +561,14 @@ AuctionResult AuctionManager::BuySoldItem (DWORD actor_id, DWORD item_id, TPlaye
|
||||||
CItemCache* c = GetItemCache (item_id);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id);
|
CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id);
|
||||||
if (item_info_cache == NULL)
|
if (item_info_cache == NULL)
|
||||||
{
|
{
|
||||||
sys_err ("how can this accident happen?");
|
SPDLOG_ERROR("how can this accident happen?");
|
||||||
return AUCTION_FAIL;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,14 +584,14 @@ AuctionResult AuctionManager::CancelAuction (DWORD actor_id, DWORD item_id, TPla
|
||||||
CItemCache* c = GetItemCache (item_id);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id);
|
CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id);
|
||||||
if (item_info_cache == NULL)
|
if (item_info_cache == NULL)
|
||||||
{
|
{
|
||||||
sys_err ("how can this accident happen?");
|
SPDLOG_ERROR("how can this accident happen?");
|
||||||
return AUCTION_FAIL;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
TAuctionItemInfo* item_info = item_info_cache->Get(false);
|
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);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id);
|
CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id);
|
||||||
if (item_info_cache == NULL)
|
if (item_info_cache == NULL)
|
||||||
{
|
{
|
||||||
sys_err ("how can this accident happen?");
|
SPDLOG_ERROR("how can this accident happen?");
|
||||||
return AUCTION_FAIL;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
TSaleItemInfo* item_info = item_info_cache->Get(false);
|
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)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Auction.DeleteItemInfoCache (item_id) == NULL)
|
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_FAIL;
|
||||||
}
|
}
|
||||||
return AUCTION_SUCCESS;
|
return AUCTION_SUCCESS;
|
||||||
|
@ -655,13 +655,13 @@ AuctionResult AuctionManager::DeleteSaleItem (DWORD actor_id, DWORD item_id)
|
||||||
{
|
{
|
||||||
if (DeleteItemCache (item_id) == false)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Sale.DeleteItemInfoCache (item_id) == NULL)
|
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_FAIL;
|
||||||
}
|
}
|
||||||
return AUCTION_SUCCESS;
|
return AUCTION_SUCCESS;
|
||||||
|
@ -672,7 +672,7 @@ AuctionResult AuctionManager::ReBid(DWORD bidder_id, const char* bidder_name, DW
|
||||||
CItemCache* c = GetItemCache (item_id);
|
CItemCache* c = GetItemCache (item_id);
|
||||||
if (c == NULL)
|
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;
|
return AUCTION_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool CBlockCountry::Load()
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
if (pMsg->Get()->uiNumRows == 0)
|
||||||
{
|
{
|
||||||
sys_err(" DirectQuery failed(%s)", szQuery);
|
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
||||||
delete pMsg;
|
delete pMsg;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ bool CBlockCountry::Load()
|
||||||
strlcpy(block_ip->country, row[2], sizeof(block_ip->country));
|
strlcpy(block_ip->country, row[2], sizeof(block_ip->country));
|
||||||
|
|
||||||
m_block_ip.push_back(block_ip);
|
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;
|
delete pMsg;
|
||||||
|
@ -79,7 +79,7 @@ bool CBlockCountry::Load()
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
if (pMsg->Get()->uiNumRows == 0)
|
||||||
{
|
{
|
||||||
sys_err(" DirectQuery failed(%s)", szQuery);
|
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
||||||
delete pMsg;
|
delete pMsg;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ bool CBlockCountry::Load()
|
||||||
|
|
||||||
m_block_exception.push_back(strdup(login));
|
m_block_exception.push_back(strdup(login));
|
||||||
|
|
||||||
sys_log(0, "BLOCK_EXCEPTION = %s", login);
|
SPDLOG_DEBUG("BLOCK_EXCEPTION = {}", login);
|
||||||
|
|
||||||
}
|
}
|
||||||
delete pMsg;
|
delete pMsg;
|
||||||
|
@ -129,7 +129,7 @@ bool CBlockCountry::IsBlockedCountryIp(const char *user_ip)
|
||||||
|
|
||||||
void CBlockCountry::SendBlockedCountryIp(CPeer *peer)
|
void CBlockCountry::SendBlockedCountryIp(CPeer *peer)
|
||||||
{
|
{
|
||||||
sys_log(0, "SendBlockedCountryIp start");
|
SPDLOG_DEBUG("SendBlockedCountryIp start");
|
||||||
BLOCK_IP *block_ip;
|
BLOCK_IP *block_ip;
|
||||||
BLOCK_IP_VECTOR::iterator iter;
|
BLOCK_IP_VECTOR::iterator iter;
|
||||||
TPacketBlockCountryIp packet;
|
TPacketBlockCountryIp packet;
|
||||||
|
@ -145,9 +145,9 @@ void CBlockCountry::SendBlockedCountryIp(CPeer *peer)
|
||||||
peer->Encode(&packet, sizeof(packet));
|
peer->Encode(&packet, sizeof(packet));
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_log(0, "[DONE] CBlockCountry::SendBlockedCountryIp() : count = %d",
|
SPDLOG_DEBUG("[DONE] CBlockCountry::SendBlockedCountryIp() : count = {}",
|
||||||
m_block_ip.size());
|
m_block_ip.size());
|
||||||
sys_log(0, "SendBlockedCountryIp end");
|
SPDLOG_DEBUG("SendBlockedCountryIp end");
|
||||||
} /* end of CBlockCountry::SendBlockedCountryIp() */
|
} /* end of CBlockCountry::SendBlockedCountryIp() */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,7 @@ void CItemCache::Delete()
|
||||||
|
|
||||||
//char szQuery[QUERY_MAX_LEN];
|
//char szQuery[QUERY_MAX_LEN];
|
||||||
//szQuery[QUERY_MAX_LEN] = '\0';
|
//szQuery[QUERY_MAX_LEN] = '\0';
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("ItemCache::Delete : DELETE {}", m_data.id);
|
||||||
sys_log(0, "ItemCache::Delete : DELETE %u", m_data.id);
|
|
||||||
|
|
||||||
m_data.vnum = 0;
|
m_data.vnum = 0;
|
||||||
m_bNeedQuery = true;
|
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);
|
snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), m_data.id);
|
||||||
CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL);
|
CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL);
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("ItemCache::Flush : DELETE {} {}", m_data.id, szQuery);
|
||||||
sys_log(0, "ItemCache::Flush : DELETE %u %s", m_data.id, szQuery);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -141,8 +139,7 @@ void CItemCache::OnFlush()
|
||||||
char szItemQuery[QUERY_MAX_LEN + QUERY_MAX_LEN + 100];
|
char szItemQuery[QUERY_MAX_LEN + QUERY_MAX_LEN + 100];
|
||||||
snprintf(szItemQuery, sizeof(szItemQuery), "REPLACE INTO item%s (%s) VALUES(%s)", GetTablePostfix(), szColumns, szValues);
|
snprintf(szItemQuery, sizeof(szItemQuery), "REPLACE INTO item%s (%s) VALUES(%s)", GetTablePostfix(), szColumns, szValues);
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("ItemCache::Flush :REPLACE ({})", szItemQuery);
|
||||||
sys_log(0, "ItemCache::Flush :REPLACE (%s)", szItemQuery);
|
|
||||||
|
|
||||||
CDBManager::instance().ReturnQuery(szItemQuery, QID_ITEM_SAVE, 0, NULL);
|
CDBManager::instance().ReturnQuery(szItemQuery, QID_ITEM_SAVE, 0, NULL);
|
||||||
|
|
||||||
|
@ -167,8 +164,7 @@ CPlayerTableCache::~CPlayerTableCache()
|
||||||
|
|
||||||
void CPlayerTableCache::OnFlush()
|
void CPlayerTableCache::OnFlush()
|
||||||
{
|
{
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("PlayerTableCache::Flush : {}", m_data.name);
|
||||||
sys_log(0, "PlayerTableCache::Flush : %s", m_data.name);
|
|
||||||
|
|
||||||
char szQuery[QUERY_MAX_LEN];
|
char szQuery[QUERY_MAX_LEN];
|
||||||
CreatePlayerSaveQuery(szQuery, sizeof(szQuery), &m_data);
|
CreatePlayerSaveQuery(szQuery, sizeof(szQuery), &m_data);
|
||||||
|
@ -211,7 +207,7 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList
|
||||||
|
|
||||||
if (pUpdateList->byCount > SHOP_PRICELIST_MAX_NUM)
|
if (pUpdateList->byCount > SHOP_PRICELIST_MAX_NUM)
|
||||||
{
|
{
|
||||||
sys_err("Count overflow!");
|
SPDLOG_ERROR("Count overflow!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +234,8 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList
|
||||||
|
|
||||||
m_bNeedQuery = true;
|
m_bNeedQuery = true;
|
||||||
|
|
||||||
sys_log(0,
|
SPDLOG_DEBUG(
|
||||||
"ItemPriceListTableCache::UpdateList : OwnerID[%u] Update [%u] Items, Delete [%u] Items, Total [%u] Items",
|
"ItemPriceListTableCache::UpdateList : OwnerID[{}] Update [{}] Items, Delete [{}] Items, Total [{}] Items",
|
||||||
m_data.dwOwnerID, pUpdateList->byCount, nDeletedNum, m_data.byCount);
|
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);
|
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;
|
m_bNeedQuery = false;
|
||||||
}
|
}
|
||||||
|
@ -287,8 +283,7 @@ void CAuctionItemInfoCache::Delete()
|
||||||
if (m_data.item_num == 0)
|
if (m_data.item_num == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("CAuctionItemInfoCache::Delete : DELETE {}", m_data.item_id);
|
||||||
sys_log(0, "CAuctionItemInfoCache::Delete : DELETE %u", m_data.item_id);
|
|
||||||
|
|
||||||
m_data.item_num = 0;
|
m_data.item_num = 0;
|
||||||
m_bNeedQuery = true;
|
m_bNeedQuery = true;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,84 +16,84 @@ bool CClientManager::InitializeTables()
|
||||||
{
|
{
|
||||||
if (!InitializeMobTable())
|
if (!InitializeMobTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeMobTable FAILED");
|
SPDLOG_ERROR("InitializeMobTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!MirrorMobTableIntoDB())
|
if (!MirrorMobTableIntoDB())
|
||||||
{
|
{
|
||||||
sys_err("MirrorMobTableIntoDB FAILED");
|
SPDLOG_ERROR("MirrorMobTableIntoDB FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeItemTable())
|
if (!InitializeItemTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeItemTable FAILED");
|
SPDLOG_ERROR("InitializeItemTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MirrorItemTableIntoDB())
|
if (!MirrorItemTableIntoDB())
|
||||||
{
|
{
|
||||||
sys_err("MirrorItemTableIntoDB FAILED");
|
SPDLOG_ERROR("MirrorItemTableIntoDB FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeShopTable())
|
if (!InitializeShopTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeShopTable FAILED");
|
SPDLOG_ERROR("InitializeShopTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeSkillTable())
|
if (!InitializeSkillTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeSkillTable FAILED");
|
SPDLOG_ERROR("InitializeSkillTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeRefineTable())
|
if (!InitializeRefineTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeRefineTable FAILED");
|
SPDLOG_ERROR("InitializeRefineTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeItemAttrTable())
|
if (!InitializeItemAttrTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeItemAttrTable FAILED");
|
SPDLOG_ERROR("InitializeItemAttrTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeItemRareTable())
|
if (!InitializeItemRareTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeItemRareTable FAILED");
|
SPDLOG_ERROR("InitializeItemRareTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeBanwordTable())
|
if (!InitializeBanwordTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeBanwordTable FAILED");
|
SPDLOG_ERROR("InitializeBanwordTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeLandTable())
|
if (!InitializeLandTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeLandTable FAILED");
|
SPDLOG_ERROR("InitializeLandTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeObjectProto())
|
if (!InitializeObjectProto())
|
||||||
{
|
{
|
||||||
sys_err("InitializeObjectProto FAILED");
|
SPDLOG_ERROR("InitializeObjectProto FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeObjectTable())
|
if (!InitializeObjectTable())
|
||||||
{
|
{
|
||||||
sys_err("InitializeObjectTable FAILED");
|
SPDLOG_ERROR("InitializeObjectTable FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeMonarch())
|
if (!InitializeMonarch())
|
||||||
{
|
{
|
||||||
sys_err("InitializeMonarch FAILED");
|
SPDLOG_ERROR("InitializeMonarch FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ bool CClientManager::InitializeRefineTable()
|
||||||
|
|
||||||
if (m_pRefineTable)
|
if (m_pRefineTable)
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: refine_proto");
|
SPDLOG_DEBUG("RELOAD: refine_proto");
|
||||||
delete [] m_pRefineTable;
|
delete [] m_pRefineTable;
|
||||||
m_pRefineTable = NULL;
|
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++;
|
prt++;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ bool CClientManager::InitializeMobTable()
|
||||||
cCsvTable nameData;
|
cCsvTable nameData;
|
||||||
if(!nameData.Load("mob_names.txt",'\t'))
|
if(!nameData.Load("mob_names.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "mob_names.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("mob_names.txt 파일을 읽어오지 못했습니다");
|
||||||
isNameFile = false;
|
isNameFile = false;
|
||||||
} else {
|
} else {
|
||||||
nameData.Next(); //설명row 생략.
|
nameData.Next(); //설명row 생략.
|
||||||
|
@ -224,7 +224,7 @@ bool CClientManager::InitializeMobTable()
|
||||||
cCsvTable test_data;
|
cCsvTable test_data;
|
||||||
if(!test_data.Load("mob_proto_test.txt",'\t'))
|
if(!test_data.Load("mob_proto_test.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "테스트 파일이 없습니다. 그대로 진행합니다.\n");
|
SPDLOG_ERROR("테스트 파일이 없습니다. 그대로 진행합니다.");
|
||||||
isTestFile = false;
|
isTestFile = false;
|
||||||
}
|
}
|
||||||
//2. (c)[test_map_mobTableByVnum](vnum:TMobTable) 맵 생성.
|
//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))
|
if (!Set_Proto_Mob_Table(test_mob_table, test_data, localMap))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "몹 프로토 테이블 셋팅 실패.\n");
|
SPDLOG_ERROR("몹 프로토 테이블 셋팅 실패.");
|
||||||
}
|
}
|
||||||
|
|
||||||
test_map_mobTableByVnum.insert(std::map<DWORD, TMobTable *>::value_type(test_mob_table->dwVnum, test_mob_table));
|
test_map_mobTableByVnum.insert(std::map<DWORD, TMobTable *>::value_type(test_mob_table->dwVnum, test_mob_table));
|
||||||
|
@ -264,7 +264,7 @@ bool CClientManager::InitializeMobTable()
|
||||||
//1. 파일 읽기.
|
//1. 파일 읽기.
|
||||||
cCsvTable data;
|
cCsvTable data;
|
||||||
if(!data.Load("mob_proto.txt",'\t')) {
|
if(!data.Load("mob_proto.txt",'\t')) {
|
||||||
fprintf(stderr, "mob_proto.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("mob_proto.txt 파일을 읽어오지 못했습니다");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
data.Next(); //설명 row 넘어가기
|
data.Next(); //설명 row 넘어가기
|
||||||
|
@ -283,14 +283,14 @@ bool CClientManager::InitializeMobTable()
|
||||||
data.Destroy();
|
data.Destroy();
|
||||||
if(!data.Load("mob_proto.txt",'\t'))
|
if(!data.Load("mob_proto.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "mob_proto.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("mob_proto.txt 파일을 읽어오지 못했습니다");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||||
//2.2 크기에 맞게 mob_table 생성
|
//2.2 크기에 맞게 mob_table 생성
|
||||||
if (!m_vec_mobTable.empty())
|
if (!m_vec_mobTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: mob_proto");
|
SPDLOG_DEBUG("RELOAD: mob_proto");
|
||||||
m_vec_mobTable.clear();
|
m_vec_mobTable.clear();
|
||||||
}
|
}
|
||||||
m_vec_mobTable.resize(data.m_File.GetRowCount()-1 + addNumber);
|
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))
|
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);
|
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;
|
++mob_table;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ bool CClientManager::InitializeMobTable()
|
||||||
test_data;
|
test_data;
|
||||||
if(!test_data.Load("mob_proto_test.txt",'\t'))
|
if(!test_data.Load("mob_proto_test.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "테스트 파일이 없습니다. 그대로 진행합니다.\n");
|
SPDLOG_ERROR("테스트 파일이 없습니다. 그대로 진행합니다.");
|
||||||
isTestFile = false;
|
isTestFile = false;
|
||||||
}
|
}
|
||||||
if(isTestFile) {
|
if(isTestFile) {
|
||||||
|
@ -419,10 +419,10 @@ bool CClientManager::InitializeMobTable()
|
||||||
|
|
||||||
if (!Set_Proto_Mob_Table(mob_table, test_data, localMap))
|
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;
|
++mob_table;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,7 @@ bool CClientManager::InitializeShopTable()
|
||||||
|
|
||||||
if (!pRes2->uiNumRows)
|
if (!pRes2->uiNumRows)
|
||||||
{
|
{
|
||||||
sys_err("InitializeShopTable : Table count is zero.");
|
SPDLOG_ERROR("InitializeShopTable : Table count is zero.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ bool CClientManager::InitializeShopTable()
|
||||||
while (it != map_shop.end())
|
while (it != map_shop.end())
|
||||||
{
|
{
|
||||||
memcpy((m_pShopTable + i), (it++)->second, sizeof(TShopTable));
|
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;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ bool CClientManager::InitializeQuestItemTable()
|
||||||
|
|
||||||
if (!pRes->uiNumRows)
|
if (!pRes->uiNumRows)
|
||||||
{
|
{
|
||||||
sys_err("query error or no rows: %s", query);
|
SPDLOG_ERROR("query error or no rows: {}", query);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ bool CClientManager::InitializeQuestItemTable()
|
||||||
|
|
||||||
if (m_map_itemTableByVnum.find(tbl.dwVnum) != m_map_itemTableByVnum.end())
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
cCsvTable nameData;
|
cCsvTable nameData;
|
||||||
if(!nameData.Load("item_names.txt",'\t'))
|
if(!nameData.Load("item_names.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "item_names.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("item_names.txt 파일을 읽어오지 못했습니다");
|
||||||
isNameFile = false;
|
isNameFile = false;
|
||||||
} else {
|
} else {
|
||||||
nameData.Next();
|
nameData.Next();
|
||||||
|
@ -622,7 +622,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
cCsvTable test_data;
|
cCsvTable test_data;
|
||||||
if(!test_data.Load("item_proto_test.txt",'\t'))
|
if(!test_data.Load("item_proto_test.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "item_proto_test.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("item_proto_test.txt 파일을 읽어오지 못했습니다");
|
||||||
//return false;
|
//return false;
|
||||||
} else {
|
} else {
|
||||||
test_data.Next(); //설명 로우 넘어가기.
|
test_data.Next(); //설명 로우 넘어가기.
|
||||||
|
@ -639,7 +639,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
|
|
||||||
if (!Set_Proto_Item_Table(test_item_table, test_data, localMap))
|
if (!Set_Proto_Item_Table(test_item_table, test_data, localMap))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "아이템 프로토 테이블 셋팅 실패.\n");
|
SPDLOG_ERROR("아이템 프로토 테이블 셋팅 실패.");
|
||||||
}
|
}
|
||||||
|
|
||||||
test_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(test_item_table->dwVnum, test_item_table));
|
test_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(test_item_table->dwVnum, test_item_table));
|
||||||
|
@ -666,14 +666,14 @@ bool CClientManager::InitializeItemTable()
|
||||||
cCsvTable data;
|
cCsvTable data;
|
||||||
if(!data.Load("item_proto.txt",'\t'))
|
if(!data.Load("item_proto.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "item_proto.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("item_proto.txt 파일을 읽어오지 못했습니다");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||||
|
|
||||||
if (!m_vec_itemTable.empty())
|
if (!m_vec_itemTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: item_proto");
|
SPDLOG_DEBUG("RELOAD: item_proto");
|
||||||
m_vec_itemTable.clear();
|
m_vec_itemTable.clear();
|
||||||
m_map_itemTableByVnum.clear();
|
m_map_itemTableByVnum.clear();
|
||||||
}
|
}
|
||||||
|
@ -693,7 +693,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
data.Destroy();
|
data.Destroy();
|
||||||
if(!data.Load("item_proto.txt",'\t'))
|
if(!data.Load("item_proto.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "item_proto.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("item_proto.txt 파일을 읽어오지 못했습니다");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||||
|
@ -715,7 +715,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
|
|
||||||
if (!Set_Proto_Item_Table(item_table, data, localMap))
|
if (!Set_Proto_Item_Table(item_table, data, localMap))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "아이템 프로토 테이블 셋팅 실패.\n");
|
SPDLOG_ERROR("아이템 프로토 테이블 셋팅 실패.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -782,7 +782,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
test_data.Destroy();
|
test_data.Destroy();
|
||||||
if(!test_data.Load("item_proto_test.txt",'\t'))
|
if(!test_data.Load("item_proto_test.txt",'\t'))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "item_proto_test.txt 파일을 읽어오지 못했습니다\n");
|
SPDLOG_ERROR("item_proto_test.txt 파일을 읽어오지 못했습니다");
|
||||||
//return false;
|
//return false;
|
||||||
} else {
|
} else {
|
||||||
test_data.Next(); //설명 로우 넘어가기.
|
test_data.Next(); //설명 로우 넘어가기.
|
||||||
|
@ -798,7 +798,7 @@ bool CClientManager::InitializeItemTable()
|
||||||
|
|
||||||
if (!Set_Proto_Item_Table(item_table, test_data, localMap))
|
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++));
|
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->dwVnum,
|
||||||
item_table->szName,
|
item_table->szName,
|
||||||
item_table->szLocaleName,
|
item_table->szLocaleName,
|
||||||
|
@ -865,13 +865,13 @@ bool CClientManager::InitializeSkillTable()
|
||||||
|
|
||||||
if (!pRes->uiNumRows)
|
if (!pRes->uiNumRows)
|
||||||
{
|
{
|
||||||
sys_err("no result from skill_proto");
|
SPDLOG_ERROR("no result from skill_proto");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_vec_skillTable.empty())
|
if (!m_vec_skillTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: skill_proto");
|
SPDLOG_DEBUG("RELOAD: skill_proto");
|
||||||
m_vec_skillTable.clear();
|
m_vec_skillTable.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -929,7 +929,7 @@ bool CClientManager::InitializeSkillTable()
|
||||||
str_to_number(t.bSkillAttrType, data[col++]);
|
str_to_number(t.bSkillAttrType, data[col++]);
|
||||||
str_to_number(t.dwTargetRange, 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);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,13 +977,13 @@ bool CClientManager::InitializeItemAttrTable()
|
||||||
|
|
||||||
if (!pRes->uiNumRows)
|
if (!pRes->uiNumRows)
|
||||||
{
|
{
|
||||||
sys_err("no result from item_attr");
|
SPDLOG_ERROR("no result from item_attr");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_vec_itemAttrTable.empty())
|
if (!m_vec_itemAttrTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: item_attr");
|
SPDLOG_DEBUG("RELOAD: item_attr");
|
||||||
m_vec_itemAttrTable.clear();
|
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_SHIELD], data[col++]);
|
||||||
str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_EAR], 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.szApply,
|
||||||
t.dwProb,
|
t.dwProb,
|
||||||
t.lValues[0],
|
t.lValues[0],
|
||||||
|
@ -1051,13 +1051,13 @@ bool CClientManager::InitializeItemRareTable()
|
||||||
|
|
||||||
if (!pRes->uiNumRows)
|
if (!pRes->uiNumRows)
|
||||||
{
|
{
|
||||||
sys_err("no result from item_attr_rare");
|
SPDLOG_ERROR("no result from item_attr_rare");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_vec_itemRareTable.empty())
|
if (!m_vec_itemRareTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: item_attr_rare");
|
SPDLOG_DEBUG("RELOAD: item_attr_rare");
|
||||||
m_vec_itemRareTable.clear();
|
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_SHIELD], data[col++]);
|
||||||
str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_EAR], 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.szApply,
|
||||||
t.dwProb,
|
t.dwProb,
|
||||||
t.lValues[0],
|
t.lValues[0],
|
||||||
|
@ -1129,7 +1129,7 @@ bool CClientManager::InitializeLandTable()
|
||||||
|
|
||||||
if (!m_vec_kLandTable.empty())
|
if (!m_vec_kLandTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: land");
|
SPDLOG_DEBUG("RELOAD: land");
|
||||||
m_vec_kLandTable.clear();
|
m_vec_kLandTable.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,7 +1156,7 @@ bool CClientManager::InitializeLandTable()
|
||||||
str_to_number(t.bGuildLevelLimit, data[col++]);
|
str_to_number(t.bGuildLevelLimit, data[col++]);
|
||||||
str_to_number(t.dwPrice, 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);
|
m_vec_kLandTable.push_back(t);
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1232,7 @@ bool CClientManager::InitializeObjectProto()
|
||||||
|
|
||||||
if (!m_vec_kObjectProto.empty())
|
if (!m_vec_kObjectProto.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: object_proto");
|
SPDLOG_DEBUG("RELOAD: object_proto");
|
||||||
m_vec_kObjectProto.clear();
|
m_vec_kObjectProto.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1280,7 +1280,7 @@ bool CClientManager::InitializeObjectProto()
|
||||||
t.lNPCY = std::max(t.lRegion[1], t.lRegion[3])+300;
|
t.lNPCY = std::max(t.lRegion[1], t.lRegion[3])+300;
|
||||||
// END_OF_ADD_BUILDING_NPC
|
// 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);
|
t.dwVnum, t.dwPrice, t.kMaterials[0].dwItemVnum, t.kMaterials[0].dwCount);
|
||||||
|
|
||||||
m_vec_kObjectProto.push_back(t);
|
m_vec_kObjectProto.push_back(t);
|
||||||
|
@ -1301,7 +1301,7 @@ bool CClientManager::InitializeObjectTable()
|
||||||
|
|
||||||
if (!m_map_pkObjectTable.empty())
|
if (!m_map_pkObjectTable.empty())
|
||||||
{
|
{
|
||||||
sys_log(0, "RELOAD: object");
|
SPDLOG_DEBUG("RELOAD: object");
|
||||||
m_map_pkObjectTable.clear();
|
m_map_pkObjectTable.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1327,7 +1327,7 @@ bool CClientManager::InitializeObjectTable()
|
||||||
str_to_number(k->zRot, data[col++]);
|
str_to_number(k->zRot, data[col++]);
|
||||||
str_to_number(k->lLife, 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);
|
k->dwID, k->dwVnum, k->lMapIndex, k->x, k->y, k->lLife);
|
||||||
|
|
||||||
m_map_pkObjectTable.insert(std::make_pair(k->dwID, k));
|
m_map_pkObjectTable.insert(std::make_pair(k->dwID, k));
|
||||||
|
|
|
@ -21,7 +21,7 @@ void CClientManager::LoadEventFlag()
|
||||||
TPacketSetEventFlag p;
|
TPacketSetEventFlag p;
|
||||||
strlcpy(p.szFlagName, row[0], sizeof(p.szFlagName));
|
strlcpy(p.szFlagName, row[0], sizeof(p.szFlagName));
|
||||||
str_to_number(p.lValue, row[1]);
|
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));
|
m_map_lEventFlag.insert(std::make_pair(std::string(p.szFlagName), p.lValue));
|
||||||
ForwardPacket(HEADER_DG_SET_EVENT_FLAG, &p, sizeof(TPacketSetEventFlag));
|
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().ReturnQuery(szQuery, QID_QUEST_SAVE, 0, NULL);
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
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;
|
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)
|
void CClientManager::SendEventFlagsOnSetup(CPeer* peer)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID)
|
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));
|
ForwardPacket(HEADER_DG_GUILD_LOAD, &dwGuildID, sizeof(DWORD));
|
||||||
|
|
||||||
CGuildManager::instance().Load(dwGuildID);
|
CGuildManager::instance().Load(dwGuildID);
|
||||||
|
@ -18,14 +18,14 @@ void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID)
|
||||||
|
|
||||||
void CClientManager::GuildChangeGrade(CPeer* peer, TPacketGuild* p)
|
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));
|
ForwardPacket(HEADER_DG_GUILD_CHANGE_GRADE, p, sizeof(TPacketGuild));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
|
void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
|
||||||
{
|
{
|
||||||
CGuildManager::instance().TouchGuild(p->dwGuild);
|
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];
|
char szQuery[512];
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
|
||||||
|
|
||||||
if (pmsg->Get()->uiNumRows == 0)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
|
||||||
|
|
||||||
void CClientManager::GuildRemoveMember(CPeer* peer, TPacketGuild* 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];
|
char szQuery[512];
|
||||||
snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_member%s WHERE pid=%u and guild_id=%u", GetTablePostfix(), p->dwInfo, p->dwGuild);
|
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)
|
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));
|
ForwardPacket(HEADER_DG_GUILD_SKILL_UPDATE, p, sizeof(TPacketGuildSkillUpdate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::GuildExpUpdate(CPeer* peer, TPacketGuildExpUpdate* p)
|
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);
|
ForwardPacket(HEADER_DG_GUILD_EXP_UPDATE, p, sizeof(TPacketGuildExpUpdate), 0, peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::GuildChangeMemberData(CPeer* peer, TPacketGuildChangeMemberData* p)
|
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);
|
ForwardPacket(HEADER_DG_GUILD_CHANGE_MEMBER_DATA, p, sizeof(TPacketGuildChangeMemberData), 0, peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::GuildDisband(CPeer* peer, TPacketGuild* p)
|
void CClientManager::GuildDisband(CPeer* peer, TPacketGuild* p)
|
||||||
{
|
{
|
||||||
sys_log(0, "GuildDisband %u", p->dwGuild);
|
SPDLOG_DEBUG("GuildDisband {}", p->dwGuild);
|
||||||
|
|
||||||
char szQuery[512];
|
char szQuery[512];
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p)
|
||||||
switch (p->bWar)
|
switch (p->bWar)
|
||||||
{
|
{
|
||||||
case GUILD_WAR_SEND_DECLARE:
|
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);
|
CGuildManager::instance().AddDeclare(p->bType, p->dwGuildFrom, p->dwGuildTo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GUILD_WAR_REFUSE:
|
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);
|
CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
|
@ -160,10 +160,10 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case GUILD_WAR_WAIT_START:
|
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: // 길드전 예약
|
case GUILD_WAR_RESERVE: // 길드전 예약
|
||||||
if (p->bWar != GUILD_WAR_WAIT_START)
|
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);
|
CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
|
||||||
|
|
||||||
if (!CGuildManager::instance().ReserveWar(p))
|
if (!CGuildManager::instance().ReserveWar(p))
|
||||||
|
@ -174,23 +174,23 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GUILD_WAR_ON_WAR: // 길드전을 시작 시킨다. (필드전은 바로 시작 됨)
|
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().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
|
||||||
CGuildManager::instance().StartWar(p->bType, p->dwGuildFrom, p->dwGuildTo);
|
CGuildManager::instance().StartWar(p->bType, p->dwGuildFrom, p->dwGuildTo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GUILD_WAR_OVER: // 길드전 정상 종료
|
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);
|
CGuildManager::instance().RecvWarOver(p->dwGuildFrom, p->dwGuildTo, p->bType, p->lWarPrice);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GUILD_WAR_END: // 길드전 비정상 종료
|
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);
|
CGuildManager::instance().RecvWarEnd(p->dwGuildFrom, p->dwGuildTo);
|
||||||
return; // NOTE: RecvWarEnd에서 패킷을 보내므로 따로 브로드캐스팅 하지 않는다.
|
return; // NOTE: RecvWarEnd에서 패킷을 보내므로 따로 브로드캐스팅 하지 않는다.
|
||||||
|
|
||||||
case GUILD_WAR_CANCEL :
|
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);
|
CGuildManager::instance().CancelWar(p->dwGuildFrom, p->dwGuildTo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -205,20 +205,20 @@ void CClientManager::GuildWarScore(CPeer* peer, TPacketGuildWarScore * p)
|
||||||
|
|
||||||
void CClientManager::GuildChangeLadderPoint(TPacketGuildLadderPoint* 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);
|
CGuildManager::instance().ChangeLadderPoint(p->dwGuild, p->lChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::GuildUseSkill(TPacketGuildUseSkill* p)
|
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);
|
CGuildManager::instance().UseSkill(p->dwGuild, p->dwSkillVnum, p->dwCooltime);
|
||||||
SendGuildSkillUsable(p->dwGuild, p->dwSkillVnum, false);
|
SendGuildSkillUsable(p->dwGuild, p->dwSkillVnum, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::SendGuildSkillUsable(DWORD guild_id, DWORD dwSkillVnum, bool bUsable)
|
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;
|
TPacketGuildSkillUsableChange p;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
extern std::string g_stLocale;
|
extern std::string g_stLocale;
|
||||||
extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab);
|
extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab);
|
||||||
extern int g_test_server;
|
extern int g_test_server;
|
||||||
extern int g_log;
|
|
||||||
|
|
||||||
bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP)
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
|
||||||
|
|
||||||
if (!pkLoginData)
|
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);
|
pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +95,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
|
||||||
|
|
||||||
if (FindLogonAccount(r.login))
|
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;
|
TPacketDGLoginAlready ptog;
|
||||||
strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
|
strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin));
|
||||||
pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready));
|
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))
|
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);
|
pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +114,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
|
||||||
{
|
{
|
||||||
const DWORD * pdwClientKey = pkLoginData->GetClientKey();
|
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,
|
r.login,
|
||||||
p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3],
|
p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3],
|
||||||
pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[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;
|
info->pAccountTable = pkTab;
|
||||||
strlcpy(info->ip, p->szIP, sizeof(info->ip));
|
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];
|
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);
|
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);
|
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);
|
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
|
||||||
std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));
|
std::unique_ptr<SQLMsg> 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)
|
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
|
// PLAYER_INDEX_CREATE_BUG_FIX
|
||||||
//snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id);
|
//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++]);
|
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);
|
pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (j == PLAYER_PER_ACCOUNT)
|
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->login, player_id,
|
||||||
pkTab->players[0].dwID,
|
pkTab->players[0].dwID,
|
||||||
pkTab->players[1].dwID,
|
pkTab->players[1].dwID,
|
||||||
|
@ -358,7 +357,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
|
||||||
// 계정이 없네?
|
// 계정이 없네?
|
||||||
if (msg->Get()->uiNumRows == 0)
|
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);
|
peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0);
|
||||||
delete info;
|
delete info;
|
||||||
return;
|
return;
|
||||||
|
@ -368,7 +367,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
|
||||||
|
|
||||||
if (!info->pAccountTable)
|
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);
|
peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle);
|
||||||
delete info;
|
delete info;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +406,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
|
||||||
// 다른 컨넥션이 이미 로그인 해버렸다면.. 이미 접속했다고 보내야 한다.
|
// 다른 컨넥션이 이미 로그인 해버렸다면.. 이미 접속했다고 보내야 한다.
|
||||||
if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip))
|
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;
|
TPacketDGLoginAlready p;
|
||||||
strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));
|
strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin));
|
||||||
|
@ -417,7 +416,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg)
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (msg->Get()->uiNumRows > 0)
|
||||||
CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable);
|
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 (pLoginData->GetAccountRef().players[n].dwID == 0)
|
||||||
{
|
{
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("LOGOUT {} {}", packet->login, pLoginData->GetAccountRef().players[n].dwID);
|
||||||
sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid[n] = pLoginData->GetAccountRef().players[n].dwID;
|
pid[n] = pLoginData->GetAccountRef().players[n].dwID;
|
||||||
|
|
||||||
if (g_log)
|
SPDLOG_TRACE("LOGOUT InsertLogoutPlayer {} {}", packet->login, pid[n]);
|
||||||
sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]);
|
|
||||||
|
|
||||||
InsertLogoutPlayer(pid[n]);
|
InsertLogoutPlayer(pid[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DeleteLogonAccount(packet->login, peer->GetHandle()))
|
if (DeleteLogonAccount(packet->login, peer->GetHandle()))
|
||||||
{
|
{
|
||||||
if (g_log)
|
SPDLOG_TRACE("LOGOUT {} ", packet->login);
|
||||||
sys_log(0, "LOGOUT %s ", packet->login);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@ void CClientManager::QUERY_PARTY_CREATE(CPeer* peer, TPacketPartyCreate* p)
|
||||||
{
|
{
|
||||||
pm.insert(make_pair(p->dwLeaderPID, TPartyMember()));
|
pm.insert(make_pair(p->dwLeaderPID, TPartyMember()));
|
||||||
ForwardPacket(HEADER_DG_PARTY_CREATE, p, sizeof(TPacketPartyCreate), peer->GetChannel(), peer);
|
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
|
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())
|
if (it == pm.end())
|
||||||
{
|
{
|
||||||
sys_err("PARTY Delete - Non exists [%lu]", p->dwLeaderPID);
|
SPDLOG_ERROR("PARTY Delete - Non exists [{}]", p->dwLeaderPID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pm.erase(it);
|
pm.erase(it);
|
||||||
ForwardPacket(HEADER_DG_PARTY_DELETE, p, sizeof(TPacketPartyDelete), peer->GetChannel(), peer);
|
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)
|
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())
|
if (it == pm.end())
|
||||||
{
|
{
|
||||||
sys_err("PARTY Add - Non exists [%lu]", p->dwLeaderPID);
|
SPDLOG_ERROR("PARTY Add - Non exists [{}]", p->dwLeaderPID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p)
|
||||||
{
|
{
|
||||||
it->second.insert(std::make_pair(p->dwPID, TPartyInfo()));
|
it->second.insert(std::make_pair(p->dwPID, TPartyInfo()));
|
||||||
ForwardPacket(HEADER_DG_PARTY_ADD, p, sizeof(TPacketPartyAdd), peer->GetChannel(), peer);
|
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
|
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)
|
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())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p)
|
||||||
{
|
{
|
||||||
it->second.erase(pit);
|
it->second.erase(pit);
|
||||||
ForwardPacket(HEADER_DG_PARTY_REMOVE, p, sizeof(TPacketPartyRemove), peer->GetChannel(), peer);
|
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
|
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)
|
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())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan
|
||||||
|
|
||||||
if (pit == it->second.end())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan
|
||||||
pit->second.bRole = 0;
|
pit->second.bRole = 0;
|
||||||
|
|
||||||
ForwardPacket(HEADER_DG_PARTY_STATE_CHANGE, p, sizeof(TPacketPartyStateChange), peer->GetChannel(), peer);
|
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)
|
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())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,12 +124,12 @@ void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMe
|
||||||
|
|
||||||
if (pit == it->second.end())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pit->second.bLevel = p->bLevel;
|
pit->second.bLevel = p->bLevel;
|
||||||
|
|
||||||
ForwardPacket(HEADER_DG_PARTY_SET_MEMBER_LEVEL, p, sizeof(TPacketPartySetMemberLevel), peer->GetChannel());
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ extern bool g_bHotBackup;
|
||||||
|
|
||||||
extern std::string g_stLocale;
|
extern std::string g_stLocale;
|
||||||
extern int g_test_server;
|
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())
|
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);
|
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_FAILED, dwHandle, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +264,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
||||||
|
|
||||||
TItemCacheSet * pSet = GetItemCacheSet(pTab->id);
|
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 로딩 :
|
// 아이템 & AFFECT & QUEST 로딩 :
|
||||||
|
@ -293,8 +292,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
||||||
memcpy(&s_items[dwCount++], p, sizeof(TPlayerItem));
|
memcpy(&s_items[dwCount++], p, sizeof(TPlayerItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("ITEM_CACHE: HIT! {} count: {}", pTab->name, dwCount);
|
||||||
sys_log(0, "ITEM_CACHE: HIT! %s count: %u", pTab->name, dwCount);
|
|
||||||
|
|
||||||
peer->EncodeHeader(HEADER_DG_ITEM_LOAD, dwHandle, sizeof(DWORD) + sizeof(TPlayerItem) * dwCount);
|
peer->EncodeHeader(HEADER_DG_ITEM_LOAD, dwHandle, sizeof(DWORD) + sizeof(TPlayerItem) * dwCount);
|
||||||
peer->EncodeDWORD(dwCount);
|
peer->EncodeDWORD(dwCount);
|
||||||
|
@ -354,7 +352,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
||||||
//----------------------------------
|
//----------------------------------
|
||||||
else
|
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];
|
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;
|
MYSQL_RES * pSQLResult = pMsg->Get()->pSQLResult;
|
||||||
if (!pSQLResult)
|
if (!pSQLResult)
|
||||||
{
|
{
|
||||||
sys_err("null MYSQL_RES QID %u", dwQID);
|
SPDLOG_ERROR("null MYSQL_RES QID {}", dwQID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dwQID)
|
switch (dwQID)
|
||||||
{
|
{
|
||||||
case QID_PLAYER:
|
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());
|
RESULT_PLAYER_LOAD(peer, pSQLResult, info.get());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QID_ITEM:
|
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);
|
RESULT_ITEM_LOAD(peer, pSQLResult, info->dwHandle, info->player_id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QID_QUEST:
|
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);
|
RESULT_QUEST_LOAD(peer, pSQLResult, info->dwHandle, info->player_id);
|
||||||
//aid얻기
|
//aid얻기
|
||||||
ClientHandleInfo* temp1 = info.get();
|
ClientHandleInfo* temp1 = info.get();
|
||||||
|
@ -586,42 +584,42 @@ void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD
|
||||||
break;
|
break;
|
||||||
if( pLoginData1 == NULL )
|
if( pLoginData1 == NULL )
|
||||||
break;
|
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);
|
ItemAward(peer,pLoginData1->GetAccountRef().login);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QID_AFFECT:
|
case QID_AFFECT:
|
||||||
sys_log(0, "QID_AFFECT %u", info->dwHandle);
|
SPDLOG_DEBUG("QID_AFFECT {}", info->dwHandle);
|
||||||
RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle);
|
RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle);
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
case QID_PLAYER_ITEM_QUEST_AFFECT:
|
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);
|
RESULT_PLAYER_LOAD(peer, pSQLResult, info->dwHandle);
|
||||||
|
|
||||||
if (!pMsg->Next())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QID_ITEM_QUEST_AFFECT:
|
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);
|
RESULT_ITEM_LOAD(peer, pSQLResult, info->dwHandle, info->player_id);
|
||||||
|
|
||||||
if (!pMsg->Next())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QID_QUEST_AFFECT:
|
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);
|
RESULT_QUEST_LOAD(peer, pSQLResult, info->dwHandle);
|
||||||
|
|
||||||
if (!pMsg->Next())
|
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
|
else
|
||||||
RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle);
|
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())
|
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);
|
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_FAILED, pkInfo->dwHandle, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -683,7 +681,7 @@ void CClientManager::RESULT_ITEM_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwHa
|
||||||
CreateItemCacheSet(dwPID);
|
CreateItemCacheSet(dwPID);
|
||||||
|
|
||||||
// ITEM_LOAD_LOG_ATTACH_PID
|
// 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
|
// END_OF_ITEM_LOAD_LOG_ATTACH_PID
|
||||||
|
|
||||||
if (dwCount)
|
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]);
|
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();
|
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]);
|
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();
|
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)
|
void CClientManager::QUERY_PLAYER_SAVE(CPeer * peer, DWORD dwHandle, TPlayerTable * pkTab)
|
||||||
{
|
{
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("PLAYER_SAVE: {}", pkTab->name);
|
||||||
sys_log(0, "PLAYER_SAVE: %s", pkTab->name);
|
|
||||||
|
|
||||||
PutPlayerCache(pkTab);
|
PutPlayerCache(pkTab);
|
||||||
}
|
}
|
||||||
|
@ -829,7 +826,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
|
||||||
if (row[0] && dwPID > 0)
|
if (row[0] && dwPID > 0)
|
||||||
{
|
{
|
||||||
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -861,7 +858,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
|
||||||
|
|
||||||
if (*row[0] != '0')
|
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);
|
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
|
||||||
return;
|
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.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);
|
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->account_id,
|
||||||
packet->player_table.name,
|
packet->player_table.name,
|
||||||
packet->player_table.level,
|
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));
|
CDBManager::instance().EscapeString(text, packet->player_table.skills, sizeof(packet->player_table.skills));
|
||||||
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s', ", text);
|
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s', ", text);
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("Create_Player queryLen[{}] TEXT[{}]", queryLen, text);
|
||||||
sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text);
|
|
||||||
|
|
||||||
CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot));
|
CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot));
|
||||||
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text);
|
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text);
|
||||||
|
|
||||||
std::unique_ptr<SQLMsg> pMsg2(CDBManager::instance().DirectQuery(queryStr));
|
std::unique_ptr<SQLMsg> pMsg2(CDBManager::instance().DirectQuery(queryStr));
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("Create_Player queryLen[{}] TEXT[{}]", queryLen, text);
|
||||||
sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text);
|
|
||||||
|
|
||||||
if (pMsg2->Get()->uiAffectedRows <= 0)
|
if (pMsg2->Get()->uiAffectedRows <= 0)
|
||||||
{
|
{
|
||||||
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,7 +919,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC
|
||||||
|
|
||||||
if (pMsg3->Get()->uiAffectedRows <= 0)
|
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);
|
snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), player_id);
|
||||||
CDBManager::instance().DirectQuery(queryStr);
|
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->EncodeHeader(HEADER_DG_PLAYER_CREATE_SUCCESS, dwHandle, sizeof(TPacketDGCreateSuccess));
|
||||||
peer->Encode(&pack, 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);
|
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))
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1);
|
||||||
peer->EncodeBYTE(packet->account_index);
|
peer->EncodeBYTE(packet->account_index);
|
||||||
return;
|
return;
|
||||||
|
@ -998,7 +993,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD
|
||||||
|
|
||||||
if (pTab->level >= m_iPlayerDeleteLevelLimit)
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1);
|
||||||
peer->EncodeBYTE(packet->account_index);
|
peer->EncodeBYTE(packet->account_index);
|
||||||
return;
|
return;
|
||||||
|
@ -1006,7 +1001,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD
|
||||||
|
|
||||||
if (pTab->level < m_iPlayerDeleteLevelLimitLower)
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1);
|
||||||
peer->EncodeBYTE(packet->account_index);
|
peer->EncodeBYTE(packet->account_index);
|
||||||
return;
|
return;
|
||||||
|
@ -1022,7 +1017,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD
|
||||||
ClientHandleInfo * pi = new ClientHandleInfo(dwHandle, packet->player_id);
|
ClientHandleInfo * pi = new ClientHandleInfo(dwHandle, packet->player_id);
|
||||||
pi->account_index = packet->account_index;
|
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);
|
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())
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
|
||||||
peer->EncodeBYTE(pi->account_index);
|
peer->EncodeBYTE(pi->account_index);
|
||||||
return;
|
return;
|
||||||
|
@ -1057,7 +1052,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg)
|
||||||
|
|
||||||
if (deletedLevelLimit < m_iPlayerDeleteLevelLimitLower)
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
|
||||||
peer->EncodeBYTE(pi->account_index);
|
peer->EncodeBYTE(pi->account_index);
|
||||||
return;
|
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)
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
|
||||||
peer->EncodeBYTE(pi->account_index);
|
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];
|
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)
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
|
||||||
peer->EncodeBYTE(pi->account_index);
|
peer->EncodeBYTE(pi->account_index);
|
||||||
return;
|
return;
|
||||||
|
@ -1158,7 +1153,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg)
|
||||||
else
|
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->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
|
||||||
peer->EncodeBYTE(pi->account_index);
|
peer->EncodeBYTE(pi->account_index);
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1212,7 @@ void CClientManager::QUERY_HIGHSCORE_REGISTER(CPeer* peer, TPacketGDHighscore *
|
||||||
char szQuery[128];
|
char szQuery[128];
|
||||||
snprintf(szQuery, sizeof(szQuery), "SELECT value FROM highscore%s WHERE board='%s' AND pid = %u", GetTablePostfix(), data->szBoard, data->dwPID);
|
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);
|
ClientHandleInfo * pi = new ClientHandleInfo(0);
|
||||||
strlcpy(pi->login, data->szBoard, sizeof(pi->login));
|
strlcpy(pi->login, data->szBoard, sizeof(pi->login));
|
||||||
|
@ -1289,8 +1284,7 @@ void CClientManager::InsertLogoutPlayer(DWORD pid)
|
||||||
if (it != m_map_logout.end())
|
if (it != m_map_logout.end())
|
||||||
{
|
{
|
||||||
// 존재할경우 시간만 갱신
|
// 존재할경우 시간만 갱신
|
||||||
if (g_log)
|
SPDLOG_TRACE("LOGOUT: Update player time pid({})", pid);
|
||||||
sys_log(0, "LOGOUT: Update player time pid(%d)", pid);
|
|
||||||
|
|
||||||
it->second->time = time(0);
|
it->second->time = time(0);
|
||||||
return;
|
return;
|
||||||
|
@ -1301,8 +1295,7 @@ void CClientManager::InsertLogoutPlayer(DWORD pid)
|
||||||
pLogout->time = time(0);
|
pLogout->time = time(0);
|
||||||
m_map_logout.insert(std::make_pair(pid, pLogout));
|
m_map_logout.insert(std::make_pair(pid, pLogout));
|
||||||
|
|
||||||
if (g_log)
|
SPDLOG_TRACE("LOGOUT: Insert player pid({})", pid);
|
||||||
sys_log(0, "LOGOUT: Insert player pid(%d)", pid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::DeleteLogoutPlayer(DWORD pid)
|
void CClientManager::DeleteLogoutPlayer(DWORD pid)
|
||||||
|
|
|
@ -171,7 +171,7 @@ bool CConfig::GetParam(const char*key, int index, DWORD *Param)
|
||||||
|
|
||||||
str_to_number(*Param, szParam[index]);
|
str_to_number(*Param, szParam[index]);
|
||||||
|
|
||||||
sys_log(0, "GetParam %d", *Param);
|
SPDLOG_DEBUG("GetParam {}", *Param);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const char * CConfig::Get(const char* key)
|
const char * CConfig::Get(const char* key)
|
||||||
|
|
|
@ -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)
|
void CDBManager::ReturnQuery(const char * c_pszQuery, int iType, IDENT dwIdent, void * udata, int iSlot)
|
||||||
{
|
{
|
||||||
assert(iSlot < SQL_MAX_NUM);
|
assert(iSlot < SQL_MAX_NUM);
|
||||||
//sys_log(0, "ReturnQuery %s", c_pszQuery);
|
//SPDLOG_DEBUG("ReturnQuery {}", c_pszQuery);
|
||||||
CQueryInfo * p = new CQueryInfo;
|
CQueryInfo * p = new CQueryInfo;
|
||||||
|
|
||||||
p->iType = iType;
|
p->iType = iType;
|
||||||
|
|
|
@ -145,8 +145,8 @@ void CGuildManager::ParseResult(SQLResult * pRes)
|
||||||
str_to_number(r_info.gold, row[6]);
|
str_to_number(r_info.gold, row[6]);
|
||||||
str_to_number(r_info.level, row[7]);
|
str_to_number(r_info.level, row[7]);
|
||||||
|
|
||||||
sys_log(0,
|
SPDLOG_DEBUG(
|
||||||
"GuildWar: %-24s ladder %-5d win %-3d draw %-3d loss %-3d",
|
"GuildWar: {:24} ladder {:<5} win {:<3} draw {:<3} loss {:<3}",
|
||||||
r_info.szName,
|
r_info.szName,
|
||||||
r_info.ladder_point,
|
r_info.ladder_point,
|
||||||
r_info.win,
|
r_info.win,
|
||||||
|
@ -170,17 +170,17 @@ void CGuildManager::Initialize()
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
|
||||||
if (!polyPower.Analyze(str))
|
if (!polyPower.Analyze(str))
|
||||||
sys_err("cannot set power poly: %s", str);
|
SPDLOG_ERROR("cannot set power poly: {}", str);
|
||||||
else
|
else
|
||||||
sys_log(0, "POWER_POLY: %s", str);
|
SPDLOG_DEBUG("POWER_POLY: {}", str);
|
||||||
|
|
||||||
if (!CConfig::instance().GetValue("POLY_HANDICAP", str, sizeof(str)))
|
if (!CConfig::instance().GetValue("POLY_HANDICAP", str, sizeof(str)))
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
|
||||||
if (!polyHandicap.Analyze(str))
|
if (!polyHandicap.Analyze(str))
|
||||||
sys_err("cannot set handicap poly: %s", str);
|
SPDLOG_ERROR("cannot set handicap poly: {}", str);
|
||||||
else
|
else
|
||||||
sys_log(0, "HANDICAP_POLY: %s", str);
|
SPDLOG_DEBUG("HANDICAP_POLY: {}", str);
|
||||||
|
|
||||||
QueryRanking();
|
QueryRanking();
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ void CGuildManager::ResultRanking(MYSQL_RES * pRes)
|
||||||
if (iLadderPoint != iLastLadderPoint)
|
if (iLadderPoint != iLastLadderPoint)
|
||||||
++iRank;
|
++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));
|
map_kLadderPointRankingByGID.insert(std::make_pair(dwGID, iRank));
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ void CGuildManager::Update()
|
||||||
{
|
{
|
||||||
// UNKNOWN_GUILD_MANAGE_UPDATE_LOG
|
// 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(),
|
m_WarMap.size(),
|
||||||
now,
|
now,
|
||||||
m_pqOnWar.top().first,
|
m_pqOnWar.top().first,
|
||||||
|
@ -307,7 +307,7 @@ void CGuildManager::Update()
|
||||||
p.dwGuildTo = ws.GID[1];
|
p.dwGuildTo = ws.GID[1];
|
||||||
|
|
||||||
CClientManager::instance().ForwardPacket(HEADER_DG_GUILD_WAR, &p, sizeof(p));
|
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)
|
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(dwGuildID1);
|
||||||
GuildWarDraw(dwGuildID2);
|
GuildWarDraw(dwGuildID2);
|
||||||
|
@ -416,7 +416,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser)
|
||||||
{
|
{
|
||||||
GuildWarWin(dwGuildWinner);
|
GuildWarWin(dwGuildWinner);
|
||||||
GuildWarLose(dwGuildLoser);
|
GuildWarLose(dwGuildLoser);
|
||||||
sys_log(0, "GuildWar: \tWinner : %d Loser : %d", dwGuildWinner, dwGuildLoser);
|
SPDLOG_DEBUG("GuildWar: \tWinner : {} Loser : {}", dwGuildWinner, dwGuildLoser);
|
||||||
|
|
||||||
int iPoint = GetLadderPoint(dwGuildLoser);
|
int iPoint = GetLadderPoint(dwGuildLoser);
|
||||||
int gain = (int)(iPoint * 0.05);
|
int gain = (int)(iPoint * 0.05);
|
||||||
|
@ -425,7 +425,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser)
|
||||||
if (IsHalfWinLadderPoint(dwGuildWinner, dwGuildLoser))
|
if (IsHalfWinLadderPoint(dwGuildWinner, dwGuildLoser))
|
||||||
gain /= 2;
|
gain /= 2;
|
||||||
|
|
||||||
sys_log(0, "GuildWar: \tgain : %d loss : %d", gain, loss);
|
SPDLOG_DEBUG("GuildWar: \tgain : {} loss : {}", gain, loss);
|
||||||
|
|
||||||
ChangeLadderPoint(dwGuildWinner, gain);
|
ChangeLadderPoint(dwGuildWinner, gain);
|
||||||
ChangeLadderPoint(dwGuildLoser, -loss);
|
ChangeLadderPoint(dwGuildLoser, -loss);
|
||||||
|
@ -435,7 +435,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser)
|
||||||
|
|
||||||
void CGuildManager::RemoveWar(DWORD GID1, DWORD GID2)
|
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)
|
if (GID1 > GID2)
|
||||||
std::swap(GID2, GID1);
|
std::swap(GID2, GID1);
|
||||||
|
@ -469,13 +469,13 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw)
|
||||||
if (GID1 > GID2)
|
if (GID1 > GID2)
|
||||||
std::swap(GID2, GID1);
|
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);
|
itertype(m_WarMap[GID1]) itWarMap = m_WarMap[GID1].find(GID2);
|
||||||
|
|
||||||
if (itWarMap == m_WarMap[GID1].end())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw)
|
||||||
|
|
||||||
if (!pData || pData->bEnd)
|
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;
|
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)
|
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 GID1 = dwGuildWinner;
|
||||||
DWORD GID2 = dwGuildLoser;
|
DWORD GID2 = dwGuildLoser;
|
||||||
|
@ -570,13 +570,13 @@ void CGuildManager::RecvWarOver(DWORD dwGuildWinner, DWORD dwGuildLoser, bool bD
|
||||||
|
|
||||||
void CGuildManager::RecvWarEnd(DWORD GID1, DWORD GID2)
|
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); // 무조건 비정상 종료 시켜야 한다.
|
WarEnd(GID1, GID2, true); // 무조건 비정상 종료 시켜야 한다.
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuildManager::StartWar(BYTE bType, DWORD GID1, DWORD GID2, CGuildWarReserve * pkReserve)
|
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)
|
if (GID1 > GID2)
|
||||||
std::swap(GID1, GID2);
|
std::swap(GID1, GID2);
|
||||||
|
@ -610,7 +610,7 @@ void CGuildManager::UpdateScore(DWORD dwGainGID, DWORD dwOppGID, int iScoreDelta
|
||||||
|
|
||||||
if (!p || p->bEnd)
|
if (!p || p->bEnd)
|
||||||
{
|
{
|
||||||
sys_err("GuildWar: war not exist or already ended.");
|
SPDLOG_ERROR("GuildWar: war not exist or already ended.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ void CGuildManager::UpdateScore(DWORD dwGainGID, DWORD dwOppGID, int iScoreDelta
|
||||||
iNewBetScore = p->iBetScore[1];
|
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);
|
dwGainGID, p->bType, iScoreDelta, iBetScoreDelta, iNewScore, iNewBetScore);
|
||||||
|
|
||||||
CClientManager::instance().for_each_peer(FSendGuildWarScore(dwGainGID, dwOppGID, 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())
|
if (m_DeclareMap.find(di) == m_DeclareMap.end())
|
||||||
m_DeclareMap.insert(di);
|
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)
|
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())
|
if (it != m_DeclareMap.end())
|
||||||
m_DeclareMap.erase(it);
|
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)
|
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())
|
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);
|
dwGuildFrom, dwGuildTo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it_from->second.gold < lWarPrice || it_to->second.gold < lWarPrice)
|
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);
|
dwGuildFrom, it_from->second.gold, dwGuildTo, it_to->second.gold);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -704,8 +704,8 @@ bool CGuildManager::WaitStart(TPacketGuildWar * p)
|
||||||
TGuildWaitStartInfo info(p->bType, p->dwGuildFrom, p->dwGuildTo, p->lWarPrice, p->lInitialScore, NULL);
|
TGuildWaitStartInfo info(p->bType, p->dwGuildFrom, p->dwGuildTo, p->lWarPrice, p->lInitialScore, NULL);
|
||||||
m_pqWaitStart.push(std::make_pair(dwCurTime + GetGuildWarWaitStartDuration(), info));
|
m_pqWaitStart.push(std::make_pair(dwCurTime + GetGuildWarWaitStartDuration(), info));
|
||||||
|
|
||||||
sys_log(0,
|
SPDLOG_DEBUG(
|
||||||
"GuildWar: WaitStart g1 %d g2 %d price %d start at %u",
|
"GuildWar: WaitStart g1 {} g2 {} price {} start at {}",
|
||||||
p->dwGuildFrom,
|
p->dwGuildFrom,
|
||||||
p->dwGuildTo,
|
p->dwGuildTo,
|
||||||
p->lWarPrice,
|
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);
|
snprintf(buf, sizeof(buf), "UPDATE guild%s SET ladder_point=%d WHERE id=%u", GetTablePostfix(), r.ladder_point, GID);
|
||||||
CDBManager::instance().AsyncQuery(buf);
|
CDBManager::instance().AsyncQuery(buf);
|
||||||
|
|
||||||
sys_log(0, "GuildManager::ChangeLadderPoint %u %d", GID, r.ladder_point);
|
SPDLOG_DEBUG("GuildManager::ChangeLadderPoint {} {}", GID, r.ladder_point);
|
||||||
sys_log(0, "%s", buf);
|
SPDLOG_DEBUG("{}", buf);
|
||||||
|
|
||||||
// Packet 보내기
|
// Packet 보내기
|
||||||
TPacketGuildLadder p;
|
TPacketGuildLadder p;
|
||||||
|
@ -760,14 +760,14 @@ void CGuildManager::ChangeLadderPoint(DWORD GID, int change)
|
||||||
void CGuildManager::UseSkill(DWORD GID, DWORD dwSkillVnum, DWORD dwCooltime)
|
void CGuildManager::UseSkill(DWORD GID, DWORD dwSkillVnum, DWORD dwCooltime)
|
||||||
{
|
{
|
||||||
// GUILD_SKILL_COOLTIME_BUG_FIX
|
// 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)));
|
m_pqSkill.push(std::make_pair(CClientManager::instance().GetCurrentTime() + dwCooltime, TGuildSkillUsed(GID, dwSkillVnum)));
|
||||||
// END_OF_GUILD_SKILL_COOLTIME_BUG_FIX
|
// END_OF_GUILD_SKILL_COOLTIME_BUG_FIX
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuildManager::MoneyChange(DWORD dwGuild, DWORD dwGold)
|
void CGuildManager::MoneyChange(DWORD dwGuild, DWORD dwGold)
|
||||||
{
|
{
|
||||||
sys_log(0, "GuildManager::MoneyChange %d %d", dwGuild, dwGold);
|
SPDLOG_DEBUG("GuildManager::MoneyChange {} {}", dwGuild, dwGold);
|
||||||
|
|
||||||
TPacketDGGuildMoneyChange p;
|
TPacketDGGuildMoneyChange p;
|
||||||
p.dwGuild = dwGuild;
|
p.dwGuild = dwGuild;
|
||||||
|
@ -788,12 +788,12 @@ void CGuildManager::DepositMoney(DWORD dwGuild, INT iGold)
|
||||||
|
|
||||||
if (it == m_map_kGuild.end())
|
if (it == m_map_kGuild.end())
|
||||||
{
|
{
|
||||||
sys_err("No guild by id %u", dwGuild);
|
SPDLOG_ERROR("No guild by id {}", dwGuild);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
it->second.gold += iGold;
|
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);
|
MoneyChange(dwGuild, it->second.gold);
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ void CGuildManager::WithdrawMoney(CPeer* peer, DWORD dwGuild, INT iGold)
|
||||||
|
|
||||||
if (it == m_map_kGuild.end())
|
if (it == m_map_kGuild.end())
|
||||||
{
|
{
|
||||||
sys_err("No guild by id %u", dwGuild);
|
SPDLOG_ERROR("No guild by id {}", dwGuild);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ void CGuildManager::WithdrawMoney(CPeer* peer, DWORD dwGuild, INT iGold)
|
||||||
if (it->second.gold >= iGold)
|
if (it->second.gold >= iGold)
|
||||||
{
|
{
|
||||||
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;
|
TPacketDGGuildMoneyWithdraw p;
|
||||||
p.dwGuild = dwGuild;
|
p.dwGuild = dwGuild;
|
||||||
|
@ -830,7 +830,7 @@ void CGuildManager::WithdrawMoneyReply(DWORD dwGuild, BYTE bGiveSuccess, INT iGo
|
||||||
if (it == m_map_kGuild.end())
|
if (it == m_map_kGuild.end())
|
||||||
return;
|
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)
|
if (!bGiveSuccess)
|
||||||
it->second.gold += iGold;
|
it->second.gold += iGold;
|
||||||
|
@ -938,16 +938,16 @@ void CGuildManager::BootReserveWar()
|
||||||
if (i == 0 || (int) t.dwTime - CClientManager::instance().GetCurrentTime() < 0)
|
if (i == 0 || (int) t.dwTime - CClientManager::instance().GetCurrentTime() < 0)
|
||||||
{
|
{
|
||||||
if (i == 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
|
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();
|
pkReserve->Draw();
|
||||||
delete pkReserve;
|
delete pkReserve;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sys_log(0, "%s : OK", buf);
|
SPDLOG_DEBUG("{} : OK", buf);
|
||||||
m_map_kWarReserve.insert(std::make_pair(t.dwID, pkReserve));
|
m_map_kWarReserve.insert(std::make_pair(t.dwID, pkReserve));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1024,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p)
|
||||||
polyPower.SetVar("mc", mc);
|
polyPower.SetVar("mc", mc);
|
||||||
|
|
||||||
t.lPowerFrom = (int) polyPower.Eval();
|
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);
|
TGuild & k2 = TouchGuild(GID2);
|
||||||
|
@ -1040,7 +1040,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p)
|
||||||
polyPower.SetVar("mc", mc);
|
polyPower.SetVar("mc", mc);
|
||||||
|
|
||||||
t.lPowerTo = (int) polyPower.Eval();
|
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)
|
if (t.lPowerTo > t.lPowerFrom)
|
||||||
|
@ -1055,7 +1055,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p)
|
||||||
}
|
}
|
||||||
|
|
||||||
t.lHandicap = (int) polyHandicap.Eval();
|
t.lHandicap = (int) polyHandicap.Eval();
|
||||||
sys_log(0, "GuildWar: handicap %d", t.lHandicap);
|
SPDLOG_DEBUG("GuildWar: handicap {}", t.lHandicap);
|
||||||
|
|
||||||
// 쿼리
|
// 쿼리
|
||||||
char szQuery[512];
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1101,7 +1101,7 @@ void CGuildManager::ProcessReserveWar()
|
||||||
TGuild & r_1 = m_map_kGuild[r.dwGuildFrom];
|
TGuild & r_1 = m_map_kGuild[r.dwGuildFrom];
|
||||||
TGuild & r_2 = m_map_kGuild[r.dwGuildTo];
|
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)
|
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())
|
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())",
|
snprintf(szQuery, sizeof(szQuery), "INSERT INTO item_award (login, vnum, socket0, given_time) VALUES('%s', %d, %u, NOW())",
|
||||||
c_pszLogin, ITEM_ELK_VNUM, dwGold);
|
c_pszLogin, ITEM_ELK_VNUM, dwGold);
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
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))
|
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())",
|
snprintf(szQuery, sizeof(szQuery), "INSERT INTO item_award (login, vnum, socket0, given_time) VALUES('%s', %d, %u, NOW())",
|
||||||
c_pszLogin, ITEM_ELK_VNUM, dwGold);
|
c_pszLogin, ITEM_ELK_VNUM, dwGold);
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_data.bStarted)
|
if (m_data.bStarted)
|
||||||
{
|
{
|
||||||
sys_log(0, "GuildWarReserve::Bet: war is already started");
|
SPDLOG_DEBUG("GuildWarReserve::Bet: war is already started");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapBet.find(pszLogin) != mapBet.end())
|
if (mapBet.find(pszLogin) != mapBet.end())
|
||||||
{
|
{
|
||||||
sys_log(0, "GuildWarReserve::Bet: failed. already bet");
|
SPDLOG_DEBUG("GuildWarReserve::Bet: failed. already bet");
|
||||||
return false;
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1311,7 +1311,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild)
|
||||||
|
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
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)));
|
mapBet.insert(std::make_pair(pszLogin, std::make_pair(dwGuild, dwGold)));
|
||||||
|
|
||||||
TPacketGDGuildWarBet pckBet;
|
TPacketGDGuildWarBet pckBet;
|
||||||
|
@ -1338,7 +1338,7 @@ void CGuildWarReserve::Draw()
|
||||||
if (mapBet.empty())
|
if (mapBet.empty())
|
||||||
return;
|
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();
|
itertype(mapBet) it = mapBet.begin();
|
||||||
|
|
||||||
|
@ -1368,7 +1368,7 @@ void CGuildWarReserve::Draw()
|
||||||
|
|
||||||
if (iRow > 0)
|
if (iRow > 0)
|
||||||
{
|
{
|
||||||
sys_log(0, "WAR_REWARD: QUERY: %s", szQuery);
|
SPDLOG_DEBUG("WAR_REWARD: QUERY: {}", szQuery);
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
CDBManager::instance().AsyncQuery(szQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,18 +1381,18 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo)
|
||||||
{
|
{
|
||||||
DWORD dwWinner;
|
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.lPowerFrom > m_data.lPowerTo)
|
||||||
{
|
{
|
||||||
if (m_data.lHandicap > iScoreFrom - iScoreTo)
|
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;
|
dwWinner = m_data.dwGuildTo;
|
||||||
}
|
}
|
||||||
else
|
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;
|
dwWinner = m_data.dwGuildFrom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1400,12 +1400,12 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo)
|
||||||
{
|
{
|
||||||
if (m_data.lHandicap > iScoreTo - iScoreFrom)
|
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;
|
dwWinner = m_data.dwGuildFrom;
|
||||||
}
|
}
|
||||||
else
|
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;
|
dwWinner = m_data.dwGuildTo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1427,17 +1427,17 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo)
|
||||||
dwWinnerBet = m_data.dwBetTo;
|
dwWinnerBet = m_data.dwBetTo;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sys_err("WAR_REWARD: fatal error, winner does not exist!");
|
SPDLOG_ERROR("WAR_REWARD: fatal error, winner does not exist!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwWinnerBet == 0)
|
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;
|
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();
|
itertype(mapBet) it = mapBet.begin();
|
||||||
|
|
||||||
|
@ -1459,7 +1459,7 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo)
|
||||||
double ratio = (double) it->second.second / dwWinnerBet;
|
double ratio = (double) it->second.second / dwWinnerBet;
|
||||||
|
|
||||||
// 10% 세금 공제 후 분배
|
// 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);
|
DWORD dwGold = (DWORD) (dwTotalBet * ratio * 0.9);
|
||||||
|
|
||||||
|
@ -1480,7 +1480,7 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo)
|
||||||
|
|
||||||
if (iRow > 0)
|
if (iRow > 0)
|
||||||
{
|
{
|
||||||
sys_log(0, "WAR_REWARD: query: %s", szQuery);
|
SPDLOG_DEBUG("WAR_REWARD: query: {}", szQuery);
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
CDBManager::instance().AsyncQuery(szQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,13 +68,13 @@ bool PlayerHB::Query(DWORD id)
|
||||||
|
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
{
|
{
|
||||||
sys_err("cannot find %s ", szFind);
|
SPDLOG_ERROR("cannot find {} ", szFind);
|
||||||
// sys_err("cannot find %s in %s", szFind, m_stCreateTableQuery.c_str());
|
// SPDLOG_ERROR("cannot find {} in {}", szFind, m_stCreateTableQuery.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(szQuery, sizeof(szQuery), "CREATE TABLE IF NOT EXISTS %s%s", szTableName, m_stCreateTableQuery.c_str() + strlen(szFind));
|
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<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP));
|
std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP));
|
||||||
m_stTableName = szTableName;
|
m_stTableName = szTableName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg)
|
||||||
strcpy(cmdStr,whyStr); //명령어 얻는 과정에서 토큰쓰면 원본도 토큰화 되기 때문
|
strcpy(cmdStr,whyStr); //명령어 얻는 과정에서 토큰쓰면 원본도 토큰화 되기 때문
|
||||||
char command[20] = "";
|
char command[20] = "";
|
||||||
strcpy(command,CClientManager::instance().GetCommand(cmdStr).c_str()); // command 얻기
|
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이면
|
if( !(strcmp(command,"GIFT") )) // command 가 GIFT이면
|
||||||
{
|
{
|
||||||
TPacketItemAwardInfromer giftData;
|
TPacketItemAwardInfromer giftData;
|
||||||
|
@ -74,7 +74,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg)
|
||||||
m_map_award.insert(std::make_pair(dwID, kData));
|
m_map_award.insert(std::make_pair(dwID, kData));
|
||||||
|
|
||||||
printf("ITEM_AWARD load id %u bMall %d \n", kData->dwID, kData->bMall);
|
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<TItemAward *> & kSet = m_map_kSetAwardByLogin[kData->szLogin];
|
std::set<TItemAward *> & kSet = m_map_kSetAwardByLogin[kData->szLogin];
|
||||||
kSet.insert(kData);
|
kSet.insert(kData);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ void ItemAwardManager::Taken(DWORD dwAwardID, DWORD dwItemID)
|
||||||
|
|
||||||
if (it == m_map_award.end())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ TItemIDRangeTable CItemIDRangeManager::GetRange()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i)
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ bool CItemIDRangeManager::BuildRange(DWORD dwMin, DWORD dwMax, TItemIDRangeTable
|
||||||
|
|
||||||
if ((dwMax < dwItemMaxID) || (dwMax - dwItemMaxID < cs_dwMinimumRemainCount))
|
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);
|
dwMin, dwMax, dwItemMaxID, cs_dwMinimumRemainCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -136,12 +136,12 @@ bool CItemIDRangeManager::BuildRange(DWORD dwMin, DWORD dwMax, TItemIDRangeTable
|
||||||
|
|
||||||
if (count > 0)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,18 @@
|
||||||
#ifndef __INC_METIN_II_ITEM_ID_RANGE_MANAGER_H__
|
#ifndef __INC_METIN_II_ITEM_ID_RANGE_MANAGER_H__
|
||||||
#define __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<CItemIDRangeManager>
|
class CItemIDRangeManager : public singleton<CItemIDRangeManager>
|
||||||
{
|
{
|
||||||
private :
|
private:
|
||||||
const static DWORD cs_dwMaxItemID = 4290000000UL;
|
|
||||||
const static DWORD cs_dwMinimumRange = 10000000UL;
|
|
||||||
const static DWORD cs_dwMinimumRemainCount = 10000UL;
|
|
||||||
|
|
||||||
std::list<TItemIDRangeTable> m_listData;
|
std::list<TItemIDRangeTable> m_listData;
|
||||||
|
|
||||||
public :
|
public:
|
||||||
CItemIDRangeManager();
|
CItemIDRangeManager();
|
||||||
|
|
||||||
void Build();
|
void Build();
|
||||||
|
|
|
@ -78,11 +78,11 @@ void CLoginData::SetPlay(bool bOn)
|
||||||
{
|
{
|
||||||
if (bOn)
|
if (bOn)
|
||||||
{
|
{
|
||||||
sys_log(0, "SetPlay on %lu %s", GetKey(), m_data.login);
|
SPDLOG_DEBUG("SetPlay on {} {}", GetKey(), m_data.login);
|
||||||
SetLogonTime();
|
SetLogonTime();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sys_log(0, "SetPlay off %lu %s", GetKey(), m_data.login);
|
SPDLOG_DEBUG("SetPlay off {} {}", GetKey(), m_data.login);
|
||||||
|
|
||||||
m_bPlay = bOn;
|
m_bPlay = bOn;
|
||||||
m_lastPlayTime = CClientManager::instance().GetCurrentTime();
|
m_lastPlayTime = CClientManager::instance().GetCurrentTime();
|
||||||
|
|
|
@ -38,8 +38,6 @@ int g_iItemCacheFlushSeconds = 60*5;
|
||||||
//g_iLogoutSeconds 수치는 g_iPlayerCacheFlushSeconds 와 g_iItemCacheFlushSeconds 보다 길어야 한다.
|
//g_iLogoutSeconds 수치는 g_iPlayerCacheFlushSeconds 와 g_iItemCacheFlushSeconds 보다 길어야 한다.
|
||||||
int g_iLogoutSeconds = 60*10;
|
int g_iLogoutSeconds = 60*10;
|
||||||
|
|
||||||
int g_log = 1;
|
|
||||||
|
|
||||||
|
|
||||||
// MYSHOP_PRICE_LIST
|
// MYSHOP_PRICE_LIST
|
||||||
int g_iItemPriceListTableCacheFlushSeconds = 540;
|
int g_iItemPriceListTableCacheFlushSeconds = 540;
|
||||||
|
@ -52,9 +50,9 @@ extern const char * _malloc_options;
|
||||||
void emergency_sig(int sig)
|
void emergency_sig(int sig)
|
||||||
{
|
{
|
||||||
if (sig == SIGSEGV)
|
if (sig == SIGSEGV)
|
||||||
sys_log(0, "SIGNAL: SIGSEGV");
|
SPDLOG_DEBUG("SIGNAL: SIGSEGV");
|
||||||
else if (sig == SIGUSR1)
|
else if (sig == SIGUSR1)
|
||||||
sys_log(0, "SIGNAL: SIGUSR1");
|
SPDLOG_DEBUG("SIGNAL: SIGUSR1");
|
||||||
|
|
||||||
if (sig == SIGSEGV)
|
if (sig == SIGSEGV)
|
||||||
abort();
|
abort();
|
||||||
|
@ -93,7 +91,7 @@ int main()
|
||||||
#ifdef __AUCTION__
|
#ifdef __AUCTION__
|
||||||
AuctionManager::instance().Initialize();
|
AuctionManager::instance().Initialize();
|
||||||
#endif
|
#endif
|
||||||
sys_log(0, "Metin2DBCacheServer Start\n");
|
SPDLOG_DEBUG("Metin2DBCacheServer Start");
|
||||||
|
|
||||||
CClientManager::instance().MainLoop();
|
CClientManager::instance().MainLoop();
|
||||||
|
|
||||||
|
@ -113,7 +111,7 @@ int main()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
sys_log(0, "WAITING_QUERY_COUNT %d", iCount);
|
SPDLOG_DEBUG("WAITING_QUERY_COUNT {}", iCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -144,18 +142,6 @@ int Start()
|
||||||
else
|
else
|
||||||
SPDLOG_INFO("Test Server");
|
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 tmpValue;
|
||||||
|
|
||||||
int heart_beat = 50;
|
int heart_beat = 50;
|
||||||
|
@ -286,7 +272,7 @@ int Start()
|
||||||
if (CConfig::instance().GetValue("SQL_ACCOUNT", line, 256))
|
if (CConfig::instance().GetValue("SQL_ACCOUNT", line, 256))
|
||||||
{
|
{
|
||||||
sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort);
|
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;
|
int iRetry = 5;
|
||||||
|
|
||||||
|
@ -294,26 +280,26 @@ int Start()
|
||||||
{
|
{
|
||||||
if (CDBManager::instance().Connect(SQL_ACCOUNT, szAddr, iPort, szDB, szUser, szPassword))
|
if (CDBManager::instance().Connect(SQL_ACCOUNT, szAddr, iPort, szDB, szUser, szPassword))
|
||||||
{
|
{
|
||||||
sys_log(0, " OK");
|
SPDLOG_DEBUG(" OK");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_log(0, " failed, retrying in 5 seconds");
|
SPDLOG_DEBUG(" failed, retrying in 5 seconds");
|
||||||
fprintf(stderr, " failed, retrying in 5 seconds");
|
SPDLOG_ERROR(" failed, retrying in 5 seconds");
|
||||||
sleep(5);
|
sleep(5);
|
||||||
} while (iRetry--);
|
} while (iRetry--);
|
||||||
fprintf(stderr, "Success ACCOUNT\n");
|
SPDLOG_INFO("Success ACCOUNT");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sys_err("SQL_ACCOUNT not configured");
|
SPDLOG_ERROR("SQL_ACCOUNT not configured");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CConfig::instance().GetValue("SQL_COMMON", line, 256))
|
if (CConfig::instance().GetValue("SQL_COMMON", line, 256))
|
||||||
{
|
{
|
||||||
sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort);
|
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;
|
int iRetry = 5;
|
||||||
|
|
||||||
|
@ -321,26 +307,26 @@ int Start()
|
||||||
{
|
{
|
||||||
if (CDBManager::instance().Connect(SQL_COMMON, szAddr, iPort, szDB, szUser, szPassword))
|
if (CDBManager::instance().Connect(SQL_COMMON, szAddr, iPort, szDB, szUser, szPassword))
|
||||||
{
|
{
|
||||||
sys_log(0, " OK");
|
SPDLOG_DEBUG(" OK");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_log(0, " failed, retrying in 5 seconds");
|
SPDLOG_DEBUG(" failed, retrying in 5 seconds");
|
||||||
fprintf(stderr, " failed, retrying in 5 seconds");
|
SPDLOG_ERROR(" failed, retrying in 5 seconds");
|
||||||
sleep(5);
|
sleep(5);
|
||||||
} while (iRetry--);
|
} while (iRetry--);
|
||||||
fprintf(stderr, "Success COMMON\n");
|
SPDLOG_INFO("Success COMMON");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sys_err("SQL_COMMON not configured");
|
SPDLOG_ERROR("SQL_COMMON not configured");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CConfig::instance().GetValue("SQL_HOTBACKUP", line, 256))
|
if (CConfig::instance().GetValue("SQL_HOTBACKUP", line, 256))
|
||||||
{
|
{
|
||||||
sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort);
|
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;
|
int iRetry = 5;
|
||||||
|
|
||||||
|
@ -348,21 +334,21 @@ int Start()
|
||||||
{
|
{
|
||||||
if (CDBManager::instance().Connect(SQL_HOTBACKUP, szAddr, iPort, szDB, szUser, szPassword))
|
if (CDBManager::instance().Connect(SQL_HOTBACKUP, szAddr, iPort, szDB, szUser, szPassword))
|
||||||
{
|
{
|
||||||
sys_log(0, " OK");
|
SPDLOG_DEBUG(" OK");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_log(0, " failed, retrying in 5 seconds");
|
SPDLOG_DEBUG(" failed, retrying in 5 seconds");
|
||||||
fprintf(stderr, " failed, retrying in 5 seconds");
|
SPDLOG_ERROR(" failed, retrying in 5 seconds");
|
||||||
sleep(5);
|
sleep(5);
|
||||||
}
|
}
|
||||||
while (iRetry--);
|
while (iRetry--);
|
||||||
|
|
||||||
fprintf(stderr, "Success HOTBACKUP\n");
|
SPDLOG_INFO("Success HOTBACKUP");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sys_err("SQL_HOTBACKUP not configured");
|
SPDLOG_ERROR("SQL_HOTBACKUP not configured");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace marriage
|
||||||
unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
|
unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
|
||||||
|
|
||||||
SQLResult * pRes = pmsg->Get();
|
SQLResult * pRes = pmsg->Get();
|
||||||
sys_log(0, "MarriageList(size=%lu)", pRes->uiNumRows);
|
SPDLOG_DEBUG("MarriageList(size={})", pRes->uiNumRows);
|
||||||
|
|
||||||
if (pRes->uiNumRows > 0)
|
if (pRes->uiNumRows > 0)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ namespace marriage
|
||||||
m_MarriageByPID.insert(make_pair(pid1, pMarriage));
|
m_MarriageByPID.insert(make_pair(pid1, pMarriage));
|
||||||
m_MarriageByPID.insert(make_pair(pid2, 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;
|
return true;
|
||||||
|
@ -92,7 +92,7 @@ namespace marriage
|
||||||
DWORD now = CClientManager::instance().GetCurrentTime();
|
DWORD now = CClientManager::instance().GetCurrentTime();
|
||||||
if (IsMarried(dwPID1) || IsMarried(dwPID2))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,11 +106,11 @@ namespace marriage
|
||||||
SQLResult* res = pmsg->Get();
|
SQLResult* res = pmsg->Get();
|
||||||
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
|
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
|
||||||
{
|
{
|
||||||
sys_err("cannot insert marriage");
|
SPDLOG_ERROR("cannot insert marriage");
|
||||||
return;
|
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);
|
TMarriage* pMarriage = new TMarriage(dwPID1, dwPID2, 0, now, 0, szName1, szName2);
|
||||||
m_Marriages.insert(pMarriage);
|
m_Marriages.insert(pMarriage);
|
||||||
|
@ -131,7 +131,7 @@ namespace marriage
|
||||||
TMarriage* pMarriage = Get(dwPID1);
|
TMarriage* pMarriage = Get(dwPID1);
|
||||||
if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2)
|
if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2)
|
||||||
{
|
{
|
||||||
sys_err("not under marriage : %u %u", dwPID1, dwPID2);
|
SPDLOG_ERROR("not under marriage : {} {}", dwPID1, dwPID2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,11 +146,11 @@ namespace marriage
|
||||||
SQLResult* res = pmsg->Get();
|
SQLResult* res = pmsg->Get();
|
||||||
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
|
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;
|
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->love_point = iLovePoint;
|
||||||
pMarriage->is_married = byMarried;
|
pMarriage->is_married = byMarried;
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ namespace marriage
|
||||||
|
|
||||||
if (pMarriage)
|
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)
|
if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2)
|
||||||
{
|
{
|
||||||
|
@ -176,9 +176,9 @@ namespace marriage
|
||||||
|
|
||||||
for (; it != m_MarriageByPID.end(); ++it)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,11 +192,11 @@ namespace marriage
|
||||||
SQLResult* res = pmsg->Get();
|
SQLResult* res = pmsg->Get();
|
||||||
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_log(0, "MARRIAGE REMOVE PID:%u %u", dwPID1, dwPID2);
|
SPDLOG_DEBUG("MARRIAGE REMOVE PID:{} {}", dwPID1, dwPID2);
|
||||||
|
|
||||||
m_Marriages.erase(pMarriage);
|
m_Marriages.erase(pMarriage);
|
||||||
m_MarriageByPID.erase(dwPID1);
|
m_MarriageByPID.erase(dwPID1);
|
||||||
|
@ -215,13 +215,13 @@ namespace marriage
|
||||||
TMarriage* pMarriage = Get(dwPID1);
|
TMarriage* pMarriage = Get(dwPID1);
|
||||||
if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMarriage->is_married)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,11 +236,11 @@ namespace marriage
|
||||||
SQLResult* res = pmsg->Get();
|
SQLResult* res = pmsg->Get();
|
||||||
if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_log(0, "MARRIAGE ENGAGE->MARRIAGE PID:%u %u", dwPID1, dwPID2);
|
SPDLOG_DEBUG("MARRIAGE ENGAGE->MARRIAGE PID:{} {}", dwPID1, dwPID2);
|
||||||
pMarriage->is_married = 1;
|
pMarriage->is_married = 1;
|
||||||
|
|
||||||
TPacketMarriageUpdate p;
|
TPacketMarriageUpdate p;
|
||||||
|
@ -313,7 +313,7 @@ namespace marriage
|
||||||
itertype(m_mapRunningWedding) it = m_mapRunningWedding.find(make_pair(dwPID1, dwPID2));
|
itertype(m_mapRunningWedding) it = m_mapRunningWedding.find(make_pair(dwPID1, dwPID2));
|
||||||
if (it == m_mapRunningWedding.end())
|
if (it == m_mapRunningWedding.end())
|
||||||
{
|
{
|
||||||
sys_err("try to end wedding %u %u", dwPID1, dwPID2);
|
SPDLOG_ERROR("try to end wedding {} {}", dwPID1, dwPID2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "Monarch.h"
|
#include "Monarch.h"
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
|
@ -53,8 +55,7 @@ void CMonarch::ElectMonarch()
|
||||||
|
|
||||||
++s[idx];
|
++s[idx];
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("[MONARCH_VOTE] pid({}) come to vote candidacy pid({})", it->second->pid, m_vec_MonarchCandidacy[idx].pid);
|
||||||
sys_log (0, "[MONARCH_VOTE] pid(%d) come to vote candidacy pid(%d)", it->second->pid, m_vec_MonarchCandidacy[idx].pid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] s;
|
delete [] s;
|
||||||
|
@ -167,8 +168,7 @@ bool CMonarch::TakeMoney(int Empire, DWORD pid, int64_t Money)
|
||||||
|
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
CDBManager::instance().AsyncQuery(szQuery);
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("[MONARCH] Take money empire({}) money({})", Empire, m_MonarchInfo.money[Empire]);
|
||||||
sys_log(0, "[MONARCH] Take money empire(%d) money(%lld)", Empire, m_MonarchInfo.money[Empire]);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,8 +197,7 @@ bool CMonarch::LoadMonarch()
|
||||||
str_to_number(p->money[Empire], row[idx++]);
|
str_to_number(p->money[Empire], row[idx++]);
|
||||||
strlcpy(p->date[Empire], row[idx++], sizeof(p->date[Empire]));
|
strlcpy(p->date[Empire], row[idx++], sizeof(p->date[Empire]));
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("[LOAD_MONARCH] Empire {} pid {} money {} windate {}", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]);
|
||||||
sys_log(0, "[LOAD_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pMsg;
|
delete pMsg;
|
||||||
|
@ -230,8 +229,7 @@ bool CMonarch::SetMonarch(const char * name)
|
||||||
strlcpy(p->name[Empire], row[idx++], sizeof(p->name[Empire]));
|
strlcpy(p->name[Empire], row[idx++], sizeof(p->name[Empire]));
|
||||||
p->money[Empire] = atoll(row[idx++]);
|
p->money[Empire] = atoll(row[idx++]);
|
||||||
|
|
||||||
if (g_test_server)
|
SPDLOG_TRACE("[Set_MONARCH] Empire {} pid {} money {} windate {}", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]);
|
||||||
sys_log(0, "[Set_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]);
|
|
||||||
}
|
}
|
||||||
delete pMsg;
|
delete pMsg;
|
||||||
|
|
||||||
|
@ -278,7 +276,7 @@ bool CMonarch::DelMonarch(const char * name)
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
if (pMsg->Get()->uiNumRows == 0)
|
||||||
{
|
{
|
||||||
sys_err(" DirectQuery failed(%s)", szQuery);
|
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
||||||
delete pMsg;
|
delete pMsg;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,15 +29,15 @@ void CPeer::OnAccept()
|
||||||
static DWORD current_handle = 0;
|
static DWORD current_handle = 0;
|
||||||
m_dwHandle = ++current_handle;
|
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()
|
void CPeer::OnClose()
|
||||||
{
|
{
|
||||||
m_state = STATE_CLOSE;
|
m_state = STATE_CLOSE;
|
||||||
|
|
||||||
sys_log(0, "Connection closed. (host: %s)", m_host);
|
SPDLOG_DEBUG("Connection closed. (host: {})", m_host);
|
||||||
sys_log(0, "ItemIDRange: returned. %u ~ %u", m_itemRange.dwMin, m_itemRange.dwMax);
|
SPDLOG_DEBUG("ItemIDRange: returned. {} ~ {}", m_itemRange.dwMin, m_itemRange.dwMax);
|
||||||
|
|
||||||
CItemIDRangeManager::instance().UpdateRange(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);
|
const char * buf = (const char *) GetRecvBuffer(iBytesProceed + 9);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
sys_err("PeekPacket: Failed to get network buffer!");
|
SPDLOG_ERROR("PeekPacket: Failed to get network buffer!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO
|
||||||
// Ensure that all the data was fully received
|
// Ensure that all the data was fully received
|
||||||
if (iBytesProceed + dwLength + 9 > (DWORD) GetRecvLength())
|
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);
|
9+dwLength, GetRecvLength()-iBytesProceed);
|
||||||
return false;
|
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
|
// Ensure that all the required data is available in a contiguous area
|
||||||
buf = (const char *) GetRecvBuffer(iBytesProceed + dwLength + 9);
|
buf = (const char *) GetRecvBuffer(iBytesProceed + dwLength + 9);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
sys_err("PeekPacket: Failed to get network buffer!");
|
SPDLOG_ERROR("PeekPacket: Failed to get network buffer!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ void CPeer::EncodeHeader(BYTE header, DWORD dwHandle, DWORD dwSize)
|
||||||
{
|
{
|
||||||
HEADER h;
|
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.bHeader = header;
|
||||||
h.dwHandle = dwHandle;
|
h.dwHandle = dwHandle;
|
||||||
|
@ -149,7 +149,7 @@ void CPeer::SendSpareItemIDRange()
|
||||||
|
|
||||||
if (SetSpareItemIDRange(CItemIDRangeManager::instance().GetRange()) == false)
|
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;
|
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;
|
if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false;
|
||||||
|
|
||||||
m_itemRange = itemRange;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ bool CPeer::SetSpareItemIDRange(TItemIDRangeTable itemRange)
|
||||||
if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false;
|
if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false;
|
||||||
|
|
||||||
m_itemSpareRange = itemRange;
|
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);
|
m_itemSpareRange.dwUsableItemIDMin);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -183,14 +183,14 @@ bool CPeer::CheckItemIDRangeCollision(TItemIDRangeTable itemRange)
|
||||||
{
|
{
|
||||||
if (m_itemRange.dwMin < itemRange.dwMax && m_itemRange.dwMax > itemRange.dwMin)
|
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);
|
m_itemRange.dwMin, m_itemRange.dwMax, itemRange.dwMin, itemRange.dwMax);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_itemSpareRange.dwMin < itemRange.dwMax && m_itemSpareRange.dwMax > itemRange.dwMin)
|
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);
|
m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, itemRange.dwMin, itemRange.dwMax);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@ void CPeerBase::Destroy()
|
||||||
bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr)
|
bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr)
|
||||||
{
|
{
|
||||||
if (!bufev) {
|
if (!bufev) {
|
||||||
sys_err("Cannot accept empty bufferevent!");
|
SPDLOG_ERROR("Cannot accept empty bufferevent!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bufferevent != nullptr) {
|
if (m_bufferevent != nullptr) {
|
||||||
sys_err("Peer is already initialized");
|
SPDLOG_ERROR("Peer is already initialized");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr)
|
||||||
// Trigger the OnAccept event
|
// Trigger the OnAccept event
|
||||||
OnAccept();
|
OnAccept();
|
||||||
|
|
||||||
sys_log(0, "ACCEPT FROM %s", m_host);
|
SPDLOG_DEBUG("ACCEPT FROM {}", m_host);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -86,12 +86,12 @@ void CPeerBase::Encode(const void* data, size_t size)
|
||||||
{
|
{
|
||||||
if (!m_bufferevent)
|
if (!m_bufferevent)
|
||||||
{
|
{
|
||||||
sys_err("Bufferevent not ready!");
|
SPDLOG_ERROR("Bufferevent not ready!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufferevent_write(m_bufferevent, data, size) != 0) {
|
if (bufferevent_write(m_bufferevent, data, size) != 0) {
|
||||||
sys_err("Buffer write error!");
|
SPDLOG_ERROR("Buffer write error!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ void CPeerBase::RecvEnd(size_t proceed_bytes)
|
||||||
{
|
{
|
||||||
if (!m_bufferevent)
|
if (!m_bufferevent)
|
||||||
{
|
{
|
||||||
sys_err("Bufferevent not ready!");
|
SPDLOG_ERROR("Bufferevent not ready!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ size_t CPeerBase::GetRecvLength()
|
||||||
{
|
{
|
||||||
if (!m_bufferevent)
|
if (!m_bufferevent)
|
||||||
{
|
{
|
||||||
sys_err("Bufferevent not ready!");
|
SPDLOG_ERROR("Bufferevent not ready!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ const void * CPeerBase::GetRecvBuffer(ssize_t ensure_bytes)
|
||||||
{
|
{
|
||||||
if (!m_bufferevent)
|
if (!m_bufferevent)
|
||||||
{
|
{
|
||||||
sys_err("Bufferevent not ready!");
|
SPDLOG_ERROR("Bufferevent not ready!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ size_t CPeerBase::GetSendLength()
|
||||||
{
|
{
|
||||||
if (!m_bufferevent)
|
if (!m_bufferevent)
|
||||||
{
|
{
|
||||||
sys_err("Bufferevent not ready!");
|
SPDLOG_ERROR("Bufferevent not ready!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ void CPrivManager::AddCharPriv(DWORD pid, BYTE type, int value)
|
||||||
{
|
{
|
||||||
if (MAX_PRIV_NUM <= type)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ void CPrivManager::AddCharPriv(DWORD pid, BYTE type, int value)
|
||||||
m_aPrivChar[type].insert(std::make_pair(pid, p));
|
m_aPrivChar[type].insert(std::make_pair(pid, p));
|
||||||
|
|
||||||
// TODO send packet
|
// TODO send packet
|
||||||
sys_log(0, "AddCharPriv %d %d %d", pid, type, value);
|
SPDLOG_DEBUG("AddCharPriv {} {} {}", pid, type, value);
|
||||||
SendChangeCharPriv(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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,14 +141,14 @@ void CPrivManager::AddGuildPriv(DWORD guild_id, BYTE type, int value, time_t dur
|
||||||
SendChangeGuildPriv(guild_id, type, value, end);
|
SendChangeGuildPriv(guild_id, type, value, end);
|
||||||
// END_OF_ADD_GUILD_PRIV_TIME
|
// 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)
|
void CPrivManager::AddEmpirePriv(BYTE empire, BYTE type, int value, time_t duration_sec)
|
||||||
{
|
{
|
||||||
if (MAX_PRIV_NUM <= type)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ void CPrivManager::AddEmpirePriv(BYTE empire, BYTE type, int value, time_t durat
|
||||||
SendChangeEmpirePriv(empire, type, value, end);
|
SendChangeEmpirePriv(empire, type, value, end);
|
||||||
// END_OF_ADD_EMPIRE_PRIV_TIME
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -206,7 +206,7 @@ int get_Item_SubType_Value(int type_value, string inputString)
|
||||||
// assert ¾È ¸ÔÈ÷´Â µí..
|
// assert ¾È ¸ÔÈ÷´Â µí..
|
||||||
if (_countof(arSubType) <= type_value)
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ bool Set_Proto_Mob_Table(TMobTable *mobTable, cCsvTable &csvTable,std::map<int,c
|
||||||
str_to_number(mobTable->bDeathBlowPoint, csvTable.AsStringByIndex(col++));
|
str_to_number(mobTable->bDeathBlowPoint, csvTable.AsStringByIndex(col++));
|
||||||
str_to_number(mobTable->bRevivePoint, 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -739,9 +739,9 @@ bool Set_Proto_Item_Table(TItemTable *itemTable, cCsvTable &csvTable,std::map<in
|
||||||
for (int j = 0; j < i; ++j)
|
for (int j = 0; j < i; ++j)
|
||||||
dataStream << dataArray[j] << ",";
|
dataStream << dataArray[j] << ",";
|
||||||
|
|
||||||
//fprintf(stderr, "ItemProto Reading Failed : Invalid value.\n");
|
//SPDLOG_ERROR("ItemProto Reading Failed : Invalid value.");
|
||||||
sys_err("ItemProto Reading Failed : Invalid value. (index: %d, col: %d, value: %s)", i, col, csvTable.AsStringByIndex(col));
|
SPDLOG_ERROR("ItemProto Reading Failed : Invalid value. (index: {}, col: {}, value: {})", i, col, csvTable.AsStringByIndex(col));
|
||||||
sys_err("\t%d ~ %d Values: %s", 0, i, dataStream.str().c_str());
|
SPDLOG_ERROR("\t{} ~ {} Values: {}", 0, i, dataStream.str().c_str());
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -768,7 +768,7 @@ bool Set_Proto_Item_Table(TItemTable *itemTable, cCsvTable &csvTable,std::map<in
|
||||||
int end_vnum = atoi(s_end_vnum.c_str());
|
int end_vnum = atoi(s_end_vnum.c_str());
|
||||||
if (0 == start_vnum || (0 != end_vnum && end_vnum < start_vnum))
|
if (0 == start_vnum || (0 != end_vnum && end_vnum < start_vnum))
|
||||||
{
|
{
|
||||||
sys_err ("INVALID VNUM %s", s.c_str());
|
SPDLOG_ERROR("INVALID VNUM {}", s.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
itemTable->dwVnum = start_vnum;
|
itemTable->dwVnum = start_vnum;
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#include <common/stl.h>
|
#include <common/stl.h>
|
||||||
#include <common/service.h>
|
#include <common/service.h>
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
@ -47,10 +47,6 @@ target_link_libraries(${PROJECT_NAME} effolkronium_random)
|
||||||
find_package(fmt CONFIG REQUIRED)
|
find_package(fmt CONFIG REQUIRED)
|
||||||
target_link_libraries(${PROJECT_NAME} fmt::fmt)
|
target_link_libraries(${PROJECT_NAME} fmt::fmt)
|
||||||
|
|
||||||
# spdlog
|
|
||||||
find_package(spdlog CONFIG REQUIRED)
|
|
||||||
target_link_libraries(${PROJECT_NAME} spdlog::spdlog)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# System-provided dependencies
|
# System-provided dependencies
|
||||||
#
|
#
|
||||||
|
|
|
@ -113,7 +113,7 @@ bool DragonSoulTable::ReadVnumMapper()
|
||||||
int n = pGroupNode->GetRowCount();
|
int n = pGroupNode->GetRowCount();
|
||||||
if (0 == n)
|
if (0 == n)
|
||||||
{
|
{
|
||||||
sys_err ("Group VnumMapper is Empty.");
|
SPDLOG_ERROR("Group VnumMapper is Empty.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1671,7 +1671,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data)
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
SPDLOG_TRACE(
|
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(),
|
ch->GetName(),
|
||||||
pinfo->bFunc,
|
pinfo->bFunc,
|
||||||
pinfo->bArg,
|
pinfo->bArg,
|
||||||
|
|
|
@ -1188,14 +1188,13 @@ static void __DropEvent_CharStone_DropItem(CHARACTER & killer, CHARACTER & victi
|
||||||
|
|
||||||
if (Random::get(1, MaxRange) <= dropPercent)
|
if (Random::get(1, MaxRange) <= dropPercent)
|
||||||
{
|
{
|
||||||
int log_level = (test_server || killer.GetGMLevel() >= GM_LOW_WIZARD) ? 0 : 1;
|
|
||||||
int victim_level = victim.GetLevel();
|
int victim_level = victim.GetLevel();
|
||||||
int level_diff = victim_level - killer_level;
|
int level_diff = victim_level - killer_level;
|
||||||
|
|
||||||
if (level_diff >= +gs_dropEvent_charStone.level_range || level_diff <= -gs_dropEvent_charStone.level_range)
|
if (level_diff >= +gs_dropEvent_charStone.level_range || level_diff <= -gs_dropEvent_charStone.level_range)
|
||||||
{
|
{
|
||||||
sys_log(log_level,
|
SPDLOG_DEBUG(
|
||||||
"dropevent.drop_char_stone.level_range_over: killer(%s: lv%d), victim(%s: lv:%d), level_diff(%d)",
|
"dropevent.drop_char_stone.level_range_over: killer({}: lv{}), victim({}: lv:{}), level_diff({})",
|
||||||
killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff);
|
killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1209,8 +1208,8 @@ static void __DropEvent_CharStone_DropItem(CHARACTER & killer, CHARACTER & victi
|
||||||
{
|
{
|
||||||
vec_item.push_back(p_item);
|
vec_item.push_back(p_item);
|
||||||
|
|
||||||
sys_log(log_level,
|
SPDLOG_DEBUG(
|
||||||
"dropevent.drop_char_stone.item_drop: killer(%s: lv%d), victim(%s: lv:%d), item_name(%s)",
|
"dropevent.drop_char_stone.item_drop: killer({}: lv{}), victim({}: lv:{}), item_name({})",
|
||||||
killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName());
|
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)
|
//if (level_diff >= +gs_dropEvent_refineBox.level_range || level_diff <= -gs_dropEvent_refineBox.level_range)
|
||||||
//{
|
//{
|
||||||
// sys_log(log_level,
|
// SPDLOG_DEBUG(
|
||||||
// "dropevent.drop_refine_box.level_range_over: killer(%s: lv%d), victim(%s: lv:%d), level_diff(%d)",
|
// "dropevent.drop_refine_box.level_range_over: killer({}: lv{}), victim({}: lv:{}), level_diff({})",
|
||||||
// killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff);
|
// killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff);
|
||||||
// return NULL;
|
// return NULL;
|
||||||
//}
|
//}
|
||||||
|
@ -1330,16 +1329,14 @@ static void __DropEvent_RefineBox_DropItem(CHARACTER & killer, CHARACTER & victi
|
||||||
if (!gs_dropEvent_refineBox.alive)
|
if (!gs_dropEvent_refineBox.alive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int log_level = (test_server || killer.GetGMLevel() >= GM_LOW_WIZARD) ? 0 : 1;
|
|
||||||
|
|
||||||
LPITEM p_item = __DropEvent_RefineBox_GetDropItem(killer, victim, itemMgr);
|
LPITEM p_item = __DropEvent_RefineBox_GetDropItem(killer, victim, itemMgr);
|
||||||
|
|
||||||
if (p_item)
|
if (p_item)
|
||||||
{
|
{
|
||||||
vec_item.push_back(p_item);
|
vec_item.push_back(p_item);
|
||||||
|
|
||||||
sys_log(log_level,
|
SPDLOG_DEBUG(
|
||||||
"dropevent.drop_refine_box.item_drop: killer(%s: lv%d), victim(%s: lv:%d), item_name(%s)",
|
"dropevent.drop_refine_box.item_drop: killer({}: lv{}), victim({}: lv:{}), item_name({})",
|
||||||
killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName());
|
killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -790,14 +790,12 @@ int idle()
|
||||||
if (!io_loop(ev_base)) return 0;
|
if (!io_loop(ev_base)) return 0;
|
||||||
s_dwProfiler[PROF_IO] += (get_dword_time() - t);
|
s_dwProfiler[PROF_IO] += (get_dword_time() - t);
|
||||||
|
|
||||||
log_rotate();
|
|
||||||
|
|
||||||
gettimeofday(&now, (struct timezone *) 0);
|
gettimeofday(&now, (struct timezone *) 0);
|
||||||
++process_time_count;
|
++process_time_count;
|
||||||
|
|
||||||
if (now.tv_sec - pta.tv_sec > 0)
|
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,
|
process_time_count,
|
||||||
num_events_called,
|
num_events_called,
|
||||||
event_count(),
|
event_count(),
|
||||||
|
|
|
@ -1648,7 +1648,7 @@ namespace quest
|
||||||
vsnprintf(szMsg, sizeof(szMsg), fmt, args);
|
vsnprintf(szMsg, sizeof(szMsg), fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
_sys_err(func, line, "%s", szMsg);
|
SPDLOG_ERROR("Quest error occurred in [{}:{}}]: {}", func, line, szMsg);
|
||||||
if (test_server)
|
if (test_server)
|
||||||
{
|
{
|
||||||
LPCHARACTER ch = GetCurrentCharacterPtr();
|
LPCHARACTER ch = GetCurrentCharacterPtr();
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <common/service.h>
|
#include <common/service.h>
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -44,7 +44,7 @@ void CAsyncSQL::Destroy()
|
||||||
{
|
{
|
||||||
if (m_hDB.host)
|
if (m_hDB.host)
|
||||||
{
|
{
|
||||||
sys_log(0, "AsyncSQL: closing mysql connection.");
|
SPDLOG_INFO("AsyncSQL: closing mysql connection.");
|
||||||
mysql_close(&m_hDB);
|
mysql_close(&m_hDB);
|
||||||
m_hDB.host = NULL;
|
m_hDB.host = NULL;
|
||||||
}
|
}
|
||||||
|
@ -91,23 +91,23 @@ bool CAsyncSQL::QueryLocaleSet()
|
||||||
{
|
{
|
||||||
if (0 == m_stLocale.length())
|
if (0 == m_stLocale.length())
|
||||||
{
|
{
|
||||||
sys_err("m_stLocale == 0");
|
SPDLOG_TRACE("m_stLocale == 0");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (m_stLocale == "ascii")
|
else if (m_stLocale == "ascii")
|
||||||
{
|
{
|
||||||
sys_err("m_stLocale == ascii");
|
SPDLOG_TRACE("m_stLocale == ascii");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql_set_character_set(&m_hDB, m_stLocale.c_str()))
|
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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ bool CAsyncSQL::Connect()
|
||||||
{
|
{
|
||||||
if (0 == mysql_init(&m_hDB))
|
if (0 == mysql_init(&m_hDB))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "mysql_init failed\n");
|
SPDLOG_CRITICAL("mysql_init failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,22 +128,22 @@ bool CAsyncSQL::Connect()
|
||||||
//mysql_options(&m_hDB, MYSQL_SET_CHARSET_DIR , "/usr/local/share/mysql");
|
//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)
|
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))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reconnect = true;
|
bool reconnect = true;
|
||||||
|
|
||||||
if (0 != mysql_options(&m_hDB, MYSQL_OPT_RECONNECT, &reconnect))
|
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을 수정한다.
|
// db cache는 common db의 LOCALE 테이블에서 locale을 알아오고, 이후 character set을 수정한다.
|
||||||
// 따라서 최초 Connection을 맺을 때에는 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)
|
if (c_pszLocale)
|
||||||
{
|
{
|
||||||
m_stLocale = c_pszLocale;
|
m_stLocale = c_pszLocale;
|
||||||
sys_log(0, "AsyncSQL: locale %s", m_stLocale.c_str());
|
SPDLOG_DEBUG("AsyncSQL: locale {}", m_stLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bNoThread)
|
if (!bNoThread)
|
||||||
|
@ -250,7 +250,7 @@ SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery)
|
||||||
{
|
{
|
||||||
if (m_ulThreadID != mysql_thread_id(&m_hDB))
|
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());
|
while (!QueryLocaleSet());
|
||||||
m_ulThreadID = mysql_thread_id(&m_hDB);
|
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()))
|
if (mysql_real_query(&m_hDB, p->stQuery.c_str(), p->stQuery.length()))
|
||||||
{
|
{
|
||||||
char buf[1024];
|
SPDLOG_ERROR("AsyncSQL::DirectQuery : mysql_query error: {}\nquery: {}", mysql_error(&m_hDB), p->stQuery);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf),
|
|
||||||
"AsyncSQL::DirectQuery : mysql_query error: %s\nquery: %s",
|
|
||||||
mysql_error(&m_hDB), p->stQuery.c_str());
|
|
||||||
|
|
||||||
sys_err(buf);
|
|
||||||
p->uiSQLErrno = mysql_errno(&m_hDB);
|
p->uiSQLErrno = mysql_errno(&m_hDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +548,7 @@ void CAsyncSQL::ChildLoop()
|
||||||
|
|
||||||
if (m_ulThreadID != mysql_thread_id(&m_hDB))
|
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());
|
while (!QueryLocaleSet());
|
||||||
m_ulThreadID = mysql_thread_id(&m_hDB);
|
m_ulThreadID = mysql_thread_id(&m_hDB);
|
||||||
}
|
}
|
||||||
|
@ -563,8 +557,8 @@ void CAsyncSQL::ChildLoop()
|
||||||
{
|
{
|
||||||
p->uiSQLErrno = mysql_errno(&m_hDB);
|
p->uiSQLErrno = mysql_errno(&m_hDB);
|
||||||
|
|
||||||
sys_err("AsyncSQL: query failed: %s (query: %s errno: %d)",
|
SPDLOG_ERROR("AsyncSQL: query failed: {} (query: {} errno: {})",
|
||||||
mysql_error(&m_hDB), p->stQuery.c_str(), p->uiSQLErrno);
|
mysql_error(&m_hDB), p->stQuery, p->uiSQLErrno);
|
||||||
|
|
||||||
switch (p->uiSQLErrno)
|
switch (p->uiSQLErrno)
|
||||||
{
|
{
|
||||||
|
@ -584,7 +578,7 @@ void CAsyncSQL::ChildLoop()
|
||||||
case ER_CANT_CREATE_THREAD:
|
case ER_CANT_CREATE_THREAD:
|
||||||
case ER_INVALID_USE_OF_NULL:
|
case ER_INVALID_USE_OF_NULL:
|
||||||
m_sem.Release();
|
m_sem.Release();
|
||||||
sys_err("AsyncSQL: retrying");
|
SPDLOG_WARN("AsyncSQL: retrying");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,8 +587,8 @@ void CAsyncSQL::ChildLoop()
|
||||||
|
|
||||||
// 0.5초 이상 걸렸으면 로그에 남기기
|
// 0.5초 이상 걸렸으면 로그에 남기기
|
||||||
if (!profiler.IsOk())
|
if (!profiler.IsOk())
|
||||||
sys_log(0, "[QUERY : LONG INTERVAL(OverSec %ld.%ld)] : %s",
|
SPDLOG_TRACE("[QUERY : LONG INTERVAL(OverSec {}.{})] : {}",
|
||||||
profiler.GetResultSec(), profiler.GetResultUSec(), p->stQuery.c_str());
|
profiler.GetResultSec(), profiler.GetResultUSec(), p->stQuery);
|
||||||
|
|
||||||
PopQueryFromCopyQueue();
|
PopQueryFromCopyQueue();
|
||||||
|
|
||||||
|
@ -616,7 +610,7 @@ void CAsyncSQL::ChildLoop()
|
||||||
{
|
{
|
||||||
if (m_ulThreadID != mysql_thread_id(&m_hDB))
|
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());
|
while (!QueryLocaleSet());
|
||||||
m_ulThreadID = mysql_thread_id(&m_hDB);
|
m_ulThreadID = mysql_thread_id(&m_hDB);
|
||||||
}
|
}
|
||||||
|
@ -625,8 +619,8 @@ void CAsyncSQL::ChildLoop()
|
||||||
{
|
{
|
||||||
p->uiSQLErrno = mysql_errno(&m_hDB);
|
p->uiSQLErrno = mysql_errno(&m_hDB);
|
||||||
|
|
||||||
sys_err("AsyncSQL::ChildLoop : mysql_query error: %s:\nquery: %s",
|
SPDLOG_ERROR("AsyncSQL::ChildLoop : mysql_query error: {}:\nquery: {}",
|
||||||
mysql_error(&m_hDB), p->stQuery.c_str());
|
mysql_error(&m_hDB), p->stQuery);
|
||||||
|
|
||||||
switch (p->uiSQLErrno)
|
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);
|
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); // 둘 중에 작은 크기
|
size_t tmpLen = sizeof(tmp) > srcSize ? srcSize : sizeof(tmp); // 둘 중에 작은 크기
|
||||||
strlcpy(tmp, src, tmpLen);
|
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);
|
dstSize, srcSize, tmpLen != srcSize ? "(trimmed to 255 characters)" : "", tmp);
|
||||||
|
|
||||||
dst[0] = '\0';
|
dst[0] = '\0';
|
||||||
|
|
|
@ -34,7 +34,7 @@ void CStmt::Destroy()
|
||||||
|
|
||||||
void CStmt::Error(const char * c_pszMsg)
|
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)
|
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())
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ bool CStmt::BindResult(enum_field_types type, void * p, int iMaxLen)
|
||||||
{
|
{
|
||||||
if (m_uiResultCount >= m_vec_result.size())
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ int CStmt::Execute()
|
||||||
{
|
{
|
||||||
if (m_uiParamCount != m_vec_param.size())
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ int CStmt::Execute()
|
||||||
if (bind->buffer_type == MYSQL_TYPE_STRING)
|
if (bind->buffer_type == MYSQL_TYPE_STRING)
|
||||||
{
|
{
|
||||||
*(m_puiParamLen + i) = strlen((const char *) bind->buffer);
|
*(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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,11 @@ add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES})
|
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)
|
||||||
|
|
|
@ -1,39 +1,12 @@
|
||||||
#ifndef __INC_LIBTHECORE_LOG_H__
|
#pragma once
|
||||||
#define __INC_LIBTHECORE_LOG_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
extern int log_init(void);
|
||||||
extern "C"
|
extern void log_destroy(void);
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
extern int log_init(void);
|
|
||||||
extern void log_destroy(void);
|
|
||||||
extern void log_rotate(void);
|
|
||||||
|
|
||||||
// 로그 레벨 처리 (레벨은 bitvector로 처리된다)
|
// 로그 레벨 처리 (레벨은 bitvector로 처리된다)
|
||||||
extern void log_set_level(unsigned int level);
|
extern void log_set_level(unsigned int level);
|
||||||
extern void log_unset_level(unsigned int level);
|
extern void log_unset_level(unsigned int level);
|
||||||
|
|
||||||
// 로그 파일을 얼만큼 보관하는가에 대한 함수
|
// 로그 파일을 얼만큼 보관하는가에 대한 함수
|
||||||
extern void log_set_expiration_days(unsigned int days);
|
extern void log_set_expiration_days(unsigned int days);
|
||||||
extern int log_get_expiration_days(void);
|
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__
|
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
#include <bsd/string.h>
|
#include <bsd/string.h>
|
||||||
|
|
||||||
|
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ using Random = effolkronium::random_static;
|
||||||
|
|
||||||
#define CREATE(result, type, number) do { \
|
#define CREATE(result, type, number) do { \
|
||||||
if (!((result) = (type *) calloc ((number), sizeof(type)))) { \
|
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)
|
abort(); } } while(0)
|
||||||
|
|
||||||
#define RECREATE(result,type,number) do { \
|
#define RECREATE(result,type,number) do { \
|
||||||
|
|
|
@ -71,7 +71,7 @@ bool safe_create(char** pdata, int number)
|
||||||
{
|
{
|
||||||
if (!((*pdata) = (char *) calloc (number, sizeof(char))))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -111,7 +111,7 @@ LPBUFFER buffer_new(int size)
|
||||||
// 실패하면 최후의 수단으로, 모든 pool을 해제한다.
|
// 실패하면 최후의 수단으로, 모든 pool을 해제한다.
|
||||||
buffer_pool_free();
|
buffer_pool_free();
|
||||||
CREATE(buffer->mem_data, char, size);
|
CREATE(buffer->mem_data, char, size);
|
||||||
sys_err ("buffer pool free success.");
|
SPDLOG_ERROR("buffer pool free success.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(buffer != NULL);
|
assert(buffer != NULL);
|
||||||
|
@ -206,10 +206,10 @@ void buffer_read_proceed(LPBUFFER buffer, int length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (length < 0)
|
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)
|
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;
|
length = buffer->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ void buffer_read_proceed(LPBUFFER buffer, int length)
|
||||||
// write_point 와 pos 는 그대로 두고 read_point 만 증가 시킨다.
|
// write_point 와 pos 는 그대로 두고 read_point 만 증가 시킨다.
|
||||||
if (buffer->read_point + length - buffer->mem_data > buffer->mem_size)
|
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();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ void buffer_adjust_size(LPBUFFER& buffer, int add_size)
|
||||||
if (buffer->mem_size >= buffer->write_point_pos + add_size)
|
if (buffer->mem_size >= buffer->write_point_pos + add_size)
|
||||||
return;
|
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);
|
buffer_realloc(buffer, buffer->mem_size + add_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void buffer_realloc(LPBUFFER& buffer, int length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
temp = buffer_new (length);
|
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);
|
memcpy(temp->mem_data, buffer->mem_data, buffer->mem_size);
|
||||||
|
|
||||||
read_point_pos = buffer->read_point - buffer->mem_data;
|
read_point_pos = buffer->read_point - buffer->mem_data;
|
||||||
|
|
|
@ -15,8 +15,8 @@ LPHEART heart_new(int opt_usec, HEARTFUNC func)
|
||||||
|
|
||||||
if (!func)
|
if (!func)
|
||||||
{
|
{
|
||||||
sys_err("no function defined");
|
SPDLOG_ERROR("no function defined");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(ht, HEART, 1);
|
CREATE(ht, HEART, 1);
|
||||||
|
@ -80,14 +80,14 @@ int heart_idle(LPHEART ht)
|
||||||
|
|
||||||
if (missed_pulse <= 0)
|
if (missed_pulse <= 0)
|
||||||
{
|
{
|
||||||
sys_err("missed_pulse is not positive! (%d)", missed_pulse);
|
SPDLOG_ERROR("missed_pulse is not positive! ({})", missed_pulse);
|
||||||
missed_pulse = 1;
|
missed_pulse = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missed_pulse > (30 * ht->passes_per_sec))
|
if (missed_pulse > (30 * ht->passes_per_sec))
|
||||||
{
|
{
|
||||||
sys_err("losing %d seconds. (lag occured)", missed_pulse / ht->passes_per_sec);
|
SPDLOG_ERROR("losing {} seconds. (lag occured)", missed_pulse / ht->passes_per_sec);
|
||||||
missed_pulse = 30 * ht->passes_per_sec;
|
missed_pulse = 30 * ht->passes_per_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
return missed_pulse;
|
return missed_pulse;
|
||||||
|
|
|
@ -1,57 +1,19 @@
|
||||||
/*
|
|
||||||
* Filename: log.c
|
|
||||||
* Description: local log file 관련
|
|
||||||
*
|
|
||||||
* Author: 비엽 aka. Cronan
|
|
||||||
*/
|
|
||||||
#define __LIBTHECORE__
|
#define __LIBTHECORE__
|
||||||
#include "stdafx.h"
|
#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 SYSLOG_FILENAME "syslog.txt"
|
||||||
#define SYSERR_FILENAME "syserr.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;
|
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)
|
void log_set_level(unsigned int bit)
|
||||||
{
|
{
|
||||||
log_level_bits |= bit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_unset_level(unsigned int bit)
|
void log_unset_level(unsigned int bit)
|
||||||
{
|
{
|
||||||
log_level_bits &= ~bit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_set_expiration_days(unsigned int days)
|
void log_set_expiration_days(unsigned int days)
|
||||||
|
@ -66,404 +28,12 @@ int log_get_expiration_days(void)
|
||||||
|
|
||||||
int log_init(void)
|
int log_init(void)
|
||||||
{
|
{
|
||||||
log_file_set_dir("./log");
|
//spdlog::set_level(spdlog::level::debug);
|
||||||
|
|
||||||
do
|
return 1;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_destroy(void)
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,11 @@ static int pid_init(void)
|
||||||
{
|
{
|
||||||
fprintf(fp, "%d", getpid());
|
fprintf(fp, "%d", getpid());
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
sys_err("\nStart of pid: %d\n", getpid());
|
SPDLOG_INFO("Start of pid: {}", getpid());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("pid_init(): could not open file for writing. (filename: ./pid)");
|
SPDLOG_ERROR("pid_init(): could not open file for writing. (filename: ./pid)");
|
||||||
sys_err("\nError writing pid file\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -42,7 +41,7 @@ static void pid_deinit(void)
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
remove("./pid");
|
remove("./pid");
|
||||||
sys_err("\nEnd of pid\n");
|
SPDLOG_INFO("End of pid");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0)
|
||||||
{
|
{
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
{
|
{
|
||||||
sys_err("select sleep %s", strerror(errno));
|
SPDLOG_ERROR("select sleep {}", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,8 +232,8 @@ void thecore_msleep(DWORD dwMillisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
void core_dump_unix(const char *who, WORD line)
|
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(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
Loading…
Reference in New Issue