#include "stdafx.h" #include "SUIDecompositionWnd.h" #include "SLog.h" //#include "Util.h" #include "CommonUtil.h" #include "SGame.h" #include "SItemDB.h" #include "SStringDB.h" #include "SCreatureDB.h" #include "SUIDefine.h" #include "KUIDefine.h" #include "SGameManager.h" //#include "SGameMessageUI.h" #include "SGameInterface.h" #include "SPetMgr.h" #include "SInventoryMgr.h" #include "SUIInventoryWnd.h" #include "SPlayerInfoMgr.h" #include "SSummonSlotMgr.h" #include "SUILazyTooltip.h" #include "SGameSystem.h" extern SGameSystem * g_pCurrentGameSystem; namespace nsDecomposeUI { static const WORD MAX_DECOMPOSITION_COUNT( 16 ); // 최대 분해 개수 static const WORD MAX_EACH_COUNT( 100 ); // 아이템별 최대 개수 static const WORD MAX_LINE_OF_PAGE( 8 ); // 한 화면에서 보여줄 아이템의 최대 줄 수 static const string BASE_ICON_CONTROL_NAME( "icon_item00" ); // 기본 아이템 아이콘 컨트롤 이름 static const string BASE_ITEMNAME_CONTROL_NAME( "item_name_text_00" ); // 기본 아이템 이름 컨트롤 이름 static const string BASE_ITEMDESC_CONTROL_NAME( "item_info_text_00" ); // 기본 아이템 이름 컨트롤 이름 static const string BASE_BACKGROUND_CONTROL_NAME( "inframe_line_00" ); // 기본 아이템 배경 컨트롤 이름 static const string BASE_SELECT_CONTROL_NAME( "select_list_red_00" ); // 선택 컨트롤 이름 static const string SCROLLBAR_CONTROL_NAME( "scrollbar_list_01" ); // 스크롤 바 컨트롤 이름 static const string ICONSLOT_CONTROL_NAME( "common_panel_titanium_slot_icon" ); // 아이템 슬롯 컨트롤 이름 static const string DO_EMPTY_CONTROL_NAME( "button_remove_01" ); // 비우기 버튼 컨트롤 이름 static const string DO_DECOMPOSITION_CONTROL_NAME( "all_decompose_01" ); // 전체 분해 버튼 컨트롤 이름 static const string ITEMCOUNT_CONTROL_NAME( "decompose_count_01" ); // 아이템 개수 컨트롤 이름 static const string RUPY_CONTROL_NAME( "text_rupy_num_01" ); // 루피 컨트롤 이름 static const string RUPY_OVER_COLOR_VALUE_CONTROL_NAME( "text_rupy_num_over_01" ); // 보유 루피보다 분해 필요 루피가 많을 시 출력 할 폰트 색상 컨트롤 이름 static const string MAX_ITEMCOUNT_COLOR_VALUE_CONTROL_NAME( "decompose_count_over_01" ); // 최대 분해 개수 만큼 아이템이 등록 ‰瑛?시 출략 할 폰트 색상 컨트롤 이름 static const string DO_DECOMPOSITION_DISABLE_COLOR_VALUE_CONTROL_NAME( "all_decompose_disable_01" );// 전체 분해 버튼 컨트롤 비 활성화 시 출력 할 폰트 색상 컨트롤 이름 static const string SYSTEM_MESSAGE_RESULT_ITEMINFO_ITENNAME_TAG( "#@item_name@#" ); // #@item_name@# static const string SYSTEM_MESSAGE_RESULT_ITEMINFO_ITENCOUNT_TAG( "#@item_num@#" ); // #@item_num@# static const string NAME_ITEM_AMOUNT( "static_itemcount00" ); static const WORD INVALID_CONTROL_INDEX( -1 ); }; //----------------------------------------------------------------------------------------------------------------- // 생성자 //----------------------------------------------------------------------------------------------------------------- SUIDecompositionWnd::SUIDecompositionWnd( SGameManager * pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager ) , m_pDisplayInfo( pDisplayInfo ) , m_pScrollBar( NULL ) , m_pRupyControl( NULL ) , m_pDoEmptyControl( NULL ) , m_pItemCountControl( NULL ) , m_pDoDecompositionControl( NULL ) , m_nCurrentScrollPosition( NULL ) , m_wCurrentSelectControlIndex( INVALID_CONTROL_INDEX ) , m_nBackgroundControlHeight( NULL ) , m_nBackgroundControlWidth( NULL ) , m_strRupyBasicColorValue( "" ) , m_strRupyNotEnoughColorValue( "" ) , m_strItemCountBasicColorValue( "" ) , m_strItemCountMaxColorValue( "" ) , m_strDoDecompositionEnableColorValue( "" ) , m_strDoDecompositionDisableColorValue( "" ) , m_strRupyPropertyTag( "" ) , m_strItemNamePropertyTag( "" ) , m_strItemDescPropertyTag( "" ) , m_strItemCountPropertyTag( "" ) , m_strDoDecompositionPropertyTag( "" ) , m_n64WaitForAppendItemUniqueID( NULL ) , m_n64NeedPriceTemporaryStorage( NULL ) , m_n64TotalNeedPrice( NULL ) , m_bIsNotEnoughMoney( true ) , m_bIsSendPacket( false ) , m_bIsOpenFinalCautionMessageBox( false ) , m_ntCountForWaiting( 0 ) { } //----------------------------------------------------------------------------------------------------------------- // 파괴자 //----------------------------------------------------------------------------------------------------------------- SUIDecompositionWnd::~SUIDecompositionWnd() { for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); SAFE_DELETE( pControlInfo ); } m_vecControlInfo.clear(); m_mapUniqueID.clear(); } //----------------------------------------------------------------------------------------------------------------- // 윈도우 생성 //----------------------------------------------------------------------------------------------------------------- SUIWnd* SUIDecompositionWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID ) { SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID ); if( false == CreateBaseControlInfo() ) return NULL; if( false == CreateCopyControlInfo() ) return NULL; ResetControlInfo(); UpdateAppendedItemCount(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); return this; } //----------------------------------------------------------------------------------------------------------------- // 기본 컨트롤 들의 정보를 생성한다. //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::CreateBaseControlInfo() { KUIControlMultiIcon* pBaseIconControl( dynamicCast( GetChild( BASE_ICON_CONTROL_NAME.c_str() ) ) ); if( NULL == pBaseIconControl ) return false; else pBaseIconControl->SetIconLayer( 8 ); //수량 KUIWnd* pBaseItemAmountControl ( GetChild( NAME_ITEM_AMOUNT.c_str() ) ); if( NULL == pBaseItemAmountControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", NAME_ITEM_AMOUNT.c_str() ); assert( pBaseItemAmountControl ); return false; } else pBaseItemAmountControl->SetShow( false ); KUIWnd* pBaseItemNameControl( GetChild( BASE_ITEMNAME_CONTROL_NAME.c_str() ) ); if( NULL == pBaseItemNameControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", BASE_ITEMNAME_CONTROL_NAME.c_str() ); assert( pBaseItemNameControl ); return false; } KUIWnd* pBaseItemDescControl( GetChild( BASE_ITEMDESC_CONTROL_NAME.c_str() ) ); if( NULL == pBaseItemDescControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", BASE_ITEMDESC_CONTROL_NAME.c_str() ); assert( pBaseItemDescControl ); return false; } KUIWnd* pBassBackgroundControl( GetChild( BASE_BACKGROUND_CONTROL_NAME.c_str() ) ); if( NULL == pBassBackgroundControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", BASE_BACKGROUND_CONTROL_NAME.c_str() ); assert( pBassBackgroundControl ); return false; } KUIWnd* pBaseSelectControl( GetChild( BASE_SELECT_CONTROL_NAME.c_str() ) ); if( NULL == pBaseSelectControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", BASE_SELECT_CONTROL_NAME.c_str() ); assert( pBaseSelectControl ); return false; } PCONTROL_INFO pControlInfo( new CONTROL_INFO() ); if( NULL == pControlInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] alloc Failed" ); assert( pControlInfo ); return false; } pControlInfo->m_wIndex = 0; // 베이스 컨트롤이니깐 0번 이다. pControlInfo->m_wLineNumber = 0; // 베이스 컨트롤이니깐 0번 라인에 존재한다. ( 한 라인에 2개 씩 존재 ) pControlInfo->m_strIconControl = BASE_ICON_CONTROL_NAME.c_str(); pControlInfo->m_strItemNameControl = BASE_ITEMNAME_CONTROL_NAME.c_str(); pControlInfo->m_strItemDescControl = BASE_ITEMDESC_CONTROL_NAME.c_str(); pControlInfo->m_strBackgroundControl = BASE_BACKGROUND_CONTROL_NAME.c_str(); pControlInfo->m_strSelectControl = BASE_SELECT_CONTROL_NAME.c_str(); pControlInfo->m_pIconControl = pBaseIconControl; pControlInfo->m_pItemAmountControl = pBaseItemAmountControl; pControlInfo->m_pItemNameControl = pBaseItemNameControl; pControlInfo->m_pItemDescControl = pBaseItemDescControl; pControlInfo->m_pBackgroundControl = pBassBackgroundControl; pControlInfo->m_pSelectControl = pBaseSelectControl; m_vecControlInfo.push_back( pControlInfo ); KRect rtBackground( pBassBackgroundControl->GetRect() ); m_nBackgroundControlHeight = rtBackground.GetHeight(); m_nBackgroundControlWidth = rtBackground.GetWidth(); GetTextDecoration( pBaseItemNameControl->GetCaption(), m_strItemNamePropertyTag ); GetTextDecoration( pBaseItemDescControl->GetCaption(), m_strItemDescPropertyTag ); pControlInfo->m_pItemNameControl->SetCaption( m_strItemNamePropertyTag.c_str() ); pControlInfo->m_pItemDescControl->SetCaption( m_strItemDescPropertyTag.c_str() ); return true; } //----------------------------------------------------------------------------------------------------------------- // 최대 분해 아이템 개수만큼 기본 컨트롤로 부터 복사 컨트롤 들의 정보를 생성한다. //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::CreateCopyControlInfo() { RECT rtLeftSide; ::ZeroMemory( &rtLeftSide, sizeof( rtLeftSide ) ); RECT rtRightSide; ::ZeroMemory( &rtRightSide, sizeof( rtRightSide ) ); KUIWnd* pBassBackgroundControl( GetChild( BASE_BACKGROUND_CONTROL_NAME.c_str() ) ); if( NULL == pBassBackgroundControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", BASE_BACKGROUND_CONTROL_NAME.c_str() ); assert( pBassBackgroundControl ); return false; } else { rtLeftSide.top = m_nBackgroundControlHeight; rtLeftSide.left = -( m_nBackgroundControlWidth ); rtLeftSide.bottom = m_nBackgroundControlHeight; rtLeftSide.right = -( m_nBackgroundControlWidth ); rtRightSide.left = m_nBackgroundControlWidth; rtRightSide.right = m_nBackgroundControlWidth; } // 컨트롤의 UI에서의 줄 번호 ( 첫 번째 줄은 0번 ) WORD wLineNumber = 0; // 0번 왼쪽 컨트롤에 대한 정보는 이미 CreateBaseControlInfo 함수에서 생성 되었음. for( WORD wCount = 1; wCount < MAX_DECOMPOSITION_COUNT; wCount++ ) { RECT rtAddPosition; ::ZeroMemory( &rtAddPosition, sizeof( rtAddPosition ) ); if( 0 == (wCount % 2) ) // 왼쪽 컨트롤 { rtAddPosition = rtLeftSide; ++wLineNumber; } else // 오른쪽 컨트롤 { rtAddPosition = rtRightSide; } PCONTROL_INFO pControlInfo( new CONTROL_INFO() ); if( NULL == pControlInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] alloc Failed" ); assert( pControlInfo ); continue; } string strBackgroundControl_SrcName( StringFormat( "inframe_line_%02d", (wCount - 1) ).c_str() ); string strBackgroundControl_DestName( StringFormat( "inframe_line_%02d", wCount ).c_str() ); KUIWnd* pCopiedBackgroundControl( CopyControl( strBackgroundControl_SrcName.c_str(), strBackgroundControl_DestName.c_str(), rtAddPosition ) ); if( NULL == pCopiedBackgroundControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Background Control Copy Failded" ); assert( pCopiedBackgroundControl ); } string strSelectControl_SrcName( StringFormat( "select_list_red_%02d", (wCount - 1) ).c_str() ); string strSelectControl_DestName( StringFormat( "select_list_red_%02d", wCount ).c_str() ); KUIWnd* pCopiedSelectControl( CopyControl( strSelectControl_SrcName.c_str(), strSelectControl_DestName.c_str(), rtAddPosition ) ); if( NULL == pCopiedSelectControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Select Control Copy Failded" ); assert( pCopiedSelectControl ); } string strIconControl_SrcName( StringFormat( "icon_item%02d", (wCount - 1) ).c_str() ); string strIconControl_DestName( StringFormat( "icon_item%02d", wCount ).c_str() ); KUIControlMultiIcon* pCopiedIconControl( dynamicCast( CopyControl( strIconControl_SrcName.c_str(), strIconControl_DestName.c_str(), rtAddPosition ) ) ); if( NULL == pCopiedIconControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Icon Control Copy Failded" ); assert( pCopiedIconControl ); } else pCopiedIconControl->SetIconLayer( 8 ); string strItemNameControl_SrcName( StringFormat( "item_name_text_%02d", (wCount - 1) ).c_str() ); string strItemNameControl_DestName( StringFormat( "item_name_text_%02d", wCount ).c_str() ); KUIWnd* pCopiedItemNameControl( CopyControl( strItemNameControl_SrcName.c_str(), strItemNameControl_DestName.c_str(), rtAddPosition ) ); if( NULL == pCopiedItemNameControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Name Control Copy Failded" ); assert( pCopiedItemNameControl ); } string strItemDescControl_SrcName( StringFormat( "item_info_text_%02d", (wCount - 1) ).c_str() ); string strItemDescControl_DestName( StringFormat( "item_info_text_%02d", wCount ).c_str() ); KUIWnd* pCopiedItemDescControl( CopyControl( strItemDescControl_SrcName.c_str(), strItemDescControl_DestName.c_str(), rtAddPosition ) ); if( NULL == pCopiedItemDescControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Desc Control Copy Failded" ); assert( pCopiedItemDescControl ); } string strItemCountControl_SrcName( StringFormat( "static_itemcount%02d", (wCount-1) ).c_str() ); string strItemCountControl_DestName( StringFormat( "static_itemcount%02d", wCount ).c_str() ); KUIWnd* pCopiedItemCountCotrol( CopyControl( strItemCountControl_SrcName.c_str(), strItemCountControl_DestName.c_str(), rtAddPosition ) ); if( NULL == pCopiedItemCountCotrol ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Desc Control Copy Failded" ); assert( pCopiedItemCountCotrol ); } pControlInfo->m_wIndex = wCount; pControlInfo->m_wLineNumber = wLineNumber; pControlInfo->m_strIconControl = strIconControl_DestName.c_str(); pControlInfo->m_strItemNameControl = strItemNameControl_DestName.c_str(); pControlInfo->m_strItemDescControl = strItemDescControl_DestName.c_str(); pControlInfo->m_strBackgroundControl = strBackgroundControl_DestName.c_str(); pControlInfo->m_strSelectControl = strSelectControl_DestName.c_str(); pControlInfo->m_pIconControl = pCopiedIconControl; pControlInfo->m_pItemNameControl = pCopiedItemNameControl; pControlInfo->m_pItemDescControl = pCopiedItemDescControl; pControlInfo->m_pBackgroundControl = pCopiedBackgroundControl; pControlInfo->m_pSelectControl = pCopiedSelectControl; pControlInfo->m_pItemAmountControl = pCopiedItemCountCotrol; m_vecControlInfo.push_back( pControlInfo ); } return true; } //----------------------------------------------------------------------------------------------------------------- // 컨트롤 초기화 //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::InitControls( KPoint kPos ) { KUIWnd* pTitleBarWnd( GetChild( "titlebar" ) ); if( NULL == pTitleBarWnd ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Title bar UI Control" ); assert( pTitleBarWnd ); } else SetCustomMovingRect( pTitleBarWnd->GetRect() ); return SUIWnd::InitControls( kPos ); } //----------------------------------------------------------------------------------------------------------------- // 데이터 초기화 //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::InitData( bool bReload /*= false*/ ) { m_pScrollBar = dynamicCast( GetChild( SCROLLBAR_CONTROL_NAME.c_str() ) ); if( NULL == m_pScrollBar ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", SCROLLBAR_CONTROL_NAME.c_str() ); assert( m_pScrollBar ); } else { // (두 줄이므로 최대 개수 / 2) - (한 페이지의 보여주는 컨트롤 개수 - 1) DWORD dwMaxRange ( (MAX_DECOMPOSITION_COUNT * 0.5f) - (MAX_LINE_OF_PAGE - 1) ); m_pScrollBar->SetMaxRange( dwMaxRange ); } m_pRupyControl = dynamicCast( GetChild( RUPY_CONTROL_NAME.c_str() ) ); if( NULL == m_pRupyControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", RUPY_CONTROL_NAME.c_str() ); assert( m_pRupyControl ); } else { string strCaption( m_pRupyControl->GetCaption() ); GetTextDecoration( strCaption.c_str(), m_strRupyPropertyTag ); GetTextColorValue( strCaption, m_strRupyBasicColorValue ); } /*m_pItemCountControl = dynamicCast( GetChild( ITEMCOUNT_CONTROL_NAME.c_str() ) ); if( NULL == m_pItemCountControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", ITEMCOUNT_CONTROL_NAME.c_str() ); assert( m_pItemCountControl ); } else { string strCaption( m_pItemCountControl->GetCaption() ); GetTextDecoration( strCaption.c_str(), m_strItemCountPropertyTag ); GetTextColorValue( strCaption, m_strItemCountBasicColorValue ); }*/ m_pDoEmptyControl = dynamicCast( GetChild( DO_EMPTY_CONTROL_NAME.c_str() ) ); if( NULL == m_pDoEmptyControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", DO_EMPTY_CONTROL_NAME.c_str() ); assert( m_pDoEmptyControl ); } KUIControlStatic* pDocompositionDisableColorValueControl = dynamicCast( GetChild( DO_DECOMPOSITION_DISABLE_COLOR_VALUE_CONTROL_NAME.c_str() ) ); if( NULL == pDocompositionDisableColorValueControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", DO_DECOMPOSITION_DISABLE_COLOR_VALUE_CONTROL_NAME.c_str() ); assert( pDocompositionDisableColorValueControl ); } else { string strCaption( pDocompositionDisableColorValueControl->GetCaption() ); GetTextDecoration( strCaption.c_str(), m_strDoDecompositionPropertyTag ); GetTextColorValue( strCaption, m_strDoDecompositionDisableColorValue ); } m_pDoDecompositionControl = dynamicCast( GetChild( DO_DECOMPOSITION_CONTROL_NAME.c_str() ) ); if( NULL == m_pDoDecompositionControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", DO_DECOMPOSITION_CONTROL_NAME.c_str() ); assert( m_pDoDecompositionControl ); } else { string strCaption( m_pDoDecompositionControl->GetCaption() ); GetTextColorValue( strCaption, m_strDoDecompositionEnableColorValue ); m_pDoDecompositionControl->SetEnableColor( StringFormat( "<#%s>", m_strDoDecompositionEnableColorValue.c_str() ).c_str() ); m_pDoDecompositionControl->SetDisableColor( StringFormat( "<#%s>", m_strDoDecompositionDisableColorValue.c_str() ).c_str() ); m_pDoDecompositionControl->Disable(); } KUIControlStatic* pRupyOverColorValueControl = dynamicCast( GetChild( RUPY_OVER_COLOR_VALUE_CONTROL_NAME.c_str() ) ); if( NULL == pRupyOverColorValueControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", RUPY_OVER_COLOR_VALUE_CONTROL_NAME.c_str() ); assert( pRupyOverColorValueControl ); } else { string strCaption( pRupyOverColorValueControl->GetCaption() ); GetTextColorValue( strCaption, m_strRupyNotEnoughColorValue ); } KUIControlStatic* pMaxItemCountColorValueControl = dynamicCast( GetChild( MAX_ITEMCOUNT_COLOR_VALUE_CONTROL_NAME.c_str() ) ); if( NULL == pMaxItemCountColorValueControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get UI Control - Name[%s]", MAX_ITEMCOUNT_COLOR_VALUE_CONTROL_NAME.c_str() ); assert( pMaxItemCountColorValueControl ); } else { string strCaption( pMaxItemCountColorValueControl->GetCaption() ); GetTextColorValue( strCaption, m_strItemCountMaxColorValue ); } return SUIWnd::InitData(bReload); } //----------------------------------------------------------------------------------------------------------------- // 윈도우 열리고, 닫힐 때 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { if( bOpen ) { if( IsOpenAnotherUIWindow() ) { if( m_pGameManager ) m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S(228) /* 지금은 할 수 없습니다.*/, true ) ); SetShow( false ); SUIWnd::OnNotifyUIWindowOpen( false ); return ; } } else { ResetControlInfo(); UpdateAppendedItemCount(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); } SUIWnd::OnNotifyUIWindowOpen( bOpen ); } //----------------------------------------------------------------------------------------------------------------- // 메시지 처리 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { if( NULL == lpszControlID ) return; string strControlID( lpszControlID ); switch( nMessage ) { case KSCROLL_SELECT: case KSCROLL_CHANGE: case KSCROLL_REFRESH: { if( NULL == strControlID.compare( SCROLLBAR_CONTROL_NAME.c_str() ) ) { UpdateScrollBar(); UpdateSelectControl(); } } break; case KBUTTON_CLICK: case KBUTTON_PRESSING: { if( NULL == strControlID.compare( "scroll_btn_up" ) || // 스크롤 위로 버튼 클릭 NULL == strControlID.compare( "scroll_btn_down" ) ) // 스크롤 아래로 버튼 클릭 { UpdateScrollBar(); UpdateSelectControl(); } if( NULL == strControlID.compare( DO_EMPTY_CONTROL_NAME.c_str() ) ) // 비우기 버튼 클릭 { ResetControlInfo(); UpdateAppendedItemCount(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); } if( NULL == strControlID.compare( "button_close" ) ) // 닫기 버튼 클릭 { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, false ) ); } if( NULL == strControlID.compare( DO_DECOMPOSITION_CONTROL_NAME.c_str() ) ) // 전체 분해 버튼 클릭 { m_bIsOpenFinalCautionMessageBox = false; for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { const IN_DATA& kData = Iter->second; if( IsNeedOpenCautionMessageBox( kData._id ) ) m_bIsOpenFinalCautionMessageBox = true; } if( m_bIsOpenFinalCautionMessageBox ) { if( NULL == m_pGameManager ) { SDEBUGLOG( "[SUIDecompositionWnd] GameManager Pointer is NULL" ); assert( m_pGameManager ); return; } SGameInterface* pGameInterface( m_pGameManager->GetGameInterface() ); if( NULL == pGameInterface ) { SDEBUGLOG( "[SUIDecompositionWnd] GameInterface Pointer is NULL" ); assert( pGameInterface ); return; } pGameInterface->OpenMessageBox( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_YESNO, SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DECOMPOSITON_CONFIRM_DO, false, -1, S( 1265 ) ); } else { OpenProgressiveBar(); } } } break; case KUI_MESSAGE::KGENWND_MOVE: { LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 } break; default: break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } //----------------------------------------------------------------------------------------------------------------- // 프로그레스 바 윈도우 열기 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::OpenProgressiveBar() { if( NULL == m_pGameManager ) return; m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) ); } //----------------------------------------------------------------------------------------------------------------- // 전체 분해 패킷 전송 //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::SendDoDecompsitionPacket() { if( m_bIsSendPacket ) { SDEBUGLOG( "[SUIDecompositionWnd] Already Send Packet" ); assert( NULL ); return false; } SMSG_DECOMPOSE_DO stMsg; for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { const IN_DATA& kIterData = Iter->second; ItemInstance::ItemUID n64UniqueID( kIterData._id ); SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( n64UniqueID ) ); if( NULL == pInventorySlot ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Slot Info By UniqueID - [ %u ]", n64UniqueID ); assert( pInventorySlot ); continue; } //stMsg.m_vecItemHandle.push_back( pInventorySlot->GetHandle() ); SMSG_DECOMPOSE_DO::IN_DATA kData; kData._handle = pInventorySlot->GetHandle(); kData._count = (unsigned int)kIterData._count.getAmount(); stMsg.m_vecItemData.push_back( kData ); } if( m_pGameManager ) { m_pGameManager->ProcMsgAtStatic( &stMsg ); m_bIsSendPacket = true; } return true; } //----------------------------------------------------------------------------------------------------------------- // 정적 메시지 처리 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { if( NULL == pMsg ) return; switch( pMsg->nType ) { case IMSG_UI_INPUTNUMBER: //gmpbigsun: 수량입력기로부터 입력받음 { SIMSG_UI_INPUTNUMBER* pInputNumberMsg = (SIMSG_UI_INPUTNUMBER*)pMsg; if( pInputNumberMsg->m_nValue < 1 ) { m_n64WaitForAppendItemUniqueID = 0; m_ntCountForWaiting = count_t( 0 ); break; } else if( pInputNumberMsg->m_nValue > MAX_EACH_COUNT ) { //최대수량 SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( m_n64WaitForAppendItemUniqueID ) ); if( NULL == pInventorySlot ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Slot Info By UniqueID - [ %u ]", m_n64WaitForAppendItemUniqueID ); assert( pInventorySlot ); m_n64WaitForAppendItemUniqueID = 0; m_ntCountForWaiting = count_t( 0 ); return; } pInputNumberMsg->m_nValue = ( pInventorySlot->GetItemCount() > MAX_EACH_COUNT ? count_t( MAX_EACH_COUNT ): pInventorySlot->GetItemCount() ); } if( IsNeedOpenCautionMessageBox( m_n64WaitForAppendItemUniqueID ) ) { if( NULL == m_pGameManager ) { SDEBUGLOG( "[SUIDecompositionWnd] GameManager Pointer is NULL" ); assert( m_pGameManager ); return; } SGameInterface* pGameInterface( m_pGameManager->GetGameInterface() ); if( NULL == pGameInterface ) { SDEBUGLOG( "[SUIDecompositionWnd] GameInterface Pointer is NULL" ); assert( pGameInterface ); return; } m_ntCountForWaiting = pInputNumberMsg->m_nValue; pGameInterface->OpenMessageBox( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_YESNO, SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DECOMPOSITON_CONFIRM_APPEND, false, -1, S( 1265 ) ); } else { if( m_mapUniqueID.size() >= MAX_DECOMPOSITION_COUNT ) return; if( IsExistItemUniqueID( m_n64WaitForAppendItemUniqueID ) ) return; if( IsPossibleItemAppend( m_n64WaitForAppendItemUniqueID ) ) { SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( m_n64WaitForAppendItemUniqueID ) ); if( NULL == pInventorySlot ) return; if( pInventorySlot->GetItemCount() >= pInputNumberMsg->m_nValue ) { WORD wIndex( m_mapUniqueID.size() ); IN_DATA kData; kData._id = m_n64WaitForAppendItemUniqueID; kData._count = pInputNumberMsg->m_nValue; m_mapUniqueID.insert( make_pair( wIndex, kData ) ); AutoScrollBarMoveWhenAppendItem( wIndex ); SetAppendedItemToInventorySlot( m_n64WaitForAppendItemUniqueID, true ); PCONTROL_INFO pFindControlInfo( FindControlInfo( wIndex ) ); if( pFindControlInfo ) pFindControlInfo->m_n64NeedPrice = m_n64NeedPriceTemporaryStorage; } } } } break; case IMSG_UI_SEND_DATA: { SIMSG_UI_SEND_DATA* pRMsg( static_cast( pMsg ) ); if( NULL == pRMsg ) break; if( NULL == pRMsg->m_strString.compare( "Append_Yes" ) ) { if( m_mapUniqueID.size() >= MAX_DECOMPOSITION_COUNT ) return; if( IsExistItemUniqueID( m_n64WaitForAppendItemUniqueID ) ) return; if( IsPossibleItemAppend( m_n64WaitForAppendItemUniqueID ) ) { SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( m_n64WaitForAppendItemUniqueID ) ); if( NULL == pInventorySlot ) return; if( pInventorySlot->GetItemCount() >= m_ntCountForWaiting ) { WORD wIndex( m_mapUniqueID.size() ); IN_DATA kData; kData._id = m_n64WaitForAppendItemUniqueID; kData._count = m_ntCountForWaiting; m_mapUniqueID.insert( make_pair( wIndex, kData ) ); SetAppendedItemToInventorySlot( m_n64WaitForAppendItemUniqueID, true ); m_n64WaitForAppendItemUniqueID = NULL; m_ntCountForWaiting = count_t(0); AutoScrollBarMoveWhenAppendItem( wIndex ); PCONTROL_INFO pFindControlInfo( FindControlInfo( wIndex ) ); if( pFindControlInfo ) pFindControlInfo->m_n64NeedPrice = m_n64NeedPriceTemporaryStorage; } } } if( NULL == pRMsg->m_strString.compare( "Append_No" ) ) { m_n64WaitForAppendItemUniqueID = NULL; m_ntCountForWaiting = count_t(0); } if( NULL == pRMsg->m_strString.compare( "Do_Decomposition" ) ) { OpenProgressiveBar(); } } break; case IMSG_DECOMPOSE_RESULT: { SMSG_DECOMPOSE_RESULT* pRMsg( static_cast( pMsg ) ); if( NULL == pRMsg ) break; OutputResultSystemMessage( pRMsg ); m_bIsSendPacket = false; } break; case MSG_RESULT: { m_bIsSendPacket = false; } break; case IMSG_SYNTHETIC_ITEM: { SendDoDecompsitionPacket(); ResetControlInfo(); } break; case IMSG_UI_MOVE: { SIMSG_UI_MOVE* pRMsg( static_cast( pMsg ) ); if( NULL == pRMsg ) break; MovePos( pRMsg->m_nX, pRMsg->m_nY ); LimitMoveWnd(); } break; case IMSG_HOTKEY_EX: //servantes 2010.10.19 { SIMSG_HOTKEY_EX* pHotKey = dynamicCast(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() ) { // 밑에서 UpdateItemInfo(); 호출하네. } } } break; } UpdateAppendedItemCount(); UpdateControlInfo(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); pMsg->bUse = true; } //----------------------------------------------------------------------------------------------------------------- // 분해 결과를 시스템 메시지로 출력한다. //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::OutputResultSystemMessage( SMSG_DECOMPOSE_RESULT* const pRMsg ) { if( NULL == pRMsg ) { SDEBUGLOG( "[SUIDecompositionWnd] Result Message Pointer is NULL" ); assert( pRMsg ); return; } for( int nCount = 0; nCount < pRMsg->m_vecItemInfo.size(); nCount++ ) { SMSG_DECOMPOSE_RESULT::DECOMPOSE_INFO& rItemInfo( pRMsg->m_vecItemInfo[nCount] ); string strResultItemInfoMessage( S( 1264 ) ); string strItemName( m_pDisplayInfo->GetItemName( rItemInfo.m_hItem ) ); string strItemCount( StringFormat( "%u", rItemInfo.m_nItemCount ) ); ReplacePhrase( strResultItemInfoMessage, SYSTEM_MESSAGE_RESULT_ITEMINFO_ITENNAME_TAG, strItemName ); ReplacePhrase( strResultItemInfoMessage, SYSTEM_MESSAGE_RESULT_ITEMINFO_ITENCOUNT_TAG, strItemCount ); if( m_pDisplayInfo ) m_pDisplayInfo->AddSystemMessage( strResultItemInfoMessage.c_str(), 99 ); } } //----------------------------------------------------------------------------------------------------------------- // 마우스 메시지 처리 : 선택 컨트롤 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::ProcessMouseMessage_SelectControl( const PCONTROL_INFO pControlInfo ) { if( NULL == pControlInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] Control Info Pointer is NULL" ); assert( pControlInfo ); return; } ITER_ITEM_UNIQUE_ID_LIST Iter( m_mapUniqueID.find( pControlInfo->m_wIndex ) ); if( Iter == m_mapUniqueID.end() ) return; KUIWnd* pBackgroundControl( pControlInfo->m_pBackgroundControl ); if( pBackgroundControl->IsShow() ) { if( INVALID_CONTROL_INDEX != m_wCurrentSelectControlIndex ) { PCONTROL_INFO pPreSelectControlInfo( FindControlInfo( m_wCurrentSelectControlIndex ) ); if( pPreSelectControlInfo ) { KUIWnd* pPreSelectControl( pPreSelectControlInfo->m_pSelectControl ); if( pPreSelectControl ) pPreSelectControl->SetShow( false ); } } KUIWnd* pSelectControl( pControlInfo->m_pSelectControl ); if( pSelectControl ) { pSelectControl->SetShow( true ); m_wCurrentSelectControlIndex = pControlInfo->m_wIndex; } } } //----------------------------------------------------------------------------------------------------------------- // 마우스 메시지 처리 : 아이템 빼기 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::ProcessMouseMessage_RemoveItem( const PCONTROL_INFO pControlInfo ) { if( NULL == pControlInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] Control Info Pointer is NULL" ); assert( pControlInfo ); return; } DeleteItemUniqueID( pControlInfo->m_wIndex ); UpdateAppendedItemCount(); UpdateControlInfo(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); } //----------------------------------------------------------------------------------------------------------------- // 마우스 메시지 처리 //----------------------------------------------------------------------------------------------------------------- DWORD SUIDecompositionWnd::OnMouseMessage(DWORD dwMessage, int x, int y) { PCONTROL_INFO pFindControlInfo( FindControlInfo( KPoint( x, y ) ) ); if ( KLBUTTON_DOWN == dwMessage ) ProcessMouseMessage_SelectControl( pFindControlInfo ); if ( KLBUTTON_DBLCLK == dwMessage ) ProcessMouseMessage_RemoveItem( pFindControlInfo ); return SUIWnd::OnMouseMessage(dwMessage, x, y); } //----------------------------------------------------------------------------------------------------------------- // 아이콘 드래그 이벤트 시작 시 처리 //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::Process_UIBeginDrag( KUIBeginDragMessage* const pRecvMsg ) { if( NULL == m_pDisplayInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] DisplayInfo Pointer is NULL" ); assert( m_pDisplayInfo ); return false; } if( NULL == m_pDragAndDropIcon ) { SDEBUGLOG( "[SUIDecompositionWnd] Drag and Drop Icon Pointer is NULL" ); assert( m_pDisplayInfo ); return false; } string strControlID( pRecvMsg->sDragControlID ); for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); if( NULL == pControlInfo ) continue; if( NULL == pControlInfo->m_strIconControl.compare( strControlID ) ) { KUIControlMultiIcon* pIconControl( pControlInfo->m_pIconControl ); if( NULL == pIconControl ) return false; ITER_ITEM_UNIQUE_ID_LIST Iter( m_mapUniqueID.find( pControlInfo->m_wIndex ) ); if( Iter == m_mapUniqueID.end() ) return false; m_pDisplayInfo->SetUIDragInfo( new SUIDecompositionDragInfo( pControlInfo->m_wIndex ) ); const KUIControlMultiIcon::ICON_INFO& rIconInfo = pIconControl->GetIconInfoByLayer( 0 ); m_pDragAndDropIcon->SetStateIcon( pIconControl->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL ); pRecvMsg->pDragAndDropRenderer = m_pDragAndDropIcon; return true; } } return false; } //----------------------------------------------------------------------------------------------------------------- // 아이콘 드롭 이벤트 메시지 받을 시 처리 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::Process_UIReceiveDrop( const KUISendRecvDropMessage* const pRecvMsg ) { if( NULL == m_pDisplayInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] DisplayInfo Pointer is NULL" ); assert( m_pDisplayInfo ); return; } SUIDragInfo* pUIDragInfo( m_pDisplayInfo->GetUIDragInfo() ); if( NULL == pUIDragInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] DragInfo Pointer is NULL" ); assert( pUIDragInfo ); return; } if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_INVENITEM ) { if( NULL == m_pManager ) return; KUIWnd* pFindWnd( m_pManager->FindWnd( pRecvMsg->sSendDropParentID.c_str() ) ); if( NULL == pFindWnd ) return; SUIInventoryWnd* pInventoryWnd( static_cast( pFindWnd ) ); if( NULL == pInventoryWnd ) return; int nSlotNumber( pInventoryWnd->GetSlotControlNum( pRecvMsg->sSendDropControlID.c_str() ) ); if( -1 == nSlotNumber ) return; SInventorySlot* pSlot( pInventoryWnd->GetInvenItem( nSlotNumber ) ); if( NULL == pSlot ) return; AppendItemUniqueID( pSlot->GetUID() ); } } //----------------------------------------------------------------------------------------------------------------- // 아이콘 드롭 이벤트 메시지 보낼 시 처리 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::Process_UISendDrop( const KUISendRecvDropMessage* const pRecvMsg ) { if( NULL == m_pDisplayInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] DisplayInfo Pointer is NULL" ); assert( m_pDisplayInfo ); return; } SUIDecompositionDragInfo* pUIDragInfo( static_cast( m_pDisplayInfo->GetUIDragInfo() ) ); if( NULL == pUIDragInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] DragInfo Pointer is NULL" ); assert( pUIDragInfo ); return; } if( SUIDragInfo::DRAGTYPE_DECOMPOSITION != pUIDragInfo->m_type ) return; if( NULL == pRecvMsg->sRecvDropParentID.compare( "window_sub_inventory_decompose" ) ) return; DeleteItemUniqueID( pUIDragInfo->m_wIndex ); m_pDisplayInfo->SetUIDragInfo(); UpdateAppendedItemCount(); UpdateControlInfo(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); } //----------------------------------------------------------------------------------------------------------------- // 윈도우 갱신 //----------------------------------------------------------------------------------------------------------------- void* SUIDecompositionWnd::Perform( KID id, KArg& msg ) { _CID( UI_BEGIN_DRAG ); _CID( UI_SEND_DROP ); _CID( UI_RECV_DROP ); if ( id == id_UI_RECV_DROP ) { KUISendRecvDropMessage* pRecvMsg( static_cast( &msg ) ); if( pRecvMsg ) { Process_UIReceiveDrop( pRecvMsg ); return NULL; } } if ( id == id_UI_BEGIN_DRAG ) { KUIBeginDragMessage* pBeginMsg( static_cast( &msg ) ); if( pBeginMsg ) { Process_UIBeginDrag( pBeginMsg ); return NULL; } } if ( id == id_UI_SEND_DROP ) { KUISendRecvDropMessage* pSendMsg( static_cast( &msg ) ); if( pSendMsg ) { Process_UISendDrop( pSendMsg ); return NULL; } } return SUIWnd::Perform( id, msg ); } //----------------------------------------------------------------------------------------------------------------- // 인덱스로 부터 컨트롤 정보 얻기 //----------------------------------------------------------------------------------------------------------------- PCONTROL_INFO SUIDecompositionWnd::FindControlInfo( const WORD wIndex ) { for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); if( NULL == pControlInfo ) continue; if( pControlInfo->m_wIndex == wIndex ) return pControlInfo; } return NULL; } //----------------------------------------------------------------------------------------------------------------- // 마우스 좌표로 부터 컨트롤 정보 얻기 // 설명 : 배경 컨트롤 기준으로 컨트롤을 찾는다. //----------------------------------------------------------------------------------------------------------------- PCONTROL_INFO SUIDecompositionWnd::FindControlInfo( const KPoint ptMouse ) { for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); if( NULL == pControlInfo ) continue; KUIWnd* pBackground( pControlInfo->m_pBackgroundControl ); if( NULL == pBackground ) continue; if( pBackground->GetRect().IsInRect( ptMouse.x, ptMouse.y ) ) return pControlInfo; } return NULL; } //----------------------------------------------------------------------------------------------------------------- // 아이템 정보 갱신 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateItemInfo() { if( NULL == m_pDisplayInfo ) return; for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { WORD wIndex( Iter->first ); const IN_DATA& kData = Iter->second; ItemInstance::ItemUID n64UniqueID( kData._id ); PCONTROL_INFO pControlInfo( FindControlInfo( wIndex ) ); if( NULL == pControlInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Control Info - Index [ %d ]", wIndex ); assert( pControlInfo ); continue; } SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( n64UniqueID ) ); if( NULL == pInventorySlot ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Slot Info By UniqueID - [ %u ]", n64UniqueID ); assert( pInventorySlot ); continue; } KUIWnd* pItemNameControlWnd( pControlInfo->m_pItemNameControl ); if( NULL == pItemNameControlWnd ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Name Control Pointer is NULL - Index [ %d ]", wIndex ); assert( pItemNameControlWnd ); continue; } // 이름 설정 string strItemName( m_strItemNamePropertyTag.c_str() ); strItemName.append( m_pDisplayInfo->GetItemName( pInventorySlot->GetItemCode(), true, pInventorySlot->GetEnhance(), pInventorySlot->GetLevel(), pInventorySlot->GetXFlag(), false, 0, false, pInventorySlot->GetRandomOption() ) ); pItemNameControlWnd->SetCaption( strItemName.c_str() ); KUIControlMultiIcon* pItemIconControl( pControlInfo ->m_pIconControl ); if( NULL == pItemIconControl ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Icon Control Pointer is NULL - Index [ %d ]", wIndex ); assert( pItemIconControl ); continue; } else { ResetMultiIcon( pItemIconControl, 0, 8 ); if( false == setSkillCardIcon( pItemIconControl, pInventorySlot->GetItemCode() ) && false == setSummonCardIcon( pItemIconControl, pInventorySlot ) ) { string strIconName( "" ); getIconNameAtDurability( pInventorySlot, strIconName ); pItemIconControl->SetIcon( 0, c_szDEF_SPR_NAME, strIconName.c_str() ); } pItemIconControl->SetIcon( 1, c_szDEF_SPR_NAME, pInventorySlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL ); EquipItemAddtionalIconSetter icon_setter( pItemIconControl, pInventorySlot ); if( pInventorySlot->GetItemAppearance() ) pItemIconControl->SetIcon( 4, c_szDEF_SPR_NAME, g_strLookChangeIcon ); pItemIconControl->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pInventorySlot, true ) ); if( m_bAltKey ) { m_pDisplayInfo->SetComparableEquipItemSubTooltip( pItemIconControl, pInventorySlot ); } // 개수 count_t nCount( kData._count ); bool bRenderCount = false; // 중복가능하다면 무조건 표기 if( GetItemDB().IsJoin( pInventorySlot->GetItemCode(), IsInstanceUnstackable( pInventorySlot ) ) ) bRenderCount = true; SetChildShow( CStringUtil::StringFormat( "static_itemcount%02d", wIndex ).c_str(), bRenderCount ); if( bRenderCount ) SetChildCaption( CStringUtil::StringFormat( "static_itemcount%02d", wIndex ).c_str(), CStringUtil::StringFormat( "%I64d", nCount.getAmount() ).c_str() ); } } } //----------------------------------------------------------------------------------------------------------------- // 아이템 등록 시 스크롤 바 자동 이동 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::AutoScrollBarMoveWhenAppendItem( const WORD wIndex ) { if( NULL == m_pScrollBar ) { SDEBUGLOG( "[SUIDecompositionWnd] Scroll Bar Pointer is NULL" ); assert( m_pScrollBar ); return; } PCONTROL_INFO pControlInfo( FindControlInfo( wIndex ) ); if( NULL == pControlInfo ) { SDEBUGLOG( "[SUIDecompositionWnd] Control Info Pointer is NULL" ); assert( pControlInfo ); return; } WORD wMinScrollPosition( m_nCurrentScrollPosition ); WORD wMaxScrollPosition( m_nCurrentScrollPosition + MAX_LINE_OF_PAGE - 1 ); if( pControlInfo->m_wLineNumber < wMinScrollPosition || pControlInfo->m_wLineNumber > wMaxScrollPosition ) { int nCalcScrollBarPosition( pControlInfo->m_wLineNumber - ( MAX_LINE_OF_PAGE - 1 ) ); if( nCalcScrollBarPosition < 0 ) nCalcScrollBarPosition = 0; m_pScrollBar->SetPosition( nCalcScrollBarPosition ); UpdateScrollBar(); UpdateSelectControl(); } } //----------------------------------------------------------------------------------------------------------------- // 선택 컨트롤 갱신 // 설명 : 스크를의 값에 따라 선택 컨트롤을 보이고 / 숨긴다. //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateSelectControl() { if( INVALID_CONTROL_INDEX == m_wCurrentSelectControlIndex ) return; WORD wMinScrollPosition( m_nCurrentScrollPosition ); WORD wMaxScrollPosition( m_nCurrentScrollPosition + MAX_LINE_OF_PAGE - 1 ); PCONTROL_INFO pSelectControlInfo( FindControlInfo( m_wCurrentSelectControlIndex ) ); if( NULL == pSelectControlInfo ) return; ITER_ITEM_UNIQUE_ID_LIST Iter( m_mapUniqueID.find( pSelectControlInfo->m_wIndex ) ); if( Iter == m_mapUniqueID.end() ) return; KUIWnd* m_pBackgroundControl( pSelectControlInfo->m_pBackgroundControl ); if( NULL == m_pBackgroundControl ) return; bool bParentShow( m_pBackgroundControl->IsShow() ); if( pSelectControlInfo->m_pSelectControl ) pSelectControlInfo->m_pSelectControl->SetShow( bParentShow ); } //----------------------------------------------------------------------------------------------------------------- // 스크롤 바 갱신 // 설명 : 스크를의 값에 따라 컨트롤 들을 이동 시키며, 보이고 / 숨긴다. //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateScrollBar() { if( NULL == m_pScrollBar ) return ; int nPreScrollPosition( m_nCurrentScrollPosition ); if( m_pScrollBar->GetPosition() < 0 ) m_nCurrentScrollPosition = 0; else m_nCurrentScrollPosition = m_pScrollBar->GetPosition(); int nGapScrollPosition( m_nCurrentScrollPosition - nPreScrollPosition ); WORD wMinScrollPosition( m_nCurrentScrollPosition ); WORD wMaxScrollPosition( m_nCurrentScrollPosition + MAX_LINE_OF_PAGE - 1 ); for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); if( NULL == pControlInfo ) { assert( pControlInfo ); continue; } pControlInfo->MovePosOffset( 0, nGapScrollPosition * m_nBackgroundControlHeight ); pControlInfo->SetShow( false ); if( pControlInfo->m_wLineNumber >= wMinScrollPosition && pControlInfo->m_wLineNumber <= wMaxScrollPosition ) { pControlInfo->SetShow( true ); } } } //----------------------------------------------------------------------------------------------------------------- // 버튼 컨트롤 갱신 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateButton() { if( m_pDoDecompositionControl ) { if( m_mapUniqueID.size() > 0 ) { if( m_bIsNotEnoughMoney ) m_pDoDecompositionControl->Disable(); else m_pDoDecompositionControl->Enable(); } else m_pDoDecompositionControl->Disable(); } } //----------------------------------------------------------------------------------------------------------------- // 돈 (루피) 컨트롤 갱신 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateRupy() { if( m_pRupyControl ) { money_t n64TotalPrice( GetTotalDecompositionPrice() ); money_t n64UserRupy( m_PlayerInfoMgr.GetGold() ); string strTotalPrice( "" ); string strRupyPropertyTag( m_strRupyPropertyTag ); if( n64UserRupy < n64TotalPrice ) { ReplaceTextColorValue( strRupyPropertyTag, m_strRupyNotEnoughColorValue ); m_bIsNotEnoughMoney = true; } else { ReplaceTextColorValue( strRupyPropertyTag, m_strRupyBasicColorValue ); m_bIsNotEnoughMoney = false; } strTotalPrice.append( strRupyPropertyTag ); strTotalPrice.append( CStringUtil::GetCommaNumberString( n64TotalPrice.getAmount() ) ); m_pRupyControl->SetCaption( strTotalPrice.c_str() ); } } //----------------------------------------------------------------------------------------------------------------- // 컨트롤 정보 갱신 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateControlInfo() { for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); if( pControlInfo ) { ITER_ITEM_UNIQUE_ID_LIST Iter( m_mapUniqueID.find( pControlInfo->m_wIndex ) ); if( Iter != m_mapUniqueID.end() ) continue; if( pControlInfo->m_pIconControl ) { ResetMultiIcon( pControlInfo->m_pIconControl, 0, 8 ); pControlInfo->m_pIconControl->SetIcon( NULL, c_szDEF_SPR_NAME, ICONSLOT_CONTROL_NAME.c_str() ); pControlInfo->m_pIconControl->SetTooltip(); } if( pControlInfo->m_pItemNameControl ) pControlInfo->m_pItemNameControl->SetCaption( m_strItemNamePropertyTag.c_str() ); if( pControlInfo->m_pItemDescControl ) pControlInfo->m_pItemDescControl->SetCaption( m_strItemDescPropertyTag.c_str() ); if( pControlInfo->m_pSelectControl ) pControlInfo->m_pSelectControl->SetShow( false ); if( pControlInfo->m_pItemAmountControl ) pControlInfo->m_pItemAmountControl->SetShow( false ); pControlInfo->m_n64NeedPrice = money_t( NULL ); } } } //----------------------------------------------------------------------------------------------------------------- // 등록 된 아이템 개수 갱신 //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::UpdateAppendedItemCount() { /*if( m_pItemCountControl ) { UINT nItemCount( m_mapUniqueID.size() ); string strItemCount( "" ); string strItemCountPropertyTag( m_strItemCountPropertyTag ); if( nItemCount >= MAX_DECOMPOSITION_COUNT ) { ReplaceTextColorValue( strItemCountPropertyTag, m_strItemCountMaxColorValue ); strItemCount.append( strItemCountPropertyTag ); strItemCount.append( StringFormat( "%d", m_mapUniqueID.size() ) ); strItemCount.append( StringFormat( "<#%s> / %d", m_strItemCountBasicColorValue.c_str(), MAX_DECOMPOSITION_COUNT ) ); } else { ReplaceTextColorValue( strItemCountPropertyTag, m_strItemCountBasicColorValue ); strItemCount.append( strItemCountPropertyTag ); strItemCount.append( StringFormat( "%d / %d", m_mapUniqueID.size(), MAX_DECOMPOSITION_COUNT ) ); } m_pItemCountControl->SetCaption( strItemCount.c_str() ); }*/ } //----------------------------------------------------------------------------------------------------------------- // 분해하는데 드는 총 소모비용 얻기 //----------------------------------------------------------------------------------------------------------------- money_t SUIDecompositionWnd::GetTotalDecompositionPrice() { money_t n64TotalPrice( NULL ); for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { WORD wIndex( Iter->first ); const IN_DATA& kData = Iter->second; ItemInstance::ItemUID n64UniqueID( kData._id ); PCONTROL_INFO pControlInfo( FindControlInfo( wIndex ) ); if( pControlInfo ) n64TotalPrice += pControlInfo->m_n64NeedPrice * kData._count; } return n64TotalPrice; } //----------------------------------------------------------------------------------------------------------------- // 컨트롤 정보 초기화 // 설명 : 생성 된 컨트롤의 위치, 아이콘, 아이템 이름, 스크롤 위치를 초기화 한다. //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::ResetControlInfo() { for( UINT nCount = 0; nCount < m_vecControlInfo.size(); nCount++ ) { PCONTROL_INFO pControlInfo( m_vecControlInfo[nCount] ); if( pControlInfo ) { // 소모 비용 초기화 pControlInfo->m_n64NeedPrice = money_t( NULL ); // 컨트롤 위치 초기화 pControlInfo->ReturnToOriginPos(); // 아이템 아이콘 초기화 if( pControlInfo->m_pIconControl ) { ResetMultiIcon( pControlInfo->m_pIconControl, 0, 8 ); pControlInfo->m_pIconControl->SetIcon( NULL, c_szDEF_SPR_NAME, ICONSLOT_CONTROL_NAME.c_str() ); pControlInfo->m_pIconControl->SetTooltip(); } // 아이템 이름 초기화 if( pControlInfo->m_pItemNameControl ) pControlInfo->m_pItemNameControl->SetCaption( m_strItemNamePropertyTag.c_str() ); // 아이템 설명 초기화 if( pControlInfo->m_pItemDescControl ) pControlInfo->m_pItemDescControl->SetCaption( m_strItemDescPropertyTag.c_str() ); if( pControlInfo->m_pSelectControl ) pControlInfo->m_pSelectControl->SetShow( false ); //아이템 갯수 초기화 if( pControlInfo->m_pItemAmountControl ) pControlInfo->m_pItemAmountControl->SetShow( false ); } } m_wCurrentSelectControlIndex = INVALID_CONTROL_INDEX; // 스크롤 바 초기화 if( m_pScrollBar ) { m_pScrollBar->SetPosition( NULL ); m_nCurrentScrollPosition = 0; UpdateScrollBar(); } // 분해 될 아이템 정보 초기화 for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { const IN_DATA& kData = Iter->second; SetAppendedItemToInventorySlot( kData._id, false ); } m_mapUniqueID.clear(); } //----------------------------------------------------------------------------------------------------------------- // DB로 부터 유효한 조합식을 찾았는가 ? ( 이건 서버와 같은 로직을 쓴다 변경 시 서버와 상의 할 것 ) //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::IsFindValidDecomositionFormula( const SInventorySlot* const pSlot, const ItemBaseEx_info* const pItemBase, DECOMPOSE_FORMULA_INFO* const pFormulaInfo ) { vector& vecIdentity( pFormulaInfo->m_vecIdentity ); for( UINT nCount = 0; nCount < vecIdentity.size(); nCount++ ) { int nValue( vecIdentity[nCount].m_nValue ); switch( vecIdentity[nCount].m_nType ) { case eCHECK_ITEM_GROUP: { if( pItemBase->nGroup != nValue ) return false; } break; case eCHECK_ITEM_GROUP_NE: { if( pItemBase->nGroup == nValue ) return false; } break; case eCHECK_ITEM_CLASS: { if( pItemBase->nClass != nValue ) return false; } break; case eCHECK_ITEM_ID: { if( pSlot->GetItemCode() != nValue ) return false; } break; case eCHECK_ITEM_RANK: { if( pItemBase->nRank != nValue ) return false; } break; case eCHECK_ITEM_LEVEL: { if( pSlot->GetLevel() != nValue ) return false; } break; case eCHECK_FLAG_ON: { if( false == pSlot->GetXFlag().IsOn( nValue ) ) return false; } break; case eCHECK_FLAG_OFF: { if( pSlot->GetXFlag().IsOn( nValue ) ) return false; } break; case eCHECK_ENHANCE_MATCH: { if( pSlot->GetEnhance() != nValue ) return false; } break; case eCHECK_ENHANCE_DISMATCH: { if( pSlot->GetEnhance() == nValue ) return false; } break; case eCHECK_ITEM_COUNT: { if( pSlot->GetItemCount() != nValue ) return false; } break; case eCHECK_ITEM_COUNT_GE: { if( pSlot->GetItemCount() < nValue ) return false; } break; case eCHECK_ITEM_ETHEREAL_DURABILITY_E: { if( pSlot->GetEtherealDurability() != nValue ) return false; } break; case eCHECK_ITEM_ETHEREAL_DURABILITY_NE: { if( pSlot->GetEtherealDurability() == nValue ) return false; } break; case eCHECK_ELEMENTAL_EFFECT_MATCH: { int nItemElementalEffectBitflag = static_cast< int >( pow( 2.0, pSlot->GetEET() ) ) >> 1; if( !nItemElementalEffectBitflag ) { if( nValue ) return false; } else if( ( nItemElementalEffectBitflag & nValue ) != nItemElementalEffectBitflag ) return false; else __noop; } break; case eCHECK_ELEMENTAL_EFFECT_MISMATCH: { int nItemElementalEffectBitflag = static_cast< int >( pow( 2.0, pSlot->GetEET() ) ) >> 1; if( !nItemElementalEffectBitflag ) { if( !nValue ) return false; } else if( ( nItemElementalEffectBitflag & nValue ) == nItemElementalEffectBitflag ) return false; else __noop; } break; case eCHECK_ITEM_WEAR_POSITION_MATCH: { if( pItemBase->WearType != nValue ) return false; } break; case eCHECK_ITEM_WEAR_POSITION_MISMATCH: { if( pItemBase->WearType == nValue ) return false; } break; case eCHECK_ITEM_GRADE: { if( pItemBase->nGrade != nValue ) return false; } break; case eCHECK_ITEM_EXPIRED_TIME_GE: { bool bExpire( false ); if( pItemBase->decrease_type == ItemBase::DECREASE_ON_GAME || pItemBase->decrease_type == ItemBase::DECREASE_ALWAYS ) bExpire = true; else bExpire = false; if( nValue == -1 && bExpire ) return false; if( nValue != -1 && bExpire && ( pItemBase->available_time < nValue ) ) return false; }break; case eCHECK_ITEM_EXPIRED_TIME_LE: { bool bExpire( false ); if( pItemBase->decrease_type == ItemBase::DECREASE_ON_GAME || pItemBase->decrease_type == ItemBase::DECREASE_ALWAYS ) bExpire = true; else bExpire = false; if( nValue == -1 && bExpire ) return false; if( nValue != -1 && bExpire && ( pItemBase->available_time > nValue ) ) return false; } break; case eCHECK_ITEM_FIRST_SOCKET_CODE_MATCH: { const int nSocketCount( pItemBase->socket ); int const* pSocket( pSlot->GetSocketInfo() ); if( NULL < nSocketCount ) { if( pSocket[0] != nValue ) return false; } } break; case eCHECK_ITEM_MAX_ETHEREAL_DURABILITY_E: { if( pSlot->getMaxEtherealDurability() != nValue ) return false; } break; case eCHECK_ITEM_MAX_ETHEREAL_DURABILITY_NE: { if( pSlot->getMaxEtherealDurability() == nValue ) return false; } break; case eCHECK_ITEM_TYPE: { if( pItemBase->nType != nValue ) return false; } break; case eCHECK_MIX_CHECK_SAME_SUMMON_RATE: { if( ItemBase::GROUP_SUMMONCARD != pItemBase->nGroup ) return false; if( GetCreatureDB().GetRate( pSlot->GetSummonID() ) != nValue ) return false; } break; case eCHECK_MIX_CHECK_ENHANCE_GE: { if( pSlot->GetEnhance() < nValue ) return false; } break; case eCHECK_MIX_CHECK_ENHANCE_LE: { if( pSlot->GetEnhance() > nValue ) return false; } break; case eCHECK_MIX_CHECK_SAME_ITEM_GROUP: { if(pItemBase->nGroup != nValue ) return false; } break; } } return true; } //----------------------------------------------------------------------------------------------------------------- // 분해가 가능한 아이템 인가? ( 분해 DB로 부터 검사한다 ) //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::IsPossibleDecompositionFromDB( const SInventorySlot* const pSlot, const ItemBaseEx_info* const pItemBase ) { if( NULL == pSlot ) return false; if( NULL == pItemBase ) return false; SDecomposeDB::DECOMPOSE_FORMULA_LIST* const pDecomposeFormulaList( GetDecomposeDB().GetDecomposeFormula() ); if( NULL == pDecomposeFormulaList ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Decompose Formula Data From DB" ); assert( pDecomposeFormulaList ); return false; } m_n64NeedPriceTemporaryStorage = money_t( NULL ); for( SDecomposeDB::DECOMPOSE_FORMULA_ITER Iter = pDecomposeFormulaList->begin(); Iter != pDecomposeFormulaList->end(); ++Iter ) { PDECOMPOSE_FORMULA_INFO pDecompositionFormula( Iter->second ); if( NULL == pDecompositionFormula ) { SDEBUGLOG( "[SUIDecompositionWnd] Decompose Formula Pointer is Invalid" ); assert( pDecomposeFormulaList ); continue; } if( IsFindValidDecomositionFormula( pSlot, pItemBase, pDecompositionFormula ) ) { m_n64NeedPriceTemporaryStorage = money_t( pDecompositionFormula->m_nNeedPrice ); return true; } } return false; } //----------------------------------------------------------------------------------------------------------------- // 등록 가능 한 아이템 인가 ? // 반환 값 : 예(true) / 아니요(false) //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::IsPossibleItemAppend( const ItemInstance::ItemUID n64UniqueID ) { SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( n64UniqueID ) ); if( NULL == pInventorySlot ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Slot Info By UniqueID - [ %u ]", n64UniqueID ); assert( pInventorySlot ); return false; } if( pInventorySlot ) { const ItemBaseEx_info* pItemBase( GetItemDB().GetItemData( pInventorySlot->GetItemCode() ) ); if( NULL == pItemBase ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get ItemInfo - ItemCode [ %n ]", pInventorySlot->GetItemCode() ); assert( pItemBase ); return false; } else { // 분해 불가 Flag 체크 if( pItemBase->CheckFlag( ItemBase::FLAG_CANT_DECOMPOSE ) ) return false; // 장비 중인 아이템인가? if( pInventorySlot->IsEquipItem() ) return false; // 소환수가 장비 중인 아이템 인가? if( pInventorySlot->IsSummonEquip() ) return false; // 강화 실패 아이템 인가? if( pInventorySlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_FAILED ) ) return false; // 내구도가 0인 아이템 인가 ? if( pInventorySlot->getMaxEtherealDurability() > 0 ) { float fEthereal( pInventorySlot->GetEtherealDurability() ); if( fEthereal <= 0.0f ) return false; } int nGroup( pItemBase->nGroup ); // 장비 중인 스킬 카드 인가 ? if( ItemBase::GROUP_SKILLCARD == nGroup ) { if( m_InventoryMgr.IsEquipCard( pInventorySlot->GetHandle() ) ) return false; } // 소환되어 있는 펫 인가 ? if( ItemBase::GROUP_PETCAGE == nGroup ) { if( pInventorySlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CAGE_HAS_PET ) ) { SGame* pGame( m_pGameManager->GetActiveGame() ); if( NULL == pGame ) return false; DATA_PET* pPetData( pGame->IsLocalPetCage( pInventorySlot->GetHandle() ) ); if( NULL == pPetData ) return false; if( pGame->IsSummonPet( pPetData->pet_handle ) ) return false; } } // 크리쳐 카드인데 편성 되었거나 벨트에 장착되어 있나? if( ItemBase::GROUP_SUMMONCARD == nGroup ) { if( m_InventoryMgr.IsBeltSlotCard( pInventorySlot->GetHandle() ) ) return false; if( m_CreatureSlotMgr.IsExistCreatureCard( pInventorySlot->GetHandle() ) ) return false; } if( false == IsPossibleDecompositionFromDB( pInventorySlot, pItemBase ) ) return false; } } return true; } //----------------------------------------------------------------------------------------------------------------- // 열려 있으면 안되는 다른 UI가 열려 있는가 ? // 설명 : 특정 UI가 열려 있을 경우 분해 UI가 열리면 안되기 때문에 여기서 체크한다. // 반환 값 : 예(true) / 아니요(false) //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::IsOpenAnotherUIWindow() { if( NULL == m_pGameManager ) return true; if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TRADE ) ) return true; if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_AUCTION ) ) return true; if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORE_HOST ) ) return true; return false; } //----------------------------------------------------------------------------------------------------------------- // 경고 메시지 박스를 열어야 필요가 있는가 ? // 반환 값 : 예(true) / 아니요(false) //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::IsNeedOpenCautionMessageBox( const ItemInstance::ItemUID n64UniqueID ) { SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( n64UniqueID ) ); if( NULL == pInventorySlot ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Slot Info By UniqueID - [ %u ]", n64UniqueID ); assert( pInventorySlot ); return false; } if( pInventorySlot ) { const ItemBaseEx_info* pItemBase( GetItemDB().GetItemData( pInventorySlot->GetItemCode() ) ); if( NULL == pItemBase ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get ItemInfo - ItemCode [ %n ]", pInventorySlot->GetItemCode() ); assert( pItemBase ); return false; } else { if( NULL == m_pDisplayInfo ) return false; // 강화 if( m_pDisplayInfo->IsEnhanceableItem( pInventorySlot->GetItemCode(), pItemBase ) ) { int nEnhance( pInventorySlot->GetEnhance() ); // 스킬카드 강화 if( pItemBase->nGroup == ItemBase::GROUP_SKILLCARD ) { if( 1 < nEnhance ) return true; } else { // 큐브 강화 if( NULL < pInventorySlot->GetEnhance() ) return true; // 대장장이 강화 if( 1 < pInventorySlot->GetLevel() ) return true; } } // 소울스톤 int nSocketCount( pInventorySlot->GetJewelSlotCount() ); int const* pSocket( pInventorySlot->GetSocketInfo() ); for( int nCount = 0; nCount < nSocketCount; nCount++ ) { if( NULL == pSocket ) break; int nJewelID( pSocket[nCount] ); if( nJewelID ) { for( int nOptionCount = 0; nOptionCount < ItemBase::MAX_OPTION_NUMBER; nOptionCount++ ) { int nType( NULL ); double dVar1( 0.0 ), dVar2( 0.0 ); if( GetItemDB().GetOptionVar( nJewelID, nOptionCount, nType, dVar1, dVar2 ) ) return true; } } } // 부여석 ( 0은 무속성 ) if( NULL != pInventorySlot->GetEET() ) return true; // 봉인 된 크리쳐 카드 if( pInventorySlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_SUMMON ) ) return true; } } return false; } //----------------------------------------------------------------------------------------------------------------- // 동일한 유일한 아이템 아이디가 존재하는가 ? //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::IsExistItemUniqueID( const ItemInstance::ItemUID n64UniqueID ) { for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { const IN_DATA& kData = Iter->second; ItemInstance::ItemUID nSaved64UniqueID( kData._id ); if( nSaved64UniqueID == n64UniqueID ) return true; } return false; } //----------------------------------------------------------------------------------------------------------------- // 분해 할 아이템의 유니크 한 아아디를 등록한다. //----------------------------------------------------------------------------------------------------------------- bool SUIDecompositionWnd::SetAppendedItemToInventorySlot( const ItemInstance::ItemUID n64UniqueID, bool bAppend ) { if( NULL == m_pGameManager ) return false; if( NULL == n64UniqueID ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Unique ID is NULL" ); assert( n64UniqueID ); return false; } SUIInventoryWnd* pInventoryWnd( dynamicCast( m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY) ) ); if( NULL == pInventoryWnd ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Inventory Window" ); assert( n64UniqueID ); return false; } SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( n64UniqueID ) ); if( NULL == pInventorySlot ) { SDEBUGLOG( "[SUIDecompositionWnd] Can't Get Slot Info By UniqueID - [ %u ]", n64UniqueID ); assert( pInventorySlot ); return false; } pInventorySlot->SetAppendDecomposeWnd( bAppend ); pInventoryWnd->RefreshInvenSlots(); return true; } //----------------------------------------------------------------------------------------------------------------- // 분해 할 아이템의 유니크 한 아아디를 등록한다. //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::AppendItemUniqueID( const ItemInstance::ItemUID n64UniqueID ) { if( NULL == n64UniqueID ) { SDEBUGLOG( "[SUIDecompositionWnd] Item Unique ID is NULL" ); assert( n64UniqueID ); return ; } else { if( m_mapUniqueID.size() >= MAX_DECOMPOSITION_COUNT ) return; if( IsExistItemUniqueID( n64UniqueID ) ) return; if( IsPossibleItemAppend( n64UniqueID ) ) { SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( n64UniqueID ) ); if( NULL == pInventorySlot ) return; if( pInventorySlot->GetItemCount() > 1 && m_bShiftKey ) // AziaMafia ADD KEY { m_n64WaitForAppendItemUniqueID = n64UniqueID; count_t tMaxCount = ( pInventorySlot->GetItemCount() > MAX_EACH_COUNT ? count_t(MAX_EACH_COUNT) : pInventorySlot->GetItemCount() ); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, tMaxCount, SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) ); } else { if( IsNeedOpenCautionMessageBox( n64UniqueID ) ) { if( NULL == m_pGameManager ) { SDEBUGLOG( "[SUIDecompositionWnd] GameManager Pointer is NULL" ); assert( m_pGameManager ); return; } SGameInterface* pGameInterface( m_pGameManager->GetGameInterface() ); if( NULL == pGameInterface ) { SDEBUGLOG( "[SUIDecompositionWnd] GameInterface Pointer is NULL" ); assert( pGameInterface ); return; } pGameInterface->OpenMessageBox( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_YESNO, SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DECOMPOSITON_CONFIRM_APPEND, false, -1, S( 1265 ) ); m_n64WaitForAppendItemUniqueID = n64UniqueID; m_ntCountForWaiting = count_t(1); //gmpbigsun( 20130820, #27057 ) : 강화된 아이템 분해실패 } else { WORD wIndex( m_mapUniqueID.size() ); IN_DATA kData; kData._id = n64UniqueID; kData._count = count_t(1); if (m_bControlKey) { if ( pInventorySlot->GetItemCount() > 10 ) kData._count = count_t(10); if (pInventorySlot->GetItemCount() < 10 && pInventorySlot->GetItemCount() > 1 ) kData._count = count_t(pInventorySlot->GetItemCount()); } if (m_bAltKey) { kData._count = count_t(pInventorySlot->GetItemCount()); } m_mapUniqueID.insert( make_pair( wIndex, kData ) ); AutoScrollBarMoveWhenAppendItem( wIndex ); SetAppendedItemToInventorySlot( n64UniqueID, true ); PCONTROL_INFO pFindControlInfo( FindControlInfo( wIndex ) ); if( pFindControlInfo ) pFindControlInfo->m_n64NeedPrice = m_n64NeedPriceTemporaryStorage; } } } else { if( m_pDisplayInfo ) m_pDisplayInfo->AddSystemMessage( S( 1263 ), 99 ); } } UpdateAppendedItemCount(); UpdateControlInfo(); UpdateItemInfo(); UpdateRupy(); UpdateButton(); } //----------------------------------------------------------------------------------------------------------------- // 아이템의 고유한 아이디를 삭제한다. //----------------------------------------------------------------------------------------------------------------- void SUIDecompositionWnd::DeleteItemUniqueID( const WORD wIndex ) { ITER_ITEM_UNIQUE_ID_LIST FindIter = m_mapUniqueID.find( wIndex ); if( FindIter == m_mapUniqueID.end() ) return ; IN_DATA kData = FindIter->second; SetAppendedItemToInventorySlot( kData._id, false ); m_mapUniqueID.erase( wIndex ); vector vecTemp; for( ITER_ITEM_UNIQUE_ID_LIST Iter = m_mapUniqueID.begin(); Iter != m_mapUniqueID.end(); Iter++ ) { kData = Iter->second; vecTemp.push_back( kData._id ); } m_mapUniqueID.clear(); for( WORD wIndex = 0; wIndex < vecTemp.size(); wIndex++ ) { IN_DATA kNewData; kNewData._id = vecTemp[wIndex]; m_mapUniqueID.insert( make_pair( wIndex, kNewData ) ); } }