Files
Leviathan/Client/Game/game/Interface/SUIExpulsionWnd.cpp
T
2026-06-01 12:46:52 +02:00

382 lines
10 KiB
C++

#include "stdafx.h"
#include "SStringDB.h"
#include <toolkit/XStringUtil.h>
#include "SGameManager.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SMessengerMgr.h"
#include "SChatType.h"
//#include "KUIControl.h"
#include "KUIControlEdit.h"
#include "SUIExpulsionWnd.h"
namespace
{
const int g_LimitText = 20; // Edit 컨트롤 최대 텍스트.
}
SUIExpulsionWnd::SUIExpulsionWnd( SGameManager * pGameManager ) :
SUIWnd( pGameManager ),
m_EditName( NULL ),
m_pClassName( NULL )
{
}
SUIExpulsionWnd::~SUIExpulsionWnd()
{
Release();
}
void SUIExpulsionWnd::Release()
{
}
SUIWnd* SUIExpulsionWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
return this;
}
bool SUIExpulsionWnd::InitControls( KPoint kPos )
{
// 에디트 박스 리밋
KUIControlEdit * pEdit = dynamicCast< KUIControlEdit * >( GetChild( "text_02" ) );
if( pEdit )
{
pEdit->SetLimitation( g_LimitText );
pEdit->SetLineChange( false );
pEdit->SetText("");
pEdit->SetCaption("");
pEdit->SetFontSize( 9 );
pEdit->UseEmoticonFilter( false );
pEdit->SetFont( "font_02" );
}
m_EditName = pEdit;
// 길드 등급명 컨트롤.
m_pClassName = dynamicCast< KUIControl * >( GetChild( "text_01" ) );
// 등급명의 텍스트 데코레이션 뽑아내기.
string strOrg( m_pClassName->GetCaption() );
std::string::size_type sizeEnd = strOrg.find_last_of( ">" );
m_strDecoClassName = strOrg.substr( 0, ++sizeEnd );
//m_strDecoClassName;
return SUIWnd::InitControls( kPos );
}
void SUIExpulsionWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
{
if( bOpen )
{
/*if( m_EditName )
m_EditName->SetText( " " );
if( m_pClassName )
m_pClassName->SetCaption( " " );*/
this->SetShow( true );
// 기존 포커스 제거.
this->m_pManager->RemoveWnd( this );
// wnd 출력 리스트의 최하단에 추가. ( wnd 들중 가장 상위에 뜨게 된다. )
this->m_pManager->AddWnd( this );
// 가장위에 뜨도록 한다.
this->m_pManager->SetFocus( this );
// Edit.
//m_EditName->SetFocus( true );
//static_cast< KUIControlEdit * >( GetChild( "text_02" ) )->SetFocus( true );
}
else
{
m_EditName->SetFocus( false );
/*if( m_EditName )
m_EditName->SetText( " " );
if( m_pClassName )
m_pClassName->SetCaption( " " );*/
}
}
void SUIExpulsionWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
pMsg->bUse = true;
}
break;
case IMSG_SHOW_UIWINDOW:
pMsg->bUse = true;
break;
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA * pData = dynamicCast< SIMSG_UI_SEND_DATA * >( pMsg );
if( pData->m_strString == "ERROR_PERMISSION" )
{
// string strMsg( S( 610 ) );
string strMsg( S(1907) ); // stringDB string db 필요.
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_YES, strMsg.c_str() ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_YES, strMsg.c_str() ) );
pMsg->bUse = true;
}
}
break;
// 길드원 제명 결정.
case IMSG_UI_GUILD_EXPULSION :
{
const char * pStrMember = m_EditName->GetText(); // 제명할 길드원.
bool bIsMaster = false;
SPlayerSlot * pPlayer = m_GuildMgr.GetPlayerByName( pStrMember );
if( pPlayer )
{
if( _PERMISSION::PERMISSION_LEADER == pPlayer->GetAuthority() )
bIsMaster = true;
}
// 길드마스터.
if( bIsMaster )
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_YES, S( 622 ) ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_YES, S( 622 ) ) );
}
// 길드원.
else
{
// 길드원 제명 메세지 전송.
// 길드탈퇴 메세지 전송.
SMSG_CHATTING_REQUEST msg;
msg.type = CHAT_TYPE::CHAT_NORMAL;
msg.strText = "/gkick ";
msg.strText.append( pStrMember );
m_pGameManager->ProcMsgAtStatic( &msg );
//// 추방메세지 출력.
//string strMsg( S( 610 ) );
//CStringUtil::ReplacePhrase( strMsg, "#@user_name@#", pStrMember );
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_YES, strMsg.c_str() ) );
// 에디트창 클리어.
m_EditName->SetText( "" );
}
pMsg->bUse = true;
}
break;
// 길드맴버 팝업메뉴( 길드원제명 ) -> 길드원관리패널( 길드원제명 팝업 오픈 )
case IMSG_UI_GUILD_EXPULSION_SETUP :
{
SIMSG_UI_GUILD_WNDMSG * pMsgData = dynamicCast< SIMSG_UI_GUILD_WNDMSG * >( pMsg );
// 데코 제외 순수 텍스트만 뽑아내기.
std::string strOrg( pMsgData->strData );
std::string::size_type size = strOrg.find_last_of( ">" );
strOrg = strOrg.substr( ++size );
if( strOrg.size() > 0 && strOrg != "" )
{
// 캐릭터명 설정.
m_EditName->SetText( ( strOrg ).c_str() );
// 등급명.
if( pMsgData->strData_2 == "" )
{
// 길드원 이름으로 길드원의 등급명 얻기.
SPlayerSlot * pPlayer = m_GuildMgr.GetPlayerByName( strOrg.c_str() );
if( pPlayer )
{
int nClass = pPlayer->GetAuthority();
if( nClass == 7 ) // 길드장.
strOrg = S(3508);
else
strOrg = m_GuildMgr.GetAuthorityClassName( nClass - 1 );
}
}
else
strOrg = pMsgData->strData_2;
///strOrg = pMsgData->strData_2 == "" ? " " : pMsgData->strData_2;
size = strOrg.find_last_of( ">" );
if( size != std::string::npos )
strOrg = strOrg.substr( ++size );
// 등급명.
//pMsgData->strData_2 = pMsgData->strData_2 == "" ? " " : pMsgData->strData_2;
m_pClassName->SetCaption( ( m_strDecoClassName + strOrg ).c_str() );
m_pClassName->CutCaptionNTooltip();
}
pMsg->bUse = true;
}
break;
}
}
void SUIExpulsionWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
//// Edit.
//case KUI_MESSAGE::KEDIT_CHANGE :
// // 해당 아이디의 등급 출력.
// //PrintClassName();
// break;
case KUI_MESSAGE::KBUTTON_CLICK :
// close.
if( !::_stricmp( lpszControlID, "button_close" ) || !::_stricmp( lpszControlID, "button_cancel" )) //servantes 2010.10.13
{
if( m_EditName )
m_EditName->SetText( "" );
if( m_pClassName )
m_pClassName->SetCaption( " " );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_EXPULSION, false ) );
}
// 확인.
else if( !::_stricmp( lpszControlID, "button_ok" ) )
{
ConfirmationButton();
}
break;
// 윈도우 이동
case KUI_MESSAGE::KGENWND_MOVE:
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
DWORD SUIExpulsionWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
{
switch( dwMessage )
{
case KLBUTTON_DOWN :
//// Edit.
//if( m_EditName->GetRect().IsInRect( x, y ) )
// m_EditName->SetFocus( true );
// Edit.
if( m_EditName && !m_EditName->GetRect().IsInRect( x, y ) )
{
m_EditName->SetFocus( false );
}
break;
}
return SUIWnd::OnMouseMessage(dwMessage, x, y);
}
// 확인버튼.
void SUIExpulsionWnd::ConfirmationButton()
{
LPCSTR strName = m_EditName->GetText();
if( strName == NULL || !::_stricmp( strName, " " ) || !::_stricmp( strName, "" ) )
{
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 622 ) ) );
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1931) ) ); // stringDB 필요.
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1931) ) ); // stringDB 필요.
return;
}
SPlayerSlot * pPlayer = m_GuildMgr.FindMember( strName );
// 길드원.
if( pPlayer )
{
// 길드장의 경우 탈퇴 불가.
if( pPlayer->GetAuthority() == _PERMISSION::PERMISSION_LEADER )
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 622 ) ) ); // 텍스트 확인용
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 622 ) ) ); // 텍스트 확인용
return;
}
string strMsg( S( 608 ) );
CStringUtil::ReplacePhrase( strMsg, "#@user_name@#", strName );
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_EXPULSION, strMsg.c_str(), true ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_EXPULSION, strMsg.c_str(), true ) );
}
// 비길드원 or 비존재캐릭터.
else
{
//std::string strMsg( m_EditName->GetText() );
//strMsg.append( " 은(는) 비길드원 이다." ); // string DB 값 필요.
std::string strMsg( S( 1905 ) );
CStringUtil::ReplacePhrase( strMsg, "#@user_name@#", m_EditName->GetText() );
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, strMsg.c_str() ) ); // 텍스트 확인용
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, strMsg.c_str() ) ); // 텍스트 확인용
}
}
// 해당 아이디의 등급 출력.
void SUIExpulsionWnd::PrintClassName()
{
LPCSTR text = m_EditName->GetText();
SPlayerSlot * pPlayer = m_GuildMgr.FindMember( text );
// 길드원.
if( pPlayer )
{
m_pClassName->SetCaption( text );
}
}