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>
273 lines
7.5 KiB
C++
273 lines
7.5 KiB
C++
// WhisperDlg.cpp : 구현 파일입니다.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "MonitoringTool.h"
|
|
#include "WhisperDlg.h"
|
|
#include "ChattingPage.h"
|
|
#include "GlobalFunc.h"
|
|
#include "MonitoringToolSetup.h"
|
|
#include "ChatServerEventHandler.h"
|
|
|
|
#include <Log/ServerLog.h>
|
|
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
|
|
|
|
|
|
// CWhisperDlg 대화 상자입니다.
|
|
|
|
IMPLEMENT_DYNAMIC(CWhisperDlg, CDialog)
|
|
CWhisperDlg::CWhisperDlg(CWnd* pParent, WhisperDlgInfo stInfo)
|
|
: CDialog(CWhisperDlg::IDD, pParent)
|
|
, m_strWhisperTitle(_T(""))
|
|
{
|
|
m_pParent = pParent;
|
|
CopyMemory(&m_stWhisperDlgInfo, &stInfo, sizeof(WhisperDlgInfo));
|
|
|
|
IsWhisperDlgSet = true;
|
|
}
|
|
|
|
CWhisperDlg::CWhisperDlg() : CDialog(CWhisperDlg::IDD)
|
|
{
|
|
IsWhisperDlgSet = false;
|
|
}
|
|
|
|
CWhisperDlg::~CWhisperDlg()
|
|
{
|
|
}
|
|
|
|
void CWhisperDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_WHISPER_OUTPUT, m_ctrlWhisperOutput);
|
|
DDX_Text(pDX, IDC_WHISPER_TITLE, m_strWhisperTitle);
|
|
DDX_Control(pDX, IDC_SENDBYUID_CHK, m_ctrlSendByUIDChk);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CWhisperDlg, CDialog)
|
|
ON_WM_CLOSE()
|
|
ON_BN_CLICKED(IDC_WHISPER_SEND, OnBnClickedWhisperSend)
|
|
END_MESSAGE_MAP()
|
|
|
|
// CWhisperDlg 메시지 처리기입니다.
|
|
|
|
BOOL CWhisperDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
SetDlgItemText(IDC_WHISPER_TITLE_STATIC, GetMyINIString("LOCAL_STRING", "STRING_021"));
|
|
SetDlgItemText(IDC_WHISPER_TRGT_TYPE, GetMyINIString("LOCAL_STRING", "STRING_022"));
|
|
SetDlgItemText(IDC_WHISPER_LOGINEDNAME_STATIC, GetMyINIString("LOCAL_STRING", "STRING_047"));
|
|
SetDlgItemText(IDC_WHISPER_SEND, GetMyINIString("LOCAL_STRING", "STRING_017"));
|
|
SetDlgItemText(IDC_PACKET_TIME, "");
|
|
|
|
bool IsEnable = false;
|
|
|
|
char strRace[4][4] = {"N/A", "H", "A", "N/A"};
|
|
|
|
if (WhisperDlgInfo::WHISPER_TYPE_CLK == m_stWhisperDlgInfo.m_nDlgType)
|
|
{
|
|
m_strWhisperTitle.Format("[%s] (UID: %u / CID: %u / Race : %s) %s",
|
|
m_stWhisperDlgInfo.m_szServerName, m_stWhisperDlgInfo.m_dwUID, m_stWhisperDlgInfo.m_dwCID, strRace[m_stWhisperDlgInfo.m_cRace],
|
|
m_stWhisperDlgInfo.m_szCharName);
|
|
|
|
SetWindowText(m_stWhisperDlgInfo.m_szCharName);
|
|
|
|
IsEnable = false;
|
|
}
|
|
else if (WhisperDlgInfo::FINDUSER == m_stWhisperDlgInfo.m_nDlgType)
|
|
{
|
|
SetDlgItemText(IDC_WHISPER_TITLE, GetMyINIString("LOCAL_STRING", "STRING_023"));
|
|
SetWindowText(GetMyINIString("LOCAL_STRING", "STRING_023"));
|
|
|
|
IsEnable = true;
|
|
}
|
|
|
|
SetDlgItemText(IDC_WHIS_SENDER_EDIT, theApp.GetLoginedName());
|
|
|
|
GetDlgItem(IDC_WHISPER_TARGET)->EnableWindow(IsEnable);
|
|
GetDlgItem(IDC_SENDBYUID_CHK)->EnableWindow(IsEnable);
|
|
|
|
UpdateData(false);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CWhisperDlg::OnBnClickedWhisperSend()
|
|
{
|
|
CString strServerName, strGMName, strMsg;
|
|
strServerName.Format("%s", m_stWhisperDlgInfo.m_szServerName); // 서버 그룹 명
|
|
strGMName = theApp.GetLoginedName(); // GM명
|
|
GetDlgItemText(IDC_WHISPER_INPUT, strMsg); // 메세지
|
|
|
|
bool IsSended = false;
|
|
|
|
if (BST_UNCHECKED == ((CChattingPage*)m_pParent)->IsDlgButtonChecked(IDC_GMLOGINED_CHK))
|
|
{
|
|
MessageBox(GetMyINIString("LOCAL_STRING", "STRING_046"));
|
|
IsSended = false;
|
|
}
|
|
else
|
|
{
|
|
// 일반 대화 모드 (리스트박스 더블 클릭)
|
|
if ((true == IsWhisperDlgSet) && (WhisperDlgInfo::WHISPER_TYPE_CLK == m_stWhisperDlgInfo.m_nDlgType))
|
|
{
|
|
IsSended = ClientNet::CChatServerEventHandler::SendChatReqPkt(
|
|
theApp.GetServerIndex(strServerName), PktChat::WHISPER,
|
|
ChatToolPkt::TARGET_CHARNAME, 0, 0, strGMName, m_stWhisperDlgInfo.m_szCharName, strMsg);
|
|
}
|
|
// 계정명으로 대화 모드 (직접 계정정보 입력)
|
|
else
|
|
{
|
|
CString strTarget;
|
|
GetDlgItemText(IDC_WHISPER_TARGET, strTarget);
|
|
|
|
char szKey[256];
|
|
CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance();
|
|
unsigned int nMaxGroupNum = Setup.GetInt(_T("SERVER_GROUP_INFO"), _T("SERVER_GROUP_NUM"));
|
|
|
|
for(int nIndex = 0; nIndex < (int)nMaxGroupNum; ++nIndex)
|
|
{
|
|
unsigned long dwDlgID = ((CChattingPage*)m_pParent)->GetAccountDlgID();
|
|
|
|
_snprintf(szKey, 256, "SERVER_GROUP_INDEX_%02d", nIndex);
|
|
unsigned int nServerGroup = Setup.GetInt("SERVER_GROUP_INFO", szKey);
|
|
|
|
if (BST_CHECKED != m_ctrlSendByUIDChk.GetCheck())
|
|
{
|
|
IsSended = ClientNet::CChatServerEventHandler::SendChatReqPkt(
|
|
nServerGroup, PktChat::WHISPER,
|
|
ChatToolPkt::TARGET_ACCOUNTNAME, 0, dwDlgID, strGMName, strTarget, strMsg);
|
|
|
|
// 로그를 모니터링 툴에 남기기 위해서 만든다.
|
|
//CMonitoringToolLog::GetInstance().WriteAdminLog(nServerGroup, PktChat::WHISPER, strGMName, strTarget, strMsg);
|
|
}
|
|
else
|
|
{
|
|
IsSended = ClientNet::CChatServerEventHandler::SendChatReqPkt(
|
|
nServerGroup, PktChat::WHISPER,
|
|
ChatToolPkt::TARGET_UID, (unsigned long)atoi(strTarget), dwDlgID, strGMName, _T(""), strMsg);
|
|
|
|
// 로그를 모니터링 툴에 남기기 위해서 만든다.
|
|
//CMonitoringToolLog::GetInstance().WriteAdminLog(nServerGroup, PktChat::WHISPER, strGMName, strTarget, strMsg);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if (true == IsSended)
|
|
{
|
|
SetDlgItemText(IDC_WHISPER_INPUT, _T(""));
|
|
GetDlgItem(IDC_WHISPER_TARGET)->EnableWindow(false);
|
|
GetDlgItem(IDC_SENDBYUID_CHK)->EnableWindow(false);
|
|
}
|
|
else
|
|
{
|
|
theApp.ReportResult(GetMyINIString("LOCAL_STRING", "STRING_026"));
|
|
}
|
|
}
|
|
|
|
BOOL CWhisperDlg::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
|
|
{
|
|
if ((pMsg->hwnd == GetDlgItem(IDC_WHISPER_INPUT)->m_hWnd))
|
|
{
|
|
OnBnClickedWhisperSend();
|
|
}
|
|
}
|
|
|
|
return CDialog::PreTranslateMessage(pMsg);
|
|
}
|
|
|
|
void CWhisperDlg::OnOK()
|
|
{
|
|
}
|
|
|
|
void CWhisperDlg::OnClose()
|
|
{
|
|
DestroyWindow();
|
|
}
|
|
|
|
void CWhisperDlg::OnCancel()
|
|
{
|
|
DestroyWindow();
|
|
}
|
|
|
|
void CWhisperDlg::PostNcDestroy()
|
|
{
|
|
if(m_stWhisperDlgInfo.m_nDlgType == WhisperDlgInfo::WHISPER_TYPE_CLK)
|
|
{
|
|
CChattingPage::WhisperDlgMap::iterator pos1 =
|
|
((CChattingPage*)m_pParent)->m_WhisperDlgMap.find(m_stWhisperDlgInfo.m_dwUID);
|
|
|
|
if (pos1 != ((CChattingPage*)m_pParent)->m_WhisperDlgMap.end())
|
|
{
|
|
((CChattingPage*)m_pParent)->m_WhisperDlgMap.erase(pos1);
|
|
}
|
|
}
|
|
|
|
CChattingPage::WhisperDlgMap::iterator pos2 =
|
|
((CChattingPage*)m_pParent)->m_AccountDlgMap.find(m_stWhisperDlgInfo.m_dwDlgID);
|
|
|
|
if (pos2 != ((CChattingPage*)m_pParent)->m_AccountDlgMap.end())
|
|
{
|
|
((CChattingPage*)m_pParent)->m_AccountDlgMap.erase(pos2);
|
|
}
|
|
|
|
delete this;
|
|
}
|
|
|
|
/// \brief 채팅패킷을 파싱하여 대화창에 표시
|
|
/// \param lpChatData 채팅 패킷
|
|
void CWhisperDlg::ParseChatData(ChatToolPkt::ChatDataSend* lpChatData)
|
|
{
|
|
char strRecvMsg[UCHAR_MAX * 2];
|
|
CString strOutput;
|
|
|
|
char szTime[32];
|
|
char szDate[32];
|
|
|
|
_tzset();
|
|
_tstrdate( szDate );
|
|
_tstrtime( szTime );
|
|
|
|
memcpy(strRecvMsg, reinterpret_cast<char*>(lpChatData + 1), lpChatData->m_cChatMsgLen);
|
|
strRecvMsg[lpChatData->m_cChatMsgLen] = 0;
|
|
|
|
strOutput.Format("[%s-%s] %s : %s", szDate, szTime, lpChatData->m_szSenderName, strRecvMsg);
|
|
|
|
int nIndex = m_ctrlWhisperOutput.AddString(strOutput);
|
|
|
|
// 자동 스크롤
|
|
int nMaxLine = 27; // 1대1 대화창 리스트박스 최대 라인수
|
|
if (nIndex >= nMaxLine)
|
|
{
|
|
m_ctrlWhisperOutput.SetTopIndex(nIndex);
|
|
}
|
|
|
|
strOutput.Format("Time : %s-%s", szDate, szTime);
|
|
SetDlgItemText(IDC_PACKET_TIME, strOutput);
|
|
}
|
|
|
|
void CWhisperDlg::SetKeyUID(unsigned long dwUID, unsigned long dwCID)
|
|
{
|
|
m_stWhisperDlgInfo.m_dwUID = dwUID;
|
|
m_stWhisperDlgInfo.m_dwCID = dwCID;
|
|
|
|
if (NULL == ((CChattingPage*)m_pParent)->GetWhisperDlg(dwUID))
|
|
{
|
|
((CChattingPage*)m_pParent)->m_WhisperDlgMap.insert(CChattingPage::WhisperDlgMap::value_type(dwUID, this));
|
|
|
|
CChattingPage::WhisperDlgMap::iterator pos =
|
|
((CChattingPage*)m_pParent)->m_AccountDlgMap.find(m_stWhisperDlgInfo.m_dwDlgID);
|
|
|
|
((CChattingPage*)m_pParent)->m_AccountDlgMap.erase(pos);
|
|
|
|
CString strTitle;
|
|
strTitle.Format("%u", dwUID);
|
|
|
|
SetWindowText(strTitle);
|
|
}
|
|
} |