Applied changes on the game executable.

This commit is contained in:
2023-12-30 22:15:54 +02:00
parent 2c8cb0c857
commit 2f829ae2dc
144 changed files with 2547 additions and 3147 deletions

View File

@@ -36,7 +36,7 @@ bool DBManager::Connect(const char * host, const int port, const char * user, co
m_bIsConnect = true;
if (!m_sql_direct.Setup(host, user, pwd, db, g_stLocale.c_str(), true, port))
sys_err("cannot open direct sql connection to host %s", host);
SPDLOG_ERROR("cannot open direct sql connection to host {}", host);
if (m_bIsConnect && !g_bAuthServer)
{
@@ -77,7 +77,6 @@ bool DBManager::IsConnected()
void DBManager::ReturnQuery(int iType, DWORD dwIdent, void * pvData, const char * c_pszFormat, ...)
{
//sys_log(0, "ReturnQuery %s", c_pszQuery);
char szQuery[4096];
va_list args;
@@ -163,7 +162,7 @@ void DBManager::DeleteLoginData(CLoginData * pkLD)
if (it == m_map_pkLoginData.end())
return;
sys_log(0, "DeleteLoginData %s %p", pkLD->GetLogin(), pkLD);
SPDLOG_DEBUG("DeleteLoginData {} {}", pkLD->GetLogin(), (void*) pkLD);
mapLDBilling.erase(pkLD->GetLogin());
@@ -177,7 +176,7 @@ void DBManager::SetBilling(DWORD dwKey, bool bOn, bool bSkipPush)
if (it == m_map_pkLoginData.end())
{
sys_err("cannot find login key %u", dwKey);
SPDLOG_ERROR("cannot find login key {}", dwKey);
return;
}
@@ -214,7 +213,7 @@ void DBManager::PushBilling(CLoginData * pkLD)
t.dwLoginKey = pkLD->GetKey();
t.bBillType = pkLD->GetBillType();
sys_log(0, "BILLING: PUSH %s %u type %u", pkLD->GetLogin(), t.dwUseSec, t.bBillType);
SPDLOG_DEBUG("BILLING: PUSH {} {} type {}", pkLD->GetLogin(), t.dwUseSec, t.bBillType);
if (t.bBillType == BILLING_IP_FREE || t.bBillType == BILLING_IP_TIME || t.bBillType == BILLING_IP_DAY)
snprintf(t.szLogin, sizeof(t.szLogin), "%u", pkLD->GetBillID());
@@ -335,7 +334,7 @@ void DBManager::FlushBilling(bool bForce)
else
m_vec_kUseTime.clear();
sys_log(0, "FLUSH_USE_TIME: count %u", dwCount);
SPDLOG_DEBUG("FLUSH_USE_TIME: count {}", dwCount);
}
if (m_vec_kUseTime.size() < 10240)
@@ -374,7 +373,7 @@ void DBManager::FlushBilling(bool bForce)
if (dwSecsConnected >= 60) // 60 second cycle
{
sys_log(0, "BILLING 1 %s remain %d connected secs %u",
SPDLOG_DEBUG("BILLING 1 {} remain {} connected secs {}",
pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected);
PushBilling(pkLD);
}
@@ -385,7 +384,7 @@ void DBManager::FlushBilling(bool bForce)
if (dwSecsConnected > (DWORD) (pkLD->GetRemainSecs() - 600) || dwSecsConnected >= 600)
{
sys_log(0, "BILLING 2 %s remain %d connected secs %u",
SPDLOG_DEBUG("BILLING 2 {} remain {} connected secs {}",
pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected);
PushBilling(pkLD);
}
@@ -402,8 +401,6 @@ void DBManager::CheckBilling()
std::vector<DWORD> vec;
vec.push_back(0); // ī<><C4AB>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>.
//sys_log(0, "CheckBilling: map size %d", m_map_pkLoginData.size());
itertype(m_map_pkLoginData) it = m_map_pkLoginData.begin();
while (it != m_map_pkLoginData.end())
@@ -412,7 +409,7 @@ void DBManager::CheckBilling()
if (pkLD->IsBilling())
{
sys_log(0, "BILLING: CHECK %u", pkLD->GetKey());
SPDLOG_DEBUG("BILLING: CHECK {}", pkLD->GetKey());
vec.push_back(pkLD->GetKey());
}
}
@@ -460,7 +457,7 @@ void DBManager::SendAuthLogin(LPDESC d)
memcpy(&ptod.adwClientKey, pkLD->GetClientKey(), sizeof(DWORD) * 4);
db_clientdesc->DBPacket(HEADER_GD_AUTH_LOGIN, d->GetHandle(), &ptod, sizeof(TPacketGDAuthLogin));
sys_log(0, "SendAuthLogin %s key %u", ptod.szLogin, ptod.dwID);
SPDLOG_DEBUG("SendAuthLogin {} key {}", ptod.szLogin, ptod.dwID);
SendLoginPing(r.login);
}
@@ -499,7 +496,7 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP
d->Packet(&pm, sizeof(TPacketGCMatrixCard));
sys_log(0, "MATRIX_QUERY: %s %c%d %c%d %c%d %c%d %s",
SPDLOG_DEBUG("MATRIX_QUERY: {} {}{} {}{} {}{} {}{} {}",
r.login,
MATRIX_CARD_ROW(rows, 0) + 'A',
MATRIX_CARD_COL(cols, 0) + 1,
@@ -581,7 +578,7 @@ bool GetGameTime(MYSQL_RES * pRes, BYTE & bBillType, int & seconds)
return true;
MYSQL_ROW row = mysql_fetch_row(pRes);
sys_log(1, "GetGameTime %p %p %p", row[0], row[1], row[2]);
SPDLOG_DEBUG("GetGameTime {} {} {}", row[0], row[1], row[2]);
int type = 0;
str_to_number(type, row[0]);
@@ -616,7 +613,7 @@ void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLogi
ptod.bBillType = bBillType;
ptod.dwRemainSeconds = std::max(0, iSecs);
db_clientdesc->DBPacket(HEADER_GD_BILLING_EXPIRE, 0, &ptod, sizeof(TPacketBillingExpire));
sys_log(0, "BILLING: EXPIRE %s type %d sec %d ptr %p", c_pszLogin, bBillType, iSecs, pkLD);
SPDLOG_DEBUG("BILLING: EXPIRE {} type {} sec {} ptr {}", c_pszLogin, bBillType, iSecs, (void*) pkLD);
}
void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
@@ -638,11 +635,11 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
//<2F><>ġ <20><><EFBFBD><EFBFBD> - By SeMinZ
d->SetLogin(pinfo->login);
sys_log(0, "QID_AUTH_LOGIN: START %u %p", qi->dwIdent, get_pointer(d));
SPDLOG_DEBUG("QID_AUTH_LOGIN: START {} {}", qi->dwIdent, (void*) get_pointer(d));
if (pMsg->Get()->uiNumRows == 0)
{
sys_log(0, " NOID");
SPDLOG_DEBUG(" NOID");
LoginFailure(d, "NOID");
M2_DELETE(pinfo);
}
@@ -661,7 +658,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!row[col])
{
sys_err("error column %d", col);
SPDLOG_ERROR("error column {}", col);
M2_DELETE(pinfo);
break;
}
@@ -670,7 +667,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!row[col])
{
sys_err("error column %d", col);
SPDLOG_ERROR("error column {}", col);
M2_DELETE(pinfo);
break;
}
@@ -689,7 +686,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!row[col])
{
sys_err("error column %d", col);
SPDLOG_ERROR("error column {}", col);
M2_DELETE(pinfo);
break;
}
@@ -698,7 +695,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!row[col])
{
sys_err("error column %d", col);
SPDLOG_ERROR("error column {}", col);
M2_DELETE(pinfo);
break;
}
@@ -707,7 +704,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!row[col])
{
sys_err("error column %d", col);
SPDLOG_ERROR("error column {}", col);
M2_DELETE(pinfo);
break;
}
@@ -752,8 +749,8 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
tm1 = localtime(&create_time);
strftime(szCreateDate, 255, "%Y%m%d", tm1);
sys_log(0, "Create_Time %d %s", retValue, szCreateDate);
sys_log(0, "Block Time %d ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8));
SPDLOG_DEBUG("Create_Time {} {}", retValue, szCreateDate);
SPDLOG_DEBUG("Block Time {} ", strncmp(szCreateDate, g_stBlockDate.c_str(), 8));
}
}
@@ -767,25 +764,25 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (nPasswordDiff)
{
LoginFailure(d, "WRONGPWD");
sys_log(0, " WRONGPWD");
SPDLOG_DEBUG(" WRONGPWD");
M2_DELETE(pinfo);
}
else if (bNotAvail)
{
LoginFailure(d, "NOTAVAIL");
sys_log(0, " NOTAVAIL");
SPDLOG_DEBUG(" NOTAVAIL");
M2_DELETE(pinfo);
}
else if (DESC_MANAGER::instance().FindByLoginName(pinfo->login))
{
LoginFailure(d, "ALREADY");
sys_log(0, " ALREADY");
SPDLOG_DEBUG(" ALREADY");
M2_DELETE(pinfo);
}
else if (strcmp(szStatus, "OK"))
{
LoginFailure(d, szStatus);
sys_log(0, " STATUS: %s", szStatus);
SPDLOG_DEBUG(" STATUS: {}", szStatus);
M2_DELETE(pinfo);
}
else
@@ -796,7 +793,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (strncmp(szCreateDate, g_stBlockDate.c_str(), 8) >= 0)
{
LoginFailure(d, "BLKLOGIN");
sys_log(0, " BLKLOGIN");
SPDLOG_DEBUG(" BLKLOGIN");
M2_DELETE(pinfo);
break;
}
@@ -824,7 +821,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
break;
}
sys_log(0, "QID_AUTH_LOGIN: SUCCESS %s", pinfo->login);
SPDLOG_DEBUG("QID_AUTH_LOGIN: SUCCESS {}", pinfo->login);
}
}
}
@@ -835,7 +832,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) qi->pvData;
LPDESC d = DESC_MANAGER::instance().FindByLoginKey(qi->dwIdent);
sys_log(0, "QID_BILLING_GET_TIME: START ident %u d %p", qi->dwIdent, get_pointer(d));
SPDLOG_DEBUG("QID_BILLING_GET_TIME: START ident {} d {}", qi->dwIdent, (void*) get_pointer(d));
if (d)
{
@@ -853,18 +850,18 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!GetGameTime(pMsg->Get()->pSQLResult, bBillType, seconds))
{
sys_log(0, "QID_BILLING_GET_TIME: BLOCK");
SPDLOG_DEBUG("QID_BILLING_GET_TIME: BLOCK");
LoginFailure(d, "BLOCK");
}
else if (bBillType == BILLING_NONE)
{
LoginFailure(d, "NOBILL");
sys_log(0, "QID_BILLING_GET_TIME: NO TIME");
SPDLOG_DEBUG("QID_BILLING_GET_TIME: NO TIME");
}
else
{
LoginPrepare(bBillType, 0, seconds, d, pinfo->adwClientKey);
sys_log(0, "QID_BILLING_GET_TIME: SUCCESS");
SPDLOG_DEBUG("QID_BILLING_GET_TIME: SUCCESS");
}
}
}
@@ -961,7 +958,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (row[0] && row[1])
{
m_map_dbstring.insert(make_pair(std::string(row[0]), std::string(row[1])));
sys_log(0, "DBSTR '%s' '%s'", row[0], row[1]);
SPDLOG_DEBUG("DBSTR '{}' '{}'", row[0], row[1]);
}
}
if (m_map_dbstring.find("GREET") != m_map_dbstring.end())
@@ -986,7 +983,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
{
if (pMsg->Get()->uiAffectedRows == 0 || pMsg->Get()->uiAffectedRows == (uint32_t)-1)
{
sys_log(0, "GIVE LOTTO FAIL TO pid %u", ch->GetPlayerID());
SPDLOG_DEBUG("GIVE LOTTO FAIL TO pid {}", ch->GetPlayerID());
}
else
{
@@ -994,14 +991,14 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (pkItem)
{
sys_log(0, "GIVE LOTTO SUCCESS TO %s (pid %u)", ch->GetName(), qi->dwIdent);
SPDLOG_DEBUG("GIVE LOTTO SUCCESS TO {} (pid {})", ch->GetName(), qi->dwIdent);
//ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %s"), pkItem->GetName());
pkItem->SetSocket(0, pMsg->Get()->uiInsertID);
pkItem->SetSocket(1, pdw[2]);
}
else
sys_log(0, "GIVE LOTTO FAIL2 TO pid %u", ch->GetPlayerID());
SPDLOG_DEBUG("GIVE LOTTO FAIL2 TO pid {}", ch->GetPlayerID());
}
}
@@ -1080,8 +1077,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
const char* c_szName = row[0];
const char* c_szUpdateTime = row[12];
if (test_server)
sys_log(0, "%s:%s", c_szName, c_szUpdateTime);
SPDLOG_TRACE("{}:{}", c_szName, c_szUpdateTime);
if (PCBANG_IP_TABLE_NAME == c_szName)
{
@@ -1091,12 +1087,12 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (s_stLastTime != c_szUpdateTime)
{
s_stLastTime = c_szUpdateTime;
sys_log(0, "'%s' mysql table is UPDATED(%s)", PCBANG_IP_TABLE_NAME.c_str(), c_szUpdateTime);
SPDLOG_DEBUG("'{}' mysql table is UPDATED({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime);
ReturnQuery(QID_PCBANG_IP_LIST_SELECT, 0, NULL, "SELECT pcbang_id, ip FROM %s;", PCBANG_IP_TABLE_NAME.c_str());
}
else
{
sys_log(0, "'%s' mysql table is NOT updated(%s)", PCBANG_IP_TABLE_NAME.c_str(), c_szUpdateTime);
SPDLOG_DEBUG("'{}' mysql table is NOT updated({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime);
}
break;
}
@@ -1104,12 +1100,12 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
if (!isFinded)
{
sys_err(0, "'%s' mysql table CANNOT FIND", PCBANG_IP_TABLE_NAME.c_str());
SPDLOG_ERROR("'{}' mysql table CANNOT FIND", PCBANG_IP_TABLE_NAME);
}
}
else if (test_server)
{
sys_err(0, "'%s' mysql table is NOT EXIST", PCBANG_IP_TABLE_NAME.c_str());
SPDLOG_ERROR("'{}' mysql table is NOT EXIST", PCBANG_IP_TABLE_NAME);
}
}
break;
@@ -1125,10 +1121,8 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
CPCBangManager::instance().InsertIP(row[0], row[1]);
}
}
else if (test_server)
{
sys_log(0, "PCBANG_IP_LIST is EMPTY");
}
else
SPDLOG_TRACE("PCBANG_IP_LIST is EMPTY");
}
break;
@@ -1136,7 +1130,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
// END_OF_PCBANG_IP_LIST
default:
sys_err("FATAL ERROR!!! Unhandled return query id %d", qi->iType);
SPDLOG_ERROR("FATAL ERROR!!! Unhandled return query id {}", qi->iType);
break;
}
@@ -1193,7 +1187,7 @@ void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item)
ITEM_MANAGER::instance().RemoveItem(item);
sys_log(0, "VCARD_TAKE: %u %s -> %s", p.dwID, CardOwner->GetName(), CardTaker->GetName());
SPDLOG_DEBUG("VCARD_TAKE: {} {} -> {}", p.dwID, CardOwner->GetName(), CardTaker->GetName());
}
void DBManager::StopAllBilling()