Files
Client/Server/ManageTool/MonitoringTool/GlobalFunc.cpp
LGram16 dd97ddec92 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>
2025-11-29 20:17:20 +09:00

198 lines
5.5 KiB
C++

#include "stdafx.h"
#include "GlobalFunc.h"
#include "MonitoringTool.h"
#include "MonitoringToolSetup.h"
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
const int MAX_BUFFER = 256;
const char* szSection1 = _T("SERVER_GROUP_INFO");
const char* szSection2 = _T("CHAT_TYPE_INFO");
/// \brief 인자로 받은 리스트 박스에 셋업파일의 서버그룹명을 셋팅
/// \param ctrlListBox 서버그룹명을 셋팅할 리스트 박스
void SetServerListBox(CListBox& ctrlListBox)
{
ctrlListBox.ResetContent();
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
char szKey[MAX_BUFFER];
unsigned int nServerGroup;
CString strFormat;
int nMaxGroup = Setup.GetInt(szSection1, "SERVER_GROUP_NUM");
for(int nIndex = 0; nIndex < nMaxGroup; ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "SERVER_GROUP_INDEX_%02d", nIndex);
nServerGroup = Setup.GetInt(szSection1, szKey);
strFormat.Format("%s", theApp.GetServerName(nServerGroup));
ctrlListBox.AddString(strFormat);
}
}
/// \brief 인자로 받은 콤보 박스에 셋업파일의 서버그룹명을 셋팅
/// \param ctrlCombo 서버그룹명을 셋팅할 콤보 박스
void SetServerGroupCombo(CComboBox& ctrlCombo)
{
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
char szKey[MAX_BUFFER];
unsigned int nServerGroup;
CString strFormat;
int nMaxGroup = Setup.GetInt(szSection1, "SERVER_GROUP_NUM");
for(int nIndex = 0; nIndex < nMaxGroup; ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "SERVER_GROUP_INDEX_%02d", nIndex);
nServerGroup = Setup.GetInt(szSection1, szKey);
strFormat.Format("%s", theApp.GetServerName(nServerGroup));
ctrlCombo.InsertString(nIndex, strFormat);
}
}
/// \brief 인자로 받은 리스트 박스에 셋업파일의 채팅타입을 셋팅
/// \param ctrlListBox 채팅타입을 셋팅할 리스트 박스
void SetChatTypeListBox(CListBox& ctrlListBox)
{
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
int nMaxChatType = Setup.GetInt(szSection2, "CHAT_TYPE_NUM");
char szKey[MAX_BUFFER];
CString strFormat;
for(int nIndex = 0; nIndex < nMaxChatType; ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "CHAT_TYPE_NAME_%02d", nIndex);
strFormat.Format("%s", Setup.GetString(szSection2, szKey));
ctrlListBox.AddString(strFormat);
}
}
/// \brief 인자로 받은 리스트 박스에 채팅서버 연결상태를 표시
/// \param ctrlListBox 연결상태를 표시할 리스트 박스
void SetConnectionListBox(CListBox& ctrlListBox)
{
if(!ctrlListBox.GetSafeHwnd())
return;
ctrlListBox.ResetContent();
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
char szKey[MAX_BUFFER];
for(unsigned int nIndex = 0; nIndex < Setup.GetInt(szSection1, "SERVER_GROUP_NUM"); ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "SERVER_GROUP_INDEX_%02d", nIndex);
if(0 != theApp.GetChatServerHandler(Setup.GetInt(szSection1, szKey)))
{
ctrlListBox.AddString(_T("OK"));
}
else
{
ctrlListBox.AddString(_T("DIS"));
}
}
}
/// \brief 인자로 받은 콤보 박스에 셋업파일의 채팅타입을 셋팅
/// \param ctrlCombo 채팅타입을 셋팅할 콤보 박스
void SetChatTypeCombo(CComboBox& ctrlCombo)
{
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
int nMaxChatType = Setup.GetInt(szSection2, "CHAT_TYPE_NUM");
char szKey[MAX_BUFFER];
CString strFormat;
for(int nIndex = 0; nIndex < nMaxChatType; ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "CHAT_TYPE_NAME_%02d", nIndex);
strFormat.Format("%s", Setup.GetString(szSection2, szKey));
ctrlCombo.InsertString(nIndex, strFormat);
}
}
/// \brief 인자로 받은 콤보 박스에 셋업파일의 메시지를 전송할 채팅타입을 셋팅
/// \param ctrlCombo 채팅타입을 셋팅할 콤보 박스
/// \note SetChatTypeCombo 함수와 구분하여 사용하여야 함
void SetSendChatTypeCombo(CComboBox& ctrlCombo)
{
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
int nMaxGroup = Setup.GetInt(szSection2, "SEND_CHAT_TYPE_NUM");
char szKey[MAX_BUFFER];
CString strFormat;
for(int nIndex = 0; nIndex < nMaxGroup; ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "SEND_CHAT_TYPE_NAME_%02d", nIndex);
strFormat.Format("%s", Setup.GetString(szSection2, szKey));
ctrlCombo.InsertString(nIndex, strFormat);
}
}
/// \brief 인자로 받은 콤보 박스에 GM명을 셋팅
/// \param ctrlCombo GM명을 셋팅할 콤보 박스
/// \note 로그인한 GM명으로 메세지 보내기로 수정한 후 사용하지 않음
void SetGMNameCombo(CComboBox& ctrlCombo)
{
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
const char* szSection = _T("GM_INFO");
int nMaxGM = Setup.GetInt(szSection, "GM_NUM");
char szKey[MAX_BUFFER];
CString strFormat;
for(int nIndex = 0; nIndex < nMaxGM; ++nIndex)
{
_snprintf(szKey, MAX_BUFFER, "GM_NAME_%02d", nIndex);
strFormat.Format("%s", Setup.GetString(szSection, szKey));
ctrlCombo.InsertString(nIndex, strFormat);
}
}
/// \brief 채팅타입명으로 채팅타입 인덱스 얻기
/// \param strTypeName 인덱스를 얻고자 하는 채팅타입명
unsigned int GetChatTypeIndex(CString strTypeName)
{
if(strTypeName == _T("ADMIN_SHOUT")) return PktChat::ADMIN_SHOUT;
if(strTypeName == _T("SHOUT")) return PktChat::SHOUT;
//if(strTypeName == _T("WHISPER")) return PktChat::WHISPER;
return 255; // 존재하지 않는 채팅타입 인덱스
}
/// \brief 섹션명과 키로 ini 셋업 파일에서 셋팅된 값 얻기
/// \param szSection 얻고자하는 값이 속한 섹션명
/// \param szKey 얻고자 하는 값에 매칭되는 키
const char* GetMyINIString(const char* szSection, const char* szKey)
{
const char* szResult = CMonitoringToolSetup::GetInstance().GetString(szSection, szKey, 0);
if(0 == szResult)
{
CString strErr;
strErr.Format("Setup string load failed! - key: %s", szKey);
AfxMessageBox(strErr, MB_ICONSTOP);
return "???";
}
return szResult;
}