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

500 lines
19 KiB
C++

#pragma once
#include <mmo/ArType.h>
//#include "SUIWnd.h"
#include "SGameMessage.h"
#include "SUIDisplayInfo.h"
//#include "SUIUtil.h" // sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현
class SInventorySlot;
class SUIDisplayInfo;
#define DECO
#define CONTRIBUTION
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// class SUIInventoryWnd
//
// * 인벤토리.
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
class SUIInventoryWnd : public SUIWnd, public sui::ticker
{
private:
SUIDisplayInfo* m_pDisplayInfo;
SUIWnd * m_pEquipmentWnd; // 장비창.
KUIControlVScrollSmallEx * m_pScrollBar; // 스크롤바.
int m_nCrrScrollIndex;
int m_nPrevInvenSlotStartIndex;
int m_nInvenSlotStartIndex; ///< 첫번째 슬롯의 인벤토리 인덱스 ( 스크롤 시킴에 따라 바뀐다. )
int m_nInvenSlotCountY; ///< 현재 보여지는 슬롯들의 세로 갯수 ( 리사이즈 시킴에 따라 바뀐다. )
int m_nInvenSlotcountX;
int m_nInvenMaxSlotCount;
int m_nInvenDropOffset; ///< 인벤토리 슬롯에 Drag & Drop하는 기준 offset. // 아이템슬롯의 top(Y).
int m_nScrollBarTopOffset; ///< 스크롤바 resize의 기준 offset
int m_nScrollBarBottomOffset;
UI_ITEM_CATEGORY m_CurrentCategory; ///< 현재 선택된 아이템 분류
int m_nCurrentSelect; ///< 현재 선택된 아이템 인덱스 (없으면 -1)
std::vector<SInventorySlot*> m_vecInvenList;
AR_HANDLE m_ReserveDropItemHandle; ///< 땅에 버리기 예약된 아이템
AR_HANDLE m_DestroyItemHandle; // 아이템 파괴창에 보낼 아이템.
// 2010.05.13 사용할 헤어 아이템 핸들을 저장해 놓는다 - prodongi
AR_HANDLE m_willUseHairItem;
AR_HANDLE m_hLocal;
KUIControlSimpleButton* m_pArrangeButton; // sonador 1.9.1 인벤토리 및 창고 정렬 기능 구현
sui::ActionBinder* m_pArrangeButtonAction;
sui::conditional_fixed_rate_one_time_ticker m_ActionTicker;
// servantes 부모 윈도우로 옮김
//bool m_bShiptKey;
// 탭컨트롤 처럼 사용할 버튼들.
// 2011.11.24 - servantes : KUIControlButton -> KUIControlSimpleButton 으로 변경
std::vector< KUIControlSimpleButton * > m_arrTabButton;
KUIWnd * m_pSelect_list_cyan;
int m_nIndexShowTab; // 활성화탭 인덱스
// 슬롯 아이콘 controls.
std::vector< KUIControlMultiIcon * > m_arrCtrlItemIcon;
// 아이템 개수 컨트롤.
std::vector< KUIWnd * > m_arrCtrlCount;
// 무게게이지 컨트롤.
/* 사용안함
KUIWnd * m_pCtrlWeightGauge;
float m_fWeightGaugeWidth;
*/
std::string m_strDeco; // 텍스트 꾸미기 태그. ( 루피, 홀릭포인트, 무게 )
SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE m_oldShowMixWndID; // 이전에 열어놓은 조합 윈도우ID;
public:
SUIInventoryWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo ), m_pArrangeButton( 0 ), m_pArrangeButtonAction( 0 ), m_ActionTicker( 30000 ), m_pEquipmentWnd( NULL ),
m_pScrollBar( NULL ), m_pSelect_list_cyan( NULL ), m_nCrrScrollIndex( 0 ), m_DestroyItemHandle( NULL )
,m_bIsSetChildTop(false),m_TempTabIndex(0)
{
enter();
// 2010.05.13 - prodongi
m_willUseHairItem = 0;
};
virtual ~SUIInventoryWnd();
virtual SUIWnd * CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID );
virtual void Process( DWORD dwTime );
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
virtual void* Perform( KID id, KArg& msg );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
//////
SInventorySlot* GetInvenItem( int nSlotControlNum );
int GetSlotControlNum( const char* szSlotControlID ) const;
void RefreshInvenSlots( int nSlot=-1 );
SInventorySlot* GetSlotItemIdexNum( int nItemIndex );
private:
// 해당윈도우는 Open, 이외의 윈도우는 Close.
void ShowSyntheticWnd( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE wndID );
void Req_BeltItem( AR_HANDLE hItem );
void ReqSwapItem( AR_HANDLE hBEGIN_DRAG, AR_HANDLE hRECV_DROP );
void CopyInvenControl( int nIndex, int nNewIndex, RECT& rcOffset );
void CloseCreatureCardWnd();
// 심플모드
bool m_bSimpleMode;
//void DisableControls();
//void RefreshSimpleMode();
void RefreshLendingItemTooltip();
void RefreshScrollBar();
void RefreshGold();
void RefreshWeight();
void RefreshInvenItems();
void RefreshSelection();
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef DECO
void RefreshEquipItem( const char* szControlID, const char* defAniName, SInventorySlot* pItem );
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef DECO
void RefreshEquipItem( const char* szControlID, const char* defAniName, SInventorySlot* pItem, const char* lpTooltip );
void GetEquipTooltip( int nWearType, std::string& rTooltip );
#endif
void RefreshItemCoolTime();
KUIControlMultiIcon* SetInvenSlot( int nSlot );
int GetInvenSlotItemIndex( int nSlotControlNum ) const;
//int GetSlotControlNum( const char* szSlotControlID ) const; public 으로 이동.
//SInventorySlot* GetInvenItem( int nSlotControlNum ); public 으로 이동.
void SetSeqForm( struct SIMSG_UI_MAINPLAYER_INFO* pMsg );
static ItemBase::ItemWearType GetEquipSlotWearType( const char* szEquipControlID );
void _ReqArrangeItem();
bool AbleSubSlot( class SInventorySlot* pSlot );
bool AbleMainSlot( class SInventorySlot* pSlot );
// 2010.05.13 - prodongi
void saveWillUseHairItem(AR_HANDLE handle) { m_willUseHairItem = handle; }
// 2010.06.11 사용할려는 아이템이 동일한 타입인지 체크 - prodongi
// 2010.07.27 DisplayInfo에서도 같이 쓰기 위해 SUIUtil.h로 뺌
//bool checkUseEqualHairTypeItem(ItemBase const* item) const;
// 탭 Wnd 보임, 숨김 처리.
void ShowTabWnd( std::string & strControlID );
// 파괴할 아이템의 유효성 검사.
bool ValidateDestructionItem( AR_HANDLE hItem );
//servantes 2010.11.30
void LimitMoveWnd(); // 창이 화면 밖으로 나가지 않도록 위치 조정
// 2011. 9 .9 - marine
// 원하는 컨트롤을 최상위로 올릴 때 프로세스내에서 체크후 올린`다.
// 기존 코드의 문제점 발견으로 만든 플래그
// msessageproc 에서 리스트를 for문으로 순회하면서 처리가 되는데
// msessageproc 내에서 호출되는 함수가 for문 돌고 있는 리스트를 삭제 추가함..
// 그래서 플래그를 두어 Process에서 처리하도록 수정
bool m_bIsSetChildTop;
int m_TempTabIndex;
void SetChildTopInventory();
bool IsBlockedAction( std::string btnName ); //2012. 2. 20 - marine 지금 사용될 수 없는 버튼인지 체크
};
//
//
////--------------------------------------------------------------------------------------------------------------------------------------------------------------
////--------------------------------------------------------------------------------------------------------------------------------------------------------------
////--------------------------------------------------------------------------------------------------------------------------------------------------------------
////--------------------------------------------------------------------------------------------------------------------------------------------------------------
////
//// class SUIInvCombineWnd
////
//// * 조합창.
////
////
////--------------------------------------------------------------------------------------------------------------------------------------------------------------
//class SUIInvCombineWnd : public SUIWnd
//{
//public:
// SUIInvCombineWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager )
// , m_pDisplayInfo( pDisplayInfo ), m_CombineItemHandel(0) {};
//
// virtual bool InitControls( KPoint kPos );
// virtual bool InitData( bool bReload = false );
// virtual void* Perform( KID id, KArg& msg );
// virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
// virtual void ProcMsgAtStatic( SGameMessage* pMsg );
// virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
//
//private:
// SUIDisplayInfo* m_pDisplayInfo;
//
// struct COMBINEITEM
// {
// AR_HANDLE handle;
// count_t usiCount;
//
// COMBINEITEM()
// : handle( NULL ), usiCount( 0 ) { }
//
// COMBINEITEM( AR_HANDLE _handle, count_t _usiCount = count_t( 1 ) )
// : handle( _handle ), usiCount( _usiCount ) { }
// };
// typedef std::vector<COMBINEITEM> COMBINEITEM_VECTOR;
//
// COMBINEITEM m_SourceItem;
// COMBINEITEM_VECTOR m_CombineItemsVector;
//
// AR_HANDLE GetItemHandle( const char* szControlID ) const;
// SUIInvCombineWnd::COMBINEITEM_VECTOR::iterator GetItemIterator( AR_HANDLE hItem );
//
// void AddCombineItem( AR_HANDLE hItem, count_t usiCount );
// void RemoveCombineItem( AR_HANDLE hItem );
// void RemoveAllCombineItems( bool bRefreshSlot = true );
//
// void RefreshSlots();
// void SetItemIconStatic( class KUIControlMultiIcon* pIconStatic, KUIWnd* pItemCountControl, count_t nCount = count_t( 0 ), SInventorySlot* pSlot = NULL );
//
// bool IsEquipItem( class SInventorySlot* pSlot, count_t usiCount );
// void AddMainCombineItem( AR_HANDLE hItem, count_t usiCount );
// void AddSubCombineItem( AR_HANDLE hItem, count_t usiCount );
//
// bool AbleAddSlot( COMBINEITEM Item );
// bool AbleMainSlot( class SInventorySlot* pSlot );
// bool AbleSubSlot( class SInventorySlot* pSlot );
//
//
// AR_HANDLE m_CombineItemHandel;
//};
//
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// class SUIContributionWnd
//
// * ??.
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
#ifdef CONTRIBUTION
class SUIContributionWnd : public SUIWnd
{
struct CONTRIBUTIONITEM
{
AR_HANDLE handle;
count_t usiCount;
CONTRIBUTIONITEM()
: handle( NULL ), usiCount( 0 ) { }
CONTRIBUTIONITEM( AR_HANDLE _handle, count_t _usiCount = count_t( 1 ) )
: handle( _handle ), usiCount( _usiCount ) { }
};
typedef std::vector<CONTRIBUTIONITEM> CONTRIBUTIONITEM_VECTOR;
public:
SUIContributionWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo ), pDragItemSlot(NULL) {};
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
virtual void* Perform( KID id, KArg& msg );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
virtual DWORD OnMouseMessage(DWORD dwMessage, int x, int y);
protected:
bool IsEquipItem( SInventorySlot* pSlot );
void AddContributionItem( AR_HANDLE hItem, count_t usiCount );
bool AbleAddSlot( SInventorySlot* pSlot );
void RemoveCombineItem( AR_HANDLE hItem );
void RemoveAllContributionItems( bool bRefreshSlot=true );
void RemoveGold();
void RefreshSlots();
void SetItemIconStatic( KUIControlMultiIcon* pIconStatic, KUIWnd* pItemCountControl, count_t nCount = count_t( 0 ), SInventorySlot* pSlot=NULL );
AR_HANDLE GetItemHandle( const char* szControlID ) const;
SUIContributionWnd::CONTRIBUTIONITEM_VECTOR::iterator GetItemIterator( AR_HANDLE hItem );
private:
enum CONTRIBUTION_STATE{
STATE_NONE,
STATE_INPUTMONEY,
STATE_SENDITEM,
STATE_INPUTJOBPOINT
};
void SetGold( AR_HANDLE hTarget, count_t nValue );
CONTRIBUTION_STATE m_InputState;
SUIDisplayInfo* m_pDisplayInfo;
SInventorySlot* pDragItemSlot;
CONTRIBUTIONITEM_VECTOR m_ContributionItemsVector;
__int64 m_n64_Gold;
int m_donateJP;
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// class SUIContributionMsgboxWnd
//
// * 인벤토리.
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
class KUITipControl;
class SUIContributionMsgboxWnd : public SUIWnd
{
public:
enum REWARD { REWARD_STATE,
REWARD_ITEM_LV0,
REWARD_ITEM_LV1,
REWARD_ITEM_LV2,
REWARD_ITEM_LV3 };
SUIContributionMsgboxWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo )
, m_nSelectReward00(-1)
, m_nSelectReward01(-1)
, m_nSelectReward02(-1)
, m_nSelectReward03(-1){};
~SUIContributionMsgboxWnd();
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
protected:
count_t m_nRewardCount[4];
int m_nSlotNumber;
int m_nMaxCount;
int m_nAvatarMoral;
int m_nMoral;
int m_nEnableSlot[4];
// int m_nCheckMouseClick;
private:
enum CONTRIBUTIONREWARD_STATE{
STATE_NONE,
STATE_INPUTMONEY,
STATE_SENDITEM,
};
void RefreshSlots();
/// 선턱한 슬롯 표시 갱신
void RefreshSelection();
void SetItemIconStatic( KUIControlIconStatic* pIconStatic, int nSlotNumber, count_t nCount = count_t( 0 ), /*SInventorySlot* pSlot=NULL*/bool bSlot = false );
int GetInvenSlotItemIndex( int nSlotControlNum ) const;
int GetSlotControlNum( const char* szSlotControlID ) const;
/// 클릭한 상태에 따른 보상 아이템 카운트 증가
void SelectItemAddCount();
void SelectClickItem( LPCSTR lpszControlID );
/// 모럴 포인트에 따른 보상 아이템 불러오기
void RewardItem();
/// 남은 모랄을 리턴해준다.
int GetRemainMoral();
SUIDisplayInfo* m_pDisplayInfo;
int m_nCurrentSelect; ///< 현재 선택된 아이템 인덱스 (없으면 -1)
// servantes 2010.11.01 부모클래스로 옮김
// bool m_bShiftKey;
CONTRIBUTIONREWARD_STATE m_InputState;
int m_nSelectReward00;
int m_nSelectReward01;
int m_nSelectReward02;
int m_nSelectReward03;
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// class SUIInventoryWnd
//
// * 인벤토리.
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
class SUIRankingWnd : public SUIWnd
{
public:
SUIRankingWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo ) {};
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
private:
SUIDisplayInfo* m_pDisplayInfo;
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// class SUIInventoryWnd
//
// * 인벤토리.
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
/// 매월 기부 보상 아이템 받기
class SUIContributionRewardConfirmWnd : public SUIWnd
{
public:
SUIContributionRewardConfirmWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo ) : SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo ) {};
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
private:
SUIDisplayInfo* m_pDisplayInfo;
};
#endif