#include "stdafx.h" #include "KUITabControl.h" #include "KUIDragAndDrop.h" //#include "KUIControlNumber.h" #include "KUIControlButton.h" #include "KUIControlStatic.h" #include "KUIControlScroll.h" #include "KUIControlClockBox.h" #include "SGameManager.h" //#include "SGameMessageUI.h" #include "SUICreatureSkillWnd.h" #include "SUIDisplayInfo.h" #include "SUILazyTooltip.h" // sonador #2.1.2.4.3 팻 조작 UI 연동 #include "SCreatureDB.h" #include "SStringDB.h" #include "SSkillDB.h" #include "ErrorCode/ErrorCode.h" #include "SSummonSlotMgr.h" #include "SSkillSlot.h" #include "SGameOption.h" // 2010.05.11 - prodongi #include "SInventoryMgr.h" //#include "SUIUtil.h" #include "Util.h" using namespace CStringUtil; namespace{ int c_nMaxJobChange = 3; // MJ 2004/11/02 퀄업때까지는 3차까지, 나중에 5차까지 확장 const int c_nMaxHeight = 590; // 최대로 늘릴때 max const int c_nDelta = 38; // 늘어나는 단위 const int c_nChildWnd = 219; // 차일드 width const int c_nTabClickArea = 9; // 탭 클릭 영역 const int c_nButtonClickArea = 20; // 버튼 클릭 영역 const int c_nIconSelectDelta = 6; // 아이콘 선택 static 표시 위치 delta const int c_nMaxLine = 9; const int c_nMinLine = 8; // const char * c_szSKILL_QUICK_SLOT = "static_slot%02d"; // 2011.11.29 - servantes : 옵션 nui에 해당 컨트롤 없음 / 주석처리 // const int c_nQUICK_SLOT_CNT = 12; // 2011.11.29 - servantes : 쓰이지 않음 const char * c_szVSCROLL = "vscroll_skill"; enum{ // 탭 타입 TAB_ACTIVE = 0, TAB_PASSIVE, }; enum{ // 스킬 타입 SKILLTYPE_PASSIVE = 0, SKILLTYPE_ACTIVE, }; enum { TAB_PARAMETER = 0, TAB_SKILL, }; }; using namespace rp; SUICreatureSkillWnd::~SUICreatureSkillWnd() { FreeSkillList(); } bool SUICreatureSkillWnd::InitControls( KPoint kPos ) { SetCustomMovingRect( KRect( 0, 0, 310, 20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area // 리사이즈 할때 단위 설정, ( 세로, 가로, 위드, 헤잇 ) SetResizeUnit( 0, c_nDelta, KSize((GetRect().right-GetRect().left), (GetRect().bottom-GetRect().top)), KSize((GetRect().right-GetRect().left), c_nMaxHeight) ); CreateTab(); CreateControls(); // 컨트롤 생성 // 버튼 클릭 영역 // SetValidRect( "creature02_fund", KRect(20,0,-c_nButtonClickArea,0) ); // SetValidRect( "creature02_use", KRect(0,0,-15,0) ); return SUIWnd::InitControls(kPos); } bool SUICreatureSkillWnd::InitData( bool bReload ) { m_nSelSkillPos = -1; m_nScrollPos = 0; m_bIsQuickSlotItem = false; m_bShowChildWnd = true; m_nMaxLine = c_nMinLine; m_nTabType = TAB_ACTIVE; SetChildShow( "common_usecreaturecardieon", false ); FreeSkillList(); // 모든 리스트 삭제 DisableAllSlot( false ); // 모든 컨트롤 초기화 HideSelectBar(); // 선택바 초기화 InitCreatureQuickSlots(); // 크리처 스킬 퀵슬롯 m_pOverBreed = dynamicCast( GetChild( "text_overbreed_01" ) ); if( NULL == m_pOverBreed ) { SDEBUGLOG( "[크리쳐 스킬] 컨트롤 정보 얻기 실패 - Name[text_overbreed_01]" ); assert( m_pOverBreed ); } else { string strCaption( m_pOverBreed->GetCaption() ); GetTextDecoration( strCaption.c_str(), m_strOverBreedPropertyTag ); m_pOverBreed->SetShow( false ); } m_pOverBreedIcon = dynamicCast( GetChild( "mark_overbreed_01" ) ); if( NULL == m_pOverBreedIcon ) { SDEBUGLOG( "[크리쳐 스킬] 컨트롤 정보 얻기 실패 - Name[mark_overbreed_01]" ); assert( m_pOverBreedIcon ); } else m_pOverBreedIcon->SetShow( false ); m_pEvolutionRankIcon = dynamicCast( GetChild( "creature_monster_mark_evolution_01" ) ); if( NULL == m_pEvolutionRankIcon ) { SDEBUGLOG( "[크리쳐 스킬] 컨트롤 정보 얻기 실패 - Name[creature_monster_mark_evolution_01]" ); assert( m_pEvolutionRankIcon ); } return SUIWnd::InitData(bReload); } void SUICreatureSkillWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { if( !m_CreatureSlotMgr.GetSelectedCreature() ) // 2011.06.03 - servantes // 선택된 크리처가 없으면 크리처 스킬장 열지 않는다 { SUIWnd::OnNotifyUIWindowOpen( false ); GetGameOption().SetCreautreInfoOpen( false ); 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_SKILLFUND, false ) ); /// 2011.07.12 - prodongi return; } SUIWnd::OnNotifyUIWindowOpen(bOpen); GetGameOption().SetCreautreInfoOpen(bOpen); if( bOpen ) { if( m_CreatureSlotMgr.GetEquipedCreatureCount() <= 0 ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); } else { m_pGameManager->StartSound( "ui_popup_window01.wav" ); RefreshCreatureInfo(); // SetQuickSlotRect(); // 퀵슬롯 영역 설정 // 2011.11.29 - servantes : 쓰이지 않음 // RefreshCreatureQuickSlots(); // 2011.11.29 - servantes : 쓰이지 않음 RefreshSkillInfo(); // 스킬 탭 KUISimpleTabControl* pTab = dynamicCast(GetChild( "creature02_tab02" )); if( pTab ) pTab->SetSelectedItem(TAB_SKILL); KUIWnd *pInfoWnd = m_pManager->FindWnd( "window_summon_info" ); if( pInfoWnd ) pInfoWnd->MovePos( pInfoWnd->GetRect().right, pInfoWnd->GetRect().bottom - GetRect().GetHeight() ); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, GetRect().right, GetRect().bottom ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, m_nTabType ) ); } } m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, (bOpen && m_bShowChildWnd) ) ); } void SUICreatureSkillWnd::InitCreatureQuickSlots() { } void* SUICreatureSkillWnd::Perform( KID id, KArg& msg ) { _CID( UI_BEGIN_DRAG ); _CID( UI_SEND_DROP ); _CID( UI_RECV_DROP ); if ( id == id_UI_BEGIN_DRAG ) { // 액티브 스킬만 가능 if( !IsActiveTab() ) return NULL; KUIBeginDragMessage* pBeginMsg = static_cast( &msg ); const char* szControlID = pBeginMsg->sDragControlID.c_str(); KUIWnd* pWnd = GetChild( szControlID ); if( pWnd == NULL ) return NULL; // 장착 해제/설정 if( m_rtQuickSlotRect.IsInRect( pWnd->GetRect().left, pWnd->GetRect().top ) ) m_bIsQuickSlotItem = true; else m_bIsQuickSlotItem = false; int nSkillID = GetSkillIDByCtrlName( szControlID ); if( nSkillID == -1 ) return NULL; int nUseLevel = GetUseLevel( nSkillID ); if( nUseLevel == -1 ) return NULL; m_pDisplayInfo->SetUIDragInfo( new SUISkillDragInfo( nSkillID, nUseLevel, NULL, m_CreatureSlotMgr.GetSelectedCreature(), SUIDragInfo::DRAGTYPE_CREATURE_QUICKSLOT, 0, false ) ); if( m_bIsQuickSlotItem ) { const KUIControlMultiIcon::ICON_INFO& rIconInfo = ( ( KUIControlMultiIcon* )pWnd)->GetIconInfoByLayer(0); m_pDragAndDropIcon->SetStateIcon( pWnd->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL ); } else m_pDragAndDropIcon->SetStateIcon( pWnd->GetSprName(), pWnd->GetAniName(), pWnd->GetFrameIndex(), STATE_NORMAL ); pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon; return NULL; } else if ( id == id_UI_SEND_DROP ) { KUISendRecvDropMessage* pSendMsg = static_cast( &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()) ) { // 슬롯을 비운다. int nDropIndex = GetIndexByCtrlID( pSendMsg->sSendDropControlID.c_str() ); m_CreatureSkillSlotMgr.DelQuickSlot( pSkillDragInfo->m_hTarget, nDropIndex ); UpdateCreatureQuickSlots(); m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() ); } // Drag & Drop 정보 제거 m_pDisplayInfo->SetUIDragInfo(); return NULL; } else if ( id == id_UI_RECV_DROP ) { if( !IsActiveTab() ) return NULL; KUISendRecvDropMessage* pRecvMsg = static_cast( &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 ) { int nDropIndex = -1; int nSendDropIndex = -1; nDropIndex = GetIndexByCtrlID( pRecvMsg->sRecvDropControlID.c_str() ); nSendDropIndex = GetIndexByCtrlID( pRecvMsg->sSendDropControlID.c_str() ); if( nDropIndex == nSendDropIndex ) return NULL; // 장착 if( m_rtQuickSlotRect.IsInRect( pRecvMsg->ptDropPos.x, pRecvMsg->ptDropPos.y ) ) { // 소환된 크리처가 이 크리처라면 알트 퀵슬롯창 갱신해준다 m_CreatureSkillSlotMgr.AddQuickSlot( pSkillDragInfo->m_hTarget, pSkillDragInfo->m_nSkillID, pSkillDragInfo->m_nLevel, pSkillDragInfo->m_nState, nDropIndex, nSendDropIndex ); // 퀵 슬롯 설정-크리처창에서만 설정이 된다. UpdateCreatureQuickSlots(); m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound(), 50 ); } // 해제 else { // 소환된 크리처가 이 크리처라면 알트 퀵슬롯창 갱신해준다 m_CreatureSkillSlotMgr.DelQuickSlot( pSkillDragInfo->m_hTarget, nSendDropIndex ); // 크리처 창에서 지운다 UpdateCreatureQuickSlots(); } } return NULL; } return SUIWnd::Perform( id, msg ); } // quickslot void SUICreatureSkillWnd::UpdateCreatureQuickSlots() { m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_CREATURE_QUICK_UPDATE() ); m_pDisplayInfo->SaveQuickSlots(); } // 2011.11.29 - servantes : 옵션 nui에 해당 컨트롤 없음 / 주석처리 int SUICreatureSkillWnd::GetIndexByCtrlID( const char* szControlID ) { return -1; } void SUICreatureSkillWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch(nMessage) { case KUI_MESSAGE::KBUTTON_CLICK: { if( _stricmp( lpszControlID, "button_close" ) == 0 ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false) ); } else if( _stricmp( lpszControlID, "button_add" ) == 0 ) { m_bShowChildWnd = !m_bShowChildWnd; m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, m_bShowChildWnd ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, m_nTabType ) ); } else if( _stricmp( lpszControlID, "button_use" ) == 0 ) RequestUseSkill(); else { for( int i = 0; i < m_nMaxLine; i++ ) { if( _stricmp( lpszControlID, CStringUtil::StringFormat( "creature02_lvinfo%02d", i ).c_str() ) == 0 ) // 선택 처리 { ShowSelectBar(i); break; } else if( _stricmp( lpszControlID, CStringUtil::StringFormat( "creature02_lvinfo_up%02d", i ).c_str() ) == 0 ) { ShowSelectBar(i); SkillUp(m_nScrollPos+i); break; } else if( _stricmp( lpszControlID, CStringUtil::StringFormat( "creature02_lvinfo_down%02d", i ).c_str() ) == 0 ) { ShowSelectBar(i); SkillDown(m_nScrollPos+i); break; } } } } break; case KUI_MESSAGE::KICON_PRESSING: { if( nMessage == KUI_MESSAGE::KICON_CLICK ) m_pGameManager->StartSound( "ui_button_click.wav" ); for( int i = 0; i < m_nMaxLine; i++ ) { if( _stricmp( lpszControlID, CStringUtil::StringFormat( "creature02_skillicon%02d", i ).c_str() ) == 0 ) // 선택 처리 { ShowSelectBar(i); break; } } } break; case KUI_MESSAGE::KICON_DBLCLK: { for( int i = 0; i < m_nMaxLine; i++ ) { if( _stricmp( lpszControlID, CStringUtil::StringFormat( "creature02_skillicon%02d", i ).c_str() ) == 0 ) // 선택 처리 { m_pGameManager->StartSound( "iconClick_iconmove_target.wav" ); ShowSelectBar(i); RequestUseSkill(); break; } } } break; case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동 { LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, GetRect().right, GetRect().bottom ) ); } break; case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택 { int nPos = int(lparam); nPos = max( nPos, 0 ); m_nScrollPos = nPos; RefreshSkillSlot(nPos); } break; case KUI_MESSAGE::KTAB_SELECT: // 탭 변경 { if( _stricmp( lpszControlID, "creature02_tab02" ) == 0 ) { // 내 자신이면,, 걍 두고 // 파라미터면.. 닫고 여는 짓을 한다 KUISimpleTabControl* pTab = dynamicCast(GetChild( "creature02_tab02" )); if( pTab ) { if( pTab->GetSelectedItem() == TAB_SKILL ) return; else { // 닫고.. // 스킬 열어준다 m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, GetRect().left, GetRect().top ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, true) ); } } } else if( _stricmp( lpszControlID, "creature02_tab" ) == 0 ) // 액티브/패시브 { KUISimpleTabControl* pTab = dynamicCast(GetChild("creature02_tab")); if( pTab ) m_nTabType = pTab->GetSelectedItem(); SelectTab(); // m_nTabType, RefreshScrollBar, RefreshSlot m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, m_nTabType ) ); } } break; case KUI_MESSAGE::KGENWND_RESIZE: // 윈도우 리사이즈 { int nDelta = GetRect().GetHeight() - static_cast(wparam); KUIWnd * pOutfram = GetChild( "outframe" ); if( pOutfram ) { KRect rcChild = pOutfram->GetRect(); rcChild.bottom += nDelta; pOutfram->Resize( rcChild ); Resize( rcChild ); } KUIWnd * pInfram = GetChild( "inframe" ); if( pInfram ) { KRect rcChild = pInfram->GetRect(); rcChild.bottom += nDelta; pInfram->Resize( rcChild ); } m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILLFUND, GetRect().right, GetRect().bottom ) ); } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUICreatureSkillWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_TAB_UPDATE: { SIMSG_UI_TAB_UPDATE* pSkillMsg = ( SIMSG_UI_TAB_UPDATE* )pMsg; KUISimpleTabControl* pTab = dynamicCast(GetChild("creature02_tab")); if( pTab ) pTab->SetSelectedItem( pSkillMsg->m_nTabType ); m_nTabType = pSkillMsg->m_nTabType; SelectTab(); pMsg->bUse = true; } break; case IMSG_UI_MOVE: { SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg; MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY ); pMsg->bUse = true; } break; case MSG_LEVEL_UPDATE: case MSG_EXP_UPDATE: { RefreshCreatureInfo(); pMsg->bUse = true; } break; case MSG_PROPERTY: { SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg; switch( pPropertyMsg->nPropertyType ) { case SMSG_PROPERTY::PROPERTY_LEVEL: case SMSG_PROPERTY::PROPERTY_EXP: case SMSG_PROPERTY::PROPERTY_JP: RefreshCreatureInfo(); break; } pMsg->bUse = true; } break; case MSG_EQUIP_SUMMON: { // 크리처 핸들로 카드 해들 알아내어 장착하고 있는 크리처인지 검사 AR_HANDLE hCard = m_CreatureSlotMgr.GetEquipedCreatureCard( m_CreatureSlotMgr.GetSelectedCreature() ); if( !m_CreatureSlotMgr.GetSelectedCreature() || !m_CreatureSlotMgr.IsExistCreatureCard(hCard) ) m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false) ); pMsg->bUse = true; } break; case MSG_ADDED_SKILL_LIST: // 2010.07.15 - prodongi RefreshAddedSkillList(); RefreshSkillSlot( m_nScrollPos ); break; //break; case MSG_SKILL_LIST: { RefreshSkillInfo(); pMsg->bUse = true; } break; case MSG_SKILL_EVENT: { RefreshSkillInfo(); SMSG_SKILL_EVENT* pSkillEvent = (SMSG_SKILL_EVENT*)pMsg; if( pSkillEvent->caster != m_CreatureSlotMgr.GetSelectedCreature() ) break; if( pSkillEvent->status_type == TS_SC_SKILL::FIRE ) ShowClockBox( pSkillEvent->skill_id ); else if( pSkillEvent->status_type == TS_SC_SKILL::CASTING ) { if( pSkillEvent->cast.nErrorCode == 0 ) // 캐스팅 성공 쿨링 시계 표시 100% ShowClockBox( pSkillEvent->skill_id, true ); //else // 실패 //m_pDisplayInfo->SetSysMsg( 0 /*pSkillEvent->count*/ ); //TODO 무엇을 보내는가 확인? } else if( pSkillEvent->status_type == TS_SC_SKILL::CANCEL ) { //TODO Cancel 처리 CancelSkill( pSkillEvent->skill_id ); } 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 처리 } else if( pSkillEvent->status_type == TS_SC_SKILL::COMPLETE ) { //TODO COMPLETE 처리 } pMsg->bUse = true; } break; case IMSG_UI_CREATURE_QUICK_UPDATE: // RefreshCreatureQuickSlots(); // 2011.11.29 - servantes : 쓰이지 않음 break; } } /////////////////////////////////////////////////////////// // 윈도우 /////////////////////////////////////////////////////////// void SUICreatureSkillWnd::CreateTab() { KUISimpleTabControl* pTabControl = NULL; // 상위 탭 만들기 pTabControl = dynamicCast(GetChild("creature02_tab02")); if( pTabControl ) { //TODO : 하드 코딩 // pTabControl->SetTabProperty( -19 ); pTabControl->SetTabProperty( 0, false, 2 ); pTabControl->AddTabItem( S(6253)/*"파라미터"*/, S(6303)/*"기본 정보"*/ ); pTabControl->AddTabItem( S(6230)/*"스킬"*/ , S(6304)/*"스킬 정보"*/ ); // pTabControl->SetCorrectionRect( KRect( c_nTabClickArea, 0, -c_nTabClickArea, 0 ) ); } // 하위 탭 만들 pTabControl = dynamicCast(GetChild("creature02_tab")); if( pTabControl ) { // pTabControl->SetTabProperty( -19 ); pTabControl->SetTabProperty( 0, false, 2 ); pTabControl->AddTabItem( S(6236)/*"액티브"*/, S(6305)/*"액티브 스킬"*/ ); pTabControl->AddTabItem( S(6256)/*"패시브"*/, S(6306)/*"패시브 스킬"*/ ); // pTabControl->SetCorrectionRect( KRect( c_nTabClickArea, 0, -c_nTabClickArea, 0 ) ); } } void SUICreatureSkillWnd::CreateControls() { RECT rc; rc.left = 0; rc.top = c_nDelta; rc.right = 0; rc.bottom = c_nDelta; KUIWnd* pIconCtr(NULL); pIconCtr = GetChild( "creature02_skillicon00" ); if( pIconCtr ) (( KUIControlIconStatic*)pIconCtr)->SetCorrectionRect( KRect( 0, 0, 150, 0 ) ); int i; for( i = 0; i < c_nMaxLine-1; i++ ) { pIconCtr = CopyControl( CStringUtil::StringFormat( "creature02_skillicon%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_skillicon%02d" , i+1 ).c_str(), rc ); // CopyControl( CStringUtil::StringFormat( "creature02_lvinfo%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_lvinfo%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_skilllv%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_skilllv%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , i ).c_str(), CStringUtil::StringFormat( "creature02_skilllv%02d_value" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_lvinfo_up%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_lvinfo_up%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_lvinfo_down%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_lvinfo_down%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_skillname_text%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_skillname_text%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , i ).c_str(), CStringUtil::StringFormat( "creature02_skilllv_text%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", i ).c_str(), CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "static_skill_mp%02d" , i ).c_str(), CStringUtil::StringFormat( "static_skill_mp%02d" , i+1 ).c_str(), rc ); CopyControl( CStringUtil::StringFormat( "static_skill_mp_value%02d" , i ).c_str(), CStringUtil::StringFormat( "static_skill_mp_value%02d" , i+1 ).c_str(), rc ); if( pIconCtr ) (( KUIControlIconStatic*)pIconCtr)->SetCorrectionRect( KRect( 0, 0, 150, 0 ) ); } // 스킬 재사용 시간 컨트롤 for( i = 0; i <= c_nMaxLine; i++ ) { KUIWnd* pIcon = GetChild( CStringUtil::StringFormat("creature02_skillicon%02d", i).c_str() ); if( pIcon ) { KUIWnd* pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", CStringUtil::StringFormat("creature02_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 ); } } // init multi_icon KUIControlMultiIcon* pMultiIcon = dynamicCast(GetChild( "creature_faceicon" )); if( pMultiIcon ) pMultiIcon->SetIconLayer( 4 ); SetChildAsTop( "creature02_skillicon_select" ); } ///////////////////////////////////////////////// // 스킬사용 //////////////////////////////////////////////// void SUICreatureSkillWnd::RequestUseSkill() { if( m_nSelSkillPos < 0 ) return; if( m_nTabType == TAB_ACTIVE ) { if( m_nSelSkillPos-1 >= static_cast(m_vecActiveSkillList.size()) ) return; SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelSkillPos-1]; if( !pSkill->IsCasting() && !pSkill->IsFire() ) m_pDisplayInfo->UseSkill( pSkill->GetSkillID(), pSkill->GetUseLevel(), false, m_CreatureSlotMgr.GetSelectSummonCreature() ); } else if( m_nTabType == TAB_PASSIVE ) { if( m_nSelSkillPos-1 >= static_cast(m_vecPassiveSkillList.size()) ) return; SSkillSlot* pSkill = m_vecPassiveSkillList[m_nSelSkillPos-1]; if( !pSkill->IsCasting() && !pSkill->IsFire() ) m_pDisplayInfo->UseSkill( pSkill->GetSkillID(), pSkill->GetUseLevel(), false, m_CreatureSlotMgr.GetSelectSummonCreature() ); } } void SUICreatureSkillWnd::ShowClockBox( int nSkillID, bool bDiable ) { if( !IsActiveTab() ) return; if( bDiable ) { std::vector slotList; m_CreatureSkillSlotMgr.GetQuickslotID( m_CreatureSlotMgr.GetSelectedCreature(), nSkillID, slotList ); for( int i(0); iInit(); } slotList.clear(); for( int i = 0; i < m_nMaxLine; i++ ) { if( GetSkillID( m_nScrollPos+i ) == nSkillID ) { KUIWnd* pWnd = GetChild( CStringUtil::StringFormat("creature02_clockbox%02d", i).c_str() ); if( pWnd && m_CreatureSkillSlotMgr.IsCastingSkill(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ) ((KUIControlClockBox*)pWnd)->Init(); { return; } } } return; } std::vector slotList; m_CreatureSkillSlotMgr.GetQuickslotID( m_CreatureSlotMgr.GetSelectedCreature(), nSkillID, slotList ); for( int i(0); iSetMaxTime( m_CreatureSkillSlotMgr.GetSkillMaxTime(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ); ((KUIControlClockBox*)pWnd)->SetCurTime( m_CreatureSkillSlotMgr.GetSkillCurTime(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ); ((KUIControlClockBox*)pWnd)->Begin(); } } slotList.clear(); for( int i = 0; i < m_nMaxLine; i++ ) { if( GetSkillID( m_nScrollPos+i ) == nSkillID ) { KUIWnd* pWnd = GetChild( CStringUtil::StringFormat("creature02_clockbox%02d", i).c_str() ); if( pWnd && m_CreatureSkillSlotMgr.IsFireSkill(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ) { ((KUIControlClockBox*)pWnd)->SetMaxTime( m_CreatureSkillSlotMgr.GetSkillMaxTime(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ); ((KUIControlClockBox*)pWnd)->SetCurTime( m_CreatureSkillSlotMgr.GetSkillCurTime(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ); ((KUIControlClockBox*)pWnd)->Begin(); ((KUIControlClockBox*)pWnd)->SetShow(true); } return; } } } //스킬 사용 취소 void SUICreatureSkillWnd::CancelSkill( int nSkillID ) { for( int i = 0; i < c_nMaxLine; i++ ) { if( GetSkillID( m_nScrollPos+i ) == nSkillID ) { KUIControlClockBox* pWnd = dynamicCast(GetChild( CStringUtil::StringFormat("creature02_clockbox%02d", i).c_str() )); if( pWnd ) { pWnd->SetMaxTime( 0 ); pWnd->SetCurTime( 0 ); pWnd->Begin(); } break; } } std::vector slotList; m_CreatureSkillSlotMgr.GetQuickslotID( m_CreatureSlotMgr.GetSelectedCreature(), nSkillID, slotList ); for( int i(0); i(GetChild( CStringUtil::StringFormat("creature02_quick_clockbox%02d", slotList[i]).c_str() )); if( pWnd ) { pWnd->SetMaxTime( 0 ); pWnd->SetCurTime( 0 ); pWnd->Begin(); } } slotList.clear(); } ///////////////////////////////////////////////// // 탭 //////////////////////////////////////////////// bool SUICreatureSkillWnd::IsActiveTab() const { return ( m_nTabType == TAB_ACTIVE ); } void SUICreatureSkillWnd::SelectTab() { RefreshScrollbar(); RefreshSkillSlot( m_nScrollPos ); } ///////////////////////////////////////////////// // 스크롤바 //////////////////////////////////////////////// void SUICreatureSkillWnd::RefreshScrollbar() { int nCurCount; if( IsActiveTab() ) nCurCount = static_cast(m_vecActiveSkillList.size()); else nCurCount = static_cast(m_vecPassiveSkillList.size()); int nScrollRange = max(nCurCount - m_nMaxLine, 0); KUIControlVScroll* pScrollBar = dynamicCast(GetChild( c_szVSCROLL )); if( NULL != pScrollBar ) { pScrollBar->SetMaxRange( DWORD(nScrollRange)+1 ); m_nScrollPos = pScrollBar->GetPosition(); pScrollBar->SetPosition( m_nScrollPos ); } } void SUICreatureSkillWnd::ResizeScrollbar( int nOldHeight ) { KUIControlVScroll* pScrollBar = dynamicCast(GetChild( c_szVSCROLL )); if( NULL != pScrollBar ) { KRect ktBottom; KRect ktTop; KUIControlStatic* pWnd; pWnd = dynamicCast(GetChild( "button_use" )); if( pWnd != NULL ) ktBottom = pWnd->GetRect(); pWnd = dynamicCast(GetChild( "creature02_tab" )); if( pWnd != NULL ) ktTop = pWnd->GetRect(); KRect ktRect = pScrollBar->GetRect(); ktRect.top = ktTop.bottom; ktRect.bottom = ktBottom.top-2; pScrollBar->Resize( ktRect ); // max 변경 int nDelta = GetRect().GetHeight() - nOldHeight; if( nDelta > 0 ) m_nMaxLine += nDelta/c_nDelta; else if( nDelta < 0 ) m_nMaxLine -= ((-1)*nDelta)/c_nDelta; m_nMaxLine = max( m_nMaxLine, c_nMinLine ); m_nMaxLine = min( m_nMaxLine, c_nMaxLine ); RefreshScrollbar(); // 스크롤 바 갱신 RefreshSkillSlot( m_nScrollPos ); // 스킬 슬롯 } } ////////////////////////////////////////////////////////////////////////// // 정보 ////////////////////////////////////////////////////////////////////////// void SUICreatureSkillWnd::RefreshCreatureInfo() { if( !m_CreatureSlotMgr.GetSelectedCreature() ) return; const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( m_CreatureSlotMgr.GetSelectedCreature() ); if( pInfo == NULL ) return; KUIControlMultiIcon* pIcon = dynamicCast(GetChild( "creature_faceicon" )); if( pIcon ) { //gmpbigsun(20130411): BORDER추가 ResetMultiIcon( pIcon, 0, 4 ); SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_CreatureSlotMgr.GetSelectedCreatureCard()); char iconName[128]; int enhance = (slot) ? slot->GetEnhance() : 0; ::getEnhanceIconName(iconName, pInfo, enhance); pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName ); 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() ); } SetChildShow( "creature_gradenumber_plus", true ); SetChildShow( "creature_gradenumber_number", false ); { //크리처 등급/오버브리드/이름 쎄팅부분 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( "static_grade_00", strRank.c_str() ); SetChildTooltip( "static_grade_00", GetCreatureDB().GetRateString( byRank ).c_str() ); if( NULL != m_pOverBreed && NULL != m_pOverBreedIcon ) { int nOverBreed( pInfo->GetOverBreed() ); if( nOverBreed ) { m_pOverBreedIcon->SetShow( true ); m_pOverBreed->SetShow( true ); std::string strOverBreed( m_strOverBreedPropertyTag ); strOverBreed.append( StringFormat( "+%u", nOverBreed ) ); m_pOverBreed->SetCaption( strOverBreed.c_str() ); } else { m_pOverBreedIcon->SetShow( false ); m_pOverBreed->SetShow( false ); } } if( m_pEvolutionRankIcon ) { string strGetEvolutionFormIconFileName( GetCreatureDB().GetEvolutionFormIconFileName( pInfo->GetID() ) ); if( strGetEvolutionFormIconFileName.empty() ) { m_pEvolutionRankIcon->SetShow( false ); } else { m_pEvolutionRankIcon->SetIcon( c_szDEF_SPR_NAME, strGetEvolutionFormIconFileName.c_str() ); m_pEvolutionRankIcon->SetTooltip( GetCreatureDB().GetEvolutionFormString( pInfo->GetID() ).c_str() ); m_pEvolutionRankIcon->SetShow( true ); } } std::string strName( "" ); strName += CStringUtil::StringFormat( "%s", pInfo->GetName() ); SetChildCaption( "creature_customname_text", strName.c_str() ); } { //크리처 class 쎄팅부분 _SUMMON_INFO_FILE * pSummon = GetCreatureDB().GetCreatureData( pInfo->GetID() ); if( pSummon ) SetChildCaption( "creature_name_text", CStringUtil::StringFormat( "<#fcc42f>%s", GetStringDB().GetString( pSummon->name_id ) ).c_str() ); else SetChildCaption( "creature_name_text", CStringUtil::StringFormat( "<#fcc42f>%s", pInfo->GetName() ).c_str() ); } // K/M 처리 /// 2011.04.27 정리 - prodongi /* int nJP = pInfo->GetJP(); const char* szCaption = m_pDisplayInfo->GetJP( &nJP ); SetChildShow( "static_jp_k_font", ( szCaption != NULL ) ); SetChildCaption( "static_creature_jp_value", CStringUtil::StringFormat( "%s%d", S(6425), nJP ).c_str() ); */ std::string jpStr; jpToString(pInfo->GetJP(), jpStr); SetChildCaption( "static_creature_jp_value", jpStr.c_str()); SetChildCaption( "static_creature_lv_value", CStringUtil::StringFormat( "%s%d", S(6425), pInfo->GetLevel() ).c_str() ); } ////////////////////////////////////////////////// // 스킬리스트 ///////////////////////////////////////////////// void SUICreatureSkillWnd::FreeSkillList() { m_vecActiveSkillList.clear(); m_vecPassiveSkillList.clear(); } bool SUICreatureSkillWnd::IsExistSkill( int nSkillID, bool bActive ) { SKILL_VECTOR::iterator it; if( bActive ) { it = m_vecActiveSkillList.begin(); while( it != m_vecActiveSkillList.end() ) { if( (*it)->GetSkillID() == nSkillID ) return true; it++; } } else { it = m_vecPassiveSkillList.begin(); while( it != m_vecPassiveSkillList.end() ) { if( (*it)->GetSkillID() == nSkillID ) return true; it++; } } return false; } void SUICreatureSkillWnd::UpdateSkill( SSkillSlot* pSkill, bool bActive ) { SKILL_VECTOR::iterator it; if( bActive ) { it = m_vecActiveSkillList.begin(); while( it != m_vecActiveSkillList.end() ) { SSkillSlot* pSkillSlot = (*it); if( pSkill->GetSkillID() == pSkillSlot->GetSkillID() ) { (*it)->SetBaseLevel( pSkill->GetSkill().base_skill_level ); (*it)->SetCurLevel( pSkill->GetSkill().current_skill_level ); (*it)->SetUseLevel( pSkill->GetUseLevel() ); (*it)->SetSkillCard( pSkill->GetSkillCard() ); (*it)->SetCasting( pSkill->IsCasting() ); (*it)->SetFire( pSkill->IsFire() ); break; } it++; } } else { it = m_vecPassiveSkillList.begin(); while( it != m_vecPassiveSkillList.end() ) { SSkillSlot* pSkillSlot = (*it); if( pSkill->GetSkillID() == pSkillSlot->GetSkillID() ) { (*it)->SetBaseLevel( pSkill->GetSkill().base_skill_level ); (*it)->SetCurLevel( pSkill->GetSkill().current_skill_level ); (*it)->SetUseLevel( pSkill->GetUseLevel() ); (*it)->SetSkillCard( pSkill->GetSkillCard() ); (*it)->SetCasting( pSkill->IsCasting() ); (*it)->SetFire( pSkill->IsFire() ); break; } it++; } } } void SUICreatureSkillWnd::RefreshSkillInfo() { FreeSkillList(); const std::vector & vecSkillList = m_CreatureSkillSlotMgr.GetSkillList(); std::vector::const_iterator it = vecSkillList.begin(); while( it != vecSkillList.end() ) { SSkillSlot* pSlot( (*it) ); if( NULL == pSlot ) { SDEBUGLOG( "[크리쳐 스킬] 스킬 정보 포인터가 유효하지 않습니다." ); assert( pSlot ); it++; continue; } if( NULL == pSlot->GetCurLevel() ) { it++; continue; // 현재 스킬 레벨이 0 이라면 등록하지 않는다 } if( pSlot->GetTarget() == m_CreatureSlotMgr.GetSelectedCreature() ) { SkillBaseEx* s_data = GetSkillDB().GetSkillData( pSlot->GetSkillID() ); if( s_data && !s_data->IsSystemSkill() ) { if( IsExistSkill(pSlot->GetSkillID(), !s_data->IsPassive() ) ) UpdateSkill( pSlot, !s_data->IsPassive() ); else { if( !s_data->IsPassive() ) m_vecActiveSkillList.push_back( pSlot ); else m_vecPassiveSkillList.push_back( pSlot ); } } } it++; } RefreshScrollbar(); // 2010.07.15 - prodongi RefreshAddedSkillList(); RefreshSkillSlot( m_nScrollPos ); // RefreshCreatureQuickSlots(); // 2011.11.29 - servantes : 쓰이지 않음 } void SUICreatureSkillWnd::SetSkillData( SSkillSlot* pSkill, int nIndex, bool bShow ) { SkillBaseEx* s_data = GetSkillDB().GetSkillData( pSkill->GetSkillID() ); if( s_data == NULL ) return; // 스킬 아이콘 KUIControlIconStatic* pIcon = dynamicCast(GetChild( CStringUtil::StringFormat( "creature02_skillicon%02d", nIndex ).c_str() )); if( pIcon && bShow ) { pIcon->SetIcon( c_szDEF_SPR_NAME, s_data->icon_file_name ); // sonador 1.2.5 Lazy Tooltip 구현 pIcon->SetLazyTooltip( new KLazyCreatureSkillTooltip( *m_pDisplayInfo, pSkill->GetSkillID(), pSkill->GetUseLevel(), true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동 } // 2010.07.21 - prodongi // 스킬 레벨 //SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), pSkill->GetUseLevel() ).c_str() ); if (pSkill->GetAddedLevel()) SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d", S(6425), pSkill->GetUseLevel() ).c_str() ); else SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), pSkill->GetUseLevel() ).c_str() ); // 스킬 이름 SetChildCaption( CStringUtil::StringFormat( "creature02_skillname_text%02d", nIndex ).c_str(), GetStringDB().GetString( s_data->GetNameID() ) ); // 2010.07.21 - prodongi // 스킬 설명 //SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d / " , S(6425), pSkill->GetUseLevel() ).c_str() ); //SetChildCaption( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s<#e6fd30>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel() ).c_str() ); if (pSkill->GetAddedLevel()) { SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d / " , S(6425), pSkill->GetUseLevel() ).c_str() ); SetChildCaption( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel() ).c_str() ); } else { SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d / " , S(6425), pSkill->GetUseLevel() ).c_str() ); SetChildCaption( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s<#e6fd30>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel() ).c_str() ); } // 소모 MP SetChildCaption( CStringUtil::StringFormat( "static_skill_mp_value%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), s_data->GetCostMP( pSkill->GetUseLevel() ) ).c_str() ); } int SUICreatureSkillWnd::GetSkillID( int nIndex ) { if( nIndex < 0 ) return -1; if( nIndex >= static_cast(m_vecActiveSkillList.size()) ) return -1; SSkillSlot* pSkill = m_vecActiveSkillList[nIndex]; return pSkill->GetSkillID(); } // 2010.07.15 - prodongi void SUICreatureSkillWnd::RefreshAddedSkillList() { const std::vector & vecSkillList = m_CreatureSkillSlotMgr.GetSkillList(); const std::vector & vecAddedSkillList = m_CreatureSkillSlotMgr.GetAddedSkillList(); std::vector::const_iterator it = vecSkillList.begin(); while( it != vecSkillList.end() ) { SSkillSlot* pSlot = (*it); int lv = 0; std::vector::const_iterator pit = vecAddedSkillList.begin(); while (pit != vecAddedSkillList.end() ) { SAddedSkillInfo * pInfo = (*pit); lv += pInfo->GetLevel( pSlot->GetSkillID(), pSlot->GetTarget() ); pit ++; } int mlv = pSlot->GetBaseLevel() + lv; pSlot->SetUseLevel(mlv); pSlot->SetCurLevel(mlv); pSlot->SetAddedLevel(lv); it++; } } ////////////////////////////////////////////////// // 스킬슬롯 ///////////////////////////////////////////////// void SUICreatureSkillWnd::RefreshSkillSlot( int nRange ) { HideSelectBar(); if( IsActiveTab() ) RefreshActiveSkillSlot(nRange); else RefreshPassiveSkillSlot(nRange); } void SUICreatureSkillWnd::RefreshActiveSkillSlot( int nRange ) { for( int i = 0; i < c_nMaxLine; i++ ) { if( i >= m_nMaxLine ) { DisableSlot(i); continue; } if( i+nRange < static_cast(m_vecActiveSkillList.size()) ) { SSkillSlot* pSkill = m_vecActiveSkillList[nRange+i]; EnableSlot(i, true, TAB_ACTIVE, pSkill->GetSkillID() ); SetSkillData( pSkill, i, true ); } else EnableSlot(i, false, TAB_ACTIVE ); } } void SUICreatureSkillWnd::RefreshPassiveSkillSlot( int nRange ) { for( int i = 0; i < c_nMaxLine; i++ ) { if( i >= m_nMaxLine ) { DisableSlot(i); continue; } if( i+nRange < static_cast(m_vecPassiveSkillList.size()) ) { SSkillSlot* pSkill = m_vecPassiveSkillList[i+nRange]; EnableSlot(i, true, TAB_PASSIVE, pSkill->GetSkillID() ); SetSkillData( pSkill, i, true ); } else EnableSlot(i, false, TAB_PASSIVE ); } } void SUICreatureSkillWnd::EnableSlot( int nMode, bool bShow, bool bPassive, int nSkillID ) { KUIControlIconStatic* pIcon = NULL; KUIControlClockBox* pClock = NULL; // 스킬 아이콘 기본 if( bShow == false ) { pIcon = dynamicCast(GetChild( CStringUtil::StringFormat( "creature02_skillicon%02d", nMode ).c_str() )) ; if( pIcon ) { pIcon->SetIcon( c_szDEF_SPR_NAME, "static_common_itemslot" ); // sonador 1.2.5 Lazy Tooltip 구현 pIcon->SetLazyTooltip(); pIcon->SetShow(true); // 스킬 아이콘은 항상 보여야 한다 } } // 스킬 쿨링 타임 검사 pClock = dynamicCast(GetChild( CStringUtil::StringFormat( "creature02_clockbox%02d", nMode ).c_str() )); if( pClock ) { if( nSkillID != -1 && m_CreatureSkillSlotMgr.IsCastingSkill( nSkillID, m_CreatureSlotMgr.GetSelectedCreature() ) ) pClock->Init(); else if( nSkillID != -1 && m_CreatureSkillSlotMgr.IsFireSkill( nSkillID, m_CreatureSlotMgr.GetSelectedCreature() ) ) { pClock->SetMaxTime( m_CreatureSkillSlotMgr.GetSkillMaxTime(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ); pClock->SetCurTime( m_CreatureSkillSlotMgr.GetSkillCurTime(nSkillID, m_CreatureSlotMgr.GetSelectedCreature()) ); pClock->Begin(); } else { pClock->SetCurTime(0); pClock->SetMaxTime(0); pClock->Begin(); } } // SetChildShow( CStringUtil::StringFormat( "creature02_lvinfo%02d" , nMode ).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllv%02d" , nMode ).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllv%02d_value", nMode ).c_str(), bShow ); if( bShow ) bPassive = !bPassive; else bPassive = false; SetChildShow( CStringUtil::StringFormat( "creature02_lvinfo_up%02d" , nMode ).c_str(), bPassive ); SetChildShow( CStringUtil::StringFormat( "creature02_lvinfo_down%02d" , nMode ).c_str(), bPassive ); SetChildShow( CStringUtil::StringFormat( "creature02_skillname_text%02d" , nMode ).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nMode ).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nMode ).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat( "static_skill_mp%02d" , nMode ).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat( "static_skill_mp_value%02d" , nMode ).c_str(), bShow ); } void SUICreatureSkillWnd::DisableSlot( int nIndex ) { SetChildShow( CStringUtil::StringFormat( "creature02_skillicon%02d" , nIndex ).c_str(), false ); // SetChildShow( CStringUtil::StringFormat( "creature02_lvinfo%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllv%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_lvinfo_up%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_lvinfo_down%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_skillname_text%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "creature02_clockbox%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "static_skill_mp%02d" , nIndex ).c_str(), false ); SetChildShow( CStringUtil::StringFormat( "static_skill_mp_value%02d" , nIndex ).c_str(), false ); } void SUICreatureSkillWnd::DisableAllSlot( bool bShow ) { for( int i = 0; i < c_nMaxLine; i++ ) { if( i < m_nMaxLine ) EnableSlot( i, false, m_nTabType, -1 ); else DisableSlot(i); } SetChildCaption( "creature_customname_text", "" ); SetChildCaption( "creature_name_text", "" ); SetChildShow( "creature_gradenumber_plus", false ); SetChildShow( "creature_gradenumber_number", false ); } ////////////////////////////////////////////////// // 선택바 ////////////////////////////////////////////////// void SUICreatureSkillWnd::ShowSelectBar( int nIndex ) { HideSelectBar(); m_nSelSkillPos = nIndex; KUIControlVScroll* pScrollBar = dynamicCast(GetChild( c_szVSCROLL )); if( NULL != pScrollBar ) m_nSelSkillPos += (pScrollBar->GetPosition()+1); // 스크롤바 만큼 더해져야 한다 bool bActive = false; if( IsActiveTab() ) bActive = true; if( m_nTabType == TAB_ACTIVE && m_vecActiveSkillList.size() <= m_nSelSkillPos-1 ) return; else if( m_nTabType == TAB_PASSIVE && m_vecPassiveSkillList.size() <= m_nSelSkillPos-1 ) return; // 선택바 보이기 KUIWnd* pBg = GetChild( CStringUtil::StringFormat( "creature02_skillicon%02d", nIndex ).c_str() ); if( pBg ) { SetMovePos( "creature02_selectbar", pBg->GetRect().left-c_nIconSelectDelta, pBg->GetRect().top-4 ); SetChildShow( "creature02_selectbar", true ); } // 아이콘 선택 보이기 KUIWnd* pIcon = GetChild( CStringUtil::StringFormat( "creature02_skillicon%02d", nIndex ).c_str() ); if( pIcon ) { SetMovePos ( "creature02_selectbar_back", pIcon->GetRect().left-c_nIconSelectDelta, pIcon->GetRect().top ); SetChildShow( "creature02_selectbar_back", true ); SetMovePos ( "creature02_skillicon_select", pIcon->GetRect().left/*-c_nIconSelectDelta*/, pIcon->GetRect().top ); SetChildShow( "creature02_skillicon_select", true ); } } void SUICreatureSkillWnd::HideSelectBar() { m_nSelSkillPos = -1; // 아이콘 선택 감추기 SetChildShow( "creature02_skillicon_select", false ); // 선택바 감추기 SetChildShow( "creature02_selectbar", false ); SetChildShow( "creature02_selectbar_back", false ); } /////////////////////////////////////////////// // 드래그앤드랍 ////////////////////////////////////////////// int SUICreatureSkillWnd::GetUseLevel( int nSkillID ) const { SKILL_VECTOR::const_iterator it; if( IsActiveTab() ) { it = m_vecActiveSkillList.begin(); while( it != m_vecActiveSkillList.end() ) { SSkillSlot* pSkill = (*it); if( pSkill->GetSkillID() == nSkillID ) return pSkill->GetUseLevel(); it++; } } else { it = m_vecPassiveSkillList.begin(); while( it != m_vecPassiveSkillList.end() ) { SSkillSlot* pSkill = (*it); if( pSkill->GetSkillID() == nSkillID ) return pSkill->GetUseLevel(); it++; } } return -1; } int SUICreatureSkillWnd::GetSkillIDByCtrlName( const char* szCtrlName ) const { if( IsActiveTab() ) return GetActiveSkillID(szCtrlName); else return GetPassiveSkillID(szCtrlName); return -1; } int SUICreatureSkillWnd::GetActiveSkillID( const char* szSprName ) const { // 2011.11.29 - servantes : 옵션 nui에 해당 컨트롤 없음 / 주석처리 //if( m_bIsQuickSlotItem ) // 장착된 스킬이라면 퀵슬롯 정보에서 //{ // for( int i = 0; i < c_nQUICK_SLOT_CNT; i++ ) // { // if( _stricmp( szSprName, CStringUtil::StringFormat( c_szSKILL_QUICK_SLOT, i ).c_str() ) == 0 ) // { // QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( m_CreatureSlotMgr.GetSelectedCreature(), i ); // if( pSlot ) // return pSlot->m_nSkillID; // } // } //} //else //{ for( int i = 0; i < m_nMaxLine; i++ ) { if( _stricmp( szSprName, CStringUtil::StringFormat( "creature02_skillicon%02d", i ).c_str() ) == 0 ) { if( i+m_nScrollPos < static_cast(m_vecActiveSkillList.size()) ) { SSkillSlot* pSkill = m_vecActiveSkillList[i+m_nScrollPos]; return pSkill->GetSkillID(); } } } //} return -1; } int SUICreatureSkillWnd::GetPassiveSkillID( const char* szSprName ) const { for( int i = 0; i < m_nMaxLine; i++ ) { if( _stricmp( szSprName, CStringUtil::StringFormat( "creature02_skillicon%02d", i ).c_str() ) == 0 ) { if( i+m_nScrollPos < static_cast(m_vecPassiveSkillList.size()) ) { SSkillSlot* pSkill = m_vecPassiveSkillList[i+m_nScrollPos]; return pSkill->GetSkillID(); } } } return -1; } QUICK_SKILL* SUICreatureSkillWnd::GetQuickSkillDByCtrlName( const char* szCtrlName ) const { // if( IsActiveTab() ) // return GetActiveQuickSkill(szCtrlName); return NULL; } QUICK_SKILL* SUICreatureSkillWnd::GetActiveQuickSkill( const char* szSprName ) const { // 2011.11.29 - servantes : 옵션 nui에 해당 컨트롤 없음 / 주석처리 //if( m_bIsQuickSlotItem ) // 장착된 스킬이라면 퀵슬롯 정보에서 //{ // for( int i = 0; i < c_nQUICK_SLOT_CNT; i++ ) // { // if( _stricmp( szSprName, CStringUtil::StringFormat( c_szSKILL_QUICK_SLOT, i ).c_str() ) == 0 ) // { // QUICK_SKILL* pSlot = m_CreatureSkillSlotMgr.FindQuickSlot( m_CreatureSlotMgr.GetSelectedCreature(), i ); // if( pSlot ) return pSlot; // } // } //} return NULL; } void SUICreatureSkillWnd::SkillUp( int nIndex ) { if( nIndex < 0 ) return; if( nIndex >= static_cast(m_vecActiveSkillList.size()) ) return; SSkillSlot* pSkill = m_vecActiveSkillList[nIndex]; if( pSkill ) { int lv = pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel(); if( lv == 1 ) return; if( lv < pSkill->GetUseLevel() + 1 ) return; int nLevel = pSkill->GetUseLevel() + 1; pSkill->SetUseLevel( nLevel ); _setSkillLevel( nIndex, nLevel, pSkill ); } } void SUICreatureSkillWnd::SkillDown( int nIndex ) { if( nIndex < 0 ) return; if( nIndex >= static_cast(m_vecActiveSkillList.size()) ) return; SSkillSlot* pSkill = m_vecActiveSkillList[nIndex]; if( pSkill ) { int lv = pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel(); if( lv == 1 ) return; if( pSkill->GetUseLevel() - 1 < 1 ) return; int nLevel = pSkill->GetUseLevel() - 1; pSkill->SetUseLevel( nLevel ); _setSkillLevel( nIndex, nLevel, pSkill ); } } void SUICreatureSkillWnd::_setSkillLevel( int nIndex, int nLevel, SSkillSlot* pSkill ) { if( pSkill ) { SkillBaseEx* s_data = GetSkillDB().GetSkillData( pSkill->GetSkillID() ); if( s_data == NULL ) return; // 2010.07.21 - prodongi //SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), nLevel ).c_str() ); // 정보 갱신해 준다 //SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s%d / " , S(6425), nLevel ).c_str() ) ; //SetChildCaption( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s<#e6fd30>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel()).c_str() ); if (pSkill->GetAddedLevel()) { SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d", S(6425), nLevel ).c_str() ); // 정보 갱신해 준다 SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d / " , S(6425), nLevel ).c_str() ) ; SetChildCaption( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel()).c_str() ); } else { SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv%02d_value" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), nLevel ).c_str() ); // 정보 갱신해 준다 SetChildCaption( CStringUtil::StringFormat( "creature02_skilllv_text%02d" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s%d / " , S(6425), nLevel ).c_str() ) ; SetChildCaption( CStringUtil::StringFormat( "creature02_skilllvmax_text%02d", nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s<#e6fd30>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel()).c_str() ); } SetChildCaption( CStringUtil::StringFormat( "static_skill_mp_value%02d" , nIndex-m_nScrollPos ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), s_data->GetCostMP( nLevel ) ).c_str() ); // 툴팁 정보 갱신해 준다 KUIControlIconStatic* pIcon = dynamicCast(GetChild( CStringUtil::StringFormat( "creature02_skillicon%02d", nIndex-m_nScrollPos ).c_str() )); if( pIcon ) { // sonador 1.2.5 Lazy Tooltip 구현 pIcon->SetLazyTooltip( new KLazyCreatureSkillTooltip( *m_pDisplayInfo, pSkill->GetSkillID(), pSkill->GetUseLevel(), true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동 } } }