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

322 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 "SPlayerInfoMgr.h"
//#include "KUIControl.h"
#include "KUIControlEdit.h"
#include "SUIMasterTransfer.h"
namespace
{
const int g_LimitText = 20; // Edit 컨트롤 최대 텍스트.
}
SUIMasterTransfer::SUIMasterTransfer( SGameManager * pGameManager ) :
SUIWnd( pGameManager ),
m_EditName( NULL )
{
}
SUIMasterTransfer::~SUIMasterTransfer()
{
Release();
}
void SUIMasterTransfer::Release()
{
}
SUIWnd* SUIMasterTransfer::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
return this;
}
bool SUIMasterTransfer::InitControls( KPoint kPos )
{
// 에디트 박스 리밋
KUIControlEdit * pEdit = dynamicCast< KUIControlEdit * >( GetChild( "text_02" ) );
if( pEdit )
{
pEdit->SetLimitation( g_LimitText );
pEdit->SetLineChange( false );
pEdit->SetText("");
pEdit->SetFontSize( 9 );
pEdit->SetCaption("");
pEdit->UseEmoticonFilter( false );
}
m_EditName = pEdit;
m_pClassNameCtrl = GetChild( "text_01" ); // 등급명 컨트롤.
CStringUtil::GetTextDecoration( m_pClassNameCtrl->GetCaption(), m_StrClassNameDecorate );
return SUIWnd::InitControls( kPos );
}
void SUIMasterTransfer::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
{
if( bOpen )
{
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 );
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
// 길드마스터 모드 설정.
//m_pGameManager->ProcMsgAtStatic( new SIMSG_UI_GUILD_WNDMSG( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAINWND,
// SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAIN_TAP_MEMBER,
// IMSG_UI_GUILD_MASTER_MODE, true ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_GUILD_WNDMSG( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAINWND,
SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAIN_TAP_MEMBER,
IMSG_UI_GUILD_MASTER_MODE, true ) );
}
else
{
m_EditName->SetFocus( false );
if( m_EditName )
m_EditName->SetText( "" );
if( m_pClassNameCtrl )
m_pClassNameCtrl->SetCaption( " " );
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
// 길드마스터 모드 해제.
//m_pGameManager->ProcMsgAtStatic( new SIMSG_UI_GUILD_WNDMSG( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAINWND,
// SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAIN_TAP_MEMBER,
// IMSG_UI_GUILD_MASTER_MODE, false ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_GUILD_WNDMSG( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAINWND,
SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_MAIN_TAP_MEMBER,
IMSG_UI_GUILD_MASTER_MODE, false ) );
}
}
void SUIMasterTransfer::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = dynamicCast< SIMSG_UI_MOVE * >( pMsg );
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
pMsg->bUse = true;
}
break;
case IMSG_UI_SEND_DATA :
{
SIMSG_UI_SEND_DATA * pData = dynamicCast< SIMSG_UI_SEND_DATA * >( pMsg );
if( !::_stricmp( "PROMOTE", pData->m_strText.c_str() ) )
m_EditName->SetText( pData->m_strString.c_str() );
}
break;
// 길드장인계 결정.
case IMSG_UI_GUILD_PROMOTE :
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_PROMOTE, std::string( m_EditName->GetText() ) ) );
m_pGameManager->ProcMsgAtStatic( &SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_PROMOTE, std::string( m_EditName->GetText() ) ) );
pMsg->bUse = true;
break;
// 길드장인계 대상정보.
case IMSG_UI_GUILD_PROMOTE_TO_MEMBER :
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 );
// 캐릭터명 설정.
m_EditName->SetText( strOrg.c_str() );
// 등급명.
//pMsgData->strData_2 = pMsgData->strData_2 == "" ? " " : pMsgData->strData_2;
// 데코 제외 순수 텍스트만 뽑아내기.
strOrg = pMsgData->strData_2;
size = strOrg.find_last_of( ">" );
strOrg = strOrg.substr( ++size );
m_pClassNameCtrl->SetCaption( ( m_StrClassNameDecorate + strOrg ).c_str() );
pMsg->bUse = true;
break;
}
}
void SUIMasterTransfer::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK :
// close.
if( !::_stricmp( lpszControlID, "button_close_trim_01" ) || !::_stricmp( lpszControlID, "button_cancel" )) //servantes 2010.10.13
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MASTER_PROMOTE, false ) );
}
// 확인.
if( !::_stricmp( lpszControlID, "button_ok" ) )
{
ConfirmationButton(); // 길드장인계.
}
break;
// 윈도우 이동
case KUI_MESSAGE::KGENWND_MOVE:
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
DWORD SUIMasterTransfer::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 SUIMasterTransfer::ConfirmationButton()
{
/// 2010.12.13 연합장도 길드장 인계가 가능하도록 주석 처리 함(본섭 업데이트 이후에 하기로 함) - prodongi
// 연합에 속한경우, 길드장이 연합길드장 인 경우, 인계 불가.
/// 2011.05.11 redmine #27 - prodongi
/*
if( !m_GuildMgr.GetIsAlliance() )
{
const char * pAMaster = m_GuildMgr.GetAllianceGuildMaster( 0 );
if( pAMaster && !::_stricmp( m_PlayerInfoMgr.GetPlayerInfo().GetName(), pAMaster ) )
{
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, strMsg.c_str() ) ); // 텍스트 확인용
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1921 ) ) ); // stringDB 필요.
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1921 ) ) ); // stringDB 필요.
return;
}
}
*/
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;
}
//
// 자신에게 인계불가.
SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo();
if( !::stricmp( strName, player.GetName() ) )
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1925 ) ) ); // string db 필요.
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1925 ) ) ); // string db 필요.
return;
}
SPlayerSlot * pPlayer = m_GuildMgr.FindMember( strName );
// 길드원.
if( pPlayer )
{
if( 2 != pPlayer->GetLogin() )
{
string strMsg( S( 1903 ) ); // string DB 필요.
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_YES, S( 1926 ), true ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1926 ), true ) );
}
else
{
string strMsg( S( 1903 ) ); // string DB 필요.
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_PROMOTE, strMsg.c_str(), true ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_PROMOTE, strMsg.c_str(), true ) );
}
}
// 비길드원 or 비존재캐릭터.
else
{
std::string strMsg( S( 1905 ) );
CStringUtil::ReplacePhrase( strMsg, "#@user_name@#", strName );
//std::string strMsg( strName );
//strMsg.append( " 은(는) 비길드원 이다." ); // string DB 값 필요.
/// 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() ) ); // 텍스트 확인용
}
}