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

2388 lines
78 KiB
C++

//#ifdef DEV_EQUIPMENT
#include "stdafx.h"
#include "KUIWndManager.h"
#include "KUIDragAndDrop.h"
#include "KUIControlChaosGauge.h"
#include "KUIControlStatic.h"
#include "KUIControlScroll.h"
#include "KUIControlButton.h"
#include "KUIControl3DStatic.h"
#include "SUIInventoryWnd.h"
#include "SUIDURABILITYWnd.h"
#include "SGameManager.h"
//#include "SGameMessageUI.h"
#include "ItemBase.h"
#include "SCombineDB.h"
#include "SItemDB.h"
#include "SStringDB.h"
#include "SkillBaseFile.h"
//#include "Util.h"
#include "ErrorCode/ErrorCode.h"
#include "SUISysMsgDefine.h"
#include "SGameOption.h"
#include "SStorageMgr.h"
#include "SPlayerInfoMgr.h"
#include "SInventoryMgr.h"
#include "SUILazyTooltip.h" // sonador #2.1.2.4.3 팻 조작 UI 연동
#include <toolkit/XEnv.h>
#include "SGameAvatarEx.h"
#include <toolkit/XStringUtil.h>
#include "SGame.h"
#include "STenacityDB.h"
#include "SContents.h" // sonador #2.1.24
#include "KUITipControl.h"
// 2010.08.25 - prodongi
#include "ItemEffect.h"
#include "SGameWorld.h"
#include "SUIEquipmentWnd.h"
#include "Durability.h"
#define DECO
#define CONTRIBUTION
// 2010.06.11 - prodongi
#include "SGameSystem.h"
extern SGameSystem * g_pCurrentGameSystem;
//
// ★ 장비창. 없으면 인벤토리.
// & 인벤리뉴얼을 위한 주석추가.
//
namespace
{
const short c_nBeltSlot_Cnt = 8; // ★ 벨트슬롯개수.
const short g_nGauge = 12; // 게이지 개수. 11개인데 c_EquipSetNames의 순서에서 망토(cloak) 이 중간에 끼여있는 관계로 12개로 한다.
//const char* c_szStaticLak = "static_c"; // LAK
const char * g_DecoView[] = { "common_button_titanium_costumeoff", "common_button_titanium_costumeon", "common_button_titanium_costumeoff" };
// 내구도 게이지 SpriteSet. 내구없는 일반아이템, 33%, 66%, 100%.
const char * g_arrGaugeAni[] = { "common_guage_titanium_line_lightgrey", "common_guage_titanium_line_red",
"common_guage_titanium_line_cyan", "common_guage_titanium_line_yellowgreen", "gauge_repair_line_grey" };
// ★ 장비창의 static control 들.
// ItemBase.h의 ItemWearType의 순서 및 개수와 동일해야 한다.
const char* c_EquipSetNames[ ItemBase::MAX_ITEM_WEAR ] =
{
"icon_weapon" , //static_inventory_weapon // 0
"icon_shield" , //static_inventory_shield // 1
"icon_armor" , //static_inventory_armor // 2
"icon_helm" , //static_inventory_helm // 3
"icon_glove" , //static_inventory_glove // 4
"icon_boots" , //static_inventory_boots // 5
"icon_belt" , //static_inventory_belt // 6
"icon_cloak" , //static_inventory_cloack // 7
"icon_neck" , //static_inventory_neck // 8
"icon_ring" , //static_inventory_ring // 9
"icon_ring02" , //static_inventory_ring // 10
"icon_ear" , //static_inventory_ear // 11
"icon_face" , //static_inventory_face // 12
#ifndef DECO
"icon_hairacc" , //static_inventory_hair
#endif
#ifdef DECO
"icon_backpack", // 13
"icon_weapon_deco", // 14
"icon_shield_deco", // 15
"icon_armor_deco", // 16
"icon_helm_deco", // 17
"icon_glove_deco", // 18
"icon_boots_deco", // 19
"icon_cloak_deco", // 20
"icon_shoulder_deco", // 21
"", // 22 (ex icon_creature)
"icon_bag", // 23
"icon_boost_deco", // 24
"icon_emblem_deco", // 25
"icon_ear_01", // 26
"icon_chaos_stone", // 27
/* Swap */
"slot_back_weapon01", // 28
"slot_back_weapon02", // 29
"icon_weapon_deco_01", // 30
"icon_shield_deco_01" // 31
/* Swap */
#endif
};
// ★ 장비창의 회색 아이콘 이미지들.
const char* c_EquipAniNames[ ItemBase::MAX_ITEM_WEAR ] =
{
"common_panel_titanium_slot_weapon",
"common_panel_titanium_slot_shield",
"common_panel_titanium_slot_clothe",
"common_panel_titanium_slot_helmet",
"common_panel_titanium_slot_glove",
"common_panel_titanium_slot_boots",
"common_panel_titanium_slot_belt",
"common_panel_titanium_slot_mantle",
"common_panel_titanium_slot_necklace",
"common_panel_titanium_slot_ring",
"common_panel_titanium_slot_ring",
"common_panel_titanium_slot_earing",
"common_panel_titanium_slot_face",
"static_inventory_hair_deco",
#ifdef DECO
"common_panel_titanium_slot_deco_weapon",
"common_panel_titanium_slot_deco_shield",
"common_panel_titanium_slot_deco_clothe",
"common_panel_titanium_slot_deco_helmet",
"common_panel_titanium_slot_deco_glove",
"common_panel_titanium_slot_deco_boots",
"common_panel_titanium_slot_deco_mantle",
"common_panel_titanium_slot_deco_shoulder",
"common_panel_titanium_slot_ride",
"common_panel_titanium_slot_bag",
"static_inventory_booster",
"static_inventory_emblem",
"common_panel_titanium_slot_earing",
"static_inventory_chaos_stone",
////--- Swap.//
"common_panel_titanium_slot_back_weaponslot",
"common_panel_titanium_slot_back_weaponslot",
"common_panel_titanium_slot_back_weaponslot",
"common_panel_titanium_slot_back_weaponslot",
////---------//
#endif
};
};
int GetSlotIndex( const char * pStr )
{
int index = -1;
for( int i=0; i<ItemBase::MAX_ITEM_WEAR; ++i, ++index )
{
if( !::_stricmp( pStr, c_EquipSetNames[ i ] ) )
{
index = i;
break;
}
}
return index;
}
// 꾸미기아이템 모두숨김여부.
// 0 개별상태, 1 모두보임, 2 모두숨김.
int IsAllDecoHide()
{
unsigned int nHideEquip = g_pCurrentGameSystem->GetLocalPlayer()->getHideEquipInfo();
unsigned int nDeco = nHideEquip & DECO_EQUIPMENT_MASK;
// 모두보임 상태.
if( nDeco == DECO_EQUIPMENT_MASK )
return 1;
// 모두숨김 상태.
else if( nDeco == 0 )
return 2;
return 0; // 개별 토글 상태.
}
using namespace rp;
SUIEquipmentWnd::~SUIEquipmentWnd()
{
//SAFE_DELETE( m_pArrangeButtonAction );
m_arrDrabilityGauge.clear();
m_arrGeneralItem.clear();
m_arrMultiIcon.clear();
m_arrBeltMultiIcon.clear(); /// 2010.11.01 - prodongi
}
SUIWnd * SUIEquipmentWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
// 캐릭터뷰.
m_pStaticTarget = dynamicCast<KUIControl3DStatic *>(GetChild( "body_view" ));
// 내구도 게이지 바 추가.
KUIWnd * pWnd = NULL;
for( int i=1; i<=g_nGauge; ++i )
{
pWnd = GetChild( CStringUtil::StringFormat( "gauge_repair_line_yellowgreen_%02d", i ).c_str() );
m_arrDrabilityGauge.push_back( pWnd );
KRect rect = pWnd->GetRect();
KUIWnd* mark( CopyControl( "mark_zero", CStringUtil::StringFormat( "mark_none_ex%02d", i ).c_str(), RECT() ) );
mark->MovePos( rect.left - 1, rect.top - 4 );
m_arrGeneralItem.push_back( mark );
}
if( m_arrDrabilityGauge.size() > 0 && m_arrDrabilityGauge[ 0 ] )
m_fDurabilityGaugeW = m_arrDrabilityGauge[ 0 ]->GetRect().GetWidth(); // 내구도 게이지바의 기본넓이.
// 라크 카오스.
m_pChaos = GetChild( "guage_purple" );
m_ChaosWidth = 0;
if( m_pChaos )
{
m_ChaosWidth = m_pChaos->GetRect().GetWidth();
//static_cast< KUIControl * >( m_pChaos )->SetLazyTooltip( new KLazyTip( S( 7230 ) ) );
}
m_pLac = GetChild( "text_07" );
if( m_pLac )
CStringUtil::GetTextDecoration( m_pLac->GetCaption(), m_strDeco ); // 텍스트 꾸미기 태그.
m_pBtnAllDecoView = dynamicCast< KUIControlSimpleButton * >( GetChild( "button_costumeoff" ) ); // 꾸미기아이템 모두 보임,숨김 버튼.
//----------------
// 툴팁 추가.
KUIControl * pControl = NULL;
pControl = dynamicCast<KUIControl*>(GetChild( "button_change" ));
if( pControl )
pControl->SetLazyTooltip( new KLazyTip( S( 7216 ) ) );
//servantes 2010.11.18
pControl = dynamicCast<KUIControl*>(GetChild( "button_bag" ));
if( pControl )
pControl->SetLazyTooltip( new KLazyTip( S( 7214 ) ) );
pControl = dynamicCast<KUIControl*>(GetChild( "button_costumeoff" ));
if( pControl )
pControl->SetLazyTooltip( new KLazyTip( S( 7215 ) ) );
pControl = dynamicCast<KUIControl*>(GetChild( "button_allrepair" ));
if( pControl )
pControl->SetLazyTooltip( new KLazyTip( S( 9764 ) ) );
pControl = dynamicCast<KUIControl*>(GetChild( "guage_lac_base_01" ));
if( pControl )
pControl->SetLazyTooltip( new KLazyTip( S( 7230 ) ) );
return this;
}
bool SUIEquipmentWnd::InitControls( KPoint kPos )
{
// 커스텀 윈도우 move 영역 설정
SetCustomMovingRect( GetChild( "titlebar" )->GetRect() );
m_hLocal = 0;
#ifndef DECO
//지역화
SetChildCaption( "static_helm" , S(6345) );
SetChildCaption( "static_cloak" , S(6346) );
SetChildCaption( "static_armor" , S(6347) );
SetChildCaption( "static_weapon" , S(6348) );
SetChildCaption( "static_glove" , S(6349) );
SetChildCaption( "static_hairacc", S(6350) );
SetChildCaption( "static_face" , S(6351) );
SetChildCaption( "static_belt" , S(6352) );
SetChildCaption( "static_shield" , S(6353) );
SetChildCaption( "static_boots" , S(6354) );
SetChildCaption( "static_ear" , S(6355) );
SetChildCaption( "static_neck" , S(6356) );
SetChildCaption( "static_ring" , S(6357) );
SetChildCaption( "static_ring02" , S(6357) );
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
// 장착 icon 툴팁 스프라이트 설정
// 임시... MAX_ITEM_WEAR 갯수가 늘어서 위에 c_EquipSetNames를 임시로 정의해뒀다
for( int nSet( 0 ); nSet < ItemBase::MAX_ITEM_WEAR; ++nSet )
{
// 2011.11.29 - servantes : 유효한 파일 이름인지 길이로 검사
if( strlen( c_EquipSetNames[ nSet ] ) <= 0)
continue;
KUIControlMultiIcon* pIconControl = dynamicCast<KUIControlMultiIcon*>(GetChild( c_EquipSetNames[ nSet ] ));
if( pIconControl )
pIconControl->SetIconLayer( 8 );
}
// 2010.08.24 - prodongi
m_beltSlotEnchantIconName[0] = sBeltSlotEnchantIconName(NULL, NULL, NULL);
m_beltSlotEnchantIconName[1] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_enchant", "common_mark_titanium_beltslot_enchant_over");
m_beltSlotEnchantIconName[2] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_enchant", "common_mark_titanium_beltslot_enchant_over");
m_beltSlotEnchantIconName[3] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_enchant", "common_mark_titanium_beltslot_enchant_over");
m_beltSlotEnchantIconName[4] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_khrooshop", "common_mark_titanium_beltslot_khrooshop_over");
m_beltSlotEnchantIconName[5] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_khrooshop", "common_mark_titanium_beltslot_khrooshop_over");
m_beltSlotEnchantIconName[6] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_khrooshop", "common_mark_titanium_beltslot_khrooshop_over");
m_beltSlotEnchantIconName[7] = sBeltSlotEnchantIconName(c_szDEF_SPR_NAME, "common_mark_titanium_beltslot_khrooshop", "common_mark_titanium_beltslot_khrooshop_over");
// 툴팁갱신 용 멀티아이콘설정.
KUIWnd * pWnd;
/// 2010.11.01 - prodongi
//m_arrMultiIcon.resize( ItemBase::MAX_ITEM_WEAR + c_nBeltSlot_Cnt ); //
m_arrMultiIcon.resize( ItemBase::MAX_ITEM_WEAR ); //
for( int i=0; i<ItemBase::MAX_ITEM_WEAR; ++i )
{
pWnd = GetChild( c_EquipSetNames[ i ] );
if( pWnd )
m_arrMultiIcon[ i ] = dynamicCast< KUIControlMultiIcon * >( pWnd );
}
m_arrBeltMultiIcon.resize(c_nBeltSlot_Cnt);
for( int i(0); c_nBeltSlot_Cnt>i; i++ )
{
// 벨트 슬롯 컨트롤
// 2010.08.20 - prodongi
KUIControlMultiIcon* pBeltSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat("icon_beltcarslot_%02d", i+1).c_str() ));
if( pBeltSlotControl )
{
pBeltSlotControl->SetIconLayer( 8 );
// 2010.08.20 - prodongi
pBeltSlotControl->SetIcon(5, m_beltSlotEnchantIconName[i].m_sprName, m_beltSlotEnchantIconName[i].m_aniName);
// 툴팁갱신 용 멀티아이콘설정.
//m_arrMultiIcon[ ItemBase::MAX_ITEM_WEAR + i ] = pBeltSlotControl;
m_arrBeltMultiIcon[i] = pBeltSlotControl;
}
}
m_pRideIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( "icon_ride" )); // 탈것아이콘.
m_pRideIcon->SetIconLayer( 4 );
int nStaticHeight = 0;
int nWndMinHeight = 0;
#ifdef _KUI_INVALIDATION
// { [sonador]
KUIControl3DStatic* pStaticTarget = dynamicCast<KUIControl3DStatic*>(GetChild( "body_view" ));
if( pStaticTarget )
this->AddPopupControl( pStaticTarget );
// }
#endif
//SetChildCaption( c_szStaticLak, GetStringDB().GetString( STRING_LAK ));
return SUIWnd::InitControls( kPos );
}
bool SUIEquipmentWnd::InitData( bool bReload )
{
//m_ReserveDropItemHandle = NULL;
m_bShiptKey = false;
/// 2011.04.01 우클릭 툴팁 - prodongi
KUIControl* rmark = dynamicCast<KUIControl*>(GetChild("mark_right_click_01"));
if (rmark)
{
std::string str;
XStringUtil::Format(str, "<#b92c36>%s", S(6775)); /// 2011.05.24 칼라 적용 - prodongi
rmark->SetTooltip(str.c_str());
}
return SUIWnd::InitData(bReload);
}
void SUIEquipmentWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
// 열기.
if( bOpen )
{
//servantes 2010.11.02
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY,
// this->GetRect().right - 6, this->GetRect().top ) ); // 인벤토리 위치지정.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, true ) );// 인벤토리.
//
// // [수리], [조합], [강화] 윈도우 위치지정.
// KRect rt = this->GetRect();
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, rt.left, rt.bottom - 6 ) ); // 조합.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, rt.left, rt.bottom - 6 ) ); // 강화.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, rt.left, rt.bottom - 6 ) ); // 수리.
m_pGameManager->StartSound( "ui_popup_window01.wav" );
// 장비슬롯 설정.
RefreshEquipItems();
// 벨트슬롯 설정.
RefreshBeltSlot();
// 캐릭터뷰.
BodyView();
// 라크수치적용.
RefreshChaos();
// 꾸미기아이템 보임,숨김 아이콘처리.
DecoEquipmentChange();
// 아이템 툴팁 갱신.
RefreshLendingItemTooltip();
this->SetFocus( true );
}
// 닫기.
else
{
/// 2011.02.17 - prodongi
GetGameOption().SetEquipmentWndPos( KPoint( GetRect().left, GetRect().top ) );
// servantes 2010.11.18
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, false ) ); // 인벤토리.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, false ) ); // 아이템 조합.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, false ) ); // 아이템강화.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, false ) ); // 아이템수리.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, false ) ); // 크리쳐카드.
}
}
void SUIEquipmentWnd::Process( DWORD dwTime )
{
SUIWnd::Process( dwTime );
tick( dwTime );
}
// 2010.08.24 - prodongi
void SUIEquipmentWnd::procBeltSlotEnchantIcon(int mx, int my)
{
for( int i(0); c_nBeltSlot_Cnt>i; i++ )
{
/// 2010.11.01 - prodongi
//KUIControlMultiIcon* pBeltSlotControl = (KUIControlMultiIcon*)GetChild( CStringUtil::StringFormat("icon_beltcarslot_%02d", i+1).c_str() );
KUIControlMultiIcon* pBeltSlotControl = m_arrBeltMultiIcon[i];
if( pBeltSlotControl )
{
char const* aniName;
if (pBeltSlotControl->IsInRect(mx, my)) aniName = m_beltSlotEnchantIconName[i].m_aniOverName;
else aniName = m_beltSlotEnchantIconName[i].m_aniName;
if( NULL != aniName )
pBeltSlotControl->SetIcon(5, m_beltSlotEnchantIconName[i].m_sprName, aniName);
}
}
}
// 2010.08.25 - prodongi
int SUIEquipmentWnd::getBeltSlotCount()
{
SInventorySlot* beltSlot = m_InventoryMgr.GetItemInfo(ItemBase::WEAR_BELT);
if (!beltSlot)
return 0;
int const* socket = beltSlot->GetSocketInfo();
return socket[0] + 1;
}
void* SUIEquipmentWnd::Perform( KID id, KArg& msg )
{
_CID( UI_BEGIN_DRAG );
_CID( UI_SEND_DROP );
_CID( UI_RECV_DROP );
//-----------------------------------------------------------------------------------
// UI_BEGIN_DRAG
//
if ( id == id_UI_BEGIN_DRAG )
{
KUIBeginDragMessage* pBeginMsg = static_cast<KUIBeginDragMessage*>( &msg );
const char* szControlID = pBeginMsg->sDragControlID.c_str();
ItemBase::ItemWearType wear_type = GetEquipSlotWearType(szControlID);
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( wear_type );
// ★ 장착슬롯. 장비가 장착되있는 경우.
if( NULL != pSlot )
{
KUIControlMultiIcon* pWndMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
if( NULL != pWndMultiIcon )
{
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
m_pDisplayInfo->SetUIDragInfo( new SUIEquipmentDragInfo( pSlot->GetHandle(), true, false ) );
m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon;
}
}
else
{ // ★ 벨트슬롯의 경우.
if( wear_type == ItemBase::WEAR_BELT00 || wear_type == ItemBase::WEAR_BELT01 ||
wear_type == ItemBase::WEAR_BELT02 || wear_type == ItemBase::WEAR_BELT03 ||
wear_type == ItemBase::WEAR_BELT04 || wear_type == ItemBase::WEAR_BELT05 ||
wear_type == ItemBase::WEAR_BELT06 || wear_type == ItemBase::WEAR_BELT07 )
{
AR_HANDLE hItem = m_InventoryMgr.GetBeltSlot( wear_type-ItemBase::WEAR_BELT00 );
pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( NULL != pSlot )
{
KUIControlMultiIcon* pWndMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
if( NULL != pWndMultiIcon )
{
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
//벨트 슬롯 처리
m_pDisplayInfo->SetUIDragInfo( new SUIEquipmentDragInfo( pSlot->GetHandle(), false, true ) );
m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon;
}
}
}
}
return NULL;
}
//-----------------------------------------------------------------------------------
// UI_SEND_DRAG
//
else if ( id == id_UI_SEND_DROP )
{
KUISendRecvDropMessage* pSendMsg = static_cast<KUISendRecvDropMessage*>( &msg );
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
if( pUIDragInfo && pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_EQUIPMENT )
{
SUIEquipmentDragInfo* pItemDragInfo = (SUIEquipmentDragInfo*)pUIDragInfo;
//// Receive Window 가 인벤토리이면 장착해제.
//if( pSendMsg->sRecvDropParentID == "window_inventory" )
//{
// // 장착 슬롯 장비 해제.
// if( pItemDragInfo->m_bFromEquipSlot )
// m_pDisplayInfo->UseOrEquipItem( pItemDragInfo->m_hItem );
//
// // 벨트 슬롯 벨트 해제.
// else if( pItemDragInfo->m_bFromBeltSlot )
// m_pDisplayInfo->ReqBeltItem( false, pItemDragInfo->m_hItem );
//
// m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
//}
}
// Drag & Drop 정보 제거
m_pDisplayInfo->SetUIDragInfo();
return NULL;
}
//-----------------------------------------------------------------------------------
// UI_RECV_DRAG
//
else if ( id == id_UI_RECV_DROP )
{
KUISendRecvDropMessage* pRecvMsg = static_cast<KUISendRecvDropMessage*>( &msg );
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
if( pUIDragInfo == NULL )
return NULL;
// ★
// 장비창에서 Drag 시작.
if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_EQUIPMENT )
{
SUIEquipmentDragInfo * pItemDragInfo = (SUIEquipmentDragInfo*)pUIDragInfo;
}
// ★
// 인벤토리에서 Drag 시작.
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_INVENITEM )
{
SUIInvenItemDragInfo* pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo;
// 같은 자리에 drop한 경우를 제외.
if( pRecvMsg->sSendDropParentID != pRecvMsg->sRecvDropParentID ||
pRecvMsg->sSendDropControlID != pRecvMsg->sRecvDropControlID )
{
// 드롭한 좌표
//KPoint ptDrop( pRecvMsg->ptDropPos.x - GetRect().left, pRecvMsg->ptDropPos.y - GetRect().top );
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pItemDragInfo->m_hItem );
if( NULL != pSlot )
{
// 장비 아이템인 경우만
int nWearType = GetItemDB().GetWearType(pSlot->GetItemCode());
if( nWearType != ItemBase::WEAR_CANTWEAR && nWearType != ItemBase::WEAR_NONE &&
ItemBase::TYPE_ARMOR == GetItemDB().GetUseType( pSlot->GetItemCode() ) ||
( nWearType == ItemBase::WEAR_NONE && pSlot->GetItemCode() == 804000 ) )
{
// 현재 장착되어 있지 않은 아이템만
if( !pSlot->IsEquipItem() )
{
// 2010.08.20 - prodongi
if (nWearType == ItemBase::WEAR_BELT_SLOT)
{
dragDropToBeltSlot(pItemDragInfo, pRecvMsg);
}
else
{
m_pDisplayInfo->UseOrEquipItem( pItemDragInfo->m_hItem );
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial( pSlot->GetItemCode() ) ) );
}
}
}
// 2010.08.19 - prodongi
// 크리처 카드인 경우, 벨트슬롯에 장착
else if( ItemBase::GROUP_SUMMONCARD == GetItemDB().GetGroup( pSlot->GetItemCode()) ||
ItemBase::GROUP_BOSSCARD == GetItemDB().GetGroup(pSlot->GetItemCode()))
{
dragDropToBeltSlot(pItemDragInfo, pRecvMsg);
}
// TEST.
//if( pRecvMsg->sRecvDropControlID == "icon_bag" )
//{
// pSlot = m_InventoryMgr.GetItemInfo( ItemBase::WEAR_BAG_SLOT );
// if( pSlot && pItemDragInfo )
// ReqSwapItem( pItemDragInfo->m_hItem, pSlot->GetHandle() );
//}
//// pSlot = GetChild("c_EquipSetNames[ nWearType ]"); // m_pInventoryWnd->GetInvenItem( m_pInventoryWnd->GetSlotControlNum( pRecvMsg->sRecvDropControlID.c_str() ) );
//if( pSlot && pItemDragInfo )
// ReqSwapItem( pItemDragInfo->m_hItem, pSlot->GetHandle() );
}
}
}
return NULL;
}
return SUIWnd::Perform( id, msg );
}
void SUIEquipmentWnd::Req_BeltItem( AR_HANDLE hItem )
{
if( m_InventoryMgr.IsBeltSlotCard(hItem) )
{
//장착 해제
m_pDisplayInfo->ReqBeltItem( false, hItem );
}
else
{ //장착 요청
// 2010.08.20 - prodongi
m_pDisplayInfo->ReqBeltItem( true, hItem, -1 );
}
m_pGameManager->StartSound( "ui_icon_drag.wav" );
}
void SUIEquipmentWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
//마우스 우측클릭했을때만 아이템풀다운윈도우가 나와야하고 다른 메세지가 발생하면 꺼줘야해서 여기서 SHOW를 false하는데
//마우스 우측클릭했을때 메세지가 KGENWND_RIGHT_CLICK와 KICON_RCLICK가 발생하기 때문에 결국 풀다운 윈도우가 켜졌다 꺼진다
//이현상을 없게기 위해서 KGENWND_RIGHT_CLICK 메세지가 아닐경우에만 SHOW를 false해준다 -N4-
// if( nMessage != KUI_MESSAGE::KGENWND_RIGHT_CLICK )
//m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_ITEMDROP, false ) );
switch( nMessage )
{
/*case KUI_MESSAGE::KICON_RCLICK:
{
}
break;*/
// }
case KUI_MESSAGE::KICON_DBLCLK:
{
bool bPrayRoom = IsRamadanPrayRoom();
if( bPrayRoom == true )
return ;
// 장착 슬롯인가?
SInventorySlot* pSlot = NULL;
ItemBase::ItemWearType wear_type = GetEquipSlotWearType(lpszControlID);
if( wear_type == ItemBase::WEAR_BELT00 || wear_type == ItemBase::WEAR_BELT01 ||
wear_type == ItemBase::WEAR_BELT02 || wear_type == ItemBase::WEAR_BELT03 ||
wear_type == ItemBase::WEAR_BELT04 || wear_type == ItemBase::WEAR_BELT05 ||
wear_type == ItemBase::WEAR_BELT06 || wear_type == ItemBase::WEAR_BELT07 )
{
AR_HANDLE hItem = m_InventoryMgr.GetBeltSlot( wear_type-ItemBase::WEAR_BELT00 );
pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( NULL != pSlot )
{
// 2010.08.20 - prodongi
if (GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD ||
GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_BOSSCARD)
{
Req_BeltItem( hItem );
}
}
}
else
{
pSlot = m_InventoryMgr.GetItemInfo( GetEquipSlotWearType(lpszControlID) );
// 장착해제.
if( pSlot )
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle() ); //
else
{
if ( strcmp( lpszControlID, "icon_bag" ) == 0 )
pSlot = m_InventoryMgr.GetItemInfo( ItemBase::WEAR_BAG_SLOT ); //라이딩은 예외 처리
if( pSlot )
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle() );
///////////////////
//if( pSlot )
//{
// const ItemBase* pItem = (ItemBase*)GetItemDB().GetItemData( pSlot->GetItemCode() );
// if( pItem->CheckFlag( ItemBase::ITEM_FLAG::FLAG_TARGET_USE ) )
// m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle(), NULL, false, true );
// else
// m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle() );
//}
}
}
}
break;
case KUI_MESSAGE::KBUTTON_CLICK:
{
// 닫기.
if( !::_stricmp( lpszControlID, "_close" ) || !::_stricmp( lpszControlID, "button_close" ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, false ) );
GetGameOption().SetOpenEquipWnd( false ); //servantes 2010.11.05
}
// 인벤토리 열기. //servantes 2010.11.05
// else if( !::_stricmp( lpszControlID, "button_bag" ) )
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY ) );
// }
// 무기교체.
else if( !::_stricmp( lpszControlID, "button_change" ) )
{
WeaponSwap(); // 무기교체.
}
// 꾸미기아이템 전체 보임,숨김.
else if( !::_stricmp( lpszControlID, "button_costumeoff" ) )
{
AllDecoEquipmentToggle(); // 전체토글.
}
// 전체수리.
else if( !::_stricmp( lpszControlID, "button_allrepair" ) )
{
// 아이템합성 시작 전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT ) );
// 아이템합성 진행률 출력 윈도우 열기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, true, true ) );
}
else if( !::_stricmp( lpszControlID, "button_zoom_0" ) )
{
m_SeqType = 0;
BodyView();
}
else if (!::_stricmp( lpszControlID, "button_zoom_1" ))
{
m_SeqType = 1;
BodyView();
}
else if (!::_stricmp( lpszControlID, "button_zoom_2" ))
{
m_SeqType = 2;
BodyView();
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE:
{
LimitMoveWnd();
// 라크.
RefreshChaos();
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE, GetRect().left, GetRect().bottom ) ); //servantes 2010.11.18
// // 윈도우 위치지정. //servantes 2010.11.18
// KRect rt = this->GetRect();
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, rt.right - 6, rt.top ) ); // 인벤토리.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, rt.left, rt.bottom - 6 ) ); // 조합.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, rt.left, rt.bottom - 6 ) ); // 강화.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, rt.left, rt.bottom - 6 ) ); // 수리.
///m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE, GetRect().left, GetRect().bottom ) );
}
break;
case::KUI_MESSAGE::KICON_RCLICK:
{
// 팝업메뉴열기.
ShowPopupEquipment( lpszControlID, lparam, wparam );
}
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
// 팝업메뉴열기.
void SUIEquipmentWnd::ShowPopupEquipment( const char * pStr, int x, int y )
{
int nType = EQUIPMENT_INFO::EQUIPMENT_NONE;
int nSlotIndex = GetSlotIndex( pStr );
if( nSlotIndex > -1 )
{
AR_HANDLE hItem = 0;
ItemBase::ItemWearType wear_type = GetEquipSlotWearType( pStr );
// 일반 or 상급 장비.
if( nSlotIndex < 12 && nSlotIndex != 7 )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( wear_type );
if( pSlot )
{
hItem= pSlot->GetHandle();
// 내구도가 존재하면서 내구도가 손상된 장비.
int nMax = pSlot->getMaxEtherealDurability();
if( nMax > 0 && pSlot->GetEtherealDurability() < nMax )
nType = EQUIPMENT_INFO::EQUIPMENT_UPPER;
// 내구도가 없거나 내구도가 손상되지 않은 장비.
else
nType = EQUIPMENT_INFO::EQUIPMENT_NORMAL;
}
}
// 꾸미기 장비.
else if( nSlotIndex > 12 && nSlotIndex < 23 )
{
nType = EQUIPMENT_INFO::EQUIPMENT_DECORATE;
}
//
else
nType = EQUIPMENT_INFO::EQUIPMENT_NONE;
//servantes 2010.11.30
int nGap = 17;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_EQUIPMENT_POPUP_WNDMSG( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, hItem, nType, wear_type ) ); // Data 전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, false ) ); // 이전팝업 Wnd 닫기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, x + nGap, y ) ); // 위치이동.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, true ) ); // 팝업 Wnd 열기.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_EQUIPMENT_POPUP_WNDMSG( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, hItem, nType, wear_type ) ); // Data 전달.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, false ) ); // 이전팝업 Wnd 닫기.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, x, y ) ); // 위치이동.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT_POPUP, true ) ); // 팝업 Wnd 열기.
}
}
bool SUIEquipmentWnd::AbleSubSlot( class SInventorySlot* pSlot )
{
if(pSlot == NULL)
return false;
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 );
}
bool SUIEquipmentWnd::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 );
}
void SUIEquipmentWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_ITEM_INVEN:
{
RefreshEquipItems();
RefreshBeltSlot();
// 아이템 툴팁 갱신.
RefreshLendingItemTooltip();
// 2010.08.20 - prodongi
refreshBeltSlotBossCardGage();
/// 2010.11.01 - prodongi
refreshBeltSlotItemToolTip();
// 탈것 아이콘.
RefreshRideIcon();
}
break;
case MSG_STAT_INFO:
case MSG_ITEM_WEAR:
case MSG_ITEM_WEAR_INFO:
{
RefreshEquipItems();
RefreshBeltSlot();
// 꾸미기아이템 보임,숨김 아이콘처리.
DecoEquipmentChange();
// 탈것 아이콘.
RefreshRideIcon();
// 아이템 툴팁 갱신.
RefreshLendingItemTooltip();
}
break;
case MSG_BELT_SLOT_INFO:
{
RefreshBeltSlot();
}
break;
case MSG_LEVEL_UPDATE:
RefreshEquipItems();
break;
case MSG_PROPERTY:
{
SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg;
//if( m_PlayerInfoMgr.IsLocalPlayer(pPropertyMsg->handle) )
//{
switch( pPropertyMsg->nPropertyType )
{
case SMSG_PROPERTY::PROPERTY_LEVEL: // 아이템 툴팁 갱신
RefreshEquipItems();
break;
case SMSG_PROPERTY::PROPERTY_CHAOS:
case SMSG_PROPERTY::PROPERTY_MAX_CHAOS:
RefreshChaos();
break;
}
//}
}
break;
/*case IMSG_UI_STATE_UPDATE:
{
RefreshLendingItemTooltip();
}
break;*/
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = (SIMSG_UI_MOVE*)pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY - GetRect().GetHeight() );
pMsg->bUse = true;
}
break;
// 꾸미기아이템 보임,숨김 변경.
case IMSG_DECO_VISIBILITY_CHANGE:
{
pMsg->bUse = true;
SIMSG_DECO_VISIBILITY_CHANGE * pData = dynamicCast< SIMSG_DECO_VISIBILITY_CHANGE * >( pMsg );
// 꾸미기아이템 보임,숨김 아이콘처리.
DecoEquipmentChange();
}
break;
case IMSG_UI_MAINPLAYER_INFO:
{
SetSeqForm( (SIMSG_UI_MAINPLAYER_INFO*)pMsg );
pMsg->bUse = true;
}
break;
case IMSG_UI_MAINPLAYER_CAM_POS:
{
SIMSG_UI_MAINPLAYER_CAM_POS* pCamMsg = (SIMSG_UI_MAINPLAYER_CAM_POS*)pMsg;
/*KUIControl3DStatic* pStaticTarget = (KUIControl3DStatic*)GetChild( "body_view" );
if( NULL != pStaticTarget )
{
pStaticTarget->SetCamPos( pCamMsg->pos );
}*/
if( m_pStaticTarget )
m_pStaticTarget->SetCamPos( pCamMsg->pos );
pMsg->bUse = true;
}
break;
case IMSG_UI_MAINPLAYER_CAM_TARGET_POS:
{
SIMSG_UI_MAINPLAYER_CAM_TARGET_POS* pCamMsg = (SIMSG_UI_MAINPLAYER_CAM_TARGET_POS*)pMsg;
//KUIControl3DStatic* pStaticTarget = (KUIControl3DStatic*)GetChild( "body_view" );
//if( NULL != pStaticTarget )
if( m_pStaticTarget )
{
m_pStaticTarget->SetCamTargetPos( pCamMsg->pos );
}
pMsg->bUse = true;
}
break;
case IMSG_UI_MAINPLAYER_LIGHT_DIR:
{
SIMSG_UI_MAINPLAYER_LIGHT_DIR* pDirMsg = (SIMSG_UI_MAINPLAYER_LIGHT_DIR*)pMsg;
// KUIControl3DStatic* pStaticTarget = (KUIControl3DStatic*)GetChild( "body_view" );
// if( NULL != pStaticTarget )
if( m_pStaticTarget )
{
m_pStaticTarget->SetLightDirection( pDirMsg->pos.x, pDirMsg->pos.y, pDirMsg->pos.z );
}
pMsg->bUse = true;
}
break;
case IMSG_UI_MAINPLAYER_LIGHT :
{
SIMSG_UI_MAINPLAYER_LIGHT* pColorMsg = (SIMSG_UI_MAINPLAYER_LIGHT*)pMsg;
//KUIControl3DStatic* pStaticTarget = (KUIControl3DStatic*)GetChild( "body_view" );
//if( NULL != pStaticTarget )
if( m_pStaticTarget )
{
if( pColorMsg->mode == SIMSG_UI_MAINPLAYER_LIGHT::COLOR_AMBIENT )
m_pStaticTarget->SetLightAmbientColor( pColorMsg->color );
else if( pColorMsg->mode == SIMSG_UI_MAINPLAYER_LIGHT::COLOR_DIFFUSE )
m_pStaticTarget->SetLightDiffuseColor( pColorMsg->color );
else if( pColorMsg->mode == SIMSG_UI_MAINPLAYER_LIGHT::COLOR_SPECULAR )
m_pStaticTarget->SetLightSpecularColor( pColorMsg->color );
}
pMsg->bUse = true;
}
break;
// 2010.08.24 - prodongi
case IMSG_MOUSEMOVE:
{
SIMSG_MOUSEMOVE* pMouseMove = (SIMSG_MOUSEMOVE* )pMsg;
int mx = ((int)(short)LOWORD(pMouseMove->lParam));
int my = ((int)(short)HIWORD(pMouseMove->lParam));
procBeltSlotEnchantIcon(mx, my);
}
break;
// 아이템합성 진행률출력 윈도우에서 진행완료 전달.
case IMSG_SYNTHETIC_ITEM:
{
// 전체수리.
AllRepair();
}
break;
// 해상도변경.
case IMSG_UI_CHANGE_RESOLUTION:
{
//servantes 2010.11.25
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY,
// this->GetRect().right, this->GetRect().top ) ); // 인벤토리 위치지정.
//
// // [수리], [조합], [강화] 윈도우 위치지정.
// KRect rt = this->GetRect();
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, rt.left, rt.bottom ) ); // 조합.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, rt.left, rt.bottom ) ); // 강화.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, rt.left, rt.bottom ) ); // 수리.
}
break;
/*case IMSG_HOTKEY_EX:
{
SIMSG_HOTKEY_EX* pHotKey = static_cast<SIMSG_HOTKEY_EX*>(pMsg);
if( pHotKey->wParam == VK_SHIFT )
m_bShiptKey = (pHotKey->bUp == 0);
if( pHotKey->wParam == VK_CONTROL ) //servantes 2010.10.15
m_bControlKey = (pHotKey->bUp == 0);
if( pHotKey->wParam == VK_MENU )
m_bAltKey = (pHotKey->bUp == 0);
}
break;*/
}
}
void SUIEquipmentWnd::RefreshChaos()
{
int nChaos = m_PlayerInfoMgr.GetPlayerInfo().GetChaos();
int nMaxChaos = m_PlayerInfoMgr.GetPlayerInfo().GetMax_chaos();
if( m_pChaos && m_pLac )
{
//m_pLac->SetCaption( CStringUtil::StringFormat( "%s<vcenter>%d / %d", S(6425), nChaos, nMaxChaos ).c_str() );
m_pLac->SetCaption( CStringUtil::StringFormat( "%s<right>%d / %d", m_strDeco.c_str(), nChaos, nMaxChaos ).c_str() );
/*KUIControlChaosGauge * pChaosGauge = (KUIControlChaosGauge *)GetChild( "guage_purple" );
if( pChaosGauge )
{
int nPercent = (nMaxChaos>0) ? ((float)nChaos/nMaxChaos*100) : 0;
pChaosGauge->SetPercent( nPercent );
}*/
KRect rt = m_pChaos->GetRect(); // ClipRect();
if( nMaxChaos > 0 )
rt.right = rt.left + (float)m_ChaosWidth * ( (float)nChaos/(float)nMaxChaos );
else
rt.right = rt.left;
// 2011.04.21 - servantes : matis - 13049
m_pChaos->Resize( rt );
}
}
//void SUIEquipmentWnd::DisableControls()
//{
// // 모든 컨트롤 하이디`~~~
// for( int nSlot( 0 ); nSlot < c_nMaxInvenSimpleMaxSlotCount; ++nSlot )
// {
// SetChildShow( CStringUtil::StringFormat( "icon_item%02d" , nSlot ).c_str(), false );
//// SetChildShow( CStringUtil::StringFormat( "static_item%02d" , nSlot ).c_str(), false );
// SetChildShow( CStringUtil::StringFormat( "static_itemcount%02d", nSlot ).c_str(), false );
// }
// SetChildShow( "static_iconselection", false );
// SetChildShow( "static_selection" , false );
//}
void SUIEquipmentWnd::RefreshBeltSlot()
{
// 2010.08.20 - prodongi
m_beltSlotBossCardInfo.clear();
//std::string gageName, gageBackName;
// 2010.08.25 - prodongi
int beltSlotCount = getBeltSlotCount();
SInventorySlot* pBeltSlot = m_InventoryMgr.GetItemInfo(ItemBase::WEAR_BELT);
for( int i(0); c_nBeltSlot_Cnt>i; i++ )
{
AR_HANDLE hItem = m_InventoryMgr.GetBeltSlot( i );
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
// 2010.08.25 외부로 이동- prodongi
//SInventorySlot* pBeltSlot = m_InventoryMgr.GetItemInfo(ItemBase::WEAR_BELT);
// 벨트 슬롯 컨트롤
// 2010.08.20 - prodongi
//KUIControlMultiIcon* pEquipControl = (KUIControlMultiIcon*)GetChild( CStringUtil::StringFormat("icon_beltcarslot_%02d", i+1).c_str() );
KUIControlMultiIcon* pEquipControl = m_arrBeltMultiIcon[i];
if( pEquipControl )
{
ResetMultiIcon( pEquipControl, 0, 8 );
// 2010.08.20 - prodongi
//bool gageShow = false;
//gageName = CStringUtil::StringFormat("gauge_repair_line_yellowgreen_%02d", i+13);
//gageBackName = CStringUtil::StringFormat("guage_base_%02d", i+12);
if( pSlot )
{
//gmpbigsun(20130327) :장착장 봉카 표시
if( false == setSummonCardIcon( pEquipControl, pSlot ) )
{
std::string iconName;
getIconNameAtDurability(pSlot, iconName);
//pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) );
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, iconName.c_str() );
}
//std::string iconName;
//getIconNameAtDurability(pSlot, iconName);
////pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) );
//pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, iconName.c_str() );
//// 2010.08.19, initControl에서 설정 해줬음 - prodongi
////pEquipControl->SetIcon( 1 );
////1. 등급마크
//getIconNameSummonCard_BORDER( iconName, pSlot->GetSummonID(), pSlot->GetEnhance(), pSlot->GetEtherealDurability() );
//pEquipControl->SetIcon( 1, c_szDEF_SPR_NAME, iconName.c_str() );
////2. 강화마크
//getIconNameSummonCard_ENHANCE( iconName, pSlot->GetEnhance() );
//pEquipControl->SetIcon( 4, c_szDEF_SPR_NAME, iconName.c_str() );
////3. 진화마크
//getIconNameSummonCard_EVOLUTION( iconName, pSlot->GetSummonID() );
//pEquipControl->SetIcon( 5, c_szDEF_SPR_NAME, iconName.c_str() );
EquipItemAddtionalIconSetter icon_setter( pEquipControl, pSlot );
pEquipControl->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
// 2010.08.20 - prodongi
if(GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_BOSSCARD)
{
m_beltSlotBossCardInfo = sBeltSlotBossCardInfo(hItem, i);
//gageShow = true;
}
}
else
{
// 빈 슬롯
if( pBeltSlot ) //벨트를 착용하고 있다면
{
// 2010.08.25 - prodongi
/*
int nType; double fVar1; double fVar2;
if( GetItemDB().GetOptionVar( pBeltSlot->GetItemCode(), 0, nType, fVar1, fVar2 ) ) //슬롯갯수를 얻어온다
{
if( i < (int)fVar1 ) //슬롯 갯수에 따른 아이콘 쎄팅
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_nocardicon" );
else pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, "static_inventory_beltslot" );
}
*/
if( i < beltSlotCount ) //슬롯 갯수에 따른 아이콘 쎄팅
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, "common_panel_titanium_slot_beltslot_open" );
else
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, "common_panel_titanium_slot_beltslot" );
}
else pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, "common_panel_titanium_slot_beltslot" );
// 2010.08.19, initControl에서 설정 해줬음 - prodongi
pEquipControl->SetLazyTooltip();
// 2010.08.18 test - prodongi
pEquipControl->SetTooltip(S(3357+i));
}
// 2010.08.20 - prodongi
//SetChildShow(gageName.c_str(), gageShow);
//SetChildShow(gageBackName.c_str(), gageShow);
}
}
// 2010.08.20 - prodongi
refreshBeltSlotBossCardGage();
}
#ifdef DECO
void SUIEquipmentWnd::RefreshEquipItems()
{
std::string strTooltip;
for( int nWearType = 0; nWearType < ItemBase::MAX_ITEM_WEAR; nWearType++ )
{
// 2011.11.29 - servantes : 유효한 파일 이름인지 길이로 검사
if( strlen( c_EquipSetNames[ nWearType ] ) <= 0)
continue;
GetEquipTooltip(nWearType, strTooltip);
RefreshEquipItem( c_EquipSetNames[ nWearType ], c_EquipAniNames[nWearType], m_InventoryMgr.GetItemInfo(nWearType), strTooltip.c_str(), nWearType );
}
}
void SUIEquipmentWnd::GetEquipTooltip( int nWearType, std::string& rTooltip )
{
rTooltip = "Tooltip";
switch( nWearType )
{
case ItemBase::WEAR_WEAPON: rTooltip = S(7198); break;
case ItemBase::WEAR_SHIELD: rTooltip = S(7199); break;
case ItemBase::WEAR_ARMOR: rTooltip = S(7194); break;
case ItemBase::WEAR_HELM: rTooltip = S(7192); break;
case ItemBase::WEAR_GLOVE: rTooltip = S(7196); break;
case ItemBase::WEAR_BOOTS: rTooltip = S(7197); break;
case ItemBase::WEAR_BELT: rTooltip = S(7200); break;
case ItemBase::WEAR_MANTLE: rTooltip = S(7195); break;
case ItemBase::WEAR_ARMULET: rTooltip = S(7201); break;
case ItemBase::WEAR_RING: rTooltip = S(7203); break;
case ItemBase::WEAR_RING+1: rTooltip = S(7203); break;
case ItemBase::WEAR_EAR: rTooltip = S(7202); break;
case ItemBase::WEAR_FACE: rTooltip = S(7193); break;
case ItemBase::WEAR_BACKPACK: rTooltip = S(6461); break;
case ItemBase::WEAR_BOOSTER: rTooltip = S(7256); break;
case ItemBase::WEAR_BACKBOARD: rTooltip = S(7257); break;
case ItemBase::WEAR_SECOND_EAR: rTooltip = S(7202); break;
case ItemBase::WEAR_CHAOS_STONE: rTooltip = S(10804000); break;
case ItemBase::WEAR_DECO_WEAPON: rTooltip = S(7198); break;
case ItemBase::WEAR_DECO_SHIELD: rTooltip = S(7199); break;
case ItemBase::WEAR_DECO_ARMOR: rTooltip = S(7206); break;
case ItemBase::WEAR_DECO_HELM: rTooltip = S(7204); break;
case ItemBase::WEAR_DECO_GLOVE: rTooltip = S(7208); break;
case ItemBase::WEAR_DECO_BOOTS: rTooltip = S(7209); break;
case ItemBase::WEAR_DECO_MANTLE: rTooltip = S(7207); break;
case ItemBase::WEAR_DECO_SHOULDER: rTooltip = S(7210); break;
case ItemBase::WEAR_RIDE_ITEM: rTooltip = S(7213); break;
case ItemBase::WEAR_BAG_SLOT: rTooltip = S(6461); break;
case ItemBase::WEAR_SWAP_WEAPON: rTooltip = S(7231); break;
case ItemBase::WEAR_SWAP_SHIELD: rTooltip = S(7232); break;
case ItemBase::WEAR_SWAP_DECO_WEAPON: rTooltip = S(7231); break;
case ItemBase::WEAR_SWAP_DECO_SHIELD: rTooltip = S(7232); break;
}
}
#endif
#ifndef DECO
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void SUIEquipmentWnd::RefreshEquipItems()
{
for( int nWearType = 0; nWearType < ItemBase::MAX_ITEM_WEAR; nWearType++ )
RefreshEquipItem( c_EquipSetNames[ nWearType ], c_EquipAniNames[nWearType], m_pInvenMgr->GetItemInfo(nWearType) );
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
void SUIEquipmentWnd::RefreshLendingItemTooltip()
{
//KUIControlMultiIcon* pIcon = NULL;
//int nVisibleSlotCount = (m_nInvenSlotCountY * m_nInvenSlotcountX);
//int nMaxCount = (m_nInvenSlotCountY+1) * m_nInvenSlotcountX; //한번에 두개가 줄어 드는 경우엔 버그..
//for( int nSlot( 0 ); nSlot < c_nMaxInvenSimpleMaxSlotCount/*nMaxCount*/; ++nSlot )
//{
// SInventorySlot* pSlot = m_pInventoryWnd->GetInvenItem(nSlot);
// if( !pSlot || pSlot->GetItem()->remain_time <= 0 ) continue;
// pIcon = ( KUIControlMultiIcon* )GetChild( CStringUtil::StringFormat("icon_item%02d", nSlot).c_str() );
// if( pIcon == NULL ) continue;
// if( nSlot >= nVisibleSlotCount )
// {
// continue;
// }
// if( pSlot )
// {
// pIcon->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
// }
//}
// 내구도.
KUIControlMultiIcon * pMultiIcon = NULL;
float per = 1.0f, ethereal = 0.0f;
SInventorySlot * pSlot = NULL;
for( int nWearType = 0; nWearType < g_nGauge; ++nWearType )
{
// 망토 제외.
if( nWearType == 7 )
pSlot = m_InventoryMgr.GetItemInfo( ItemBase::WEAR_SECOND_EAR );
else
pSlot = m_InventoryMgr.GetItemInfo( nWearType );
per = 1.0f;
// 장비중.
if( pSlot )
{
//// 내구도 게이지.
const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( pSlot->GetItemCode() );
if(pItemBase)
{
// 상급아이템.
if(pSlot->getMaxEtherealDurability() > 0)
{
ethereal = (float)pSlot->GetEtherealDurability();//>GetItem()->ethereal_durability;
if( ethereal > 0.0f )
{
per = ethereal / (float)pSlot->getMaxEtherealDurability();
//per = per > 0.99f ? 1.0f : per;
if( ( (float)pSlot->getMaxEtherealDurability() / 10000.0f ) - ( ethereal / 10000.0f ) < 1.0f )
per = 1.0f;
}
// 파괴된 아이템에 파괴아이콘 적용.
else
{
//per = 0.0f;
pMultiIcon = m_arrMultiIcon[ nWearType ];
if( pMultiIcon )
{
EquipItemAddtionalIconSetter icon_setter( pMultiIcon, pSlot );
}
}
}
}
/*KRect rt = m_arrDrabilityGauge[ nWearType ]->GetRect();
rt.right = rt.left + m_fDurabilityGaugeW * per;
m_arrDrabilityGauge[ nWearType ]->Resize( rt );*/
//per = 1.0f;
//ethereal = 0.0f;
}
KRect rt = m_arrDrabilityGauge[ nWearType ]->GetRect();
rt.right = rt.left + m_fDurabilityGaugeW * per;
m_arrDrabilityGauge[ nWearType ]->Resize( rt );
//
// 내구도게이지 출력설정.( % 에 따른 색상변경, 아이템종류에 따른 아이콘 출력 )
RefreshDurability( pSlot, nWearType );
}
// 장비창의 모든 장비아이템 툴팁 갱신.
/// 2010.11.01 벨트 슬롯의 wearpos는 ItemBase::MAX_ITEM_WEAR와 안 맞는것 같음 - prodongi
//int size = ItemBase::MAX_ITEM_WEAR + c_nBeltSlot_Cnt;
int size = ItemBase::MAX_ITEM_WEAR;// + c_nBeltSlot_Cnt;
for( int i=0; i<size; ++i )
{
pSlot = m_InventoryMgr.GetItemInfo( i );
if( pSlot && m_arrMultiIcon[ i ] )
m_arrMultiIcon[ i ]->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
}
}
/// 2010.11.01 - prodongi
void SUIEquipmentWnd::refreshBeltSlotItemToolTip()
{
/// 2010.11.01 벨트 툴팁 갱신
for(int i = 0; c_nBeltSlot_Cnt>i; i++ )
{
AR_HANDLE hItem = m_InventoryMgr.GetBeltSlot( i );
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if (pSlot)
{
KUIControlMultiIcon* pEquipControl = m_arrBeltMultiIcon[ i ];
if (pEquipControl)
{
EquipItemAddtionalIconSetter icon_setter( pEquipControl, pSlot );
}
}
}
}
#ifdef DECO
void SUIEquipmentWnd::RefreshEquipItem( const char* szControlID, const char* defAniName, SInventorySlot* pSlot, const char* lpTooltip, int wearType )
{
// 장착 슬롯 컨트롤
KUIControlMultiIcon* pEquipControl = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
if( pEquipControl )
{
ResetMultiIcon( pEquipControl, 0, 8 );
if( pSlot )
{
//TODO : 하드코딩
/// 2011.08.03 - prodongi
if( !setSkillCardIcon(pEquipControl, pSlot->GetItemCode()) && !setSummonCardIcon( pEquipControl, pSlot ) )
{
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) );
}
pEquipControl->SetIcon( 1, c_szDEF_SPR_NAME, pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL );
EquipItemAddtionalIconSetter icon_setter( pEquipControl, pSlot );
pEquipControl->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
//// 내구도 게이지 적용.
if( wearType != 7 && wearType < g_nGauge )
{
float per = 0.0f;
int nMax = pSlot->getMaxEtherealDurability();
if( nMax > 0)
{
int ethereal = pSlot->GetEtherealDurability();
if( ethereal > 0 )
per = (float)ethereal / (float)nMax;
}
KRect rt = m_arrDrabilityGauge[ wearType ]->GetRect();
rt.right = rt.left + m_fDurabilityGaugeW * per;
m_arrDrabilityGauge[ wearType ]->Resize( rt );
}
}
else
{
// 빈 슬롯
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, defAniName );
if( lpTooltip )
pEquipControl->SetLazyTooltip( new KLazyTip( lpTooltip ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
else
pEquipControl->SetLazyTooltip();
//// 내구도 게이지 적용.
if( wearType != 7 && wearType < g_nGauge )
{
KRect rt = m_arrDrabilityGauge[ wearType ]->GetRect();
rt.right = rt.left;
m_arrDrabilityGauge[ wearType ]->Resize( rt );
}
}
}
}
#endif
#ifndef DECO
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void SUIInventoryWnd::RefreshEquipItem( const char* szControlID, const char* defAniName, SInventorySlot* pSlot )
{
// 장착 슬롯 컨트롤
KUIControlMultiIcon* pEquipControl = (dynamicCast<UIControlMultiIcon*>(GetChild( szControlID ));
if( pEquipControl )
{
ResetMultiIcon( pEquipControl, 0, 8 );
if( pSlot )
{
//TODO : 하드코딩
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) );
pEquipControl->SetIcon( 1, c_szDEF_SPR_NAME, pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL );
pEquipControl->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
}
else
{
// 빈 슬롯
pEquipControl->SetIcon( 0, c_szDEF_SPR_NAME, defAniName );
pEquipControl->SetTooltip();
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
ItemBase::ItemWearType SUIEquipmentWnd::GetEquipSlotWearType( const char* szEquipControlID )
{
ItemBase::ItemWearType WearType = ItemBase::WEAR_NONE;
if( 0 == ::_stricmp( szEquipControlID, "icon_weapon" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_WEAPON );
else if( 0 == ::_stricmp( szEquipControlID, "icon_shield" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_SHIELD );
else if( 0 == ::_stricmp( szEquipControlID, "icon_armor" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_ARMOR );
else if( 0 == ::_stricmp( szEquipControlID, "icon_helm" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_HELM );
else if( 0 == ::_stricmp( szEquipControlID, "icon_glove" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_GLOVE );
else if( 0 == ::_stricmp( szEquipControlID, "icon_boots" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BOOTS );
else if( 0 == ::_stricmp( szEquipControlID, "icon_belt" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT );
else if( 0 == ::_stricmp( szEquipControlID, "icon_cloak" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_MANTLE );
else if( 0 == ::_stricmp( szEquipControlID, "icon_neck" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_ARMULET );
else if( 0 == ::_stricmp( szEquipControlID, "icon_ring" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_RING );
else if( 0 == ::_stricmp( szEquipControlID, "icon_ring02" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_RING + 1);
else if( 0 == ::_stricmp( szEquipControlID, "icon_ear" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_EAR );
else if( 0 == ::_stricmp( szEquipControlID, "icon_face" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_FACE );
else if( 0 == ::_stricmp( szEquipControlID, "icon_boost_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BOOSTER );
else if( 0 == ::_stricmp( szEquipControlID, "icon_emblem_deco") ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BACKBOARD );
else if( 0 == ::_stricmp( szEquipControlID, "icon_ear_01" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_SECOND_EAR );
else if( 0 == ::_stricmp( szEquipControlID, "icon_chaos_stone" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_CHAOS_STONE );
#ifdef DECO
else if( 0 == ::_stricmp( szEquipControlID, "icon_backpack" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BACKPACK ); // nui와 이름이 맞지 않아서 수정. kappamind, 2010.01.18
else if( 0 == ::_stricmp( szEquipControlID, "icon_weapon_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_WEAPON );
else if( 0 == ::_stricmp( szEquipControlID, "icon_shield_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_SHIELD );
else if( 0 == ::_stricmp( szEquipControlID, "icon_armor_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_ARMOR );
else if( 0 == ::_stricmp( szEquipControlID, "icon_helm_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_HELM );
else if( 0 == ::_stricmp( szEquipControlID, "icon_glove_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_GLOVE );
else if( 0 == ::_stricmp( szEquipControlID, "icon_boots_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_BOOTS );
else if( 0 == ::_stricmp( szEquipControlID, "icon_cloak_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_MANTLE );
else if( 0 == ::_stricmp( szEquipControlID, "icon_shoulder_deco" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_DECO_SHOULDER );
#endif
#ifndef DECO
//////////////////////////////////////////////////////////////////////////////////////////////////
else if( 0 == ::_stricmp( szEquipControlID, "icon_hairacc" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_MOUTH );
//////////////////////////////////////////////////////////////////////////////////////////////////
#endif
// 2010.08.20 - prodongi
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_01" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT00 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_02" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT01 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_03" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT02 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_04" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT03 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_05" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT04 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_06" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT05 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_07" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT06 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot_08" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT07 );
return WearType;
}
void SUIEquipmentWnd::BodyView()
{
// KUIControl3DStatic* pStaticTarget = (KUIControl3DStatic*)GetChild( "body_view" );
if( m_pStaticTarget )
{
const KRect& rRect = m_pStaticTarget->GetRect();
const char* bCobName = g_pCurrentGameSystem->GetLocalPlayer()->GetCobFileName();
K3DVertex pos = GetSeqPos( bCobName );
K3DVertex tg_pos = GetSeqTargetPos( bCobName );
m_pStaticTarget->SetAutoTargetMode( false );
m_pStaticTarget->SetFullExpression( true );
m_pStaticTarget->SetAniName( "" );
m_pStaticTarget->SetSeqForm( g_pCurrentGameSystem->GetLocalPlayer()->GetSeqForm(), KSize( rRect.GetWidth(), rRect.GetHeight() ), TS_ENTER::GAME_PLAYER, pos );
m_pStaticTarget->SetCamPos( pos );
m_pStaticTarget->SetCamTargetPos( tg_pos );
m_pStaticTarget->SetEnableLight( true );
//m_hLocal = pMsg->handle;
}
}
void SUIEquipmentWnd::SetSeqForm( struct SIMSG_UI_MAINPLAYER_INFO* pMsg )
{
if( m_pStaticTarget )
{
const KRect& rRect = m_pStaticTarget->GetRect();
if( pMsg->bRefresh )
{
//m_pStaticTarget->SetCameBoneIndex( DETAIL_PELVIS );
m_pStaticTarget->SetAutoTargetMode( false );
m_pStaticTarget->SetFullExpression( true );
if( pMsg->pAniName )
m_pStaticTarget->SetAniName( pMsg->pAniName );
else
m_pStaticTarget->SetAniName( "" );
K3DVertex pos = GetSeqPos( pMsg->pCobName );
K3DVertex tg_pos = GetSeqTargetPos( pMsg->pCobName );
m_pStaticTarget->SetSeqForm( pMsg->pSeqForm, KSize( rRect.GetWidth(), rRect.GetHeight() ), TS_ENTER::GAME_PLAYER, pos );
m_pStaticTarget->SetCamPos( pos );
m_pStaticTarget->SetCamTargetPos( tg_pos );
m_pStaticTarget->SetEnableLight( true );
m_hLocal = pMsg->handle;
}
}
}
K3DVertex SUIEquipmentWnd::GetSeqPos( const char * szRace )
{
switch (m_SeqType)
{
case 0:
if (strstr( szRace, "asf" )) return K3DVertex( 0, -17, 15 );
else if (strstr( szRace, "asm" )) return K3DVertex( 0, -17, 16.25f );
else if (strstr( szRace, "def" )) return K3DVertex( 0, -17, 15 );
else if (strstr( szRace, "dem" )) return K3DVertex( 0, -17, 16.25f );
else if (strstr( szRace, "gaf" )) return K3DVertex( 0, -17, 14 );
else if (strstr( szRace, "gam" )) return K3DVertex( 0, -17, 16 );
break;
case 1:
if (strstr( szRace, "asf" )) return K3DVertex( 0, -8.5f, 13.5f );
else if (strstr( szRace, "asm" )) return K3DVertex( 0, -9.5f, 15 );
else if (strstr( szRace, "def" )) return K3DVertex( 0, -8.5f, 13.5f );
else if (strstr( szRace, "dem" )) return K3DVertex( -0.6f, -8.25f, 15.75f );
else if (strstr( szRace, "gaf" )) return K3DVertex( 0, -8.5f, 13 );
else if (strstr( szRace, "gam" )) return K3DVertex( 0, -8.25f, 15 );
break;
case 2:
if (strstr( szRace, "asf" )) return K3DVertex( 0, -1, 15.15f );
else if (strstr( szRace, "asm" )) return K3DVertex( 0, -4, 16.75f );
else if (strstr( szRace, "def" )) return K3DVertex( 0, -4, 15.25f );
else if (strstr( szRace, "dem" )) return K3DVertex( -0.8f, -4.25f, 17 );
else if (strstr( szRace, "gaf" )) return K3DVertex( 0, -4, 14.5f );
else if (strstr( szRace, "gam" )) return K3DVertex( 0, -5, 16 );
break;
}
return K3DVertex( 0, 0, 0 );
}
K3DVertex SUIEquipmentWnd::GetSeqTargetPos( const char* szRace )
{
switch (m_SeqType)
{
case 0:
if (strstr( szRace, "asf" )) return K3DVertex( 0, 0, 11 );
else if (strstr( szRace, "asm" )) return K3DVertex( 0, 0, 12.25f );
else if (strstr( szRace, "def" )) return K3DVertex( 0, 0, 11 );
else if (strstr( szRace, "dem" )) return K3DVertex( -0.5f, 0, 12.25f );
else if (strstr( szRace, "gaf" )) return K3DVertex( 0, 0, 10 );
else if (strstr( szRace, "gam" )) return K3DVertex( -1, 0, 12 );
break;
case 1:
if (strstr( szRace, "asf" )) return K3DVertex( 0, 0, 13.5f );
else if (strstr( szRace, "asm" )) return K3DVertex( 0, 0, 15 );
else if (strstr( szRace, "def" )) return K3DVertex( 0, 0, 13.5f );
else if (strstr( szRace, "dem" )) return K3DVertex( -1.2f, 0, 15.75f );
else if (strstr( szRace, "gaf" )) return K3DVertex( 0, 0, 13 );
else if (strstr( szRace, "gam" )) return K3DVertex( -1, 0, 15 );
break;
case 2:
if (strstr( szRace, "asf" )) return K3DVertex( 0.3f, 0, 15.15f );
else if (strstr( szRace, "asm" )) return K3DVertex( 0, 0, 16.75f );
else if (strstr( szRace, "def" )) return K3DVertex( -0.1f, 0, 15.25f );
else if (strstr( szRace, "dem" )) return K3DVertex( -1.1f, 0, 17 );
else if (strstr( szRace, "gaf" )) return K3DVertex( 0.2f, 0, 14.5f );
else if (strstr( szRace, "gam" )) return K3DVertex( -1, 0, 16 );
break;
}
return K3DVertex( 0, 0, 0 );
}
void SUIEquipmentWnd::ReqSwapItem( AR_HANDLE hBEGIN_DRAG, AR_HANDLE hRECV_DROP )
{
if( hBEGIN_DRAG && hRECV_DROP )
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_CHANGE_ITEM_POSITION(false, hBEGIN_DRAG, hRECV_DROP) );
}
// Weapon swap
void SUIEquipmentWnd::WeaponSwap()
{
SGameWorld* pGameWorld = dynamicCast<SGameWorld*>(m_pGameManager->GetActiveGame());
if (pGameWorld)
{
// Send message
pGameWorld->sendSwapEquipPendMessage();
// this->m_pGameManager->PendMessage( &TS_CS_SWAP_EQUIP() );
}
}
// 꾸미기장비 전체토글.
void SUIEquipmentWnd::AllDecoEquipmentToggle()
{
unsigned int nHideEquip = g_pCurrentGameSystem->GetLocalPlayer()->getHideEquipInfo();
// 개별상태가 아니면 토글.
if( IsAllDecoHide() > 0 )
nHideEquip ^= DECO_EQUIPMENT_MASK;
// 개별상태. ( 한개이상 보이는 상태이므로 모두숨김상태로 변경. )
else
nHideEquip = ( !DECO_EQUIPMENT_MASK );
//int result = IsAllDecoHide();
//switch( result )
//{
// // 개별상태. ( 한개이상 보이는 상태이므로 모두숨김상태로 변경. )
//case 0 : nHideEquip = ( !DECO_EQUIPMENT_MASK );
// break;
//// 모두보임.
//case 1 :
// break;
//// 모두숨김.
//case 2 :
// break;
//}
// 메세지전송.
TS_CS_HIDE_EQUIP_INFO info;
info.nHideEquipFlag = nHideEquip;
m_pGameManager->PendMessage( &info );
// 0 개별상태, 1 모두보임, 2 모두숨김.
}
// 꾸미기아이템 보임,숨김 아이콘처리.
void SUIEquipmentWnd::DecoEquipmentChange()
{
unsigned int nHideEquip = g_pCurrentGameSystem->GetLocalPlayer()->getHideEquipInfo();
// 개별 아이콘 처리.
KUIControlMultiIcon * pIconControl;
for( int i=ItemBase::WEAR_DECO_WEAPON; i<=ItemBase::WEAR_DECO_SHOULDER; ++i )
{
pIconControl = dynamicCast<KUIControlMultiIcon*>(GetChild( c_EquipSetNames[ i ] ));
if( pIconControl )
{
//ResetMultiIcon( pIconControl, 0, 8 );
SInventorySlot * pSlot = m_InventoryMgr.GetItemInfo( i );
/*if( pSlot && nHideEquip & (1 << i) )
{
pIconControl->SetIcon( 3, c_szDEF_SPR_NAME, "common_mark_titanium_costumeoff" );
}*/
if( pSlot )
{
if( nHideEquip & (1 << i) )
{
pSlot->SetShowDecoration( true );
pIconControl->SetIcon( 3, c_szDEF_SPR_NAME, "common_mark_titanium_costumeoff" );
}
else
{
pSlot->SetShowDecoration( false );
pIconControl->SetIcon( 3, c_szDEF_SPR_NAME, NULL );
}
}
else
{
pIconControl->SetIcon( 3, c_szDEF_SPR_NAME, NULL );
}
}
}
// 모두 보임,숨김 버튼 처리.
if( m_pBtnAllDecoView )
{
// 0 개별상태, 1 모두보임, 2 모두숨김.
m_pBtnAllDecoView->SetAniName( g_DecoView[ IsAllDecoHide() ] );
}
}
//#endif
// 2010.08.20 - prodongi
void SUIEquipmentWnd::refreshBeltSlotBossCardGage()
{
if (0 == m_beltSlotBossCardInfo.m_handle)
return ;
SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_beltSlotBossCardInfo.m_handle);
if (!slot)
{
assert(slot && "failed find m_equipedBossCard item");
return ;
}
float percent = getEquipCardDurPercent(slot);
KUIWnd* wnd = GetChild( CStringUtil::StringFormat("gauge_repair_line_yellowgreen_%02d", m_beltSlotBossCardInfo.m_slotIndex+13).c_str() );
if (!wnd)
{
return ;
}
setStaticWndGage(wnd,(int)m_fDurabilityGaugeW, percent);
/*
float percent = 0.0f;
int nMax = slot->getMaxEtherealDurability();
if( nMax > 0)
{
int ethereal = slot->GetEtherealDurability();
if( ethereal > 0 )
percent = (float)ethereal / (float)nMax;
}
KUIWnd* wnd = GetChild( CStringUtil::StringFormat("gauge_repair_line_yellowgreen_%02d", m_beltSlotBossCardInfo.m_slotIndex+13).c_str() );
if (!wnd)
{
assert(slot && "failed find m_equipedBossCard window");
return ;
}
setUiWndGage(wnd, percent);
*/
}
// 2010.08.20 - prodongi
void SUIEquipmentWnd::dragDropToBeltSlot(SUIInvenItemDragInfo* itemDragInfo, KUISendRecvDropMessage* recvMsg)
{
// 현재 장착되어 있지 않은 아이템만
if( !m_InventoryMgr.IsBeltSlotCard( itemDragInfo->m_hItem ) )
{
//// 2010.08.17 드랍할려는 슬룻 검색 - prodongi
//size_t t = recvMsg->sRecvDropControlID.find_last_of("icon_beltcarslot_");
//if (t != std::string::npos)
//{
// std::string c = recvMsg->sRecvDropControlID.substr(t+2, t+3);
// int putSlot = atoi(c.c_str()) - 1;
// if (0 <= putSlot && c_BeltSlotCnt > putSlot)
// {
// //m_pDisplayInfo->ReqBeltItem( true, pItemDragInfo->m_hItem );
// m_pDisplayInfo->ReqBeltItem( true, itemDragInfo->m_hItem, putSlot );
// m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
// }
//}
// 2010.08.17 드랍할려는 슬룻 검색 - prodongi
size_t t = recvMsg->sRecvDropControlID.find("icon_beltcarslot_");
if (t != std::string::npos)
{
t = recvMsg->sRecvDropControlID.find_last_of("icon_beltcarslot_");
if (t != std::string::npos)
{
std::string c = recvMsg->sRecvDropControlID.substr(t+2, t+3);
int putSlot = atoi(c.c_str()) - 1;
if (0 <= putSlot && c_BeltSlotCnt > putSlot)
{
//m_pDisplayInfo->ReqBeltItem( true, pItemDragInfo->m_hItem );
m_pDisplayInfo->ReqBeltItem( true, itemDragInfo->m_hItem, putSlot );
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
}
}
}
}
}
// 탈것 아이콘.
void SUIEquipmentWnd::RefreshRideIcon()
{
// 탈것 아이콘.
SInventorySlot * pSlot = m_InventoryMgr.GetItemInfo( ItemBase::WEAR_RIDE_ITEM );
if( pSlot && m_pRideIcon && pSlot->IsEquipItem() )
{
// ResetMultiIcon( m_pRideIcon, 0, 4 );
m_pRideIcon->SetIcon( 1, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) );
}
}
bool GetBiggerPercent( SRepairInfo & p1, SRepairInfo & p2 )
{
return p1.percent > p2.percent;
}
bool GetsmallerPercent( SRepairInfo & p1, SRepairInfo & p2 )
{
return p1.percent < p2.percent;
}
//// 전체수리.
//void SUIEquipmentWnd::AllRepair()
//{
// // 에테리얼스톤 충전량이 0.
// if( m_PlayerInfoMgr.GetEtherealStoneDurability() <= 0 )
// {
// m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 7908 ), true ) );
// return;
// }
//
// int crrEthereal = m_PlayerInfoMgr.GetEtherealStoneDurability(); // 현재 에테리얼충전량.
// if( crrEthereal < 1 )
// {
// // 메세지출력. 733 에테리얼 스톤 충전양이 부족합니다.
// m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 733 ), true ) );
// return;
// }
// crrEthereal *= 10000;
//
//
// m_arrRepairInfo.clear();
//
//
// // 내구도.
// SInventorySlot * pSlot = NULL;
// for( int nWearType = 0; nWearType < g_nGauge; ++nWearType )
// {
// SRepairInfo aRepairInfo;
//
// // 망토 제외.
// if( nWearType == 7 )
// continue;
//
// pSlot = m_InventoryMgr.GetItemInfo(nWearType);
//
// // 장비중.
// if( pSlot )
// {
// // 수리해야 할 내구도가 소모된 아이템.
// if( IsRepair( pSlot ) )
// {
// ItemBaseEx_info * pItemBase = const_cast< ItemBaseEx_info * >( GetItemDB().GetItemData( pSlot->GetItemCode() ) );
//
// aRepairInfo.Set( pItemBase, pSlot );
// m_arrRepairInfo.push_back( aRepairInfo );
// }
// }
// }
//
// // 수리할 아이템이 없다.
// if( m_arrRepairInfo.empty() )
// {
// // 메세지출력. 732 수리할 아이템이 없습니다.
// m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 732 ), true ) );
// return;
// }
//
//
// // 서버에 전송할 충전 %.
// float sendPercent = 0.0f;
//
//
// // 전체충전 가능검사.
// int needValue = 0; // 개별 충전필요량.
// int needTotalValue = 0; // 총 충전 필요량.
// int size = m_arrRepairInfo.size();
// for( int i=0; i<size; ++i )
// {
// SRepairInfo & aInfo = m_arrRepairInfo[ i ];
// needValue = ( 100.0f - aInfo.percent ) * (float)aInfo.EtherealPerOne; // 필요 에테리얼 량.
// needTotalValue += needValue; // 필요 에테리얼 총량.
// }
// // 충전가능.
// if( needTotalValue <= crrEthereal )
// {
// // 메세지전송.
// TS_CS_TRANSMIT_ETHEREAL_DURABILITY_TO_EQUIPMENT msg;
// msg.percent = 1.0f;
// this->m_pGameManager->PendMessage( &msg );
// return;
// }
//
//
// //--------------------------------------------------------------------------
// // 전체충전이 불가능하다. 균등분배시작.
//
//
// // 현재 내구도 % 로 내림차순 정렬.
// sort( m_arrRepairInfo.begin(), m_arrRepairInfo.end(), GetBiggerPercent );
//
// struct SRepair
// {
// int index;
// int needEthereal;
// SRepair( int _index, int _needEthereal ) : index( _index ), needEthereal( _needEthereal ) {}
// };
// std::vector< SRepair > arrNeedEthereal; // 필요 에테리얼 량.
//
// float bigPercent = 0.0f;
// size = m_arrRepairInfo.size();
// for( int i=0; i<size-1; ++i )
// {
// needTotalValue = 0;
// arrNeedEthereal.clear();
//
// SRepairInfo & aBig = m_arrRepairInfo[ i ];
//
// // 최대치(%) 에 맞추기위해 필요한 에테리얼량 계산.
// needTotalValue = 0;
// for( int k=i+1; k<size; ++k )
// {
// SRepairInfo & aInfo = m_arrRepairInfo[ k ];
// needValue = ( aBig.percent - aInfo.percent ) * (float)aInfo.EtherealPerOne; // 필요 에테리얼 량.
// needTotalValue += needValue; // 필요 에테리얼 총량.
//
// arrNeedEthereal.push_back( SRepair( k, needValue ) );
// }
//
// // 충전가능.
// if( ( needTotalValue + 10000 ) <= crrEthereal )
// {
// bigPercent = aBig.percent;
// break;
// //rest = crrEthereal - needValue;
// //if( rest == 0 )
// //{
// // sendPercent = aBig.percent;
// //}
// //else if( rest > 0 )
// //{
// // for( int x=0; x<size; ++x )
// // {
// // SRepairInfo & aSmall = m_arrRepairInfoSmall[ x ];
//
// // // 1% 당 필요 에테리얼량이 가장작은 것도 채울수가 없다.
// // if( rest < aSmall.EtherealPerOne )
// // {
// //
// // }
// // }
// //}
//
// //break;
// }
// }
//
// if( bigPercent == 0.0f )
// {
// // 메세지출력. 733 에테리얼 스톤 충전양이 부족합니다.
// m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 733 ), true ) );
// return;
// }
//
// int rest = crrEthereal - needTotalValue;
// if( rest == 0 )
// {
// sendPercent = bigPercent;
// }
// else if( rest > 0 )
// {
// rest = crrEthereal;// - needTotalValue;
//
// int needValue = 0;
//
// // % 만큼 에테리얼을 채운다.
// //size = m_arrRepairInfo.size();
// size = arrNeedEthereal.size();
// for( int x=0; x<size; ++x )
// {
// SRepair & aRepair = arrNeedEthereal[ x ];
// needValue = aRepair.needEthereal;
//
// SRepairInfo & aInfo = m_arrRepairInfo[ aRepair.index ];
//
// if( needValue > 0 )
// {
// rest -= needValue; // 나머지 에테리얼 감소.
// aInfo.crrEthereal += needValue;
//
// // 현재 % 다시 계산.
// aInfo.percent = (float)aInfo.crrEthereal / (float)aInfo.maxEthereal;
// }
// }
//
// // 오름차순 정렬.
// std::vector< SRepairInfo > m_arrRepairInfoSmall( m_arrRepairInfo.begin(), m_arrRepairInfo.end() );
// sort( m_arrRepairInfoSmall.begin(), m_arrRepairInfoSmall.end(), GetsmallerPercent );
//
// float smallPercent = m_arrRepairInfoSmall[ 0 ].percent; // 가장 작은 내구도 %.
//
// size = m_arrRepairInfoSmall.size();
//
// bool bLoop = true;
// while( bLoop )
// {
// for( int x=0; x<size; ++x )
// {
// SRepairInfo & aSmall = m_arrRepairInfoSmall[ x ];
//
// // 1% 당 필요 에테리얼량이 가장작은 것도 채울수가 없다.
// if( rest < aSmall.EtherealPerOne )
// {
// sendPercent = aSmall.percent * 100.0f;
//
// // 필요 에테리얼량이 가장작은 0번째의 1%도 충전불가하다면 현재에테리얼량이 부족한것이다.
// if( x == 0 || ( ( aSmall.percent-smallPercent ) < 0.01f ) )
// {
// // 메세지출력. 733 에테리얼 스톤 충전양이 부족합니다.
// m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GENERAL, S( 733 ), true ) );
// return;
// }
// bLoop = false;
// break;
// }
//
// // 1% 채워본다.
// aSmall.crrEthereal += aSmall.EtherealPerOne;
// rest -= aSmall.EtherealPerOne;
//
// // 현재 % 다시 계산.
// aSmall.percent = (float)aSmall.crrEthereal / (float)aSmall.maxEthereal;
// }
// }
// }
//
// arrNeedEthereal.clear();
//
// // 메세지전송.
// TS_CS_TRANSMIT_ETHEREAL_DURABILITY_TO_EQUIPMENT msg;
// msg.percent = sendPercent / 100.0f;
// this->m_pGameManager->PendMessage( &msg );
//
//}
// 전체수리.
void SUIEquipmentWnd::AllRepair()
{
SDurability sDurability(true);
float sendPercent = sDurability.calculate(&m_PlayerInfoMgr, &m_InventoryMgr, &m_CreatureSlotMgr);
// 메세지전송.
TS_CS_TRANSMIT_ETHEREAL_DURABILITY_TO_EQUIPMENT msg;
// msg.target = m_CreatureSlotMgr.GetEquipedCardIndexByCreature( m_CreatureSlotMgr.GetSelectedCreature() );
msg.percent = sendPercent / 100.0f;
this->m_pGameManager->PendMessage( &msg );
}
void SRepairInfo::Set( ItemBaseEx_info * _pItemBase, SInventorySlot * pSlot )
{
if( _pItemBase )
{
if( pSlot->getMaxEtherealDurability() > 0)
{
maxEthereal = pSlot->getMaxEtherealDurability(); // 최대내구도.
crrEthereal = pSlot->GetEtherealDurability(); // 현재내구도.
if( crrEthereal == 0 )
percent = 0.0f;
else if( crrEthereal > 0 )
{
lossValue = maxEthereal - crrEthereal; // 손실 내구도값.
percent = ( ( float )crrEthereal / ( float )maxEthereal ) * 100.0f; // 현재 내구도 %.
}
EtherealPerOne = (float)maxEthereal / 100.0f; // 1% 당 ethereal 량.
}
else
Clear();
}
else
{
Clear();
}
}
// 수리해야 할 내구도가 소모된 아이템.
bool SUIEquipmentWnd::IsRepair( SInventorySlot * pSlot )
{
const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( pSlot->GetItemCode() );
if(pItemBase)
{
// 상급아이템.
if( pSlot->getMaxEtherealDurability() > 0)
{
// 내구도가 소모된 아이템.
int crrEthereal = pSlot->GetEtherealDurability();
int maxEthereal = pSlot->getMaxEtherealDurability();
if( crrEthereal < maxEthereal && crrEthereal > 0 )
{
/*if( ( (float)ethereal / (float)pItemBase->nEthereal_durability ) <= 0.99f )
return true;*/
if( ( (float)maxEthereal / 10000.0f ) - ( (float)crrEthereal / 10000.0f ) >= 1.0f )
return true;
}
}
}
return false;
}
// 내구도게이지 출력설정.( % 에 따른 색상변경, 아이템종류에 따른 아이콘 출력 )
void SUIEquipmentWnd::RefreshDurability( SInventorySlot * pSlot, int nWearType )
{
enum ITEM_STATE
{
ITEM_STATE_NONE = -1,// 장비X.
ITEM_STATE_GENERAL = 0, // 일반.
ITEM_STATE_UPPER, // 상급.
ITEM_STATE_BROKEN, // 부서진 상급.
};
ITEM_STATE itemState = ITEM_STATE::ITEM_STATE_NONE;
bool bIsGeneral = false; // 일반아이템 여부.
float per = 1.0f; //// 내구도 퍼센트.
// 장비중.
if( pSlot )
{
const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( pSlot->GetItemCode() );
if(pItemBase)
{
// 상급아이템.
if(pSlot->getMaxEtherealDurability() > 0)
{
int crrEthereal = pSlot->GetEtherealDurability();
int maxEthereal = pSlot->getMaxEtherealDurability();
if( crrEthereal > 0 )
{
itemState = ITEM_STATE::ITEM_STATE_UPPER;
per = (float)crrEthereal / (float)maxEthereal;
}
else
{
itemState = ITEM_STATE::ITEM_STATE_BROKEN;
//per = 0.0f;
}
}
// 일반아이템.
else
itemState = ITEM_STATE::ITEM_STATE_GENERAL;
}
}
// 장비하지 않음.
else
{
//per = 0.0f;
m_arrGeneralItem[ nWearType ]->SetShow( false ); // X 아이콘.
}
int nIndexAni = 4; // 내구도에 따른 SpriteSet Index;
switch( itemState )
{
// 장비X.
case ITEM_STATE::ITEM_STATE_NONE:
nIndexAni = 4;
m_arrGeneralItem[ nWearType ]->SetShow( false ); // X 아이콘.
break;
// 일반아이템.
case ITEM_STATE::ITEM_STATE_GENERAL:
nIndexAni = 0;
m_arrGeneralItem[ nWearType ]->SetAniName( "common_mark_titanium_repair_none" );
m_arrGeneralItem[ nWearType ]->SetShow( true ); // X 아이콘.
break;
// 상급아이템.
case ITEM_STATE::ITEM_STATE_UPPER:
if( per < 0.33f ) // red.
nIndexAni = 1;
else if( per < 0.66f ) // cyan.
nIndexAni = 2;
else // yellowgreen.
nIndexAni = 3;
m_arrGeneralItem[ nWearType ]->SetShow( false ); // X 아이콘.
break;
// 파괴된아이템.
case ITEM_STATE_BROKEN:
nIndexAni = 4;
m_arrGeneralItem[ nWearType ]->SetAniName( "common_mark_titanium_repair_zero" );
m_arrGeneralItem[ nWearType ]->SetShow( true );
break;
}
KUIWnd * pWnd = m_arrDrabilityGauge[ nWearType ];
pWnd->SetAniName( g_arrGaugeAni[ nIndexAni ] );
}