Files
Leviathan/Client/Game/game/Interface/SUIRepairWnd.cpp
T
2026-06-01 12:46:52 +02:00

1771 lines
58 KiB
C++

#include "stdafx.h"
#include <toolkit/XStringUtil.h>
#include "SStringDB.h"
#include "SItemDB.h"
#include "SCombineDB.h"
#include "SMixCategoryDB.h"
#include "SCreatureEnhanceDB.h"
//#include "SUIUtil.h"
#include "SUIDisplayInfo.h"
#include "SUISysMsgDefine.h"
#include "SUILazyTooltip.h"
#include "SGameManager.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SInventoryMgr.h"
#include "SPlayerInfoMgr.h"
#include "KUIDragAndDrop.h"
#include "KUIControlStatic.h"
#include "SUIRepairWnd.h"
/// 2011.02.15 - prodongi
#include "KUIControlButton.h"
#include "SGameOption.h"
#include "SGameInterface.h"
#include "SGameSystem.h"
extern SGameSystem * g_pCurrentGameSystem;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// SUIRepairWnd
const int nLayer = 8;
using namespace rp;
namespace
{
//----------------------------------------------------------------------------------
// 조합창.
// 조합창 슬롯 개수.
const int c_nCombineSlotCount = 9;
const char * g_pStrMainSlotId = "slot_red_00"; // 메인슬롯 컨트롤 ID.
const int c_nCombineSlotNameLength = int( ::strlen( "slot_blue_" ) );
const int c_nCombineSlotCountLength = 2;
const int c_nCombineItemCountLimit = 65535; // 매매갯수는 65535로 제한한다. ( 패킷에 갯수를 unsigned short을 사용하고 있음. )
int g_nBtnStrID[] = { 0, 9727, 9726,9728 }; // 버튼 텍스트 ID.
int g_nStateStrID[] = { 0, 9737, 9733,9741 }; // 상태 텍스트 ID.
int g_nStrIDCompleteSuccessState[] = { 0, 9738, 9734,9742 }; // 상태 완료 '성공' 텍스트 ID.
int g_nStrIDCompleteFailState[] = { 0, 9739, 9735,9743 }; // 상태 완료 '실패' 텍스트 ID.
// 내구도 게이지 색상별 SpriteSet.
char * g_LineAni[] = { " ", "common_panel_inframe_titanium_repair_cyan_02", "common_panel_inframe_titanium_repair_cyan_04", "common_panel_inframe_titanium_repair_cyan_03" };
// 에테리얼스톤 충전별 SpriteSet. 0, 50, 100
char * g_EtherealAni[] = { "common_panel_titanium_slot_chargestone_03", "common_panel_titanium_slot_chargestone_01", "common_panel_titanium_slot_chargestone_02" };
typedef void (SUIRepairWnd::*functionGauge)();
functionGauge g_fpGauge[] = { &SUIRepairWnd::GaugeDurability_Empty, &SUIRepairWnd::GaugeDurability_Restoration, &SUIRepairWnd::GaugeDurability_Repair, &SUIRepairWnd::GaugeDurability_Recharge };
// 복원, 수리, 충전.
int g_arrFormalState[] = { 0, 9730, 9729, 9731 };
const int g_nFormulaListCount = 6; // 공식리스트 최대 아이템 개수.
std::string g_arrStrFormula[ 4 ]; // 공식 텍스트 배열.
std::string g_StrFormula; // 공식 텍스트.
KUISendRecvDropMessage g_sRecvMsgRepairWnd; // 2011.04.26 - servantes / mantis : 12753
AR_HANDLE g_hDragItemRepairWnd;
}
//
// 메인슬롯에 아이템이 등록되어있는경우, [복원], [수리], [충전] 구분.
//
enum E_MAINSLOT_ATTRIBUTE
{
E_MAINSLOT_ATTRIBUTE_NONE = 0, // 없다.
E_MAINSLOT_ATTRIBUTE_RESTORATION = 1, // [복원]
E_MAINSLOT_ATTRIBUTE_REPAIR = 2, // [수리]
E_MAINSLOT_ATTRIBUTE_RECHARGE = 3, // [충전]
};
bool SUIRepairWnd::InitControls( KPoint kPos )
{
m_RechargeQuantity = 0; // 아이템내구도 충전량. ( 입력기의 입력값 )
g_arrStrFormula[ 0 ] = " "; // 공식 텍스트 배열.
g_arrStrFormula[ 1 ] = S( 9758 ); // 복원.
g_arrStrFormula[ 2 ] = S( 9757 ); // 수리.
g_arrStrFormula[ 3 ] = S( 9759 ); // 충전.
m_pCtlrFormalState = GetChild( "text_repair_formula" ); // 공식 상태.
CStringUtil::GetTextDecoration( m_pCtlrFormalState->GetCaption(), m_strDecoFormalState );
m_pCtrlFormula = dynamicCast< KUIControl * >( GetChild( "text_repair_formula_content" ) ); // 공식출력 컨트롤.
CStringUtil::GetTextDecoration( m_pCtrlFormula->GetCaption(), m_strDecoFormal ); // 공식 꾸미기 태그.
CStringUtil::GetTextFontName( m_strDecoFormal, m_strFontNameFormal ); // 공식 폰트명.
m_pScrollFormal = dynamicCast< KUIControlVScrollSmallEx * >( GetChild( "scrollbar_repair" ) ); // 스크롤바.
m_nScrollPos = 0; // 현재 스크롤 값.
m_pCtrlGaugeDurability = GetChild( "text_09" ); // 내구도 백분률 출력 컨트롤.
CStringUtil::GetTextDecoration( m_pCtrlGaugeDurability->GetCaption(), m_strDurabilityDeco ); // 내구도 꾸미기 태그.
m_pGaugeDurability = GetChild( "gauge_repair_line_yellowgreen" ); // 내구도 게이지.
m_fGaugeWidth = (float)m_pGaugeDurability->GetRect().GetWidth(); // 내구도 게이지 너비.
m_fDurabilityPercent = 0.0f; // 내구도 백분률.
m_pBtnRepair = GetChild( "button_repair" ); // 수리버튼.
CStringUtil::GetTextDecoration( m_pBtnRepair->GetCaption(), m_strDecoBtn );
KUIControl* btnRepair = dynamicCast<KUIControl*>(m_pBtnRepair); /// 2011.06.02 enable color 설정 - prodongi
if (btnRepair) btnRepair->SetEnableColor("<#ffffff>");
m_pCtrlLine = GetChild( "line_none" ); // 라인컨트롤.
m_pCtrlStringState = GetChild( "text_08" ); // 상태 텍스트 컨트롤.
CStringUtil::GetTextDecoration( m_pCtrlStringState->GetCaption(), m_strDecoState ); // 상태 꾸미기 태그.
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_REPAIR);
// m_WndType = E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_REPAIR; // 수리,복원,충전 ( 기본값 : 수리 )
m_pCtrlEtherealStoneDurability = GetChild( "text_chargestone_state" ); // 에테리얼스톤 내구도충전량.
CStringUtil::GetTextDecoration( m_pCtrlEtherealStoneDurability->GetCaption(), m_strDecoEtherealStoneDurability );
m_pCtrlEtherealStone = GetChild( "slot_chargestone_01" ); // 에테리얼스톤 충전량에 따른 이미지 출력용 컨트롤.
// 내구도에 따른 마크 컨트롤.
m_pCtrlMarkDurability = GetChild( "mark_zero_ex01" );
if( m_pCtrlMarkDurability )
m_pCtrlMarkDurability->SetShow( false );
//// 슬롯 multi icon 레이어 설정, 툴팁 스프라이트 설정
KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( g_pStrMainSlotId ));
if( NULL != pSrcSlotControl )
pSrcSlotControl->SetIconLayer( nLayer );
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( nLayer );
}
SetCustomMovingRect( GetChild( "titlebar" )->GetRect() ); // 이동
//----------------
// 툴팁 추가.
KUIWnd * pControl = NULL;
pControl = GetChild( "button_help" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 6872 ) ) );
return SUIWnd::InitControls( kPos );
}
bool SUIRepairWnd::InitData( bool bReload )
{
RefreshSlots();
return SUIWnd::InitData(bReload);
}
void SUIRepairWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
m_RechargeQuantity = 0; // 아이템내구도 충전량. ( 입력기의 입력값 )
if( bOpen )
{
// 공식목록 출력.
SetTextList( g_nFormulaListCount, g_arrStrFormula[ E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_REPAIR ], m_strDecoFormal,
const_cast< char * >( m_strFontNameFormal.c_str() ), m_pCtrlFormula, m_pScrollFormal, m_nScrollPos, m_vLineList, true );
RemoveAllCombineItems();
/// 2011.01.25 - prodongi
RefreshWndType();
RefreshEtherealSton();
setUseRechargeMsgBox(!GetGameOption().GetUseRechargeMsgBox(), false);
}
else
{
GaugeDurability_Restoration();
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_REPAIR);
//m_WndType = E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_REPAIR; // 윈도우타입.
// 공식 초기화.
Clear();
}
}
void* SUIRepairWnd::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 );
RefreshEtherealSton(); // 에테리얼스톤 설정. 슬롯을 비운경우 에테리얼스톤이미지 처리를 하기위해 추가. 2010.10.29.
KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( g_pStrMainSlotId )); // 2012. 2. 14 - marine 툴팁이 남아 있는 문제 수정 redmine 22913
if( pSrcSlotControl )
pSrcSlotControl->SetLazyTooltip( );
}
// 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;
std::string strDropControlID = pRecvMsg->sRecvDropControlID; // 아이템이 드롭된 컨트롤 ID.
// ReceiveItem
if( pItemDragInfo->m_hItem ) // 2011.04.26 - servantes / mantis : 12753
{
g_hDragItemRepairWnd = pItemDragInfo->m_hItem;
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( g_hDragItemRepairWnd );
if( pSlot == NULL )
return NULL;
if(pSlot->GetItemCount() > 1)
{
g_sRecvMsgRepairWnd.sRecvDropParentID = pRecvMsg->sRecvDropParentID;
g_sRecvMsgRepairWnd.sRecvDropControlID = pRecvMsg->sRecvDropControlID;
g_sRecvMsgRepairWnd.sSendDropParentID = pRecvMsg->sSendDropParentID;
g_sRecvMsgRepairWnd.sSendDropControlID = pRecvMsg->sSendDropControlID;
g_sRecvMsgRepairWnd.ptDropPos.x = pRecvMsg->ptDropPos.x;
g_sRecvMsgRepairWnd.ptDropPos.y = pRecvMsg->ptDropPos.y;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, pSlot->GetItemCount(), SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
}
else
{
ReceiveItem( pItemDragInfo->m_hItem, strDropControlID );
}
}
}
return NULL;
}
return SUIWnd::Perform( id, msg );
}
void SUIRepairWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
// Scroll
case KUI_MESSAGE::KSCROLL_SELECT :
m_nScrollPos = max( (int)lparam, 0 );
// 공식목록 출력.
SetTextList( g_nFormulaListCount, g_arrStrFormula[ m_WndType ], m_strDecoFormal, const_cast< char * >( m_strFontNameFormal.c_str() ),
m_pCtrlFormula, m_pScrollFormal, m_nScrollPos, m_vLineList );
break;
case KUI_MESSAGE::KBUTTON_CLICK:
{
// 닫기.
if( !::_stricmp( lpszControlID, "button_close" ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, false ) );
}
// [수리] [복원] [충전].
else if( !::_stricmp( lpszControlID, "button_repair" ) )
{
if( m_SourceItem.handle || !m_CombineItemsVector.empty() )
{
/// 2011.08.11 - prodongi
if (isCheckedUseRechargeMsgBox())
{
int strId = 0;
if (E_MAINSLOT_ATTRIBUTE_REPAIR == m_WndType) strId = 9814;
else if (E_MAINSLOT_ATTRIBUTE_RESTORATION == m_WndType) strId = 9815;
else if (E_MAINSLOT_ATTRIBUTE_RECHARGE == m_WndType) strId = 9767;
m_pGameManager->PostMsgAtDynamic(new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RECHARGE_MSGBOX, true, true));
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_COMMON(IMSG_RECHARGE_MSGBOX_CONTENT, strId));
}
else
{
if( m_WndType == E_MAINSLOT_ATTRIBUTE_REPAIR )
{
performRepair();
}
else
{
performRestortionRecharge();
}
}
}
}
// 도움말윈도우.
else if( !::_stricmp( lpszControlID, "button_help" ) )
{
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( 9763 ) ) ) ); // 텍스트전달.
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;
/// 2011.02.16 - prodongi
case KUI_MESSAGE::KCHECK_CHANGE:
{
if (stricmp(lpszControlID, "button_checkbutton_01") == 0)
{
GetGameOption().SetUseRechargeMsgBox(isCheckedUseRechargeMsgBox());
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIRepairWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
//2011.04.26 - servantes / mantis : 12753
case IMSG_UI_INPUTNUMBER:
{
SIMSG_UI_INPUTNUMBER* pInputNumberMsg = (SIMSG_UI_INPUTNUMBER*)pMsg;
if( pInputNumberMsg->m_nValue > 0 )
{
if( g_hDragItemRepairWnd )
{
count_t nValue;
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( g_hDragItemRepairWnd );
if( pSlot )
nValue = (pInputNumberMsg->m_nValue < pSlot->GetItemCount()) ? pInputNumberMsg->m_nValue : pSlot->GetItemCount();
ReceiveItem( g_hDragItemRepairWnd, g_sRecvMsgRepairWnd.sRecvDropParentID, true, nValue.getAmount());
g_hDragItemRepairWnd = 0;
g_sRecvMsgRepairWnd.sRecvDropParentID = "";
g_sRecvMsgRepairWnd.sRecvDropControlID = "";
g_sRecvMsgRepairWnd.sSendDropParentID = "";
g_sRecvMsgRepairWnd.sSendDropControlID = "";
g_sRecvMsgRepairWnd.ptDropPos.x = 0;
g_sRecvMsgRepairWnd.ptDropPos.y = 0;
}
}
}
break;
case IMSG_REPAIR_MOVEITEM:
{
SIMSG_REPAIR_MOVEITEM* pData = dynamicCast<SIMSG_REPAIR_MOVEITEM*>(pMsg);
g_hDragItemRepairWnd = pData->m_handle;
g_sRecvMsgRepairWnd.sRecvDropParentID = pData->m_strRecvDropParentID;
if(pData->m_nValue == 1) //servantes 2010.10.19
{
ReceiveItem( g_hDragItemRepairWnd, g_sRecvMsgRepairWnd.sRecvDropParentID, true, pData->m_nValue.getAmount());
}
else if(pData->m_nValue > 10)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, pData->m_nValue, SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
}
else
{
if(pData->m_bMove10 && pData->m_nValue == 10)
{
ReceiveItem( g_hDragItemRepairWnd, g_sRecvMsgRepairWnd.sRecvDropParentID, true, pData->m_nValue.getAmount());
break;
}
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, pData->m_nValue, SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
}
}
break;
case MSG_UPDATE_ITEM_COUNT:
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();
}
break;
case MSG_PROPERTY:
{
SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg;
if( m_PlayerInfoMgr.IsLocalPlayer(pPropertyMsg->handle) )
{
switch( pPropertyMsg->nPropertyType )
{
case SMSG_PROPERTY::PROPERTY_ETHEREAL_STONE_DURABILITY: // 에테리얼스톤 내구충전량 변화.
RefreshEtherealSton();
break;
}
}
}
break;
case MSG_RESULT:
{
// 개별수리 완료 반환.
SMSG_RESULT* pResultMsg = (SMSG_RESULT*)pMsg;
if( TM_CS_TRANSMIT_ETHEREAL_DURABILITY == pResultMsg->request_msg_id &&
this->IsShow() && m_SourceItem.handle != 0 )
{
if( m_pCtrlStringState )
{
std::string strDeco( m_strDecoState );
const char * pStr = S( g_nStrIDCompleteSuccessState[ m_WndType ] );
strDeco.append( pStr );
m_pCtrlStringState->SetCaption( strDeco.c_str() );
m_pDisplayInfo->AddSystemMessage( pStr ); // 채팅창에 출력.
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if( pSlot )
{
// 툴팁 갱신.
KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( g_pStrMainSlotId ));
if( pSrcSlotControl )
{
pSrcSlotControl->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
}
// 윈도우타입에 따른 처리.
RefreshWndType();
}
}
// 슬롯정리.
RefreshSlots();
pMsg->bUse = true;
}
}
break;
case MSG_MIX_RESULT:
{
if( this->IsShow() )
{
RemoveAllCombineItems( false );
SMSG_MIX_RESULT* pMixResultMsg = (SMSG_MIX_RESULT*)pMsg;
//2011.04.22 - servantes / mantis : 12774
// 조합 성공.
if( pMixResultMsg->count > 0 )
m_pDisplayInfo->AddSystemMessage( S( g_nStrIDCompleteSuccessState[m_WndType] ) );
// 조합 실패.
else
m_pDisplayInfo->AddSystemMessage( S( g_nStrIDCompleteFailState[m_WndType] ) );
RefreshSlots();
pMsg->bUse = true;
}
}
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_SYNTHETIC_ITEM:
{
pMsg->bUse = true;
// ★ 수리.
if( m_WndType == E_MAINSLOT_ATTRIBUTE_REPAIR && m_SourceItem.handle ) // && m_RechargeQuantity > 0 )
{
/// 2012.03.27 수리에 맞는 아이템인지 체크한다 - prodongi
if (!isRepairItems())
{
m_pDisplayInfo->AddSystemMessage(S(274), 99);
return ;
}
// 강화 크리쳐카드 내구도. 강화크리쳐카드 처리 추가. bintitle. 2010.11.02.
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if ( pSlot && GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD && pSlot->GetEnhance() > 0 )
{
SIMSG_UI_ACT_ITEMCOMBINE combineMsg;
// 원본 아이템 추가
combineMsg.main_Items = SIMSG_UI_ACT_ITEMCOMBINE::CombineItemInfo( m_SourceItem.handle, m_SourceItem.usiCount.getAmount() );
bool bSucceed = true;
// 강화 아이템 추가
bool bAllEquipment = true;
int nWearType;
AR_HANDLE handle;
SInventorySlot * pSlot;
for( COMBINEITEM_VECTOR::const_iterator itItem = m_CombineItemsVector.begin(); itItem != m_CombineItemsVector.end(); itItem++ )
{
handle = (*itItem).handle;
// 모든슬롯의 아이템이 장비인 경우 에는 조합요청 하지않는다. ( 에테리얼스톤 충전을 막기위함 ).
pSlot = m_InventoryMgr.GetItemInfo( handle );
if( pSlot )
{
nWearType = GetItemDB().GetWearType( pSlot->GetItemCode() );
if( nWearType == ItemBase::WEAR_CANTWEAR || nWearType == ItemBase::WEAR_STORAGE ||
( nWearType < ItemBase::WEAR_WEAPON || nWearType > ItemBase::WEAR_FACE ) && !ItemBase::WEAR_TWOHAND )
bAllEquipment = false;
}
if( m_InventoryMgr.IsExistItem( handle ) )
combineMsg.vtItems.push_back( SIMSG_UI_ACT_ITEMCOMBINE::CombineItemInfo( handle, (*itItem).usiCount.getAmount() ) );
else
{
bSucceed = false;
break;
}
}
// 모든슬롯의 아이템이 장비인 경우 에는 조합요청 하지않는다. ( 에테리얼스톤 충전을 막기위함 ).
if( bAllEquipment )
bSucceed = false;
// 슬롯제거.
RemoveAllCombineItems();
// 조합!.
if( bSucceed )
{
m_pGameManager->ProcMsgAtStatic( &combineMsg );
}
}
else // 장비.
{
TS_CS_TRANSMIT_ETHEREAL_DURABILITY msg;
msg.handle = m_SourceItem.handle;
//msg.amount = m_RechargeQuantity;
m_pGameManager->PendMessage( &msg );
}
}
// ★ 충전 or 복원.
else if( m_WndType == E_MAINSLOT_ATTRIBUTE_RECHARGE || m_WndType == E_MAINSLOT_ATTRIBUTE_RESTORATION )
{
SIMSG_UI_ACT_ITEMCOMBINE combineMsg;
// 원본 아이템 추가
bool bSucceed = true;
// [복원] 일때만 Main 아이템이 존재.
if( m_SourceItem.handle )
{
combineMsg.main_Items = SIMSG_UI_ACT_ITEMCOMBINE::CombineItemInfo( m_SourceItem.handle, m_SourceItem.usiCount.getAmount() );
}
// Sub 아이템 추가
for( COMBINEITEM_VECTOR::const_iterator itItem = m_CombineItemsVector.begin(); itItem != m_CombineItemsVector.end(); itItem++ )
{
if( m_InventoryMgr.IsExistItem( (*itItem).handle ) )
combineMsg.vtItems.push_back( SIMSG_UI_ACT_ITEMCOMBINE::CombineItemInfo( (*itItem).handle, (*itItem).usiCount.getAmount() ) );
else
{
bSucceed = false;
break;
}
}
// 슬롯제거.
RemoveAllCombineItems();
// 수행!.
if( bSucceed )
{
m_pGameManager->ProcMsgAtStatic( &combineMsg );
}
// 아이템이 없다.
else
{
m_pDisplayInfo->AddSystemMessage( GetStringDB().GetString(SYS_MSG_BUILDUP_ITEM_NOT_EXIST), 99 ); // Items needed for combination do not exist. Are you trying to combine a creature that is in your formation?
}
}
}
break;
/// 2011.01.24 - prodongi
case IMSG_RECHARGE_MSGBOX:
{
SIMSG_RECHARGE_MSGBOX* msg = dynamicCast<SIMSG_RECHARGE_MSGBOX*>(pMsg);
setUseRechargeMsgBox(msg->dontask, true);
if (IsShow())
{
// 아이템합성 시작 전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) );
// 아이템합성 진행률 출력 윈도우 열기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
}
}
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();
}
}
}
break;
}
}
AR_HANDLE SUIRepairWnd::GetItemHandle( const char* szControlID ) const
{
// 원본 아이템
if( 0 == ::_stricmp( szControlID, g_pStrMainSlotId ) )
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;
}
SUIRepairWnd::COMBINEITEM_VECTOR::iterator SUIRepairWnd::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 SUIRepairWnd::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 SUIRepairWnd::AddMainCombineItem( AR_HANDLE hItem, count_t usiCount, bool bEquip )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( !pSlot ) return;
// 장착중인 아이템은 제외.
if( bEquip && IsEquipItem( pSlot, usiCount ) )
return;
m_SourceItem = COMBINEITEM( hItem );
RefreshSlots();
}
void SUIRepairWnd::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;
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();
}
RefreshSlots();
}
void SUIRepairWnd::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( GetStringDB().GetString(292), 99 ); // Enable after releasing equipment
}
}
bool SUIRepairWnd::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 SUIRepairWnd::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 SUIRepairWnd::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 SUIRepairWnd::RemoveCombineItem( AR_HANDLE hItem )
{
// 원본 아이템
if( m_SourceItem.handle == hItem )
{
m_SourceItem = COMBINEITEM();
RefreshSlots();
}
// 강화 아이템
else
{
COMBINEITEM_VECTOR::iterator itItem = GetItemIterator( hItem );
if( m_CombineItemsVector.end() != itItem )
{
m_CombineItemsVector.erase( itItem );
RefreshSlots();
}
}
}
void SUIRepairWnd::RemoveAllCombineItems( bool bRefreshSlot/* = true*/ )
{
m_SourceItem = COMBINEITEM();
m_CombineItemsVector.clear();
if( bRefreshSlot ) RefreshSlots();
}
void SUIRepairWnd::RefreshSlots()
{
// 공식 초기화.
if( m_SourceItem.handle == NULL && m_CombineItemsVector.empty() )
Clear();
// 대상 아이템.
KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( g_pStrMainSlotId ));
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 SUIRepairWnd::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());
}
pIconStatic->SetIcon( 1, c_szDEF_SPR_NAME, pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL );
EquipItemAddtionalIconSetter icon_setter( pIconStatic, pSlot );
if( pSlot->GetItemAppearance() )
pIconStatic->SetIcon( 4, c_szDEF_SPR_NAME, g_strLookChangeIcon ); // 2012. 7. 27 - marine 아이템 형상변환 아이콘
pIconStatic->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
if( m_bAltKey )
{
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIconStatic, pSlot );
}
}
if( NULL != pItemCountControl )
{
__int64 amount = GetItemDB().IsJoin(pSlot->GetItemCode(), IsInstanceUnstackable(pSlot)) ? 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, "common_panel_titanium_slot_icon" );
//pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, bMain ? "common_panel_titanium_slot_red" : "common_panel_titanium_slot_blue" );
pIconStatic->SetTooltip();
}
if( NULL != pItemCountControl )
pItemCountControl->SetShow(false);
}
}
//// 공식텍스트 출력.
//void SUIRepairWnd::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>";
//#else
// m_pFormalTextControl->SplitLine( vLineList, m_strFormal, S(6425), m_pFormalTextControl->GetFontSize() );
// strNewStory += 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;
// }
//
// // 스크롤바 Thumb 조절.
// m_pScrollFormal->SetScrollRange( MAX_STORY_LINE_COUNT, size );
//
// // 텍스트 적용.
// m_pFormalTextControl->SetCaption( strNewStory.c_str() );
//}
// 에테리얼스톤 내구충전량 변화.
void SUIRepairWnd::RefreshEtherealSton()
{
int crrEthereal = m_PlayerInfoMgr.GetEtherealStoneDurability();
// 에테리얼 수치 출력.
if( m_pCtrlEtherealStoneDurability )
m_pCtrlEtherealStoneDurability->SetCaption( ( m_strDecoEtherealStoneDurability + CStringUtil::GetCommaNumberString( crrEthereal ) ).c_str() );
// bintitle. 2010.10.29.
// 에테리얼충전량이 0 이면 "회색이미지", 1이상 이면 "약간밝은이미지", 아이템슬롯에 아이템존재하면 "밝은이미지".
if( m_pCtrlEtherealStone )
{
int index = 0;
if( crrEthereal > 0 )
index = 1;
/// 2011.01.27 - prodongi
if (E_MAINSLOT_ATTRIBUTE_RECHARGE == m_WndType)
{
refreshRepairButtonStatus();
if (isEnableRechargeItem())
index = 2;
}
else
{
if( m_SourceItem.handle || !m_CombineItemsVector.empty() )
{
index = 2;
}
}
/*
if( m_SourceItem.handle || !m_CombineItemsVector.empty() )
{
index = 2;
}
*/
if( m_SourceItem.handle || !m_CombineItemsVector.empty() )
{
/// 2011.01.27 - prodongi
if (E_MAINSLOT_ATTRIBUTE_RECHARGE == m_WndType)
{
if (isEnableRechargeItem())
index = 2;
}
else
{
index = 2;
}
//index = 2;
}
m_pCtrlEtherealStone->SetAniName( g_EtherealAni[ index ] );
}
}
// 아이템을 넘겨받음.
// 2011.04.26 - servantes / mantis : 12753
void SUIRepairWnd::ReceiveItem( AR_HANDLE hItem, std::string & strDropControlID, bool bEquip, int nItemCount )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( !pSlot )
return;
// 2011.04.26 - servantes / mantis : 12753
//pSlot->SetItemCount( count_t(nItemCount) );
// 윈도우타입 - 기본 : [수리]
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_REPAIR);
//m_WndType = E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_REPAIR;
// ---------- 아이템의 상태에 따라 메인슬롯, 서브슬롯으로 등록된다. -- //
//
// * 메인슬롯 조건 : (1)메인에 드롭. (2)장비or크리쳐카드. (3)내구도존재( 상급or강화 )
//
// 아이템슬롯속성.
enum E_ITEM_SLOT_ATTRIBUTE
{
E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN = ( 1 << 0 ), // 메인슬롯에 드롭.
E_ITEM_SLOT_ATTRIBUTE_UPPERITEM = ( 1 << 1 ), // 상급아이템( 기본 내구도존재 ).
E_ITEM_SLOT_ATTRIBUTE_DURABILLITY = ( 1 << 2 ), // 내구도있음( 수리해야하는 아이템 ).
E_ITEM_SLOT_ATTRIBUTE_BREAK = ( 1 << 3 ), // [복원] 해야함.
};
const int ITEM_SLOT_ATTRIBUTE_MASK = ( E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN | E_ITEM_SLOT_ATTRIBUTE_UPPERITEM );
int bItemAttributes = 0; // 슬롯속성.
// 메인슬롯 or 서브슬롯.
if( strDropControlID == g_pStrMainSlotId )
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN; // 속성.
// 장비 or 크리쳐카드( 강화된 ) 만이 등록가능.
int itemType = GetItemDB().GetUseType( pSlot->GetItemCode() );
ItemBaseEx_info * pItemBase = NULL;
bool bCreaturCard = false; // 크리쳐카드 여부.
// 강화 크리쳐카드 내구도. 강화크리쳐카드 처리 추가. bintitle. 2010.10.27.
if ( GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD && pSlot->GetEnhance() > 0 )
{
bCreaturCard = true;
// 강화 크리쳐.
//if( GetCreatureEnhanceDB().getCardDurability( pSlot->GetEnhance() ) > 0 )
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_UPPERITEM; // 속성.
// 내구도가 남아있다. ( 수리 해야하는 카드 )
if( pSlot->GetEtherealDurability() > 0 )
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_DURABILLITY; // 속성.
// [복원] 필요.
else
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_BREAK; // 속성.
}
// 내구도.
else
{
//const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( pSlot->GetItemCode() );
pItemBase = const_cast< ItemBaseEx_info * >( GetItemDB().GetItemData( pSlot->GetItemCode() ) );
if( pItemBase )
{
// 상급아이템.
if(pSlot->getMaxEtherealDurability() > 0)
{
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_UPPERITEM; // 속성.
// 내구도가 남아있다. ( 수리 해야하는 아이템 )
if( pSlot->GetEtherealDurability() > 0 )
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_DURABILLITY; // 속성.
// [복원] 필요.
else
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE::E_ITEM_SLOT_ATTRIBUTE_BREAK; // 속성.
}
}
}
//
// 메인슬롯에 아이템이 등록되어있는경우, [복원], [수리] 구분.
int MAINSLOT_ATTRIBUTE = E_MAINSLOT_ATTRIBUTE_NONE; // 메인슬롯속성.
SInventorySlot * pMainSlot = NULL;
if( m_SourceItem.handle != 0 )
{
pMainSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if( pMainSlot )
{
if( pMainSlot->GetEtherealDurability() > 0 )
MAINSLOT_ATTRIBUTE = E_MAINSLOT_ATTRIBUTE_REPAIR; // [수리]
else
MAINSLOT_ATTRIBUTE = E_MAINSLOT_ATTRIBUTE_RESTORATION; // [복원]
}
}
// 일반아이템( 내구도없음 ) 을 메인 슬롯에 놓은 경우, 서브슬롯으로 변경.
if( !( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_UPPERITEM ) &&
( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN ) )
bItemAttributes ^= E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN;
// [복원] 해야 하는 아이템을 서브슬롯에 놓은경우, 메인슬롯으로 변경.
if( !( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN ) &&
( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_BREAK ) )
bItemAttributes |= E_ITEM_SLOT_ATTRIBUTE_DROP_MAIN;
// 동일아이템 무시.
if( AbleAddSlot( COMBINEITEM(pSlot->GetHandle(), pSlot->GetItemCount()) ) == false )
return;
// ★ 메인에 등록.
if( ( bItemAttributes & ITEM_SLOT_ATTRIBUTE_MASK ) == ITEM_SLOT_ATTRIBUTE_MASK )
{
/*if( pItemBase && ( ( (float)pItemBase->nEthereal_durability / 10000.0f ) - ( (float)pSlot->GetEtherealDurability() / 10000.0f ) >= 1.0f ) )
AddMainCombineItem( hItem, count_t( 1 ), bEquip ); */
if( ( pItemBase && ( ( (float)pSlot->getMaxEtherealDurability() / 10000.0f ) - ( (float)pSlot->GetEtherealDurability() / 10000.0f ) >= 1.0f ) ) ||
bCreaturCard ) // 강화크리쳐카드는 내구도검사 무시. 강화크리쳐카드 처리 추가. bintitle. 2010.10.27.
{
// 2011.04.26 - servantes / mantis : 12753
AddMainCombineItem( hItem, count_t(nItemCount), bEquip );
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
}
}
// ★ 서브에 등록( 파괴되지 않은 아이템 ) &&
// * 메인슬롯이 [수리] 가 아닌 경우 등록.
/*else if( !( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_BREAK ) &&
( MAINSLOT_ATTRIBUTE != E_MAINSLOT_ATTRIBUTE_REPAIR ) )*/
else if( !( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_BREAK ) ) // 장비 수리의 경우 에테리얼스톤을 이용하여 재료가 필요없는 반면, 크리쳐카드는 수리에 재료가 필요하다. bintitle. 2010.11.02.
{
// 제거. bintitle. 2010.10.27. 크리쳐카드의 경우에는 동일 아이템이 아닌 '소울오비터' 라는 추가 아이템이 필요.
//// 메인슬롯이 [복원] 인 경우, 동일아이템 만이 재료가 된다.
//if( MAINSLOT_ATTRIBUTE == E_MAINSLOT_ATTRIBUTE_RESTORATION )
//{
// if( pMainSlot && pSlot &&
// pMainSlot->GetItemCode() == pSlot->GetItemCode() &&
// ( bItemAttributes & E_ITEM_SLOT_ATTRIBUTE_DURABILLITY ) ) // 복원재료에 내구도가 남아있어야함.
// {
// AddSubCombineItem( hItem, count_t( 1 ) );
// m_WndType = E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_RESTORATION; // [복원].
// }
//}
//else
//{
// AddSubCombineItem( hItem, count_t( 1 ) );
//}
// 메인슬롯이 [복원] 인 경우.
if( MAINSLOT_ATTRIBUTE == E_MAINSLOT_ATTRIBUTE_RESTORATION )
{
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_RESTORATION);
//m_WndType = E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_RESTORATION; // [복원].
}
// 2011.04.26 - servantes / mantis : 12753
AddSubCombineItem( hItem, count_t(nItemCount) );
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
}
//
// ★ 윈도우타입( 수리,복원,충전 ).
//
bool bExistMain = false;
if( m_SourceItem.handle != 0 )
{
// [메인O] => 복원 or 수리.
pMainSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if( pMainSlot )
{
bExistMain = true;
if( pMainSlot->GetEtherealDurability() > 0 )
{
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_REPAIR);
//m_WndType = E_MAINSLOT_ATTRIBUTE_REPAIR; // [수리]
}
else
{
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_RESTORATION);
//m_WndType = E_MAINSLOT_ATTRIBUTE_RESTORATION; // [복원]
}
}
}
// [메인X] && [서브O].
if( !bExistMain )
{
if( m_CombineItemsVector.size() > 0 )
{
/// 2011.01.27 - prodongi
setWndType(E_MAINSLOT_ATTRIBUTE_RECHARGE);
//m_WndType = E_MAINSLOT_ATTRIBUTE_RECHARGE; // [충전]
}
}
// 윈도우타입에 따른 처리.
RefreshWndType();
// }
// 에테리얼스톤 설정.
RefreshEtherealSton();
}
// 윈도우타입에 따른 처리.
void SUIRepairWnd::RefreshWndType()
{
std::string strDeco;
// 수리 Button.
if( m_pBtnRepair )
{
/// 2011.02.16 - prodongi
refreshRepairButtonStatus();
strDeco = m_strDecoBtn;
strDeco.append( S( g_nBtnStrID[ m_WndType ] ) );
m_pBtnRepair->SetCaption( strDeco.c_str() );
}
// 라인컨트롤.
if( m_pCtrlLine )
m_pCtrlLine->SetAniName( g_LineAni[ m_WndType ] );
// 상태 텍스트 컨트롤.
if( m_pCtrlStringState )
{
strDeco = m_strDecoState;
strDeco.append( S( g_nStateStrID[ m_WndType ] ) );
m_pCtrlStringState->SetCaption( strDeco.c_str() );
}
// 내구도 게이지 처리 함수호출.
if( m_pGaugeDurability )
{
( this->*g_fpGauge[ m_WndType ] )();
// 백분률 출력.
if( m_pCtrlGaugeDurability )
m_pCtrlGaugeDurability->SetCaption( CStringUtil::StringFormat( "%s<Right>%d/%d %", m_strDurabilityDeco.c_str(), (int)( (m_fDurabilityPercent + 0.009f )* 100.0f ), 100 ).c_str() );
}
// 공식 상태 텍스트 출력.
strDeco = m_strDecoFormalState;
strDeco.append( S( g_arrFormalState[ m_WndType ] ) );
m_pCtlrFormalState->SetCaption( strDeco.c_str() );
// 공식목록 출력.
m_nScrollPos = 0; // bintitle. 2010.11.02 공식리스트 초기화, 스크롤위치 초기화.
m_vLineList.clear(); //
SetTextList( g_nFormulaListCount, g_arrStrFormula[ m_WndType ], m_strDecoFormal, const_cast< char * >( m_strFontNameFormal.c_str() ),
m_pCtrlFormula, m_pScrollFormal, m_nScrollPos, m_vLineList, true );
}
//
//--- 내구도 게이지 처리 함수.
// Empty.
void SUIRepairWnd::GaugeDurability_Empty()
{
}
// 복원.
void SUIRepairWnd::GaugeDurability_Restoration()
{
m_fDurabilityPercent = 0.0f; // 내구도 백분률.
KRect rt = m_pGaugeDurability->GetRect();
rt.right = rt.left;
m_pGaugeDurability->ClipRect( rt );
// 내구도 상태 아이콘.
if( m_pCtrlMarkDurability )
m_pCtrlMarkDurability->SetShow( true );
}
// 수리.
void SUIRepairWnd::GaugeDurability_Repair()
{
if( m_SourceItem.handle != 0 )
{
// [메인O] => 복원 or 수리.
SInventorySlot * pMainSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if( pMainSlot )
{
if ( GetItemDB().GetGroup(pMainSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD && pMainSlot->GetEnhance() > 0 )
{
m_fDurabilityPercent = (float)pMainSlot->GetEtherealDurability() / (float)GetCreatureEnhanceDB().getCardDurability( pMainSlot->GetEnhance() );
m_fDurabilityPercent = m_fDurabilityPercent > 0.99f ? 1.0f : m_fDurabilityPercent;
}
else
{
const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( pMainSlot->GetItemCode() );
if(pItemBase)
{
m_fDurabilityPercent = (float)pMainSlot->GetEtherealDurability() / (float)pMainSlot->getMaxEtherealDurability();
m_fDurabilityPercent = m_fDurabilityPercent > 0.99f ? 1.0f : m_fDurabilityPercent;
}
}
}
// 내구도 게이지 길이 조절.
KRect rt = m_pGaugeDurability->GetRect();
rt.right = rt.left + m_fGaugeWidth * m_fDurabilityPercent;
m_pGaugeDurability->Resize( rt );
// 내구도 게이지 색상.
char * pStrAni = "common_guage_titanium_line_yellowgreen";
if( m_fDurabilityPercent < 0.34f )
pStrAni = "common_guage_titanium_line_red";
else if( m_fDurabilityPercent < 0.67f )
pStrAni = "common_guage_titanium_line_cyan";
m_pGaugeDurability->SetAniName( pStrAni );
// 내구도 상태 아이콘.
if( m_pCtrlMarkDurability )
m_pCtrlMarkDurability->SetShow( false );
}
}
// 충전.
void SUIRepairWnd::GaugeDurability_Recharge()
{
m_fDurabilityPercent = 1.0f; // 내구도 백분률.
KRect rt = m_pGaugeDurability->GetRect();
rt.right = rt.left + m_fGaugeWidth;
m_pGaugeDurability->ClipRect( rt );
// 내구도 상태 아이콘.
if( m_pCtrlMarkDurability )
m_pCtrlMarkDurability->SetShow( false );
}
//----------------------
// 공식 초기화.
void SUIRepairWnd::Clear()
{
// 공식 상태 텍스트 출력.
std::string strDeco = m_strDecoFormalState;
strDeco.append( S( g_arrFormalState[ E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_REPAIR ] ) );
m_pCtlrFormalState->SetCaption( strDeco.c_str() );
// 공식목록 출력.
m_vLineList.clear();
SetTextList( g_nFormulaListCount, g_arrStrFormula[ E_MAINSLOT_ATTRIBUTE::E_MAINSLOT_ATTRIBUTE_REPAIR ], m_strDecoFormal, const_cast< char * >( m_strFontNameFormal.c_str() ),
m_pCtrlFormula, m_pScrollFormal, m_nScrollPos, m_vLineList, true );
m_pCtrlGaugeDurability->SetCaption( " " ); // 내구도%
m_pCtrlGaugeDurability->SetCaption( CStringUtil::StringFormat( "%s<Right>%d/%d %", m_strDurabilityDeco.c_str(), 0, 100 ).c_str() );
KRect rt = m_pGaugeDurability->GetRect();
rt.right = rt.left;
m_pGaugeDurability->Resize( rt );
}
/// 2011.01.27 - prodongi
bool SUIRepairWnd::isEnableRechargeItem() const
{
bool ret = false;
if (!m_CombineItemsVector.empty())
{
COMBINEITEM_VECTOR::const_iterator it = m_CombineItemsVector.begin();
for (; it != m_CombineItemsVector.end(); ++it)
{
SInventorySlot* slot = m_InventoryMgr.GetItemInfo(it->handle);
if (!slot)
continue;
ItemBaseEx_info const* item = GetItemDB().GetItemData(slot->GetItemCode());
if (!item)
continue;
if (ItemBase::TYPE_ARMOR == item->nType)
{
int group = item->nGroup;
if ((ItemBase::GROUP_WEAPON <= group && ItemBase::GROUP_BELT >= group) || (ItemBase::GROUP_ACCESSORY == group))
{
ret = true;
break;
}
}
else if (ItemBase::TYPE_ETC == item->nType && 1100103 == slot->GetItemCode()) /// 연마된 강철
{
ret = true;
break;
}
}
}
return ret;
}
/// 2011.02.14 - prodongi
void SUIRepairWnd::setWndType(int type)
{
m_WndType = type;
}
/// 2011.02.14 - prodongi
void SUIRepairWnd::refreshRepairButtonStatus()
{
KUIControl* control = dynamicCast<KUIControl*>(m_pBtnRepair);
control->Enable();
if (E_MAINSLOT_ATTRIBUTE_RECHARGE == m_WndType)
{
if (!isEnableRechargeItem())
control->Disable();
}
}
/// 2011.02.14 - prodongi
bool SUIRepairWnd::isCheckedUseRechargeMsgBox() const
{
KUIControlCheck* check = dynamicCast<KUIControlCheck*>(GetChild("button_checkbutton_01"));
return check ? check->GetCheck() : false;
}
/// 2011.02.14 - prodongi
void SUIRepairWnd::setUseRechargeMsgBox(bool dontask, bool applyOption)
{
KUIControlCheck* check = dynamicCast<KUIControlCheck*>(GetChild("button_checkbutton_01"));
if (check)
check->SetCheck(!dontask);
if (applyOption)
GetGameOption().SetUseRechargeMsgBox(!dontask);
}
/// 2011.08.11 - prodongi
void SUIRepairWnd::performRepair()
{
// 강화 크리쳐카드 내구도. 강화크리쳐카드 처리 추가. bintitle. 2010.10.27.
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if ( pSlot && GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD && pSlot->GetEnhance() > 0 )
{
// 아이템합성 시작 전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) );
// 아이템합성 진행률 출력 윈도우 열기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
}
else //
{
int crrEthereal = m_PlayerInfoMgr.GetEtherealStoneDurability() * 10000; // 현재 에테리얼충전량.
// 수리여부 검사.
bool bRepairFailed = true;
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if( pSlot && crrEthereal >= 10000 )
{
ItemBaseEx_info * pItemBase = const_cast< ItemBaseEx_info * >( GetItemDB().GetItemData( pSlot->GetItemCode() ) );
if (pItemBase)
{
// 현재 에테리얼량이 1% 충전에 필요한 에테리얼량보다 크거나 같을때 수리 가능.
float EtherealPerOne = (float)pSlot->getMaxEtherealDurability() / 100.0f;
if( pItemBase && crrEthereal >= EtherealPerOne )
{
//if( ( (float)pItemBase->nEthereal_durability / 10000.0f ) - ( (float)pSlot->GetEtherealDurability() / 10000.0f ) >= 1.0f )
// 1%당 필요량이 10000 보다 작을때에는 서버에서 충전이 무시되기 때문에,
// 충전이 무시되지않는 10000 이상을 채울 수 있을때에만 수리 요청한다.
float quota = 10000.0f / EtherealPerOne;
if( quota > 1.0f && ( (quota * 10000.0f) > crrEthereal ) )
bRepairFailed = true;
else
{
bRepairFailed = false;
// 아이템합성 시작 전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) );
// 아이템합성 진행률 출력 윈도우 열기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
}
}
}
}
// 메세지출력. 733 에테리얼 스톤 충전양이 부족합니다.
if( bRepairFailed )
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 733 ), true ) );
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 733 ), true ) );
}
}
}
void SUIRepairWnd::performRestortionRecharge()
{
// 아이템합성 시작 전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) );
// 아이템합성 진행률 출력 윈도우 열기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
}
bool SUIRepairWnd::isRepairItems()
{
SInventorySlot* slot = m_InventoryMgr.GetItemInfo( m_SourceItem.handle );
if (!slot)
return false;
std::vector<int> mainMixList;
getMainMixList(slot, mainMixList);
if (mainMixList.empty())
return false;
std::vector<int> extractMixList;
extractMixList = mainMixList;
COMBINEITEM_VECTOR::iterator it_sub = m_CombineItemsVector.begin();
for (; it_sub != m_CombineItemsVector.end(); ++it_sub)
{
slot = m_InventoryMgr.GetItemInfo(it_sub->handle);
if (slot)
{
std::vector<int> _subMixList;
getSubMixList(slot, extractMixList, _subMixList);
extractMixList = _subMixList;
_subMixList.clear();
}
}
bool ret = false;
std::vector<int>::iterator it_id = extractMixList.begin();
for (; it_id != extractMixList.end(); ++it_id)
{
int mixType = GetCombineDB().getMixType(*it_id);
/// 803, 804, 805, 806은 내구도 회복 유형 ID 이다. 따로 정의를 할려다가 임시 수정이라서 그냥 씀
if (803 == mixType || 804 == mixType || 805 == mixType || 806 == mixType)
{
ret = true;
break;
}
}
mainMixList.clear();
extractMixList.clear();
return ret;
}
void SUIRepairWnd::getMainMixList( SInventorySlot* pSlot, std::vector<int>& mainMixList )
{
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();
GetCombineDB().getMainMixList( nBigGroup, nGroup, nID, nRank, nLv, xFlag, nEnhance, nItemCount, mainMixList);
}
void SUIRepairWnd::getSubMixList( SInventorySlot* pSlot, const std::vector<int>& mainMixList, std::vector<int>& subMixList)
{
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();
GetCombineDB().getSubMixList( nBigGroup, nGroup, nID, nRank, nLv, xFlag, nEnhance, nItemCount, mainMixList, subMixList);
}