#pragma once #include //#include #include #include #include "SNetMessage.h" #include "SGameUIMgr.h" using std::vector; struct TS_ITEM_INFO; class KViewportObject; enum EQUIPMENT_INFO { EQUIPMENT_NONE, EQUIPMENT_NORMAL, // 일반아이템. EQUIPMENT_UPPER, // 상급아이템. EQUIPMENT_DECORATE, // 꾸미기아이템. EQUIPMENT_MAX }; // Item 의 요청상태. enum RQ_ITEM_STATE { RQ_ITEM_STATE_NONE = 0, RQ_ITEM_STATE_DROP = 1, // 버리기. RQ_ITEM_STATE_ERASE = 2, // 파괴( 파괴창 ). RQ_ITEM_STATE_MAX, }; //------------------------------------------------------------------------------------------------------------ // Shop slot information //------------------------------------------------------------------------------------------------------------ class SShopSlot { public: SShopSlot( void ); ~SShopSlot( void ); void SetPrice( money_t nPrice ) { m_nPrice = nPrice; }; void SetHuntaHolicPoint( money_t nPoint ) { m_nHuntaHolicPoint = nPoint; } // #2.1.2.11.1 void SetArenaPoint(money_t point) { m_arenaPoint = point; } void SetItemCode( int nItemCode ); void SetNpcHandle( AR_HANDLE handle ) { m_hNpc = handle; }; void SetRank( int nItemRank ) { m_nItemRank = nItemRank; } const money_t GetPrice( void ) const { return m_nPrice; }; const money_t GetHuntaHolicPoint( void ) const { return m_nHuntaHolicPoint; }; // #2.1.2.11.1 const money_t GetArenaPoint( void ) const { return m_arenaPoint; } const int GetItemCode( void ) const { return m_nItemCode; }; const int GetIconID( void ) const { return m_nIconID; }; const AR_HANDLE GetNpcHandle( void ) const { return m_hNpc; }; const int GetItemRank( void ) const { return m_nItemRank; }; private: AR_HANDLE m_hNpc; int m_nIconID; int m_nItemCode; int m_nItemRank; money_t m_nPrice; money_t m_nHuntaHolicPoint; money_t m_arenaPoint; }; //------------------------------------------------------------------------------------------------------------ // 인벤토리 슬롯 정보 //------------------------------------------------------------------------------------------------------------ class SInventorySlot { public: enum { NONEITEM = -9, SOKETNULL = -99, NONESOKET = -999, ENDURANCE_SUCCESS = -9999 }; SInventorySlot( void ); ~SInventorySlot( void ); public: TS_ITEM_INFO* GetItem( void ) { return &m_ItemInfo; } const AR_HANDLE GetHandle( void ) const { return m_ItemInfo.handle; } const int GetItemCode( void ) const { return m_ItemInfo.Code; } const count_t GetItemCount( void ) const { return count_t( m_ItemInfo.count ); } const short GetPosition( void ) const { return m_ItemInfo.wear_position; } const AR_HANDLE GetWearHandle( void ) const { return m_ItemInfo.own_summon_handle; } const unsigned int GetEndurance( void ) const { return m_ItemInfo.endurance; } const int* GetSocketInfo( void ) const { return m_ItemInfo.socket; } const int GetEnhance( void ) const { return m_ItemInfo.enhance; } const int GetIconID( void ) const { return m_nIconID; } const int GetLevel( void ) const { return m_ItemInfo.level; } const int GetRemainTime( void ) const { return m_ItemInfo.remain_time; } const XFlag GetXFlag( void ) const { return m_xFlg; } const ItemInstance::ItemUID GetUID( void ) const { return m_ItemInfo.uid; } const char GetEET( void ) const { return m_ItemInfo.elemental_effect_type; } const int GetEERT( void ) const { return m_ItemInfo.elemental_effect_remain_time; } const int GetEEAP( void ) const { return m_ItemInfo.elemental_effect_attack_point; } const int GetEEMP( void ) const { return m_ItemInfo.elemental_effect_magic_point; } const int GetEtherealDurability( void ) const { return m_ItemInfo.ethereal_durability; } TS_ITEM_BASE_INFO::AwakenOption* const GetAwakening( void ) { return &(m_ItemInfo.awakenoption); } const DWORD* GetAwakeningType( void ) const { return m_ItemInfo.awakenoption.nValue; } const int* GetAwakeningValue( void ) const { return m_ItemInfo.awakenoption.nData; } TS_ITEM_BASE_INFO::LPRANDOM_OPTION const GetRandomOption( void ) { return &(m_ItemInfo.random_option); } const int GetSummonID( void ) const { return m_ItemInfo.summon_id; } const int GetJewelSlotCount( void ); int getMaxEtherealDurability( void ) const; // Fraun Sky Accessories 7/12/2025 int GetAdditionalItemEffect(void) const { return m_ItemInfo.nAdditionalItemEffect; } static const int GetCrrEndurancePer( TS_ITEM_BASE_INFO* item, unsigned int& rEndurance ); const int GetCrrEndurancePer( unsigned int& rEndurance ); static const unsigned int GetMaxEndurance( TS_ITEM_BASE_INFO* item ); const unsigned int GetMaxEndurance( void ); const count_t GetUpdateCount( void ) const { return m_nGetItemCount; } bool GetShowDecoration( void ) { return m_bShowDecoration; } const int GetItemAppearance( void ) const { return m_ItemInfo.appearance_code; } void SetItem( TS_ITEM_INFO* pItemInfo ); void SetUpdateCount( count_t nNewCount, bool bDestroy = false ); void SetItemCount( count_t nItemCount ) { m_ItemInfo.count = nItemCount.getAmount(); } void SetPosition( short position ) { m_ItemInfo.wear_position = position; } void SetIconID( int nIconID ) { m_nIconID = nIconID; } void SetXFlag( XFlag xFlag ) { m_xFlg = xFlag; } void SetWearHandle( AR_HANDLE hCreature ) { m_ItemInfo.own_summon_handle = hCreature; } void SetToggleShowDecoration( void ) { m_bShowDecoration ^= true; } // 꾸미기아이템 보임,숨김 토글. void SetShowDecoration( bool flag ) { m_bShowDecoration = flag; } // 꾸미기아이템 보임,숨김 설정. void SetExistence( bool bExistence ) { m_bIsExistence = bExistence; } void SetAppendDecomposeWnd( bool bAppend ) { m_bIsAppendedDecomposeWnd = bAppend; } bool IsAwakeningItem( void ); bool IsAwakeningItem( TS_ITEM_BASE_INFO* pItemBaseInfo ); bool isExhausted( void ) const; bool IsExistence( void ) { return m_bIsExistence; } bool IsAppendedDecomposeWnd( void ) const { return m_bIsAppendedDecomposeWnd; } const bool IsSummonEquip( void ) const { return (m_ItemInfo.own_summon_handle != NULL); } const bool IsStorageItem( void ) const { return (m_ItemInfo.wear_position == ItemBase::WEAR_STORAGE); } const bool IsPlayerEquipItem( int nPos ) const { return (m_ItemInfo.wear_position == nPos && m_ItemInfo.own_summon_handle==NULL); } const bool IsEquipItem( void ) const { return (m_ItemInfo.wear_position != ItemBase::WEAR_CANTWEAR && m_ItemInfo.wear_position != ItemBase::WEAR_NONE && m_ItemInfo.wear_position != ItemBase::WEAR_STORAGE); } public: int m_nLastDurabilityCheckPercent; // 마지막으로 출력한 메시지를 보여주고, int m_nLastDurabilityValue; // 마지막으로 메시지 출력시 내구도의 값. protected: TS_ITEM_INFO m_ItemInfo; count_t m_nGetItemCount; // 몇개 추가되었나 업뎃 int m_nIconID; XFlag m_xFlg; bool m_bIsExistence; bool m_bShowDecoration; // 꾸미기 아이템 보임,안보임. bool m_bIsAppendedDecomposeWnd; // 분해 창에 등록 된 아이템 인가? }; bool IsInstanceUnstackable( SInventorySlot* pSlot ); bool IsInstanceUnstackable( const XFlag& rFlag ); bool IsInstanceUnstackable( const int nFlag ); //------------------------------------------------------------------------------------------------------------ // 인벤토리 매니져 //------------------------------------------------------------------------------------------------------------ namespace nsInventoryMgr { const static int NO_HANDLE( 0 ); const static int INVENTORY_SET_COUNT( 5 ); // Set 수 const static int INVENTORY_SET_SIZE( 13 ); // Set 의 Item 수 const static int CHECK_LENDING_TIME( 1000 ); const static int c_BeltSlotCnt( 8 ); }; using namespace nsInventoryMgr; class SInventoryMgr : public SGameUIMgr { public: enum { SET_INDEX_01 = 0, SET_INDEX_02, SET_INDEX_03, SET_INDEX_04, SET_INDEX_05, }; SInventoryMgr(); ~SInventoryMgr(); void SortItemList(); void Process( DWORD time ); void SetItemCoolTime( int nIndex, DWORD dwCoolTime ); int GetItemMaxCoolTime( int nIndex ); int GetItemCurCoolTime( int nIndex ); std::vector & GetInvenList() { return m_vInventory; }; /// 2010.11.24 편성된 크리처 카드 인지도 검사하도록 - prodongi void GetInvenDataList( int nCategory, std::vector& vecInvenList, class SCreatureSlotMgr const& creatureSlotMgr, bool bExceptEquipItem = false, bool bExceptDontBuyItem = false ); //void GetInvenDataList( int nCategory, std::vector& vecInvenList, bool bExceptEquipItem = false, bool bExceptDontBuyItem = false ); bool GetInvenDataList2( int nCategory, std::vector< SInventorySlot*>& vecInvenList ); SInventorySlot* GetItemInfo( AR_HANDLE hItem ); SInventorySlot* GetItemInfo( int nWearPos ); SInventorySlot* GetItemInfo( ItemInstance::ItemUID itemUID ); void GetItemInfo( std::vector& rItemList, ItemBase::ItemCode code, int level=0, int enhance=0 ); SInventorySlot* GetCodeItemInfo( ItemBase::ItemCode code ); SInventorySlot* GetComparableEquipItemInfo( SInventorySlot* pItem, bool second_equip ); SInventorySlot* GetComparableEquipItemInfo( ItemBase::ItemCode code, bool second_equip ); SInventorySlot* GetItemInfoCreatureUID( int nUID ); AR_HANDLE GetItemHandle( int nIndex ); AR_HANDLE GetItemHandleForCode( int nItemCode ); const int GetItemSetIndex() const { return m_nCurSetIndex; }; const bool IsEndurance(int nResult) { return (nResult!=SInventorySlot::NONEITEM && nResult!=SInventorySlot::SOKETNULL && nResult!=SInventorySlot::NONESOKET); } void CheckWeapon( const struct ItemBaseEx_info* pItemBase, int item_handle, ItemBase::ItemWearType MainWearType, ItemBase::ItemWearType SubWearType, unsigned int& a, int& nPosition, BOOL& bPut ); void Rq_UseItem( int nRace, AR_HANDLE item_handle, AR_HANDLE target_handle, AR_HANDLE item_target_handle, const char* lpText=NULL ); void Rq_CreatureUseItem( AR_HANDLE item_handle, AR_HANDLE target_handle ); /// Item 추가 int AddItem( TS_ITEM_INFO* pItemInfo ); /// Item 떨굼 int DropItem( AR_HANDLE item_handle ); /// Item 파괴 int DestroyItem( AR_HANDLE item_handle ); // 아이템 삭제 후 처리 (인덱스 밀기) void _onEraseItem( std::vector::iterator it ); // 아이템파괴. //int EraseItem( ItemBase::ItemCode itemCode, __int64 count ); int EraseItem( AR_HANDLE handle, __int64 count ); void SendDestroyMsg(int count, int itemCode); bool GetIsRquestDestroyState()const { return m_rqItemState == RQ_ITEM_STATE::RQ_ITEM_STATE_ERASE; } /// Item 수량 변경 int UpdateItemCount( AR_HANDLE item_handle, count_t nItemCount, bool fromDestory = false ); void UpdateWear( struct SMSG_ITEM_WEAR* pMsg ); void UpdateWearInfo( struct SMSG_ITEM_WEAR_INFO* pMsg, bool bCreature = false ); void ItemSet( int nItemSetIndex ) { m_nCurSetIndex = nItemSetIndex; }; /// 스킬 카드 장착 유무 void AddEquipCard( AR_HANDLE target_handle, AR_HANDLE hItem ); void DelEquipCard( AR_HANDLE target_handle, AR_HANDLE hItem ); bool IsEquipCard( AR_HANDLE hItem ) const; /// 2010.12.29 const 추가 /// 벨트 슬롯 장착 유무 void SetBeltSlotCard( struct SMSG_BELT_SLOT_INFO* pMsg ); bool IsBeltSlotCard( AR_HANDLE hItem ) const; /// 2010.12.29 const 추가 int GetBeltSlotIndex( AR_HANDLE hItem ); int GetEmptyBeltSlotIndex(); AR_HANDLE GetBeltSlot( int nIndex ); // 아이템의 장착여부 반환. bool IsEquip( AR_HANDLE handle ); // 2010.08.17 - prodongi //void Rq_BeltCardPut( bool bPutOn, AR_HANDLE hItem ); void Rq_BeltCardPut( bool bPutOn, AR_HANDLE hItem, int putSlot = 0 ); // shop list void AddShopItem( struct SMSG_MARKET* pMsg ); void GetShopDataList( int nCategory, std::vector& vecShopList ); SShopSlot* GetShopItem( int nItemCode ); SInventorySlot* GetUpdateItemInfo( AR_HANDLE handle ); void SetUpdateItemInfo( SInventorySlot* pSlot ); int GetLendingItemTime( AR_HANDLE item_handle ); // Cash Item void SetCashDragItem( unsigned int itemUID ) { m_hCashDragItem = itemUID; } const unsigned int GetCashDragItem() { return m_hCashDragItem; } std::vector & GetCashItemList() { return m_vCashItemList; }; void UpdateCashItem( TS_SC_COMMERCIAL_STORAGE_LIST::CommercialItemInfo * pCashItemInfo ); void ClearCashItem(); /// 현재 아이템 소유 하고 하는가? bool IsExistItem( int nItemCode ); bool IsExistItem( AR_HANDLE hItem ); bool IsExistItem( AR_HANDLE hItem, count_t nItemCount ); /// 창고에 인벤토리에 해당 코드의 아이템이 있는가? bool IsExistInvenItem( int nItemCode ); bool IsAwakeningItem(SInventorySlot* pSlot); AR_HANDLE GetFirstFindItem( int nItemCode ); count_t GetItemCount( int nItemCode ); void GetEquipItemList( std::vector& vecInvenList ); // 2010.07.22 - prodongi void getCreatureEquipItemList(std::vector& vecInvenList, AR_HANDLE creatureHandle); void Clear(); void ResetInfo(); void CheckDurabilityMsg(SInventorySlot* pSlot); // Item 의 요청상태. void SetItemRqState( RQ_ITEM_STATE state ){ m_rqItemState = state; } protected: bool enableSellItem(bool exceptEquipItem, bool exceptDontBuyItem, SInventorySlot const* slot, SCreatureSlotMgr const& creatureSlotMgr, ItemBaseEx_info const* item) const; protected: DWORD m_dwTime; DWORD m_dwCheckLendingTime; unsigned int m_nCheckCount; void _addLendingItem( SInventorySlot* pItemSlot ); void _delLendingItem( SInventorySlot* pItemSlot ); int m_nCurSetIndex; SInventorySlot m_nSet[INVENTORY_SET_COUNT][INVENTORY_SET_SIZE]; ///< Set에는 Only Link struct EQUIP_CARD { AR_HANDLE item_handle; AR_HANDLE target_handle; }; std::vector< EQUIP_CARD > m_vEquipCareList; struct CRETURE_REMAIN_TIME { int nRemainTime; AR_HANDLE hCreatureCard; }; std::vector m_vLendingItem; ///< 대여 아이템 핸들 std::vector m_vInventory; ///< Inventory List std::vector m_vecShopList; ///< shop list //현재 장착하고 있는 정보 ItemBase::ItemCode m_itemCode[ItemBase::MAX_ITEM_WEAR]; ///< 장착된 아이템 코드 AR_HANDLE m_itemHandle[ItemBase::MAX_ITEM_WEAR]; ///< 장착된 아이템 핸들 SInventorySlot* m_pUpdateItemInfo; std::vector< TS_SC_COMMERCIAL_STORAGE_LIST::CommercialItemInfo > m_vCashItemList; unsigned int m_hCashDragItem; int m_dwCool_time[TS_SC_ITEM_COOL_TIME::MAX_ITEM_COOLTIME_GROUP]; ///< 아이템 그룹 쿨타임 DWORD m_dwCur_time[TS_SC_ITEM_COOL_TIME::MAX_ITEM_COOLTIME_GROUP]; int m_dwRemain_time[TS_SC_ITEM_COOL_TIME::MAX_ITEM_COOLTIME_GROUP]; AR_HANDLE handle_BeltSlot[6]; ///< Belt Slot Info // Item 의 요청상태. int m_rqItemState; };