1526 lines
57 KiB
C++
1526 lines
57 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "KUIDragAndDrop.h"
|
|
//#include "KUIControl.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlButton.h"
|
|
#include "KUIControlScroll.h"
|
|
#include "KUIControlGauge.h"
|
|
|
|
#include "SUIEquipCreatureWnd.h"
|
|
//#include "Util.h"
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SCreatureDB.h"
|
|
#include "SItemDB.h"
|
|
#include "SStringDB.h"
|
|
#include "SSummonSlotMgr.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "SInventoryMgr.h"
|
|
#include "MonsterBase.h"
|
|
|
|
#include "SUIDisplayInfo.h"
|
|
|
|
#include "SSKillSlot.h" //크리처의 유니트 컨트롤 렙을 알기 위해서 추가 -N4-
|
|
#include "SUISysMsgDefine.h"
|
|
#include "SGame.h"
|
|
|
|
#include "SUIInventoryWnd.h"
|
|
|
|
#include "KUITipControl.h"
|
|
#include "SCreatureEnhanceDB.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
//#include "SUIUtil.h"
|
|
|
|
#include "Durability.h"
|
|
#include "SUILazyTooltip.h"
|
|
#include "SGameSystem.h"
|
|
extern SGameSystem * g_pCurrentGameSystem;
|
|
|
|
namespace
|
|
{
|
|
const int c_nDelta = 164;
|
|
const int c_nMaxLine = 3;
|
|
const int c_nMaxItem = SCreatureSlotMgr::MAX_CREATURE_SLOT;
|
|
const KRect c_TopWndRect(0, 55, 290, 55 + c_nDelta);
|
|
const KRect c_MiddleWndRect(0, 55 + c_nDelta, 290, 55 + (c_nDelta * 2));
|
|
const KRect c_ButtomWndRect(0, 55 + (c_nDelta * 2), 290, 55 + (c_nDelta * 3));
|
|
int c_nSelectSlot = 0; // 2011.06.02 - servantes // 선택 슬롯번호 저장용
|
|
|
|
|
|
const int c_nCreatureCountMax = 6;
|
|
const int c_nCreatureMaxItem = SCreatureSlotMgr::MAX_CREATURE_SLOT;
|
|
};
|
|
|
|
bool SUIEquipCreatureWnd::InitControls( KPoint kPos )
|
|
{
|
|
// 커스텀 윈도우 move 영역 설정
|
|
SetCustomMovingRect( KRect( 0, 0, 312, 20 ) );
|
|
|
|
// init org child wnd
|
|
KUIControlMultiIcon* pInitIcon = NULL;
|
|
pInitIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( "creatureform_cardslot00" ) );
|
|
if( pInitIcon )
|
|
pInitIcon->SetIconLayer(8);
|
|
|
|
pInitIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( "creature_faceicon00" ) );
|
|
if( pInitIcon )
|
|
pInitIcon->SetIconLayer(4);
|
|
|
|
CreateSlots();
|
|
InitIconToolTip();
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
bool SUIEquipCreatureWnd::InitData( bool bReload )
|
|
{
|
|
m_nSelSlotNum = -1;
|
|
m_nScrollPos = 0;
|
|
|
|
::memset( m_hCreatureCardHandle, 0, sizeof(m_hCreatureCardHandle) );
|
|
|
|
SetChildShow( "static_select_click", false );
|
|
SetChildShow( "static_select_clickback", false );
|
|
|
|
for( int i(0); 3>i; i++ )
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat( "button_up_summon%02d" , i ).c_str(), false );
|
|
SetChildShow( CStringUtil::StringFormat( "button_down_summon%02d" , i ).c_str(), false );
|
|
}
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
KUIControlStatic* pGauge = dynamicCast<KUIControlStatic*>( GetChild( "creature_card_durabillity_gauge00" ) );
|
|
if( pGauge )
|
|
m_fGaugeWidth = pGauge->GetRect().GetWidth();
|
|
*/
|
|
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
void SUIEquipCreatureWnd::OnRefresh( SGameMessage* pMsg )
|
|
{
|
|
if( IsShow() )
|
|
RefreshSlots( m_nScrollPos );
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 생성
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIEquipCreatureWnd::CreateSlots()
|
|
{
|
|
RECT rc;
|
|
rc.left = 0; rc.top = c_nDelta+4; rc.right = 0; rc.bottom = c_nDelta+4;
|
|
|
|
KUIControlMultiIcon* pCopyedIcon = NULL;
|
|
for( int i = 0; i < 2; i++ )
|
|
{
|
|
//공통 컨트롤
|
|
CopyControl( CStringUtil::StringFormat( "static_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "button_up_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "button_up_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "button_down_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "button_down_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "static_outframe_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_outframe_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "static_outicon_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_outicon_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "static_lv_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_lv_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "static_jp_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_jp_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "static_maxhp_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_maxhp_summon%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "static_maxmp_summon%02d" , i ).c_str(), CStringUtil::StringFormat( "static_maxmp_summon%02d" , i+1 ).c_str(), rc );
|
|
|
|
// 카드슬롯
|
|
CopyControl( CStringUtil::StringFormat( "creatureform_cardslot%02d" , i ).c_str(), CStringUtil::StringFormat( "creatureform_cardslot%02d" , i+1 ).c_str(), rc );
|
|
pCopyedIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( CStringUtil::StringFormat( "creatureform_cardslot%02d",i ).c_str() ) );
|
|
if( pCopyedIcon )
|
|
pCopyedIcon->SetIconLayer( 8 );
|
|
|
|
|
|
// 오버브리드
|
|
CopyControl( CStringUtil::StringFormat( "mark_overbreed_%02d" , i ).c_str(), CStringUtil::StringFormat( "mark_overbreed_%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "text_overbreed_%02d" , i ).c_str(), CStringUtil::StringFormat( "text_overbreed_%02d" , i+1 ).c_str(), rc );
|
|
|
|
// 진화 마크 아이콘
|
|
CopyControl( CStringUtil::StringFormat( "creature_monster_mark_evolution_%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_monster_mark_evolution_%02d" , i+1 ).c_str(), rc );
|
|
|
|
// 크리처슬롯
|
|
CopyControl( CStringUtil::StringFormat( "creature_faceicon%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_faceicon%02d" , i+1 ).c_str(), rc );
|
|
pCopyedIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( CStringUtil::StringFormat( "creature_faceicon%02d",i ).c_str() ) );
|
|
if( pCopyedIcon )
|
|
pCopyedIcon->SetIconLayer( 4 );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "creature_lv_number%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_lv_number%02d" , i+1 ).c_str(), rc );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "creature_exp_number%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_exp_number%02d" , i+1 ).c_str(), rc );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "creature_jp_number%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_jp_number%02d" , i+1 ).c_str(), rc );
|
|
|
|
// 크리처스탯
|
|
CopyControl( CStringUtil::StringFormat( "creature_grade%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_grade%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "creature_name_text%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_name_text%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "creature_customname_text%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_customname_text%02d" , i+1 ).c_str(), rc );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "creature_maxsp_number%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_maxsp_number%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "creature_maxhp_number%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_maxhp_number%02d" , i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "creature_maxmp_number%02d" , i ).c_str(), CStringUtil::StringFormat( "creature_maxmp_number%02d" , i+1 ).c_str(), rc );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "number_%02d" , i ).c_str(), CStringUtil::StringFormat( "number_%02d" , i+1 ).c_str(), rc );
|
|
|
|
for( int j = 0; j < c_nMaxItem; j++ )
|
|
CopyControl( CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", j, i ).c_str(), CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", j , i+1 ).c_str(), rc );
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
for( int j = 0; j < c_nCreatureMaxItem; j++ )
|
|
{
|
|
CopyControl( CStringUtil::StringFormat( "guage_slot_%02d_base_%02d", j, i ).c_str(), CStringUtil::StringFormat( "guage_slot_%02d_base_%02d", j, i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "creature_slot_%02d_durabillity_gauge%02d", j, i ).c_str(), CStringUtil::StringFormat( "creature_slot_%02d_durabillity_gauge%02d", j, i+1 ).c_str(), rc );
|
|
}
|
|
|
|
KUIControlStatic* pGaugeBase = dynamicCast<KUIControlStatic*>( GetChild( "creature_slot_06_durabillity_gauge00" ) );
|
|
if( pGaugeBase )
|
|
pGaugeBase->SetShow( false );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "guage_base_%02d", i ).c_str(), CStringUtil::StringFormat( "guage_base_%02d", i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "creature_card_durabillity_gauge%02d", i ).c_str(), CStringUtil::StringFormat( "creature_card_durabillity_gauge%02d", i+1 ).c_str(), rc );
|
|
|
|
CopyControl( CStringUtil::StringFormat( "text_%02d", i ).c_str(), CStringUtil::StringFormat( "text_%02d", i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "text_allrepair_%02d", i ).c_str(), CStringUtil::StringFormat( "text_allrepair_%02d", i+1 ).c_str(), rc );
|
|
CopyControl( CStringUtil::StringFormat( "button_allrepair_%02d", i ).c_str(), CStringUtil::StringFormat( "button_allrepair_%02d", i+1 ).c_str(), rc );
|
|
*/
|
|
|
|
|
|
}
|
|
|
|
//활성화 비활성화 있는 StaticControl들 Enable가능하게 쎄팅하는 함수 호출
|
|
OnControlEnablOption();
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::EnableSlot( int nPos, bool bEnable )
|
|
{
|
|
//KUIControlIconStatic* pIcon = NULL;
|
|
KUIControlMultiIcon* pIcon = NULL;
|
|
|
|
pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creatureform_cardslot%02d", nPos ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetIconLayer( 8 );
|
|
ResetMultiIcon( pIcon, 0, 8 );
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" );
|
|
pIcon->SetTooltip();
|
|
}
|
|
|
|
pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_faceicon%02d", nPos ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetIconLayer( 4 );
|
|
ResetMultiIcon( pIcon, 0, 4 );
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" );
|
|
pIcon->SetTooltip();
|
|
}
|
|
|
|
// 카드슬롯
|
|
SetChildShow( CStringUtil::StringFormat( "creatureform_cardslot%02d" , nPos ).c_str(), true );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "mark_overbreed_%02d" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "text_overbreed_%02d" , nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_monster_mark_evolution_%02d" , nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_faceicon%02d" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_lv_number%02d", nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_exp_number%02d" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_jp_number%02d" , nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_grade%02d" , nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_name_text%02d" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_customname_text%02d" , nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_maxsp_number%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_maxhp_number%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_maxmp_number%02d", nPos ).c_str(), bEnable );
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
SetChildShow( CStringUtil::StringFormat( "gauge_frame_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_card_durabillity_gauge%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "text_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "text_allrepair_%02d" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "button_allrepair_%02d" , nPos ).c_str(), bEnable );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "guage_base_%02d" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "guage_slot_01_base_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "guage_slot_02_base_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "guage_slot_03_base_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "guage_slot_04_base_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "guage_slot_05_base_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "guage_slot_06_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow( CStringUtil::StringFormat("guage_slot_07_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow( CStringUtil::StringFormat("guage_slot_08_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow(CStringUtil::StringFormat("guage_slot_09_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow(CStringUtil::StringFormat("guage_slot_10_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow(CStringUtil::StringFormat("guage_slot_11_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow(CStringUtil::StringFormat("guage_slot_12_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow(CStringUtil::StringFormat("guage_slot_13_base_%02d", nPos).c_str(), bEnable);
|
|
SetChildShow(CStringUtil::StringFormat("guage_slot_14_base_%02d", nPos).c_str(), bEnable);
|
|
|
|
*/
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "static_maxhp_summon" , nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "static_maxmp_summon" , nPos ).c_str(), bEnable );
|
|
|
|
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "number_%02d", nPos ).c_str(), bEnable );
|
|
SetChildShow( CStringUtil::StringFormat( "mark_durability_%02d", nPos ).c_str(), bEnable );
|
|
|
|
if( bEnable )
|
|
{
|
|
for( int i = 0; i < c_nMaxItem; i++ )
|
|
{
|
|
KUIControlMultiIcon* pMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", i, nPos ).c_str() ));
|
|
if( pMultiIcon )
|
|
{
|
|
pMultiIcon->SetShow(bEnable);
|
|
pMultiIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_skillcardicon" );
|
|
pMultiIcon->SetIcon( 1 );
|
|
pMultiIcon->SetIcon( 3 );
|
|
// pMultiIcon->SetIcon( 4 ); // 왠 4????
|
|
pMultiIcon->SetTooltip();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for( int i = 0; i < c_nMaxItem; i++ )
|
|
SetChildShow( CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", i, nPos ).c_str() );
|
|
}
|
|
}
|
|
|
|
|
|
void SUIEquipCreatureWnd::InitIconToolTip()
|
|
{
|
|
KUIControlIconStatic* pIcon = NULL;
|
|
|
|
for( int i = 0; i < c_nMaxLine; i++ )
|
|
{
|
|
// 카드 슬롯
|
|
for( int j = 0; j < c_nMaxItem; j++ )
|
|
{
|
|
KUIControlMultiIcon* pMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", j, i ).c_str() ));
|
|
if( pMultiIcon )
|
|
pMultiIcon->SetIconLayer(4);
|
|
}
|
|
}
|
|
}
|
|
void* SUIEquipCreatureWnd::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();
|
|
|
|
int nCreatureSlotForItem = GetItemSlotIndex( szControlID );
|
|
if( nCreatureSlotForItem == -1 ) return NULL;
|
|
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
|
|
if( pIcon == NULL ) return NULL;
|
|
|
|
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pIcon->GetIconInfoByLayer(0);
|
|
m_pDragAndDropIcon->SetStateIcon( pIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
|
|
|
|
m_pDisplayInfo->SetUIDragInfo( new SUIEquipCreatureInfo( m_CreatureSlotMgr.GetEquipedCreature(nCreatureSlotForItem), GetItemInCreature(m_nScrollPos, nCreatureSlotForItem, szControlID) ) );
|
|
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;
|
|
|
|
m_pDisplayInfo->SetUIDragInfo();
|
|
return NULL;
|
|
}
|
|
else if ( id == id_UI_RECV_DROP )
|
|
{
|
|
SUIDragInfo* pDragInfo = m_pDisplayInfo->GetUIDragInfo();
|
|
if( pDragInfo == NULL ) return NULL;
|
|
if( pDragInfo->m_type != SUIDragInfo::DRAGTYPE_INVENITEM ) return NULL;
|
|
|
|
KUISendRecvDropMessage* pDropMsg = static_cast<KUISendRecvDropMessage*>( &msg );
|
|
|
|
// 크리처 슬롯인지, 아이템 슬롯인지 검사
|
|
// int nCreatureSlot = GetCardSlotIndex( pDropMsg->sRecvDropControlID.c_str() );
|
|
int nCreatureSlotForItem = GetItemSlotIndex( pDropMsg->sRecvDropControlID.c_str() );
|
|
|
|
// if( nCreatureSlot >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return NULL;
|
|
if( nCreatureSlotForItem >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return NULL;
|
|
|
|
SUIInvenItemDragInfo* pInvenInfo = ( SUIInvenItemDragInfo* )pDragInfo;
|
|
if( pInvenInfo == NULL ) return NULL;
|
|
|
|
// 유효한 카드 아이템인지 검사
|
|
if( IsEnableEquipCardItem(pInvenInfo->m_hItem) )
|
|
{
|
|
int nCreatureSlot = GetEmptySlot();//GetCreatureSlotIndex(pDropMsg->ptDropPos.x, pDropMsg->ptDropPos.y);
|
|
EquipCreatureCard( nCreatureSlot, pInvenInfo->m_hItem );
|
|
RequestEquipCreature();
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
|
|
|
|
UISendStringMessage(m_pGameManager, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY, "refresh_durability");
|
|
}
|
|
|
|
if( nCreatureSlotForItem != -1 ) // 크리처 아이템에
|
|
{
|
|
// 유효한 장비 아이템인지 검사
|
|
if( !IsEnableEquipItem( pInvenInfo->m_hItem ) ) return NULL;
|
|
|
|
RequestEquipItem( nCreatureSlotForItem, pInvenInfo->m_hItem );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
|
|
|
|
UISendStringMessage(m_pGameManager, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY, "refresh_durability");
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
return SUIWnd::Perform( id, msg );
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
// 2011.05.02 - servantes
|
|
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
|
|
{
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++ )
|
|
m_hCreatureCardHandle[i] = m_CreatureSlotMgr.GetEquipedCreatureCard(i);
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, false ) ); // 크리처 편성창
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "creatureform_formcancle_botton" ) == 0 )
|
|
{
|
|
RequestEquipCreature( true );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_LAST_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, true ) ); // 2011.06.02 - servantes // 크리처 편성창
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_up_summon00" ) == 0 || ::_stricmp( lpszControlID, "button_up_summon01" ) == 0 )
|
|
{
|
|
if(m_bFixedCreatureSlot)
|
|
break;
|
|
|
|
SwapCreatureInfo(false);
|
|
if (RequestEquipCreature())
|
|
unSelectCreature(); /// 2011.06.07 - prodongi
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_up_summon02" ) == 0 )
|
|
{
|
|
SwapCreatureInfo(false);
|
|
if (RequestEquipCreature())
|
|
unSelectCreature(); /// 2011.06.07 - prodongi
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_down_summon00" ) == 0 || ::_stricmp( lpszControlID, "button_down_summon01" ) == 0 )
|
|
{
|
|
if(m_bFixedCreatureSlot)
|
|
break;
|
|
|
|
SwapCreatureInfo();
|
|
if (RequestEquipCreature())
|
|
unSelectCreature(); /// 2011.06.07 - prodongi
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_down_summon02" ) == 0 )
|
|
{
|
|
SwapCreatureInfo();
|
|
if (RequestEquipCreature())
|
|
unSelectCreature(); /// 2011.06.07 - prodongi
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "creatureform_confirm_button" ) == 0 ) //servantes 2010.10.13
|
|
{
|
|
RequestEquipCreature();
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, false ) ); // 크리처 편성창
|
|
}
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
else if( ::strncmp( lpszControlID, "button_allrepair_", strlen("button_allrepair_") ) == 0 )
|
|
{
|
|
SDurability sDurability(false);
|
|
float fSendPercent = sDurability.calculate(&m_PlayerInfoMgr, &m_InventoryMgr, &m_CreatureSlotMgr);
|
|
|
|
// 메세지전송
|
|
TS_CS_TRANSMIT_ETHEREAL_DURABILITY_TO_EQUIPMENT msg;
|
|
msg.target = m_CreatureSlotMgr.GetEquipedCardIndexByCreature( m_CreatureSlotMgr.GetSelectedCreature() ) + 1; // 0은 플레이어 크리처는 인덱스 + 1 해야한다
|
|
msg.percent = fSendPercent / 100.0f;
|
|
this->m_pGameManager->PendMessage( &msg );
|
|
}
|
|
*/
|
|
|
|
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KICON_DBLCLK:
|
|
{
|
|
m_pGameManager->StartSound( "ui_button_click.wav" );
|
|
|
|
for( int i = 0; i < c_nMaxLine; i++ )
|
|
{
|
|
if( ::_stricmp( lpszControlID, CStringUtil::StringFormat( "creatureform_cardslot%02d", i ).c_str() ) == 0 )
|
|
{
|
|
if( SelectCreature( i, true ) )
|
|
{
|
|
if (RequestEquipCreature( true ))
|
|
unSelectCreature(); /// 2011.06.07 - prodongi
|
|
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_LAST_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, true ) ); // 2011.06.03 - servantes // 크리처 편성창
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KGENWND_MOVE:
|
|
LimitMoveWnd();
|
|
break;
|
|
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택
|
|
{
|
|
m_nSelSlotNum = -1;
|
|
|
|
int nPos = int(lparam);
|
|
nPos = max( nPos, 0 );
|
|
m_nScrollPos = nPos;
|
|
RefreshSlots(nPos);
|
|
/// 2011.06.07 SelectCreature대신 syncSelectButton 사용 - prodongi
|
|
//SelectCreature(nPos, false);
|
|
syncSelectButton(m_nCurrentSelectCreature); /// 2011.06.07 - prodongi
|
|
|
|
RefreshSlots(m_nScrollPos);
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KFOCUS_ACTIVATED:
|
|
{
|
|
int index = GetCreatureSlotIndex(lparam, wparam);
|
|
if( index != -1 )
|
|
{
|
|
if (!SelectCreature( index, true ))
|
|
break;
|
|
}
|
|
|
|
// 2011.05.25 - servantes
|
|
if(m_nCurrentSelectCreature > -1)
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, m_nCurrentSelectCreature ) ); // 크리처 편성창
|
|
}
|
|
else
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, -1 ) ); // 크리처 미니 편성창
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
// 2011.05.25 - servantes
|
|
case IMSG_UI_SET_MAIN_CREATURE_2ND: // 메인 크리처를 선택을 알려준다
|
|
{
|
|
SIMSG_SET_MAIN_CREATURE* pMsgSetMain = (SIMSG_SET_MAIN_CREATURE*)pMsg;
|
|
|
|
int hMainCreatureID = pMsgSetMain->nIndex;
|
|
AR_HANDLE hMainCreature = (AR_HANDLE)pMsgSetMain->hCreature;
|
|
|
|
if(hMainCreatureID == -1) // 핸들 검사
|
|
{
|
|
for(int h=0; h<SCreatureSlotMgr::MAX_SUMMON_SLOT; h++) // 보조크리처 인덱스 찾기
|
|
{
|
|
if(m_hCreatureCardHandle[h] == hMainCreature)
|
|
{
|
|
SelectCreature(h);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else // 무조건 0번 선택
|
|
{
|
|
SelectCreature(0);
|
|
}
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_SELECT_CREATURE_2ND: //2011.05.25 - servantes // 크리처를 선택 미니 편성창에 선택한 번호를 알려준다
|
|
{
|
|
SIMSG_SELECT_CREATURE_2ND* pMsgSelect = (SIMSG_SELECT_CREATURE_2ND*)pMsg;
|
|
|
|
// 2011.06.02 - servantes
|
|
bool bSelect = false;
|
|
int h=0;
|
|
for(h=0; h<SCreatureSlotMgr::MAX_CREATURE_SLOT; h++) // 보조크리처 인덱스 찾기
|
|
{
|
|
if(m_hCreatureCardHandle[h] == pMsgSelect->hCreature)
|
|
{
|
|
bSelect = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(bSelect && h >= m_nScrollPos && h < m_nScrollPos+3)
|
|
{
|
|
c_nSelectSlot = h - m_nScrollPos; // 선택 슬롯번호 저장용
|
|
SelectCreature(c_nSelectSlot, true); // 선택 슬롯 활성화
|
|
}
|
|
else
|
|
SelectCreature(c_nSelectSlot, false); // 전에 선택했던 번호 비활성화
|
|
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_FIXED_CREATURESLOT: // 2011.05.02 - servantes
|
|
{
|
|
SIMSG_FIXED_CREATURE_SLOT* pFixedMsg = (SIMSG_FIXED_CREATURE_SLOT*)pMsg;
|
|
m_bFixedCreatureSlot = pFixedMsg->bFiexd;
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_EQUIP_SUMMON: // 장착하고 있는 크리처 핸들 받기
|
|
{
|
|
SMSG_EQUIP_SUMMON* pEquipMsg = (SMSG_EQUIP_SUMMON*)pMsg;
|
|
::memcpy( m_hCreatureCardHandle, pEquipMsg->card_handle, sizeof(m_hCreatureCardHandle) );
|
|
|
|
RefreshSlots( m_nScrollPos );
|
|
|
|
SUIInventoryWnd* pInventoryWnd( dynamicCast<SUIInventoryWnd*>( m_pGameManager->GetSUI( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY ) ) );
|
|
if (NULL == pInventoryWnd)
|
|
{
|
|
SDEBUGLOG( "[SUIEquipCreatureWnd] Can't Get Inventory Window" );
|
|
assert( n64UniqueID );
|
|
return;
|
|
}
|
|
|
|
pInventoryWnd->RefreshInvenSlots();
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_ITEM_WEAR_INFO:
|
|
{
|
|
SMSG_ITEM_WEAR_INFO* pWearMsg = ( SMSG_ITEM_WEAR_INFO* )pMsg;
|
|
if( !m_PlayerInfoMgr.IsLocalPlayer(pWearMsg->target_handle) )
|
|
// 크리처의 핸들이면. 추가..
|
|
RefreshSlots( m_nScrollPos );
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_REQUEST_EQUIP_SUMMON:
|
|
{
|
|
SMSG_REQUEST_EQUIP_SUMMON* pRequsetEquipMsg = (SMSG_REQUEST_EQUIP_SUMMON*)pMsg;
|
|
int nSlot = GetEmptySlot();
|
|
|
|
int UnitControlLv(0);
|
|
UnitControlLv = m_SkillSlotMgr.GetCurrentSkillLevel( 1801 ); //1801 -> 크리처 컨트롤 스킬 아이디 값
|
|
if( nSlot == -1 || UnitControlLv <= nSlot )
|
|
{
|
|
// m_pGame->SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_PUT_ITEM_FAIL ) ); 크리처를 장착할 슬롯이 없습니다
|
|
break;
|
|
}
|
|
if( pRequsetEquipMsg->card_handle != 0 )
|
|
{
|
|
EquipCreatureCard(nSlot, pRequsetEquipMsg->card_handle);
|
|
RefreshSlots( m_nScrollPos );
|
|
RequestEquipCreature();
|
|
pMsg->bUse = true;
|
|
}
|
|
}
|
|
break;
|
|
case MSG_CHANGE_NAME:
|
|
{
|
|
RefreshSlots( m_nScrollPos );
|
|
}
|
|
break;
|
|
case MSG_LEVEL_UPDATE:
|
|
{
|
|
RefreshSlots( m_nScrollPos );
|
|
}
|
|
break;
|
|
case IMSG_UI_TARGET_STAT:
|
|
{
|
|
RefreshSlots( m_nScrollPos );
|
|
}
|
|
break;
|
|
case MSG_ITEM_INVEN:
|
|
{
|
|
RefreshSlots( m_nScrollPos );
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 스크롤 바
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIEquipCreatureWnd::RefreshScrollbar()
|
|
{
|
|
KUIControlVScroll* pScrollBar = dynamicCast<KUIControlVScroll*>(GetChild( "creatureform_scroll" ));
|
|
if( NULL != pScrollBar )
|
|
{
|
|
pScrollBar->SetMaxRange( DWORD(c_nMaxLine+1) );
|
|
|
|
m_nScrollPos = pScrollBar->GetPosition();
|
|
pScrollBar->SetPosition( m_nScrollPos );
|
|
}
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 편성
|
|
//////////////////////////////////////////////////////////////////////////
|
|
bool SUIEquipCreatureWnd::RequestEquipCreature( bool bCancel )
|
|
{
|
|
m_pGameManager->StartSound( "ui_button_click.wav" );
|
|
|
|
if( bCancel && m_nSelSlotNum == -1 ) return false;
|
|
|
|
SIMSG_UI_ACT_EQUIP_SUMMON actEquipSummonMsg;
|
|
|
|
if( !bCancel ) // 편성
|
|
{
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++ )
|
|
actEquipSummonMsg.card_handle[i] = m_hCreatureCardHandle[i];
|
|
}
|
|
else // 편성 취소
|
|
{
|
|
int nCurSlotNum = m_nSelSlotNum + m_nScrollPos;
|
|
if( nCurSlotNum < SCreatureSlotMgr::MAX_CREATURE_SLOT && nCurSlotNum > -1 )
|
|
{
|
|
AR_HANDLE hCreature(NULL);
|
|
hCreature = m_CreatureSlotMgr.GetEquipedCreature(m_hCreatureCardHandle[nCurSlotNum]);
|
|
if( hCreature )
|
|
{
|
|
if( m_CreatureSlotMgr.IsExistSummonedCreature(hCreature) )
|
|
{
|
|
SGame* pGame = m_pGameManager->GetActiveGame();
|
|
if( pGame )
|
|
pGame->SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_CREATURE_REMOVE_ERR ) ); //소환된 크리처 입니다.
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// 선택 카드가 존재하면 편성취소와 동시에 편성이 된다
|
|
if( m_CreatureSlotMgr.IsExistCreatureCard( m_hCreatureCardHandle[nCurSlotNum] ) )
|
|
m_hCreatureCardHandle[nCurSlotNum] = NULL;
|
|
else
|
|
{
|
|
m_hCreatureCardHandle[nCurSlotNum] = NULL;
|
|
EnableSlot( m_nSelSlotNum, false );
|
|
return false;
|
|
}
|
|
}
|
|
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++ )
|
|
actEquipSummonMsg.card_handle[i] = m_hCreatureCardHandle[i];
|
|
}
|
|
|
|
m_pGameManager->ProcMsgAtStatic( &actEquipSummonMsg );
|
|
m_nSelSlotNum = -1;
|
|
return true;
|
|
}
|
|
|
|
int SUIEquipCreatureWnd::GetEmptySlot()
|
|
{
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++ )
|
|
{
|
|
if( m_hCreatureCardHandle[i] == 0 )
|
|
return i; //등록되지 않은 슬롯중 제일 앞의 슬롯
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
void SUIEquipCreatureWnd::EquipCreatureCard( int nPos, AR_HANDLE hCardItem )
|
|
{
|
|
if( hCardItem == NULL ) return;
|
|
|
|
if( nPos < 0 || nPos >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return;
|
|
|
|
// 이 위치에 카드가 존재한다면, 이 카드가 가짜 카드인지 진짜 카드인지 검사
|
|
if( m_hCreatureCardHandle[nPos] && m_CreatureSlotMgr.IsExistCreatureCard(m_hCreatureCardHandle[nPos]) )
|
|
return;
|
|
|
|
// 이 카드가 슬롯에 존재한다면 바꿔준다
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++ )
|
|
{
|
|
if( m_hCreatureCardHandle[i] == hCardItem )
|
|
{
|
|
m_hCreatureCardHandle[i] = NULL;
|
|
EnableSlot( i-m_nScrollPos, false );
|
|
}
|
|
}
|
|
|
|
m_hCreatureCardHandle[nPos] = hCardItem;
|
|
RefreshCardSlot( nPos-m_nScrollPos, hCardItem );
|
|
|
|
SelectCreature( nPos, true );
|
|
// m_nSelSlotNum = -1;
|
|
}
|
|
void SUIEquipCreatureWnd::SwapCreatureInfo( bool bDown )
|
|
{
|
|
if( m_nSelSlotNum == -1 ) return;
|
|
|
|
int UnitControlLv(0);
|
|
UnitControlLv = m_SkillSlotMgr.GetCurrentSkillLevel( 1801 ); //1801 -> 크리처 컨트롤 스킬 아이디 값
|
|
|
|
// 2011.04.18 - servantes
|
|
m_nCurrentSelectCreature = m_nSelSlotNum + m_nScrollPos;
|
|
if( m_nCurrentSelectCreature < 0 || m_nCurrentSelectCreature >= SCreatureSlotMgr::MAX_CREATURE_SLOT )
|
|
return;
|
|
if( bDown && m_nCurrentSelectCreature == SCreatureSlotMgr::MAX_CREATURE_SLOT-1 )
|
|
return;
|
|
if( !bDown && m_nCurrentSelectCreature == 0 )
|
|
return;
|
|
if( bDown && UnitControlLv <= m_nCurrentSelectCreature+1 )
|
|
return; //이 조건에 만족하면 크리처를 편성할 수 없는 창으로 넘어가게 되는 것이기에 return;
|
|
|
|
int nSwapPos = m_nCurrentSelectCreature;
|
|
AR_HANDLE hTemp = m_hCreatureCardHandle[ m_nCurrentSelectCreature ];
|
|
|
|
if( bDown )
|
|
{
|
|
nSwapPos += 1;
|
|
m_hCreatureCardHandle[ m_nCurrentSelectCreature ] = m_hCreatureCardHandle[ nSwapPos ];
|
|
m_hCreatureCardHandle[ nSwapPos ] = hTemp;
|
|
m_nSelSlotNum += 1;
|
|
m_nCurrentSelectCreature = nSwapPos;
|
|
}
|
|
else
|
|
{
|
|
nSwapPos -= 1;
|
|
m_hCreatureCardHandle[ m_nCurrentSelectCreature ] = m_hCreatureCardHandle[ nSwapPos ];
|
|
m_hCreatureCardHandle[ nSwapPos ] = hTemp;
|
|
m_nSelSlotNum -= 1;
|
|
m_nCurrentSelectCreature = nSwapPos;
|
|
}
|
|
|
|
RefreshSlots( m_nScrollPos, true );
|
|
|
|
SelectCreature( m_nSelSlotNum, true );
|
|
|
|
// 2011.05.20 - servantes
|
|
int findIndex = 0;
|
|
if( m_CreatureSlotMgr.GetSummonedCreatureCount() == 2)
|
|
findIndex = 1;
|
|
|
|
int index=0;
|
|
bool bExistCreature = false; // 2011.05.24 - servantes
|
|
AR_HANDLE hSummonCreature = m_CreatureSlotMgr.GetSummonedCreature(findIndex);
|
|
for( int i = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++ )
|
|
{
|
|
AR_HANDLE hCreture = m_CreatureSlotMgr.GetEquipedCreature( m_hCreatureCardHandle[i] );
|
|
if(hSummonCreature == hCreture && hCreture != 0) // 2011.05.25 - servantes
|
|
{
|
|
bExistCreature = true;
|
|
index = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(bExistCreature) // 2011.05.24 - servantes // 소환한 크리처가 있을 경우
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, -1, hSummonCreature ) ); // 2011.05.20 - servantes // 크리처 편성창
|
|
else // 2011.05.25 - servantes // 소환한 크리처가 없을 경우
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_MAIN_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, index, 0 ) ); // 2011.05.25 - servantes // 크리처 편성창
|
|
|
|
UISendStringMessage(m_pGameManager, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY, "refresh_durability");
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 선택 처리
|
|
//////////////////////////////////////////////////////////////////////////
|
|
bool SUIEquipCreatureWnd::SelectCreature( int nPos, bool bShow )
|
|
{
|
|
int nCurScroll = m_nScrollPos + nPos;
|
|
|
|
if( nCurScroll < 0 || nCurScroll >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return false;
|
|
|
|
/// 2011.06.07 - prodongi
|
|
if (!m_CreatureSlotMgr.isInCreatureCard(nCurScroll))
|
|
return false;
|
|
|
|
//static_summon 이것이 활성화 되있지 않으면 크리처컨트롤 렙으로 인해 편성자체가 불가능한 곳이므로 select 하면 안된다 -N4-
|
|
KUIControl* pControl(NULL);
|
|
pControl = dynamicCast<KUIControl*>(GetChild( CStringUtil::StringFormat( "static_summon%02d", nPos ).c_str() ));
|
|
if( !pControl ) bShow = false;
|
|
else
|
|
{
|
|
if( pControl->IsDisable() )
|
|
bShow = false;
|
|
}
|
|
|
|
for( int i(0); 3>i; i++ )
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat( "button_up_summon%02d" , i ).c_str(), nPos == i ? bShow : false );
|
|
SetChildShow( CStringUtil::StringFormat( "button_down_summon%02d" , i ).c_str(), nPos == i ? bShow : false );
|
|
}
|
|
|
|
bool bResult = false;
|
|
// 존재하는 카드 이거나, 슬롯에 카드가 있거나 하면, 선택해준다
|
|
if( m_CreatureSlotMgr.GetEquipedCreatureCard(nCurScroll) || m_hCreatureCardHandle[nCurScroll] )
|
|
{
|
|
// m_CreatureSlotMgr.SetSelectCreatureCard( m_hCreatureCardHandle[nCurScroll] ); // 2011.06.03 - servantes // 크리처 카드선택 // 2011.07.05 연동에 문제있음 주석처리
|
|
bResult = true;
|
|
}
|
|
|
|
if( bResult )
|
|
{
|
|
m_nSelSlotNum = nPos;
|
|
m_nCurrentSelectCreature = m_nSelSlotNum; // 2011.06.03 - servantes
|
|
|
|
if( bShow )
|
|
m_CreatureSlotMgr.SetSelectCreatureCard( m_CreatureSlotMgr.GetEquipedCreatureCard(nCurScroll) );
|
|
}
|
|
else // 2011.06.03 - servantes // 크리처 카드의 핸들이 없으면 리턴
|
|
{
|
|
m_CreatureSlotMgr.SetSelectCreatureCard(-1);
|
|
m_nCurrentSelectCreature = -1;
|
|
}
|
|
|
|
KUIWnd * pSelect = GetChild( "static_select_click" );
|
|
KUIWnd * pSelectBack = GetChild( "static_select_clickback" );
|
|
KUIWnd * pWnd = GetChild( CStringUtil::StringFormat( "static_summon%02d", nPos ).c_str() );
|
|
if( pWnd && pSelect && pSelectBack )
|
|
{
|
|
pSelect->MovePos( pWnd->GetRect().left - 10 , pWnd->GetRect().top - 9 );
|
|
pSelectBack->MovePos( pWnd->GetRect().left - 8, pWnd->GetRect().top - 8 );
|
|
}
|
|
if( pSelect )
|
|
{
|
|
pSelect->SetShow( bShow );
|
|
pSelectBack->SetShow( bShow );
|
|
|
|
// 2011.05.13 - servantes
|
|
if(bShow && bResult)
|
|
{
|
|
m_nCurrentSelectCreature = nCurScroll; // 2011.05.23 - servantes
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, nCurScroll ) ); // 미니 편성창으로 메세지 보낸다
|
|
}
|
|
|
|
}
|
|
|
|
if( bResult || !bShow ) return true;
|
|
else return false;
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 슬롯
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIEquipCreatureWnd::RefreshSlots( int nPos, bool bSwap )
|
|
{
|
|
if( !IsShow() ) return;
|
|
|
|
int UnitControlLv(0);
|
|
UnitControlLv = m_SkillSlotMgr.GetCurrentSkillLevel( 1801 ); //1801 -> 크리처 컨트롤 스킬 아이디 값
|
|
|
|
bool bDisable = true;
|
|
for( int i = nPos, nIndex = 0; i < SCreatureSlotMgr::MAX_CREATURE_SLOT; i++, nIndex++ )
|
|
{
|
|
bDisable = true;
|
|
if( nIndex >= c_nMaxLine ) break;
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
for(int k=0; k<c_nCreatureMaxItem; k++)
|
|
{
|
|
KUIWnd* pGauge = dynamicCast<KUIWnd*>( GetChild( CStringUtil::StringFormat( "creature_slot_%02d_durabillity_gauge%02d", k+1, nIndex ).c_str() ) );
|
|
if( pGauge )
|
|
pGauge->SetShow( false );
|
|
|
|
KUIWnd* pGaugeBase = dynamicCast<KUIWnd*>( GetChild( CStringUtil::StringFormat( "guage_slot_%02d_base_%02d", k+1, nIndex ).c_str() ) );
|
|
if( pGaugeBase )
|
|
pGaugeBase->SetShow( false );
|
|
}
|
|
*/
|
|
|
|
/// 2011.06.07 - prodongi
|
|
//크리처 컨트롤로 편성불가능한 슬롯의 컨트롤들을 비활성화 시킨다 -N4-
|
|
if( i < UnitControlLv ) EnableControlOnSlot(nIndex, true);
|
|
else EnableControlOnSlot(nIndex, false);
|
|
// EnableControlOnSlot(nIndex, m_CreatureSlotMgr.isInCreatureCard(i));
|
|
|
|
if( m_CreatureSlotMgr.IsExistCreatureCard( m_hCreatureCardHandle[i] ) )
|
|
{
|
|
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( m_CreatureSlotMgr.GetEquipedCreature(m_hCreatureCardHandle[i]) );
|
|
if( pInfo )
|
|
{
|
|
EnableSlot( nIndex, true );
|
|
SetCreatureData(nIndex, i, pInfo);
|
|
RefreshCreatureItem( nIndex, i, m_CreatureSlotMgr.GetEquipedCreature(m_hCreatureCardHandle[i]) );
|
|
|
|
bDisable = false;
|
|
}
|
|
}
|
|
|
|
if( bDisable )
|
|
{
|
|
EnableSlot( nIndex, false );
|
|
|
|
if( m_hCreatureCardHandle[i] )
|
|
RefreshCardSlot( nIndex, m_hCreatureCardHandle[i] );
|
|
}
|
|
|
|
// 슬롯 번호
|
|
SetSlotNum(nIndex, i);
|
|
}
|
|
|
|
RefreshScrollbar();
|
|
|
|
/// 2011.06.08 현재 선택되어 있는 것이 유효한지 체크한다 - prodongi
|
|
if (0 <= m_nCurrentSelectCreature && SCreatureSlotMgr::MAX_CREATURE_SLOT > m_nCurrentSelectCreature)
|
|
{
|
|
if (0 == m_hCreatureCardHandle[m_nCurrentSelectCreature])
|
|
{
|
|
unSelectCreature();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
unSelectCreature();
|
|
}
|
|
|
|
UISendStringMessage(m_pGameManager, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, "refresh_durability");
|
|
}
|
|
void SUIEquipCreatureWnd::SetSlotNum( int nIndex, int nPos )
|
|
{
|
|
SetChildCaption( CStringUtil::StringFormat( "static_summon%02d", nIndex ).c_str(), CStringUtil::StringFormat( "<hcenter><vcenter>%d", nPos+1 ).c_str() );
|
|
}
|
|
void SUIEquipCreatureWnd::SetCreatureData( int nIndex, int nPos, const SCreatureInfo* pInfo )
|
|
{
|
|
if( pInfo == NULL ) return;
|
|
|
|
if( nPos < 0 || nPos >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return;
|
|
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_hCreatureCardHandle[nPos] );
|
|
if( pSlot == NULL ) return;
|
|
|
|
// 2010.05.07 - prodongi
|
|
updateCreatureCardIcon(pSlot, nIndex);
|
|
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_faceicon%02d", nIndex ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetShow(true);
|
|
|
|
ResetMultiIcon( pIcon, 0, 4 );
|
|
|
|
if( false == setSummonCardIconForPortrait( pIcon, pSlot ) )
|
|
{
|
|
// 2010.05.11 - prodongi
|
|
char iconName[128];
|
|
::getEnhanceIconName(iconName, pInfo, pSlot->GetEnhance());
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName);
|
|
// pIcon->SetIcon( c_szDEF_SPR_NAME, GetCreatureDB().GetIconName(pInfo->GetID()) );
|
|
}
|
|
|
|
pIcon->SetTooltip( GetStringDB().GetString( GetCreatureDB().GetTextID(pInfo->GetID()) ) );
|
|
}
|
|
|
|
//소환수 등급/오버브리드/이름
|
|
{
|
|
std::string strRank( "" );
|
|
BYTE byRank( GetCreatureDB().GetRate( pInfo->GetID() ) );
|
|
|
|
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( "creature_grade%02d", nIndex ).c_str(), strRank.c_str() );
|
|
SetChildTooltip( CStringUtil::StringFormat( "creature_grade%02d", nIndex ).c_str(), GetCreatureDB().GetRateString( byRank ).c_str() );
|
|
|
|
// 오버브리드
|
|
int nOverBreed( pInfo->GetOverBreed() );
|
|
if( nOverBreed )
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat( "mark_overbreed_%02d" , nIndex ).c_str(), true );
|
|
SetChildShow( CStringUtil::StringFormat( "text_overbreed_%02d" , nIndex ).c_str(), true );
|
|
|
|
std::string strOverBreed( CStringUtil::StringFormat( "<#FFF200><size:9><vcenter>+%d<#FFFFFF>", nOverBreed ) );
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "text_overbreed_%02d", nIndex ).c_str(), strOverBreed.c_str() );
|
|
|
|
}
|
|
else
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat( "mark_overbreed_%02d" , nIndex ).c_str(), false );
|
|
SetChildShow( CStringUtil::StringFormat( "text_overbreed_%02d" , nIndex ).c_str(), false );
|
|
}
|
|
|
|
KUIControlIconStatic* pEvolutionRankIcon( dynamicCast<KUIControlIconStatic*>( GetChild( CStringUtil::StringFormat( "creature_monster_mark_evolution_%02d" , nIndex ).c_str() ) ) );
|
|
if( pEvolutionRankIcon )
|
|
{
|
|
string strGetEvolutionFormIconFileName( GetCreatureDB().GetEvolutionFormIconFileName( pInfo->GetID() ) );
|
|
|
|
if( strGetEvolutionFormIconFileName.empty() )
|
|
{
|
|
pEvolutionRankIcon->SetShow( false );
|
|
}
|
|
else
|
|
{
|
|
pEvolutionRankIcon->SetIcon( c_szDEF_SPR_NAME, strGetEvolutionFormIconFileName.c_str() );
|
|
pEvolutionRankIcon->SetTooltip( GetCreatureDB().GetEvolutionFormString( pInfo->GetID() ).c_str() );
|
|
|
|
pEvolutionRankIcon->SetShow( true );
|
|
}
|
|
}
|
|
|
|
// 이름
|
|
std::string strName( "" );
|
|
strName += CStringUtil::StringFormat( "<size:12><left>%s", pInfo->GetName() );
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_customname_text%02d", nIndex ).c_str(), strName.c_str() );
|
|
}
|
|
|
|
//소환수 계열
|
|
_SUMMON_INFO_FILE * pSummon = GetCreatureDB().GetCreatureData( pInfo->GetID() );
|
|
if( pSummon )
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_name_text%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "<#fec530><size:10><vcenter>%s", GetStringDB().GetString( pSummon->name_id ) ).c_str() );
|
|
else
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_name_text%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "<#fec530><size:10><vcenter>%s", pInfo->GetName() ).c_str() );
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_maxhp_number%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), pInfo->GetMaxHP() ).c_str() );
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_maxmp_number%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), pInfo->GetMaxMP() ).c_str() );
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_maxsp_number%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%d", pInfo->GetSP() ).c_str() );
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_lv_number%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), pInfo->GetLevel() ).c_str() );
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "number_%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), pSlot->GetEnhance() ).c_str() );
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
KUIWnd* pGauge = dynamicCast<KUIWnd*>(GetChild( CStringUtil::StringFormat("creature_card_durabillity_gauge%02d", nIndex).c_str() ));
|
|
KUIWnd* pGaugeFrame = dynamicCast<KUIWnd*>(GetChild( CStringUtil::StringFormat("guage_base_%02d", nIndex).c_str() ));
|
|
if( pGauge && pGaugeFrame )
|
|
{
|
|
refreshItemDurability( pSlot, pGauge, m_fGaugeWidth );
|
|
}
|
|
*/
|
|
|
|
/// 2011.04.27 정리 - prodongi
|
|
/*
|
|
std::string strJP;
|
|
int nJP = pInfo->GetJP();
|
|
const char* szCaption = m_pDisplayInfo->GetJP( &nJP );
|
|
strJP = CStringUtil::StringFormat( "%s%d", S(6425), nJP );
|
|
if( ( szCaption != NULL ) ) strJP += "K";
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_jp_number%02d" , nIndex ).c_str(), strJP.c_str() );
|
|
*/
|
|
std::string jpStr;
|
|
jpToString(pInfo->GetJP(), jpStr);
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_jp_number%02d" , nIndex ).c_str(), jpStr.c_str() );
|
|
|
|
int nExp, nRest;
|
|
m_pDisplayInfo->GetPercentValue( pInfo->GetCurExp(), pInfo->GetMaxExp(), &nExp, &nRest );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "creature_exp_number%02d" , nIndex ).c_str(), (nExp>0 || nRest>0) );
|
|
SetChildShow( CStringUtil::StringFormat( "creature_exp_decimal%02d", nIndex ).c_str(), (nExp>0 || nRest>0) );
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_exp_number%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%d", nExp ).c_str() );
|
|
SetChildCaption( CStringUtil::StringFormat( "creature_exp_number02_%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%d", nRest ).c_str() );
|
|
}
|
|
|
|
|
|
void SUIEquipCreatureWnd::RefreshCreatureItem( int nPos, int scrollPos, AR_HANDLE hCreature )
|
|
//void SUIEquipCreatureWnd::RefreshCreatureItem( int nPos, AR_HANDLE hCreature )
|
|
{
|
|
// 2010.05.04 사용하지 않아서 주석처리합니다. - prodongi
|
|
/*
|
|
int UnitControlLv(0);
|
|
// UnitControlLv = m_CreatureSkillSlotMgr.GetBaseSkillLevel( 11004, hCreature ); //11004 -> 유니트 컨트롤 스킬 아이디 값
|
|
UnitControlLv = 2;
|
|
*/
|
|
|
|
// 2010.05.07 - prodongi
|
|
SInventorySlot* invenSlot = m_InventoryMgr.GetItemInfo( m_hCreatureCardHandle[scrollPos] );
|
|
int nCardEnhance = 2;
|
|
if (invenSlot) nCardEnhance = invenSlot->GetEnhance();
|
|
int maxOpenSlotNum = GetCreatureEnhanceDB().getSlotAmount(nCardEnhance);
|
|
|
|
for( int i = 0; i < c_nMaxItem; i++ )
|
|
{
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", i, nPos ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
ResetMultiIcon( pIcon, 0, 4 );
|
|
|
|
bool bEmpty = true;
|
|
AR_HANDLE hItem = m_CreatureSlotMgr.GetCreatureItem( hCreature, i );
|
|
if( hItem )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( pSlot )
|
|
{
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName(pSlot->GetItemCode()) );
|
|
/// 2011.04.04 - prodongi
|
|
//pIcon->SetIcon( 1, c_szDEF_SPR_NAME, "static_inventory_equipicon" );
|
|
pIcon->SetIcon( 1, c_szDEF_SPR_NAME, "common_mark_titanium_equipicon" );
|
|
|
|
EquipItemAddtionalIconSetter icon_setter( pIcon, pSlot );
|
|
|
|
pIcon->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true, hCreature ) );
|
|
|
|
//Azia Mafia OFF dura PET
|
|
/*
|
|
KUIWnd* pGauge = dynamicCast<KUIWnd*>( GetChild( CStringUtil::StringFormat( "creature_slot_%02d_durabillity_gauge%02d", i+1, nPos ).c_str() ) );
|
|
if( pGauge )
|
|
refreshItemDurability( pSlot, pGauge, m_fGaugeWidth );
|
|
|
|
KUIWnd* pGaugeBase = dynamicCast<KUIWnd*>( GetChild( CStringUtil::StringFormat( "guage_slot_%02d_base_%02d", i+1, nPos ).c_str() ) );
|
|
if( pGaugeBase )
|
|
pGaugeBase->SetShow( true );
|
|
*/
|
|
|
|
bEmpty = false;
|
|
}
|
|
}
|
|
|
|
if( bEmpty )
|
|
{
|
|
// 2010.05.07 - prodongi
|
|
char const* sprName;
|
|
if (i < maxOpenSlotNum)
|
|
{
|
|
switch (i)
|
|
{
|
|
// AziaMafia SlotPets
|
|
case 0: sprName = "common_panel_titanium_slot_face"; break;
|
|
case 1: sprName = "static_common_nocardicon"; break;
|
|
case 2: sprName = "static_common_nocardicon"; break;
|
|
case 3: sprName = "static_creature_itemslot_accessory"; break;
|
|
case 4: sprName = "static_creature_itemslot_artifact"; break;
|
|
case 5: sprName = "static_creature_itemslot_artifact"; break;
|
|
case 6: sprName = "static_common_nocardicon"; break;
|
|
case 7: sprName = "static_common_nocardicon"; break;
|
|
case 8: sprName = "static_common_nocardicon"; break;
|
|
case 9: sprName = "static_creature_itemslot_accessory"; break;
|
|
case 10:sprName = "static_creature_itemslot_artifact"; break;
|
|
case 11:sprName = "static_creature_itemslot_accessory"; break;
|
|
case 12:sprName = "static_creature_itemslot_artifact"; break;
|
|
case 13:sprName = "static_creature_itemslot_accessory"; break;
|
|
case 14:sprName = "static_common_nocardicon"; break;
|
|
default:sprName = "static_common_nocardicon";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sprName = "static_inventory_beltslot";
|
|
}
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, sprName);
|
|
|
|
/*
|
|
//크리처의 유니트 컨트롤 렙에 따라서 아이템 장착부분 아이콘이미지를 바꿔주는 부분 -N4-
|
|
if( UnitControlLv > i ) pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_nocardicon" );
|
|
else pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_inventory_beltslot" );
|
|
*/
|
|
|
|
pIcon->SetTooltip(NULL);
|
|
|
|
// AziaMafia OFF dura PET
|
|
/*
|
|
KUIWnd* pGaugeBase = dynamicCast<KUIWnd*>( GetChild( CStringUtil::StringFormat( "guage_slot_%02d_base_%02d", i+1, nPos ).c_str() ) );
|
|
if( pGaugeBase )
|
|
pGaugeBase->SetShow( false );
|
|
*/
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
int SUIEquipCreatureWnd::GetCreatureSlotIndex( int x, int y )
|
|
{
|
|
KRect rt = GetRect();
|
|
KRect CompareRt;
|
|
KUIControl* pControl(NULL);
|
|
|
|
CompareRt = c_TopWndRect;
|
|
OffSetRect( CompareRt, rt.left, rt.top );
|
|
if( CompareRt.IsInRect(x, y) )
|
|
return 0; // 2011.06.03 - servantes // 디버깅을 위해 한줄 내림
|
|
|
|
CompareRt = c_MiddleWndRect;
|
|
OffSetRect( CompareRt, rt.left, rt.top );
|
|
if( CompareRt.IsInRect(x, y) )
|
|
return 1; // 2011.06.03 - servantes
|
|
|
|
CompareRt = c_ButtomWndRect;
|
|
OffSetRect( CompareRt, rt.left, rt.top );
|
|
if( CompareRt.IsInRect(x, y) )
|
|
return 2; // 2011.06.03 - servantes
|
|
|
|
return -1;
|
|
}
|
|
|
|
int SUIEquipCreatureWnd::GetCardSlotIndex( const char* szControlID ) const
|
|
{
|
|
for( int i = 0; i < c_nMaxLine; i++ )
|
|
{
|
|
if( ::_stricmp( szControlID, CStringUtil::StringFormat( "creatureform_cardslot%02d", i ).c_str() )== 0 )
|
|
return (i+m_nScrollPos);
|
|
}
|
|
return -1;
|
|
}
|
|
int SUIEquipCreatureWnd::GetItemSlotIndex( const char* szControlID ) const
|
|
{
|
|
for( int i = 0; i < c_nMaxLine; i++ )
|
|
{
|
|
for( int j = 0; j < c_nMaxItem; j++ )
|
|
{
|
|
if( ::_stricmp( szControlID, CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", j, i ).c_str() ) == 0 )
|
|
return (i+m_nScrollPos);
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
void SUIEquipCreatureWnd::RefreshCardSlot( int nPos, AR_HANDLE hCard )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hCard );
|
|
if( pSlot == NULL ) return;
|
|
|
|
// 2010.05.07 - prodongi
|
|
updateCreatureCardIcon(pSlot, nPos);
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 장착
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIEquipCreatureWnd::RequestEquipItem( int nPos, AR_HANDLE hItem, bool bEquip )
|
|
{
|
|
if( nPos < 0 || nPos >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return;
|
|
|
|
// 이미 장착하고 있으면 리턴 처리 하지 않겠음
|
|
// 6개 이상이면 장착 불가
|
|
if( m_CreatureSlotMgr.GetCreatureItemCount(m_CreatureSlotMgr.GetEquipedCreature(m_hCreatureCardHandle[nPos])) >= SCreatureSlotMgr::MAX_CREATURE_SLOT ) return;
|
|
|
|
m_pDisplayInfo->UseOrEquipItem( hItem, m_CreatureSlotMgr.GetEquipedCreature(m_hCreatureCardHandle[nPos]) );
|
|
}
|
|
|
|
bool SUIEquipCreatureWnd::IsEnableEquipItem( AR_HANDLE hItem )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( pSlot == NULL ) return false;
|
|
|
|
if( !GetItemDB().IsJoin(pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) && !pSlot->IsEquipItem() )
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
bool SUIEquipCreatureWnd::IsEnableEquipCardItem( AR_HANDLE hItem )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( pSlot == NULL ) return false;
|
|
|
|
int a = GetItemDB().GetUseType(pSlot->GetItemCode());
|
|
int b = GetItemDB().GetGroup(pSlot->GetItemCode());
|
|
if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD
|
|
&& GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD )
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
AR_HANDLE SUIEquipCreatureWnd::GetItemInCreature( int nStartPos, int nPos, const char* szControlID )
|
|
{
|
|
int nCreatureIndex( nPos - nStartPos );
|
|
|
|
for( int i = 0; i < c_nMaxItem; i++ )
|
|
{
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_%02d", i, nCreatureIndex ).c_str() ));
|
|
if( pIcon && ::_stricmp( pIcon->GetID(), szControlID ) == 0 )
|
|
return m_CreatureSlotMgr.GetCreatureItem( m_CreatureSlotMgr.GetEquipedCreature(nPos), i );
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::SetControlEnable( const char * pControlName, bool bEnable )
|
|
{
|
|
KUIControlStatic * pControl = dynamicCast<KUIControlStatic *>(GetChild(pControlName));
|
|
if( pControl )
|
|
{
|
|
if( bEnable )
|
|
pControl->Enable();
|
|
else
|
|
pControl->Disable();
|
|
}
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::EnableControlOnSlot( int nIndex, bool bEnable )
|
|
{
|
|
SetControlEnable( CStringUtil::StringFormat( "static_summon%02d" , nIndex ).c_str(), bEnable );
|
|
SetControlEnable( CStringUtil::StringFormat( "static_lv_summon%02d" , nIndex ).c_str(), bEnable );
|
|
SetControlEnable( CStringUtil::StringFormat( "static_jp_summon%02d" , nIndex ).c_str(), bEnable );
|
|
SetControlEnable( CStringUtil::StringFormat( "static_maxhp_summon%02d" , nIndex ).c_str(), bEnable );
|
|
SetControlEnable( CStringUtil::StringFormat( "static_maxmp_summon%02d" , nIndex ).c_str(), bEnable );
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::OnControlEnablOption()
|
|
{
|
|
KUIControlStatic* pStatic = NULL;
|
|
|
|
for( int i = 0; i < 3; i++ )
|
|
{
|
|
pStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat( "static_summon%02d" , i ).c_str() ));
|
|
if( pStatic ) pStatic->SetEnableOption( true );
|
|
pStatic->SetEnableColor( "<#ffcb00>" );
|
|
pStatic = NULL;
|
|
|
|
pStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat( "static_lv_summon%02d" , i ).c_str() ));
|
|
if( pStatic ) pStatic->SetEnableOption( true );
|
|
pStatic->SetEnableColor( "<#dffa2f>" );
|
|
pStatic = NULL;
|
|
|
|
pStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat( "static_jp_summon%02d" , i ).c_str() ));
|
|
if( pStatic ) pStatic->SetEnableOption( true );
|
|
pStatic->SetEnableColor( "<#ffb900>" );
|
|
pStatic = NULL;
|
|
|
|
pStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat( "static_maxhp_summon%02d" , i ).c_str() ));
|
|
if( pStatic ) pStatic->SetEnableOption( true );
|
|
pStatic->SetEnableColor( "<#ffeab1>" );
|
|
pStatic = NULL;
|
|
|
|
pStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat( "static_maxmp_summon%02d" , i ).c_str() ));
|
|
if( pStatic ) pStatic->SetEnableOption( true );
|
|
pStatic->SetEnableColor( "<#ffeab1>" );
|
|
pStatic = NULL;
|
|
}
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::OffSetRect( KRect& rRt, int x, int y )
|
|
{
|
|
rRt.left += x;
|
|
rRt.top += y;
|
|
rRt.right += x;
|
|
rRt.bottom += y;
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd/* = true*/ )
|
|
{
|
|
if( bOpen )
|
|
m_pGameManager->StartSound( "ui_popup_window01.wav" );
|
|
|
|
SUIWnd::OnNotifyUIWindowOpen( bOpen, bLimitWnd );
|
|
}
|
|
|
|
// 2010.05.06 - prodongi
|
|
void SUIEquipCreatureWnd::updateCreatureCardIcon(SInventorySlot* slot, int pos)
|
|
{
|
|
// KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "creatureform_cardslot%02d", pos ).c_str() ));
|
|
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creatureform_cardslot%02d", pos ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
ResetMultiIcon( pIcon, 0, 8 );
|
|
if( false == setSummonCardIcon( pIcon, slot ) )
|
|
{
|
|
// 2010.06.09 - prodongi
|
|
std::string iconName;
|
|
getIconNameAtDurability(slot, iconName);
|
|
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName.c_str());
|
|
}
|
|
pIcon->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, slot, true ) );
|
|
}
|
|
}
|
|
|
|
/// 편성이 되어있는지 검사
|
|
BOOL SUIEquipCreatureWnd::IsFormatCreature(AR_HANDLE hCreature) // 2011.03.24 - servantes
|
|
{
|
|
if(hCreature <= 0)
|
|
return FALSE;
|
|
|
|
for(int k=0; k<6; k++)
|
|
{
|
|
if(m_hCreatureCardHandle[k])
|
|
{
|
|
if(m_hCreatureCardHandle[k] == hCreature)
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::unSelectCreature()
|
|
{
|
|
SetChildShow("static_select_click", false);
|
|
SetChildShow("static_select_clickback", false);
|
|
for( int i(0); 3>i; i++ )
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat( "button_up_summon%02d" , i ).c_str(), false );
|
|
SetChildShow( CStringUtil::StringFormat( "button_down_summon%02d" , i ).c_str(), false );
|
|
}
|
|
|
|
m_nSelSlotNum = -1;
|
|
m_CreatureSlotMgr.SetSelectCreatureCard(-1);
|
|
m_nCurrentSelectCreature = -1;
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, -1 ) );
|
|
}
|
|
|
|
void SUIEquipCreatureWnd::syncSelectButton(int selectCreature)
|
|
{
|
|
int uiScrollIndex;
|
|
bool showSelect = true;
|
|
if (-1 == selectCreature)
|
|
{
|
|
showSelect = false;
|
|
}
|
|
else
|
|
{
|
|
uiScrollIndex = selectCreature - m_nScrollPos;
|
|
if (0 > uiScrollIndex || c_nMaxLine <= uiScrollIndex)
|
|
showSelect = false;
|
|
}
|
|
|
|
KUIWnd * pSelect = GetChild( "static_select_click" );
|
|
KUIWnd * pSelectBack = GetChild( "static_select_clickback" );
|
|
|
|
for( int i(0); 3>i; i++ )
|
|
{
|
|
SetChildShow( CStringUtil::StringFormat( "button_up_summon%02d" , i ).c_str(), false );
|
|
SetChildShow( CStringUtil::StringFormat( "button_down_summon%02d" , i ).c_str(), false );
|
|
}
|
|
|
|
if (showSelect)
|
|
{
|
|
KUIWnd * pWnd = GetChild( CStringUtil::StringFormat( "static_summon%02d", uiScrollIndex ).c_str() );
|
|
if( pWnd && pSelect && pSelectBack )
|
|
{
|
|
pSelect->MovePos( pWnd->GetRect().left - 10 , pWnd->GetRect().top - 9 );
|
|
pSelectBack->MovePos( pWnd->GetRect().left - 8, pWnd->GetRect().top - 8 );
|
|
}
|
|
}
|
|
|
|
if( pSelect && pSelectBack )
|
|
{
|
|
pSelect->SetShow( showSelect );
|
|
pSelectBack->SetShow( showSelect );
|
|
|
|
SetChildShow( CStringUtil::StringFormat( "button_up_summon%02d" , uiScrollIndex ).c_str(), true );
|
|
SetChildShow( CStringUtil::StringFormat( "button_down_summon%02d" , uiScrollIndex ).c_str(), true );
|
|
}
|
|
} |