1170 lines
38 KiB
C++
1170 lines
38 KiB
C++
|
|
#include "stdafx.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SStringDB.h"
|
|
#include "SItemDB.h"
|
|
#include "SCombineDB.h"
|
|
#include "SMixCategoryDB.h"
|
|
//#include "SUIUtil.h"
|
|
#include "SUIDisplayInfo.h"
|
|
#include "SUISysMsgDefine.h"
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SInventoryMgr.h"
|
|
#include "KUIDragAndDrop.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "SUIUpgradeWnd.h"
|
|
#include "SUILazyTooltip.h"
|
|
#include "SGameSystem.h"
|
|
|
|
#include "SGameInterface.h"
|
|
extern SGameSystem * g_pCurrentGameSystem;
|
|
|
|
namespace
|
|
{
|
|
//----------------------------------------------------------------------------------
|
|
// 조합창.
|
|
|
|
// 조합창 슬롯 개수.
|
|
int c_nCombineSlotCount = 9;
|
|
|
|
const int c_nCombineSlotNameLength = int( ::strlen( "slot_blue_" ) );
|
|
const int c_nCombineSlotCountLength = 2;
|
|
|
|
const int c_nCombineItemCountLimit = 65535; // 매매갯수는 65535로 제한한다. ( 패킷에 갯수를 unsigned short을 사용하고 있음. )
|
|
|
|
const int g_nMaxFormalLine = 6; // 공식리스트 행 수.
|
|
|
|
const int nLayer = 8;
|
|
}
|
|
|
|
bool SUIUpgradeWnd::InitControls( KPoint kPos )
|
|
{
|
|
m_pCtrlFormalResult = GetChild( "text_enchant_result_content" ); // 결과출력 static 컨트롤.
|
|
CStringUtil::GetTextDecoration( m_pCtrlFormalResult->GetCaption(), m_strDecoResult ); // 결과 꾸미기 태그.
|
|
|
|
|
|
m_nScrollPos = 0;
|
|
m_pScrollFormal = dynamicCast< KUIControlVScrollSmallEx * >( GetChild("scrollbar_enchant") ); // 스크롤.
|
|
|
|
m_pFormalTextControl = dynamicCast< KUIControl * >( GetChild( "text_enchant_formula_content" ) ); // 공식출력 static 컨트롤.
|
|
CStringUtil::GetTextDecoration( m_pFormalTextControl->GetCaption(), m_strDecoFormal ); // 공식 꾸미기 태그.
|
|
CStringUtil::GetTextFontName( m_strDecoFormal, m_strFormalFontName ); // 폰트명.
|
|
|
|
// ClipRect()
|
|
|
|
//// 슬롯 multi icon 레이어 설정, 툴팁 스프라이트 설정
|
|
KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( "slot_red_00" ));
|
|
if( NULL != pSrcSlotControl )
|
|
pSrcSlotControl->SetIconLayer( 8 );
|
|
|
|
for( int nSlotNum( 0 ); nSlotNum < c_nCombineSlotCount; ++nSlotNum )
|
|
{
|
|
KUIControlMultiIcon* pSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "slot_blue_%02d", nSlotNum ).c_str() ));
|
|
if( NULL != pSlotControl )
|
|
pSlotControl->SetIconLayer( 8 );
|
|
}
|
|
|
|
SetCustomMovingRect( GetChild( "titlebar" )->GetRect() ); // 이동
|
|
|
|
//----------------
|
|
// 툴팁 추가.
|
|
|
|
KUIWnd * pControl = NULL;
|
|
pControl = GetChild( "button_help" );
|
|
if( pControl )
|
|
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 6872 ) ) );
|
|
|
|
pControl = GetChild( "button_enchantlist" );
|
|
if( pControl )
|
|
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 9746 ) ) );
|
|
#ifdef _AUTOMATERIAL
|
|
memset ( m_materialItem, 0, sizeof ( m_materialItem ) );
|
|
memset ( m_enhanceItem, 0, sizeof ( m_enhanceItem ) );
|
|
memset ( m_materialItemNum, 0, sizeof ( m_materialItemNum ) );
|
|
|
|
#endif //_AUTOMATERIAL
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
bool SUIUpgradeWnd::InitData( bool bReload )
|
|
{
|
|
RefreshSlots();
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
void SUIUpgradeWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
m_bSpaceEnhance = FALSE;;
|
|
|
|
KUIControlCheck* pCheck = dynamicCast<KUIControlCheck*>( GetChild("checkbox01") );
|
|
if( pCheck ) pCheck->SetCheck( m_bSpaceEnhance );
|
|
|
|
if( bOpen )
|
|
RemoveAllCombineItems();
|
|
}
|
|
void* SUIUpgradeWnd::Perform( KID id, KArg& msg )
|
|
{
|
|
_CID( UI_BEGIN_DRAG );
|
|
_CID( UI_SEND_DROP );
|
|
_CID( UI_RECV_DROP );
|
|
|
|
if ( id == id_UI_BEGIN_DRAG )
|
|
{
|
|
KUIBeginDragMessage* pBeginMsg = static_cast<KUIBeginDragMessage*>( &msg );
|
|
const char* szControlID = pBeginMsg->sDragControlID.c_str();
|
|
|
|
KUIControlMultiIcon* pWndMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
|
|
if( NULL != pWndMultiIcon )
|
|
{
|
|
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
|
|
|
|
AR_HANDLE hItem = GetItemHandle( szControlID );
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( NULL != pSlot )
|
|
{
|
|
m_pDisplayInfo->SetUIDragInfo( new SUICombineItemDragInfo( hItem ) );
|
|
m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
|
|
|
|
pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
else if ( id == id_UI_SEND_DROP )
|
|
{
|
|
KUISendRecvDropMessage* pSendMsg = static_cast<KUISendRecvDropMessage*>( &msg );
|
|
|
|
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
|
|
if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_COMBINEITEM == pUIDragInfo->m_type )
|
|
{
|
|
SUICombineItemDragInfo* pCombineDragInfo = (SUICombineItemDragInfo*)pUIDragInfo;
|
|
|
|
// 동일한 창이 아닌 곳에 드롭했다면 슬롯을 비운다.
|
|
if( pSendMsg->sRecvDropParentID != std::string(GetID()) )
|
|
RemoveCombineItem( pCombineDragInfo->m_hItem );
|
|
|
|
// Drag & Drop 정보 제거
|
|
m_pDisplayInfo->SetUIDragInfo();
|
|
}
|
|
return NULL;
|
|
}
|
|
else if ( id == id_UI_RECV_DROP )
|
|
{
|
|
KUISendRecvDropMessage* pRecvMsg = static_cast<KUISendRecvDropMessage*>( &msg );
|
|
|
|
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
|
|
|
|
if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_INVENITEM == pUIDragInfo->m_type ) // 아이템인 경우만
|
|
{
|
|
SUIInvenItemDragInfo* pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo;
|
|
const char* szDropControlID = pRecvMsg->sRecvDropControlID.c_str();
|
|
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pItemDragInfo->m_hItem );
|
|
if( !pSlot ) return NULL;
|
|
|
|
if( AbleAddSlot( COMBINEITEM(pSlot->GetHandle(), pSlot->GetItemCount()) ) == false )
|
|
return NULL;
|
|
|
|
bool bMain = AbleMainSlot( pSlot );
|
|
bool bSub = AbleSubSlot( pSlot );
|
|
|
|
// Main.
|
|
if( bMain )
|
|
{
|
|
// 메인 && 메인슬롯이 비어있으면 등록.
|
|
if( m_SourceItem.handle == 0 )
|
|
{
|
|
// 파괴된 아이템은 등록불가.
|
|
ItemBaseEx_info * pItemBase = const_cast< ItemBaseEx_info * >( GetItemDB().GetItemData( pSlot->GetItemCode() ) );
|
|
if( pItemBase && pSlot->getMaxEtherealDurability() > 0 && pSlot->GetEtherealDurability() <= 0 )
|
|
return NULL;
|
|
|
|
AddMainCombineItem( pItemDragInfo->m_hItem, count_t( 1 ) );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
}
|
|
|
|
// 메인(메인슬롯이 꽉차있다) && 서브.
|
|
else if( bSub )
|
|
{
|
|
AddSubCombineItem( pItemDragInfo->m_hItem, count_t( 1 ) );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
}
|
|
|
|
// 메인슬롯에만 가능한 아이템이므로 메인슬롯 교체.
|
|
else
|
|
{
|
|
AddMainCombineItem( pItemDragInfo->m_hItem, count_t( 1 ) ); //메인만 등록이 가능하지만 메인에 이미 아템 있으니 바꿈
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
}
|
|
}
|
|
|
|
// Sub.
|
|
else if( bSub )
|
|
{
|
|
AddSubCombineItem( pItemDragInfo->m_hItem, count_t( 1 ) );
|
|
//if( pSlot->GetItemCount() == 1 ) // 2011.06.27 : mantis 12753 - servantes
|
|
//{
|
|
// AddSubCombineItem( pItemDragInfo->m_hItem, count_t( 1 ) );
|
|
// m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
//}
|
|
//else
|
|
//{
|
|
// m_CombineItemHandel = pItemDragInfo->m_hItem;
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, pSlot->GetItemCount(), SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
|
|
//}
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
return SUIWnd::Perform( id, msg );
|
|
}
|
|
|
|
void SUIUpgradeWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
// Scroll
|
|
case KUI_MESSAGE::KSCROLL_SELECT :
|
|
|
|
m_nScrollPos = max( (int)lparam, 0 );
|
|
//RefreshFormal();
|
|
|
|
// 공식출력.
|
|
SetTextList( g_nMaxFormalLine, m_strFormal, m_strDecoFormal, const_cast< char * >( m_strFormalFontName.c_str() ),
|
|
m_pFormalTextControl, m_pScrollFormal, m_nScrollPos, m_vLineList );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
// 공식리스트윈도우 열기.
|
|
if( !::_stricmp( lpszControlID, "button_enchantlist" ) )
|
|
{
|
|
// 분류( 조합, 강화 ) 값을 보내야한다.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ID( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FORMULA, SMixCategoryDB::SYNTHETIC_TYPE::SYNTHETIC_TYPE_UPGRAGE ) );
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FORMULA ) );
|
|
}
|
|
|
|
// 닫기.
|
|
else if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
|
|
{
|
|
m_CombineItemsVector.clear();
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, false ) );
|
|
}
|
|
|
|
// 강화.
|
|
else if( ::_stricmp( lpszControlID, "button_enchant" ) == 0 )
|
|
{
|
|
if( m_SourceItem.handle )
|
|
{
|
|
// 아이템합성 시작 전달.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE ) );
|
|
|
|
// 아이템합성 진행률 출력 윈도우 열기.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
|
|
}
|
|
|
|
}
|
|
|
|
// 도움말윈도우.
|
|
else if( ::_stricmp( lpszControlID, "button_help" ) == 0 )
|
|
{
|
|
const KRect & rt = GetChild( "button_help" )->GetRect();
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, false ) ); // 닫기.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, rt.left, rt.top ) ); // 위치전달.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_HELP_TEXT( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, std::string( S( 9761 ) ) ) ); // 텍스트전달.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, true ) ); // 열기.
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KICON_DBLCLK:
|
|
{
|
|
AR_HANDLE hHandle = GetItemHandle( lpszControlID );
|
|
if(hHandle == NULL)
|
|
break;
|
|
|
|
RemoveCombineItem( hHandle );
|
|
}
|
|
break;
|
|
|
|
|
|
case KUI_MESSAGE::KGENWND_MOVE:
|
|
{
|
|
LimitMoveWnd();
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KCHECK_CHANGE:
|
|
{
|
|
m_pGameManager->StartSound( "ui_button_click.wav" );
|
|
|
|
if( ::_stricmp( "checkbox01", lpszControlID ) == 0 )
|
|
{ // 스페이스 강화 Checkbox
|
|
|
|
KUIControlCheck* pCheck = dynamicCast<KUIControlCheck*>( GetChild(lpszControlID) );
|
|
if( pCheck ) m_bSpaceEnhance = pCheck->GetCheck();
|
|
}
|
|
}
|
|
}
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
void SUIUpgradeWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
//case MSG_UPDATE_ITEM_COUNT:
|
|
case MSG_ITEM_ERASE:
|
|
case MSG_ITEM_DESTROY:
|
|
//case MSG_ITEM_INVEN:
|
|
case MSG_ITEM_WEAR_INFO:
|
|
{
|
|
//bool bRemoved = false;
|
|
|
|
//// 원본 아이템이 사라졌거나 장착된 경우 제거한다.
|
|
//// 조합창과 관련 없는 아이템이 장비 탈착시 조합창의 Main 슬롯을 제거하지 않는다. - 2009.08.24 sfreer
|
|
//bool bMainRemoved = false;
|
|
|
|
//if( pMsg->nType != MSG_ITEM_WEAR_INFO && NULL != m_SourceItem.handle )
|
|
// bMainRemoved = true;
|
|
|
|
//if( pMsg->nType == MSG_ITEM_WEAR_INFO && NULL != m_SourceItem.handle )
|
|
//{
|
|
// if( ((SMSG_ITEM_WEAR_INFO *)(pMsg))->item_handle == m_SourceItem.handle )
|
|
// {
|
|
// bMainRemoved = true;
|
|
// }
|
|
//}
|
|
|
|
//if(bMainRemoved)
|
|
//{
|
|
// SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
|
|
// if( pSlot == NULL || !pSlot->IsEquipItem() )
|
|
// {
|
|
// m_SourceItem = COMBINEITEM();
|
|
// bRemoved = true;
|
|
// }
|
|
//}
|
|
|
|
|
|
//COMBINEITEM_VECTOR::iterator itItem = m_CombineItemsVector.begin();
|
|
//while( itItem != m_CombineItemsVector.end() )
|
|
//{
|
|
// SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( (*itItem).handle );
|
|
// if( pSlot && !pSlot->IsEquipItem() )
|
|
// {
|
|
// // 조합창에 올려놓은 양보다 실제 인벤아이템의 양이 줄어있는 경우
|
|
// if( (*itItem).usiCount > pSlot->GetItemCount() )
|
|
// (*itItem).usiCount = pSlot->GetItemCount();
|
|
|
|
// // 존재하고 장착하지 않은 것은 그대로 유지
|
|
// itItem++;
|
|
// }
|
|
// else
|
|
// {
|
|
// // 없어졌거나 장착된 아이템은 제거한다.
|
|
// itItem = m_CombineItemsVector.erase( itItem );
|
|
// bRemoved = true;
|
|
// }
|
|
//}
|
|
//if( bRemoved ) RefreshSlots();
|
|
|
|
if( m_SourceItem.handle )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
|
|
if( pSlot == NULL || pSlot->IsEquipItem() )
|
|
m_SourceItem.Clear();
|
|
|
|
RefreshSlots();
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
case MSG_BELT_SLOT_INFO:
|
|
{
|
|
if( m_SourceItem.handle )
|
|
{
|
|
if( -1 != m_InventoryMgr.GetBeltSlotIndex( m_SourceItem.handle ) )
|
|
m_SourceItem.Clear();
|
|
|
|
RefreshSlots();
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case MSG_MIX_RESULT:
|
|
{
|
|
if( this->IsShow() )
|
|
{
|
|
RemoveAllCombineItems( false );
|
|
|
|
SMSG_MIX_RESULT* pMixResultMsg = (SMSG_MIX_RESULT*)pMsg;
|
|
KUIWnd * pWnd = GetChild( "text_08" );
|
|
|
|
if( pWnd )
|
|
{
|
|
if( m_strDecoState.empty() )
|
|
CStringUtil::GetTextDecoration( pWnd->GetCaption(), m_strDecoState ); // 상태 텍스트 꾸미기 태그.
|
|
|
|
std::string strDeco( m_strDecoState );
|
|
|
|
// 강화 성공.
|
|
if( pMixResultMsg->count > 0 )
|
|
{
|
|
const char * pStr = S( 9715 );
|
|
strDeco.append( pStr );
|
|
pWnd->SetCaption( strDeco.c_str() );
|
|
m_pDisplayInfo->AddSystemMessage( pStr, 0 ); // AziaMafia Message Craft (I returned it back)
|
|
|
|
for( int n( 0 ); n < int(pMixResultMsg->count); ++n )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pMixResultMsg->pArHandle[n] );
|
|
if( pSlot )
|
|
{
|
|
// 장착용 아이템인 경우 원본 아이템으로
|
|
if( NULL == m_SourceItem.handle && ItemBase::TYPE_ARMOR == GetItemDB().GetUseType( pSlot->GetItemCode() ) )
|
|
{
|
|
m_SourceItem = COMBINEITEM( pSlot->GetHandle() );
|
|
#ifdef _AUTOMATERIAL
|
|
for ( int i = 0; i < 5; i++ )
|
|
{
|
|
if ( m_enhanceItem[i] == pSlot->GetHandle() )
|
|
{
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( m_materialItem[i], count_t(1) ) ); //한개 옮긴다
|
|
for ( int j = 0; j < 9; j++ )
|
|
{
|
|
if ( m_materialItem[i][j] ) AddSubCombineItem( m_materialItem[i][j], count_t(m_materialItemNum[i][j]) );
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
#endif //_AUTOMATERIAL
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 강화 실패.
|
|
else
|
|
{
|
|
const char * pStr = S( 9716 );
|
|
strDeco.append( pStr );
|
|
pWnd->SetCaption( strDeco.c_str() );
|
|
m_pDisplayInfo->AddSystemMessage( pStr, 0 ); // AziaMafia Message Craft (I returned it back)
|
|
}
|
|
}
|
|
|
|
// 슬롯정리.
|
|
RefreshSlots();
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case MSG_RESULT:
|
|
{
|
|
SMSG_RESULT* pResultMsg = (SMSG_RESULT*)pMsg;
|
|
if( TM_CS_MIX == pResultMsg->request_msg_id )
|
|
{
|
|
RemoveAllCombineItems();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case IMSG_UI_MOVE:
|
|
{
|
|
SIMSG_UI_MOVE* pMoveMsg = (SIMSG_UI_MOVE*)pMsg;
|
|
//MovePos( pMoveMsg->m_nX - GetRect().GetWidth(), pMoveMsg->m_nY - GetRect().GetHeight() );
|
|
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
case IMSG_UI_INPUTNUMBER:
|
|
{
|
|
SIMSG_UI_INPUTNUMBER* pInputNumberMsg = (SIMSG_UI_INPUTNUMBER*)pMsg;
|
|
pMsg->bUse = true;
|
|
|
|
if( pInputNumberMsg->m_nValue > 0 )
|
|
{
|
|
if(m_CombineItemHandel != 0)
|
|
{
|
|
AR_HANDLE hItem = m_CombineItemHandel;
|
|
count_t usiCount = pInputNumberMsg->m_nValue;
|
|
m_CombineItemHandel = 0;
|
|
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( !pSlot )
|
|
break;
|
|
|
|
if( AbleAddSlot( COMBINEITEM(pSlot->GetHandle(), pSlot->GetItemCount()) ) == false )
|
|
break;
|
|
|
|
bool bSub = AbleSubSlot( pSlot );
|
|
if( bSub )
|
|
{
|
|
AddSubCombineItem( hItem, usiCount );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case IMSG_SET_UPGRADEITEM:
|
|
{
|
|
SIMSG_SET_UPGRADEITEM * pUpgradeItemMsg = (SIMSG_SET_UPGRADEITEM*)pMsg;
|
|
|
|
AR_HANDLE hItem = pUpgradeItemMsg->hItem;
|
|
count_t usiCount = pUpgradeItemMsg->usiCount;
|
|
pMsg->bUse = true;
|
|
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
|
|
if( pSlot && AbleAddSlot( COMBINEITEM(pSlot->GetHandle(), pSlot->GetItemCount()) ) )
|
|
{
|
|
bool bMain = AbleMainSlot( pSlot );
|
|
bool bSub = AbleSubSlot( pSlot );
|
|
|
|
if( bMain == true )
|
|
{
|
|
if( m_SourceItem.handle == 0 )
|
|
{
|
|
ItemBaseEx_info * pItemBase = const_cast< ItemBaseEx_info * >( GetItemDB().GetItemData( pSlot->GetItemCode() ) );
|
|
if( pItemBase && pSlot->getMaxEtherealDurability() > 0 && pSlot->GetEtherealDurability() <= 0 )
|
|
{
|
|
// 파괴된 아이템은 등록불가.
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
AddMainCombineItem( hItem, count_t( 1 ) );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
#ifdef _AUTOMATERIAL
|
|
XFlag<int> xFlag = pSlot->GetXFlag();
|
|
|
|
if( xFlag.IsOn( ItemInstance::ITEM_FLAG_FAILED ) ) // 강화 실패 작
|
|
{
|
|
SInventorySlot* pSvrSlot = m_InventoryMgr.GetCodeItemInfo ( 960124 ); // 축복받은 재생의 가루
|
|
if ( !pSvrSlot ) pSvrSlot = m_InventoryMgr.GetCodeItemInfo ( 950070 ); // 축복받은 재생의 가루가 없을 경우 완전한 재생의 가루
|
|
if ( !pSvrSlot ) pSvrSlot = m_InventoryMgr.GetCodeItemInfo ( 2012802 ); // 기간없는 완전한 재생의 가루가 아닐경우 아이템이 아닐경우 기간제로 넣어줍니다.
|
|
if ( pSvrSlot ) AddSubCombineItem( pSvrSlot->GetHandle(), count_t(1) ); // 해당되는 가루(950070)를 넣어줍니다.
|
|
}
|
|
else
|
|
{
|
|
for ( int i = 0; i < 5; i++ )
|
|
{
|
|
if ( m_enhanceItem[i] == hItem )
|
|
{
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( m_materialItem[i], count_t(1) ) ); //한개 옮긴다
|
|
for ( int j = 0; j < 9; j++ )
|
|
{
|
|
if ( m_materialItem[i][j] ) AddSubCombineItem( m_materialItem[i][j], count_t(m_materialItemNum[i][j]) );
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
#endif // _AUTOMATERIAL
|
|
break;
|
|
}
|
|
}
|
|
else if( bSub == false )
|
|
{
|
|
// 메인슬롯에만 가능한 아이템이므로 메인슬롯 교체.
|
|
AddMainCombineItem( hItem, count_t( 1 ) ); //메인만 등록이 가능하지만 메인에 이미 아템 있으니 바꿈
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
if( bSub == true )
|
|
{
|
|
if(usiCount == 1) //servantes 2010.10.19
|
|
{
|
|
AddSubCombineItem( hItem, usiCount );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
}
|
|
else if(usiCount > 10)
|
|
{
|
|
// 2011.07.25 - servantes
|
|
m_CombineItemHandel = hItem; // 2011.07.25 - servantes : redmine 18784 - 강화 조합 등의 재료 넣는 곳에서 더블 클릭 문제
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, usiCount, SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
|
|
}
|
|
else
|
|
{
|
|
if(pUpgradeItemMsg->bMove10 && usiCount == 10)
|
|
{
|
|
AddSubCombineItem( hItem, usiCount );
|
|
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
|
|
break;
|
|
}
|
|
|
|
m_CombineItemHandel = hItem;
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, usiCount, SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
// 공식리스트에서 공식 텍스트 ID 전달.
|
|
case IMSG_FORMAL_ID:
|
|
{
|
|
pMsg->bUse = true;
|
|
SIMSG_FORMAL_ID * pData = dynamicCast< SIMSG_FORMAL_ID * >( pMsg );
|
|
|
|
m_strFormal = S( pData->formal_id ); // 공식.
|
|
if( m_strFormal != "0" )
|
|
{
|
|
std::string strResult( m_strDecoResult );
|
|
strResult.append( S( pData->result_id ) );
|
|
m_pCtrlFormalResult->SetCaption( strResult.c_str() ); // 결과.
|
|
|
|
m_nScrollPos = 0;
|
|
|
|
//RefreshFormal();
|
|
// 공식출력.
|
|
m_vLineList.clear();
|
|
SetTextList( g_nMaxFormalLine, m_strFormal, m_strDecoFormal, const_cast< char * >( m_strFormalFontName.c_str() ),
|
|
m_pFormalTextControl, m_pScrollFormal, m_nScrollPos, m_vLineList, true );
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
// 아이템합성 진행률출력 윈도우에서 진행완료 전달.
|
|
case IMSG_SYNTHETIC_ITEM:
|
|
|
|
if( m_CombineItemsVector.empty() )
|
|
{
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 2502 ), true ) );
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 2502 ), true ) );
|
|
}
|
|
if( m_SourceItem.handle )
|
|
{
|
|
m_pGameManager->StartSound( "ui_click_compound01.wav" );
|
|
|
|
SIMSG_UI_ACT_ITEMCOMBINE combineMsg;
|
|
|
|
// 원본 아이템 추가
|
|
bool bSucceed = true;
|
|
combineMsg.main_Items = SIMSG_UI_ACT_ITEMCOMBINE::CombineItemInfo( m_SourceItem.handle, m_SourceItem.usiCount.getAmount() );
|
|
#ifdef _AUTOMATERIAL
|
|
int i = 0;
|
|
int nReg = 0; // 등록 플레그
|
|
bool nFailFlag = FALSE; // 강화실패 아이템인지 확인
|
|
|
|
|
|
SInventorySlot* pSvrSlot = m_InventoryMgr.GetItemInfo ( m_SourceItem.handle );
|
|
XFlag<int> xFlag = pSvrSlot->GetXFlag();
|
|
if( xFlag.IsOn( ItemInstance::ITEM_FLAG_FAILED ) )
|
|
nFailFlag = TRUE;
|
|
while ( i < 5 )
|
|
{
|
|
if ( m_enhanceItem[i] == m_SourceItem.handle )
|
|
{
|
|
nReg = i+1; // 등록이 이미 되어있으면, 해당 인덱스를 저장합니다.
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
|
|
if ( i == 5 ) // 등록이 안되어있으면 저장합니다.
|
|
{
|
|
m_enhanceItem[m_nRegEnhance] = m_SourceItem.handle;
|
|
}
|
|
|
|
i = 0;
|
|
if ( nReg && !nFailFlag) // 등록되어있고, 실패아이템이 아닌경우에만 재료아이템을 초기화합니다.
|
|
{
|
|
memset ( m_materialItem[nReg-1], 0, sizeof ( m_materialItem[nReg-1] ) );
|
|
memset ( m_materialItemNum[nReg-1], 0, sizeof ( m_materialItemNum[nReg-1] ) );
|
|
}
|
|
#endif // _AUTOMATERIAL
|
|
// 강화 아이템 추가
|
|
for( COMBINEITEM_VECTOR::const_iterator itItem = m_CombineItemsVector.begin(); itItem != m_CombineItemsVector.end(); itItem++ )
|
|
{
|
|
if( m_InventoryMgr.IsExistItem( (*itItem).handle ) )
|
|
{
|
|
|
|
#ifdef _AUTOMATERIAL
|
|
SInventorySlot* pmatSlot = m_InventoryMgr.GetItemInfo ( (*itItem).handle );
|
|
|
|
// AziaMafia Fix Combi
|
|
//if ((pmatSlot->GetItemCode() >= 705001 && pmatSlot->GetItemCode() <= 705004) || pmatSlot->GetItemCode() == 960124 ||
|
|
// pmatSlot->GetItemCode() == 950070 || pmatSlot->GetItemCode() == 2012802 || pmatSlot->GetItemCode() == 601100308 ||
|
|
// pmatSlot->GetItemCode() == 601100362 || pmatSlot->GetItemCode() == 601100363 || pmatSlot->GetItemCode() == 601100365
|
|
// )
|
|
if ( ( pmatSlot->GetItemCode() == 960124
|
|
|| pmatSlot->GetItemCode() == 950070
|
|
|| pmatSlot->GetItemCode() == 2012802
|
|
))
|
|
nFailFlag = TRUE;
|
|
|
|
// 등록되어있으면 해당 메인아이템에 재료를 등록합니다.
|
|
if ( !nFailFlag && i < 9 ) // 강화실패아이템이 아니고 이럴일은 없겠지만, i값이 재료소켓 갯수보다 커질 경우 예외처리합니다.
|
|
{
|
|
if ( nReg ) // 이미 등록되어 있는 아이템인 경우 해당인덱스에 재료를 셋팅합니다.
|
|
{
|
|
m_materialItem[nReg-1][i] = (*itItem).handle;
|
|
m_materialItemNum[nReg-1][i] = (*itItem).usiCount.getAmount();
|
|
}
|
|
else // 등록되어있지 않다면 새로저장합니다.
|
|
{
|
|
m_materialItem[m_nRegEnhance][i] = (*itItem).handle;
|
|
m_materialItemNum[m_nRegEnhance][i] = (*itItem).usiCount.getAmount();
|
|
}
|
|
i++;
|
|
}
|
|
|
|
#endif // _AUTOMATERIAL
|
|
combineMsg.vtItems.push_back( SIMSG_UI_ACT_ITEMCOMBINE::CombineItemInfo( (*itItem).handle, (*itItem).usiCount.getAmount() ) );
|
|
}
|
|
else
|
|
{
|
|
bSucceed = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// 강화!.
|
|
if( bSucceed )
|
|
{
|
|
#ifdef _AUTOMATERIAL
|
|
if ( !nReg ) // 등록되어있지 않을 때만 인덱스를 올립니다.
|
|
{
|
|
m_nRegEnhance++;
|
|
if ( m_nRegEnhance > 5 ) m_nRegEnhance = 0;
|
|
}
|
|
#endif // _AUTOMATERIAL
|
|
m_pGameManager->ProcMsgAtStatic( &combineMsg );
|
|
}
|
|
|
|
// 슬롯제거.
|
|
RemoveAllCombineItems();
|
|
}
|
|
break;
|
|
case IMSG_HOTKEY_EX: //servantes 2010.10.19
|
|
{
|
|
SIMSG_HOTKEY_EX* pHotKey = dynamicCast<SIMSG_HOTKEY_EX*>(pMsg);
|
|
|
|
if( pHotKey->wParam == VK_SHIFT )
|
|
m_bShiftKey = (pHotKey->bUp == 0); //servantes 2010.10.15
|
|
if( pHotKey->wParam == VK_CONTROL ) //servantes 2010.10.15
|
|
m_bControlKey = (pHotKey->bUp == 0);
|
|
if( pHotKey->wParam == VK_MENU )
|
|
{
|
|
bool bPreState = m_bAltKey;
|
|
m_bAltKey = (pHotKey->bUp == 0);
|
|
|
|
if( bPreState != m_bAltKey && IsShow() )
|
|
{
|
|
RefreshSlots();
|
|
}
|
|
}
|
|
#ifdef _AUTOMATERIAL
|
|
|
|
SGameInterface* pGameInterface( m_pGameManager->GetGameInterface() );
|
|
KUIWnd* pFocusWnd = pGameInterface->m_pUIWndManager->GetMouseClickWnd();
|
|
|
|
if( m_bSpaceEnhance && pHotKey->wParam == VK_SPACE )
|
|
{
|
|
// 포커스가 에디트박스에 있지 않고, 창이 활성화되어있고, 강화아이템이 올라가있으며, 포커스가 인벤토리나, 강화창에 되어있을때 스페이스 강화
|
|
if( !KUIControlEdit::IsFocusEdit() && IsShow() && m_SourceItem.handle && ( pFocusWnd == this || !strcmp ( pFocusWnd->GetID(), "window_main_inventory_bag" ) ) )
|
|
{
|
|
// 아이템합성 시작 전달.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE ) );
|
|
|
|
// 아이템합성 진행률 출력 윈도우 열기.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
|
|
}
|
|
}
|
|
#endif // _AUTOMATERIAL
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
AR_HANDLE SUIUpgradeWnd::GetItemHandle( const char* szControlID ) const
|
|
{
|
|
// 원본 아이템
|
|
if( 0 == ::_stricmp( szControlID, "slot_red_00" ) )
|
|
return m_SourceItem.handle;
|
|
|
|
// 강화 아이템
|
|
if( 0 == ::strnicmp( szControlID, "slot_blue_", c_nCombineSlotNameLength ) )
|
|
{
|
|
if( ::strlen( szControlID ) >= (c_nCombineSlotNameLength + c_nCombineSlotCountLength) )
|
|
{
|
|
std::string strSlotNum;
|
|
strSlotNum.assign( szControlID, c_nCombineSlotNameLength, c_nCombineSlotCountLength );
|
|
|
|
int nSlotNum = ::atoi( strSlotNum.c_str() );
|
|
|
|
if( 0 <= nSlotNum && nSlotNum < int(m_CombineItemsVector.size()) )
|
|
return m_CombineItemsVector[ nSlotNum ].handle;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
SUIUpgradeWnd::COMBINEITEM_VECTOR::iterator SUIUpgradeWnd::GetItemIterator( AR_HANDLE hItem )
|
|
{
|
|
for( COMBINEITEM_VECTOR::iterator itItem = m_CombineItemsVector.begin(); itItem != m_CombineItemsVector.end(); itItem++ )
|
|
if( (*itItem).handle == hItem ) return itItem;
|
|
|
|
return m_CombineItemsVector.end();
|
|
}
|
|
|
|
bool SUIUpgradeWnd::IsEquipItem( SInventorySlot* pSlot, count_t usiCount )
|
|
{
|
|
if( !pSlot ) return false;
|
|
|
|
bool bEquip = false;
|
|
|
|
if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD )
|
|
bEquip = m_InventoryMgr.IsEquipCard( pSlot->GetHandle() );
|
|
else bEquip = pSlot->IsEquipItem();
|
|
|
|
return bEquip;
|
|
}
|
|
|
|
void SUIUpgradeWnd::AddMainCombineItem( AR_HANDLE hItem, count_t usiCount )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( !pSlot ) return;
|
|
|
|
// 장착중인 아이템은 제외.
|
|
if( IsEquipItem( pSlot, usiCount ) )
|
|
return;
|
|
|
|
m_SourceItem = COMBINEITEM( hItem );
|
|
|
|
RefreshSlots();
|
|
}
|
|
|
|
void SUIUpgradeWnd::AddSubCombineItem( AR_HANDLE hItem, count_t usiCount )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if( !pSlot ) return;
|
|
|
|
// 장착중인 아이템 제외.
|
|
if( IsEquipItem( pSlot, usiCount ) )
|
|
return;
|
|
|
|
/// 2011.07.25 최대 개수 체크 - prodongi
|
|
if(usiCount > pSlot->GetItemCount())
|
|
usiCount = pSlot->GetItemCount();
|
|
|
|
COMBINEITEM_VECTOR::iterator itItem = GetItemIterator( hItem );
|
|
if( m_CombineItemsVector.end() != itItem ) // 이미 존재하는 경우
|
|
{
|
|
// 중첩 가능한 아이템인 경우
|
|
if( GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) )
|
|
{
|
|
// 기존 아이템의 갯수를 증가시킨다.
|
|
count_t nTotalCount = (*itItem).usiCount + usiCount;
|
|
|
|
//gmpbigsun(20130829): 메인아이템까지 검사
|
|
count_t nExtraCount( 0 );
|
|
if( m_SourceItem.handle == (*itItem).handle ) //메인아이템과 재료아이템이 같은녀석이라면 +1
|
|
nExtraCount = count_t(1);
|
|
|
|
if( (nTotalCount+nExtraCount) > pSlot->GetItemCount() )
|
|
nTotalCount = pSlot->GetItemCount() - nExtraCount; // 갖고있는 아이템의 전체 갯수보다 커지지 않도록 조정
|
|
if( nTotalCount > c_nCombineItemCountLimit )
|
|
nTotalCount = count_t( c_nCombineItemCountLimit );
|
|
|
|
if( (*itItem).usiCount != nTotalCount )
|
|
{
|
|
(*itItem).usiCount = nTotalCount;
|
|
RefreshSlots();
|
|
}
|
|
}
|
|
}
|
|
else // 처음 추가하는 경우
|
|
{
|
|
if(m_CombineItemsVector.size() < c_nCombineSlotCount)
|
|
{
|
|
m_CombineItemsVector.push_back( COMBINEITEM( hItem, usiCount ) );
|
|
}
|
|
|
|
RefreshSlots();
|
|
}
|
|
|
|
RefreshSlots();
|
|
}
|
|
|
|
void SUIUpgradeWnd::AddCombineItem( AR_HANDLE hItem, count_t usiCount )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
|
|
if (!pSlot)
|
|
return ;
|
|
|
|
bool bEquip = false;
|
|
|
|
if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD )
|
|
bEquip = m_InventoryMgr.IsEquipCard( pSlot->GetHandle() );
|
|
else
|
|
bEquip = pSlot->IsEquipItem();
|
|
|
|
if( pSlot && !bEquip ) // 장착된 아이템은 배제
|
|
{
|
|
if( m_SourceItem.handle == 0 )
|
|
m_SourceItem = COMBINEITEM( hItem );
|
|
else
|
|
{
|
|
COMBINEITEM_VECTOR::iterator itItem = GetItemIterator( hItem );
|
|
if( m_CombineItemsVector.end() != itItem ) // 이미 존재하는 경우
|
|
{
|
|
// 중첩 가능한 아이템인 경우
|
|
if( GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) )
|
|
{
|
|
// 기존 아이템의 갯수를 증가시킨다.
|
|
count_t nTotalCount = (*itItem).usiCount + usiCount;
|
|
if( nTotalCount > pSlot->GetItemCount() ) nTotalCount = pSlot->GetItemCount(); // 갖고있는 아이템의 전체 갯수보다 커지지 않도록 조정
|
|
if( nTotalCount > c_nCombineItemCountLimit ) nTotalCount = count_t( c_nCombineItemCountLimit );
|
|
|
|
if( (*itItem).usiCount != nTotalCount )
|
|
{
|
|
(*itItem).usiCount = nTotalCount;
|
|
RefreshSlots();
|
|
}
|
|
}
|
|
}
|
|
else // 처음 추가하는 경우
|
|
{
|
|
if(m_CombineItemsVector.size() < c_nCombineSlotCount)
|
|
{
|
|
m_CombineItemsVector.push_back( COMBINEITEM( hItem, usiCount ) );
|
|
}
|
|
RefreshSlots();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_pDisplayInfo->AddSystemMessage( S(292), 99); // Enable after releasing equipment
|
|
}
|
|
}
|
|
|
|
bool SUIUpgradeWnd::AbleAddSlot( COMBINEITEM Item )
|
|
{
|
|
if( Item.handle == m_SourceItem.handle && Item.usiCount == m_SourceItem.usiCount )
|
|
return false;
|
|
|
|
for( COMBINEITEM_VECTOR::iterator itItem = m_CombineItemsVector.begin(); itItem != m_CombineItemsVector.end(); itItem++ )
|
|
{
|
|
int nHandle = int((*itItem).handle);
|
|
count_t nCount = (*itItem).usiCount;
|
|
|
|
if( Item.handle == nHandle && Item.usiCount == nCount )
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool SUIUpgradeWnd::AbleMainSlot( SInventorySlot* pSlot )
|
|
{
|
|
int nBigGroup = GetItemDB().GetGroup( pSlot->GetItemCode() );
|
|
int nGroup = GetItemDB().GetClassID( pSlot->GetItemCode() );
|
|
int nID = pSlot->GetItemCode();
|
|
int nRank = GetItemDB().GetItemRank( pSlot->GetItemCode() );
|
|
int nLv = pSlot->GetLevel();
|
|
const XFlag<int> xFlag = pSlot->GetXFlag();
|
|
int nEnhance = pSlot->GetEnhance();
|
|
int nItemCount = pSlot->GetItemCount().getAmount();
|
|
|
|
return GetCombineDB().IsMain( nBigGroup, nGroup, nID, nRank, nLv, xFlag, nEnhance, nItemCount );
|
|
}
|
|
|
|
bool SUIUpgradeWnd::AbleSubSlot( SInventorySlot* pSlot )
|
|
{
|
|
int nBigGroup = GetItemDB().GetGroup( pSlot->GetItemCode() );
|
|
int nGroup = GetItemDB().GetClassID( pSlot->GetItemCode() );
|
|
int nID = pSlot->GetItemCode();
|
|
int nRank = GetItemDB().GetItemRank( pSlot->GetItemCode() );
|
|
int nLv = pSlot->GetLevel();
|
|
const XFlag<int> xFlag = pSlot->GetXFlag();
|
|
int nEnhance = pSlot->GetEnhance();
|
|
int nItemCount = pSlot->GetItemCount().getAmount();
|
|
|
|
return GetCombineDB().IsSub( nBigGroup, nGroup, nID, nRank, nLv, xFlag, nEnhance, nItemCount );
|
|
}
|
|
|
|
void SUIUpgradeWnd::RemoveCombineItem( AR_HANDLE hItem )
|
|
{
|
|
// 원본 아이템
|
|
if( m_SourceItem.handle == hItem )
|
|
{
|
|
//gmpbigsun(20130829) : 원본아이템 제거시 모두 초기화, handle로 비교하기때문에 재료아이템과 원본아이템이 같을경우 모두초기화 될수있음.
|
|
RemoveAllCombineItems( );
|
|
// m_SourceItem = COMBINEITEM();
|
|
// RefreshSlots();
|
|
}
|
|
// 강화 아이템
|
|
else
|
|
{
|
|
COMBINEITEM_VECTOR::iterator itItem = GetItemIterator( hItem );
|
|
if( m_CombineItemsVector.end() != itItem )
|
|
{
|
|
m_CombineItemsVector.erase( itItem );
|
|
RefreshSlots();
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIUpgradeWnd::RemoveAllCombineItems( bool bRefreshSlot/* = true*/ )
|
|
{
|
|
m_SourceItem = COMBINEITEM();
|
|
m_CombineItemsVector.clear();
|
|
|
|
if( bRefreshSlot ) RefreshSlots();
|
|
}
|
|
|
|
void SUIUpgradeWnd::RefreshSlots()
|
|
{
|
|
// 원본 아이템
|
|
KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( "slot_red_00" ));
|
|
if( NULL != pSrcSlotControl )
|
|
SetItemIconStatic( pSrcSlotControl, NULL, count_t( 0 ), m_InventoryMgr.GetItemInfo( m_SourceItem.handle ), true );
|
|
|
|
// 강화 아이템
|
|
for( int nSlotNum( 0 ); nSlotNum < c_nCombineSlotCount; ++nSlotNum )
|
|
{
|
|
std::string strIconControlID = CStringUtil::StringFormat( "slot_blue_%02d" , nSlotNum );
|
|
std::string strStaticCountID = CStringUtil::StringFormat( "static_itemcount%02d", nSlotNum );
|
|
|
|
KUIControlMultiIcon* pSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( strIconControlID.c_str() ));
|
|
KUIWnd* pItemCountControl = GetChild( strStaticCountID.c_str() );
|
|
|
|
if( nSlotNum < int(m_CombineItemsVector.size()) )
|
|
{
|
|
const COMBINEITEM& rCombineItem = m_CombineItemsVector[ nSlotNum ];
|
|
SetItemIconStatic( pSlotControl, pItemCountControl, rCombineItem.usiCount, m_InventoryMgr.GetItemInfo( rCombineItem.handle ), false );
|
|
}
|
|
else
|
|
{
|
|
SetItemIconStatic( pSlotControl, pItemCountControl );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIUpgradeWnd::SetItemIconStatic( KUIControlMultiIcon* pIconStatic, KUIWnd* pItemCountControl, count_t nCount, SInventorySlot* pSlot/* = NULL*/, bool bMain/*=false*/ )
|
|
{
|
|
if( NULL != pIconStatic )
|
|
ResetMultiIcon( pIconStatic, 0, 8 );
|
|
|
|
if( pSlot )
|
|
{
|
|
if( NULL != pIconStatic )
|
|
{
|
|
/// 2011.08.03 - prodongi
|
|
if( !setSkillCardIcon(pIconStatic, pSlot->GetItemCode()) && !setSummonCardIcon( pIconStatic, pSlot ) )
|
|
{
|
|
std::string iconName;
|
|
getIconNameAtDurability(pSlot, iconName);
|
|
pIconStatic->SetIcon(0, c_szDEF_SPR_NAME, iconName.c_str());
|
|
}
|
|
|
|
if( pSlot->GetItemAppearance() )
|
|
pIconStatic->SetIcon( 4, c_szDEF_SPR_NAME, g_strLookChangeIcon ); // 2012. 7. 27 - marine 아이템 형상변환 아이콘
|
|
|
|
pIconStatic->SetIcon( 1, c_szDEF_SPR_NAME, pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL );
|
|
|
|
EquipItemAddtionalIconSetter icon_setter( pIconStatic, pSlot );
|
|
|
|
pIconStatic->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
|
|
|
|
if( m_bAltKey )
|
|
{
|
|
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIconStatic, pSlot );
|
|
}
|
|
}
|
|
if( NULL != pItemCountControl )
|
|
{
|
|
/// 2011.04.28 정리 - prodongi
|
|
__int64 amount = GetItemDB().IsJoin(pSlot->GetItemCode(),IsInstanceUnstackable(pSlot)) ? nCount.getAmount() : 0;
|
|
//pItemCountControl->SetShow( GetItemDB().IsJoin(pSlot->GetItemCode()) ? nCount.getAmount() : 0 );
|
|
pItemCountControl->SetShow( (amount != 0) ? true : false);
|
|
pItemCountControl->SetCaption( CStringUtil::StringFormat( "%s<right><size:8><shadow>%I64d", S(6425),
|
|
GetItemDB().IsJoin(pSlot->GetItemCode(),IsInstanceUnstackable(pSlot)) ? nCount.getAmount() : 0 ).c_str() );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if( NULL != pIconStatic )
|
|
{
|
|
//pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, bMain ? "common_panel_titanium_slot_red" : "common_panel_titanium_slot_blue" );
|
|
pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, "common_panel_titanium_slot_icon" );
|
|
pIconStatic->SetTooltip();
|
|
}
|
|
if( NULL != pItemCountControl )
|
|
pItemCountControl->SetShow(false);
|
|
}
|
|
}
|
|
|
|
|
|
// 공식텍스트 출력.
|
|
void SUIUpgradeWnd::RefreshFormal()
|
|
{
|
|
std::string strNewStory;
|
|
const int MAX_STORY_LINE_COUNT = 6;
|
|
|
|
// 대화내용 넘침 방지
|
|
std::vector< std::string > vLineList;
|
|
//m_pFormalTextControl->SplitLine( vLineList, m_strFormal, S(6425), m_pFormalTextControl->GetFontSize(), false, true );
|
|
|
|
|
|
#ifdef _COUNTRY_ME_
|
|
m_pFormalTextControl->SplitLine( vLineList, m_strFormal, KFontManager::KDEFAULT_FONT_NAME, m_pFormalTextControl->GetFontSize() );
|
|
//strNewStory += "<font:Default><RIGHT>";
|
|
strNewStory += m_strDecoFormal;
|
|
#else
|
|
m_pFormalTextControl->SplitLine( vLineList, m_strFormal, m_strFormalFontName.c_str(), m_pFormalTextControl->GetFontSize() );
|
|
strNewStory += m_strDecoFormal; // std::string( S(6313)/*"<size:9><top><font:\"돋움\">"*/ );
|
|
#endif
|
|
|
|
int size = vLineList.size();
|
|
if( size > MAX_STORY_LINE_COUNT )
|
|
{
|
|
for( int i = 0; i < size; ++i )
|
|
{
|
|
if( i >= MAX_STORY_LINE_COUNT || size <= m_nScrollPos + i )
|
|
break;
|
|
|
|
strNewStory += vLineList[ m_nScrollPos + i ];
|
|
strNewStory += "<BR>";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
#ifdef _COUNTRY_ME_
|
|
strNewStory += m_strFormal;
|
|
#else
|
|
strNewStory = m_strFormal;
|
|
#endif
|
|
m_nScrollPos = 0;
|
|
}
|
|
|
|
vLineList.clear();
|
|
|
|
// 스크롤바 Thumb 조절.
|
|
m_pScrollFormal->SetScrollRange( MAX_STORY_LINE_COUNT, size );
|
|
|
|
// 텍스트 적용.
|
|
m_pFormalTextControl->SetCaption( strNewStory.c_str() );
|
|
} |