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

291 lines
10 KiB
C++

#include "stdafx.h"
#include "SGameManager.h"
#include "SStringDB.h"
#include "SItemDB.h"
#include "SUINotifyWnd.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
//#include "KUIControl.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
bool SUIResurrectWnd::InitData( bool bReload /*= false*/ )
{
m_nUseItem = 0;
m_hOwner = 0;
//910004 요정의 병
//910005 대모요정의 병
//두가지 모두 소유 시, 대모요정의 병이 먼저 사용
return true;
}
void SUIResurrectWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_RESURRECTION:
{
SIMSG_UI_RESURRECTION* pResurrection = dynamicCast<SIMSG_UI_RESURRECTION*>(pMsg);
SetChildCaption( "button_resurrect_town", GetStringDB().GetString( 6423 ) );
KUIControl* pResurrectTown = dynamicCast<KUIControl*>(GetChild( "button_resurrect_town" ));
KUIControl* pResurrectItem = dynamicCast<KUIControl*>(GetChild( "button_resurrect_item" ));
KUIControl* pResurrectState = dynamicCast<KUIControl*>(GetChild( "button_resurrect_buff" ));
// 대련 부활 추가, kappamind.
KUIControl* pResurrectPVPState = dynamicCast<KUIControl*>(GetChild( "button1" ));
KUIControl* pResurrectPVPTown = dynamicCast<KUIControl*>(GetChild( "butoon2" ));
if( pResurrection->nResurrectionType == RESURRECTION_BY_ITEM )
{
m_hOwner = 0;
m_nUseItem = pResurrection->nUseItem;
std::string strMsg = SStringDB::ParseString( GetStringDB().GetString( 6422 ), "#@item_name@#", GetStringDB().GetString(GetItemDB().GetTextID(m_nUseItem)) );
std::string strText = SStringDB::ParseString( GetStringDB().GetString( 6424 ), "#@item_name@#", GetStringDB().GetString(GetItemDB().GetTextID(m_nUseItem)) );
std::string strText2 = S( 6500 );
SetChildCaption( "static_msg" , strMsg.c_str() );
if( pResurrectTown ) pResurrectTown->Enable();
if( pResurrectItem )
{
pResurrectItem->SetCaption( strText.c_str() );
pResurrectItem->Enable();
}
if( pResurrectState )
{
pResurrectState->SetCaption( strText2.c_str() );
pResurrectState->Disable();
}
}
else if( pResurrection->nResurrectionType == RESURRECTION_BY_ITEM_STATE )
{
m_hOwner = pResurrection->hOwner;
m_nUseItem = pResurrection->nUseItem;
std::string strMsg = SStringDB::ParseString( S( 6479 ), "#@item_name@#", GetStringDB().GetString(GetItemDB().GetTextID(m_nUseItem)), "#@state_name@#", pResurrection->szStateName );
std::string strText = SStringDB::ParseString( GetStringDB().GetString( 6424 ), "#@item_name@#", GetStringDB().GetString(GetItemDB().GetTextID(m_nUseItem)) );
std::string strText2 = SStringDB::ParseString( GetStringDB().GetString( 6499 ), "#@resurrect_buff@#", pResurrection->szStateName );
SetChildCaption( "static_msg" , strMsg.c_str() );
if( pResurrectTown ) pResurrectTown->Enable();
if( pResurrectItem )
{
pResurrectItem->SetCaption( strText.c_str() );
pResurrectItem->Enable();
}
if( pResurrectState )
{
pResurrectState->SetCaption( strText2.c_str() );
pResurrectState->Enable();
}
}
else if( pResurrection->nResurrectionType == RESURRECTION_BY_STATE )
{
m_hOwner = pResurrection->hOwner;
std::string strMsg = SStringDB::ParseString( GetStringDB().GetString( 6422 ), "#@item_name@#", pResurrection->szStateName );
std::string strText = SStringDB::ParseString( GetStringDB().GetString( 6424 ), "#@item_name@#", GetStringDB().GetString(GetItemDB().GetTextID(pResurrection->nUseItem)) );
std::string strText2 = SStringDB::ParseString( GetStringDB().GetString( 6499 ), "#@resurrect_buff@#", pResurrection->szStateName );
SetChildCaption( "static_msg" , strMsg.c_str() );
if( pResurrectTown ) pResurrectTown->Enable();
if( pResurrectItem )
{
pResurrectItem->SetCaption( strText.c_str() );
pResurrectItem->Disable();
}
if( pResurrectState )
{
pResurrectState->SetCaption( strText2.c_str() );
pResurrectState->Enable();
}
}
else if( pResurrection->nResurrectionType == RESURRECTION_CREATURE_BY_STATE )
{
m_hOwner = pResurrection->hOwner;
std::string strMsg = SStringDB::ParseString( GetStringDB().GetString( 6422 ), "#@item_name@#", pResurrection->szStateName );
std::string strText = SStringDB::ParseString( GetStringDB().GetString( 6424 ), "#@item_name@#", GetStringDB().GetString(GetItemDB().GetTextID(pResurrection->nUseItem)) );
std::string strText2 = SStringDB::ParseString( GetStringDB().GetString( 6499 ), "#@resurrect_buff@#", pResurrection->szStateName );
SetChildCaption( "static_msg" , strMsg.c_str() );
if( pResurrectTown ) pResurrectTown->Disable();
if( pResurrectItem )
{
pResurrectItem->SetCaption( strText.c_str() );
pResurrectItem->Disable();
}
if( pResurrectState )
{
pResurrectState->SetCaption( strText2.c_str() );
pResurrectState->Enable();
}
// 1:1 대련, kappamind.
else if( pResurrection->nResurrectionType == RESURRECTION_PVP )
{
if( pResurrectPVPState ) pResurrectPVPState->Enable();
if( pResurrectPVPTown ) pResurrectPVPTown->Enable();
}
}
}
break;
}
}
void SUIResurrectWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
/** 1:1 대련 추가
* 2009-01-20: hunee
*/
if( ::_stricmp( lpszControlID, "button_resurrect_town" ) == 0 )
{
//그냥 부활
// 서버에 기본 부활 메세지 보냄
m_pGameManager->PostMsgAtDynamic( new SMSG_RESURRECTION( 0, 0, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RESURRECT, false, true ) );
m_nUseItem = 0;
}
if( ::_stricmp( lpszControlID, "button_resurrect_item" ) == 0 )
{
//아이템 사용
m_pGameManager->PostMsgAtDynamic( new SMSG_RESURRECTION( 0, m_nUseItem, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RESURRECT, false, true ) );
m_nUseItem = 0;
}
if( ::_stricmp( lpszControlID, "button_resurrect_buff" ) == 0 )
{
//지속 효과 사용
m_pGameManager->PostMsgAtDynamic( new SMSG_RESURRECTION( m_hOwner, 0, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RESURRECT, false, true ) );
m_hOwner = 0;
m_nUseItem = 0;
}
// #kappamind. 대련중 죽었을 때, 제자리 부활.
if( ::_stricmp( lpszControlID, "button1" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SMSG_RESURRECTION( 0, 0, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RESURRECT_PVP, false, true ) );
m_nUseItem = 0;
}
// #kappamind. 대련중 죽었을 때, 마을에서 부활.
if( ::_stricmp( lpszControlID, "butoon2" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SMSG_RESURRECTION( 0, 0, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RESURRECT_PVP, false, true ) );
m_nUseItem = 0;
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
namespace
{
const int RECALL_WAIT_TIME = 30;
};
bool SUIRecallWnd::InitData( bool bReload/* = false*/ )
{
m_dwCheckTime = 0;
m_nWaitSecond = RECALL_WAIT_TIME;
SetChildCaption( "static_msg02", "" );
// 커스텀 윈도우 move 영역 설정
SetCustomMovingRect( KRect( 0, 0, GetRect().GetWidth(), (GetRect().GetHeight()-GetRect().GetHeight()/3) ) );
return true;
}
void SUIRecallWnd::Process(DWORD dwTime)
{
if( m_dwCheckTime==0 )m_dwCheckTime = dwTime;
if( (dwTime-m_dwCheckTime) >= 1000 )
{
m_dwCheckTime = dwTime;
if( m_nWaitSecond > 0 )
m_nWaitSecond--;
else
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA( m_nDynamicWndID, "RECALL_DYNAMIC_CLOSE" ) );
char szNum[10];
itoa( m_nWaitSecond, szNum, 10 );
// <size:10><#fbe6af><left><vcenter>00 : 00
SetChildCaption( "static_msg02", CStringUtil::StringFormat( "<size:10><#fbe6af><left><vcenter>%s", SStringDB::ParseString( GetStringDB().GetString( 6421 ), "#@time@#", szNum ).c_str() ).c_str() );
}
}
void SUIRecallWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_ok" ) == 0 )
{ //트리거 날리고 초기화
std::string strTrigger = CStringUtil::StringFormat( "%s", m_strTrigger.c_str() ).c_str();
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG( strTrigger.c_str() ) );
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA( m_nDynamicWndID, "RECALL_DYNAMIC_CLOSE" ) );
}
if( ::_stricmp( lpszControlID, "button_cancel" ) == 0 )
{ //닫고 초기화
m_strTrigger="";
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA( m_nDynamicWndID, "RECALL_DYNAMIC_CLOSE" ) );
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIRecallWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_SCRIPT_SHOW_WINDOW :
{
SMSG_SCRIPT_SHOW_WINDOW* pScriptShowWindow = dynamicCast<SMSG_SCRIPT_SHOW_WINDOW*>(pMsg);
m_strTrigger = pScriptShowWindow->strTrigger;
m_strArgument = pScriptShowWindow->strArgument;
/// 2012.08.08 예전 코드로 복원, 통합된 스크립트 윈도우 작업 할 때, 기존꺼는 그대로 나두기로 했는데, 수정이 되버린것 같다- prodongi
//#@user_name@# 님이 소환하셨습니다. 소환에 응하시겠습니까?
SetChildCaption( "static_msg", CStringUtil::StringFormat( "<size:10><#fbe6af><hcenter><vcenter>%s",SStringDB::ParseString( GetStringDB().GetString( 6420 ), "#@user_name@#", m_strArgument.c_str() ).c_str() ).c_str() );
}
break;
}
}