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

1944 lines
63 KiB
C++

/// 2010.12.17 - prodongi
#include "stdafx.h"
#include "KUITabControl.h"
#include "KUIDragAndDrop.h"
#include "KUIControlButton.h"
#include "KUIControlStatic.h"
#include "KUIControlScroll.h"
#include "KUIControlClockBox.h"
#include "SGameManager.h"
#include "SUISkillWnd.h"
#include "SUIDisplayInfo.h"
#include "SUILazyTooltip.h" // sonador #2.1.2.4.3 팻 조작 UI 연동
//#include "SUIUtil.h" // 2011.04.29 - servantes
#include "SStringDB.h"
#include "SSkillDB.h"
#include "SExpDB.h"
#include "SJobDB.h"
#include "SItemDB.h"
#include "ErrorCode/ErrorCode.h"
#include "SPlayerInfoMgr.h"
//#include "SGameMessageUI.h"
#include "SInventoryMgr.h"
#include "SUISysMsgDefine.h"
namespace{
int c_nMaxJobChange = 3; // MJ 2004/11/02 퀄업때까지는 3차까지, 나중에 5차까지 확장
const int c_nMaxHeight = 560; // 최대로 늘릴때 max
const int c_nDelta = 38; // 늘어나는 단위
/// 2010.12.16 - prodongi
const int c_nMaxLine = 11;
const int c_nMinLine = 11;
const int c_nSysMenu = 56; // 왼쪽 메뉴 바 width
const int c_nChildWnd = 235; // 차일드 width
const int c_nTabClickArea = 9; // 탭 클릭 영역
const int c_nButtonClickArea = 20; // 버튼 클릭 영역
const int c_nIconSelectDelta = 6; // 아이콘 선택 static 표시 위치 delta
enum{ // 탭 타입
TAB_ACTIVE = 0,
TAB_PASSIVE,
};
enum{ // 스킬 타입
SKILLTYPE_PASSIVE = 0,
SKILLTYPE_ACTIVE,
};
enum{ // 카드 슬롯 장착 상태
CARD_NONE = 0, // 카드 없음
CARD_SLOT, // 카드 있음
CARD_DISABLE, // 있지만 사용불가
};
const char* c_szButtonJLVUp = "button_jlvup";
};
using namespace rp;
SUISkillWnd::~SUISkillWnd()
{
FreeSkillList();
}
bool SUISkillWnd::InitControls( KPoint kPos )
{
/// 2010.12.16 - prodongi
SetCustomMovingRect( KRect( 0, 0, 342, 25 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
// 리사이즈 할때 단위 설정, ( 세로, 가로, 위드, 헤잇 )
SetResizeUnit( 0, c_nDelta, KSize((GetRect().right-GetRect().left), (GetRect().bottom-GetRect().top)), KSize((GetRect().right-GetRect().left), c_nMaxHeight) );
// // 버튼 클릭 영역
// SetValidRect( "skill_fund", KRect( 0, 0, -c_nButtonClickArea, 0 ) );
CreateControls(); // 컨트롤 생성
/// 2010.12.21 - prodongi
m_jobRankButton[JOP_0] = dynamicCast<KUIControlCheck*>(GetChild("button_skill_sort_basic_01"));
m_jobRankButton[JOP_1] = dynamicCast<KUIControlCheck*>(GetChild("button_skill_sort_first_01"));
m_jobRankButton[JOP_2] = dynamicCast<KUIControlCheck*>(GetChild("button_skill_sort_second_01"));
m_jobRankButton[JOP_3] = dynamicCast<KUIControlCheck*>(GetChild("button_skill_sort_master_01"));
m_jobRankButton[JOP_ALL] = dynamicCast<KUIControlCheck*>(GetChild("button_skill_sort_all_01"));
m_jobRankButton[JOP_TP] = dynamicCast<KUIControlCheck*>(GetChild("button_skill_sort_trait_01")); /// 2011.03.28 - prodongi
/// 2010.12.24 - prodongi
SetChildShow("skill_card_slot_00", false);
/// 2011.03.28 - prodongi
KUIControl* wnd = dynamicCast<KUIControl*>(GetChild("button_skill_tree_01"));
if (wnd)
wnd->SetTooltip(S(9524));
return SUIWnd::InitControls(kPos);
}
bool SUISkillWnd::InitData( bool bReload )
{
m_nSelSkillPos = -1;
m_nSysMenuPosX = -99;
m_nSysMenuPosY = -99;
m_nScrollPos = 0;
m_bIsOpenSkillFund = false;
m_nChangeJob = 0;
m_bShowChildWnd = true;
m_nMaxLine = c_nMinLine;
m_nTabType = TAB_ACTIVE;
FreeSkillList(); // 모든 리스트 삭제
DisableAllSlot(); // 모든 컨트롤 초기화
HideSelectBar(); // 선택바 초기화
m_nScrollPos = 0;
m_nSelectJopIndex = JOP_ALL;
m_aniJobLevelUp.init(this);
return SUIWnd::InitData(bReload);
}
void SUISkillWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen( bOpen, false );
if( bOpen )
{
m_pGameManager->StartSound( "ui_popup_window01.wav" );
m_aniJobLevelUp.setState(sAniJobLevelUp::END, GetRect());
SetJP();
SetJLevel();
SetJLvHistory();
setSelectedSheetTabItem(m_nTabType);
refreshJobRank();
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, GetBoundingRect().right, GetBoundingRect().bottom ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, m_nTabType ) );
}
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, (bOpen && m_bShowChildWnd) ) );
}
void* SUISkillWnd::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();
KUIWnd* pWnd = GetChild( szControlID );
if( pWnd == NULL ) return NULL;
// 스킬 카드 아이템
int nSkillCardIndex = GetCardSlotIndex(szControlID, true);
if( nSkillCardIndex != -1 )
{
m_pDisplayInfo->SetUIDragInfo( new SUISkillDragInfo( GetSkillID(nSkillCardIndex), GetSkillLevel(nSkillCardIndex), GetSkillCardItem(nSkillCardIndex), m_PlayerInfoMgr.GetPlayerHandle() ) );
m_pDragAndDropIcon->SetStateIcon( pWnd->GetSprName(), pWnd->GetAniName(), pWnd->GetFrameIndex(), STATE_NORMAL );
pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon;
}
else // 스킬 아이콘
{
int nSkillID = GetSkillIDByCtrlName( szControlID );
if( (-1) != nSkillID )
{
int nUseLevel = GetUseLevel( nSkillID );
if( (-1) != nUseLevel )
{
m_pDisplayInfo->SetUIDragInfo( new SUISkillDragInfo( nSkillID, nUseLevel, NULL, m_PlayerInfoMgr.GetPlayerHandle() ) );
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<KUISendRecvDropMessage*>( &msg );
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
if( NULL != pUIDragInfo ) m_pDisplayInfo->SetUIDragInfo();
return NULL;
}
else if ( id == id_UI_RECV_DROP )
{
// 액티브 스킬만 가능
if( GetTabType() != TAB_ACTIVE ) return NULL;
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 nCardSlot = GetCardSlotIndex( pDropMsg->sRecvDropControlID.c_str() );
//if( nCardSlot == -1 ) return NULL;
SUIInvenItemDragInfo* pInvenInfo = ( SUIInvenItemDragInfo* )pDragInfo;
if( pInvenInfo == NULL ) return NULL;
if( !IsSkillCard( -1, pInvenInfo->m_hItem) ) return NULL;
RequestEquipCard( -1, pInvenInfo->m_hItem );
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
return NULL;
}
return SUIWnd::Perform( id, msg );
}
void SUISkillWnd::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_SKILL, false) );
else if( ::_stricmp( lpszControlID, "skill_fund" ) == 0 ) // 스킬투자
{
m_bShowChildWnd = !m_bShowChildWnd;
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, m_bShowChildWnd ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, m_nTabType ) );
}
else if( ::_stricmp( lpszControlID, c_szButtonJLVUp ) == 0 ) // 잡레벨 업
{
/// 2010.12.20 - prodongi
if (m_aniJobLevelUp.isState(sAniJobLevelUp::END))
{
m_pGameManager->StartSound( "ui_click_jlv01.wav" );
m_aniJobLevelUp.setState(sAniJobLevelUp::READY, GetRect());
RequestJobLvUP();
}
}
/// 2010.12.21 스킬 사용 - prodongi
else if (strstr(lpszControlID, "button_skill_use_"))
{
RequestUseSkill(lpszControlID + strlen("button_skill_use_"));
}
/// 2010.12.15 - prodongi
else if (_stricmp(lpszControlID, "button_skill_tree_01") == 0)
{
toggleSkillTreeFundWnd();
}
else if (_stricmp(lpszControlID, "tab_active_01") == 0)
{
selectTabButton(TAB_ACTIVE);
}
else if (_stricmp(lpszControlID, "tab_passive_01") == 0)
{
selectTabButton(TAB_PASSIVE);
}
else
{
for( int i = 0; i < m_nMaxLine; i++ )
{
if( ::_stricmp( lpszControlID, CStringUtil::StringFormat( "skill_icon%02d", i ).c_str() ) == 0 ) // 선택 처리
{ ShowSelectBar(i); break; }
else if( ::_stricmp( lpszControlID, CStringUtil::StringFormat( "skill_lvinfo_up%02d", i ).c_str() ) == 0 ) // 스킬 업
{ SkillUp(m_nScrollPos+i); ShowSelectBar(i); break; }
else if( ::_stricmp( lpszControlID, CStringUtil::StringFormat( "skill_lvinfo_down%02d", i ).c_str() ) == 0 ) // 스킬 다운
{ SkillDown(m_nScrollPos+i); ShowSelectBar(i); break; }
}
}
}
break;
case KUI_MESSAGE::KICON_PRESSING:
case KUI_MESSAGE::KICON_CLICK:
{
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( "skill_icon%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( "skill_icon%02d", i ).c_str() ) == 0 ) // 선택 처리
{
ShowSelectBar(i);
RequestUseSkill();
break;
}
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
{
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSMENU, GetRect().left, GetRect().top ) ); // 좌측 메뉴도 이동
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, GetBoundingRect().right, GetBoundingRect().bottom ) );
}
break;
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택
{
int nPos = int(lparam);
nPos = max( nPos, 0 );
m_nScrollPos = nPos;
RefreshSkillSlot();
}
break;
case KUI_MESSAGE::KGENWND_RESIZE: // 윈도우 리사이즈
{
int nDelta = GetRect().GetHeight() - static_cast<int>(wparam);
KUIWnd * pOutfram = GetChild( "outframe" );
if( pOutfram )
{
KRect rcChild = pOutfram->GetRect();
rcChild.bottom += nDelta;
pOutfram->Resize( rcChild );
}
KUIWnd * pInfram = GetChild( "inframe" );
if( pInfram )
{
KRect rcChild = pInfram->GetRect();
rcChild.bottom += nDelta;
pInfram->Resize( rcChild );
}
ResizeScrollbar( static_cast<int>(wparam) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, GetBoundingRect().right, GetBoundingRect().bottom ) );
}
break;
case KUI_MESSAGE::KFOCUS_ACTIVATED:
{
if( GetRect().IsInRect( static_cast<int>(lparam), static_cast<int>(wparam) ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_FOCUS(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSMENU) );
}
}
break;
/// 2010.12.21 - prodongi
case KUI_MESSAGE::KCHECK_CHANGE:
{
if (_stricmp(lpszControlID, "button_skill_sort_all_01") == 0)
{
selectJobRankButton(JOP_ALL);
}
else if (_stricmp(lpszControlID, "button_skill_sort_basic_01") == 0)
{
selectJobRankButton(JOP_0);
}
else if (_stricmp(lpszControlID, "button_skill_sort_first_01") == 0)
{
selectJobRankButton(JOP_1);
}
else if (_stricmp(lpszControlID, "button_skill_sort_second_01") == 0)
{
selectJobRankButton(JOP_2);
}
else if (_stricmp(lpszControlID, "button_skill_sort_master_01") == 0)
{
selectJobRankButton(JOP_3);
}
/// 2011.03.28 - prodongi
else if (_stricmp(lpszControlID, "button_skill_sort_trait_01") == 0)
{
selectJobRankButton(JOP_TP);
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUISkillWnd::Process(DWORD dwTime)
{
SUIWnd::Process(dwTime);
DWORD elapsedtime = dwTime - m_lastTime;
m_lastTime = dwTime;
if (m_aniJobLevelUp.procedure(this, elapsedtime))
{
SetJLvHistory();
}
}
void SUISkillWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_TAB_UPDATE:
{
SIMSG_UI_TAB_UPDATE* pSkillMsg = ( SIMSG_UI_TAB_UPDATE* )pMsg;
setSelectedSheetTabItem(pSkillMsg->m_nTabType);
m_nTabType = pSkillMsg->m_nTabType;
SelectTab();
pMsg->bUse = true;
}
break;
case IMSG_TOGGLE_UIWINDOW:
case IMSG_SHOW_UIWINDOW:
{
if( m_nSysMenuPosX > -99 && m_nSysMenuPosY > -99 )
{
MovePos(m_nSysMenuPosX, m_nSysMenuPosY);
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, GetBoundingRect().right, GetBoundingRect().bottom ) );
}
pMsg->bUse = true;
}
break;
case MSG_EXP_UPDATE: // jp
{
SetJP();
SetJLvHistory();
pMsg->bUse = true;
}
break;
case MSG_LEVEL_UPDATE: // 직업레벨
{
// SetJLevel();
// SetJLvHistory();
pMsg->bUse = true;
}
break;
case MSG_PROPERTY:
{
SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg;
switch( pPropertyMsg->nPropertyType )
{
case SMSG_PROPERTY::PROPERTY_JOB: // 직업아이디
if( ChangeJop() )
SetJName();
break;
case SMSG_PROPERTY::PROPERTY_JOB_LEVEL:
{
SetJLevel();
/// 2010.12.20 - prodongi
if (m_aniJobLevelUp.isState(sAniJobLevelUp::READY))
{
m_aniJobLevelUp.setState(sAniJobLevelUp::BEGIN, GetRect());
m_aniJobLevelUp.setTopWndCaption(m_PlayerInfoMgr.GetPlayerInfo().GetJLv(), m_nChangeJob);
}
else if (m_aniJobLevelUp.isState(sAniJobLevelUp::BEGIN))
{
}
else
{
SetJLvHistory();
}
}
break;
case SMSG_PROPERTY::PROPERTY_JP:
{
if( !IsShow() ) break;
SetJP();
SPlayerInfo & info = m_PlayerInfoMgr.GetPlayerInfo();
SetCurJLevel( info.GetJLv(), info.GetJP() );
}
break;
case SMSG_PROPERTY::PROPERTY_JOB_0:
case SMSG_PROPERTY::PROPERTY_JOB_1:
case SMSG_PROPERTY::PROPERTY_JOB_2:
case SMSG_PROPERTY::PROPERTY_JLV_0:
case SMSG_PROPERTY::PROPERTY_JLV_1:
case SMSG_PROPERTY::PROPERTY_JLV_2:
// RefreshSkillSlot( m_nScrollPos );
break;
}
pMsg->bUse = true;
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
m_nSysMenuPosX = pMoveMsg->m_nX;
m_nSysMenuPosY = pMoveMsg->m_nY;
pMsg->bUse = true;
}
break;
case IMSG_UI_FOCUS:
{
m_pManager->SetFocus(this);
pMsg->bUse = true;
}
break;
case MSG_SKILLCARD_INFO:
{
if( !IsShow() ) break;
RefreshSkillSlot();
pMsg->bUse = true;
}
break;
case MSG_ADDED_SKILL_LIST:
{
RefreshAddedSkillList();
RefreshSkillSlot();
pMsg->bUse = true;
}
break;
case MSG_SKILL_LIST:
{
SMSG_SKILL_LIST* pSkillList = (SMSG_SKILL_LIST*)pMsg;
/// 2011.07.04 - prodongi
if( pSkillList->isRefresh())
FreeSkillList();
UpdateSkillList();
RefreshScrollbar();
RefreshAddedSkillList();
RefreshSkillSlot();
pMsg->bUse = true;
}
break;
case MSG_SKILL_EVENT:
{
SMSG_SKILL_EVENT* pSkillEvent = (SMSG_SKILL_EVENT*)pMsg;
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*/ );
}
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_SKILL_TIME_UPDATE:
{
SIMSG_UI_SKILL_TIME_UPDATE* pSkillMsg = ( SIMSG_UI_SKILL_TIME_UPDATE* )pMsg;
if( m_PlayerInfoMgr.IsLocalPlayer(pSkillMsg->m_hTarget) )
{
// 스킬 업데이트
// UpdateSkill( m_SkillSlotMgr.GetSkillSlot(pSkillMsg->m_nSkillID), true );
RefreshScrollbar();
RefreshSkillSlot();
}
pMsg->bUse = true;
}
break;
}
}
///////////////////////////////////////////////////////////
// 윈도우
///////////////////////////////////////////////////////////
void SUISkillWnd::CreateControls()
{
RECT rc;
rc.left = 0; rc.top = c_nDelta; rc.right = 0; rc.bottom = c_nDelta;
// 아이콘
int i;
for( i = 0; i < c_nMaxLine-1; i++ )
{
CopyControl( CStringUtil::StringFormat("skill_card_bg_%02d", i).c_str(), CStringUtil::StringFormat("skill_card_bg_%02d", i+1).c_str(), rc ); // 2010.12.21 - prodongi
CopyControl( CStringUtil::StringFormat("skill_icon%02d", i).c_str(), CStringUtil::StringFormat("skill_icon%02d", i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_card%02d", i).c_str(), CStringUtil::StringFormat("skill_card%02d", i+1).c_str(), rc );
}
KUIWnd* pWnd = NULL;
for( i = 0; i < c_nMaxLine; i++ )
{
pWnd = GetChild( CStringUtil::StringFormat( "skill_icon%02d", i ).c_str() );
if( pWnd )
(( KUIControlIconStatic*)pWnd)->SetCorrectionRect( KRect( 0, 0, 150, 0 ) );
}
// 기타 컨트롤
for( i = 0; i < c_nMaxLine-1; i++ )
{
CopyControl( CStringUtil::StringFormat("skill_card%02d_count" , i).c_str(), CStringUtil::StringFormat("skill_card%02d_count" , i+1).c_str(), rc );
// CopyControl( CStringUtil::StringFormat("skill_count%02d" , i).c_str(), CStringUtil::StringFormat("skill_count%02d" , i+1).c_str(), rc );
// CopyControl( CStringUtil::StringFormat("skill_lvinfo%02d" , i).c_str(), CStringUtil::StringFormat("skill_lvinfo%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_lvinfo_lv%02d" , i).c_str(), CStringUtil::StringFormat("skill_lvinfo_lv%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_lvinfo_lv%02d_value", i).c_str(), CStringUtil::StringFormat("skill_lvinfo_lv%02d_value", i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_lvinfo_up%02d" , i).c_str(), CStringUtil::StringFormat("skill_lvinfo_up%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_lvinfo_down%02d" , i).c_str(), CStringUtil::StringFormat("skill_lvinfo_down%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_name%02d" , i).c_str(), CStringUtil::StringFormat("skill_name%02d" , i+1).c_str(), rc );
/// 2010.12.16 - prodongi
CopyControl( CStringUtil::StringFormat("skill_level_bg_%02d" , i).c_str(), CStringUtil::StringFormat("skill_level_bg_%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_info%02d" , i).c_str(), CStringUtil::StringFormat("skill_info%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skill_info%02d_max" , i).c_str(), CStringUtil::StringFormat("skill_info%02d_max" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("static_use_mp%02d" , i).c_str(), CStringUtil::StringFormat("static_use_mp%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("static_use_mp_value%02d" , i).c_str(), CStringUtil::StringFormat("static_use_mp_value%02d" , i+1).c_str(), rc );
/// 2010.12.16 - prodongi
CopyControl( CStringUtil::StringFormat("button_skill_use_%02d" , i).c_str(), CStringUtil::StringFormat("button_skill_use_%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("layout_dotline_%02d" , i).c_str(), CStringUtil::StringFormat("layout_dotline_%02d" , i+1).c_str(), rc );
}
SetChildAsTop( "skill_icon_select" );
// 아이콘 선택바 처리
// m_pManager->CreateControl( KUIWND_CREATE_ARG( "static", "skill_icon_select", " ", KRect(0,0,48,48), 0, 0, this, "static_common_iconover", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
// 스킬 재사용 시간 컨트롤
for( i = 0; i < c_nMaxLine; i++ )
{
KUIWnd* pIcon = GetChild( CStringUtil::StringFormat("skill_icon%02d", i).c_str() );
if( pIcon )
{
KUIWnd* pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", CStringUtil::StringFormat("skill_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 );
}
}
}
////////////////////////////////////////////////
// 잡레벨
/////////////////////////////////////////////////
void SUISkillWnd::RequestJobLvUP()
{
SIMSG_UI_ACT_JOB_LEVELUP msg;
msg.handle = m_PlayerInfoMgr.GetPlayerHandle();
m_pGameManager->ProcMsgAtStatic(&msg);
}
/////////////////////////////////////////////////
// 스킬사용
////////////////////////////////////////////////
void SUISkillWnd::RequestUseSkill()
{
if( m_nSelSkillPos < 0 ) return;
if( CheckCurrentJobIndex() == false ) return;
// 2010.12.20 패시브는 사용 못하는게 맞는 것 같음 - prodongi
if (m_nTabType == TAB_PASSIVE)
return ;
RequestUseSkill(m_nSelSkillPos);
}
void SUISkillWnd::RequestUseSkill(char const* strID) /// 2010.12.20 - prodongi
{
if (!strID) return ;
if( CheckCurrentJobIndex() == false ) return;
// 2010.12.20 인덱스를 추출 - prodongi
int index = atoi(strID);
if (0 > index || c_nMaxLine <= index)
return ;
KUIControlVScroll* pScrollBar = dynamicCast<KUIControlVScroll*>(GetChild( "skill_scroll" ));
if( NULL != pScrollBar ) index += (pScrollBar->GetPosition()+1); // 스크롤바 만큼 더해져야 한다
RequestUseSkill(index);
}
/// 2010.12.21 - prodongi
void SUISkillWnd::RequestUseSkill(int index)
{
_oprint("void SUISkillWnd::RequestUseSkill(int index)\n");
// 2010.12.20 패시브는 사용 못하는게 맞는 것 같음 - prodongi
if (m_nTabType == TAB_PASSIVE)
return ;
if( m_nTabType == TAB_ACTIVE )
{
if( index-1 >= static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) ) return;
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][index-1];
if( !pSkill->IsCasting() && !pSkill->IsFire() )
m_pDisplayInfo->UseSkill( pSkill->GetSkillID(), pSkill->GetUseLevel() );
}
else if( m_nTabType == TAB_PASSIVE )
{
if( index-1 >= static_cast<int>(m_vecPassiveSkillList[m_nSelectJopIndex].size()) ) return;
SSkillSlot* pSkill = m_vecPassiveSkillList[m_nSelectJopIndex][index-1];
if( !pSkill->IsCasting() && !pSkill->IsFire() )
m_pDisplayInfo->UseSkill( pSkill->GetSkillID(), pSkill->GetUseLevel() );
}
}
void SUISkillWnd::ShowClockBox( int nSkillID, bool bDiable )
{
if( !IsActiveTab() ) return;
if( bDiable )
{
for( int i = 0; i < m_nMaxLine; i++ )
{
if( GetSkillID( m_nScrollPos+i ) == nSkillID )
{
KUIWnd* pWnd = GetChild( CStringUtil::StringFormat("skill_clockbox%02d", i).c_str() );
if( pWnd && m_SkillSlotMgr.IsCastingSkill( nSkillID ) )
((KUIControlClockBox*)pWnd)->Init();
return;
}
}
return;
}
for( int i = 0; i < m_nMaxLine; i++ )
{
if( GetSkillID( m_nScrollPos+i ) == nSkillID )
{
KUIWnd* pWnd = GetChild( CStringUtil::StringFormat("skill_clockbox%02d", i).c_str() );
if( pWnd && m_SkillSlotMgr.IsFireSkill( nSkillID ) )
{
((KUIControlClockBox*)pWnd)->SetMaxTime( m_SkillSlotMgr.GetSkillMaxTime(nSkillID) );
((KUIControlClockBox*)pWnd)->SetCurTime( m_SkillSlotMgr.GetSkillCurTime(nSkillID) );
((KUIControlClockBox*)pWnd)->Begin();
}
return;
}
}
}
//스킬 사용 취소
void SUISkillWnd::CancelSkill( int nSkillID )
{
for( int i = 0; i < m_nMaxLine; i++ )
{
if( GetSkillID( m_nScrollPos+i ) == nSkillID )
{
KUIControlClockBox* pWnd = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat("skill_clockbox%02d", i).c_str() ));
if( pWnd )
{
pWnd->SetCurTime(0);
pWnd->SetMaxTime(0);
pWnd->Begin();
}
return;
}
}
}
/////////////////////////////////////////////////
// 탭
////////////////////////////////////////////////
const bool SUISkillWnd::IsActiveTab() const
{
return ( m_nTabType == TAB_ACTIVE );
}
void SUISkillWnd::SelectTab()
{
RefreshScrollbar();
RefreshSkillSlot();
}
/////////////////////////////////////////////////
// 스크롤바
////////////////////////////////////////////////
void SUISkillWnd::RefreshScrollbar()
{
if( CheckCurrentJobIndex() == false ) return;
int nCurCount(0);
if( IsActiveTab() ) nCurCount = static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size());
else nCurCount = static_cast<int>(m_vecPassiveSkillList[m_nSelectJopIndex].size());
int nScrollRange = max(nCurCount - m_nMaxLine, 0);
KUIControlVScroll* pScrollBar = dynamicCast<KUIControlVScroll*>(GetChild( "skill_scroll" ));
if( NULL != pScrollBar )
{
pScrollBar->SetMaxRange( DWORD(nScrollRange)+1 );
m_nScrollPos = pScrollBar->GetPosition();
pScrollBar->SetPosition( m_nScrollPos );
}
}
void SUISkillWnd::ResizeScrollbar( int nOldHegiht )
{
KUIControlVScroll* pScrollBar = dynamicCast<KUIControlVScroll*>(GetChild( "skill_scroll" ));
if( NULL != pScrollBar )
{
KRect ktBottom;
KRect ktTop;
KUIWnd* pWnd;
pWnd = GetChild( "skill_fund" ); if( pWnd != NULL ) ktBottom = pWnd->GetRect();
pWnd = GetChild( "tab_active_01" ); 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() - nOldHegiht;
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(); // 스킬 슬롯
}
}
//////////////////////////////////////////////////
// 직업
/////////////////////////////////////////////////
// 히스토리
void SUISkillWnd::SetJLvHistory()
{
SPlayerInfo & info = m_PlayerInfoMgr.GetPlayerInfo();
SetPrevJLevel( info.GetJLv() );
SetCurJLevel( info.GetJLv(), info.GetJP() );
SetNextJLevel( info.GetJLv() );
}
void SUISkillWnd::SetPrevJLevel( int nLevel )
{
/// 2010.12.13 - prodongi
// sonador #2.1.10 스킬창 'JLv' 및 크리처 편성창 'K' 컨트롤 분리에 따른 클라이언트 수정
SetChildCaption( "joblv_prev_01", CStringUtil::StringFormat("<font:font_02><#707070><size:9><vcenter><left>%d", nLevel).c_str() );
if( GetExpDB().GetNeedJp(nLevel-1, m_nChangeJob) <= 0 )
{
SetChildShow( "jp_prev_01", false );
}
else
{
SetChildShow( "jp_prev_01", true );
std::string strPrevJp;
jpToString( GetExpDB().GetNeedJp(nLevel-1, m_nChangeJob), strPrevJp );
SetChildCaption( "jp_prev_01", CStringUtil::StringFormat( "<font:font_02><#707070><size:9><vcenter><right>%s", strPrevJp.c_str() ).c_str() );
}
}
/// 2011.04.29 int->__int64 - prodongi
void SUISkillWnd::SetCurJLevel( int nLevel, __int64 nJP )
{
SetChildShow( "skill_curfont", true );
SetChildShow( "skill_curjlv_master", false ); // sonador #2.1.10 스킬창 'JLv' 및 크리처 편성창 'K' 컨트롤 분리에 따른 클라이언트 수정
SetChildShow( "skill_curjlv_ui", true );
/// 2010.12.13 - prodongi
SetChildShow( "joblv_curjlv_01", true );
SetChildShow( "jp_curjlv_01", true );
SetChildShow( "skill_historyselect02", false );
SetChildShow( "skill_selfont", false );
SetChildShow( "skill_seljlv", false );
SetChildShow( "skill_seljp", false );
bool bEnable = false;
if( nJP >= GetExpDB().GetNeedJp(nLevel, m_nChangeJob) )
bEnable = ShowCurJLevel( "skill_sel", nLevel );
else
bEnable = ShowCurJLevel( "skill_cur", nLevel );
std::string strCurJp;
jpToString( GetExpDB().GetNeedJp(nLevel, m_nChangeJob), strCurJp );
if( bEnable )
{
SetChildShow( "static_jp_viewbox", true );
/// 2010.12.13 - prodongi
SetChildCaption( "jp_curjlv_01", CStringUtil::StringFormat("<font:font_02><#00a99d><size:9><vcenter><right>%s", strCurJp.c_str()).c_str() );
}
else
{
SetChildShow( "static_jp_viewbox", false );
/// 2010.12.13 - prodongi
SetChildCaption( "jp_curjlv_01", CStringUtil::StringFormat("<font:font_02><#ffffff><size:9><vcenter><right>%s", strCurJp.c_str()).c_str() );
}
KUIControlSimpleButton* pButton = dynamicCast<KUIControlSimpleButton*>(GetChild( c_szButtonJLVUp ));
if( pButton )
{
if( bEnable ) pButton->Enable();
else pButton->Disable();
}
}
bool SUISkillWnd::ShowCurJLevel( std::string str, int nLevel )
{
// sonador #2.1.10 스킬창 'JLv' 및 크리처 편성창 'K' 컨트롤 분리에 따른 클라이언트 수정
SetChildShow( "skill_curjlv_master", false );
SetChildShow( "skill_curjlv_ui", true );
/// 2010.12.13 - prodongi
SetChildShow( "joblv_curjlv_01", true );
bool bEnable = false;
__int64 nNeedJP = GetExpDB().GetNeedJp(nLevel, m_nChangeJob);
if( m_PlayerInfoMgr.GetPlayerInfo().GetJP() >= nNeedJP && nNeedJP > 0 )
bEnable = true;
if( GetExpDB().GetNeedJp(nLevel, m_nChangeJob) > 0 )
{
// sonador #2.1.10 스킬창 'JLv' 및 크리처 편성창 'K' 컨트롤 분리에 따른 클라이언트 수정
/// 2010.12.13 - prodongi
if( bEnable )
{
SetChildCaption( "joblv_curjlv_01", CStringUtil::StringFormat("<font:font_02><size:9><#fc4b00><vcenter><left>%d", nLevel+1).c_str() );
}
else
{
SetChildCaption( "joblv_curjlv_01", CStringUtil::StringFormat("<font:font_02><size:9><#ffffff><vcenter><left>%d", nLevel+1).c_str() );
}
SetChildShow( "jp_curjlv_01", true );
}
else
{
// sonador #2.1.10 스킬창 'JLv' 및 크리처 편성창 'K' 컨트롤 분리에 따른 클라이언트 수정
SetChildShow( "skill_curjlv_master", true );
SetChildShow( "skill_curjlv_ui", false );
/// 2010.12.13 - prodongi
SetChildShow( "joblv_curjlv_01", false );
SetChildShow( "jp_curjlv_01", false );
}
//뭐지?
if( ::_stricmp(str.c_str(), "skill_sel") == 0 )
{
SetChildShow( "skill_historyselect02", true );
SetChildShow ( CStringUtil::StringFormat("%sfont", str.c_str()).c_str(), true );
SetChildShow ( CStringUtil::StringFormat("%sjlv", str.c_str()).c_str(), true );
SetChildCaption( CStringUtil::StringFormat("%sjlv", str.c_str()).c_str(), CStringUtil::StringFormat("%d",nLevel+1).c_str() );
}
SetChildShow ( CStringUtil::StringFormat("%sjp", str.c_str()).c_str(), true );
SetChildCaption( CStringUtil::StringFormat("%sjp", str.c_str()).c_str(), CStringUtil::StringFormat("%I64d",GetExpDB().GetNeedJp(nLevel, m_nChangeJob)).c_str() );
return bEnable;
}
void SUISkillWnd::SetNextJLevel( int nLevel )
{
// #2.1.10
/// 2010.12.13 - prodongi
SetChildCaption( "joblv_next_01", CStringUtil::StringFormat("<font:font_02><#707070><size:9><vcenter><left>%d", nLevel+2).c_str() ); // #2.1.10
SetChildShow( "skill_nextjlv_master", false );
if( GetExpDB().GetNeedJp(nLevel+1, m_nChangeJob) <= 0 )
{
if( GetExpDB().GetNeedJp(nLevel, m_nChangeJob) > 0 )
{
SetChildShow( "skill_nextjlv_master", true );
}
SetChildShow( "skill_nextjlv_ui", false );
/// 2010.12.13 - prodongi
SetChildShow( "joblv_next_01", false );
SetChildShow( "jp_next_01", false );
}
else
{
SetChildShow( "skill_nextjlv_ui", true );
/// 2010.12.13 - prodongi
SetChildShow( "joblv_next_01", true );
SetChildShow( "jp_next_01", true );
std::string strNextJp;
jpToString( GetExpDB().GetNeedJp(nLevel+1, m_nChangeJob), strNextJp );
SetChildCaption( "jp_next_01", CStringUtil::StringFormat("<font:font_02><#707070><size:9><vcenter><right>%s", strNextJp.c_str()).c_str() );
}
}
void SUISkillWnd::SetJName()
{
SPlayerInfo & Info = m_PlayerInfoMgr.GetPlayerInfo();
JobInfo * pJobInfo = GetJobDB().GetJobData( Info.GetJobID() );
if( pJobInfo )
{
// 잡 아이콘
KUIControlIconStatic* pJobIcon = dynamicCast<KUIControlIconStatic*>(GetChild( "icon_job" ));
if( pJobIcon )
{
pJobIcon->SetIcon( c_szDEF_SPR_NAME, GetJobDB().GetJobIconName(Info.GetJobID()) );
pJobIcon->SetTooltip(NULL);
}
m_nChangeJob = pJobInfo->job_depth;
SetChildCaption( "static_job_name", CStringUtil::StringFormat("<font:font_02><size:9><left><VCENTER>%s", Info.GetJobName()).c_str() );
}
}
void SUISkillWnd::SetJLevel()
{
SetJName();
SPlayerInfo & info = m_PlayerInfoMgr.GetPlayerInfo();
SetChildCaption( "static_joblv_value", CStringUtil::StringFormat("<font:font_02><size:9><left>%d", info.GetJLv()).c_str() );
}
void SUISkillWnd::SetJP()
{
SPlayerInfo & info = m_PlayerInfoMgr.GetPlayerInfo();
/// 2011.04.28 정리 - prodongi
std::string strJp;
jpToString(info.GetJP(), strJp);
/*
// K 처리
std::string strJP;
int nJP = info.GetJP();
if( nJP > c_nJPKLimit )
{
nJP = info.GetJP() / 1000;
strJP = CStringUtil::StringFormat( "<font:font_02><size:9><right>%dK", nJP );
}
else
{
strJP = CStringUtil::StringFormat( "<font:font_02><size:9><right>%d", nJP );
}
*/
SetChildCaption( "static_jp_value", strJp.c_str() );
}
//////////////////////////////////////////////////
// 리스트
/////////////////////////////////////////////////
void SUISkillWnd::FreeSkillList()
{
for( int i(0); i<JOP_CNT; ++i )
{
m_vecActiveSkillList[i].clear();
m_vecPassiveSkillList[i].clear();
}
}
void SUISkillWnd::UpdateSkillList()
{
FreeSkillList();
const std::vector<SSkillSlot*> & vecSkillList = m_SkillSlotMgr.GetSkillList();
std::vector<SSkillSlot*>::const_iterator it = vecSkillList.begin();
while( it != vecSkillList.end() )
{
SSkillSlot* pSlot = (*it);
AddSkillList( pSlot );
it++;
}
}
void SUISkillWnd::RefreshAddedSkillList()
{
const std::vector<SSkillSlot*> & vecSkillList = m_SkillSlotMgr.GetSkillList();
const std::vector<SAddedSkillInfo*> & vecAddedSkillList = m_SkillSlotMgr.GetAddedSkillList();
std::vector<SSkillSlot*>::const_iterator it = vecSkillList.begin();
while( it != vecSkillList.end() )
{
SSkillSlot* pSlot = (*it);
int lv = 0;
std::vector<SAddedSkillInfo*>::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 SUISkillWnd::AddSkillList( SSkillSlot* pSlot )
{
if( !pSlot ) return;
SkillBaseEx* s_data = GetSkillDB().GetSkillData( pSlot->GetSkillID() );
if( !s_data || s_data->IsSystemSkill() ) return;
SPlayerInfo& pPlayerInfo = m_PlayerInfoMgr.GetPlayerInfo();
int nJobRank = m_nJopRank+1;
for( int i(0); i < nJobRank; ++i )
{
if( i<m_nJopRank )
{
if( !IsExistSkill( pSlot->GetSkillID(), pPlayerInfo.GetOldJobID(i) ) )
continue;
}
else
{
if( !IsExistSkill( pSlot->GetSkillID(), pPlayerInfo.GetJobID() ) )
continue;
}
if( i < JOP_CNT )
{
/// 2011.03.28 특성 포인트는 필요 잡 포인트가 마이너스 이다 - prodongi
if (0 > s_data->GetNeedJopPoint(pSlot->GetCurLevel()))
{
addSkillList(s_data->IsPassive(), pSlot, JOP_TP);
}
/*
if( !s_data->IsPassive() )
m_vecActiveSkillList[i].push_back( pSlot );
else
m_vecPassiveSkillList[i].push_back( pSlot );
*/
addSkillList(s_data->IsPassive(), pSlot, i);
}
}
/*
if( !s_data->IsPassive() )
m_vecActiveSkillList[JOP_ALL].push_back( pSlot );
else
m_vecPassiveSkillList[JOP_ALL].push_back( pSlot );
*/
addSkillList(s_data->IsPassive(), pSlot, JOP_ALL);
}
bool SUISkillWnd::IsExistSkill( int nSkillID, int nJopID )
{
if( nJopID == -1 ) return false;
const JobInfoEx* pJobDB = GetJobDB().GetJobData( nJopID );
if( pJobDB == NULL )
{
return false;
}
const std::vector< SkillTreeEx >* pSkillTreeList = GetSkillTreeDB().GetSkillTreeData( pJobDB->skill_tree_id );
if( pSkillTreeList == NULL ) return false;
std::vector<SkillTreeEx>::const_iterator it = pSkillTreeList->begin();
while( it != pSkillTreeList->end() )
{
const SkillTreeEx* pTree = &(*it);
if( pTree->skill_id == nSkillID )
return true;
it++;
}
return false;
}
//SMSG_PROPERTY::PROPERTY_JOB:
bool SUISkillWnd::ChangeJop()
{
int nJopRank( GetUserJopRank() );
if( m_nJopRank == nJopRank ) return false;
m_nJopRank = GetUserJopRank();
bool bRank_1(m_nJopRank>=JOP_1), bRank_2(m_nJopRank>=JOP_2);
// 2011.11.29 - servantes : 옵션 nui에 해당 컨트롤 없음 / 주석처리
//SetControlEnable("common_radiobutton02", bRank_1);
//SetControlEnable("static_view_01", bRank_1);
//SetControlEnable("common_radiobutton03", bRank_2);
//SetControlEnable("static_view_02", bRank_2);
return true;
}
void SUISkillWnd::SetControlEnable( const char * pControlName, bool bEnable )
{
KUIControl * pControl = dynamicCast<KUIControl *>(GetChild(pControlName));
if( !pControl ) return;
if( bEnable ) pControl->Enable();
else pControl->Disable();
}
void SUISkillWnd::SetControlEnableColor( const char * pControlName, const char* lpColor, bool bEnable )
{
KUIControl * pControl = dynamicCast<KUIControl *>(GetChild(pControlName));
if( !pControl ) return;
if( bEnable ) pControl->SetEnableColor(lpColor);
else pControl->SetDisableColor(lpColor);
}
int SUISkillWnd::GetUserJopRank()
{
JobInfo* pJobInfo = GetJobDB().GetJobData( m_PlayerInfoMgr.GetJobID() );
if( pJobInfo ) return (int)(pJobInfo->job_depth);
else return -1;
}
//////////////////////////////////////////////////
// 슬롯
/////////////////////////////////////////////////
void SUISkillWnd::RefreshSkillSlot()
{
// by Testors
if( !IsShow() ) return;
HideSelectBar();
if( IsActiveTab() ) RefreshActiveSkillSlot();
else RefreshPassiveSkillSlot();
}
void SUISkillWnd::RefreshActiveSkillSlot()
{
if( CheckCurrentJobIndex() == false ) return;
int nListSize( static_cast<int>(m_vecActiveSkillList[ m_nSelectJopIndex ].size()) );
if( m_nScrollPos >= nListSize ) m_nScrollPos = 0;
for( int i = 0; i < c_nMaxLine; i++ )
{
if( i >= m_nMaxLine )
{
DisableSlot(i);
continue;
}
if( i+m_nScrollPos < nListSize )
{
SSkillSlot* pSkill = m_vecActiveSkillList[ m_nSelectJopIndex ][i+m_nScrollPos];
EnableSlot(i, true, TAB_ACTIVE, pSkill->GetSkillID() );
SetSkillData( pSkill, i, true );
}
else
EnableSlot(i, false, TAB_ACTIVE );
}
}
void SUISkillWnd::RefreshPassiveSkillSlot()
{
if( CheckCurrentJobIndex() == false ) return;
int nListSize( static_cast<int>(m_vecPassiveSkillList[ m_nSelectJopIndex ].size()) );
if( m_nScrollPos >= nListSize ) m_nScrollPos = 0;
for( int i = 0; i < c_nMaxLine; i++ )
{
if( i >= m_nMaxLine )
{
DisableSlot(i);
continue;
}
if( i+m_nScrollPos < nListSize)
{
SSkillSlot* pSkill = m_vecPassiveSkillList[ m_nSelectJopIndex ][i+m_nScrollPos];
EnableSlot(i, true, TAB_PASSIVE, pSkill->GetSkillID() );
SetSkillData( pSkill, i, true );
}
else
EnableSlot(i, false, TAB_PASSIVE );
}
}
void SUISkillWnd::EnableSlot( int nMode, bool bShow, bool bPassive, int nSkillID )
{
KUIControlIconStatic* pIcon = NULL;
KUIControlClockBox* pClock = NULL;
//// 스킬 아이콘 기본
if( bShow == false )
{
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_icon%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); // 스킬 아이콘은 항상 보여야 한다
}
pIcon = NULL;
// 카드 슬롯 기본
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_card%02d", nMode ).c_str() ));
if( pIcon )
{
/// 2010.12.16 - prodongi
pIcon->SetIcon( c_szDEF_SPR_NAME, "common_panel_titanium_slot_skill_card" );
pIcon->SetTooltip();
pIcon->SetShow(true);
}
}
pIcon = NULL;
// 스킬 쿨링 타임 검사
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat( "skill_clockbox%02d", nMode ).c_str() ));
if( pClock )
{
if( nSkillID != -1 && m_SkillSlotMgr.IsCastingSkill( nSkillID ) )
pClock->Init();
else if( nSkillID != -1 && m_SkillSlotMgr.IsFireSkill( nSkillID ) )
{
pClock->SetMaxTime( m_SkillSlotMgr.GetSkillMaxTime(nSkillID) );
pClock->SetCurTime( m_SkillSlotMgr.GetSkillCurTime(nSkillID) );
pClock->Begin();
}
else
{
pClock->SetCurTime(0);
pClock->SetMaxTime(0);
pClock->Begin();
}
pClock->SetShow(bShow);
}
// SetChildShow( CStringUtil::StringFormat( "skill_count%02d" , nMode ).c_str(), false );
// SetChildShow( CStringUtil::StringFormat( "skill_lvinfo%02d" , nMode ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_lv%02d", nMode ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", nMode ).c_str(), bShow );
if( bShow ) bPassive = !bPassive;
else bPassive = false;
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_up%02d" , nMode ).c_str(), bPassive );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_down%02d" , nMode ).c_str(), bPassive );
SetChildShow( CStringUtil::StringFormat( "skill_card%02d_count" , nMode ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_card_bg_%02d" , nMode ).c_str(), bShow ); /// 2010.12.21 - prodongi
SetChildShow( CStringUtil::StringFormat( "skill_card%02d" , nMode ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_name%02d" , nMode ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_info%02d" , nMode ).c_str(), bPassive );
SetChildShow( CStringUtil::StringFormat( "skill_info%02d_max" , nMode ).c_str(), bPassive );
SetChildShow( CStringUtil::StringFormat("static_use_mp%02d" , nMode ).c_str(), bPassive );
SetChildShow( CStringUtil::StringFormat("static_use_mp_value%02d", nMode ).c_str(), bPassive );
/// 2010.12.17 - prodongi
SetChildShow( CStringUtil::StringFormat("skill_level_bg_%02d", nMode ).c_str(), bPassive );
KUIControlSimpleButton* useButton = dynamicCast<KUIControlSimpleButton*>(GetChild( CStringUtil::StringFormat("button_skill_use_%02d", nMode ).c_str()));
if( useButton )
{
useButton->SetShow(bShow);
if( bPassive ) useButton->Enable();
else useButton->Disable();
}
}
void SUISkillWnd::DisableSlot( int nIndex )
{
SetChildShow( CStringUtil::StringFormat( "skill_card%02d_count", nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_icon%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_card_bg_%02d" , nIndex ).c_str(), false ); /// 2010.12.21 - prodongi
SetChildShow( CStringUtil::StringFormat( "skill_card%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_clockbox%02d" , nIndex ).c_str(), false );
// SetChildShow( CStringUtil::StringFormat( "skill_count%02d" , nIndex ).c_str(), false );
// SetChildShow( CStringUtil::StringFormat( "skill_lvinfo%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_lv%02d", nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_up%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_down%02d", nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_name%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_info%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_info%02d_max" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat("static_use_mp%02d" , nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat("static_use_mp_value%02d", nIndex ).c_str(), false );
/// 2010.12.17 - prodongi
SetChildShow( CStringUtil::StringFormat("skill_level_bg_%02d", nIndex ).c_str(), false );
SetChildShow( CStringUtil::StringFormat("button_skill_use_%02d", nIndex ).c_str(), false );
}
// 모두 비활성화, 초기 로드할때만 해주면 된다..
void SUISkillWnd::DisableAllSlot( bool bShow )
{
KUIWnd* pWnd = NULL;
KUIControlIconStatic* pIcon = NULL;
KUIControlClockBox* pClock = NULL;
for( int i = 0; i < c_nMaxLine; i++ )
{
//pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_icon%02d", i ).c_str() ));
//if( pIcon )
//{
// pIcon->SetIcon( 0, "itembackground" );
// pIcon->SetTooltip();
// if( i < m_nMaxLine ) pIcon->SetShow(true);
// else pIcon->SetShow(false);
//}
//pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_card%02d", i ).c_str() ));
//if( pIcon )
//{
// pIcon->SetIcon( 0, "skillcardsocket" );
// pIcon->SetTooltip();
// if( i < m_nMaxLine ) pIcon->SetShow(true);
// else pIcon->SetShow(false);
//}
//// 스킬 쿨링 타임
//pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat( "skill_clockbox%02d", i ).c_str() ));
//if( pClock )
//{
// pClock->SetCurTime(0);
// pClock->SetMaxTime(0);
// pClock->Begin();
//}
SetChildShow( CStringUtil::StringFormat( "skill_icon%02d" , i ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_card_bg_%02d" , i ).c_str(), false ); /// 2010.12.21 - prodongi
SetChildShow( CStringUtil::StringFormat( "skill_card%02d" , i ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_card%02d_count", i ).c_str(), false );
SetChildShow( CStringUtil::StringFormat( "skill_clockbox%02d" , i ).c_str(), false );
// SetChildShow( CStringUtil::StringFormat( "skill_count%02d" , i ).c_str(), bShow );
// SetChildShow( CStringUtil::StringFormat( "skill_lvinfo%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_lv%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_up%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_lvinfo_down%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_name%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_info%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat( "skill_info%02d_max" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat("static_use_mp%02d" , i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat("static_use_mp_value%02d", i ).c_str(), bShow );
/// 2010.12.17 - prodongi
SetChildShow( CStringUtil::StringFormat("skill_level_bg_%02d", i ).c_str(), bShow );
SetChildShow( CStringUtil::StringFormat("button_skill_use_%02d", i ).c_str(), bShow );
}
}
void SUISkillWnd::SetSkillData( SSkillSlot* pSkill, int nIndex, bool bShow )
{
KUIWnd* pWnd = NULL;
KUIControlStatic* pStatic = NULL;
// KUIControlNumber* pNumber = NULL;
SkillBaseEx* s_data = GetSkillDB().GetSkillData( pSkill->GetSkillID() );
if( s_data == NULL ) return;
// 스킬 아이콘
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_icon%02d", nIndex ).c_str() ));
if( pIcon && bShow )
{
pIcon->SetIcon( c_szDEF_SPR_NAME, s_data->GetIconName() );
// sonador 1.2.5 Lazy Tooltip 구현
pIcon->SetLazyTooltip( new KLazySkillTooltip( *m_pDisplayInfo, pSkill->GetSkillID(), pSkill->GetUseLevel(), true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
pIcon->SetShow( bShow );
}
KUIControlIconStatic* pCardIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_card%02d", nIndex ).c_str() ));
// 카드 슬롯 아이콘
if( IsActiveTab() )
{
if( pSkill->GetSkillCard() ) // 장착되어 있다면
{
if( pCardIcon && bShow )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pSkill->GetSkillCard() );
if( pSlot )
{
/// 2010.12.16 - prodongi
pCardIcon->SetAbleReSizeRes(false);
pCardIcon->SetIcon( c_szDEF_SPR_NAME, "static_common_skillcardicon" );
pCardIcon->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
pCardIcon->SetShow( bShow );
// 카운트
SetChildShow ( CStringUtil::StringFormat( "skill_card%02d_count", nIndex ).c_str(), pSlot->GetEnhance() );
SetChildCaption( CStringUtil::StringFormat( "skill_card%02d_count", nIndex ).c_str(), CStringUtil::StringFormat( "<font:font_01><#ffc104><size:8><left>+%d", pSlot->GetEnhance() ).c_str() );
}
}
}
else
{
if( pCardIcon )
{
/// 2010.12.16 - prodongi
pCardIcon->SetIcon( c_szDEF_SPR_NAME, "common_panel_titanium_slot_skill_card" );
pCardIcon->SetTooltip();
}
SetChildShow( CStringUtil::StringFormat( "skill_card%02d_count", nIndex ).c_str(), false );
}
}
else
{ //패시브 스킬은 스킬카드가 없다.
if( pCardIcon ) pCardIcon->SetShow( false );
SetChildShow( CStringUtil::StringFormat( "skill_card%02d_count", nIndex ).c_str(), false );
}
// 스킬 레벨
if (pSkill->GetAddedLevel())
SetChildCaption( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", nIndex ).c_str(), CStringUtil::StringFormat( "%s<font:font_01><size:9><#ff9900>%d", S(6425), pSkill->GetUseLevel() ).c_str() );
else
SetChildCaption( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", nIndex ).c_str(), CStringUtil::StringFormat( "%s<font:font_01><size:9>%d", S(6425), pSkill->GetUseLevel() ).c_str() );
// 스킬 이름
SetChildCaption( CStringUtil::StringFormat( "skill_name%02d", nIndex ).c_str(), CStringUtil::StringFormat( "<font:font_01><size:9><left>%s", GetStringDB().GetString( s_data->GetNameID() ) ).c_str() );
#ifndef NDEBUG
_oprint( "Skill name: %s\n", GetStringDB().GetString(s_data->GetNameID()) );
#endif
// 스킬 설명
if (pSkill->GetAddedLevel())
{
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s<#ff9900><right>%d /" , S(6425), pSkill->GetUseLevel() ).c_str() );
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d_max", nIndex ).c_str(), CStringUtil::StringFormat( "%s<shadow><#ff9900><left>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel()).c_str() );
}
else
{
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s<right>%d /" , S(6425), pSkill->GetUseLevel() ).c_str() );
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d_max", nIndex ).c_str(), CStringUtil::StringFormat( "%s<shadow><#e7fd2e><left>%d", S(6425), pSkill->GetSkill().base_skill_level).c_str() );
}
//소모 MP
SetChildCaption( CStringUtil::StringFormat( "static_use_mp_value%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), s_data->GetCostMP(pSkill->GetUseLevel()) ).c_str() );
}
//////////////////////////////////////////////////
// 스킬업/다운
/////////////////////////////////////////////////
void SUISkillWnd::_setSkillLevel( int nIndex, int nLevel, SSkillSlot* pSkill )
{
if( pSkill )
{
// 정보 갱신해 준다
if (pSkill->GetAddedLevel())
{
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s<#ff9900><right>%d /" , S(6425), nLevel ).c_str() );
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d_max", nIndex ).c_str(), CStringUtil::StringFormat( "%s<shadow><#ff9900><left>%d", S(6425), pSkill->GetSkill().base_skill_level + pSkill->GetAddedLevel() ).c_str() );
}
else
{
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d" , nIndex ).c_str(), CStringUtil::StringFormat( "%s<right>%d /" , S(6425), nLevel ).c_str() );
SetChildCaption( CStringUtil::StringFormat( "skill_info%02d_max", nIndex ).c_str(), CStringUtil::StringFormat( "%s<shadow><#e7fd2e><left>%d", S(6425), pSkill->GetSkill().base_skill_level ).c_str() );
}
// 툴팁 정보 갱신해 준다
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_icon%02d", nIndex ).c_str() ));
if( pIcon )
{
// sonador 1.2.5 Lazy Tooltip 구현
pIcon->SetLazyTooltip( new KLazySkillTooltip( *m_pDisplayInfo, pSkill->GetSkillID(), pSkill->GetUseLevel(), true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
}
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "skill_card%02d", nIndex ).c_str() ));
if( pIcon )
{
// sonador 1.2.5 Lazy Tooltip 구현
pIcon->SetLazyTooltip( new KLazySkillTooltip( *m_pDisplayInfo, pSkill->GetSkillID(), pSkill->GetUseLevel(), true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
}
if (pSkill->GetAddedLevel())
SetChildCaption( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", nIndex ).c_str(), CStringUtil::StringFormat( "%s<#ff9900>%d", S(6425), nLevel ).c_str() );
else
SetChildCaption( CStringUtil::StringFormat( "skill_lvinfo_lv%02d_value", nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), nLevel ).c_str() );
SkillBaseEx* s_data = GetSkillDB().GetSkillData( pSkill->GetSkillID() );
if( s_data == NULL ) return;
//소모 MP
SetChildCaption( CStringUtil::StringFormat( "static_use_mp_value%02d", nIndex ).c_str(), CStringUtil::StringFormat( "%s%d", S(6425), s_data->GetCostMP(pSkill->GetUseLevel()) ).c_str() );
}
}
void SUISkillWnd::SkillUp( int nIndex )
{
if( CheckCurrentJobIndex() == false ) return;
if( nIndex < 0 ) return;
if( nIndex >= static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) ) return;
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][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-m_nScrollPos, nLevel, pSkill );
}
}
void SUISkillWnd::SkillDown( int nIndex )
{
if( CheckCurrentJobIndex() == false ) return;
if( nIndex < 0 ) return;
if( nIndex >= static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) ) return;
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][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-m_nScrollPos, nLevel, pSkill );
}
}
//////////////////////////////////////////////////
// 선택바
//////////////////////////////////////////////////
//
void SUISkillWnd::ShowSelectBar( int nIndex )
{
HideSelectBar();
m_nSelSkillPos = nIndex;
KUIControlVScroll* pScrollBar = dynamicCast<KUIControlVScroll*>(GetChild( "skill_scroll" ));
if( NULL != pScrollBar ) m_nSelSkillPos += (pScrollBar->GetPosition()+1); // 스크롤바 만큼 더해져야 한다
bool bActive = false;
if( IsActiveTab() ) bActive = true;
if( CheckCurrentJobIndex() == false ) return;
if( m_nTabType == TAB_ACTIVE && m_vecActiveSkillList[m_nSelectJopIndex].size() <= m_nSelSkillPos-1 ) return;
else if( m_nTabType == TAB_PASSIVE && m_vecPassiveSkillList[m_nSelectJopIndex].size() <= m_nSelSkillPos-1 ) return;
// 아이콘 선택 보이기
KUIWnd* pIcon = GetChild( CStringUtil::StringFormat( "skill_icon%02d", nIndex ).c_str() );
if( pIcon )
{
SetMovePos( "skill_icon_select", pIcon->GetRect().left/*-c_nIconSelectDelta*/, pIcon->GetRect().top/*-c_nIconSelectDelta*/ );
SetChildShow( "skill_icon_select", true );
}
}
void SUISkillWnd::HideSelectBar()
{
m_nSelSkillPos = -1;
// 아이콘 선택 감추기
SetChildShow( "skill_icon_select", false );
}
///////////////////////////////////////////////
// 드래그앤드랍
//////////////////////////////////////////////
const int SUISkillWnd::GetUseLevel( int nSkillID ) const
{
if( CheckCurrentJobIndex() == false )
return -1;
SKILL_VECTOR::const_iterator it;
if( IsActiveTab() )
{
it = m_vecActiveSkillList[m_nSelectJopIndex].begin();
while( it != m_vecActiveSkillList[m_nSelectJopIndex].end() )
{
SSkillSlot* pSkill = (*it);
if( pSkill->GetSkillID() == nSkillID )
return pSkill->GetUseLevel();
it++;
}
}
else
{
it = m_vecPassiveSkillList[m_nSelectJopIndex].begin();
while( it != m_vecPassiveSkillList[m_nSelectJopIndex].end() )
{
SSkillSlot* pSkill = (*it);
if( pSkill->GetSkillID() == nSkillID )
return pSkill->GetUseLevel();
it++;
}
}
return -1;
}
const int SUISkillWnd::GetSkillIDByCtrlName( const char* szCtrlName ) const
{
if( IsActiveTab() )
return GetActiveSkillID(szCtrlName);
else
return GetPassiveSkillID(szCtrlName);
return -1;
}
const int SUISkillWnd::GetActiveSkillID( const char* szSprName ) const
{
if( CheckCurrentJobIndex() == false ) return -1;
for( int i = 0; i < m_nMaxLine; i++ )
{
if( ::_stricmp( szSprName, CStringUtil::StringFormat( "skill_icon%02d", i ).c_str() ) == 0 )
{
if( i+m_nScrollPos < static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) )
{
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][i+m_nScrollPos];
return pSkill->GetSkillID();
}
}
}
return -1;
}
const int SUISkillWnd::GetPassiveSkillID( const char* szSprName ) const
{
if( CheckCurrentJobIndex() == false ) return -1;
for( int i = 0; i < m_nMaxLine; i++ )
{
if( ::_stricmp( szSprName, CStringUtil::StringFormat( "skill_icon%02d", i ).c_str() ) == 0 )
{
if( i+m_nScrollPos < static_cast<int>(m_vecPassiveSkillList[m_nSelectJopIndex].size()) )
{
SSkillSlot* pSkill = m_vecPassiveSkillList[m_nSelectJopIndex][i+m_nScrollPos];
return pSkill->GetSkillID();
}
}
}
return -1;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// 카드 장착
const int SUISkillWnd::GetCardSlotIndex( const char* szControl, bool bSend ) const
{
if( CheckCurrentJobIndex() == false ) return -1;
// 해당 슬롯에 카드가 있는지 검사해서 없으면 -1
for( int i = 0; i < m_nMaxLine; i++ )
{
if( ::_stricmp( szControl, CStringUtil::StringFormat( "skill_card%02d" , i ).c_str() ) == 0 )
{
if( i+m_nScrollPos < static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) )
{
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][i+m_nScrollPos];
if( !bSend || (bSend && pSkill->GetSkillCard()) ) return (m_nScrollPos + i);
}
}
}
return -1;
}
void SUISkillWnd::RequestEquipCard( int nIndex, AR_HANDLE hItem )
{
SIMSG_UI_ACT_INVENTORY invMsg;
invMsg.m_nActType = SIMSG_UI_ACT_INVENTORY::ACT_SKILLCARD_BIND;
invMsg.m_nHandle = hItem;
invMsg.m_TargetHandle = m_PlayerInfoMgr.GetPlayerHandle();
m_pGameManager->ProcMsgAtStatic( &invMsg );
}
const bool SUISkillWnd::IsSkillCard( int nIndex, AR_HANDLE hItem ) const
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( pSlot == NULL ) return false;
// 장착중이 아니고, 카드일때가 아니면 리턴
if( GetItemDB().GetUseType(pSlot->GetItemCode()) != ItemBase::TYPE_CARD ||
GetItemDB().IsJoin(pSlot->GetItemCode(), IsInstanceUnstackable(pSlot)) || pSlot->IsEquipItem() )
return false;
return true;
}
const AR_HANDLE SUISkillWnd::GetSkillCardItem( int nIndex ) const
{
if( CheckCurrentJobIndex() == false ) return 0;
if( nIndex < static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) )
{
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][nIndex];
return pSkill->GetSkillCard();
}
return NULL;
}
bool SUISkillWnd::IsExistSkill( int nSkillID, bool bActive )
{
if( CheckCurrentJobIndex() == false ) return false;
SKILL_VECTOR::iterator it;
if( bActive )
{
it = m_vecActiveSkillList[m_nSelectJopIndex].begin();
while( it != m_vecActiveSkillList[m_nSelectJopIndex].end() )
{
if( (*it)->GetSkillID() == nSkillID ) return true;
it++;
}
}
else
{
it = m_vecPassiveSkillList[m_nSelectJopIndex].begin();
while( it != m_vecPassiveSkillList[m_nSelectJopIndex].end() )
{
if( (*it)->GetSkillID() == nSkillID ) return true;
it++;
}
}
return false;
}
int SUISkillWnd::GetSkillID( int nIndex )
{
if( CheckCurrentJobIndex() == false ) return -1;
if( nIndex < 0 ) return -1;
if( nIndex >= static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) ) return -1;
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][nIndex];
return pSkill->GetSkillID();
}
int SUISkillWnd::GetSkillLevel( int nIndex )
{
if( CheckCurrentJobIndex() == false ) return -1;
if( nIndex < 0 ) return -1;
if( nIndex >= static_cast<int>(m_vecActiveSkillList[m_nSelectJopIndex].size()) ) return -1;
SSkillSlot* pSkill = m_vecActiveSkillList[m_nSelectJopIndex][nIndex];
return pSkill->GetUseLevel();
}
/// 2010.12.15 - prodongi
void SUISkillWnd::toggleSkillTreeFundWnd()
{
bool show = (m_pGameManager->IsUIWindowOpened(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND)) ? false : true;
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, show) );
}
/// 2010.12.16 - prodongi
void SUISkillWnd::selectTabButton(int type)
{
m_pGameManager->StartSound( "ui_button_click.wav" );
m_nTabType = type;
SelectTab(); // m_nTabType, RefreshScrollBar, RefreshSlot
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, m_nTabType ) );
/// 2010.12.21 - prodongi
SetChildAniName("tab_select_cyan_01", (m_nTabType == TAB_ACTIVE) ? "common_select_titanium_cyan" : "common_select_titanium_brown");
/// 2010.12.22 - prodongi
reorderSelectTabLayer(type);
}
/// 2010.12.17 - prodongi
void SUISkillWnd::setSelectedSheetTabItem(int type)
{
KUITabControlSheet* tabSheet = dynamicCast<KUITabControlSheet*>(GetChild("tab_skill_01"));
if (tabSheet) tabSheet->SetSelectHead((DWORD)type);
/// 2010.12.22 - prodongi
reorderSelectTabLayer(type);
}
/// 2010.12.22 - prodongi
void SUISkillWnd::reorderSelectTabLayer(int type)
{
if (TAB_ACTIVE == type)
{
SetChildAsTop("tab_passive_01");
SetChildAsTop("tab_select_cyan_01");
SetChildAsTop("tab_active_01");
}
else if (TAB_PASSIVE == type)
{
SetChildAsTop("tab_active_01");
SetChildAsTop("tab_select_cyan_01");
SetChildAsTop("tab_passive_01");
}
}
/// 2010.12.17 - prodongi
void SUISkillWnd::selectJobRankButton(int rank)
{
if(rank == m_nSelectJopIndex)
{
m_jobRankButton[m_nSelectJopIndex]->SetCheck(true); /// 다시 풀려 버리므로 다시 체크 해준다
return ;
}
m_nSelectJopIndex = rank;
m_pGameManager->StartSound( "ui_button_click.wav" );
refreshJobRank();
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SKILL_RADIO_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILLFUND, m_nSelectJopIndex ) );
}
/// 2010.12.21 - prodongi
void SUISkillWnd::refreshJobRank()
{
for (int i = 0; i < JOP_CNT; ++i)
{
m_jobRankButton[i]->SetCheck(false);
}
m_jobRankButton[m_nSelectJopIndex]->SetCheck(true);
int textId = 0;
switch (m_nSelectJopIndex)
{
case JOP_0: textId = 9518; break;
case JOP_1: textId = 9519; break;
case JOP_2: textId = 9520; break;
case JOP_3: textId = 9521; break;
case JOP_ALL: textId = 9517; break;
case JOP_TP: textId = 9522; break;
default: textId = 9517;
}
SetChildCaption("sort_text_all_01", CStringUtil::StringFormat("<font:font_01><#898989><size:9>%s", S(textId)).c_str());
RefreshScrollbar();
RefreshSkillSlot();
}
/// 2011.03.28 - prodongi
void SUISkillWnd::addSkillList(bool isPassive, SSkillSlot* slot, int listIndex)
{
if(!isPassive)
m_vecActiveSkillList[listIndex].push_back(slot);
else
m_vecPassiveSkillList[listIndex].push_back(slot);
}