Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
146
Server/ManageTool/MonitoringTool/MonitoringToolLog.cpp
Normal file
146
Server/ManageTool/MonitoringTool/MonitoringToolLog.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
#include "stdafx.h"
|
||||
#include "MonitoringTool.h"
|
||||
#include "MonitoringToolLog.h"
|
||||
#include "MonitoringToolSetup.h"
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
#include <UserManage/UserStatistics.h>
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
CServerLog g_ChattingLog("ChatLog", 0);
|
||||
CServerLog g_UserStatLog("UserStatLog", 0);
|
||||
|
||||
CMonitoringToolLog::CMonitoringToolLog()
|
||||
{
|
||||
}
|
||||
|
||||
CMonitoringToolLog::~CMonitoringToolLog()
|
||||
{
|
||||
}
|
||||
|
||||
/// \brief ä<><C3A4> <20><>Ŷ<EFBFBD><C5B6> <20>Ľ<EFBFBD><C4BD>Ͽ<EFBFBD> <20>α<CEB1> <20><><EFBFBD><EFBFBD>
|
||||
/// \param lpChatData ä<><C3A4> <20><>Ŷ
|
||||
bool CMonitoringToolLog::WriteChatLog(ChatToolPkt::ChatDataSend* lpChatData)
|
||||
{
|
||||
SYSTEMTIME sysTime;
|
||||
GetLocalTime(&sysTime);
|
||||
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = lpChatData->m_dwServerID;
|
||||
|
||||
char strRecvMsg[UCHAR_MAX * 2];
|
||||
memcpy(strRecvMsg, reinterpret_cast<char*>(lpChatData + 1), lpChatData->m_cChatMsgLen);
|
||||
strRecvMsg[lpChatData->m_cChatMsgLen] = 0;
|
||||
|
||||
if(lpChatData->m_cChatType == PktChat::DICE)
|
||||
{
|
||||
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d]"
|
||||
"[ServerID:0x%08x][Group:%-15s][Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][<5B>ֻ<EFBFBD><D6BB><EFBFBD>:%s]\r\n",
|
||||
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
|
||||
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
|
||||
lpChatData->m_dwServerID, theApp.GetServerName((unsigned int)serverID.GetGroup()), serverID.GetZone(), serverID.GetChannel(),
|
||||
lpChatData->m_usXPos, lpChatData->m_usZPos, lpChatData->m_dwUID, lpChatData->m_dwCID, lpChatData->m_cChatType + 1,
|
||||
lpChatData->m_szSenderName, lpChatData->m_szTargetName, strRecvMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d]"
|
||||
"[ServerID:0x%08x][Group:%-15s][Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][%s]\r\n",
|
||||
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
|
||||
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
|
||||
lpChatData->m_dwServerID, theApp.GetServerName((unsigned int)serverID.GetGroup()), serverID.GetZone(), serverID.GetChannel(),
|
||||
lpChatData->m_usXPos, lpChatData->m_usZPos, lpChatData->m_dwUID, lpChatData->m_dwCID, lpChatData->m_cChatType + 1,
|
||||
lpChatData->m_szSenderName, lpChatData->m_szTargetName, strRecvMsg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMonitoringToolLog::WriteAdminLog(unsigned char cChatType, unsigned char* szGMName, unsigned char* szUserName, unsigned char* strRecvMsg)
|
||||
{
|
||||
SYSTEMTIME sysTime;
|
||||
GetLocalTime(&sysTime);
|
||||
|
||||
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d]"
|
||||
"[ServerID:0x%08x][Group:%-15s][Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][%s]\r\n",
|
||||
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
|
||||
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
|
||||
0, "Tool", 0, 0, 0, 0, 0, 0, cChatType,
|
||||
szGMName, szUserName, strRecvMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// \brief <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<CEB1> <20><><EFBFBD><EFBFBD>
|
||||
/// \note <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><DEB9><EFBFBD>
|
||||
bool CMonitoringToolLog::WriteUserStatLog()
|
||||
{
|
||||
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
|
||||
|
||||
const unsigned int nMaxZone = Setup.GetInt(_T("ZONE_INFO"), _T("ZONE_NUM"), 0);
|
||||
const unsigned int nMaxGroup = Setup.GetInt(_T("SERVER_GROUP_INFO"), _T("SERVER_GROUP_NUM"), 0);
|
||||
const unsigned int nMaxChannel = Setup.GetInt(_T("CHANNEL_INFO"), _T("CHANNEL_NUM"), 0);
|
||||
|
||||
SYSTEMTIME sysTime;
|
||||
GetLocalTime(&sysTime);
|
||||
char szKey[MAX_PATH];
|
||||
|
||||
CString strLog;
|
||||
for (unsigned int nIndex = 0; nIndex < nMaxGroup; ++nIndex)
|
||||
{
|
||||
strLog.AppendFormat(_T("%04d-%02d-%02d %02d:%02d:%02d"),
|
||||
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
|
||||
sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
|
||||
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = 0;
|
||||
serverID.sID.Type = CServerSetup::GameServer;
|
||||
|
||||
_snprintf(szKey, MAX_PATH, _T("SERVER_GROUP_INDEX_%02d"), nIndex);
|
||||
serverID.sID.Group = Setup.GetInt(_T("SERVER_GROUP_INFO"), szKey, 100);
|
||||
|
||||
strLog.AppendFormat(_T("\t%02d"), serverID.GetGroup());
|
||||
|
||||
for (unsigned int nIdx = 0; nIdx < nMaxZone; ++nIdx)
|
||||
{
|
||||
for (unsigned int nCH = 0; nCH < nMaxChannel; ++nCH)
|
||||
{
|
||||
_snprintf(szKey, MAX_PATH, _T("ZONE_INDEX_%02d"), nIdx);
|
||||
serverID.sID.ID = Setup.GetInt(_T("ZONE_INFO"), szKey, 100);
|
||||
serverID.sID.Channel = nCH;
|
||||
|
||||
strLog.AppendFormat(_T("\t%4d"), CUserStatistics::GetInstance().GetUserNum(serverID.dwID));
|
||||
}
|
||||
}
|
||||
strLog.Append(_T("\r\n"));
|
||||
|
||||
g_UserStatLog.Log(strLog);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief <20><><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD><CEB1><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
/// \param strLog <20>÷<EFBFBD><C3B7><EFBFBD>(<28><>: WriteTime GroupIndex Z:01 C: 01 Z02: C:01)
|
||||
/// \note <20>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><DEB6><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD>½<EFBFBD> ó<><C3B3> <20>ѹ<EFBFBD><D1B9><EFBFBD> ȣ<><C8A3><EFBFBD>ȴ<EFBFBD>.
|
||||
bool CMonitoringToolLog::WriteUserStatLog(const CString& strLog)
|
||||
{
|
||||
g_UserStatLog.Log(strLog);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief <20><><EFBFBD>ۿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ä<>÷α<CEB1> <20><><EFBFBD><EFBFBD>
|
||||
void CMonitoringToolLog::FlushChatLog()
|
||||
{
|
||||
g_ChattingLog.Flush();
|
||||
}
|
||||
|
||||
/// \brief <20><><EFBFBD>ۿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD>
|
||||
void CMonitoringToolLog::FlushStatLog()
|
||||
{
|
||||
g_UserStatLog.Flush();
|
||||
}
|
||||
Reference in New Issue
Block a user