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

149 lines
4.9 KiB
C++

#pragma once
//#include "SUIWnd.h"
//#include <vector>
//
// 노점.
//
class SUIDisplayInfo;
enum STORE_MODE
{
MODE_READY_TO_SELL = 0,
MODE_READY_TO_BUY,
MODE_SELLING,
MODE_BUYING,
};
static const size_t MAX_SLOT_COUNT = 8; ///< 최대 올릴 수 있는 아이템 갯수
static const size_t CONTROL_PER_SLOT = 6; ///< 한개의 슬롯이 사용하는 UI 컨트롤 갯수
class SUIStoreHostWnd : public SUIWnd
{
public:
SUIStoreHostWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo );
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
virtual void* Perform( KID id, KArg& msg );
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
virtual bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
bool IsStarted() const { return ( m_nMode == MODE_SELLING || m_nMode == MODE_BUYING ); }
bool IsBoothNameFocus();
private:
void TagFillter( std::string& strChat );
void EraseColorTag( std::string& strChat );
void EraseTag( std::string& strChat, const char* lpTag );
void StartBooth();
void StopBooth( bool bEnd );
void Refresh( int index=-1 );
void RequestPrice( class SInventorySlot* pSlot );
/// -1 이면 없앤다
void MoveFocus( int idx );
int CheckAddItem( AR_HANDLE handle, ItemBase::ItemCode code, int nLevel, int nEnhance, count_t nCount, money_t nPrice, int nFlag );
void AddItem( AR_HANDLE handle, ItemBase::ItemCode code, count_t count, money_t price, int nLevel, int nEnhance, int nEndurance, int nFlag, const int aSocket[ ItemBase::MAX_SOCKET_NUMBER ], int remain_time, char eet, int eert, int eeap, int eemp, int ed , ItemBase::ItemCode apCode, TS_ITEM_BASE_INFO::AwakenOption* pAwakenOption, TS_ITEM_BASE_INFO::LPRANDOM_OPTION const pRandomOption, int nSummonID, int nAdditionalItemEffect ); // Fraun Sky Accessories 7/12/2025
void RemoveItem( int idx );
void SwitchStoreMode( int nNewMode, bool bNeedClear = true );
void SetSlotShowMode( size_t idx, bool bShow );
void CreateControls();
void SendStartBoothMsg();
int StartBoothPossibilityCheck();
void SendEndBoothMsg();
void onMsgResult( struct SMSG_RESULT* pMsg );
void onBoothInfo( struct SMSG_BOOTH_INFO *pMsg );
void onBoothTradeInfo( struct SMSG_BOOTH_TRADE_INFO * pMsg );
bool BoothEditUpdate( int nCase );
int CheckPrice( int index );
void EditControlEnable();
void ShowDisableBackGround( int nCnt );
void RemoveAllItem( bool bRefresh );
void EnableEditAll(bool bAble, bool bStrClear);
void OpenStore();
bool GetPresumptionGoldWeight( money_t& rGold, float& rfWeightRate );
int GetItemSlotCount( AR_HANDLE hHandle ); //servantes 2010.10.19
// bintitle. 2011.11.11. 노점에 아이템 등록할때 EditControl활성화 & Sound출력.
void AddSaleItem();
public:
int GetMode() const { return m_nMode; }
protected:
bool isEnableSell(class SInventorySlot* slot); /// 2011.05.16 - prodongi
private:
bool m_bItemDrag;
int m_nMode;
int m_nFocus;
count_t m_unCount;
money_t m_unPrice;
AR_HANDLE m_hCurrentAddingItem;
AR_HANDLE m_hCurrentDragItem;
std::string m_strLastEditBox;
SUIDisplayInfo* m_pDisplayInfo;
count_t m_OldInvenItemList[MAX_SLOT_COUNT]; ///< 서버에서 구입된 아이템의 핸들과 갯수를 보내주면 필요 없음... -N4-
};
class SUIStoreClientWnd : public SUIWnd
{
public:
SUIStoreClientWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager )
, m_nFocus( -1 )
, m_nDragIndex( 0 )
, m_hTarget( 0 )
, m_pDisplayInfo( pDisplayInfo )
, m_bSellStore( 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 bool InitControls( KPoint kPos );
virtual bool InitData( bool bReload = false );
private:
void StopBooth();
void SendEndWatchBoothMsg();
void Refresh();
void RefreshGold();
void RefreshWeight();
/// -1 이면 없앤다
void MoveFocus( int idx );
void AddItem();
void RemoveItem( int idx );
void SetSlotShowMode( size_t idx, bool bShow );
void CreateControls();
void MoveItemToKart( int idx, count_t nItemCnt );
bool GetMoveItemCount( int idx, bool bSellStore );
void onMsgResult( struct SMSG_RESULT* pMsg );
void onBoothInfo( struct SMSG_BOOTH_INFO *pMsg);
void onBoothTradeInfo( struct SMSG_BOOTH_TRADE_INFO * pMsg );
count_t GetItemCountInven( ItemBase::ItemCode code, int level, int enhance, int nFlag );
AR_HANDLE GetItemHandle( ItemBase::ItemCode code, int level, int enhance, count_t byCount );
bool m_bSellStore;
int m_nFocus;
AR_HANDLE m_hTarget;
size_t m_nDragIndex;
SUIDisplayInfo* m_pDisplayInfo;
};