/* ==========================================================================
* 작 성 자 : 이순규
* 작 성 일 : 2007.07.02
* 내    용 : 아이템 관리자
* 주의사항 : 
*===========================================================================*/
#pragma once

#include "Item_Common.h"
#include "Item.h"
#include "BaseStage.h"
#include "UIRect.h"
typedef tUIRect<int> cUIRect;

struct MSG_RES_NPC_ITEM_MOV2_INVENTORY;
struct MSG_RES_NPC_ITEM_BUY;
struct MSG_RES_NPC_ITEM_SELL;

/// 루팅창등 출력용
const int MAX_ITEMNAME_LEN = 10;
const int ITENNAME_LEN = 128;
const int MAX_NAME_WIDTH = 102;
const unsigned long OPEN_TIME = 1000;

const unsigned long TRADE_WAIT_TIME = 10000;

class cParser;
class cUIText;
class cItemDefine;
class cItemAbility;
class cItemLimit;
class cItemCard;
class cGauge;
class cPlayer;
class cUIWindow;

/// drop item 그래픽 정보
class cSceneNode;

/// npc 아이템 상점 탭 갯수
const int NPCSTORE_TAB_COUNT = 5;
const int NPCSTORE_SLOT_COUNT = 10;

/// 인벤토리 제외 슬롯들
/// 아이템 아이콘을 관리하기위한 슬롯으로, 서버와 관련없다
enum eNotInvenSlotIndex
{
	/// 아이템 Npc 상점 슬롯
	NPCSTORE_SLOT_BEGIN = MAX_INVENTORY + 1,
	NPCSTORE_SLOT_END = NPCSTORE_SLOT_BEGIN + NPCSTORE_SLOT_COUNT - 1,

	/// 분해윈도우 슬롯
	DISJOINT_SLOT,

	/// 강화아이템 슬롯
	ENHANCED_ITEM_SLOT,

	/// 강화카드 슬롯
	ENHANCED_CARD_SLOT,

	/// 카드장착 아이템 슬롯
	PUTCARD_ITEM_SLOT,
	PUTCARD_CARD_SLOT_BEGIN,
	PUTCARD_CARD_SLOT_END = PUTCARD_CARD_SLOT_BEGIN + MAX_CARD_SLOT - 1,

	NOTINVENSLOT_MAX,
};

/// 인벤토리 장착 슬롯
const int EQUIP_SLOT_COUNT = INVENTORY_HAND_END - INVENTORY_WEAR_BEGIN + 1;

/// 인벤토리 쉬트 슬롯
const int INVENSHEET_SLOT_COUNT = INVENTORY_BAG0_END - INVENTORY_BAG0_BEGIN + 1;

/// 인벤토리 가방 슬롯
const int BAG_SLOT_COUNT = INVENTORY_BAG1_END - INVENTORY_BAG1_BEGIN + 1;

/// 아이템 창고 슬롯
const int WAREHOUSE_SLOT_COUNT = INVENTORY_WAREHOUSE0_END - INVENTORY_WAREHOUSE0_BEGIN + 1;

/// 아이템 슬롯
const int ITEM_SLOT_COUNT = MAX_INVENTORY + NOTINVENSLOT_MAX + 1;

/// 아이템 슬롯 소속
/// 각슬롯이 어느 창에 속하는지 알수 있음.
enum eItemIn
{
	ITEM_IN_NULL = 0,
	ITEM_IN_EQUIP,
	ITEM_IN_INVEN_PRIVATE,
	ITEM_IN_INVEN_QUEST,
	ITEM_IN_INVEN_MALL,
	ITEM_IN_WAREHOUSE_PRIVATE,
	ITEM_IN_WAREHOUSE_MALL,
	ITEM_IN_NPCSTORE,
	ITEM_IN_USERSELL,	
	ITEM_IN_DISJOINT,
	ITEM_IN_ENHANCED_ITEM,
	ITEM_IN_ENHANCED_CARD,
	ITEM_IN_PUTCARD_ITEMSLOT,
	ITEM_IN_PUTCARD_CARDSLOT,
	ITEM_IN_CARDBOOK_TAROT,
	ITEM_IN_CARDBOOK_SPREAD,
};

/// 아이템 시도
enum eItemTry
{
	ITEM_TRY_NULL = 0,
	ITEM_TRY_MOVE,
    ITEM_TRY_USE,
	ITEM_TRY_EQUIP,
	ITEM_TRY_UNEQUIP,
	ITEM_TRY_DUMP,
	ITEM_TRY_SPLIT,
	ITEM_TRY_MERGE,
	ITEM_TRY_SWITCH,
	ITEM_TRY_BUY,
	ITEM_TRY_SELL,
	ITEM_TRY_GET,				/// 상자로부터 아이템 획득
	ITEM_TRY_DISJOINT,
	ITEM_TRY_ENHANCEDSTART,
	ITEM_TRY_ENHANCEDCANCEL,
	ITEM_TRY_ENHANCEDEND,
	ITEM_TRY_TRADEADD,
	ITEM_TRY_TRADEDELETE,
	ITEM_TRY_SELLITEMADD,
	ITEM_TRY_SELLITEMDELETE,
	ITEM_TRY_SELLGET,			/// 노점아이템 구입
	ITEM_TRY_QUEST_REWARDTAKE,	/// 아이템 보상지급 & 반납 처리
	ITEM_TRY_QUEST_ADDBYITEM,	/// 아이템 보상지급 & 의뢰아이템 삭제 처리
	ITEM_TRY_QUEST_TAKE,		/// 아이템 반납
	ITEM_TRY_PUTCARD,			/// 카드 장착
	ITEM_TRY_CARDBOOKADD,		/// 컬렉션북 등록
	ITEM_TRY_PICK,				/// 스페이스바로 아이템 줍기
	ITEM_TRY_CHANGE,			/// 체인지 아이템
	ITEM_TRY_MIXSKILL,			/// 조합기술 아이템
};

struct sNpcItemData
{
	unsigned long			mTextIndex;
	tArray<unsigned long>	mItemArr;

	sNpcItemData()
	{
		mTextIndex = 0;
	}
};

/// 아이템 Npc 상점
class cItemNpcStore
{
public:
	cItemNpcStore();
	~cItemNpcStore();

	void Clear();
	bool Load( cParser& parser );
	bool LoadTab( cParser& parser );

	unsigned int GetTabCount() { return mDataCount; }
	unsigned int GetItemCount( unsigned int tab );
	unsigned long GetItemIndex( unsigned int tabIndex, unsigned int cellIndex );
	unsigned long GetTextIndex( unsigned int tabIndex );

private:
	/// 데이터 카운트
	unsigned int mDataCount;
	sNpcItemData mItemData[NPCSTORE_TAB_COUNT];
};

inline
cItemNpcStore::cItemNpcStore()
: mDataCount(0)
{
}

inline
cItemNpcStore::~cItemNpcStore()
{
	Clear();
}

inline
unsigned long cItemNpcStore::GetItemIndex( unsigned int tabIndex, unsigned int cellIndex )
{
	return mItemData[tabIndex].mItemArr[cellIndex];
}

inline
unsigned long cItemNpcStore::GetTextIndex( unsigned int tabIndex )
{
	return mItemData[tabIndex].mTextIndex;
}

inline
unsigned int cItemNpcStore::GetItemCount( unsigned int tab )
{
	return mItemData[tab].mItemArr.GetSize();
}

/// 아이템 관리자
class cItemManager
{
	friend class cCheatManager;

public:
	static cItemManager* mSingleton;

	/// 정보 ( text index, 분류 리스트 )
	typedef tPair<unsigned int, void*> cDataPair;

public:
	cItemManager();
	~cItemManager();

	/// 초기화
	bool Init();
	void Open();

	/// 데이터 삭제
	void Close();

	/// 아이콘
	void BindIcon( unsigned int slotIndex, cItemIcon* icon );
	void LinkIcon( cItemIcon* icon );
	void UnLinkIcon( bool setcolor = false );
	void ClearColor( unsigned int slotIndex );
	void CheckItemSlot( unsigned int slotIndex );

	/// 쿨타임 세팅
	void StartCoolTime( unsigned long itemIndex, unsigned long coolTime );
	void EndCoolTime( unsigned long itemIndex );
	void CopyCoolTime( unsigned long itemIndex, unsigned long startTime, unsigned long restTime, unsigned long totalTime );

	/// 게임접속시, 전체 쿨타임 정보 복사 세팅 
	void SetAllItemCool();

	/// 무게
	void SetWeightGauge( cGauge* gauge );
	void SetMaxWeightGauge( float max );
	void SetCurWeightGauge();

	/// 아이템 변화시 정보 체크 ( 무게, 갯수, 사용여부등 )
	void UpdateItem();
	float GetWeight();

	/// 아이템 어빌리티 체크
	void ClearAbility();
	void CheckEquipAbility();

	sEquipAbility* GetBasicAbil();

	/// hero 장착 무기 리턴
	cItem& GetHeroRightWeapon();
	cItem& GetHeroLeftWeapon();

	/// 무기를 장착하고 있는지 여부
	bool IsEquipWeapon();
	void SetActiveWeapon( int active ) { mActiveWeapon = (eItemActiveWeapon)active; }
	int GetActiveWeapon() { return (int)mActiveWeapon; }

	/// 인벤토리내에 선택된 아이콘을 한개만 세팅하도록 함
	void SetInvenSelect( cUIWindow* win );

	/// 아이템 툴팁 컬러 리턴 
	void GetTooltipColor( unsigned short tiptype, unsigned long& color );

	/// 가격 단위 툴팁 획득
	unsigned long GetPriceUinit( unsigned long type );

	/// 아이템명 줄이기
	bool ModifyItemName( LPCTSTR name, TCHAR* out );

	/// 아이템
	bool CheckLimit( unsigned int slotIndex );	
	bool CheckMoveItem( unsigned int itemIndex, unsigned short count );
	bool CheckDisjoint( unsigned int slotIndex );
	bool TryToMoveItem( unsigned int slotIndex0, unsigned int slotIndex1, cItemIcon* icon );
	bool TryToEquipItem( unsigned int slotIndex );
	bool TryToUnEquipItem( unsigned int slotIndex );
	bool TryToDumpItem( unsigned int slotIndex );
	bool TryToSplitItem( unsigned int slotIndex0, unsigned int slotIndex1, unsigned short value );
	bool TryToUseMapChange( unsigned int slotIndex );
	
	/// 무기
	bool TryToSwitchWeapon();

	/// 해당 갯수의 아이템을 살수 있는지 여부
    bool CheckEmptySlot( unsigned int itemIndex, unsigned short count );

	/// 슬롯에 총 들어갈수 있는 갯수 구하기
	int GetRemainCount( unsigned int itemIndex, unsigned short mincount );

	/// 상점
	bool CheckBuyItem( unsigned int itemIndex, unsigned short count );
	bool TryToBuyItem( unsigned int itemIndex, unsigned short count );
	bool TryToSellItem( unsigned int slotIndex, unsigned short count );

	/// 아이템 줍기
	bool TryToGetItem( unsigned long itemIndex, unsigned short count );

	/// 아이템 분해, 강화 (아이템,카드)
	bool TryToDisjoint( unsigned int slotIndex );

	bool TryToEnhancedStart();
	void TryToEnhancedCancel( bool close = true );
	bool TryToEnhanced( unsigned int slotIndex0, unsigned int slotIndex1 );

	/// 080402 PKH Npc
	void NpcNetTryItem( unsigned int protocol, void* msg = 0 );

	/// 거래관련
	bool TryToTradeAsk( cPlayer* player );	/// 거래요청
	void TryToTradeAccept();								/// 거래 승인
	void TryToTradeReject();								/// 거래 거절
	void TryToTradeCancel();								/// 닫기 요청
	bool TryToTradeItemAdd( unsigned int slotIndex );		/// 아이템 등록
	bool TryToTradeMoneyAdd( unsigned long money );			/// 거래금액 등록
	bool TryToTradeItemDelete( unsigned int slotIndex, unsigned int arrIndex );	/// 아이템 삭제
	void TryToTradeOk();									/// 거래물품 확인 완료
	void TryToTradeReTry();									/// 수정 요청
	void TryToTradeEnd();									/// 거래 종료 

	/// 노점상관련
	unsigned long GetUserSellTarget() { return mUserSellTarget; }
	void ClearUserSellTarget();
	bool TryToUserSellOpen();
	bool TryToUserSellReName( LPCTSTR title );
	void TryToUserSellClose();
	bool TryToUserSellAdd( unsigned short slot, unsigned long price );
	bool TryToUserSellDelete( unsigned short slot );
	bool TryToUserSellModify( unsigned short slot );
	void TryToUserSellJoin( sObject& obj );
	void TryToUserSellJoinClose();										/// 노점상 참여 닫기
	bool TryToUserSellGet( unsigned short slot, unsigned short count );	/// 아이템 구입요청
	void TryToUserSellSearch( unsigned long itemIndex, unsigned char enhanced );

	/// 카드장착 관련 ( 장착아이템, 장착할카드, 장착윈도우의 슬롯 )
	bool TryToPutCard( unsigned int itemSlot, unsigned int cardSlot, unsigned int putSlot );

	/// 컬렉션북 카드 장착 관련
	bool TryToCardBookAdd( unsigned int slot0, unsigned int slot1 );

	///
	cItem& GetItem( unsigned int slotIndex );
	cItemDefine* GetItemDefine( long itemIndex );
	cItemAbility* GetItemAbility( long itemIndex );
	eItemIn GetItemIn( unsigned int slotIndex );
	cItemNpcStore* GetItemNpcStore( unsigned int npcIndex );
	unsigned int GetItemCount( long itemIndex );
	unsigned int FindSlotIndex( long itemIndex );
	LPCTSTR GetItemName( unsigned int textIndex );

	/// 잠금
	void LockItemTry( eItemTry itemTry, unsigned long slotIndex0 = 0 );	/// 외부 사용잠금

	/// 잠금 풀기 
	eItemTry GetItemTry() { return mTry; }
	void UnlockItemTry( eItemTry itemTry );
	bool IsLocked();

	/// 네트워크 메시지
	void NetworkMsgParser( char* msg );
	void NetSetItem( sInventory* inv, bool setCool = true );

	/// DropItem 인터페이스..
	bool CreateDropItem( MSG_ITEM_INFO* dropMsg );
	void DeleteDropItem( unsigned long idx );

	/// 퀘스트 시작 아이템 삭제
	void DeleteQuestInsertItem();

	/// 조합 레시피,전문기술 아이템 삭제
	void DeleteMixInsertItem();

	/// DropItem 상자 선택 체크
	//bool ProcessLButtonClick( int mouseX, int mouseY );
	//bool ProcessLButtonDClick( int mouseX, int mouseY );
	//bool ProcessMouseOver( int mouseX, int mouseY );

	bool CheckNearestDropItem();
	bool CheckOpenTime();

	/// 무기 스위칭 좌표 세팅
	void SetWeaponIconPos( unsigned int slotIndex, cUIRect rect );

	/// 아이템 분류맵 획득
	tArray<unsigned long>* GetHighClassArr() { return &mHighClassArr; }
	tArray<unsigned long>* GetMiddleClassArr( unsigned long key ) { return (tArray<unsigned long>*)mMiddleClassMap.GetAt( key ); }
	tArray<unsigned long>* GetLowClassArr( unsigned long key ) { return (tArray<unsigned long>*)mLowClassMap.GetAt( key ); }
	tArray<unsigned long>* GetItemCategoryArr( unsigned long key ) { return (tArray<unsigned long>*)mItemMap.GetAt( key ); }

#ifdef _GMTOOL
	tArray<unsigned long>* GetGMItemCategoryArr( unsigned long key ) { return (tArray<unsigned long>*)mGMItemMap.GetAt( key ); }
#endif

	/// 아이템 정의맵 획득
	tHashMap<long, void*>& GetDefineMap() { return mDefineMap; }
	
protected:
	/// 로딩
	bool LoadText( const cString& pathName );
	bool LoadDefine( const cString& pathName );
	bool LoadAbility( const cString& pathName );
	bool LoadLimit( const cString& pathName );
	bool LoadCard( const cString& pathName );
	bool LoadTarot( const cString& pathName );
	bool LoadSpread( const cString& pathName );
	bool LoadFileName( const cString& pathName );
	bool LoadNpcStore( const cString& pathName );
	bool LoadDisjoint( const cString& pathName );
	bool LoadEnhanced( const cString& pathName );
	bool LoadCardSlot( const cString& pathName );
	bool LoadCategoryTable( const cString& pathName );

	/// 쿨타임 관련 데이터 로드
	void LoadCoolData();
	
	///
	void LockAndBackup( eItemTry itemTry, unsigned int slotIndex0, unsigned int slotIndex1 = 0, unsigned long tempIndex = 0, unsigned short value = 0, unsigned long price = 0, cItemIcon* icon = 0 );

	/// 장착
	bool TestMoveItemDown( unsigned int slotIndex0, unsigned int slotIndex1 );
	bool TestMoveItemUp( unsigned int slotIndex0, unsigned int slotIndex1 );

	bool MoveItemDown( unsigned int slotIndex0, unsigned int slotIndex1 );
	bool MoveItemUp( unsigned int slotIndex0, unsigned int slotIndex1 );

	bool TestEquipWeapon( unsigned int& slotIndex1, eItemEquip equipType );
	bool TestEquipWeapon_OneHand( unsigned int& slotIndex1 );
	bool TestEquipWeapon_TwoHands( unsigned int& slotIndex1 );
	bool TestEquipWeapon_Shield( unsigned int& slotIndex1 );
	bool TestEquipWear( unsigned int& slotIndex1, unsigned char subType );
	bool TestEquipAccessory( unsigned int& slotIndex1, unsigned char subType );
	bool TestEquipCard( unsigned int& slotIndex1 );

	bool TestUseItem( unsigned int slotIndex0 );
	bool TestUseEtcItem( unsigned int slotIndex0 );	// 퀘스트 의뢰아이템

	bool EquipWeapon( unsigned int& slotIndex1, unsigned int slotIndex, eItemEquip equipType );
	bool EquipWeapon_OneHand( unsigned int& slotIndex1, unsigned int slotIndex );
	bool EquipWeapon_TwoHands( unsigned int& slotIndex1, unsigned int slotIndex );
	bool EquipWeapon_Shield( unsigned int& slotIndex1, unsigned int slotIndex );
	bool EquipWear( unsigned int& slotIndex1, unsigned int slotIndex, unsigned char subType );
	bool EquipAccessory( unsigned int& slotIndex1, unsigned int slotIndex, unsigned char subType );
	bool EquipCard( unsigned int& slotIndex1, unsigned int slotIndex );

	bool FindEmptySlot( unsigned int* slotIndex, unsigned int begin, unsigned int end );

	/// 네트워크
	void NetTryItem( unsigned int protocol, void* msg = 0 );
	void NetMoveItem( unsigned int slotIndex0, unsigned int slotIndex1 );
	void NetEquipItem( unsigned int slotIndex );
	void NetUseItem( unsigned int slotIndex );
	void NetUnEquipItem( unsigned int slotIndex );
	void NetDumpItem( unsigned int slotIndex );
	void NetSplitItem( MSG_RES_ITEM_DIVIDE_INVENTORY* msgData );
	void NetSplitItem( MSG_RES_NPC_ITEM_MOV2_INVENTORY* msgData, unsigned int slotIndex0, unsigned int slotIndex1 );

	void SetSwitchWeapon( eItemActiveWeapon activeWeapon );
	void NetSwitchWeapon( eItemActiveWeapon activeWeapon );
	void NetBuyItem( MSG_RES_NPC_ITEM_BUY* msgData );
	void NetGetItem( MSG_RES_ITEM_GET* msgData );
	void NetSellItem( MSG_RES_NPC_ITEM_SELL* msgData );
	void NetRewardItem( MSG_RES_ITEM_REWARD* msgData );
	void NetTakeItem( MSG_RES_ITEM_TAKE* msgData );
	void NetDisjointItem( MSG_RES_ITEM_DISJOINT_INVENTORY* msgData );
	void NetEnhancedItem( MSG_RES_ITEM_ENHANCED_END* msgData );
	void NetTradeItem( MSG_RES_ITEM_EXCHANGE_END* msgData );
	void NetChangeItem( MSG_RES_ITEM_CHANGE_INVENTORY* msgData );
	void NetMixSkillItem( MSG_RES_MAKESKILL_ITEM* msgData );
	void NetMixItem( MSG_RES_ITEM_MIXED* msgData );

	///
	cItemLimit* GetItemLimit( long itemIndex );
	cString* GetItemFileNames( long itemIndex );
	cItemSpread* GetItemSpread( long itemIndex );
	cItemCard* GetItemCard( long itemIndex );
	cItemTarot* GetItemTarot( long itemIndex );
	sItemDisjoint* GetItemDisjoint( long index );
	sItemEnhanced* GetItemEnhanced( long index );
	sItemPutCardSlot* GetItemPutCardSlot( long index );
	
	/// 아이템 어빌리티 체크
	void AddAbility( cItem& item );
	void AddSpecialAbility( short type, short value );

	void AddEnhance( cItem& item );
	void AddPutCard( unsigned long cardIndex );

	/// 아이템 전체 무게 검사 && 아이템 총갯수 관리
	void CheckWeight();
	void CheckItemCount();

	/// 선택된 슬롯 갱신
	void ChangeSelectSlot( unsigned int slot );
	
	/// 치트
	bool CheatMakeItem( sInventory* inv );

public:
	/// 단일체를 리턴
	static cItemManager* GetSingleton();

protected:
	/// 텍스트
	cUIText* mItemText;

	/// 아이템 정의
	typedef tHashMap<long, void*> cDefineMap;
	cDefineMap mDefineMap;

	/// 아이템 능력
	typedef tHashMap<long, void*> cAbilityMap;
	cAbilityMap mAbilityMap;

	/// 아이템 제한
	typedef tHashMap<long, void*> cLimitMap;
	cLimitMap mLimitMap;

	/// 아이템 카드
	typedef tHashMap<long, void*> cCardMap;
	cCardMap mCardMap;

	/// 아이템 타롯
	typedef tHashMap<long, void*> cTarotMap;
	cTarotMap mTarotMap;

	/// 아이템 스프레드
	typedef tHashMap<long, void*> cSpreadMap;
	cSpreadMap mSpreadMap;

	/// 아이템 파일명 배열
	typedef tHashMap<long, void*> cFileNamesMap;
	cFileNamesMap mFileNamesMap;

	/// 아이템 분해 데이터 
	typedef tHashMap<long, void*> cDisjointMap;
	cDisjointMap mDisjointMap;

	/// 아이템 강화 데이터 
	typedef tHashMap<long, void*> cEnhancedMap;
	cEnhancedMap mEnhancedMap;

	/// 카드 슬롯 데이터
	typedef tHashMap<long, void*> cPutCardSlotMap;
	cPutCardSlotMap	mPutCardSlotMap;

	/// 아이템 분류를 위한 자료구조
	/// 아이템 정의 인덱스

	typedef tArray<unsigned long> cNameIdxArr;
	typedef tPointerHashMap<unsigned long, void*> cNameIdxArrMap;

	cNameIdxArr mHighClassArr;
	cNameIdxArrMap mMiddleClassMap;
	cNameIdxArrMap mLowClassMap;
	cNameIdxArrMap mItemMap;

#ifdef _GMTOOL
	cNameIdxArrMap mGMItemMap;
#endif

protected:

	/// 아이템 배열
	cItem mItemArray[MAX_INVENTORY];

	/// 아이템 플랙 배열
	int mFlagArray[MAX_INVENTORY];

	/// 잠김 여부
	bool mLocked;

	/// 활성화된 장착 정보
	eItemActiveWeapon mActiveWeapon;

	/// front / back 상대좌표
	cUIRect mFrontLeft;
	cUIRect mFrontRight;
	cUIRect mBackLeft;
	cUIRect mBackRight;

	/// 백업
	eItemTry mTry;
	unsigned int mSlotIndex0;
	unsigned int mSlotIndex1;
	unsigned long mTempIndex;	/// 각종 상황별로 저장할 인덱스
	unsigned short mValue;
	unsigned long mPrice;
	cItemIcon* mLinkedIcon;

	/// 무게
	cGauge* mWeightGauge;
	float mMaxWeight;
	float mCurWeight;

	/// 장비 어빌리티 ( 기본, 추가 )
	sEquipAbility mBasicAbil;

	/// Npc 상점
	typedef tHashMap<unsigned int, void*> cNpcStoreMap;
	cNpcStoreMap mNpcStoreMap;

	/// 동일종류의 아이템의 총 갯수 저장 (아이템인덱스, 아이템 총갯수)
	typedef tHashMap<long, unsigned int> cItemCountMap;
	cItemCountMap mItemCountMap;

	/// Drop Item의 정보를 좀더 쉽게 참조하기 위한 자료구조
	/// server에서 제공된 index / 그래픽 Node 포인터
	typedef tPointerHashMap<unsigned long, unsigned long> cDropItemMap;
	cDropItemMap mDropItemMap;

	/// 거래할 상대방 정보
	unsigned long mTradeTarget;
	cStringT mTradeName;
	unsigned long mTradeMoney;

	/// 노점관련 정보
	cStringT mUserSellName;	
	unsigned long mUserSellTarget;	/// 보고있는 노점의 타겟인덱스

	/// 아이템 상자 오픈시간 체크
	unsigned long mLastAccutime;
};

inline
void cItemManager::SetWeightGauge( cGauge* gauge )
{
	mWeightGauge = gauge;
}

inline
float cItemManager::GetWeight()
{
	return mCurWeight;
}

inline
cItem& cItemManager::GetItem( unsigned int slotIndex )
{
	assert( slotIndex <= MAX_INVENTORY && "index out of range" );

	return mItemArray[ slotIndex ];
}

inline
sEquipAbility*	cItemManager::GetBasicAbil()
{
	return &mBasicAbil;
}

inline
void cItemManager::ClearUserSellTarget()
{
	mUserSellTarget = 0;
}

inline
cItemManager* cItemManager::GetSingleton()
{
	return mSingleton;
}

#define ITEMMAN cItemManager::GetSingleton()
