1652 lines
54 KiB
C++
1652 lines
54 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "KUIControlGauge.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlClockBox.h"
|
|
#include "KUIControlQuickEffect.h"
|
|
|
|
#include "SGameManager.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SUICreatureInfoWnd.h"
|
|
#include "SUIDisplayInfo.h"
|
|
|
|
#include "SSummonSlotMgr.h"
|
|
#include "SInventoryMgr.h"
|
|
|
|
#include "SCreatureDB.h"
|
|
#include "SSkillDB.h"
|
|
#include "SStringDB.h"
|
|
#include "SSkillSlot.h"
|
|
|
|
#include "SUIDisplayInfo.h"
|
|
#include "KUIDragAndDrop.h"
|
|
#include "SGameAvatarEx.h"
|
|
#include "SGame.h"
|
|
// 2010.05.11 - prodongi
|
|
//#include "SUIUtil.h"
|
|
|
|
|
|
void SUICreatureInfoWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
|
|
//파티 윈도우 위치 조정
|
|
if( !bOpen )
|
|
{
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, GetRect().left, GetRect().top ) );
|
|
}
|
|
else
|
|
{
|
|
m_pGameManager->StartSound( "ui_popup_window01.wav" );
|
|
}
|
|
}
|
|
|
|
bool SUICreatureInfoWnd::InitData( bool bReload )
|
|
{
|
|
m_bUnSummonedCheck = false;
|
|
m_hUnSummonedCreature = NULL;
|
|
m_dwBeginTime = 0;
|
|
m_dwRemainTime = 0;
|
|
m_dwStartTime = 0;
|
|
m_nProcessCount = 0;
|
|
m_nSelectIndex = -1;
|
|
|
|
::memset( m_hCreature, 0, sizeof(m_hCreature) );
|
|
::memset( m_hLendingCreature, 0, sizeof(m_hLendingCreature) );
|
|
|
|
//init multi_icon
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( "creature_icon00" ) );
|
|
if( pIcon )
|
|
pIcon->SetIconLayer( 4 );
|
|
|
|
RECT rc; rc.top = 51; rc.left = 0; rc.right = 0; rc.bottom = 51;
|
|
for( int i = 0; i < 2-1; i++ )
|
|
{
|
|
if( !bReload )
|
|
{
|
|
CopyControl( CStringUtil::StringFormat("outframe%02d" , i).c_str(), CStringUtil::StringFormat("outframe%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("inframe%02d" , i).c_str(), CStringUtil::StringFormat("inframe%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("creature_icon%02d" , i).c_str(), CStringUtil::StringFormat("creature_icon%02d" , i+1).c_str(), rc );
|
|
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( CStringUtil::StringFormat("creature_icon%02d", i+1).c_str() ) );
|
|
if( pIcon )
|
|
pIcon->SetIconLayer( 4 );
|
|
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_rank%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_rank%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_static%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_static%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_time%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_time%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_soket_number%02d", i).c_str(), CStringUtil::StringFormat("crmainframe_soket_number%02d", i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_hp_gauge%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_hp_gauge%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_mp_gauge%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_mp_gauge%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_sp_gauge%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_sp_gauge%02d" , i+1).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat("crmainframe_name%02d" , i).c_str(), CStringUtil::StringFormat("crmainframe_name%02d" , i+1).c_str(), rc );
|
|
}
|
|
|
|
KUIControlGauge* pGaugeHP = dynamicCast<KUIControlGauge*>( GetChild( CStringUtil::StringFormat( "crmainframe_hp_gauge%02d", 1 ).c_str() ) );
|
|
if( pGaugeHP )
|
|
{
|
|
pGaugeHP->SetBack( c_szDEF_SPR_NAME, "common_gauge_titanium_player_hp100_mini" );
|
|
}
|
|
|
|
KUIControlGauge* pGaugeMP = dynamicCast<KUIControlGauge*>( GetChild( CStringUtil::StringFormat( "crmainframe_mp_gauge%02d", 1 ).c_str() ) );
|
|
if( pGaugeMP )
|
|
{
|
|
pGaugeMP->SetBack( c_szDEF_SPR_NAME, "common_gauge_titanium_player_mp_mini" );
|
|
}
|
|
}
|
|
|
|
SetChildShow( "crmainframe_count" );
|
|
|
|
SetChildShow( "select_mouseclick" );
|
|
SetChildAsTop( "select_mouseclick" );
|
|
|
|
SetChildAsTop( CStringUtil::StringFormat( "crmainframe_soket_number%02d", 0 ).c_str() );
|
|
SetChildAsTop( CStringUtil::StringFormat( "crmainframe_soket_number%02d", 1 ).c_str() );
|
|
|
|
SetChildAsTop( "crmainframe_count" );
|
|
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
void SUICreatureInfoWnd::Process( DWORD dwTime )
|
|
{
|
|
SUIWnd::Process( dwTime );
|
|
|
|
m_dwTime = dwTime;
|
|
|
|
//대여 시간 처리
|
|
m_dwTime = dwTime;
|
|
|
|
if( (m_dwTime - m_dwStartTime) > 1000 )
|
|
{
|
|
m_dwStartTime = m_dwTime;
|
|
++m_nProcessCount;
|
|
|
|
if( m_nProcessCount >= 60 )
|
|
{
|
|
m_nProcessCount = 0;
|
|
//Refresh
|
|
|
|
for( int nIndex(0); 2>nIndex; ++nIndex )
|
|
{
|
|
if( m_hLendingCreature[nIndex] )
|
|
{
|
|
int nRemainTime = m_InventoryMgr.GetLendingItemTime( m_hLendingCreature[nIndex] );
|
|
|
|
//대여 시간 표시
|
|
SetChildShow( CStringUtil::StringFormat("crmainframe_time%02d" , nIndex).c_str(), true );
|
|
std::string StrTime = GetRemainTime(nRemainTime);
|
|
if( !StrTime.empty() )
|
|
SetChildCaption( CStringUtil::StringFormat("crmainframe_time%02d", nIndex).c_str(), StrTime.c_str() );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if( m_bUnSummonedCheck && m_hUnSummonedCreature )
|
|
{
|
|
if( m_dwBeginTime == 0 )
|
|
m_dwBeginTime = m_dwTime;
|
|
|
|
DWORD dwCurTime = (m_dwTime-m_dwBeginTime) / 1000;
|
|
|
|
if( dwCurTime <= m_dwRemainTime )
|
|
ShowCountNumber( static_cast<int>(m_dwRemainTime - dwCurTime) );
|
|
}
|
|
}
|
|
|
|
std::string SUICreatureInfoWnd::GetRemainTime( int nRemainTime )
|
|
{
|
|
std::string StrTempTime = m_pDisplayInfo->GetTimeString( nRemainTime, 0, true ).c_str();
|
|
if( !StrTempTime.empty() )
|
|
return CStringUtil::StringFormat("<size:8>%s<outline><vcenter><hcenter><#00fff6>%s", S(6425), StrTempTime.c_str() );
|
|
return "";
|
|
}
|
|
|
|
void SUICreatureInfoWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch(nMessage)
|
|
{
|
|
case KUI_MESSAGE::KGENWND_RIGHT_CLICK:
|
|
{
|
|
#ifndef NDEBUG
|
|
AR_HANDLE hSelCreature = CheckCreature( static_cast<int>(lparam), static_cast<int>(wparam) );
|
|
if( hSelCreature )
|
|
{
|
|
//크리처 정보창 열자
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) );
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , false ) );
|
|
|
|
m_CreatureSlotMgr.SetSelectSummonCreature( hSelCreature );
|
|
|
|
////크리처 정보창 열자
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) );
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , true ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, "creature_update" ) );
|
|
}
|
|
#endif
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KFOCUS_ACTIVATED:
|
|
{
|
|
if( GetRect().IsInRect( static_cast<int>(lparam), static_cast<int>(wparam) ) )
|
|
SelectCreature( static_cast<int>(lparam), static_cast<int>(wparam) );
|
|
}
|
|
break;
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
void SUICreatureInfoWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch(pMsg->nType)
|
|
{
|
|
case MSG_UNSUMMON:
|
|
case MSG_ENTER:
|
|
{
|
|
if( pMsg->nType == MSG_UNSUMMON && ((SMSG_UNSUMMON*)pMsg)->summon_handle == m_hUnSummonedCreature )
|
|
{
|
|
// 2011.12.15 - servantes : 크리처 핸들 정보를 파티창에 보낸다
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "set_hidecreature_handle", (unsigned int)m_hUnSummonedCreature ) );
|
|
|
|
m_bUnSummonedCheck = false;
|
|
m_hUnSummonedCreature = NULL;
|
|
m_dwBeginTime = 0;
|
|
m_dwRemainTime = 0;
|
|
|
|
SetChildShow( "crmainframe_count" );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_FIXED_CREATURE_SLOT( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, false ) );
|
|
}
|
|
|
|
if( pMsg->nType == MSG_UNSUMMON ) // 2011.05.24 - servantes //크리처 역소환하여 화면에서 사라질 경우
|
|
{
|
|
SIMSG_GET_MAIN_CREATURE_HANDEL sMsg(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM); // 크리처 편성창
|
|
m_pGameManager->ProcMsgAtStatic( &sMsg );
|
|
if(sMsg.hCreature == ((SMSG_UNSUMMON*)pMsg)->summon_handle) // 주크리처가 사라지는 경우
|
|
{
|
|
int nCountCreature = m_CreatureSlotMgr.GetSummonedCreatureCount();
|
|
if( nCountCreature == 2) // 보조 크리처가 있을 때, 보조크리처가 주크리처가 된다
|
|
{
|
|
AR_HANDLE hSubCreature = m_CreatureSlotMgr.GetSummonedCreature(1); // 보조 크리처 핸들
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, -1, hSubCreature ) ); // 크리처 편성창
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE_2ND( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, -1, hSubCreature ) ); // 크리처 미니 편성창
|
|
|
|
// 2011.12.19 - servantes :크리처 핸들 정보를 파티창에 보낸다
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "set_creature_handle", (unsigned int)hSubCreature ) );
|
|
}
|
|
else if(nCountCreature == 1) // 보조 크리처가 있을 때
|
|
{
|
|
AR_HANDLE hSubCreature = m_CreatureSlotMgr.GetSummonedCreature(0); // 보조 크리처 핸들
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, -1, hSubCreature ) ); // 크리처 편성창
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE_2ND( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, -1, hSubCreature ) ); // 크리처 미니 편성창
|
|
|
|
// 2011.12.19 - servantes :크리처 핸들 정보를 파티창에 보낸다
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "set_creature_handle", (unsigned int)hSubCreature ) );
|
|
}
|
|
}
|
|
else // 보조크리처가 사라지는 경우
|
|
{
|
|
if( m_CreatureSlotMgr.GetSummonedCreatureCount() == 2) // 보조크리처가 있었을 경우
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, m_nSelectIndex ) ); // 크리처 편성창
|
|
}
|
|
}
|
|
|
|
SetChildShow( "select_mouseclick", false ); // 2011.12.19 - servantes : 선택표시 사라짐
|
|
|
|
// 크리처 퇴장
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "leave_creature", (unsigned int)((SMSG_UNSUMMON*)pMsg)->summon_handle ) );
|
|
|
|
}
|
|
|
|
if( pMsg->nType == MSG_ENTER && ((SMSG_ENTER*)pMsg)->handle ) // 2011.05.25 - servantes //크리처 소환
|
|
{
|
|
AR_HANDLE hCreature = ((SMSG_ENTER*)pMsg)->handle;
|
|
|
|
SIMSG_GET_MAIN_CREATURE_HANDEL sMsg(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM); // 크리처 편성창
|
|
m_pGameManager->ProcMsgAtStatic( &sMsg );
|
|
|
|
int nCntCreature = m_CreatureSlotMgr.GetSummonedCreatureCount();
|
|
if( nCntCreature == 1) // 주크리처 소환
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, -1, hCreature ) ); // 크리처 편성창
|
|
|
|
// 2011.12.15 - servantes : 주크리처 카드 핸들 정보를 파티창에 보낸다
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "set_creature_handle", (unsigned int)hCreature ) );
|
|
}
|
|
else if(nCntCreature == 2) // 보조크리처 소환
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, -1, sMsg.hCreature ) ); // 크리처 편성창
|
|
}
|
|
|
|
// 크리처 입장
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "enter_creature", (unsigned int)hCreature ) );
|
|
}
|
|
|
|
RefreshSlots();
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_LEAVE:
|
|
{
|
|
SMSG_LEAVE* pLeave = ( SMSG_LEAVE* )pMsg;
|
|
|
|
if( m_CreatureSlotMgr.GetSummonedCreatureCnt() <= 1 )
|
|
{
|
|
m_bUnSummonedCheck = false;
|
|
|
|
m_dwBeginTime = 0;
|
|
m_dwRemainTime = 0;
|
|
SetChildShow( "crmainframe_count" );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_FIXED_CREATURE_SLOT( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, false ) ); // 크리처 편성창
|
|
|
|
// 크리처 퇴장
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "leave_creature", (unsigned int)pLeave->handle ) );
|
|
}
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_UNSUMMON_NOTICE:
|
|
{
|
|
SMSG_UNSUMMON_NOTICE* pNotice = ( SMSG_UNSUMMON_NOTICE* )pMsg;
|
|
|
|
m_bUnSummonedCheck = true;
|
|
m_hUnSummonedCreature = pNotice->summon_handle;
|
|
m_dwBeginTime = m_dwTime;
|
|
m_dwRemainTime = static_cast<DWORD>(pNotice->unsummon_duration/100);
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_FIXED_CREATURE_SLOT( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, true ) ); // 크리처 편성창
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_TARGET_STAT:
|
|
{
|
|
SIMSG_UI_TARGET_STAT* pUIMsg = dynamicCast<SIMSG_UI_TARGET_STAT*>(pMsg);
|
|
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
if( pUIMsg->handle == m_hCreature[i] )
|
|
{
|
|
RefreshHPMP( i, pUIMsg );
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case MSG_PROPERTY:
|
|
case MSG_EXP_UPDATE:
|
|
case MSG_LEVEL_UPDATE:
|
|
// case MSG_HPMP:
|
|
{
|
|
AR_HANDLE handle = NULL;
|
|
if( IMSG_UI_TARGET_STAT == pMsg->nType ) handle = ((SIMSG_UI_TARGET_STAT*)pMsg)->handle;
|
|
else if( MSG_EXP_UPDATE == pMsg->nType ) handle = ((SMSG_EXP_UPDATE*)pMsg)->handle;
|
|
// else if( MSG_HPMP == pMsg->nType ) handle = ((SMSG_HPMP*)pMsg)->handle;
|
|
else if( MSG_LEVEL_UPDATE == pMsg->nType ) handle = ((SMSG_LEVEL_UPDATE*)pMsg)->handle;
|
|
else if( MSG_PROPERTY == pMsg->nType )
|
|
{
|
|
switch(((SMSG_PROPERTY*)pMsg)->nPropertyType)
|
|
{
|
|
case SMSG_PROPERTY::PROPERTY_MAX_HP:
|
|
case SMSG_PROPERTY::PROPERTY_MAX_MP:
|
|
case SMSG_PROPERTY::PROPERTY_EXP:
|
|
case SMSG_PROPERTY::PROPERTY_LEVEL:
|
|
handle = ((SMSG_PROPERTY*)pMsg)->handle;
|
|
break;
|
|
}
|
|
}
|
|
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
if( handle == m_hCreature[i] )
|
|
{
|
|
EnableSlot(i, true);
|
|
SetSummonedCreautreData( i, m_hCreature[i] );
|
|
}
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_TARGET_INFO:
|
|
{
|
|
// 내 크리처 이면 선택 처리한다
|
|
SIMSG_UI_TARGET_INFO* pTargetMsg = (SIMSG_UI_TARGET_INFO*)pMsg;
|
|
|
|
if( ((SIMSG_UI_TARGET_INFO*)pMsg)->pSeqForm == NULL )
|
|
{
|
|
SetChildShow( "crmainframe_select01" );
|
|
SetChildShow( "crmainframe_select02" );
|
|
}
|
|
else
|
|
{
|
|
SetChildShow( "crmainframe_select01", ( pTargetMsg->handle == m_hCreature[0] ) );
|
|
SetChildShow( "crmainframe_select02", ( pTargetMsg->handle == m_hCreature[1] ) );
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_CHANGE_NAME:
|
|
{
|
|
SMSG_CHANGE_NAME* pNameMsg = (SMSG_CHANGE_NAME*)pMsg;
|
|
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
if( pNameMsg->handle == m_hCreature[i] )
|
|
{
|
|
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( pNameMsg->handle );
|
|
if( pInfo )
|
|
{
|
|
SetChildCaption( CStringUtil::StringFormat( "crmainframe_name%02d", i ).c_str(), CStringUtil::StringFormat( "<size:11><left>%s", pInfo->GetName() ).c_str() );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case MSG_SUMMON_NAME_CHANGE:
|
|
{
|
|
SMSG_SUMMON_NAME_CHANGE* pNameMsg = (SMSG_SUMMON_NAME_CHANGE*)pMsg;
|
|
|
|
SGame* pGame( m_pGameManager->GetActiveGame() );
|
|
if( !pGame ) break;
|
|
|
|
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( pNameMsg->summon_handle );
|
|
if( !pInfo ) break;
|
|
|
|
_SUMMON_INFO_FILE * pSummon = GetCreatureDB().GetCreatureData( pInfo->GetID() );
|
|
if( !pSummon ) break;
|
|
|
|
std::string strCreatureClass = GetStringDB().GetString( pSummon->name_id );
|
|
|
|
std::string strText = SR(6434, "#@creature_class@#", strCreatureClass.c_str(), "#@creature_name@#", pInfo->GetName() );
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTTEXT( SIMSG_UI_REQ_INPUTTEXT::USAGE_CREATURE_NAMEPLATE, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_MAIN, strText.c_str(), 6784 ) ); // [sonador][7.0.6] Mantis 0002624
|
|
}
|
|
break;
|
|
case IMSG_UI_INPUTTEXT:
|
|
{
|
|
SIMSG_UI_INPUTTEXT* pInputTextMsg = (SIMSG_UI_INPUTTEXT*)pMsg;
|
|
|
|
// 크리처 이름 길이 제한 체크
|
|
if( !pInputTextMsg->m_strText.empty() && pInputTextMsg->m_strText.size() <= 18)
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_CHANGE_SUMMON_NAME( pInputTextMsg->m_strText.c_str() ) );
|
|
}
|
|
else
|
|
{
|
|
// 잘못된 이름입니다. 메시지 박스 출력
|
|
//m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GENERAL, S(128), false) );
|
|
m_pDisplayInfo->AddSystemMessage( S(128), 0 ); // Invalid name
|
|
}
|
|
}
|
|
break;
|
|
case IMSG_SELECT_TARGET: /// 2011.02.15 - prodongi
|
|
{
|
|
SIMSG_SELECT_TARGET* msg = dynamicCast<SIMSG_SELECT_TARGET*>(pMsg);
|
|
setShowSelectControl(msg->handle);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void SUICreatureInfoWnd::RefreshHPMP( int nIndex, struct SIMSG_UI_TARGET_STAT * pMsg )
|
|
{
|
|
RefreshGauge( CStringUtil::StringFormat( "crmainframe_hp_gauge%02d", nIndex ).c_str(), pMsg->m_nVar1, pMsg->m_nVar3 );
|
|
RefreshGauge( CStringUtil::StringFormat( "crmainframe_mp_gauge%02d", nIndex ).c_str(), pMsg->m_nVar2, pMsg->m_nVar4 );
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 리스트
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUICreatureInfoWnd::RefreshSlots()
|
|
{
|
|
::ZeroMemory( m_hCreature, sizeof(m_hCreature) );
|
|
|
|
// 2010.07.01 장비된 크리처가 없을때도 체크 - prodongi
|
|
// 소환된 크리처가 없으면
|
|
//if( m_CreatureSlotMgr.GetSummonedCreatureCount() <= 0 )
|
|
if( m_CreatureSlotMgr.GetSummonedCreatureCount() <= 0 ||
|
|
m_CreatureSlotMgr.GetEquipedCreatureCount() <= 0)
|
|
{
|
|
SetChildShow( "crmainframe_select01" );
|
|
SetChildShow( "crmainframe_select02" );
|
|
|
|
m_pGameManager->ProcMsgAtStatic( &(SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_MAIN, false)) );
|
|
return;
|
|
}
|
|
|
|
{
|
|
KRect rect = GetRect() ;
|
|
|
|
KUIWnd * pOut = GetChild( "outframe00" );
|
|
if( pOut )
|
|
{
|
|
int nHeight = pOut->GetRect().GetHeight() * m_CreatureSlotMgr.GetSummonedCreatureCount();
|
|
rect.bottom = rect.top + nHeight;
|
|
Resize( rect );
|
|
SetCorrectionRect( rect, false );
|
|
_oprint( "%d %d\n", m_CreatureSlotMgr.GetSummonedCreatureCount(), rect.GetHeight() );
|
|
|
|
//파티 윈도우 내리기
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, rect.left, rect.bottom ) );
|
|
}
|
|
|
|
if( m_CreatureSlotMgr.GetSummonedCreatureCount() == 1 && m_nSelectIndex > 0 )
|
|
{ //셀렉트 바 숨기기
|
|
SetChildShow( "select_mouseclick" );
|
|
m_nSelectIndex = -1;
|
|
}
|
|
}
|
|
|
|
// 소환된 크리처 저장
|
|
for( int i = 0; i < m_CreatureSlotMgr.GetSummonedCreatureCount(); i++ )
|
|
m_hCreature[i] = m_CreatureSlotMgr.GetSummonedCreature(i);
|
|
|
|
// 2011.12.19 - servantes :크리처 핸들 정보를 파티창에 보낸다
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "set_creature_handle", (unsigned int)m_hCreature[0] ) );
|
|
|
|
ClearSummonedCreautreData();
|
|
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
if( m_hCreature[i] == NULL )
|
|
{
|
|
EnableSlot( i, false );
|
|
continue;
|
|
}
|
|
|
|
if(m_hCreature[i] == m_hUnSummonedCreature)
|
|
EnableSlot( i, true, true );
|
|
else
|
|
EnableSlot( i, true, false );
|
|
|
|
SetSummonedCreautreData( i, m_hCreature[i] );
|
|
}
|
|
}
|
|
|
|
void SUICreatureInfoWnd::ClearSummonedCreautreData()
|
|
{
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
m_hLendingCreature[i] = 0;
|
|
}
|
|
}
|
|
|
|
void SUICreatureInfoWnd::SetSummonedCreautreData( int nIndex, AR_HANDLE hCreature )
|
|
{
|
|
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
|
|
if( pInfo == NULL )
|
|
{
|
|
EnableSlot( nIndex, false );
|
|
return;
|
|
}
|
|
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_icon%02d", nIndex ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
ResetMultiIcon( pIcon, 0, 4 );
|
|
|
|
// 2010.05.11 - prodongi
|
|
// 2010.09.24 - prodongi
|
|
//SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_CreatureSlotMgr.GetSelectedCreatureCard());
|
|
SInventorySlot* slot = m_InventoryMgr.GetItemInfo(pInfo->GetCardHandle());
|
|
int enhance = (slot) ? slot->GetEnhance() : 0;
|
|
char iconName[128];
|
|
::getEnhanceIconName(iconName, pInfo, enhance);
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName );
|
|
//pIcon->SetIcon( c_szDEF_SPR_NAME, GetCreatureDB().GetIconName(pInfo->GetID()) );
|
|
|
|
//gmpbigsun( 20130411 ) : BORDER 추가
|
|
std::string strTemp;
|
|
int nDurability = (slot) ? slot->GetEtherealDurability() : 0;
|
|
getIconNameSummonCard_BORDER( strTemp, pInfo->GetID(), enhance, nDurability );
|
|
pIcon->SetIcon( 1, c_szDEF_SPR_NAME, strTemp.c_str() );
|
|
|
|
pIcon->SetTooltip( GetStringDB().GetString( GetCreatureDB().GetTextID(pInfo->GetID()) ) );
|
|
}
|
|
|
|
std::string strRank( "" );
|
|
BYTE byRank( GetCreatureDB().GetRate( pInfo->GetID() ) );
|
|
|
|
if( pInfo )
|
|
{
|
|
switch( byRank )
|
|
{
|
|
case SummonBase::RATE_BASIC: strRank = "#@C1R@#"; break;
|
|
case SummonBase::RATE_NORMAL_BASIC: strRank = "#@C2R@#"; break;
|
|
case SummonBase::RATE_SPECIAL_BASIC: strRank = "#@C3R@#"; break;
|
|
case SummonBase::RATE_NORMAL_RARE: strRank = "#@C4R@#"; break;
|
|
case SummonBase::RATE_SPECIAL_RARE: strRank = "#@C5R@#"; break;
|
|
case SummonBase::RATE_UNIQUE: strRank = "#@C6R@#"; break;
|
|
|
|
// AziaMafia Pet Rarity
|
|
case SummonBase::RATE_VERACRUZ: strRank = "#@C7R@#"; break;
|
|
case SummonBase::RATE_PHANTOM: strRank = "#@C8R@#"; break;
|
|
case SummonBase::RATE_AURA: strRank = "#@C9R@#"; break;
|
|
case SummonBase::RATE_SHINNY: strRank = "#@C10R@#"; break;
|
|
case SummonBase::RATE_GALAXY: strRank = "#@C11R@#"; break;
|
|
}
|
|
}
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "crmainframe_rank%02d", nIndex ).c_str(), strRank.c_str() );
|
|
SetChildTooltip( CStringUtil::StringFormat( "crmainframe_rank%02d", nIndex ).c_str(), GetCreatureDB().GetRateString( byRank ).c_str() );
|
|
|
|
/// 2011.01.17 - prodongi
|
|
if( pInfo->GetOverBreed() > 0 )
|
|
SetChildCaption( CStringUtil::StringFormat( "crmainframe_static%02d", nIndex ).c_str(), CStringUtil::StringFormat( "<font:font_01><size:9><#17f39c><left><vcenter>+%d", pInfo->GetOverBreed() ).c_str() );
|
|
else
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_static%02d", nIndex ).c_str(), false );
|
|
|
|
if( pInfo->GetCardHandle() )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pInfo->GetCardHandle() );
|
|
if( pSlot && pSlot->GetItem()->remain_time )
|
|
{
|
|
if( nIndex < SCreatureSlotMgr::MAX_SUMMON_SLOT &&
|
|
nIndex > -1 )
|
|
{
|
|
m_hLendingCreature[nIndex] = pInfo->GetCardHandle();
|
|
m_nProcessCount = 60;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat("crmainframe_time%02d" , nIndex).c_str(), false );
|
|
}
|
|
}
|
|
|
|
RefreshGauge( CStringUtil::StringFormat( "crmainframe_hp_gauge%02d", nIndex ).c_str(), pInfo->GetHP(), pInfo->GetMaxHP() );
|
|
RefreshGauge( CStringUtil::StringFormat( "crmainframe_mp_gauge%02d", nIndex ).c_str(), pInfo->GetMP(), pInfo->GetMaxMP());
|
|
RefreshGauge( CStringUtil::StringFormat( "crmainframe_sp_gauge%02d", nIndex ).c_str(), pInfo->GetCurExp(), pInfo->GetMaxExp() );
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "crmainframe_soket_number%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s<B><#1d2a06><hcenter><vcenter><size:8>%d</B>", S(6425), m_CreatureSlotMgr.GetEquipedCardIndexByCreature(hCreature)+1 ).c_str() );
|
|
SetChildCaption( CStringUtil::StringFormat( "crmainframe_name%02d", nIndex ).c_str(), CStringUtil::StringFormat( "<font:font_01><size:9><#FFFFFF><left><vcenter>%s", pInfo->GetName() ).c_str() );
|
|
}
|
|
|
|
void SUICreatureInfoWnd::EnableSlot( int nIndex, bool bEnable, bool bEnableRemainTimeDisplay ) // 2011.04.18 - servantes
|
|
{
|
|
// 2011.04.18 - servantes
|
|
if( bEnableRemainTimeDisplay == true )
|
|
{
|
|
KUIWnd* pframe = GetChild( CStringUtil::StringFormat( "crmainframe_hp_gauge%02d" , nIndex ).c_str() );
|
|
if( pframe )
|
|
{
|
|
KUIWnd* pWnd = GetChild( "crmainframe_count" );
|
|
if( pWnd )
|
|
pWnd->MovePos( pWnd->GetRect().left, pframe->GetRect().top-4 );
|
|
}
|
|
}
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "outframe%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "inframe%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_icon%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_rank%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_static%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_time%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_soket_number%02d", nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_hp_gauge%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_mp_gauge%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_sp_gauge%02d" , nIndex ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "crmainframe_name%02d" , nIndex ).c_str(), bEnable );
|
|
}
|
|
void SUICreatureInfoWnd::RefreshGauge( std::string strControl, __int64 nCurValue, __int64 nMaxValue )
|
|
{
|
|
KUIControlGauge* pGauge = NULL;
|
|
|
|
pGauge = dynamicCast<KUIControlGauge*>(GetChild( strControl.c_str() ));
|
|
if( pGauge == NULL ) return;
|
|
|
|
int nPer = (static_cast<double>(nCurValue)/static_cast<double>(nMaxValue)) * 100;
|
|
|
|
int nCurrent = max( 0, min( 100, nPer ) );
|
|
pGauge->SetMax( DWORD(100) );
|
|
pGauge->SetGauge( DWORD(nCurrent), DEFAULT_GAUGE_ANI_TIME );
|
|
|
|
if( ::_stricmp( strControl.c_str(), "crmainframe_hp_gauge00" ) == 0 || ::_stricmp( strControl.c_str(), "crmainframe_hp_gauge01" ) == 0 )
|
|
{
|
|
if( nMaxValue <= 0 ) return;
|
|
// 체력 게이지일때는 바의 색이 변한다.. 50% > guagebar_07, 20% > guagebar_08, 20% < guagebar_09
|
|
/// 2010.11.24 - prodongi
|
|
|
|
// 게이지 남은 양에 따라 텍스처 바꿔줌 // 2012.02.02 - servantes
|
|
setHPGaugeTexture( nPer, pGauge );
|
|
}
|
|
}
|
|
|
|
AR_HANDLE SUICreatureInfoWnd::CheckCreature( int nX, int nY )
|
|
{
|
|
KUIWnd* pWnd = NULL;
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
pWnd = GetChild( CStringUtil::StringFormat( "inframe%02d", i ).c_str() );
|
|
if( pWnd && pWnd->GetRect().IsInRect( nX, nY ) && m_hCreature[i] != NULL )
|
|
return m_hCreature[i];
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void SUICreatureInfoWnd::SelectCreature( int nX, int nY )
|
|
{
|
|
bool bSelect = false;
|
|
KUIWnd* pWnd = NULL;
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
pWnd = GetChild( CStringUtil::StringFormat( "inframe%02d", i ).c_str() );
|
|
if( pWnd && pWnd->GetRect().IsInRect( nX, nY ) && m_hCreature[i] != NULL )
|
|
{
|
|
m_nSelectIndex = i;
|
|
|
|
bSelect = true;
|
|
|
|
/// 2011.02.15 select_mouseclick의 show/hide는 SetTarget에서 해준다
|
|
// 선택 크리처 선택 처리한다
|
|
SIMSG_UI_ACT_TARGET msg;
|
|
msg.m_nTargetHandle = m_hCreature[i];
|
|
m_pGameManager->ProcMsgAtStatic(&msg);
|
|
}
|
|
}
|
|
|
|
if( !bSelect )
|
|
{
|
|
SetChildShow( "select_mouseclick" );
|
|
m_nSelectIndex = -1;
|
|
}
|
|
}
|
|
void SUICreatureInfoWnd::ShowCountNumber( int nCountNumber )
|
|
{
|
|
if( nCountNumber <= 0 )
|
|
{
|
|
nCountNumber = 0;
|
|
}
|
|
|
|
SetChildShow ( "crmainframe_count", nCountNumber );
|
|
SetChildCaption( "crmainframe_count", CStringUtil::StringFormat( "<size:18><hcenter><vcenter>%d", nCountNumber ).c_str() );
|
|
}
|
|
|
|
/// 2011.02.15 - prodongi
|
|
void SUICreatureInfoWnd::setShowSelectControl(AR_HANDLE handle)
|
|
{
|
|
if (0 == handle)
|
|
{
|
|
SetChildShow("select_mouseclick", false);
|
|
}
|
|
else
|
|
{
|
|
KUIWnd* wnd;
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_SUMMON_SLOT; i++ )
|
|
{
|
|
if (m_hCreature[i] == handle)
|
|
{
|
|
wnd = GetChild( CStringUtil::StringFormat( "inframe%02d", i ).c_str() );
|
|
|
|
KUIWnd* pSelectWnd = GetChild( "select_mouseclick" );
|
|
if( pSelectWnd )
|
|
{
|
|
pSelectWnd->SetShow( true );
|
|
pSelectWnd->Resize( wnd->GetRect() );
|
|
}
|
|
return ;
|
|
}
|
|
}
|
|
|
|
SetChildShow("select_mouseclick", false);
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Summon hquick
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
/*
|
|
|
|
namespace
|
|
{
|
|
const char* c_szIconSlotName = "icon_slot";
|
|
};
|
|
|
|
|
|
SUIHCreatureQuickSlotWnd::SUIHCreatureQuickSlotWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
|
|
: SUIWnd(pGameManager)
|
|
, m_pDisplayInfo( pDisplayInfo )
|
|
, m_bFaceCut( true )
|
|
, m_bCtrlKey( false )
|
|
, m_bIsQuickSlot( false )
|
|
{
|
|
std::string strNum;
|
|
|
|
m_pSlotControlIDs = new SLOT_INFO[ SUIDisplayInfo::c_nQuickSlotCount ];
|
|
for( int n( 0 ); n < SUIDisplayInfo::c_nQuickSlotCount; ++n )
|
|
{
|
|
strNum = CStringUtil::StringFormat( "%02d", n );
|
|
m_pSlotControlIDs[ n ].strIconControl = c_szIconSlotName + strNum;
|
|
}
|
|
|
|
for( int i = 0; i < QUICK_SLOT_MAX; ++i )
|
|
{
|
|
m_vToggleQuickSlotList[i] = false;
|
|
}
|
|
|
|
m_bCasting = false;
|
|
}
|
|
|
|
SUIHCreatureQuickSlotWnd::~SUIHCreatureQuickSlotWnd()
|
|
{
|
|
delete [] m_pSlotControlIDs;
|
|
|
|
m_vUseSkillList.clear();
|
|
}
|
|
|
|
bool SUIHCreatureQuickSlotWnd::InitData( bool bReload )
|
|
{
|
|
//// custom move 영역
|
|
//SetCustomMovingRect( KRect( 0, 0, 25, 12 ) );
|
|
|
|
// quick item 초기화
|
|
int i;
|
|
for( i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
KUIControlMultiIcon* pIcon = (KUIControlMultiIcon*)GetChild( CStringUtil::StringFormat("icon_slot%02d", i).c_str() );
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetIconLayer( 2 );
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" );
|
|
pIcon->SetIcon( 1 );
|
|
pIcon->SetTooltip( "" );
|
|
}
|
|
}
|
|
|
|
// 스킬 재사용 시간 컨트롤
|
|
for( i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
KUIWnd* pIcon = GetChild( CStringUtil::StringFormat("icon_slot%02d", i).c_str() );
|
|
if( pIcon )
|
|
{
|
|
KUIWnd* pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", CStringUtil::StringFormat("quick_clockbox%02d", i).c_str(), " ", pIcon->GetRect(), 0, KFLAG_NO_GET_MESSAGE, this, "", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
if( pWnd ) ((KUIControlClockBox*)pWnd)->SetColor( c_ColorClockControl );
|
|
}
|
|
}
|
|
|
|
KRect rt;
|
|
for( int nSlot( 0 ); nSlot < QUICK_SLOT_MAX; ++nSlot )
|
|
{
|
|
KUIControlMultiIcon* pIconSlotControl = (KUIControlMultiIcon*)GetChild( CStringUtil::StringFormat("icon_slot%02d", nSlot).c_str() );
|
|
|
|
rt = ( pIconSlotControl->GetRect() );
|
|
SetMovePos( CStringUtil::StringFormat( "icon_effect%02d", nSlot ).c_str(), rt.left-27, rt.top-27 );
|
|
|
|
SetChildAsTop( CStringUtil::StringFormat( "icon_effect%02d", nSlot ).c_str() );
|
|
}
|
|
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
|
|
if( bOpen )
|
|
{
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
//큇슬롯 상태 설정
|
|
KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", i ).c_str() );
|
|
if( pSlotEffect )
|
|
pSlotEffect->Cancel();
|
|
}
|
|
|
|
RefreshQuickInfo();
|
|
}
|
|
//else
|
|
// m_CreatureSlotMgr.SetActiveCreatureQuickSlot( NULL );
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::RefreshQuickInfo()
|
|
{
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
if( hCreature && m_CreatureSlotMgr.IsExistSummonedCreature(hCreature) )
|
|
{
|
|
RefreshQuickSlot( hCreature );
|
|
RefreshCreatureIcon( hCreature );
|
|
}
|
|
else
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_HQUICK, false) );
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch(nMessage)
|
|
{
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
if( ::_stricmp( lpszControlID, "quickslot_facecut_button" ) == 0 )
|
|
{
|
|
m_bFaceCut = !m_bFaceCut;
|
|
|
|
SetChildShow( "quickslot_facecut", m_bFaceCut );
|
|
SetChildShow( "icon_face", m_bFaceCut );
|
|
SetChildShow( "quickslot_inframe02", m_bFaceCut );
|
|
}
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KICON_CLICK:
|
|
case KUI_MESSAGE::KICON_DBLCLK:
|
|
{
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
if( ::_stricmp( lpszControlID, CStringUtil::StringFormat("icon_slot%02d", i).c_str() ) == 0 )
|
|
{
|
|
UseSkill( i );
|
|
// RefreshQuickInfo();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KICON_RCLICK:
|
|
{
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
if( ::_stricmp( lpszControlID, CStringUtil::StringFormat("icon_slot%02d", i).c_str() ) == 0 )
|
|
{
|
|
SkillToggleMode( i );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::ToggleEffect( int nSkillID, bool bToggle )
|
|
{
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( hCreature, i );
|
|
if( pSlot && pSlot->m_nSkillID == nSkillID )
|
|
{
|
|
UpdateSkillToggle( ((bToggle==true) ? QUICK_SKILL::STATE_TOGGLE_ON : QUICK_SKILL::STATE_TOGGLE_OFF), pSlot );
|
|
|
|
//큇슬롯 상태 설정
|
|
KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", i ).c_str() );
|
|
if( pSlotEffect )
|
|
{
|
|
pSlotEffect->ToggleOn( bToggle );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::CheckEffect( int nSkillID, int nSkillStatus )
|
|
{
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( hCreature, i );
|
|
if( pSlot && pSlot->m_nSkillID == nSkillID )
|
|
{
|
|
UpdateSkillStatus( nSkillStatus, pSlot );
|
|
|
|
//큇슬롯 상태 설정
|
|
KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", i ).c_str() );
|
|
if( pSlotEffect )
|
|
{
|
|
if( nSkillStatus == TS_SC_SKILL::FIRE )
|
|
{
|
|
if( !pSlotEffect->IsToggleOn() )
|
|
pSlotEffect->CoolTimeOff();
|
|
}
|
|
else if( nSkillStatus == TS_SC_SKILL::CASTING )
|
|
pSlotEffect->Cast(0);
|
|
else if( nSkillStatus == TS_SC_SKILL::CANCEL )
|
|
pSlotEffect->Cancel();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::Process( DWORD dwTime )
|
|
{
|
|
SUIWnd::Process( dwTime );
|
|
|
|
m_dwTime = dwTime;
|
|
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
if( hCreature != 0 )
|
|
{
|
|
if( m_pDisplayInfo->IsCreatureBattleMode( hCreature ) == false ) return;
|
|
|
|
std::vector< UsingSkill >::iterator result;
|
|
for( int i = 0; i < QUICK_SLOT_MAX; ++i )
|
|
{
|
|
if( m_vToggleQuickSlotList[i] == false ) continue;
|
|
|
|
QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( hCreature, i );
|
|
if( pSlot == NULL ) continue;
|
|
|
|
result = std::find( m_vUseSkillList.begin(), m_vUseSkillList.end(), pSlot->m_nSkillID );
|
|
if( result != m_vUseSkillList.end() )
|
|
continue;
|
|
|
|
if( m_CreatureSkillSlotMgr.IsUseSkill( hCreature, pSlot->m_nSkillID ) == false )
|
|
{
|
|
m_vUseSkillList.push_back( UsingSkill( hCreature, pSlot->m_nSkillID, pSlot->m_nUseLevel ) );
|
|
break;
|
|
}
|
|
}
|
|
|
|
static DWORD s_dwDelay = 0;
|
|
if( m_bCasting == false && (m_dwTime - s_dwDelay) > 3000 )
|
|
{
|
|
std::vector< UsingSkill >::iterator iter = m_vUseSkillList.begin();
|
|
for( ; iter != m_vUseSkillList.end(); ++iter )
|
|
{
|
|
if( m_pDisplayInfo->UseSkillByToggle( (*iter).m_nSkillID, (*iter).m_nSkillLevel, false, (*iter).m_hOwner ) )
|
|
{
|
|
s_dwDelay = m_dwTime;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch(pMsg->nType)
|
|
{
|
|
case IMSG_UI_CREATURE_QUICK_UPDATE:
|
|
{
|
|
RefreshQuickInfo();
|
|
}
|
|
break;
|
|
case MSG_ENTER:
|
|
{
|
|
SMSG_ENTER* pEnterMsg = (SMSG_ENTER*)pMsg;
|
|
|
|
if( pEnterMsg->ObjType == TS_ENTER::GAME_SUMMON )
|
|
{
|
|
// 나의 크리처가 소환되었다
|
|
SMSG_ENTER* pEnterMsg = (SMSG_ENTER*)pMsg;
|
|
m_CreatureSlotMgr.SetActiveCreatureQuickSlot( pEnterMsg->handle );
|
|
|
|
// [sonador][20070725][bugfix:mantis:0002460]
|
|
m_CreatureSlotMgr.AddSummonCreature( pEnterMsg->handle );
|
|
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
//큇슬롯 상태 설정
|
|
KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", i ).c_str() );
|
|
if( pSlotEffect )
|
|
pSlotEffect->Cancel();
|
|
}
|
|
|
|
if( IsShow() )
|
|
{
|
|
RefreshQuickInfo();
|
|
}
|
|
else
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_HQUICK, true ) );
|
|
}
|
|
}
|
|
break;
|
|
case MSG_UNSUMMON:
|
|
{
|
|
// 소환한 크리처가 존재한다면 그것으로 교체 아니면 닫아준다
|
|
int nCount = m_CreatureSlotMgr.GetSummonedCreatureCount();
|
|
if( nCount <= 0 )
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_HQUICK, false ) );
|
|
else
|
|
{
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetSummonedCreature( nCount-1 );
|
|
m_CreatureSlotMgr.SetActiveCreatureQuickSlot( hCreature );
|
|
|
|
if( IsShow() )
|
|
{
|
|
RefreshQuickInfo();
|
|
}
|
|
else
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_HQUICK, true ) );
|
|
}
|
|
}
|
|
break;
|
|
case MSG_SUMMON_EVOLUTION:
|
|
{
|
|
if( IsShow() )
|
|
{
|
|
RefreshQuickInfo();
|
|
}
|
|
else
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_HQUICK, true ) );
|
|
}
|
|
break;
|
|
case IMSG_HOTKEY_EX:
|
|
{
|
|
SIMSG_HOTKEY_EX* pHotKey = static_cast<SIMSG_HOTKEY_EX*>(pMsg);
|
|
|
|
if( pHotKey->wParam == VK_CONTROL )
|
|
m_bCtrlKey = (pHotKey->bUp == 0);
|
|
else
|
|
{
|
|
if( m_bCtrlKey )
|
|
{
|
|
char szKey = LOWORD(pHotKey->wParam);
|
|
|
|
if( szKey == '0' ) UseSkill( 0 );
|
|
else if( szKey == '1' ) UseSkill( 1 );
|
|
else if( szKey == '2' ) UseSkill( 2 );
|
|
else if( szKey == '3' ) UseSkill( 3 );
|
|
else if( szKey == '4' ) UseSkill( 4 );
|
|
else if( szKey == '5' ) UseSkill( 5 );
|
|
else if( szKey == '6' ) UseSkill( 6 );
|
|
else if( szKey == '7' ) UseSkill( 7 );
|
|
else if( szKey == '8' ) UseSkill( 8 );
|
|
else if( szKey == '9' ) UseSkill( 9 );
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case MSG_AURA:
|
|
{
|
|
SMSG_AURA* pAuraMsg = (SMSG_AURA*)pMsg;
|
|
ToggleEffect( pAuraMsg->skill_id, pAuraMsg->status );
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_SKILL_LIST:
|
|
{
|
|
RefreshQuickInfo();
|
|
}
|
|
break;
|
|
case MSG_SKILL_EVENT:
|
|
{
|
|
SMSG_SKILL_EVENT* pSkillEvent = (SMSG_SKILL_EVENT*)pMsg;
|
|
|
|
if( pSkillEvent->caster != m_CreatureSlotMgr.GetActiveCreatureQuickSlot() ) break;
|
|
|
|
if( pSkillEvent->data_owner != SMSG_SKILL_EVENT::OWNER_LOCAL_CREATURE ) break;
|
|
|
|
bool bEndCasting = false;
|
|
|
|
if( pSkillEvent->status_type == TS_SC_SKILL::FIRE )
|
|
{
|
|
ShowClockBox( pSkillEvent->skill_id );
|
|
CheckEffect( pSkillEvent->skill_id, TS_SC_SKILL::FIRE );
|
|
|
|
bEndCasting = true;
|
|
}
|
|
else if( pSkillEvent->status_type == TS_SC_SKILL::CASTING )
|
|
{
|
|
if( pSkillEvent->cast.nErrorCode == 0 ) // 캐스팅 성공 쿨링 시계 표시 100%
|
|
{
|
|
ShowClockBox( pSkillEvent->skill_id, true );
|
|
CheckEffect( pSkillEvent->skill_id, TS_SC_SKILL::CASTING );
|
|
|
|
m_bCasting = true;
|
|
}
|
|
else // 실패
|
|
{
|
|
m_pDisplayInfo->SetSysMsg( 0 ); //TODO 무엇을 보내는가 확인?
|
|
bEndCasting = true;
|
|
}
|
|
}
|
|
else if( pSkillEvent->status_type == TS_SC_SKILL::CANCEL )
|
|
{ //TODO Cancel 처리
|
|
CancelSkill( pSkillEvent->skill_id );
|
|
CheckEffect( pSkillEvent->skill_id, TS_SC_SKILL::CANCEL );
|
|
|
|
bEndCasting = true;
|
|
}
|
|
else if( pSkillEvent->status_type == TS_SC_SKILL::CASTING_UPDATE )
|
|
{ //TODO CASTING_UPDATE 처리
|
|
}
|
|
else if( pSkillEvent->status_type == TS_SC_SKILL::REGION_FIRE )
|
|
{ //TODO REGION_FIRE 처리
|
|
bEndCasting = true;
|
|
}
|
|
else if( pSkillEvent->status_type == TS_SC_SKILL::COMPLETE )
|
|
{ //TODO COMPLETE 처리
|
|
bEndCasting = true;
|
|
}
|
|
|
|
if( bEndCasting )
|
|
{
|
|
m_bCasting = false;
|
|
DeleteToggleQuickSlotList( pSkillEvent->skill_id );
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::ShowClockBox( int nSkillID, bool bDiable )
|
|
{
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
if( bDiable )
|
|
{
|
|
std::vector<int> slotList;
|
|
m_CreatureSkillSlotMgr.GetQuickslotID( hCreature, nSkillID, slotList );
|
|
for( int i(0); i<slotList.size(); ++i )
|
|
{
|
|
KUIWnd* pWnd = GetChild( CStringUtil::StringFormat("quick_clockbox%02d", slotList[i]).c_str() );
|
|
if( pWnd && m_CreatureSkillSlotMgr.IsCastingSkill(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) )
|
|
((KUIControlClockBox*)pWnd)->Init();
|
|
}
|
|
return;
|
|
}
|
|
|
|
std::vector<int> slotList;
|
|
m_CreatureSkillSlotMgr.GetQuickslotID( hCreature, nSkillID, slotList );
|
|
for( int i(0); i<slotList.size(); ++i )
|
|
{
|
|
KUIControlClockBox* pClock = (KUIControlClockBox*)( GetChild( CStringUtil::StringFormat("quick_clockbox%02d", slotList[i]).c_str() ) );
|
|
bool bFire = m_CreatureSkillSlotMgr.IsFireSkill(nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot());
|
|
if( pClock )
|
|
{
|
|
if( bFire )
|
|
{
|
|
DWORD dwMaxTime = m_CreatureSkillSlotMgr.GetSkillMaxTime(nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot());
|
|
DWORD dwCrrTime = m_CreatureSkillSlotMgr.GetSkillCurTime(nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot());
|
|
pClock->SetMaxTime( dwMaxTime );
|
|
pClock->SetCurTime( dwCrrTime );
|
|
pClock->Begin();
|
|
pClock->SetShow(true);
|
|
}
|
|
else pClock->SetShow(false);
|
|
}
|
|
}
|
|
}
|
|
//스킬 사용 취소
|
|
void SUIHCreatureQuickSlotWnd::CancelSkill( int nSkillID )
|
|
{
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
std::vector<int> slotList;
|
|
m_CreatureSkillSlotMgr.GetQuickslotID( hCreature, nSkillID, slotList );
|
|
for( int i(0); i<slotList.size(); ++i )
|
|
{
|
|
KUIControlClockBox* pWnd = (KUIControlClockBox*)GetChild( CStringUtil::StringFormat("quick_clockbox%02d", slotList[i]).c_str() );
|
|
if( pWnd )
|
|
{
|
|
pWnd->SetMaxTime( 0 );
|
|
pWnd->SetCurTime( 0 );
|
|
pWnd->Begin();
|
|
}
|
|
}
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::UseSkill( int nQuickSlotNum )
|
|
{
|
|
QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( m_CreatureSlotMgr.GetActiveCreatureQuickSlot(), nQuickSlotNum );
|
|
if( pSlot )
|
|
m_pDisplayInfo->UseSkill( pSlot->m_nSkillID, pSlot->m_nUseLevel, false, m_CreatureSlotMgr.GetActiveCreatureQuickSlot() );
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::UpdateQuickSlot( AR_HANDLE hCreature )
|
|
{
|
|
RefreshQuickSlot(hCreature);
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_CREATURE_QUICK_UPDATE() );
|
|
m_pDisplayInfo->SaveQuickSlots();
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::RefreshQuickSlot( AR_HANDLE hCreature )
|
|
{
|
|
for( int i = 0; i < QUICK_SLOT_MAX; i++ )
|
|
{
|
|
KUIControlMultiIcon* pIcon = ( KUIControlMultiIcon* )GetChild( CStringUtil::StringFormat("icon_slot%02d", i).c_str() );
|
|
if( pIcon )
|
|
{
|
|
QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( hCreature, i );
|
|
|
|
RefreshQuickEffect( i, pSlot );
|
|
|
|
if( pSlot )
|
|
{
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, GetSkillDB().GetIconName(pSlot->m_nSkillID) );
|
|
pIcon->SetIcon( 1 );
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetSkillTooltipText(pSlot->m_nSkillID, pSlot->m_nUseLevel, false, true, true).c_str() );
|
|
|
|
// SetChildShow( CStringUtil::StringFormat("quickslot_number%02d", i+1).c_str(), true );
|
|
// SetChildNumber( CStringUtil::StringFormat("quickslot_number%02d", i+1).c_str(), i+1 );
|
|
SetChildShow( CStringUtil::StringFormat( "static_slotcount%02d", i ).c_str(), true );
|
|
SetChildCaption( CStringUtil::StringFormat( "static_slotcount%02d", i ).c_str(), CStringUtil::StringFormat( "%s<size:8><right>%d", S(6425), pSlot->m_nUseLevel ).c_str() );
|
|
|
|
// 쿨링
|
|
//SetChildShow( CStringUtil::StringFormat( "quick_clockbox%02d", i ).c_str(), false );
|
|
KUIControlClockBox* pClock = ( KUIControlClockBox* )GetChild( CStringUtil::StringFormat("quick_clockbox%02d", i).c_str() );
|
|
if( pClock )
|
|
{
|
|
if( pSlot->m_nSkillID != -1 && m_CreatureSkillSlotMgr.IsCastingSkill( pSlot->m_nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot() ) )
|
|
pClock->Init();
|
|
else if( pSlot->m_nSkillID != -1 )
|
|
{
|
|
bool bFire = m_CreatureSkillSlotMgr.IsFireSkill( pSlot->m_nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot() );
|
|
if( bFire )
|
|
{
|
|
DWORD dwMaxTime = m_CreatureSkillSlotMgr.GetSkillMaxTime(pSlot->m_nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot());
|
|
DWORD dwCrrTime = m_CreatureSkillSlotMgr.GetSkillCurTime(pSlot->m_nSkillID, m_CreatureSlotMgr.GetActiveCreatureQuickSlot());
|
|
pClock->SetMaxTime( dwMaxTime );
|
|
pClock->SetCurTime( dwCrrTime );
|
|
pClock->Begin();
|
|
pClock->SetShow(true);
|
|
}
|
|
else pClock->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
pClock->SetCurTime(0);
|
|
pClock->SetMaxTime(0);
|
|
pClock->Begin();
|
|
pClock->SetShow(false);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" );
|
|
pIcon->SetIcon( 1 );
|
|
pIcon->SetTooltip( "" );
|
|
|
|
// SetChildShow( CStringUtil::StringFormat( "quickslot_number%02d", i+1 ).c_str(), false );
|
|
SetChildShow( CStringUtil::StringFormat( "static_slotcount%02d", i ).c_str(), false );
|
|
SetChildShow( CStringUtil::StringFormat( "quick_clockbox%02d" , i ).c_str(), false );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void SUIHCreatureQuickSlotWnd::RefreshCreatureIcon( AR_HANDLE hCreature )
|
|
{
|
|
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
|
|
if( pInfo == NULL ) return;
|
|
|
|
KUIControlIconStatic* pIcon = ( KUIControlIconStatic* )GetChild( "icon_face" );
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetIcon( c_szDEF_SPR_NAME, GetCreatureDB().GetIconName(pInfo->GetID()) );
|
|
pIcon->SetTooltip( pInfo->GetName() );
|
|
}
|
|
}
|
|
|
|
void* SUIHCreatureQuickSlotWnd::Perform( KID id, KArg& msg )
|
|
{
|
|
_CID( UI_BEGIN_DRAG );
|
|
_CID( UI_SEND_DROP );
|
|
_CID( UI_RECV_DROP );
|
|
|
|
if ( id == id_UI_BEGIN_DRAG )
|
|
{
|
|
KUIBeginDragMessage* pBeginMsg = static_cast<KUIBeginDragMessage*>( &msg );
|
|
const char* szControlID = pBeginMsg->sDragControlID.c_str();
|
|
KUIControlMultiIcon* pWndMultiIcon = (KUIControlMultiIcon*)GetChild( szControlID );
|
|
if( !pWndMultiIcon ) return NULL;
|
|
|
|
// 장착 해제/설정
|
|
if( GetRect().IsInRect( pWndMultiIcon->GetRect().left, pWndMultiIcon->GetRect().top ) ) m_bIsQuickSlot = true;
|
|
else m_bIsQuickSlot = false;
|
|
|
|
int nSlotIndex = GetSlotIndex( szControlID );
|
|
if( 0 <= nSlotIndex && nSlotIndex < SUIDisplayInfo::c_nQuickSlotCount )
|
|
{
|
|
// 비어있지 않은 슬롯만
|
|
QUICK_SKILL* pQuik_Skill(NULL);
|
|
pQuik_Skill = GetSlotSkillInfo(nSlotIndex);
|
|
|
|
if( NULL != pQuik_Skill )
|
|
{
|
|
m_pDisplayInfo->SetUIDragInfo( new SUISkillDragInfo( pQuik_Skill->m_nSkillID, pQuik_Skill->m_nUseLevel, NULL, pQuik_Skill->m_hCreature, SUIDragInfo::DRAGTYPE_CREATURE_QUICKSLOT, pQuik_Skill->GetStateQuickSlot() ) );
|
|
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
|
|
m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
|
|
|
|
pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon;
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
else if ( id == id_UI_SEND_DROP )
|
|
{
|
|
KUISendRecvDropMessage* pSendMsg = static_cast<KUISendRecvDropMessage*>( &msg );
|
|
|
|
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
|
|
if( pUIDragInfo == NULL ) return NULL;
|
|
|
|
SUISkillDragInfo* pSkillDragInfo = ( SUISkillDragInfo* )pUIDragInfo;
|
|
if( pSkillDragInfo == NULL ) return NULL;
|
|
|
|
if( pSkillDragInfo->m_type != SUIDragInfo::DRAGTYPE_CREATURE_QUICKSLOT ) return NULL;
|
|
|
|
if( pSendMsg->sRecvDropParentID != std::string(GetID()) ) // #kappamind. 0002828. 2009.01.28 크리처 퀵슬롯에 스킬아이콘 스왑문제 수정
|
|
{
|
|
int nSlotIndex = GetSlotIndex( pSendMsg->sSendDropControlID.c_str() );
|
|
if( nSlotIndex == -1 ) return NULL;
|
|
|
|
QUICK_SKILL* pQuik_Skill(NULL);
|
|
pQuik_Skill = GetSlotSkillInfo(nSlotIndex);
|
|
if( pQuik_Skill == NULL ) return NULL;
|
|
|
|
m_CreatureSkillSlotMgr.DelQuickSlot( pQuik_Skill->m_hCreature, nSlotIndex );
|
|
UpdateQuickSlot(pSkillDragInfo->m_hTarget);
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
|
|
}
|
|
|
|
// Drag & Drop 정보 제거
|
|
m_pDisplayInfo->SetUIDragInfo();
|
|
m_bIsQuickSlot = false;
|
|
return NULL;
|
|
}
|
|
else if ( id == id_UI_RECV_DROP )
|
|
{
|
|
KUISendRecvDropMessage* pRecvMsg = static_cast<KUISendRecvDropMessage*>( &msg );
|
|
|
|
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
|
|
if( pUIDragInfo == NULL ) return NULL;
|
|
|
|
SUISkillDragInfo* pSkillDragInfo = ( SUISkillDragInfo* )pUIDragInfo;
|
|
if( pSkillDragInfo == NULL ) return NULL;
|
|
|
|
const SUIQuickSlotDragInfo* pQuickSlotDragInfo = (SUIQuickSlotDragInfo*)pUIDragInfo;
|
|
|
|
if( pSkillDragInfo->m_type == SUIDragInfo::DRAGTYPE_CREATURE_QUICKSLOT )
|
|
{
|
|
int nDropIndex = -1;
|
|
int nSendDropIndex = -1;
|
|
nDropIndex = GetSlotIndex( pRecvMsg->sRecvDropControlID.c_str() );
|
|
nSendDropIndex = GetSlotIndex( pRecvMsg->sSendDropControlID.c_str() );
|
|
if( nDropIndex == nSendDropIndex || pRecvMsg->sRecvDropControlID == "" ) return NULL;
|
|
|
|
if( !IsActive(pSkillDragInfo->m_nSkillID) ) return NULL;
|
|
|
|
// 장착
|
|
if( GetRect().IsInRect( pRecvMsg->ptDropPos.x, pRecvMsg->ptDropPos.y ) )
|
|
{
|
|
// 소환된 크리처가 이 크리처라면 알트 퀵슬롯창 갱신해준다
|
|
m_CreatureSkillSlotMgr.AddQuickSlot( pSkillDragInfo->m_hTarget, pSkillDragInfo->m_nSkillID, pSkillDragInfo->m_nLevel, pSkillDragInfo->m_nState, nDropIndex, nSendDropIndex );
|
|
// if( m_bIsQuickSlot )
|
|
// {
|
|
// int nBeforeDropIndex = -1;
|
|
// m_CreatureSkillSlotMgr.DelQuickSlot( pSkillDragInfo->m_hTarget, pQuickSlotDragInfo->m_nSlotIndex );
|
|
// }
|
|
|
|
// 퀵 슬롯 설정-크리처창에서만 설정이 된다.
|
|
UpdateQuickSlot(pSkillDragInfo->m_hTarget);
|
|
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound(), 50 );
|
|
// m_pGameManager->StartSound( "ui_icon_click.wav", 50 );
|
|
}
|
|
// 해제
|
|
else
|
|
{
|
|
// 소환된 크리처가 이 크리처라면 알트 퀵슬롯창 갱신해준다
|
|
m_CreatureSkillSlotMgr.DelQuickSlot( pSkillDragInfo->m_hTarget, pQuickSlotDragInfo->m_nSlotIndex );
|
|
|
|
// 크리처 창에서 지운다
|
|
UpdateQuickSlot(pSkillDragInfo->m_hTarget);
|
|
}
|
|
|
|
m_bIsQuickSlot = false;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
return SUIWnd::Perform( id, msg );
|
|
}
|
|
|
|
int SUIHCreatureQuickSlotWnd::GetSlotIndex( const char* szControlID )
|
|
{
|
|
if( m_pSlotControlIDs )
|
|
{
|
|
for( int nIndex( 0 ); nIndex < SUIDisplayInfo::c_nQuickSlotCount; ++nIndex )
|
|
{
|
|
|
|
if( 0 == ::_stricmp( m_pSlotControlIDs[ nIndex ].strIconControl.c_str(), szControlID ) )
|
|
return nIndex;
|
|
}
|
|
}
|
|
|
|
return (-1);
|
|
}
|
|
|
|
QUICK_SKILL* SUIHCreatureQuickSlotWnd::GetSlotSkillInfo( int index )
|
|
{
|
|
AR_HANDLE ar_handle(NULL);
|
|
ar_handle = m_CreatureSlotMgr.GetSelectSummonCreature();
|
|
if( ar_handle == NULL ) return NULL;
|
|
|
|
return m_CreatureSkillSlotMgr.FindQuickSlot(ar_handle, index);
|
|
}
|
|
|
|
bool SUIHCreatureQuickSlotWnd::IsActive( int nID )
|
|
{
|
|
SkillBaseEx* s_data = GetSkillDB().GetSkillData( nID );
|
|
if( !s_data ) return false;
|
|
return !s_data->IsPassive();
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::UpdateSkillStatus( int nSkillStatus, QUICK_SKILL* pSlot )
|
|
{
|
|
if( pSlot == NULL )
|
|
{
|
|
assert( false );
|
|
return;
|
|
}
|
|
|
|
if( nSkillStatus == TS_SC_SKILL::FIRE )
|
|
{
|
|
if( pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON &&
|
|
pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON_BY_USER )
|
|
pSlot->SetStateQuickSlot( QUICK_SKILL::STATE_FIRE );
|
|
}
|
|
else if( nSkillStatus == TS_SC_SKILL::CASTING )
|
|
{
|
|
if( pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON &&
|
|
pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON_BY_USER )
|
|
pSlot->SetStateQuickSlot( QUICK_SKILL::STATE_CASTING );
|
|
}
|
|
else if( nSkillStatus == TS_SC_SKILL::CANCEL )
|
|
{
|
|
if( pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON &&
|
|
pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON_BY_USER )
|
|
pSlot->SetStateQuickSlot( QUICK_SKILL::STATE_CANCEL );
|
|
}
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::UpdateSkillToggle( int nStatus, QUICK_SKILL* pSlot )
|
|
{
|
|
if( pSlot == NULL )
|
|
{
|
|
assert( false );
|
|
return;
|
|
}
|
|
|
|
pSlot->SetStateQuickSlot( (QUICK_SKILL::STATE_QUICK_SLOT)nStatus );
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::RefreshQuickEffect( int nSlot, QUICK_SKILL* pQuickSkill )
|
|
{
|
|
if( nSlot >= QUICK_SLOT_MAX && nSlot < 0 )
|
|
{
|
|
assert( false );
|
|
return;
|
|
}
|
|
|
|
int nOldSkillID = m_vToggleQuickSlotList[nSlot];
|
|
m_vToggleQuickSlotList[nSlot] = 0;
|
|
|
|
//큇슬롯 상태 설정
|
|
KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", nSlot ).c_str() );
|
|
if( !pSlotEffect ) return;
|
|
|
|
if( pQuickSkill == NULL )
|
|
{
|
|
pSlotEffect->Cancel();
|
|
DeleteToggleQuickSlotList( nOldSkillID );
|
|
return;
|
|
}
|
|
|
|
if( pQuickSkill->GetStateQuickSlot() == QUICK_SKILL::STATE_TOGGLE_ON_BY_USER )
|
|
m_vToggleQuickSlotList[nSlot] = pQuickSkill->m_nSkillID;
|
|
|
|
if( m_vToggleQuickSlotList[nSlot] != nOldSkillID )
|
|
DeleteToggleQuickSlotList( nOldSkillID );
|
|
|
|
switch( pQuickSkill->GetStateQuickSlot() )
|
|
{
|
|
case QUICK_SKILL::STATE_NONE:
|
|
{
|
|
pSlotEffect->Cancel();
|
|
}
|
|
break;
|
|
case QUICK_SKILL::STATE_CASTING:
|
|
{
|
|
if( !pSlotEffect->IsToggleOn() )
|
|
{
|
|
pSlotEffect->Cast(0);
|
|
}
|
|
}
|
|
break;
|
|
case QUICK_SKILL::STATE_FIRE:
|
|
{
|
|
if( !pSlotEffect->IsToggleOn() )
|
|
{
|
|
pSlotEffect->Cancel();
|
|
}
|
|
}
|
|
break;
|
|
case QUICK_SKILL::STATE_CANCEL:
|
|
{
|
|
if( !pSlotEffect->IsToggleOn() )
|
|
pSlotEffect->Cancel();
|
|
}
|
|
break;
|
|
case QUICK_SKILL::STATE_TOGGLE_ON_BY_USER:
|
|
case QUICK_SKILL::STATE_TOGGLE_ON:
|
|
{
|
|
if( !pSlotEffect->IsToggleOn() )
|
|
pSlotEffect->ToggleOn(true);
|
|
}
|
|
break;
|
|
case QUICK_SKILL::STATE_TOGGLE_OFF_BY_USER:
|
|
case QUICK_SKILL::STATE_TOGGLE_OFF:
|
|
{
|
|
pSlotEffect->ToggleOn(false);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::SkillToggleMode( int nQuickSlotNum )
|
|
{
|
|
if( QUICK_SLOT_MAX <= nQuickSlotNum ) return;
|
|
|
|
AR_HANDLE hCreature = m_CreatureSlotMgr.GetActiveCreatureQuickSlot();
|
|
|
|
QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( hCreature, nQuickSlotNum );
|
|
if( pSlot == NULL )
|
|
{
|
|
assert( false );
|
|
return;
|
|
}
|
|
|
|
if( pSlot->GetStateQuickSlot() == QUICK_SKILL::STATE_TOGGLE_ON ||
|
|
pSlot->GetStateQuickSlot() == QUICK_SKILL::STATE_TOGGLE_OFF) return;
|
|
|
|
SkillBaseEx * pSkillBase = GetSkillDB().GetSkillData( pSlot->m_nSkillID );
|
|
if( pSkillBase == NULL )
|
|
{
|
|
assert( false );
|
|
return;
|
|
}
|
|
|
|
//토글형 스킬이냐?
|
|
if( pSkillBase->IsToggle() ) return;
|
|
if( pSkillBase->IsHarmful() == false ) return;
|
|
if( pSkillBase->IsPassive() ) return;
|
|
|
|
if( pSlot->GetStateQuickSlot() != QUICK_SKILL::STATE_TOGGLE_ON_BY_USER )
|
|
pSlot->SetStateQuickSlot( QUICK_SKILL::STATE_TOGGLE_ON_BY_USER );
|
|
else
|
|
pSlot->SetStateQuickSlot( QUICK_SKILL::STATE_TOGGLE_OFF_BY_USER );
|
|
|
|
RefreshQuickEffect( nQuickSlotNum, pSlot );
|
|
}
|
|
|
|
void SUIHCreatureQuickSlotWnd::DeleteToggleQuickSlotList( int nSkillID )
|
|
{
|
|
if( nSkillID != 0 )
|
|
{
|
|
std::vector< UsingSkill >::iterator result = std::find( m_vUseSkillList.begin(), m_vUseSkillList.end(), nSkillID );
|
|
if( result != m_vUseSkillList.end() )
|
|
{
|
|
m_vUseSkillList.erase( result );
|
|
}
|
|
}
|
|
}*/ |