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

4224 lines
153 KiB
C++

#include "stdafx.h"
#include "KUIWndManager.h"
#include "KUIDragAndDrop.h"
#include "KUIControlChaosGauge.h"
#include "KUIControlStatic.h"
#include "KUIControlScroll.h"
#include "KUIControlButton.h"
#include "KUIControlClockBox.h"
#include "KUITabControl.h"
#include "KUIControl3DStatic.h"
#include "SNetMessage.h"
#include "IHuntaHolicSystem.h"
#include "SHuntaHolicSystem.h"
#include "SUIInventoryWnd.h"
#include "SGameManager.h"
//#include "SGameMessageUI.h"
#include "SItemDB.h"
#include "SStringDB.h"
#include "SCombineDB.h"
#include "CombineBase.h"
#include "SkillBaseFile.h"
//#include "Util.h"
#include "ErrorCode/ErrorCode.h"
#include "SUISysMsgDefine.h"
#include "SGameOption.h"
#include "SPlayerInfoMgr.h"
#include "SInventoryMgr.h"
#include "SStorageMgr.h"
#include "SUILazyTooltip.h" // sonador #2.1.2.4.3 팻 조작 UI 연동
#include "SGameInterface.h" //servantes 2010.11.29
#include "SSummonSlotMgr.h"
#include "SPetMgr.h"
#include <toolkit/XEnv.h>
#include "SGameAvatarEx.h"
#include <toolkit/XStringUtil.h>
#include "SGame.h"
#include "SCreatureDB.h"
#include "STenacityDB.h"
#include "SContents.h" // sonador #2.1.24
#include "KUITipControl.h"
#include "SUIStoreWnd.h"
//#include "SUIUtil.h" /// 2011.08.03 - prodongi
#include "./Decomposition/SUIDecompositionWnd.h"
#define DECO
#define CONTRIBUTION
#define NEW_INVENTORY83
// 2010.06.11 - prodongi
#include "SGameSystem.h"
extern SGameSystem * g_pCurrentGameSystem;
#define HUNTAHOLICSYSTEM g_pCurrentGameSystem->GetContentsMgr().acquire< SHuntaHolicSystem >( "huntaholic" )
namespace
{
//----------------------------------------------------------------------------------
// 인벤토리
const int c_nInvenWndResizeUnitX = 35;
const int c_nInvenWndResizeUnitY = 36; // TEST
const int c_nInvenSlotReduceMinCount = 4; // Reduce 축소.
const float c_fSetTabSizeCorrect = 0.9f; // 사용X
// 인벤슬롯개수
const int c_nInvenSlotCount_Y = 11;
const int c_nInvenSlotCount_X = 9;
const int c_nMaxInvenSimpleMaxSlotCount = c_nInvenSlotCount_Y * c_nInvenSlotCount_X; // 56;
const int c_nInvenSlotCountX = 2;
const int c_nInvenSlotSimpleXCount = 8;
const int c_nEquipSetTabCorrection = 9; // 사용X
const int c_nCategoryTabCorrection = 0; // 사용X
const int c_nCombineButtonCorrection = 13; // 사용X
const int c_nItemIconCorrection = 100;
const int c_nIconSelectionCorrectX = (-5); //
const int c_nIconSelectionCorrectY = (-6); // 사용X
const int c_nNameSelectinCorrectX = (-5); //
const char* c_szTooltipSprName = c_szDEF_SPR_NAME;
const char* c_szGOLD = "text_04"; //"static_item_rp_value";
const char* c_szWEIGHT = "text_08"; //"static_item_wt_value";
const char* c_szStaticItemWt = "text_07"; //"static_item_wt"; // WT
const char* c_szStaticItemRp = "text_03"; //"static_item_rp"; // R
const char* c_szStaticItemAp = "text_10"; //
const char* c_szArrangeButton = "button_arrange"; // sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현. [정렬버튼]
const char* g_strEquipIcon = "common_mark_titanium_equipicon"; // 장착표시. "E"
const char* g_strBeltIcon = "common_mark_titanium_belt";
const char* g_strEmptyCardIcon = "common_mark_titanium_empty_card"; // 2011.06.29 빈 카드 표시 - prodongi
const char* g_strAppendedDecomposeWndIcon = "common_mark_titanium_useicon"; // 분해 창 등록 아이템 마킹 아이콘
const char* g_strInvenTabActivity = "game_button_tab_copper_inventory"; //인벤 탭버튼 활성화 이미지
const char* g_strInvenTabUnActivity = "game_button_tab_copper_inventory_off"; //인벤 탭버튼 비활성화 이미지
// 탭 Wnd 타입.
enum INVEN_TAB_TYPE
{
INVEN_TAB_NONE = -1,
INVEN_TAB_ALL = 0, // 전체.
INVEN_TAB_EQUIPMENT = 1, // 장비.
INVEN_TAB_CONSUMPTION = 2, // 소비.
INVEN_TAB_CARD = 3, // 카드.
INVEN_TAB_QUEST = 4, // 퀘스트.
INVEN_TAB_ETC = 5, // 나머지.
INVEN_TAB_CREATURE = 6, // 크리처 //servantes 2010.11.24
INVEN_TAB_OUTSIDE = 7,
INVEN_TAB_WIDGET = 8,
INVEN_TAB_MAX = 9,
};
//----------------------------------------------------------------------------------
// 조합창.
// 조합창 슬롯 개수.
int c_nCombineSlotCount = 9;
const int c_nCombineSlotNameLength = int( ::strlen( "icon_item" ) );
const int c_nCombineSlotCountLength = 2;
const int c_nCombineItemCountLimit = 65535; // 매매갯수는 65535로 제한한다. ( 패킷에 갯수를 unsigned short을 사용하고 있음. )
//--------------------------------------------------------------------------
// 기부.
//
int c_nContributionCount = 9; // 기부창 아이템슬롯 개수.
int c_nContributionRewardCount = 5;
int c_nRankSlotCount = 11;
const int c_nContributionCountLimit = 65535; // 매매갯수는 65535로 제한한다. ( 패킷에 갯수를 unsigned short을 사용하고 있음. )
const char* c_lpContributionIconName = "icon_item";
const int c_nContributionSlotNameLength = int( ::strlen( c_lpContributionIconName ) );
const int c_nContributionSlotCountLength = 2;
//--------------------------------------------------------------------------
// 조합, 강화, 수리 윈도우ID.
const int g_nWndSize = 3;
const SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE g_arrWndID[ g_nWndSize ] = { SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE,
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE,
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR };
};
using namespace rp;
SUIInventoryWnd::~SUIInventoryWnd()
{
SAFE_DELETE( m_pArrangeButtonAction );
m_vecInvenList.clear();
m_arrCtrlCount.clear();
m_arrCtrlItemIcon.clear();
m_arrTabButton.clear();
}
void SUIInventoryWnd::Process( DWORD dwTime )
{
SUIWnd::Process( dwTime );
tick( dwTime );
if( m_bIsSetChildTop )
SetChildTopInventory();
}
// 2011. 9. 9 - marine Top으로 올릴컨드롤이 있다면 처리..
//void SUIInventoryWnd::SetChildTopInventory()
//{
// if(m_bIsSetChildTop)
// {
// std::list<KUIWnd*> & rChildList = const_cast< std::list<KUIWnd*> & >( this->GetChildList() );
//
// //// 탭이 적용될 윈도우의 레이아웃을 최하단으로 이동.
// if( m_pSelect_list_cyan )
// {
// std::list< KUIWnd* >::iterator it = std::find( rChildList.begin(), rChildList.end(), m_pSelect_list_cyan );
// if( it != rChildList.end() )
// {
// rChildList.erase( it );
// rChildList.push_back( m_pSelect_list_cyan );
// }
// }
//
// for( int i=0; i<INVEN_TAB_TYPE::INVEN_TAB_MAX; i++ )
// {
// if( i == m_TempTabIndex )
// {
// m_nIndexShowTab = m_TempTabIndex;
// if(m_arrTabButton.size() <= m_nIndexShowTab) //servantes 2010.11.24
// return ; //error
//
// // 선택된 탭버튼의 레이아웃을 최하단으로 이동.
// std::list< KUIWnd* >::iterator it = std::find( rChildList.begin(), rChildList.end(), m_arrTabButton[ m_TempTabIndex ] );
// if( it != rChildList.end() )
// {
// rChildList.erase( it );
// rChildList.push_back( m_arrTabButton[ m_TempTabIndex ] );
// m_arrTabButton[ m_TempTabIndex ]->SetAniName( g_strInvenTabActivity );
// }
//
// m_nInvenSlotStartIndex = 0; // 탭변경시 startIndex 초기화.
// m_nCrrScrollIndex = 0;
// // 2010.08.19 - prodongi
// if (m_pScrollBar)
// m_pScrollBar->SetPosition( m_nCrrScrollIndex );
//
// switch( m_TempTabIndex )
// {
// case 0: m_CurrentCategory = UI_ITEM_ALL; break;
// case 1: m_CurrentCategory = UI_ITEM_EQUIP; break;
// case 2: m_CurrentCategory = UI_ITEM_EXPEND; break;
// case 3: m_CurrentCategory = UI_ITEM_CARD; break;
// case 4: m_CurrentCategory = UI_ITEM_QUEST; break;
// case 5: m_CurrentCategory = UI_ITEM_ETC; break;
// case 6: m_CurrentCategory = UI_ITEM_CREATURE; break; //servantes 2010.11.24
// case 7: m_CurrentCategory = UI_ITEM_OUTSIDE; break;
// case 8: m_CurrentCategory = UI_ITEM_EXTENSION_A; break;
// }
// RefreshInvenItems();
// RefreshItemCoolTime();
//
// }
// else
// {
// // 비선택 탭버튼 이미지 변경.
// if( m_arrTabButton[ i ] )
// m_arrTabButton[ i ]->SetAniName( g_strInvenTabUnActivity );
// }
// }
// m_bIsSetChildTop = false;
// }
//}
//for auto tab
void SUIInventoryWnd::SetChildTopInventory()
{
SetChildAsTop( "select_list_cyan" );
switch(m_CurrentCategory)
{
case UI_ITEM_ALL: SetChildAsTop("button_tab_01"); break;
case UI_ITEM_EQUIP: SetChildAsTop("button_tab_02"); break;
case UI_ITEM_USE: SetChildAsTop("button_tab_03"); break;
case UI_ITEM_CARD: SetChildAsTop("button_tab_04"); break;
case UI_ITEM_CREATURE: SetChildAsTop("button_tab_05"); break;
case UI_ITEM_EXPEND: SetChildAsTop("button_tab_06"); break;
case UI_ITEM_ETC: SetChildAsTop("button_tab_07"); break;
case UI_ITEM_QUEST: SetChildAsTop("button_tab_08"); break;
case UI_ITEM_CRU: SetChildAsTop("button_tab_09"); break;
case UI_ITEM_COLLECTION:SetChildAsTop("button_tab_10"); break;
case UI_ITEM_CARD2: SetChildAsTop("button_tab_11"); break;
default:
break;
}
RefreshInvenItems();
RefreshItemCoolTime();
m_bIsSetChildTop = false;
SetChildTooltip( "button_tab_01", GetStringDB().GetString(9843) );
SetChildTooltip( "button_tab_02", GetStringDB().GetString(9844) );
SetChildTooltip( "button_tab_03", GetStringDB().GetString(9845) );
SetChildTooltip( "button_tab_04", GetStringDB().GetString(9846) );
SetChildTooltip( "button_tab_05", GetStringDB().GetString(9847) );
SetChildTooltip( "button_tab_06", GetStringDB().GetString(9848) );
SetChildTooltip( "button_tab_07", GetStringDB().GetString(9849) );
SetChildTooltip( "button_tab_08", GetStringDB().GetString(9850) );
SetChildTooltip( "button_tab_09", GetStringDB().GetString(9851) );
SetChildTooltip( "button_tab_10", GetStringDB().GetString(9855) );
}
SUIWnd * SUIInventoryWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
m_oldShowMixWndID = SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_NONE; // 이전에 열어놓은 조합 윈도우ID;
m_nCrrScrollIndex = 0;
// 탭 버튼. 탭컨트롤 기능을 대신한다. 배열에 등록.
// for( int i=1; i<INVEN_TAB_MAX + 1; ++i ) //servantes 2010.12.08
// {
// 2011.11.24 - servantes : KUIControlButton -> KUIControlSimpleButton 으로 변경
// KUIControlSimpleButton* pTap = dynamicCast< KUIControlSimpleButton * >( GetChild( CStringUtil::StringFormat("button_tab_%02d", i).c_str() ) ); //servantes 2010.11.24
// if(pTap) //servantes 2010.12.08
// {
// m_arrTabButton.push_back( pTap );
// m_arrTabButton[ i - 1 ]->SetEnableColor( "<#ffffff>" );
// m_arrTabButton[ i - 1 ]->SetDisableColor( "<#a0a0a0>" );
// }
// }
// 이부분 때문에 탭컨트롤 대신 버튼을 사용했다.
// 활성화된 탭의 레이아웃을 탭에 속한 Wnd 보다 높게하여 ------
// _____| |_______
// 이런 모양이 되도록 해야하지만,
// 탭컨트롤은 탭컨트롤안에 버튼기능의 TabItem 이 포함된다.
// 탭컨트롤의 레이아웃이 탭에속한 Wnd 보다 낮은 상태에서 TabItem의 레이아웃은 탭에속한 Wnd 보다 높게 할 수 없다.
//std::list<KUIWnd*> & rChildList = const_cast< std::list<KUIWnd*> & >( this->GetChildList() );
//std::list< KUIWnd* >::iterator it = std::find( rChildList.begin(), rChildList.end(), m_arrTabButton[ 0 ] );
//if( it != rChildList.end() )
//{
// rChildList.erase( it );
// rChildList.push_back( m_arrTabButton[ 0 ] );
//}
//// 전체 탭을 제외한 탭 비활성 이미지적용.
//int size = m_arrTabButton.size();
//for( int i=1; i<size; ++i )
//{
// //m_arrTabButton[ i ]->SetAniName( "common_button_tab_beamblue_a_off" );
// m_arrTabButton[ i ]->SetAniName( g_strInvenTabUnActivity );
//}
m_pSelect_list_cyan = GetChild( "select_list_cyan" );
// 무게게이지 컨트롤.
/*
m_pCtrlWeightGauge = GetChild( "gauge_bag_line_yellowgreen" );
if( m_pCtrlWeightGauge )
{
//안쓰임, 강제Hide
m_pCtrlWeightGauge->SetShow( false );
m_fWeightGaugeWidth = (float)m_pCtrlWeightGauge->GetRect().GetWidth();
}
*/
//----------------
// 툴팁 추가.
KUIWnd * pControl = NULL;
pControl = GetChild( "button_khrooshop" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 6673 ) ) );
pControl = GetChild( "button_cart" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 7217 ) ) );
pControl = GetChild( "button_enchant" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 7218 ) ) );
pControl = GetChild( "button_mix" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 7219 ) ) );
pControl = GetChild( "button_repair" );
if( pControl )
pControl->SetShow(false); // AziaMafia Hide boutin inventaire
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 9725 ) ) );
pControl = GetChild( "button_help" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 6872 ) ) );
// new inven : 안쓰임
// pControl = GetChild( "guage_base" );
//if( pControl )
// dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 7220 ) ) );
pControl = GetChild( "button_character" );
if( pControl )
dynamicCast< KUIControl * >( pControl )->SetLazyTooltip( new KLazyTip( S( 7234 ) ) );
KUIControlSimpleButton* pDecomposeButtonIcon( dynamicCast<KUIControlSimpleButton*>( GetChild( "button_decompose_01" ) ) );
pControl = GetChild("button_decompose_01");
pControl->SetShow(true); // AziaMafia decompose
if( pDecomposeButtonIcon )
pDecomposeButtonIcon->SetLazyTooltip( new KLazyTip( S( 1266 ) ) );
// 텍스트 꾸미기 태그.
CStringUtil::GetTextDecoration( GetChild( c_szGOLD )->GetCaption(), m_strDeco );
//gmpbigsun(20131004)
m_strDeco = "<font:font_02><size:9><#d0d0d0><right>";
return this;
}
bool SUIInventoryWnd::InitControls( KPoint kPos )
{
// 커스텀 윈도우 move 영역 설정
SetCustomMovingRect( GetChild( "titlebar" )->GetRect() );
m_hLocal = 0;
m_nInvenDropOffset = 0;
m_nScrollBarBottomOffset = 0;
m_nScrollBarTopOffset = 0;
m_nInvenSlotcountX = c_nInvenSlotCount_X; //c_nInvenSlotCountX;
m_nInvenMaxSlotCount = c_nMaxInvenSimpleMaxSlotCount; //c_nMaxInvenSlotCount;
m_nInvenSlotCountY = c_nMaxInvenSimpleMaxSlotCount / c_nInvenSlotCount_X; //m_nInvenMaxSlotCount / m_nInvenSlotcountX;
#ifndef DECO
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// 아이템 multi icon 레이어 설정, 툴팁 스프라이트 설정, 클릭 영역 보정
// 심플모드 위해 생성해줄 아이콘 스태틱
RECT rc; rc.left = 0; rc.top = c_nInvenWndResizeUnitY; rc.right = 0; rc.bottom = c_nInvenWndResizeUnitY;
for( int i = 15; i < c_nMaxInvenSimpleMaxSlotCount-1; i++ )
{
CopyControl( CStringUtil::StringFormat("icon_item%02d" , i).c_str(), CStringUtil::StringFormat("icon_item%02d" , i+1).c_str(), rc );
// CopyControl( CStringUtil::StringFormat("static_item%02d" , i).c_str(), CStringUtil::StringFormat("static_item%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("static_itemcount%02d", i).c_str(), CStringUtil::StringFormat("static_itemcount%02d", i+1).c_str(), rc );
SetChildShow( CStringUtil::StringFormat("icon_item%02d" , i+1).c_str() );
// SetChildShow( CStringUtil::StringFormat("static_item%02d" , i+1).c_str() );
SetChildShow( CStringUtil::StringFormat("static_itemcount%02d", i+1).c_str() );
}
for( int nSlot( 0 ); nSlot < c_nMaxInvenSimpleMaxSlotCount; ++nSlot )
{
KUIControlMultiIcon* pItemIconControl = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat("icon_item%02d", nSlot).c_str() ));
if( NULL != pItemIconControl )
{
pItemIconControl->SetIconLayer( 8 );
// pItemIconControl->SetCorrectionRect( KRect( 0, 0, c_nItemIconCorrection, 0 ) );
KUIWnd* pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", CStringUtil::StringFormat("item_clockbox%02d", nSlot).c_str(), " ", pItemIconControl->GetRect(), 0, KFLAG_NO_GET_MESSAGE, this, "", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
if( pWnd ) ((KUIControlClockBox*)pWnd)->SetColor( c_ColorClockControl );
}
}
//지역화
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
#ifdef DECO
KUIControlMultiIcon* pItemIconControl = dynamicCast<KUIControlMultiIcon*>(GetChild( "icon_item00" ));
if( pItemIconControl )
{
pItemIconControl->SetIconLayer( 8 ); //sun
KUIWND_CREATE_ARG ClockArg( "clockbox", "item_clockbox00", " ", pItemIconControl->GetRect(), 0, KFLAG_NO_GET_MESSAGE, this, "",
c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP );
KUIWnd* pWnd = m_pManager->CreateControl( ClockArg );
if( pWnd ) ((KUIControlClockBox*)pWnd)->SetColor( c_ColorClockControl );
}
// 아이템 multi icon 레이어 설정, 툴팁 스프라이트 설정, 클릭 영역 보정
// 심플모드 위해 생성해줄 아이콘 스태틱
RECT rcVOffset; rcVOffset.left=0; rcVOffset.top=c_nInvenWndResizeUnitY; rcVOffset.right=0; rcVOffset.bottom=c_nInvenWndResizeUnitY;
RECT rcHOffset; rcHOffset.left=c_nInvenWndResizeUnitX; rcHOffset.top=0; rcHOffset.right=c_nInvenWndResizeUnitX; rcHOffset.bottom=0;
int j(0), i(0), nIndex(1);
for( ; j < c_nInvenSlotCount_Y; j++ )
{
for( i = j*c_nInvenSlotCount_X; i < (j+1)*c_nInvenSlotCount_X-1; i++ )
{
CopyInvenControl(i, nIndex, rcHOffset);
++nIndex;
}
CopyInvenControl(j*c_nInvenSlotCount_X, nIndex, rcVOffset);
++nIndex;
}
#endif
//최상위로 올림.
SetChildAsTop( "static_iconselection" );
// ScrollBar.
m_pScrollBar = dynamicCast<KUIControlVScrollSmallEx*>(GetChild( "scrollbar_list_01" ));
RefreshScrollBar();
#ifdef _KUI_INVALIDATION
// { [sonador]
KUIControl3DStatic* pStaticTarget = dynamicCast<KUIControl3DStatic*>(GetChild( "body_view" ));
if( pStaticTarget )
this->AddPopupControl( pStaticTarget );
// }
#endif
//SetChildCaption( c_szStaticItemWt, GetStringDB().GetString( STRING_WT ) );
SetChildCaption( c_szStaticItemWt, CStringUtil::StringFormat( "<font:font_02><size:9><#ba9924><left>%s", S(STRING_WT) ).c_str() );
SetChildCaption( c_szStaticItemAp, CStringUtil::StringFormat( "<font:font_01><size:9><#2781bc><left>%s", S(STRING_AP) ).c_str() );
// sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현
// m_pArrangeButton = dynamicCast<KUIControlButton*>(GetChild( c_szArrangeButton ));
m_pArrangeButton = dynamicCast<KUIControlSimpleButton*>(GetChild( c_szArrangeButton ));
m_pArrangeButton->SetEnableColor( "<#ffffff>" );
m_pArrangeButton->SetDisableColor( "<#a0a0a0>" );
m_pArrangeButtonAction = new sui::ActionBinder( new sui::ActionDisableControl( m_pArrangeButton ), new sui::ActionEnableControl( m_pArrangeButton ), 0 );
m_ActionTicker.append_tickable( m_pArrangeButtonAction );
// 아이템아이콘 컨트롤들.
KUIControlMultiIcon* pIcon = NULL;
for( int nSlot=0; nSlot<c_nMaxInvenSimpleMaxSlotCount; ++nSlot )
{
pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat("icon_item%02d", nSlot).c_str() ));
if( pIcon )
m_arrCtrlItemIcon.push_back( pIcon );
//m_arrCtrlCount.push_back( GetChild( CStringUtil::StringFormat("static_itemcount%02d", nSlot).c_str() ); // 개수컨트롤.
}
// 수령함에 캐쉬아이템이 남아있는지 표시할 아이콘.
KUIWnd * pWnd = GetChild( "mark_new_cashitem" );
pWnd->SetShow( false );
m_bIsSetChildTop = true;
SetChildTooltip( "button_tab_01", GetStringDB().GetString(9843) );
SetChildTooltip( "button_tab_02", GetStringDB().GetString(9844) );
SetChildTooltip( "button_tab_03", GetStringDB().GetString(9845) );
SetChildTooltip( "button_tab_04", GetStringDB().GetString(9846) );
SetChildTooltip( "button_tab_05", GetStringDB().GetString(9847) );
SetChildTooltip( "button_tab_06", GetStringDB().GetString(9848) );
SetChildTooltip( "button_tab_07", GetStringDB().GetString(9849) );
SetChildTooltip( "button_tab_08", GetStringDB().GetString(9850) );
SetChildTooltip( "button_tab_09", GetStringDB().GetString(9851) );
SetChildTooltip( "button_tab_10", GetStringDB().GetString(9855) );
return SUIWnd::InitControls( kPos );
}
void SUIInventoryWnd::CopyInvenControl( int nIndex, int nNewIndex, RECT& rcOffset )
{
std::string strIconName1 = CStringUtil::StringFormat("icon_item%02d", nIndex);
std::string strIconName2 = CStringUtil::StringFormat("icon_item%02d", nNewIndex);
std::string strClockName1 = CStringUtil::StringFormat("item_clockbox%02d", nIndex);
std::string strClockName2 = CStringUtil::StringFormat("item_clockbox%02d", nNewIndex);
std::string strCntName1 = CStringUtil::StringFormat("static_itemcount%02d", nIndex);
std::string strCntName2 = CStringUtil::StringFormat("static_itemcount%02d", nNewIndex);
KUIWnd* pIconWnd(NULL); KUIWnd* pClockWnd(NULL);
pIconWnd = CopyControl( strIconName1.c_str(), strIconName2.c_str(), rcOffset );
if( pIconWnd ) ((KUIControlMultiIcon*)pIconWnd)->SetIconLayer(8);
pClockWnd = CopyControl( strClockName1.c_str(), strClockName2.c_str(), rcOffset );
if( pClockWnd ) ((KUIControlClockBox*)pClockWnd)->SetColor( c_ColorClockControl );
CopyControl( strCntName1.c_str(), strCntName2.c_str(), rcOffset );
SetChildShow( strIconName2.c_str() );
SetChildShow( strCntName2.c_str() );
}
bool SUIInventoryWnd::InitData( bool bReload )
{
m_CurrentCategory = UI_ITEM_ALL;
m_nCurrentSelect = -1;
m_nPrevInvenSlotStartIndex = 0;
m_nInvenSlotStartIndex = 0;
m_ReserveDropItemHandle = NULL;
m_bSimpleMode = false;
SetChildCaption( "static_item_count", "? / ?" );
m_bShiftKey = false; //servantes 2010.10.15
return SUIWnd::InitData(bReload);
}
void SUIInventoryWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
if( bOpen )
{
// 장비창.
if( !m_pEquipmentWnd )
m_pEquipmentWnd = m_pGameManager->GetSUI( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT );
m_pGameManager->StartSound( "ui_popup_window01.wav" );
//servantes 2010.11.30
bool bOpenEquipWndFlag = GetGameOption().GetOpenEquipWnd(); //servantes 2010.11.05
if(bOpenEquipWndFlag)
{
bool bOpen = true; //servantes 2010.11.29
int aID[3] =
{
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION,
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SOUL_CHARGE,
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_JEWEL_EQUIP
};
int nSelectUI = m_pGameManager->GetGameInterface()->GetCurrentSelectUI();
for(int k=0; k<3; k++)
{
if( nSelectUI == aID[k] )
{
bOpen = false;
break;
}
}
if(bOpen)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, true ) ); // 장비창.
}
}
// servantes 2010.12.09 테스트 필요
//
// SUIWnd* pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT); //servantes 2010.11.18
// if(pWnd)
// {
// if(pWnd->IsShow())
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, false ) ); // 장비창.
// }
// }
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE, GetRect().left, GetRect().bottom ) );
RefreshItemCoolTime();
//// 홀릭포인트 TEST.
//TS_CS_INSTANCE_GAME_SCORE_REQUEST msg;
//m_pGameManager->PendMessage( &msg );
//const HuntaHolicScore& score = HUNTAHOLICSYSTEM->getMyScore();
//GetChild("text_06")->SetCaption( CStringUtil::StringFormat("<size:9><right>%d", score.gain_point).c_str() );
//
//// 헌터홀릭 포인트 카드일 경우
//// 내구도를 포인트 점수로 처리.
//// 따라서 내구도를 percentage 로 나타내면 안된다.
////
//if( pItemSlot->GetItemCode() == 806808 )
//{
// nEndurancePer = pItemSlot->GetEndurance();
//}
//else
//{
// int nResult = pItemSlot->GetCrrEndurancePer(nEndurancePer);
// if( nResult != SInventorySlot::ENDURANCE_SUCCESS )
// nEndurancePer = nResult;
//}
}
// 닫을때 상태 체크해서 종료할 윈도우 꺼준다
else
{
if( m_PlayerInfoMgr.GetState() != SPlayerInfoMgr::STATE_NONE )
m_PlayerInfoMgr.ChangeState(SPlayerInfoMgr::STATE_NONE);
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INPUTNUMBER, false ) ); // 수입력기
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE, false ) ); // 크루샵
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE ) ) //sevantes 2010.11.22
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, false ) ); // 강화창
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, false ) ); // 조합창
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, false ) ); // 수리창
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION, false ) ); // 파괴창
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, false ) ); // 장착창
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, false ) ); // 분해창
CloseCreatureCardWnd();
m_oldShowMixWndID = SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_NONE;
/// 2011.02.17 - prodongi
GetGameOption().SetInventoryX( GetRect().left );
GetGameOption().SetInventoryY( GetRect().top );
}
// 2011.06.22 - servantes : matis - 13049
RefreshWeight();
}
void* SUIInventoryWnd::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();
SInventorySlot * pSlot = GetInvenItem( GetSlotControlNum(szControlID) );
// ★ 인벤의 아이템을 드래그 시작.
if( pSlot )
{
if( pSlot->IsAppendedDecomposeWnd() )
return NULL;
KUIControlMultiIcon* pWndMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
if( pWndMultiIcon )
{
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
// 일반 아이템 슬롯인 경우
/// 2011.03.29 벨트 슬롯 체그 추가 - prodongi
m_pDisplayInfo->SetUIDragInfo( new SUIInvenItemDragInfo( pSlot->GetHandle(), false, m_InventoryMgr.IsBeltSlotCard(pSlot->GetHandle()) ) );
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_INVENITEM == pUIDragInfo->m_type )
{
SUIInvenItemDragInfo* pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo;
// 아무 윈도우도 아닌 장소에 drop한 경우
if( pSendMsg->sRecvDropParentID.empty() && ( IsBlockedAction("drop_bottom") == false) ) // 2012. 2. 20 - marine
{
// 장착 슬롯이 아니었다면 아이템 버리기 예약. ( 장착된 아이템은 서버처리에서도 버릴수 없게 되어 있음. )
if( !pItemDragInfo->m_bFromEquipSlot )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pItemDragInfo->m_hItem );
if( NULL != pSlot )
{
//카드 중 장착된 카드는 버릴 수 없음
if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD && m_InventoryMgr.IsEquipCard( pItemDragInfo->m_hItem ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GENERAL, S(297), true ) );
m_pDisplayInfo->SetUIDragInfo();
return NULL;
}
// 중첩 가능한 아이템이고, 갯수가 2개 이상인 경우
if( GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) && pSlot->GetItemCount() > 1 )
{
m_ReserveDropItemHandle = pItemDragInfo->m_hItem;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, pSlot->GetItemCount() ) );
}
// 중첩 불가능한 아이템이거나 갯수가 1개인 경우
else
{
m_ReserveDropItemHandle = pItemDragInfo->m_hItem;
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_ITEMDROPCHECK,
SStringDB::ParseString( GetStringDB().GetString(SYS_MSG_DUMP_ITEM_CONFIRM), "#@item_name@#", m_pDisplayInfo->GetItemName(pSlot->GetItemCode(), true, pSlot->GetEnhance(), pSlot->GetLevel(), pSlot->GetXFlag()).c_str() ).c_str(), true ) );
}
}
}
}
/*else if( ::_stricmp( pSendMsg->sRecvDropParentID.c_str(), "creatureform" ) == 0 )
return NULL;*/
}
// 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( pUIDragInfo == NULL ) return NULL;
SUIInvenItemDragInfo* pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo;
// ★ 인벤토리에서 Drag 를 시작한 경우.
if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_INVENITEM )
{
// 같은 자리에 drop한 경우를 제외
if( pRecvMsg->sSendDropParentID != pRecvMsg->sRecvDropParentID ||
pRecvMsg->sSendDropControlID != pRecvMsg->sRecvDropControlID )
{
pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo;
SInventorySlot* pSlot = GetInvenItem( GetSlotControlNum( pRecvMsg->sRecvDropControlID.c_str() ) );
if( pSlot && pItemDragInfo )
ReqSwapItem( pItemDragInfo->m_hItem, pSlot->GetHandle() );
}
}
// ★ 장비창에서 Drag 를 시작한 경우.
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_EQUIPMENT )
{
// 장착슬롯의 경우 장비 장착해제..
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() );
}
// MJ 2004/12/12 크리처 장착창에서 드랙앤드랍
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_EQUIPCREATURE ) // 크리처 장비창에서 일어남
{
SUIEquipCreatureInfo* pEquipCreatureInfo = ( SUIEquipCreatureInfo* )pUIDragInfo;
if( pEquipCreatureInfo == NULL ) return NULL;
// 현재 장착 되어 있으면 장비 해제
if( m_pDisplayInfo->GetItemCurrentWearState( pEquipCreatureInfo->m_hItem ) != ItemBase::WEAR_NONE )
{
m_pDisplayInfo->UseOrEquipItem( pEquipCreatureInfo->m_hItem, pEquipCreatureInfo->m_hCreature );
// m_pGameManager->StartSound( "ui_click_potion01.wav" );
UISendStringMessage(m_pGameManager, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY, "refresh_durability");
}
}
// 스킬 카드
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_SKILL )
{
SUISkillDragInfo* pSkillDragInfo = ( SUISkillDragInfo* )pUIDragInfo;
if( pSkillDragInfo == NULL ) return NULL;
// 인벤에서 장착 처리하면 풀어준다
if( m_InventoryMgr.IsEquipCard( pSkillDragInfo->m_hCardItem ) )
{
m_pDisplayInfo->UseOrEquipItem( pSkillDragInfo->m_hCardItem, pSkillDragInfo->m_hTarget, true );
// m_pGameManager->StartSound( "ui_click_potion01.wav" );
}
}
// 창고
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_STORAGE )
{
// 2011. 9. 20 - marine 파괴창이 열려있을때는 받지 않는다.
if(m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION)->IsShow())
return NULL;
SUIStorageDragInfo* pStorageDragInfo = ( SUIStorageDragInfo* )pUIDragInfo;
if( pStorageDragInfo == NULL ) return NULL;
SInventorySlot* pSlot = m_StorageMgr.GetItemInfo( pStorageDragInfo->m_hItem );
if( pSlot == NULL ) return NULL;
// 일반 아이템일 경우
if( GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) )
{
if( pSlot->GetItemCount() > 1 )
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORAGE, pSlot->GetItemCount(), SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
else
m_pDisplayInfo->RequestStorageItem( pStorageDragInfo->m_hItem, count_t( 1 ), TS_CS_STORAGE::STORAGE_TO_INVENTORY );
// m_pGameManager->StartSound( "ui_click_potion01.wav" );
}
// 장비 품복
else
{
// 장착동시에 빼낸다
m_pDisplayInfo->RequestStorageItem( pStorageDragInfo->m_hItem, count_t( 1 ), TS_CS_STORAGE::STORAGE_TO_INVENTORY );
m_pDisplayInfo->UseOrEquipItem( pStorageDragInfo->m_hItem );
}
}
// 캐쉬 아이템 창고
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_CASHITEM )
{
SUICashItemDragInfo* pCashItemDragInfo = ( SUICashItemDragInfo* )pUIDragInfo;
if( pCashItemDragInfo == NULL ) return NULL;
if( pCashItemDragInfo->item_count > 1 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE, count_t( pCashItemDragInfo->item_count ), SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
}
else
{
//아이템 추가 요청
m_pDisplayInfo->RequestTakeOutCashItem( pCashItemDragInfo->item_uid, pCashItemDragInfo->item_count );
}
}
// 크리처 농장 //servantes 2011.01.27
else if( pUIDragInfo->m_type == SUIDragInfo::DRAGTYPE_CREATURE_FARM ) // 2011.03.15 servantes
{
SUICreatureFarmDragInfo* pCreatureFarmDragInfo = ( SUICreatureFarmDragInfo* )pUIDragInfo;
if( pCreatureFarmDragInfo == NULL )
return NULL;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_CREATURE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_FRAM_WND, pCreatureFarmDragInfo->nMsg ) );
}
return NULL;
}
return SUIWnd::Perform( id, msg );
}
void SUIInventoryWnd::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" );
}
// 2012. 2. 20 - marine
// 아이템 파괴, 조합, 강화, 수리, 창 버튼 및 바닥 드랍은 거래, 노점, 상점, 경매장이 열려있는 경우 true를 리턴하고 메세지 박스를 띄운다.
bool SUIInventoryWnd::IsBlockedAction( std::string btnName )
{
bool bRet = false;
// 1. 파괴, 조합, 강화, 수리 버튼인지 체크
if( btnName.compare("button_warning") == 0 || //파괴
btnName.compare("button_mix") == 0 || //조합
btnName.compare("button_enchant") == 0 || //강화
btnName.compare("button_repair") == 0 || //수리
btnName.compare("drop_bottom") == 0 ) //바닥에 드랍
{
// 2. 거래, 노점, 상점, 경매장이 열려있는 경우 메시지 박스 띄우고 true 리턴
bRet = m_pGameManager->GetGameInterface()->IsAgainstUiOpen();
}
return bRet;
}
void SUIInventoryWnd::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::KTAB_SELECT:
{
KUITabControlSheet* pTab = dynamicCast<KUITabControlSheet*>(GetChild("tab_inventory"));
if(pTab)
{
switch(pTab->GetSelectedItem())
{
case 0: m_CurrentCategory = UI_ITEM_ALL; break;
case 1: m_CurrentCategory = UI_ITEM_EQUIP; break;
case 2: m_CurrentCategory = UI_ITEM_USE; break;
case 3: m_CurrentCategory = UI_ITEM_CARD; break;
case 4: m_CurrentCategory = UI_ITEM_CREATURE; break;
case 5: m_CurrentCategory = UI_ITEM_EXPEND; break;
case 6: m_CurrentCategory = UI_ITEM_ETC; break;
case 7: m_CurrentCategory = UI_ITEM_QUEST; break;
case 8: m_CurrentCategory = UI_ITEM_CRU; break;
case 9: m_CurrentCategory = UI_ITEM_COLLECTION; break;
case 10: m_CurrentCategory = UI_ITEM_CARD2; break;
}
m_bIsSetChildTop = true;
m_nInvenSlotStartIndex = 0; // 탭변경시 startIndex 초기화.
m_nCrrScrollIndex = 0;
RefreshInvenItems();
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_TAB_UPDATE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORAGE, m_CurrentCategory ) ); //수입력기가 뜬다
}
}
break;
case KUI_MESSAGE::KICON_PRESSING:
{
int nInvenIndex = GetInvenSlotItemIndex( GetSlotControlNum( lpszControlID ) );
if( (-1) != nInvenIndex )
{
if( m_nInvenSlotStartIndex <= nInvenIndex && nInvenIndex < (m_nInvenSlotStartIndex + (m_nInvenSlotCountY * m_nInvenSlotcountX)) )
{
if( m_nCurrentSelect == nInvenIndex )
m_nCurrentSelect = -1;
else m_nCurrentSelect = nInvenIndex;
RefreshSelection();
RefreshInvenSlots( m_nCurrentSelect-m_nInvenSlotStartIndex );
SInventorySlot* pSlot = NULL;
pSlot = m_InventoryMgr.GetItemInfo( GetEquipSlotWearType(lpszControlID) );
if( NULL == pSlot )
{
// 일반 아이템 슬롯인가?
pSlot = GetInvenItem( GetSlotControlNum(lpszControlID) );
}
bool bSubSlotCombineItem = AbleSubSlot( pSlot );
bool bMainSlotCombineItem = AbleMainSlot( pSlot );
if ( pSlot && m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORAGE ) ) //창고 //2010.10.15 - servantes
{
if(m_pGameManager->IsShow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION))
break;
if(m_bShiftKey) //servantes 2010.10.15
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1) // 여러개가 있을 경우
{
m_StorageMgr.SetDragItem(pSlot->GetHandle());
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORAGE, nCnt ) ); //수입력기가 뜬다
}
else // 한 개일 경우
{
m_pDisplayInfo->ChangeStorageItem( pSlot->GetHandle() ); // 1개를 옮긴다
}
}
if(m_bControlKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt >= 1 && nCnt < 10) // 1-10 개가 있을 경우
{
m_pDisplayInfo->ChangeStorageItem( pSlot->GetHandle() );
}
else if(nCnt >= 10) // 10 개 이상 있을 경우
{
m_pDisplayInfo->RequestStorageItem( pSlot->GetHandle(), count_t( 10 ), TS_CS_STORAGE::INVENTORY_TO_STORAGE); // 10개를 옮긴다
}
else
{
//assert(0); //error
}
}
// AziaMafia Zentrix Alt
if (m_bAltKey)
{
count_t nCnt = pSlot->GetItemCount();
if (nCnt >= 1) // 10 개 이상 있을 경우
m_pDisplayInfo->RequestStorageItem(pSlot->GetHandle(), count_t(nCnt), TS_CS_STORAGE::INVENTORY_TO_STORAGE); // 10개를 옮긴다
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE ) && (bSubSlotCombineItem || bMainSlotCombineItem) ) //조합
{
if(m_bShiftKey) //servantes 2010.10.18
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1 && GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) )) // 여러개가 있을 경우
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), count_t(-1) ) ); //수입력기가 뜬다
}
else // 한 개일 경우
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), count_t(1) ) ); // 1개를 옮긴다
}
}
if(m_bControlKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt == 1) // 1 개가 있을 경우
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), count_t(1) ) );
}
else if(nCnt >= 1 && nCnt < 10) // 1-10 개가 있을 경우
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), nCnt ) );
}
else if(nCnt >= 10) // 10 개 이상 있을 경우
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), count_t( 10 ), true ) );
}
else
{
//assert(0); //error
}
}
// AziaMafia Zentrix Alt
if (m_bAltKey)
{
count_t nCnt = pSlot->GetItemCount();
if (nCnt >= 1) // 1 개가 있을 경우
m_pGameManager->PostMsgAtDynamic(new SIMSG_SET_COMBINEITEM(pSlot->GetHandle(), count_t(nCnt)));
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE ) && (bSubSlotCombineItem || bMainSlotCombineItem) ) //강화
{
//if(m_bShiftKey) //servantes 2010.10.18
//{
// count_t nCnt = pSlot->GetItemCount();
// if(nCnt > 1 && GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) )) // 여러개가 있을 경우
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(-1) ) ); //수입력기가 뜬다
// }
// else // 한 개일 경우
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) ); // 1개를 옮긴다
// }
//}
//if(m_bControlKey)
//{
// count_t nCnt = pSlot->GetItemCount();
// if(nCnt == 1) // 1 개가 있을 경우
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) );
// }
// else if(nCnt >= 1 && nCnt < 10) // 1-10 개가 있을 경우
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), nCnt ) );
// }
// else if(nCnt >= 10) // 10 개 이상 있을 경우
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t( 10 ), true ) );
// }
// else
// {
// //assert(0); //error
// }
//
//}
if ( m_bShiftKey || m_bControlKey )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) );
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) ) //수리
{
//2011.04.26 - servantes / mantis : 12753
if(m_bShiftKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), nCnt, nCnt, false, GetID() ) ); //수입력기가 뜬다
else if(nCnt == 1)
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1), false, GetID() ) ); //1개 옮긴다
}
if(m_bControlKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 0 && nCnt >= 10)
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), count_t(10), count_t(10), true, GetID() ) ); //수입력기가 뜬다
else if(nCnt > 1 && nCnt < 10) // 1-10 개가 있을 경우
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), nCnt, nCnt, false, GetID() ) );
else if(nCnt >= 1)
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1), false, GetID() ) ); //1개 옮긴다
}
//Azia Mafia Zentrix Alt
if (m_bAltKey)
{
count_t nCnt = pSlot->GetItemCount();
if (nCnt >= 1)
m_pGameManager->PostMsgAtDynamic(new SIMSG_REPAIR_MOVEITEM(pSlot->GetHandle(), count_t(nCnt), count_t(nCnt), true, GetID())); //수입력기가 뜬다
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION ) ) //파괴
{
if(m_bShiftKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_DESTROY_MOVEITEM( pSlot->GetHandle(), nCnt, nCnt, false, true ) );
}
else if(nCnt == 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_DESTROY_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1) ) ); //1개 옮긴다
}
}
if(m_bControlKey)
{
count_t nCnt = pSlot->GetItemCount();
if( nCnt > 0 )
{
if( nCnt < 10 ) // 10개 이하
m_pGameManager->PostMsgAtDynamic( new SIMSG_DESTROY_MOVEITEM( pSlot->GetHandle(), count_t(nCnt), count_t(nCnt) ) );
else // 10개 이상
m_pGameManager->PostMsgAtDynamic( new SIMSG_DESTROY_MOVEITEM( pSlot->GetHandle(), count_t(10), count_t(10) ) );
}
}
// AziaMafia Zentrix Alt
if (m_bAltKey)
{
count_t nCnt = pSlot->GetItemCount();
if (nCnt >= 1)
m_pGameManager->PostMsgAtDynamic(new SIMSG_DESTROY_MOVEITEM(pSlot->GetHandle(), count_t(nCnt), count_t(nCnt)));
}
}
// AziaMafia DECOMPOS
else if (m_pGameManager->IsShow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION)) //파괴
{
SUIDecompositionWnd* pDecompositionWnd(dynamicCast<SUIDecompositionWnd*>(m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION)));
if (m_bControlKey || m_bShiftKey || m_bAltKey )
{
if (pDecompositionWnd && pDecompositionWnd->IsShow()) // ★ 분해창이 열려있으면 분해창에 넣는다.
{
pDecompositionWnd->AppendItemUniqueID(pSlot->GetUID());
}
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORE_HOST ) ) //노점열어 팔 때
{
SUIStoreHostWnd* pWnd = (SUIStoreHostWnd*)m_pGameManager->GetSUI( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORE_HOST );
if(pWnd == NULL)
break;
if(m_bShiftKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(nCnt), count_t(nCnt) ) ); //수입력기가 뜬다
}
else if(nCnt == 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1) ) ); //수입력기가 뜬다
}
}
if(m_bControlKey)
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt == 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1) ) ); //수입력기가 뜬다
}
if(nCnt > 1 && nCnt > 10) // 1 개가 있을 경우
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(10), count_t(10), true ) );
}
else if(nCnt > 0)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(nCnt), count_t(nCnt) ) ); //수입력기가 뜬다
}
}
// AziaMafia Zentrix Alt
if (m_bAltKey)
{
count_t nCnt = pSlot->GetItemCount();
if (nCnt >= 1)
{
m_pGameManager->PostMsgAtDynamic(new SIMSG_NOJUM_HOST_MOVEITEM(pSlot->GetHandle(), nCnt , nCnt )); //수입력기가 뜬다
}
}
}
}
}
}
break;
// { sonador 3.9.1 크리쳐 카드 상세 정보창 우클릭 오픈 기능 구현
case KUI_MESSAGE::KICON_RCLICK:
{
int nInvenIndex = GetInvenSlotItemIndex( GetSlotControlNum( lpszControlID ) );
if( (-1) != nInvenIndex )
{
if( m_nInvenSlotStartIndex <= nInvenIndex && nInvenIndex < (m_nInvenSlotStartIndex + (m_nInvenSlotCountY * m_nInvenSlotcountX)) )
{
if( m_nCurrentSelect == nInvenIndex )
m_nCurrentSelect = -1;
else m_nCurrentSelect = nInvenIndex;
RefreshSelection();
RefreshInvenSlots( m_nCurrentSelect-m_nInvenSlotStartIndex );
//크리쳐 카드 인가?
SInventorySlot* pSlot = NULL;
pSlot = m_InventoryMgr.GetItemInfo( GetEquipSlotWearType(lpszControlID) );
if( NULL == pSlot )
{
// 일반 아이템 슬롯인가?
pSlot = GetInvenItem( GetSlotControlNum(lpszControlID) );
}
if( pSlot && GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD )
{
//크리처 카드 윈도우가 열려 있지 않다면
// 2010.08.03 - prodongi
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT ) == false &&
m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK ) == false)
{
//m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE_EX( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD,
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE_EX( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT,
GetRect().left,
GetRect().top,
GetRect().right,
GetRect().bottom ) );
}
SMSG_SUMMON_CARD Msg;
int insert(-1);
AR_HANDLE CardHandle(0);
CardHandle = pSlot->GetHandle();
if( CardHandle )
{
Msg.card_handle = CardHandle;
m_pGameManager->ProcMsgAtStatic( &Msg );
}
}
// 2010.08.17 - prodongi
else if( pSlot && GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_BOSSCARD ||
pSlot && GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_COLLECTION )
{
SMSG_BOSS_MONSTER_CARD msg;
msg.card_handle = pSlot->GetHandle();
if (msg.card_handle)
m_pGameManager->ProcMsgAtStatic(&msg);
}
else
{
CloseCreatureCardWnd();
}
}
}
}
break;
// }
case KUI_MESSAGE::KICON_DBLCLK:
{
if(m_bControlKey) //servantes 2010.12.02
break;
bool bPrayRoom = IsRamadanPrayRoom();
// 2011. 9. 20 - marine 파괴창이 열려있을때는 받지 않는다.
// 2012. 8. 7 - marine 창고창과 파괴창이 같이 열려 있을 때는 더블클릭 메세지는 처리하지 않는다.
if(m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION)->IsShow() &&
m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORAGE)->IsShow() )
break;
// 장착 슬롯인가?
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 )
{
if (GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD )
{
Req_BeltItem( hItem );
}
}
}
else
{
pSlot = m_InventoryMgr.GetItemInfo( GetEquipSlotWearType(lpszControlID) );
if( NULL == pSlot )
{
if ( strcmp( lpszControlID, "icon_bag" ) == 0 )
pSlot = m_InventoryMgr.GetItemInfo( ItemBase::WEAR_BAG_SLOT ); //라이딩은 예외 처리
else
pSlot = GetInvenItem( GetSlotControlNum(lpszControlID) ); // 인벤토리 슬롯이다.
}
if( NULL == pSlot )
break;
if( NULL == m_pGameManager )
break;
SUIDecompositionWnd* pDecompositionWnd( dynamicCast<SUIDecompositionWnd*>( m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION) ) );
if( pDecompositionWnd && pDecompositionWnd->IsShow() ) // ★ 분해창이 열려있으면 분해창에 넣는다.
{
pDecompositionWnd->AppendItemUniqueID( pSlot->GetUID() );
}
else if( m_StorageMgr.IsStorageOpen() ) // ★ 창고가 열려있으면 창고에 넣는다.
{
m_pDisplayInfo->ChangeStorageItem( pSlot->GetHandle() );
}
else // ★ 아이템 사용(장착)
{
bool bSubSlotCombineItem = AbleSubSlot( pSlot );
bool bMainSlotCombineItem = AbleMainSlot( pSlot );
// ★ 조합창이 열려있으면 조합창에 넣는다.
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE )
&& (bSubSlotCombineItem||bMainSlotCombineItem)
&& !pSlot->IsEquipItem() )
{
if(pSlot->GetItemCount() > 1) //servantes 2010.10.20
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), count_t(pSlot->GetItemCount()) ) ); //수입력기가 뜬다 //servantes 2010.12.20 아이템 갯수만큼 최대값 설정
}
else if(pSlot->GetItemCount() == 1)
{
//조합창이 열려있는가?
//조합템(서브슬롯,메인슬롯)인가?
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_COMBINEITEM( pSlot->GetHandle(), count_t(1) ) ); //한개 옮긴다
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE )
&& (bSubSlotCombineItem||bMainSlotCombineItem)
&& !pSlot->IsEquipItem() )
{
//if(pSlot->GetItemCount() > 1) //servantes 2010.10.20
//{
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(pSlot->GetItemCount()) ) ); //수입력기가 뜬다 //servantes 2010.12.20 아이템 갯수만큼 최대값 설정
//}
//else if(pSlot->GetItemCount() == 1)
//{
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) ); //한개 옮긴다
//}
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) );
//int nBigGroup = GetItemDB().GetGroup( pSlot->GetItemCode() );
//if ( nBigGroup == 21 || nBigGroup == 22 )
//{
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) );
//}
//else
//{
// if(pSlot->GetItemCount() > 1) //servantes 2010.10.20
// {
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(pSlot->GetItemCount()) ) ); //수입력기가 뜬다 //servantes 2010.12.20 아이템 갯수만큼 최대값 설정
// }
// else if(pSlot->GetItemCount() == 1)
// {
//
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_UPGRADEITEM( pSlot->GetHandle(), count_t(1) ) ); //한개 옮긴다
//
// //pSlot = GetSlotItemIdexNum( nItemIndex );
//
// }
//}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) ) //수리
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), nCnt, nCnt, 0, GetID() ) ); //수입력기가 뜬다
}
else if(nCnt == 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REPAIR_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1), 0, GetID() ) ); //1개 옮긴다
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TRADE )) //servantes 2010.10.20
{
if(pSlot->GetItemCount() > 1)
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_TRADE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TRADE, pSlot->GetHandle(), pSlot->GetItemCount(), false ) ); //여러개 옮긴다
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TRADE, pSlot->GetItemCount(), SIMSG_UI_REQ_INPUTNUMBER::TYPE_NUMBER ) );
else
m_pGameManager->PostMsgAtDynamic( new SIMSG_SET_TRADE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TRADE, pSlot->GetHandle(), count_t(1), false ) ); //한개 옮긴다
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SOUL_CHARGE ))
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SOULCHARGE_MOVEITEM( pSlot->GetHandle()) ); //한개 옮긴다
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION ) ) //파괴
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_DESTROY_MOVEITEM( pSlot->GetHandle(), nCnt, nCnt, false, true ) );
}
else if(nCnt == 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_DESTROY_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1) ) ); //1개 옮긴다
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORE_HOST ) ) //노점열어 팔 때
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(nCnt), count_t(nCnt) ) ); //수입력기가 뜬다
}
else if(nCnt == 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(1), count_t(1) ) ); //한개 이동
}
}
else if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_JEWEL_EQUIP ) ) //소울스톤세공
{
count_t nCnt = pSlot->GetItemCount();
if(nCnt >= 1)
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SOULSTONE_MOVEITEM( pSlot->GetHandle() ) );
}
}
// 카드.
else if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD )
{
//스킬 카드.
if ( GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SKILLCARD )
{
// 장착해제
if( m_InventoryMgr.IsEquipCard( pSlot->GetHandle() ) )
{
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle(), m_PlayerInfoMgr.GetPlayerHandle(), true );
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound(m_pDisplayInfo->GetMaterial( pSlot->GetHandle() )) );
// m_pGameManager->StartSound( "ui_click_potion01.wav" );
}
//장착
else
{
SIMSG_UI_ACT_INVENTORY invMsg;
invMsg.m_nActType = SIMSG_UI_ACT_INVENTORY::ACT_SKILLCARD_BIND;
invMsg.m_nHandle = pSlot->GetHandle();
invMsg.m_TargetHandle = m_PlayerInfoMgr.GetPlayerHandle();
m_pGameManager->ProcMsgAtStatic( &invMsg );
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound(m_pDisplayInfo->GetMaterial( pSlot->GetHandle() )) );
// m_pGameManager->StartSound( "ui_click_potion01.wav" );
}
}
// 크리쳐카드.
else if( GetItemDB().GetGroup(pSlot->GetItemCode()) == ItemBase::GROUP_SUMMONCARD )
{
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM ) )
{
if( bPrayRoom == true )
return ;
SMSG_REQUEST_EQUIP_SUMMON Msg;
int insert(-1);
AR_HANDLE CardHandle(0);
CardHandle = pSlot->GetHandle();
if( CardHandle )
{
Msg.card_handle = CardHandle;
m_pGameManager->ProcMsgAtStatic( &Msg );
}
}
else //벨트에 크리처 카드 장착
{
Req_BeltItem( pSlot->GetHandle() );
}
}
//
else
{
if( bPrayRoom == true )
return ;
const ItemBase* pItem = (ItemBase*)GetItemDB().GetItemData( pSlot->GetItemCode() );
int nGroup = GetItemDB().GetGroup(pSlot->GetItemCode());
bool bTestCheck(false);
if( bTestCheck )
{
if( pItem )
{
if( pItem->CheckFlag( ItemBase::ITEM_FLAG::FLAG_TARGET_USE ) )
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle(), NULL, false, true );
else
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle() );
}
}
}
}
else
{ //일반 아이템
const ItemBase* pItem = (ItemBase*)GetItemDB().GetItemData( pSlot->GetItemCode() );
// 2010.08.20 - prodongi
if (ItemBase::GROUP_BOSSCARD == pItem->nGroup)
{
Req_BeltItem( pSlot->GetHandle() );
break;
}
//SUIDisplayInfo에도 동일 코드 존재 한곳으로 모으자 ㅡ,.ㅡ
if( pItem->nOptType[ 0 ] == 116 )
{
if ( !m_CreatureSlotMgr.IsExistSummonedCreature( m_PlayerInfoMgr.GetTarget() ) )
{
m_pDisplayInfo->AddSystemMessage( S(389), 7); // Please select a creature
return;
}
saveWillUseHairItem( pSlot->GetHandle() );
std::string itemName = ::getItemName( pSlot->GetItemCode() );
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA("inventory_use_hair_item", itemName.c_str()) );
}
else if( pItem->nOptType[ 0 ] == 117 ) // 염원의 깃털
{
m_pDisplayInfo->UseItemByText( pSlot );
}
else if( pItem->nOptType[ 0 ] == 119 ) // 캐릭터명 변경 sonador #2.1.24
{
SGuiObj changeNameWindow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHANGE_NAME );
_CID( updateChangeNameWnd );
changeNameWindow->PerformKV(
id_updateChangeNameWnd
, KID( "current_name" ), m_PlayerInfoMgr.GetName()
, KID( "item_handle" ), pSlot->GetHandle()
, KID( "target_handle" ), m_PlayerInfoMgr.GetPlayerHandle() );
m_pGameManager->ProcMsgAtStatic( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHANGE_NAME, true, true ) );
}
else if( pSlot->GetItemCode() == 920004 )
{
m_pDisplayInfo->ChangeCreatureName();
}
else if( pSlot->GetItemCode() == 920010 )
{
m_pDisplayInfo->ChangePetName();
}
else
{
if( bPrayRoom == true )
{
if( pItem->nGroup == ItemBase::GROUP_RIDING )
return ;
}
// 2010.05.12 헤어 관련 아이템일 경우에 메세지 박스 출력- prodongi
// 122 : 염색약, 123 : 헤어스타일
// 추후에 메세지 박스가 필요한 아이템에 대한 플래그를 설정하기로 함
/*
if (122 == pItem->nOptType[0] || 123 == pItem->nOptType[0])
{
saveWillUseHairItem(pSlot->GetHandle());
std::string itemName = ::getItemName(pSlot->GetItemCode());
m_pGameManager->PostMsgAtDynamic(new SMSG_SEND_DATA("inventory_use_hair_item", itemName.c_str()));
}
else
{
if( pItem->CheckFlag( ItemBase::ITEM_FLAG::FLAG_TARGET_USE ) )
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle(), NULL, false, true );
else
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle() );
}
*/
// 2010.06.11 동일한 기본 헤어 타입 아이템을 사용했을때는 막는다 - prodongi
if (checkUseEqualHairTypeItem(pItem))
return ;
// 2010.07.27 - prodongi
int msgId;
if (!checkEnableUseItem(pItem, pSlot->GetItemCode(), m_pDisplayInfo, msgId))
{
m_pDisplayInfo->SetSysMsg( msgId );
return ;
}
if( pItem->CheckFlag( ItemBase::ITEM_FLAG::FLAG_TARGET_USE ) )
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle(), NULL, false, true );
else
m_pDisplayInfo->UseOrEquipItem( pSlot->GetHandle() );
/// 2011.07.07 - prodongi
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_OPEN_BADGE(pSlot->GetItemCode()));
}
}
}
}
}
break;
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( IsBlockedAction(lpszControlID) )
break;
// 아이템삭제.
else if( !::_stricmp( lpszControlID, "button_warning" ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION ) );
// sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현.
else if( !::_stricmp( lpszControlID, c_szArrangeButton ) )
{
_ReqArrangeItem();
//m_nCrrScrollIndex = 0;; //servantes 2010.12.01
}
// 닫기.
else if( !::_stricmp( lpszControlID, "_close" ) || !::_stricmp( lpszControlID, "button_close" ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, 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 ) ); // 크리쳐카드.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, false ) );
CloseCreatureCardWnd();
}
// 인벤토리 열기.
else if( !::_stricmp( lpszControlID, "mark_bag" ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT ) );
// 조합창 열기.
else if( !::_stricmp( lpszControlID, "button_mix" ) ) // button_combine
{
// 2011.07.27 - servantes : 수리창 열때 처리 : 이전 코드 삭제
SUIWnd* pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE);
if(pWnd)
{
KRect rtWnd = pWnd->GetRect();
int nPos = GetRect().right - rtWnd.GetWidth() + 2;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, nPos, GetRect().bottom - 4 ) ); //수리
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_ITEMCOMBINE, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, false ) );
m_pGameManager->GetGameInterface()->SetCurrentSelectUI(TOGGLE_WINDOW::UIWINDOW_ITEMCOMBINE);
}
}
// 아이템강화 창 열기.
else if( !::_stricmp( lpszControlID, "button_enchant" ) )
{
// 2011.07.27 - servantes : 아이템강화창 열때 처리 : 이전 코드 삭제
SUIWnd* pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE);
if(pWnd)
{
KRect rtWnd = pWnd->GetRect();
int nPos = GetRect().right - rtWnd.GetWidth() + 2;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, nPos, GetRect().bottom - 4 ) ); //강화
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, 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_DECOMPOSITION, false ) );
m_pGameManager->GetGameInterface()->SetCurrentSelectUI(TOGGLE_WINDOW::UIWINDOW_UPGRADE);
}
}
// 수리창 열기.
else if( !::_stricmp( lpszControlID, "button_repair" ) )
{
// 2011.07.27 - servantes : 수리창 열때 처리 : 이전 코드 삭제
SUIWnd* pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR);
if(pWnd)
{
KRect rtWnd = pWnd->GetRect();
int nPos = GetRect().right - rtWnd.GetWidth() + 2;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, nPos, GetRect().bottom - 4 ) ); //수리
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, 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_DECOMPOSITION, false ) );
m_pGameManager->GetGameInterface()->SetCurrentSelectUI(TOGGLE_WINDOW::UIWINDOW_REPAIR);
}
}
else if( !::_stricmp( lpszControlID, "button_decompose_01" ) ) // 분해
{
SUIWnd* pDecompositionWnd( m_pGameManager->GetSUI( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION ) );
if( pDecompositionWnd )
{
KRect rtDecompositionWnd( pDecompositionWnd->GetRect() );
KRect rtInventoryWnd( GetRect() );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, rtInventoryWnd.left - rtDecompositionWnd.GetWidth() + 2, rtInventoryWnd.top - 1 ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, 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_ITEMCOMBINE, false ) );
}
}
// 수령함 열기.
else if( !::_stricmp( lpszControlID, "button_cart" ) )
{
/// 2010.12.16 - prodongi
m_pGameManager->PostMsgAtDynamic( new SMSG_CHAT_COMMAND(SMSG_CHAT_COMMAND::CHAT_CASHSTORAGE_OPEN) );
}
// 크루샾 열기.
else if( !::_stricmp( lpszControlID, "button_khrooshop" ) )
{
if( ENV().IsExist( "commercial_shop" ) == true )
{
//캐쉬창고
m_pGameManager->PostMsgAtDynamic( new SMSG_CHAT_COMMAND(SMSG_CHAT_COMMAND::CHAT_CASHSTORAGE_OPEN) );
//크루샾 오픈
if( !m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_TITLE ) &&
!m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ) &&
!m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_TITLE ) &&
!m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPURL_TITLE ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_CASHSHOP_OPEN, S(944), true ) );
}
}
}
// 도움말 윈도우.
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( 9760 ) ) ) ); // 텍스트전달.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, true ) ); // 열기.
}
// 인벤토리 열기. //servantes 2010.11.05
else if( !::_stricmp( lpszControlID, "button_character" ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT ) );
bool bOpenEquipWndFlag = GetGameOption().GetOpenEquipWnd();
GetGameOption().SetOpenEquipWnd( !bOpenEquipWndFlag );
}
else
__noop;
}
break;
case KUI_MESSAGE::KSCROLL_SELECT:
{
m_nPrevInvenSlotStartIndex = m_nInvenSlotStartIndex;
m_nCrrScrollIndex = max( int(lparam), 0 );
m_nInvenSlotStartIndex = m_nCrrScrollIndex * m_nInvenSlotcountX;
if( m_nInvenSlotStartIndex >= m_vecInvenList.size() )
m_nInvenSlotStartIndex = m_nPrevInvenSlotStartIndex;
RefreshInvenSlots();
RefreshSelection();
RefreshItemCoolTime();
}
break;
case KUI_MESSAGE::KGENWND_MOVE:
{
LimitMoveWnd(); //servantes 2010.11.19
RefreshWeight();
//servantes 2010.11.05
KRect rt;
if(m_pEquipmentWnd) //servantes 2010.12.09
{
// 윈도우 위치지정.
KRect rtEqmtWnd = m_pEquipmentWnd->GetRect();
rt = this->GetRect();
//servantes 2010.11.17
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, rt.left + 0 - rtEqmtWnd.GetWidth(), rt.bottom ) ); // 장비창
}
SUIWnd* pDecompositionWnd( m_pGameManager->GetSUI( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION ) );
if( pDecompositionWnd )
{
KRect rtDecompositionWnd( pDecompositionWnd->GetRect() );
KRect rtInventoryWnd( GetRect() );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION, rtInventoryWnd.left - rtDecompositionWnd.GetWidth() + 2, rtInventoryWnd.top - 1 ) );
}
//servantes 2010.11.30
bool bOpen = true; //servantes 2010.11.29
int aID[3] = {
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, // 조합
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, // 강화
SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR // 수리
};
for(int k=0; k<3; k++)
{
SUIWnd* pWnd = m_pGameManager->GetSUI(aID[k]);
if( pWnd && pWnd->IsShow() )
{
KRect rtWnd = pWnd->GetRect();
int nPos = GetRect().right - rtWnd.GetWidth() + 2;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( (SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE)aID[k], nPos, rt.bottom - 4 ) ); // 강화.
}
}
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_STORAGE, GetRect().left, GetRect().bottom ) );
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
//servantes 2010.11.30
// 창이 화면 밖으로 나가지 않도록 위치 조정 // servantes 2010.11.19
void SUIInventoryWnd::LimitMoveWnd()
{
bool bExtendW=false, bExtendH=false;
SUIWnd* pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE);
if(pWnd && pWnd->IsShow())
bExtendH = true;
pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE);
if(pWnd && pWnd->IsShow())
bExtendH = true;
pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR);
if(pWnd && pWnd->IsShow())
bExtendH = true;
SUIWnd* pWndEquip = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT);
if(pWndEquip && pWndEquip->IsShow())
bExtendW = true;
SUIWnd* pWndDecomposition( m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DECOMPOSITION) );
if(pWndDecomposition && pWndDecomposition->IsShow())
bExtendW = true;
if(bExtendW)
{
const KSize& rResolution = KUIWndManager::GetResolution();
KRect rWndRect;
rWndRect.left = GetRect().left;
rWndRect.right = GetRect().right;
rWndRect.top = GetRect().top;
rWndRect.bottom = GetRect().bottom;
rWndRect.left -= (pWndEquip->GetRect().GetWidth() - 8);
if(bExtendH)
rWndRect.bottom += (pWnd->GetRect().GetHeight() - 6);
KRect rcLimit( 0, 0, rResolution.cx, rResolution.cy );
KSize sizMoveOffset( 0, 0 );
if( rWndRect.left < rcLimit.left ) sizMoveOffset.cx += (rcLimit.left - rWndRect.left );
if( rWndRect.top < rcLimit.top ) sizMoveOffset.cy += (rcLimit.top - rWndRect.top );
if( rWndRect.right > rcLimit.right ) sizMoveOffset.cx += (rcLimit.right - rWndRect.right );
if( rWndRect.bottom > rcLimit.bottom ) sizMoveOffset.cy += (rcLimit.bottom - rWndRect.bottom);
if( 0 != sizMoveOffset.cx || 0 != sizMoveOffset.cy )
MovePosOffset( sizMoveOffset.cx, sizMoveOffset.cy );
}
else if(bExtendH)
{
const KSize& rResolution = KUIWndManager::GetResolution();
KRect rWndRect;
rWndRect.left = GetRect().left;
rWndRect.right = GetRect().right;
rWndRect.top = GetRect().top;
rWndRect.bottom = GetRect().bottom;
rWndRect.left -= (pWndEquip->GetRect().GetWidth() - 8);
rWndRect.bottom += (pWnd->GetRect().GetHeight() - 6);
KRect rcLimit( 0, 0, rResolution.cx, rResolution.cy );
KSize sizMoveOffset( 0, 0 );
if( rWndRect.left < rcLimit.left ) sizMoveOffset.cx += (rcLimit.left - rWndRect.left );
if( rWndRect.top < rcLimit.top ) sizMoveOffset.cy += (rcLimit.top - rWndRect.top );
if( rWndRect.right > rcLimit.right ) sizMoveOffset.cx += (rcLimit.right - rWndRect.right );
if( rWndRect.bottom > rcLimit.bottom ) sizMoveOffset.cy += (rcLimit.bottom - rWndRect.bottom);
if( 0 != sizMoveOffset.cx || 0 != sizMoveOffset.cy )
MovePosOffset( sizMoveOffset.cx, sizMoveOffset.cy );
}
else
{
SUIWnd::LimitMoveWnd();
}
}
bool SUIInventoryWnd::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 SUIInventoryWnd::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 SUIInventoryWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_ITEM_ERASE: // 아이템파괴.
case MSG_ITEM_DESTROY:
pMsg->bUse = true;
RefreshInvenItems();
RefreshWeight();
RefreshItemCoolTime();
break;
case MSG_ITEM_WEAR_INFO:
RefreshInvenItems();
break;
case MSG_BELT_SLOT_INFO:
RefreshInvenSlots();
break;
case MSG_UPDATE_ITEM_COUNT:
case MSG_ITEM_INVEN:
case MSG_SKILLCARD_INFO:
{
RefreshInvenItems();
RefreshWeight();
RefreshItemCoolTime();
}
break;
case MSG_ITEM_COOL_TIME:
{
RefreshItemCoolTime();
}
break;
case MSG_GOLD_UPDATE:
RefreshGold();
break;
case MSG_LEVEL_UPDATE: // 아이템 툴팁 갱신
RefreshInvenSlots();
break;
case MSG_PROPERTY:
{
SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg;
if( m_PlayerInfoMgr.IsLocalPlayer(pPropertyMsg->handle) )
{
switch( pPropertyMsg->nPropertyType )
{
case SMSG_PROPERTY::PROPERTY_GOLD:
RefreshGold();
break;
case SMSG_PROPERTY::PROPERTY_LEVEL: // 아이템 툴팁 갱신
RefreshInvenSlots();
break;
case SMSG_PROPERTY::PROPERTY_WEIGHT:
RefreshWeight();
break;
case SMSG_PROPERTY::PROPERTY_STAMINA:
case SMSG_PROPERTY::PROPERTY_MAX_STAMINA:
break;
// 헌터홀릭포인트.
case SMSG_PROPERTY::PROPERTY_HUNTAHOLICPOINT:
{
std::string strHolicPoint( m_strDeco );
strHolicPoint += CStringUtil::GetCommaNumberString( this->m_PlayerInfoMgr.GetHuntaHolicPoint() );
GetChild("text_06")->SetCaption( strHolicPoint.c_str() );
}
break;
/// 2012.06.12 - prodongi
case SMSG_PROPERTY::PROPERTY_AP:
{
std::string strComma;
std::string caption;
strComma = CStringUtil::GetCommaNumberString(m_PlayerInfoMgr.GetAP());
XStringUtil::Format(caption, "<font:font_01><size:8><right>%s", strComma.c_str());
SetChildCaption("text_09", caption.c_str());
}
break;
}
}
}
break;
case IMSG_UI_STATE_UPDATE:
{
//Lending Item ToolTip 갱신
RefreshLendingItemTooltip();
}
break;
case IMSG_UI_DISCARDITEM:
{
// Item 의 요청상태.
this->m_InventoryMgr.SetItemRqState( RQ_ITEM_STATE::RQ_ITEM_STATE_DROP );
m_pDisplayInfo->DiscardItem( m_ReserveDropItemHandle );
m_ReserveDropItemHandle = NULL;
pMsg->bUse = true;
}
break;
case IMSG_UI_INPUTNUMBER:
{
SIMSG_UI_INPUTNUMBER* pInputNumberMsg = (SIMSG_UI_INPUTNUMBER*)pMsg;
if( pInputNumberMsg->m_nValue > 0 )
{
// 아이템 버리기.
if( m_ReserveDropItemHandle )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_ReserveDropItemHandle );
if( pSlot )
{
count_t nValue = (pInputNumberMsg->m_nValue < pSlot->GetItemCount()) ? pInputNumberMsg->m_nValue : pSlot->GetItemCount();
m_pDisplayInfo->DiscardItem( m_ReserveDropItemHandle, nValue );
}
m_ReserveDropItemHandle = NULL;
}
// 아이템 파괴창으로 이동.
else if( m_DestroyItemHandle )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_DestroyItemHandle );
if( pSlot )
{
count_t nValue = (pInputNumberMsg->m_nValue < pSlot->GetItemCount()) ? pInputNumberMsg->m_nValue : pSlot->GetItemCount();
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_DESTROY_ITEM( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION, m_DestroyItemHandle, nValue ) );
}
m_DestroyItemHandle = NULL;
}
else if( m_StorageMgr.GetDragItem() ) //servantes 2010.10.15
{
AR_HANDLE hDragItem = m_StorageMgr.GetDragItem();
m_pDisplayInfo->ChangeStorageItem(hDragItem, false, pInputNumberMsg->m_nValue);
}
}
}
break;
case IMSG_UI_INPUTTEXT:
{
SIMSG_UI_INPUTTEXT* pInputTextMsg = (SIMSG_UI_INPUTTEXT*)pMsg;
if(pInputTextMsg->m_nUsage == SIMSG_UI_REQ_INPUTTEXT::USAGE_CREATURE_NAMEPLATE)
{
// 크리처 이름 길이 제한 체크
if( !pInputTextMsg->m_strText.empty() && pInputTextMsg->m_strText.size() <= 18)
{
AR_HANDLE hCreature(0);
SCreatureSlotMgr* pCreature = m_pDisplayInfo->GetCreatureManager();
if( pCreature )
//hCreature = pCreature->GetActiveCreatureQuickSlot();
hCreature = pCreature->GetSummonedCreature(0);
AR_HANDLE handle = m_InventoryMgr.GetItemHandleForCode(920004);
if( handle && hCreature )
m_pDisplayInfo->UseNameChangeItem( handle, hCreature, pInputTextMsg->m_strText.c_str() );
}
else
{
// 잘못된 이름입니다. 메시지 박스 출력
//m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GENERAL, S(128), false) );
m_pDisplayInfo->AddSystemMessage( S(128), 0 ); // Invalid name
}
}
else if(pInputTextMsg->m_nUsage == SIMSG_UI_REQ_INPUTTEXT::USAGE_CHANGE_PET_NAME)
{
// 펫 이름 길이 제한 체크
if( !pInputTextMsg->m_strText.empty() && pInputTextMsg->m_strText.size() <= 18)
{
AR_HANDLE hPet(0);
AR_HANDLE handle = m_InventoryMgr.GetItemHandleForCode(920010);
hPet = m_PetMgr.GetSummonPetData().pet_handle;
if( handle && hPet )
m_pDisplayInfo->UseNameChangeItem( handle, hPet, pInputTextMsg->m_strText.c_str() );
}
else
{
// 잘못된 이름입니다. 메시지 박스 출력
m_pDisplayInfo->AddSystemMessage( S(128), 0 ); // Invalid name
}
}
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = (SIMSG_UI_MOVE*)pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
RefreshWeight();
pMsg->bUse = true;
}
break;
case MSG_STAT_INFO:
{
RefreshWeight();
pMsg->bUse = true;
}
break;
case MSG_RESULT: // sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현
{
SMSG_RESULT* pMsgResult = dynamicCast<SMSG_RESULT*>(pMsg);
switch( pMsgResult->request_msg_id )
{
case TM_CS_ARRANGE_ITEM:
{
switch( pMsgResult->result )
{
case RESULT_SUCCESS:
case RESULT_NOT_ACTABLE:
case RESULT_COOL_TIME:
m_ActionTicker.satisfy();
break;
}
}
break;
}
pMsg->bUse = true;
}
break;
case IMSG_HOTKEY_EX:
{
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() )
{
RefreshInvenSlots( m_nCurrentSelect-m_nInvenSlotStartIndex );
}
}
}
break;
// 2010.05.12 - prodongi
case IMSG_UI_USE_HAIR_ITEM:
{
SIMSG_UI_USE_HAIR_ITEM* useHairItem = (SIMSG_UI_USE_HAIR_ITEM*)pMsg;
if (m_willUseHairItem && 0 == useHairItem->m_result)
m_pDisplayInfo->UseOrEquipItem( m_willUseHairItem, NULL, false, true );
m_willUseHairItem = 0;
}
break;
// 캐쉬아이템 업데이트.
case IMSG_UPDATE_CASHITEM:
{
KUIWnd * pWnd = GetChild( "mark_new_cashitem" );
if( pWnd )
{
if( this->m_InventoryMgr.GetCashItemList().size() > 0 )
pWnd->SetShow( true );
else
pWnd->SetShow( false );
}
}
break;
case IMSG_UI_SEND_DATA: //servantes 2010.12.21
{
SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg;
if( pData->m_strString == "RefreshSelection" )
{
// m_nCurrentSelect = (-1);
// SetChildShow( "static_iconselection", false );
// m_nInvenSlotStartIndex = 0;
m_pDragAndDropIcon->EnableState(STATE_NORMAL, false);
m_pDragAndDropIcon->EnableState(STATE_CAN_DROP, false);
m_pDragAndDropIcon->EnableState(STATE_CANNOT_DROP, false);
if(m_ReserveDropItemHandle)
{
m_pDisplayInfo->DiscardItem( m_ReserveDropItemHandle );
m_ReserveDropItemHandle = NULL;
}
// m_pDisplayInfo->SetUIDragInfo();
RefreshInvenItems();
// m_StorageMgr.SetDragItem(NULL);
}
}
break;
}
}
void SUIInventoryWnd::RefreshScrollBar()
{
if( m_pScrollBar )
{
int nSize = m_vecInvenList.size();
int nLineCount = nSize / m_nInvenSlotcountX;
//nLineCount += ( nSize % m_nInvenSlotcountX );
if( ( nSize % m_nInvenSlotcountX ) > 0 )
nLineCount += 1;
m_pScrollBar->SetPosition( m_nCrrScrollIndex ); // m_nInvenSlotStartIndex );
m_pScrollBar->SetScrollRange( c_nInvenSlotCount_Y, nLineCount );
}
}
void SUIInventoryWnd::RefreshGold()
{
KUIWnd* pWnd = GetChild(c_szGOLD);
__int64 nGold = m_PlayerInfoMgr.GetGold().getAmount();
std::string strString = "";
if (nGold >= 1000000000000) strString += "<#FF0000>";
else if (nGold >= 100000000000) strString += "<#FF00F3>";
else if (nGold >= 10000000000) strString += "<#FF1493>";
else if (nGold >= 1000000000) strString += "<#00FFFC>";
else if (nGold >= 100000000) strString += "<#FF8C00>";
else if (nGold >= 10000000) strString += "<#FFFF00>";
else if (nGold >= 1000000) strString += "<#4AD55D>";
//m_strDeco += strString;
if (NULL != pWnd)
{
std::string strGold(m_strDeco);
strGold += strString;
strGold += CStringUtil::GetCommaNumberString(nGold);
pWnd->SetCaption(strGold.c_str());
}
}
//void SUIInventoryWnd::RefreshGold()
//{
// KUIWnd* pWnd = GetChild( c_szGOLD );
// if( NULL != pWnd )
// {
// std::string strGold( m_strDeco );
// strGold += CStringUtil::GetCommaNumberString( m_PlayerInfoMgr.GetGold().getAmount() );
//
// pWnd->SetCaption( strGold.c_str() );
// }
//}
void SUIInventoryWnd::RefreshWeight()
{
float fInvenWeight = m_PlayerInfoMgr.GetPlayerInfo().GetInvenWeigth();
int nMaxWeight = m_PlayerInfoMgr.GetPlayerInfo().GetWeight();
float fWeightRatio = fInvenWeight / float(nMaxWeight);
/// 2011.08.02 - prodongi
if (0.0f > fWeightRatio) fWeightRatio = 0.0f;
else if (1.0f < fWeightRatio) fWeightRatio = 1.0f;
KUIWnd* pWnd = GetChild( c_szWEIGHT );
if( NULL != pWnd )
{
std::string strWeight = CStringUtil::StringFormat( "%s%d%% ( ", m_strDeco.c_str(), int(fWeightRatio * 100.0f) );
strWeight += CStringUtil::GetCommaNumberString( fInvenWeight );
strWeight += " / ";
strWeight += CStringUtil::GetCommaNumberString( nMaxWeight );
strWeight += " )";
pWnd->SetCaption( strWeight.c_str() );
}
// 무게게이지 컨트롤. 안쓰임 강제Hide
/*
if( m_pCtrlWeightGauge )
{
m_pCtrlWeightGauge->SetShow( false );
//m_pCtrlWeightGauge->SetAniName( fWeightRatio < 0.75f ? "common_guage_titanium_line_yellowgreen" : "common_guage_titanium_line_red" );
//KRect rt = m_pCtrlWeightGauge->GetRect();
//rt.right = rt.left + m_fWeightGaugeWidth * fWeightRatio;
//m_pCtrlWeightGauge->ClipRect( rt );
//// 2011.06.22 - servantes : matis - 13049
//m_pCtrlWeightGauge->Resize( rt );
}
*/
}
void SUIInventoryWnd::RefreshItemCoolTime()
{
if( !IsShow() ) return;
KUIControlClockBox* pItemClock = NULL;
int nVisibleSlotCount = (m_nInvenSlotCountY * m_nInvenSlotcountX);
int nMaxCount = (m_nInvenSlotCountY+1) * m_nInvenSlotcountX; //한번에 두개가 줄어 드는 경우엔 버그..
for( int nSlot( 0 ); nSlot < c_nMaxInvenSimpleMaxSlotCount/*nMaxCount*/; ++nSlot )
{
KUIWnd * pWnd = GetChild( CStringUtil::StringFormat("item_clockbox%02d", nSlot).c_str() );
if( pWnd == NULL ) continue;
pItemClock = ( KUIControlClockBox* )pWnd;
pItemClock->SetShow( false );
SInventorySlot* pSlot = GetInvenItem(nSlot);
if( pSlot == NULL ) continue;
bool bEnable = (!m_bSimpleMode && pSlot);
if( nSlot >= nVisibleSlotCount ) continue;
const ItemBaseEx_info * pItemInfo = GetItemDB().GetItemData( pSlot->GetItemCode() );
if( pItemInfo->nType == ItemBase::TYPE_USEABLE ||
pItemInfo->nType == ItemBase::TYPE_USE)
{
pItemClock->SetMaxTime( m_InventoryMgr.GetItemMaxCoolTime( (pItemInfo->nCoolTimeGroup-1) ) );
pItemClock->SetCurTime( m_InventoryMgr.GetItemCurCoolTime( (pItemInfo->nCoolTimeGroup-1) ) );
pItemClock->Begin();
pItemClock->SetShow( true );
}
}
}
#ifdef DECO
void SUIInventoryWnd::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_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_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;
}
}
#endif
#ifndef DECO
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void SUIInventoryWnd::RefreshEquipItems()
{
for( int nWearType = 0; nWearType < ItemBase::MAX_ITEM_WEAR; nWearType++ )
RefreshEquipItem( c_EquipSetNames[ nWearType ], c_EquipAniNames[nWearType], m_pInvenMgr->GetItemInfo(nWearType) );
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
void SUIInventoryWnd::RefreshInvenItems()
{
//2012. 8.8 - marine redmine 24922 셀렉트 상태가 계속 풀려 툴팁이 꺼지는 버그가 발생,,
//m_nCurrentSelect = (-1);
/// 2010.11.24 - prodongi
//m_InventoryMgr.GetInvenDataList( m_CurrentCategory, m_vecInvenList, m_CreatureSlotMgr );
//m_InventoryMgr.GetInvenDataList( m_CurrentCategory, m_vecInvenList );
m_InventoryMgr.GetInvenDataList2( m_CurrentCategory, m_vecInvenList );
RefreshScrollBar();
RefreshInvenSlots();
RefreshSelection();
CloseCreatureCardWnd();
}
void SUIInventoryWnd::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 = GetInvenItem(nSlot);
if( !pSlot || pSlot->GetItem()->remain_time <= 0 ) continue;
pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat("icon_item%02d", nSlot).c_str() ));
if( pIcon == NULL ) continue;
if( nSlot >= nVisibleSlotCount )
{
continue;
}
if( pSlot )
{
/// 2011.03.28 - prodongi
pIcon->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true, NULL, true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
if( m_bAltKey )
{
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIcon, pSlot );
}
}
}
}
void SUIInventoryWnd::CloseCreatureCardWnd()
{
//크리처 카드 윈도우 닫기
if( m_pGameManager == NULL ) return;
//if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD ) )
// 2010.08.03 - prodongi
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT ) )
{
/*
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD, false ) );
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_SUB ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_SUB, false ) );
*/
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, false ) );
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK ) )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, false ) );
}
}
KUIControlMultiIcon* SUIInventoryWnd::SetInvenSlot( int nSlot )
{
KUIControlMultiIcon* pIcon = NULL;
SInventorySlot* pSlot = GetInvenItem(nSlot);
int nVisibleSlotCount = (m_nInvenSlotCountY * m_nInvenSlotcountX);
pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat("icon_item%02d", nSlot).c_str() ));
if( pIcon == NULL )
return NULL;
bool bEnable = (!m_bSimpleMode && pSlot);
if( nSlot >= nVisibleSlotCount )
{
pIcon->SetShow(false);
SetChildShow( CStringUtil::StringFormat( "static_itemcount%02d", nSlot ).c_str(), false );
return NULL;
}
ResetMultiIcon( pIcon, 0, 8 );
if( pSlot )
{
//sun
// 2010.06.10 - prodongi
std::string iconName;
getIconNameAtDurability(pSlot, iconName);
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName.c_str());
////TODO 하드 코딩
//pIcon->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) );
pIcon->SetIcon( 1, c_szDEF_SPR_NAME, pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL );
//카드 아이템
if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD )
{
if( GetItemDB().GetGroup( pSlot->GetItemCode() ) == ItemBase::GROUP_SUMMONCARD )
{
bool isSummon = pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_SUMMON ); /// 2011.03.29 - prodongi
if (isSummon)
setSummonCardIcon( pIcon, pSlot );
pIcon->SetIcon( 5, c_szDEF_SPR_NAME, m_InventoryMgr.IsBeltSlotCard( pSlot->GetHandle() ) ? g_strBeltIcon : NULL );
}
else if( GetItemDB().GetGroup( pSlot->GetItemCode() ) == ItemBase::GROUP_SKILLCARD )
{
setSkillCardIcon(pIcon, pSlot->GetItemCode(), m_InventoryMgr.IsEquipCard(pSlot->GetHandle()));
}
else
pIcon->SetIcon( 2, c_szDEF_SPR_NAME, m_InventoryMgr.IsEquipCard( pSlot->GetHandle() ) ? g_strEquipIcon : NULL );
}
else // 장비장착E.
{
// 2010.08.20 - prodongi
if (ItemBase::GROUP_BOSSCARD == GetItemDB().GetGroup(pSlot->GetItemCode()))
pIcon->SetIcon( 5, c_szDEF_SPR_NAME, m_InventoryMgr.IsBeltSlotCard( pSlot->GetHandle() ) ? g_strBeltIcon : NULL );
else if( GetItemDB().GetUseType( pSlot->GetItemCode() ) == ItemBase::TYPE_COLLECTION )
{
pIcon->SetIcon( 4, c_szDEF_SPR_NAME, "game_panel_item_collection" );
pIcon->SetIcon( 5, c_szDEF_SPR_NAME, NULL );
}
else
pIcon->SetIcon( 2, c_szDEF_SPR_NAME, pSlot->IsEquipItem() ? g_strEquipIcon : NULL );
}
if( pSlot->GetItemAppearance() )
pIcon->SetIcon( 4, c_szDEF_SPR_NAME, g_strLookChangeIcon );
if( pSlot->IsAppendedDecomposeWnd() )
pIcon->SetIcon( 5, c_szDEF_SPR_NAME, g_strAppendedDecomposeWndIcon );
EquipItemAddtionalIconSetter icon_setter( pIcon, pSlot );
bool bDetail = ((m_nCurrentSelect-m_nInvenSlotStartIndex) == nSlot);
/// 2011.03.28 - prodongi
pIcon->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, bDetail, true ) );
if( m_bAltKey && bDetail )
{
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIcon, pSlot );
}
// SetChildShow ( CStringUtil::StringFormat( "static_item%02d" , nSlot ).c_str(), bEnable );
// SetChildCaption( CStringUtil::StringFormat( "static_item%02d" , nSlot ).c_str(), m_pDisplayInfo->GetItemName(pSlot->GetItemCode(), pSlot->GetEnhance(), pSlot->GetLevel(), pSlot->GetXFlag()).c_str() );
SetChildShow ( CStringUtil::StringFormat( "static_itemcount%02d", nSlot ).c_str(), GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) ? pSlot->GetItemCount().getAmount() : 0 );
SetChildCaption( CStringUtil::StringFormat( "static_itemcount%02d", nSlot ).c_str(), CStringUtil::StringFormat( "%s<right><size:8><shadow>%I64d", S(6425),
GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) ? pSlot->GetItemCount().getAmount() : 0 ).c_str() );
}
else
{
// 빈 슬롯
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" );
pIcon->SetLazyTooltip();
// SetChildShow ( CStringUtil::StringFormat( "static_item%02d" , nSlot ).c_str(), false );
// SetChildCaption( CStringUtil::StringFormat( "static_item%02d" , nSlot ).c_str(), "" );
SetChildShow ( CStringUtil::StringFormat( "static_itemcount%02d", nSlot ).c_str(), false );
}
return pIcon;
}
void SUIInventoryWnd::RefreshInvenSlots( int nSlot/*-1*/ )
{
// int nMaxCount = (m_nInvenSlotCountY+1) * m_nInvenSlotcountX; //한번에 두개가 줄어 드는 경우엔 버그..
if( nSlot == -1 )
{
for( int nSlotIndex( 0 ); nSlotIndex < c_nMaxInvenSimpleMaxSlotCount/*nMaxCount*/; ++nSlotIndex )
{
KUIControlMultiIcon* pIcon = SetInvenSlot( nSlotIndex );
if( pIcon ) pIcon->SetShow(true);
}
}
else
{
KUIControlMultiIcon* pIcon = SetInvenSlot( nSlot );
if( pIcon ) pIcon->SetShow(true);
}
}
void SUIInventoryWnd::RefreshSelection()
{
if( 0 <= m_nCurrentSelect && m_nCurrentSelect < m_vecInvenList.size() )
{
int nSlot = (m_nCurrentSelect - m_nInvenSlotStartIndex);
if( 0 <= nSlot && nSlot < (m_nInvenSlotCountY * m_nInvenSlotcountX) )
{
KUIWnd* pItemIconControl = GetChild( CStringUtil::StringFormat( "icon_item%02d", nSlot ).c_str() );
// KUIWnd* pItemNameControl = GetChild( CStringUtil::StringFormat( "static_item%02d", nSlot ).c_str() );
if( NULL != pItemIconControl /*&& NULL != pItemNameControl*/ )
{
const KRect& rIconRect = pItemIconControl->GetRect();
// const KRect& rNameRect = pItemNameControl->GetRect();
SetMovePos( "static_iconselection", rIconRect.left /*+ c_nIconSelectionCorrectX*/, rIconRect.top /*+ c_nIconSelectionCorrectY*/ );
// SetMovePos( "static_selection", rNameRect.left + c_nNameSelectinCorrectX, rNameRect.top );
SetChildShow( "static_iconselection", true );
// SetChildShow( "static_selection", true );
}
}
else
{
SetChildShow( "static_iconselection", false );
// SetChildShow( "static_selection", false );
}
}
else
{
m_nCurrentSelect = (-1);
SetChildShow( "static_iconselection", false );
// SetChildShow( "static_selection", false );
}
// if( m_bSimpleMode ) SetChildShow("static_selection");
}
#ifdef DECO
void SUIInventoryWnd::RefreshEquipItem( const char* szControlID, const char* defAniName, SInventorySlot* pSlot, const char* lpTooltip )
{
// 장착 슬롯 컨트롤
KUIControlMultiIcon* pEquipControl = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
if( pEquipControl )
{
ResetMultiIcon( pEquipControl, 0, 8 );
if( pSlot )
{
/// 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 );
/// 2011.03.28 - prodongi
pEquipControl->SetLazyTooltip( new KLazyItemTooltip( *m_pDisplayInfo, pSlot, true, NULL, true ) ); // sonador #2.1.2.4.3 팻 조작 UI 연동
if( m_bAltKey )
{
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pEquipControl, pSlot );
}
}
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();
}
}
}
#endif
#ifndef DECO
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void SUIInventoryWnd::RefreshEquipItem( const char* szControlID, const char* defAniName, SInventorySlot* pSlot )
{
// 장착 슬롯 컨트롤
KUIControlMultiIcon* pEquipControl = dynamicCast<KUIControlMultiIcon*>(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
SInventorySlot* SUIInventoryWnd::GetInvenItem( int nSlotControlNum )
{
int nInvenIndex = GetInvenSlotItemIndex( nSlotControlNum );
return (nInvenIndex != -1) ? m_vecInvenList[nInvenIndex] : NULL;
}
int SUIInventoryWnd::GetInvenSlotItemIndex( int nSlotControlNum ) const
{
if( 0 <= nSlotControlNum && nSlotControlNum < m_nInvenMaxSlotCount )
{
int nInvenIndex = (nSlotControlNum + m_nInvenSlotStartIndex);
//if( 0 <= nInvenIndex && nInvenIndex < m_InventoryVector.size() )
if( 0 <= nInvenIndex && nInvenIndex < m_vecInvenList.size() )
return nInvenIndex;
}
return (-1);
}
int SUIInventoryWnd::GetSlotControlNum( const char* szSlotControlID ) const
{
for( int nIndex( 0 ); nIndex < m_nInvenMaxSlotCount; ++nIndex )
{
if( 0 == ::_stricmp( CStringUtil::StringFormat( "icon_item%02d", nIndex ).c_str(), szSlotControlID ) )
return nIndex;
}
return (-1);
}
SInventorySlot* SUIInventoryWnd::GetSlotItemIdexNum( int nItemIndex )
{
for( int nIndex( 0 ); nIndex < m_vecInvenList.size(); ++nIndex )
{
int tempcode = m_vecInvenList[nIndex]->GetItemCode();
if( m_vecInvenList[nIndex]->GetItemCode() == nItemIndex )
return m_vecInvenList[nIndex];
}
return NULL;
}
ItemBase::ItemWearType SUIInventoryWnd::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
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot00" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT00 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot01" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT01 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot02" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT02 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot03" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT03 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot04" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT04 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot05" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT05 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot06" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT06 );
else if( 0 == ::_stricmp( szEquipControlID, "icon_beltcarslot07" ) ) WearType = ItemBase::ItemWearType(ItemBase::WEAR_BELT07 );
return WearType;
}
void SUIInventoryWnd::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) );
}
// sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현
void SUIInventoryWnd::_ReqArrangeItem()
{
if( m_pGameManager && !m_ActionTicker.is_on_tick() )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_ARRANGE_ITEM( false ) );
append_tickable( &m_ActionTicker );
m_ActionTicker.satisfy();
}
}
// 해당윈도우는 Open, 이외의 윈도우는 Close.
void SUIInventoryWnd::ShowSyntheticWnd( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE wndID )
{
// 이전에 열어놓은 조합 윈도우ID;
if( m_oldShowMixWndID == wndID )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( wndID, false ) );
m_oldShowMixWndID = SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_NONE;
}
else
{
for( int i=0; i<g_nWndSize; ++i )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( g_arrWndID[ i ], ( g_arrWndID[ i ] == wndID ) ) );
if( g_arrWndID[ i ] == wndID )
m_oldShowMixWndID = wndID;
}
}
}
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////
//// SUIContributionWnd
#ifdef CONTRIBUTION
bool SUIContributionWnd::InitControls( KPoint kPos )
{
// 2011.11.29 - servantes : "icon_itemsrc" 컨트롤 nui에 없어서 주석처리
//// 슬롯 multi icon 레이어 설정, 툴팁 스프라이트 설정
//KUIControlMultiIcon* pSrcSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( "icon_itemsrc" ));
//if( NULL != pSrcSlotControl )
// pSrcSlotControl->SetIconLayer( 4 );
for( int nSlotNum( 0 ); nSlotNum < c_nCombineSlotCount; ++nSlotNum )
{
KUIControlMultiIcon* pSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "%s%02d", c_lpContributionIconName, nSlotNum ).c_str() ));
if( NULL != pSlotControl )
pSlotControl->SetIconLayer( 8 );
}
SetChildCaption( "static_altar_bless", GetStringDB().GetString( 6721 ) );
SetChildCaption( "button_jp_donation", GetStringDB().GetString( 6757 ) );
SetChildCaption( "quest_static000", "" );
SetChildCaption( "donation_input_text", "" );
SetCustomMovingRect( KRect( 0, 0, 200, 19 ) ); // 이동
return SUIWnd::InitControls( kPos );
}
bool SUIContributionWnd::InitData( bool bReload )
{
m_InputState = STATE_NONE;
m_n64_Gold = 0;
m_donateJP = 0;
RefreshSlots();
return SUIWnd::InitData(bReload);
}
void SUIContributionWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
if( bOpen )
{
RemoveAllContributionItems();
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, true ) );
}
else
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_REWARD_CONFIRM, false, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, false ) );
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA( "contribution_prop_clear" ) );
}
}
void* SUIContributionWnd::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( pWndMultiIcon )
{
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
AR_HANDLE hItem = GetItemHandle( szControlID );
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( 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()) ) //servantes 2010.10.20
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pCombineDragInfo->m_hItem );
if( !pSlot )
return NULL;
count_t nCnt = pSlot->GetItemCount();
if(nCnt > 1)
m_pGameManager->PostMsgAtDynamic( new SIMSG_NOJUM_HOST_MOVEITEM( pSlot->GetHandle(), count_t(nCnt), count_t(nCnt) ) ); //수입력기가 뜬다
else
RemoveCombineItem( pCombineDragInfo->m_hItem );
}
// Drag & Drop 정보 제거
m_pDisplayInfo->SetUIDragInfo();
}
return NULL;
}
else if ( id == id_UI_RECV_DROP )
{
KUISendRecvDropMessage* pRecvMsg = static_cast<KUISendRecvDropMessage*>( &msg );
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_INVENITEM == pUIDragInfo->m_type ) // 아이템인 경우만
{
SUIInvenItemDragInfo* pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo;
const char* szDropControlID = pRecvMsg->sRecvDropControlID.c_str();
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pItemDragInfo->m_hItem );
if( !pSlot ) return NULL;
if( m_ContributionItemsVector.size() > 8 )
{
m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_OVERCOUNT_CONTRIBUTION), 0 );
return NULL;
}
if( !AbleAddSlot(pSlot) )
{
m_pDisplayInfo->AddSystemMessage( GetStringDB().GetString(SYS_MSG_CANT_CONTRIBUTION), 99 ); // You can't donate this item.
return NULL;
}
count_t nCnt( pSlot->GetItemCount() );
if( nCnt>1 && GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) )
{
m_InputState = CONTRIBUTION_STATE::STATE_SENDITEM;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION, nCnt ) );
pDragItemSlot = pSlot;
}
else AddContributionItem( pSlot->GetHandle(), count_t( 1 ) );
m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) );
}
return NULL;
}
return SUIWnd::Perform( id, msg );
}
void SUIContributionWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK: /// 기부 UI창 클릭 이벤트,,,
{
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INPUTNUMBER, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_RANKING, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION, false ) );
}
//else if( ::_stricmp( lpszControlID, "button_donation_rudy" ) == 0 ) //servantes 2010.10.13
else if( ::_stricmp( lpszControlID, "button_donation_rupy" ) == 0 ) // bintitle. 2011.11.07. "button_donation_rudy" => "button_donation_rupy"
{
m_InputState = CONTRIBUTION_STATE::STATE_INPUTMONEY;
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INPUTNUMBER, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION, m_PlayerInfoMgr.GetPlayerInfo().GetGold(), SIMSG_UI_REQ_INPUTNUMBER::TYPE_GOLD ) );
}
else if( ::_stricmp( lpszControlID, "button_jp_donation" ) == 0 )
{
m_InputState = CONTRIBUTION_STATE::STATE_INPUTJOBPOINT;
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INPUTNUMBER, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION, count_t(m_PlayerInfoMgr.GetPlayerInfo().GetJP()), SIMSG_UI_REQ_INPUTNUMBER::TYPE_JP ) );
}
else if( ::_stricmp( lpszControlID, "button_donation_cancel" ) == 0 ) //servantes 2010.10.13
{
RemoveAllContributionItems();
RemoveGold();
}
else if( ::_stricmp( lpszControlID, "button_donation_item" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, true ) );
}
else if( ::_stricmp( lpszControlID, "button_donation_ranking" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_RANKING, true ) );
m_pGameManager->PostMsgAtDynamic( new SMSG_SEND_DATA( "Ranking_Top_Record" ) );
}
else if( ::_stricmp( lpszControlID, "button_donation" ) == 0 ) //servantes 2010.10.13
{
if( m_ContributionItemsVector.size() == 0 )
{
SIMSG_UI_ACT_ITEMCONTRIBUTION contributionMsg;
contributionMsg.n64_Gold = m_n64_Gold;
contributionMsg.jp = m_donateJP;
m_pGameManager->ProcMsgAtStatic( &contributionMsg );
RemoveGold();
return;
}
else if( m_ContributionItemsVector.size() > 0 )
{
SIMSG_UI_ACT_ITEMCONTRIBUTION contributionMsg;
// 강화 아이템 추가
bool bSucceed = true;
for( CONTRIBUTIONITEM_VECTOR::const_iterator itItem = m_ContributionItemsVector.begin(); itItem != m_ContributionItemsVector.end(); itItem++ )
{
if( m_InventoryMgr.IsExistItem( (*itItem).handle, (*itItem).usiCount ) )
{
contributionMsg.vtItems.push_back( SIMSG_UI_ACT_ITEMCONTRIBUTION::ContributionItemInfo( (*itItem).handle, (*itItem).usiCount.getAmount() ) );
}
else
{
bSucceed = false;
break;
}
}
contributionMsg.n64_Gold = m_n64_Gold;
contributionMsg.jp = m_donateJP;
RemoveAllContributionItems();
if( bSucceed )
{
m_pGameManager->ProcMsgAtStatic( &contributionMsg );
}
else
{
m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_CONTRIBUTE_ITEM_NOT_EXIST), 99 ); // Items needed for donation do not exist.
}
RemoveGold();
}
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
{
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIContributionWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_UPDATE_ITEM_COUNT:
case MSG_ITEM_DESTROY:
case MSG_ITEM_INVEN:
case MSG_ITEM_WEAR_INFO:
{
bool bChange = false;
CONTRIBUTIONITEM_VECTOR::iterator itItem = m_ContributionItemsVector.begin();
while( itItem != m_ContributionItemsVector.end() )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( (*itItem).handle );
if( pSlot && !pSlot->IsEquipItem() ) // 올려놓은 양보다 실제 인벤아이템의 양이 줄어있는 경우
{
if( (*itItem).usiCount > pSlot->GetItemCount() )
{
bChange = true;
(*itItem).usiCount = pSlot->GetItemCount();
}
itItem++;
}
else // 없어졌거나 장착된 아이템은 제거한다.
{
itItem = m_ContributionItemsVector.erase( itItem );
bChange = true;
}
}
if( bChange ) RefreshSlots();
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = (SIMSG_UI_MOVE*)pMsg;
MovePos( pMoveMsg->m_nX - GetRect().GetWidth(), pMoveMsg->m_nY - GetRect().GetHeight() );
pMsg->bUse = true;
}
break;
case IMSG_UI_INPUTNUMBER:
{
SIMSG_UI_INPUTNUMBER* pInputNumberMsg = (SIMSG_UI_INPUTNUMBER*)pMsg;
if( m_InputState == CONTRIBUTION_STATE::STATE_INPUTMONEY )
{
if( pInputNumberMsg->m_nValue <= m_PlayerInfoMgr.GetPlayerInfo().GetGold() && pInputNumberMsg->m_nValue > 0 )
{
SetGold( m_PlayerInfoMgr.GetTradeTarget(), count_t( pInputNumberMsg->m_nValue.getAmount() ) );
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
m_n64_Gold = pInputNumberMsg->m_nValue.getAmount();
}
}
if( m_InputState == CONTRIBUTION_STATE::STATE_INPUTJOBPOINT )
{
if( pInputNumberMsg->m_nValue <= m_PlayerInfoMgr.GetPlayerInfo().GetJP() && pInputNumberMsg->m_nValue > 0 )
{
int jp = pInputNumberMsg->m_nValue.getAmount();
std::string strJP = "<size:11><right>";
strJP += CStringUtil::GetCommaNumberString( jp );
SetChildCaption( "donation_input_text", strJP.c_str() );
m_donateJP = jp;
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
}
}
else if( m_InputState == CONTRIBUTION_STATE::STATE_SENDITEM )
{
if( pDragItemSlot )
{
AddContributionItem( pDragItemSlot->GetHandle(), pInputNumberMsg->m_nValue );
pDragItemSlot = NULL;
}
}
m_InputState = CONTRIBUTION_STATE::STATE_NONE;
}
break;
case IMSG_HOTKEY_EX:
{
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;
}
}
extern std::string getGoldString( money_t nGold, bool bAdddRupy = true );
void SUIContributionWnd::SetGold( AR_HANDLE hTarget, money_t nValue )
{
std::string strGold = "<SIZE:11>";
strGold += getGoldString( nValue, false );
SetChildCaption( "quest_static000", strGold.c_str() );
}
bool SUIContributionWnd::IsEquipItem( SInventorySlot* pSlot )
{
if( !pSlot ) return false;
if( GetItemDB().GetUseType(pSlot->GetItemCode()) == ItemBase::TYPE_CARD )
return m_InventoryMgr.IsEquipCard( pSlot->GetHandle() );
else
return pSlot->IsEquipItem();
}
void SUIContributionWnd::AddContributionItem( AR_HANDLE hItem, count_t usiCount )
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if( !pSlot ) return;
if( usiCount == 0 ) return;
bool bEquip( IsEquipItem(pSlot) );
bool bAbleAdd( AbleAddSlot(pSlot) );
if( !bEquip && bAbleAdd ) // 장착된 아이템은 배제
{
CONTRIBUTIONITEM_VECTOR::iterator itItem = GetItemIterator( hItem );
if( m_ContributionItemsVector.end() != itItem ) // 이미 존재하는 경우
{
// 중첩 가능한 아이템인 경우
if( GetItemDB().IsJoin( pSlot->GetItemCode(), IsInstanceUnstackable(pSlot) ) )
{
// 기존 아이템의 갯수를 증가시킨다.
count_t nTotalCount = (*itItem).usiCount + usiCount;
if( nTotalCount > pSlot->GetItemCount() ) nTotalCount = pSlot->GetItemCount(); // 갖고있는 아이템의 전체 갯수보다 커지지 않도록 조정
nTotalCount = min( count_t( c_nContributionCountLimit ), nTotalCount);
if( (*itItem).usiCount != nTotalCount )
{
(*itItem).usiCount = nTotalCount;
RefreshSlots();
}
}
}
else // 처음 추가하는 경우
{
if( usiCount > pSlot->GetItemCount() )
usiCount = pSlot->GetItemCount();
m_ContributionItemsVector.push_back( CONTRIBUTIONITEM( hItem, usiCount ) );
RefreshSlots();
}
}
if( bEquip )
{
m_pDisplayInfo->AddSystemMessage( S(292), 99 ); // Enable after releasing equipment
}
if( !bAbleAdd )
{
m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_CANT_CONTRIBUTION), 99 ); // You can't donate this item.
}
}
bool SUIContributionWnd::AbleAddSlot( SInventorySlot* pSlot )
{
if( !pSlot ) return false;
int nItemCode( pSlot->GetItemCode() );
const ItemBase* pItem = (ItemBase*)GetItemDB().GetItemData( pSlot->GetItemCode() );
if( pItem == NULL ) return false;
//기부 가능 여부 체크 0이면 기부 가능 1이면 불가능
if( pItem->CheckFlag( ItemBase::FLAG_WEARABLE ) )
return false;
//ItemBase::FLAG_WEARABLE로 체크 한다 ( 기부 가능 확인용 Flag )
/* if( ItemBase::GROUP_BULLET == GetItemDB().GetGroup( nItemCode ) ) return false;
if( ItemBase::CLASS_BOOST_CHIP == GetItemDB().GetClassID( nItemCode ) ) return false;*/
if( ItemBase::TYPE_CARD == GetItemDB().GetUseType( nItemCode ) )
{
//카드에 크리처가 장착 되있더라도 기부 가능
// if( m_pInvenMgr->IsEquipCard( pSlot->GetHandle() ) ) return false;
//편성되 있는 크리처 카드는 기부 불가능
if( m_CreatureSlotMgr.IsEquipedCreature( pSlot->GetHandle() ) ) return false;
}
// if( pItem->Flag.IsOn(ItemBase::ITEM_FLAG::FLAG_QUEST) ) return false;
if( pItem->available_time > 0 ) return false;
for( CONTRIBUTIONITEM_VECTOR::iterator itItem = m_ContributionItemsVector.begin(); itItem != m_ContributionItemsVector.end(); itItem++ )
{
if( pSlot->GetHandle() == (*itItem).handle &&
pSlot->GetItemCount() == (*itItem).usiCount )
return false;
}
return true;
}
void SUIContributionWnd::RemoveCombineItem( AR_HANDLE hItem )
{
CONTRIBUTIONITEM_VECTOR::iterator itItem = GetItemIterator( hItem );
if( m_ContributionItemsVector.end() != itItem )
{
m_ContributionItemsVector.erase( itItem );
RefreshSlots();
}
}
void SUIContributionWnd::RemoveAllContributionItems( bool bRefreshSlot/* = true*/ )
{
m_ContributionItemsVector.clear();
if( bRefreshSlot ) RefreshSlots();
}
void SUIContributionWnd::RemoveGold()
{
SetGold( m_PlayerInfoMgr.GetTradeTarget(), count_t( 0 ) );
SetChildCaption( "quest_static000", "" );
m_n64_Gold = 0;
SetChildCaption( "donation_input_text", "" );
m_donateJP = 0;
}
void SUIContributionWnd::RefreshSlots()
{
for( int nSlotNum( 0 ); nSlotNum < c_nContributionCount; ++nSlotNum )
{
std::string strIconControlID = CStringUtil::StringFormat( "icon_item%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_ContributionItemsVector.size()) )
{
const CONTRIBUTIONITEM& rContributionItem = m_ContributionItemsVector[ nSlotNum ];
SetItemIconStatic( pSlotControl, pItemCountControl, rContributionItem.usiCount, m_InventoryMgr.GetItemInfo( rContributionItem.handle ) );
}
else
{
SetItemIconStatic( pSlotControl, pItemCountControl );
}
}
}
void SUIContributionWnd::SetItemIconStatic( KUIControlMultiIcon* pIconStatic, KUIWnd* pItemCountControl, count_t nCount/*=0*/, SInventorySlot* pSlot/* = NULL*/ )
{
if( pSlot )
{
if( NULL != pIconStatic )
ResetMultiIcon( pIconStatic, 0, 8 );
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 );
pIconStatic->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
if( m_bAltKey )
{
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIconStatic, pSlot );
}
}
if( NULL != pItemCountControl )
{
pItemCountControl->SetShow( GetItemDB().IsJoin(pSlot->GetItemCode(), IsInstanceUnstackable(pSlot)) ? nCount.getAmount() : 0 );
pItemCountControl->SetCaption( CStringUtil::StringFormat( "%s%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, "static_common_itemslot" );
pIconStatic->SetTooltip();
}
if( NULL != pItemCountControl )
pItemCountControl->SetShow(false);
}
}
AR_HANDLE SUIContributionWnd::GetItemHandle( const char* szControlID ) const
{
if( 0 == ::strnicmp( szControlID, c_lpContributionIconName, c_nContributionSlotNameLength ) )
{
if( ::strlen( szControlID ) >= (c_nContributionSlotNameLength + c_nContributionSlotCountLength) )
{
std::string strSlotNum;
strSlotNum.assign( szControlID, c_nContributionSlotNameLength, c_nContributionSlotCountLength );
int nSlotNum = ::atoi( strSlotNum.c_str() );
if( 0 <= nSlotNum && nSlotNum < int(m_ContributionItemsVector.size()) )
return m_ContributionItemsVector[ nSlotNum ].handle;
}
}
return NULL;
}
SUIContributionWnd::CONTRIBUTIONITEM_VECTOR::iterator SUIContributionWnd::GetItemIterator( AR_HANDLE hItem )
{
for( CONTRIBUTIONITEM_VECTOR::iterator itItem = m_ContributionItemsVector.begin(); itItem != m_ContributionItemsVector.end(); itItem++ )
if( (*itItem).handle == hItem ) return itItem;
return m_ContributionItemsVector.end();
}
DWORD SUIContributionWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
{
if( dwMessage == KMOUSE_MOVE )
{
KUIControlStatic* pStaticCtr(NULL);
// { [sonador][7.7.14] 기부 시스템 오류 수정 - 널포인터 참조
pStaticCtr = dynamicCast<KUIControlStatic*>(GetChild("button_choice2"));
std::string strCaption( "<LEFT><size:10><#0066FF>" );
if( pStaticCtr )
{
if( pStaticCtr->IsInRect(x,y) )
{
strCaption += pStaticCtr->GetCaption();
strCaption.insert(0, "<U>");
pStaticCtr->SetCaption( strCaption.c_str() );
}
else
{
strCaption += GetStringDB().GetString( 6440 );
pStaticCtr->SetCaption( strCaption.c_str() );
}
}
pStaticCtr = dynamicCast<KUIControlStatic*>(GetChild("button_choice1"));
strCaption = "<LEFT><size:10><#0066FF>";
if( pStaticCtr )
{
if( pStaticCtr->IsInRect(x,y) )
{
strCaption += pStaticCtr->GetCaption();
strCaption.insert(0, "<U>");
pStaticCtr->SetCaption( strCaption.c_str() );
}
else
{
strCaption += GetStringDB().GetString( 6439 );
pStaticCtr->SetCaption( strCaption.c_str() );
}
}
// }
}
return SUIWnd::OnMouseMessage(dwMessage, x, y);
}
//////////////////////////////////////////////////////////////////////////
SUIContributionMsgboxWnd::~SUIContributionMsgboxWnd()
{
}
bool SUIContributionMsgboxWnd::InitControls( KPoint kPos )
{
return SUIWnd::InitControls( kPos );
}
bool SUIContributionMsgboxWnd::InitData( bool bReload )
{
SetChildShow( "selectitem", false );
for( int i =0; i < 4; ++i )
{
m_nEnableSlot[i] = 0;
KUIControlIconStatic* pSlotControl = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "selectitem_itemback_%02d", i+1 ).c_str() ));
if (pSlotControl != NULL)
{
if( i == 0 )
pSlotControl->SetTooltip( SR(2101000072, "#@moralpoint@#", "2000").c_str() );
else if( i == 1 )
pSlotControl->SetTooltip( SR(2101000073, "#@moralpoint@#", "10000").c_str() );
else if( i == 2 )
pSlotControl->SetTooltip( SR(2101000074, "#@moralpoint@#", "20000").c_str() );
else if( i == 3 )
pSlotControl->SetTooltip( SR(2101000075, "#@moralpoint@#", "30000").c_str() );
pSlotControl->SetIcon( c_szDEF_SPR_NAME, "static_common_itemslot" );
pSlotControl->SetChildShow( CStringUtil::StringFormat( "selectitem_itemback_%02d", i+1 ).c_str(), false );
}
}
m_nSelectReward00 = -1;
m_nSelectReward01 = -1;
m_nSelectReward02 = -1;
m_nSelectReward03 = -1;
// m_nCheckMouseClick = 0;
m_nCurrentSelect = -1;
m_nSlotNumber = -1;
m_nMaxCount = 0;
m_nAvatarMoral = 0;
m_nMoral = 0;
m_bShiftKey = false; //servantes 2010.10.15
m_nRewardCount[0] = m_nRewardCount[1] = m_nRewardCount[2] = m_nRewardCount[3] = count_t(0);
m_InputState = STATE_NONE;
SPlayerInfo & info = m_PlayerInfoMgr.GetPlayerInfo();
m_nAvatarMoral = (info.GetMoral() / 10000) * -1;
RewardItem();
RefreshSlots();
return SUIWnd::InitData(bReload);
}
void SUIContributionMsgboxWnd::RefreshSlots()
{
for( int nSlotNum( 1 ); nSlotNum < c_nContributionRewardCount; ++nSlotNum )
{
std::string strIconControlID = CStringUtil::StringFormat( "selectitem_itemback_%02d" , nSlotNum );
std::string strStaticCountID = CStringUtil::StringFormat( "static_itemcount%02d", nSlotNum );
if( m_nRewardCount[nSlotNum-1] != count_t(0) )
SetChildShow( strStaticCountID.c_str(), true );
else
SetChildShow( strStaticCountID.c_str(), false );
KUIControlIconStatic* pSlotControl = dynamicCast<KUIControlIconStatic*>(GetChild( strIconControlID.c_str() ));
KUIWnd* pItemCountControl = GetChild( strStaticCountID.c_str() );
SetItemIconStatic( pSlotControl, nSlotNum, m_nRewardCount[nSlotNum-1], true );
// m_nRewardCount은 [0-3], 루프는 [1-4]
}
}
// 모럴 포인트를 얻어 온다.
int SUIContributionMsgboxWnd::GetRemainMoral()
{
return m_nAvatarMoral - (
(m_nRewardCount[0].getAmount() * 2000) +
(m_nRewardCount[1].getAmount() * 10000) +
(m_nRewardCount[2].getAmount() * 20000) +
(m_nRewardCount[3].getAmount() * 30000)
);
}
// 현재 모럴 포인트를 계산해서 보상 받을 수 있는 상자를 세팅
void SUIContributionMsgboxWnd::RewardItem()
{
if( GetRemainMoral() >= 2000 )
{
m_pGameManager->InterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, "box_title", "item_gray") );
m_nSelectReward00 = REWARD::REWARD_ITEM_LV0;
}
if( GetRemainMoral() >= 10000 )
{
m_pGameManager->InterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, "box_title", "item_copper") );
m_nSelectReward01 = REWARD::REWARD_ITEM_LV1;
}
if( GetRemainMoral() >= 20000 )
{
m_pGameManager->InterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, "box_title", "item_silver") );
m_nSelectReward02 = REWARD::REWARD_ITEM_LV2;
}
if( GetRemainMoral() >= 30000 )
{
m_pGameManager->InterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, "box_title", "item_gold") );
m_nSelectReward03 = REWARD::REWARD_ITEM_LV3;
}
}
void SUIContributionMsgboxWnd::SetItemIconStatic(KUIControlIconStatic* pIconStatic, int nSlotNumber, count_t nCount /* = count_t */, bool bSlot)
{
if( bSlot )
{
if( nSlotNumber == 1 )
{
KUIControlStatic* pSlotControl = dynamicCast<KUIControlStatic*>(GetChild( "static_itemcount01" ));
pSlotControl->SetCaption( CStringUtil::StringFormat( "<right>%I64d", nCount.getAmount() ).c_str() );
}
else if( nSlotNumber == 2 )
{
KUIControlStatic* pSlotControl = dynamicCast<KUIControlStatic*>(GetChild( "static_itemcount02" ));
pSlotControl->SetCaption( CStringUtil::StringFormat( "<right>%I64d", nCount.getAmount() ).c_str() );
}
else if( nSlotNumber == 3 )
{
KUIControlStatic* pSlotControl = dynamicCast<KUIControlStatic*>(GetChild( "static_itemcount03" ));
pSlotControl->SetCaption( CStringUtil::StringFormat( "<right>%I64d", nCount.getAmount() ).c_str() );
}
else if( nSlotNumber == 4 )
{
KUIControlStatic* pSlotControl = dynamicCast<KUIControlStatic*>(GetChild( "static_itemcount04" ));
pSlotControl->SetCaption( CStringUtil::StringFormat( "<right>%I64d", nCount.getAmount() ).c_str() );
}
}
}
// 슬롯 선택에 따른 활성화
void SUIContributionMsgboxWnd::RefreshSelection()
{
if( 0 <= m_nCurrentSelect
&& m_nSlotNumber != -1 )
{
int nSlot = m_nCurrentSelect;
KUIWnd* pItemIconControl = GetChild( CStringUtil::StringFormat( "selectitem_itemback_%02d", nSlot ).c_str() );
if( NULL != pItemIconControl )
{
const KRect& rIconRect = pItemIconControl->GetRect();
SetMovePos( "selectitem", rIconRect.left , rIconRect.top );
SetChildShow( "selectitem", true );
}
}
else
{
m_nCurrentSelect = (-1);
SetChildShow( "selectitem", false );
}
}
int SUIContributionMsgboxWnd::GetSlotControlNum( const char* szSlotControlID ) const
{
for( int nIndex( 1 ); nIndex < c_nContributionRewardCount; ++nIndex )
{
if( 0 == ::_stricmp( CStringUtil::StringFormat( "selectitem_itemback_%02d", nIndex ).c_str(), szSlotControlID ) )
return nIndex;
}
return (-1);
}
int SUIContributionMsgboxWnd::GetInvenSlotItemIndex( int nSlotControlNum ) const
{
if( 0 <= nSlotControlNum && nSlotControlNum < c_nContributionRewardCount )
{
int nInvenIndex = nSlotControlNum;
if( 0 <= nInvenIndex )
return nInvenIndex;
}
return (-1);
}
// 클릭 상태에 따른 보상 아이템 카운트 증가
void SUIContributionMsgboxWnd::SelectItemAddCount()
{
if( m_nSlotNumber == -1 )
return;
int nItemCode(0);
// 각 보상 아이템마다 받을 수 있는 최대 갯수를 구함
if( m_nSlotNumber == 1 )
m_nMaxCount = GetRemainMoral() / 2000 + m_nRewardCount[0].getAmount();
else if( m_nSlotNumber == 2 )
m_nMaxCount = GetRemainMoral() / 10000 + m_nRewardCount[1].getAmount();
else if( m_nSlotNumber == 3 )
m_nMaxCount = GetRemainMoral() / 20000 + m_nRewardCount[2].getAmount();
else if( m_nSlotNumber == 4 )
m_nMaxCount = GetRemainMoral() / 30000 + m_nRewardCount[3].getAmount();
if( m_bShiftKey ) // 시프트 클릭 해서 직접숫자입력 하는 경우 //servantes 2010.10.15
{
count_t ItemCount( m_nMaxCount );
// if( ItemCount < 1 ) return;
m_InputState = CONTRIBUTIONREWARD_STATE::STATE_SENDITEM;
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INPUTNUMBER, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTNUMBER( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, ItemCount ) );
}
else if( !m_bShiftKey/* && m_nCheckMouseClick ==1 */) //servantes 2010.10.15
{ // 더블클릭 할 경우
if( m_nMaxCount <= m_nRewardCount[m_nSlotNumber-1].getAmount() ) // 이미 최대값 이상이면 에러
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_CONTRIBUTION_REWARD_DISABLE, S(6506), true) );
m_nRewardCount[m_nSlotNumber-1] = count_t( m_nMaxCount );
}
else
++m_nRewardCount[m_nSlotNumber-1];
}
// else if( !m_bShiftKey && m_nCheckMouseClick == 2 )
// {
// if( 0 < m_nRewardCount[m_nSlotNumber-1].getAmount() )
// {
// --m_nRewardCount[m_nSlotNumber-1];
// }
// else
// m_nRewardCount[m_nSlotNumber-1] = count_t( 0 );
// }
}
// 클릭한 슬롯 번호 얻어오기
void SUIContributionMsgboxWnd::SelectClickItem( LPCSTR lpszControlID )
{
if( ::_stricmp( lpszControlID, "selectitem_itemback_01" ) == 0
&& m_nEnableSlot[0] == 1 )
{
m_nSlotNumber = 1;
}
else if( ::_stricmp( lpszControlID, "selectitem_itemback_02" ) == 0
&& m_nEnableSlot[1] == 1 )
{
m_nSlotNumber = 2;
}
else if( ::_stricmp( lpszControlID, "selectitem_itemback_03" ) == 0
&& m_nEnableSlot[2] == 1 )
{
m_nSlotNumber = 3;
}
else if( ::_stricmp( lpszControlID, "selectitem_itemback_04" ) == 0
&& m_nEnableSlot[3] == 1 )
{
m_nSlotNumber = 4;
}
else
{
m_nSlotNumber = -1;
}
}
void SUIContributionMsgboxWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KICON_PRESSING:
{
if( ::_stricmp( lpszControlID, GetID() ) != 0 && m_bShiftKey ) //servantes 2010.10.15
{
SelectClickItem( lpszControlID );
SelectItemAddCount();
RefreshSlots();
}
}
break;
case KUI_MESSAGE::KICON_CLICK:
{
if( ::_stricmp( lpszControlID, GetID() ) != 0 && m_bShiftKey ) // 쉬프트 + 왼쪽클릭 일 때, //servantes 2010.10.15
{
SelectClickItem( lpszControlID );
SelectItemAddCount();
RefreshSlots();
}
int nInvenIndex = GetInvenSlotItemIndex( GetSlotControlNum( lpszControlID ) );
if( (-1) != nInvenIndex )
{
if( m_nCurrentSelect == nInvenIndex )
m_nCurrentSelect = -1;
else m_nCurrentSelect = nInvenIndex;
SelectClickItem( lpszControlID );
RefreshSelection();
RefreshSlots();
}
}
break;
case KUI_MESSAGE::KICON_DBLCLK:
{
// 더블 클릭 하면 카운트를 +1 씩 증가 시킨다.
if( ::_stricmp( lpszControlID, GetID() ) != 0 && ( !m_bShiftKey ) ) //servantes 2010.10.15
{
// m_nCheckMouseClick = 1;
SelectClickItem( lpszControlID );
SelectItemAddCount();
RefreshSlots();
}
}
break;
// case KUI_MESSAGE::KICON_RCLICK:
// {
// // // 오른쪽 클릭일 경우 카운트를 -1씩 감소 시킨다.
// if( ::_stricmp( lpszControlID, GetID() ) != 0 && ( !m_bShiftKey ) ) //servantes 2010.10.15
// {
// m_nCheckMouseClick = 2;
// SelectClickItem( lpszControlID );
// SelectItemAddCount();
// RefreshSlots();
// }
// }
// break;
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_ok" ) == 0 )
{
m_pGameManager->InterfaceMsg( &SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, "contribution_ok" ) );
}
else if( ::_stricmp( lpszControlID, "button_cancel" ) == 0 )
{
InitData();
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, false ) );
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIContributionMsgboxWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA* pSendDataMsg = (SIMSG_UI_SEND_DATA*)pMsg;
if( pSendDataMsg->m_strString == "contribution_ok" )
{
SIMSG_UI_ACT_REQUESTREWARDITEM requestRewardMsg;
for( int i = 0; i < 4; i++ )
requestRewardMsg.nRewardCount[i] = (unsigned short)m_nRewardCount[i].getAmount();
m_pGameManager->ProcMsgAtStatic( &requestRewardMsg );
// 모럴포인트가 없는 상태에서 확인 버튼을 누렀을 때
// 이모럴 포인트 부족 채팅 메세지 출력
if( GetRemainMoral() < 2000 && m_nSlotNumber == -1 )
m_pDisplayInfo->AddSystemMessage( S(6746), 0 ); // Player cannot acquire item due to loss of moral points.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_RANKING, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_MSGBOX, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INPUTNUMBER, false ) );
InitData();
return;
}
// 모럴 포인트에 따른 아이콘 출력
if( pSendDataMsg->m_strString == "box_title" )
{
if( pSendDataMsg->m_strText == "item_gray" )
{
KUIControlIconStatic* pIconStatic = dynamicCast<KUIControlIconStatic*>(GetChild("selectitem_itemback_01"));
if( pIconStatic )
{
m_nEnableSlot[0] = 1;
pIconStatic->SetIcon( c_szDEF_SPR_NAME, "icon_donation_reward_gray" );
SetChildShow( "selectitem_itemback_01", true );
}
}
else if( pSendDataMsg->m_strText == "item_copper" )
{
KUIControlIconStatic* pIconStatic = dynamicCast<KUIControlIconStatic*>(GetChild("selectitem_itemback_02"));
if( pIconStatic )
{
m_nEnableSlot[1] = 1;
pIconStatic->SetIcon( c_szDEF_SPR_NAME, "icon_donation_reward_copper" );
SetChildShow( "selectitem_itemback_02", true );
}
}
else if( pSendDataMsg->m_strText == "item_silver" )
{
KUIControlIconStatic* pIconStatic = dynamicCast<KUIControlIconStatic*>(GetChild("selectitem_itemback_03"));
if( pIconStatic )
{
m_nEnableSlot[2] = 1;
pIconStatic->SetIcon( c_szDEF_SPR_NAME, "icon_donation_reward_silver" );
SetChildShow( "selectitem_itemback_03", true );
}
}
else if( pSendDataMsg->m_strText == "item_gold" )
{
KUIControlIconStatic* pIconStatic = dynamicCast<KUIControlIconStatic*>(GetChild("selectitem_itemback_04"));
if( pIconStatic )
{
m_nEnableSlot[3] = 1;
pIconStatic->SetIcon( c_szDEF_SPR_NAME, "icon_donation_reward_gold" );
SetChildShow( "selectitem_itemback_04", true );
}
}
}
}
break;
case IMSG_HOTKEY_EX:
{
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 )
m_bAltKey = (pHotKey->bUp == 0);
}
break;
case IMSG_UI_INPUTNUMBER:
{
SIMSG_UI_INPUTNUMBER* pInputNumberMsg = (SIMSG_UI_INPUTNUMBER*)pMsg;
if( count_t( m_nMaxCount ) < pInputNumberMsg->m_nValue )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_CONTRIBUTION_REWARD_DISABLE, S(6506), true) );
m_nRewardCount[m_nSlotNumber-1] = count_t( m_nMaxCount );
}
else
m_nRewardCount[m_nSlotNumber-1] = pInputNumberMsg->m_nValue;
RefreshSlots();
}
break;
case MSG_NPC_DIALOG:
{
SMSG_NPC_DIALOG* pNPCDlgMsg = (SMSG_NPC_DIALOG*)pMsg;
if( pNPCDlgMsg->nDialogType == TS_SC_DIALOG::TYPE_DONATION_PROP )
{
if( pNPCDlgMsg->vtMenus.size() >= 4 )
{
// m_strItemTriger00 = pNPCDlgMsg->vtMenus[REWARD::REWARD_ITEM_LV0].strTrigger;
// m_strItemTriger01 = pNPCDlgMsg->vtMenus[REWARD::REWARD_ITEM_LV1].strTrigger;
// m_strItemTriger02 = pNPCDlgMsg->vtMenus[REWARD::REWARD_ITEM_LV2].strTrigger;
// m_strItemTriger03 = pNPCDlgMsg->vtMenus[REWARD::REWARD_ITEM_LV3].strTrigger;
}
}
InitData();
}
break;
}
SUIWnd::ProcMsgAtStatic( pMsg );
}
bool SUIRankingWnd::InitControls( KPoint kPos )
{
for( int nSlotNum( 1 ); nSlotNum < c_nRankSlotCount; ++nSlotNum )
{
SetChildCaption( CStringUtil::StringFormat( "character_name_text_%02d", nSlotNum ).c_str(), "" );
SetChildCaption( CStringUtil::StringFormat( "mypoint_info_%02d", nSlotNum ).c_str(), "" );
}
SetChildCaption( "myrank_01", "" );
SetCustomMovingRect( KRect( 0, 0, 221, 19 ) ); // 이동
return SUIWnd::InitControls( kPos );
}
bool SUIRankingWnd::InitData( bool bReload )
{
return SUIWnd::InitData(bReload);
}
void SUIRankingWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_enter" ) == 0 || ::_stricmp( lpszControlID, "button_close" ) == 0 ) //servantes 2010.10.13
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_RANKING, false ) );
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
{
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIRankingWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = (SIMSG_UI_MOVE*)pMsg;
MovePos( pMoveMsg->m_nX - GetRect().GetWidth(), pMoveMsg->m_nY - GetRect().GetHeight() );
pMsg->bUse = true;
}
break;
case MSG_SC_RANKING_TOP_RECORD :
{
SMSG_SC_RANKING_TOP_RECORD *pRankingRecord = dynamicCast< SMSG_SC_RANKING_TOP_RECORD* >( pMsg );
if( NULL != pRankingRecord->requester_rank && 0 != pRankingRecord->requester_rank )
SetChildCaption( "myrank_01", CStringUtil::StringFormat( "<#000000><hcenter><vcenter> %d", pRankingRecord->requester_rank ).c_str() );
else
SetChildCaption( "myrank_01", "<#000000><hcenter><vcenter>--" );
int nCount = pRankingRecord->record_count;
SPlayerInfo & info = m_PlayerInfoMgr.GetPlayerInfo();
SetChildCaption( CStringUtil::StringFormat( "character_name_text_%02d", 11 ).c_str(), CStringUtil::StringFormat( "<hcenter><vcenter> %s", info.GetName() ).c_str() );
SetChildCaption( CStringUtil::StringFormat( "mypoint_info_%02d", 11 ).c_str(), CStringUtil::StringFormat( "<right>%I64d", pRankingRecord->requester_score).c_str() );
for( int nSlotNum( 1 ); nSlotNum < c_nRankSlotCount; ++nSlotNum )
{
SetChildCaption( CStringUtil::StringFormat( "character_name_text_%02d", nSlotNum ).c_str(), "" );
SetChildCaption( CStringUtil::StringFormat( "mypoint_info_%02d", nSlotNum ).c_str(), "" );
}
for( int nSlotNum( 1 ); nSlotNum < nCount + 1; ++nSlotNum )
{
if ( nSlotNum == pRankingRecord->ranking_record[nSlotNum-1].rank )
{
SetChildCaption( CStringUtil::StringFormat( "character_name_text_%02d", nSlotNum ).c_str(), CStringUtil::StringFormat( "<hcenter><vcenter> %s", pRankingRecord->ranking_record[nSlotNum-1].ranker_name ).c_str() );
SetChildCaption( CStringUtil::StringFormat( "mypoint_info_%02d", nSlotNum ).c_str(), CStringUtil::StringFormat( "<right>%I64d", pRankingRecord->ranking_record[nSlotNum-1].score ).c_str() );
}
}
}
break;
}
SUIWnd::ProcMsgAtStatic( pMsg );
}
///////////////////////////////////////////////////////////////////////////////////////////////
bool SUIContributionRewardConfirmWnd::InitControls( KPoint kPos )
{
return SUIWnd::InitControls( kPos );
}
bool SUIContributionRewardConfirmWnd::InitData( bool bReload )
{
std::string msg = "<size:10><#fbe6af><hcenter><vcenter>";
msg += GetStringDB().GetString ( 6750 );
SetChildCaption( "static_msg", msg.c_str() ); // 기부 보상이 지급되었으니 받아가시오
return SUIWnd::InitData(bReload);
}
void SUIContributionRewardConfirmWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
if( ::_stricmp( lpszControlID, "button_ok" ) == 0 )
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CONTRIBUTION_REWARD_CONFIRM, false, true ) );
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIContributionRewardConfirmWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
SIMSG_UI_MOVE* pMoveMsg = (SIMSG_UI_MOVE*)pMsg;
MovePos( pMoveMsg->m_nX - GetRect().GetWidth(), pMoveMsg->m_nY - GetRect().GetHeight() );
pMsg->bUse = true;
break;
}
SUIWnd::ProcMsgAtStatic( pMsg );
}
#endif