Files
2026-06-01 12:46:52 +02:00

305 lines
9.9 KiB
C++

#pragma once
//#include "SUIWnd.h"
#include "SUIDefine.h"
//#include "SUIUtil.h"
const int CHAT_CHANNEL_MAX = 5;
const int CHAT_OPTION_MAX = 19;
extern bool g_GMDEV;
namespace AutoMsg
{
struct AutoMsgInfo
{
int m_nSystemMsg;
int m_nMsgCount;
DWORD m_dwAutoMsgTime;
DWORD m_dwDelayTime;
bool m_bUseMsgCount;
bool m_bEnd;
std::string m_strMsg;
std::string m_strTag1;
AR_HANDLE m_hItem; ///< 소울스톤 오토메시지는 아이템에 따라서 결정되기 때문에 추가하였다.
AutoMsgInfo() : m_nSystemMsg(0),
m_nMsgCount(0),
m_dwAutoMsgTime(0),
m_dwDelayTime(0),
m_bUseMsgCount(false),
m_bEnd(false),
m_hItem(0)
{}
void UseMsgCount() { m_bUseMsgCount = true; }
bool IsEnd() { return m_bEnd; }
void SetEnd( bool bEnd ) { m_bEnd = bEnd; }
};
enum {
CHAT_MIN_LIST = 2,
CHAT_MAX_LIST = 38,
};
// 2010.09.02 - prodongi
std::string makeKey(int msgId, AR_HANDLE itemHandle);
std::string makeKey(AutoMsgInfo const* msgInfo);
}
class SUIDisplayInfo;
class SUIChattingWndSystem;
class KUITabItemControlBase;
class SUIChattingWnd : public SUIWnd
{
// 2010.09.02 - prodongi
public:
typedef std::map<std::string, AutoMsg::AutoMsgInfo*>::iterator it_autoMsgInfo;
public:
enum { MAX_WHISPER_USER_CACHE = 5 };
SUIChattingWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo ), m_bScrollClick(false), m_bScrollLbuttonDown(false), m_OldStaSize(0), m_nSelectUserIndex(-1)
, /*m_nCrrWhisperUser(-1), */m_bShowTab(false), m_bChatAlpha(false), m_nChattingMode(0)//, m_bEmptySoulpwerMsg(false) // 2010.09.02 - prodongi
, m_cacheWhisperUser( MAX_WHISPER_USER_CACHE )
, m_QSPosY(-1)
, m_bChatLog(false)
, m_hChatLog(INVALID_HANDLE_VALUE)
{};
~SUIChattingWnd();
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual SUIWnd* CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
virtual void Process( DWORD dwTime );
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
virtual DWORD OnMouseMessage(DWORD dwMessage, int x, int y);
public:
void UpdateChattingResize();
bool CheckChatTabMarkCutting( std::string& str );
void AddAutoMsgInfo( AutoMsg::AutoMsgInfo* pAutoMsgInfo );
void OutputAutoMsgWithMsgCount( AutoMsg::AutoMsgInfo* pAutoMsgInfo );
void OutputAutoMsg( AutoMsg::AutoMsgInfo* pAutoMsgInfo );
// 2010.09.02 - prodongi
//void DeleteAutoMsg( int nSystemMsg );
void DeleteAutoMsg(int systemMsg, AR_HANDLE itemHandle = 0);
// 2010.09.02 - prodongi
//void DeleteAutoEmptySoulpwerMsg( int nSystemMsg, AR_HANDLE hItem );
void AllKillFocusChild();
void SetFocusEdit( bool bFocus );
bool GetFocusEdit( );
bool GetImeState();
void FillterBR( std::string& rstrText );
void LogChatMsg( const char* fileName );
void SetChatLog( bool bOn );
//bool MoveWnd(); //윈도우 이동을 하는것.. 2009.03.31 sfreer
// operator
private:
//Check IME
bool IsEnglish();
bool IsImeDoingComposition( ) const;
/// 윈도우 ========================================
void CreateStatic ();
void CreateTab ();
/// 시스템 메시지 처리
void SetSysMsg ( int nType );
// 메지시 리스트 ========================================
/// 메시지 전달 받음
void AddChatText ( const char* szText, const char* szSender, int nChatType );
/// 메시지 갱신
void UpdateChatText ( int nRange = 0, bool bScroll = false );
bool IsScrollEnd();
/// 메시지 저장
void AddHistory ( const char* szText, const char* szSender, int nChatType );
/// 메시지 삭제
void DelHistory ( CHAT_LIST& rList );
void DelTempHistory ( CHAT_LIST& rList );
void SplitChat( std::vector< std::string > & vTextList, CHATDATA & chatData );
void OffScrollClick();
void AddChatList( CHAT_LIST& rChatList, CHATDATA* pData );
void AddTempChatList( CHAT_LIST& rChatList, CHATDATA* pData );
/// 서버 요청 ========================================
void RequestChatText();
/// 컬러 ========================================
std::string GetColorSender ( int nType );
std::string GetColorText ( int nType );
KColor GetColor ( int nType );
KColor GetColor ( std::string& rText );
/// 스크롤 바 ========================================
void ResizeScrollbar ();
void RefreshScrollbar ( bool bCrrPos );
void RefreshMaxLine ();
// 탭 ========================================
/// 에디터 창에서 탭 타입에 따라 필터링하여 보여준다(컬러, 기호)
void SetChatType ();
/// 탭 타입으로 채팅 타입 리턴
int GetTypeByTab ();
// 필터링 ========================================
/// 필터링 하여 텍스트만 리턴한다
const char* FilterText ( std::string* str );
/// 기호로 채팅 타입 리턴
int FilterType ( std::string& str );
/// 파티관련 명령어 모두 막는다
bool FilterParty ( std::string& str );
void TagFillter ( std::string& strChat );
void EraseColorTag ( std::string& strChat );
void EraseTag ( std::string& strChat, const char* lpTag );
// 귓속말 ========================================
/// 귓속말 보낸 후 결과 처리
void UpdateWhisperList ( int nResult );
/// 귓속말 보낼때 타겟 아이디 필터링하여 아이디만 리턴
const char* GetTarget ( std::string* str );
bool WhisperFillter( const std::string& strChat, std::string& strPlayer, std::string& strText );
bool RemindWhisper( bool bBackward, bool bForceActivate = false ); // [sonador][7.0.5]자동 귓속말 오류 수정
void AutoWhisper( const char* pDestUser ); // [sonador][7.0.5]자동 귓속말 오류 수정
void AutoPartyInvite( const char* pDestUser ); // 파티초대
bool IsChatBufferEmpty();
/// 채팅 옵션 =====================================
int GetChattingType( int nChatType );
bool IsVisibleType( int nChatType );
bool _IsVisibleType( int nChatType, int nTabType );
/// N4 체팅창 완전히 바꾸면서 들거간 부분
void ToggleShowChatTab();
void EditAlpha( bool bOn );
void UpdateSelectUser( int x, int y );
bool UpdateSelectUserColor(int nIndex);
void CancleSelectUserColor();
void WhisperSenderFillter( std::string& strSender, std::string& strRealSender );
void AddWhisperUser( const char* pName );
// 2010.09.02 - prodongi
bool findAutoMsgInfo(int msgId, AR_HANDLE itemHandle, it_autoMsgInfo& it);
bool findAutoMsgInfo(AutoMsg::AutoMsgInfo* autoMsgInfo, it_autoMsgInfo& it);
/// 2010.11.15 채팅 입력으로 /위치 or //position이 들어왔을 때, position.txt에 아바타의 위치를 저장 - prodongi
#ifdef _DEV
void saveLocalAvatarPos(std::string const& str);
#endif
// attribute
/// 2012.05.02 아레나 지역일 때 서버에 요청하는 채팅 메세지가 유효한지 체크 - prodongi
bool checkIsValidArenaRequest(std::string const& str, int chatType);
/// 2012.05.02 채팅 입력창에 아레나 말머리를 설정한다.
bool setArenaFilterToChatEdit(bool clear = false);
/// 2012. 6. 25 - marine 탭바꿀때 시스템 메세지 출력
void printArenaSystemMsg();
private:
int m_QSPosY;
SUIDisplayInfo* m_pDisplayInfo;
KUIControlStatic* m_pStaticHistories[ AutoMsg::CHAT_MAX_LIST/*텍스트 스태틱 맥스*/ ];
std::string m_vecChatSneder[AutoMsg::CHAT_MAX_LIST/*텍스트 스태틱 맥스*/];
CHAT_LIST m_vecChatList[CHAT_CHANNEL_MAX];
CHAT_LIST m_vecTempChatList[CHAT_CHANNEL_MAX];
std::string m_strFilter;
std::string m_strTarget;
std::vector<std::string> m_vecWhisperList;
int m_nTabType;
int m_nOldTabType;
int m_nCurChatCount;
int m_nMaxLine;
int m_OldStaSize;
bool m_bYell;
DWORD m_dwYellTime;
DWORD m_dwTime;
bool m_bNoAlphaProc;
bool m_bColse;
DWORD m_dwAlphaTime;
DWORD m_dwIMEAlphaTime;
bool m_bScrollClick;
bool m_bScrollLbuttonDown;
void FreeList();
void ClearChatListBuffer( CHAT_LIST& chat_list );
// 2010.09.02 검색때문에 map으로 수정 - prodongi
//std::vector< AutoMsg::AutoMsgInfo* > m_vAutoMsgInfo;
std::map<std::string, AutoMsg::AutoMsgInfo*> m_autoMsgInfo;
float m_fWeightRatio;
unsigned short m_nTime;
char m_nTimeCount;
std::string m_strPreText;
//std::vector<std::string> m_vecPreWhisper;
//int m_nCrrWhisperUser;
sui::spin_cache< std::string > m_cacheWhisperUser; ///< [sonador][7.0.2]귓속말 스택 기능 오류 수정
bool m_bShowTab;
int m_nSelectUserIndex;
bool m_bChatAlpha;
int m_nChattingMode;
// 2010.09.02 내구도 떨어진 아이템이 여러개 일 수 있는데 m_bEmptySoulpwerMsg 하나로 체크하기 때문에 버그가 발생되는거 같음 - prodongi
//bool m_bEmptySoulpwerMsg;
bool m_bChatLog;
HANDLE m_hChatLog;
#ifdef _DEV
// 이전 채팅명령 저장. bintitle. 2011.11.08.
KUIControlEdit* m_pEditBox;
std::string m_strPreChatSave;
#endif
};
class SUIChattingOptionWnd : public SUIWnd
{
public:
SUIChattingOptionWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd(pGameManager)
, m_pDisplayInfo( pDisplayInfo )
, m_nCurKind( -1 )
, m_bIsOpen( false )
{
for( int j = 0; j < CHAT_OPTION_MAX; j++ )
m_bChatOption[j] = false;
};
virtual bool InitControls( KPoint kPos );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
private:
SUIDisplayInfo* m_pDisplayInfo;
bool m_bIsOpen;
bool m_bChatOption[CHAT_OPTION_MAX];
int m_nCurKind;
std::string m_strTabName;
std::string m_strTabMark;
void SetCheck( LPCSTR lpszControlID, bool bFlag );
bool IsCheck( LPCSTR lpszControlID );
void SetCheckEnable( LPCSTR lpszControlID, bool bFlag );
void UpdateChatOption();
std::string GetChatKindName();
};