#ifndef _NA_0_20110613_GAME_SHOP_RENEWAL #pragma once #ifndef SOLAR_SHOP_PRESENT_RECVBOX_H #define SOLAR_SHOP_PRESENT_RECVBOX_H //================================================================================================== /// PresentRecvBox class /** @author Kim Min Wook < taiyo@webzen.com > @since 2007. 1. 19 @remark - ¹ÞÀº ¼±¹°ÇÔ @note - @history - */ //================================================================================================== #include class ArchiveOfStream; class ShopManager; //================================================================================================== class PresentRecvBox { public: class PresentInfo; // internal class typedef std::list GIFT_HASH; // PresentRecvBox(); virtual ~PresentRecvBox(); void SetList(ShopManager& mgr IN, DWORD Count, tblRecvGiftItem* pGiftList); void Serialize(ArchiveOfStream& ar, eSHOP_SERIALIZE se); void Release(); PresentRecvBox::PresentInfo* FindPresent(GIFTGUID GiftGuid) const; BOOL ErasePresent(GIFTGUID GiftGuid); GIFT_HASH& GetHash() { return m_PresentList; } private: GIFT_HASH m_PresentList; }; //================================================================================================== class PresentRecvBox::PresentInfo { __DECL_CUSTOMPOOL_PTR(PresentInfo) public: enum ePRESENT_STATE { ePS_WAIT = 0, ///> ´ë±â ePS_ACCEPT, ///> ¼±¹° ½ÂÀÎ ePS_REJECT, ///> ¼±¹° °ÅºÎ ePS_DELETE ///> ¼±¹° »èÁ¦ }; struct ItemPiece { WORD ItemCode; BYTE Amount; DWORD UseTime; BYTE Enchant; BYTE Rank; }; // m_ItemPieces[MAX_PACKAGE_ITEM_SIZE]; public: PresentInfo(); ~PresentInfo(); void Release(); void Serialize(ArchiveOfStream& ar, eSHOP_SERIALIZE se); const char* GetItemName() const { return present_info_data_.item_name_; } const char* GetSendCharName() const { return present_info_data_.send_char_name_; } const char* GetSendMessage() const { return present_info_data_.send_message_; } void SetItemName(const char* p); void SetSendCharName(const char* p); void SetSendMessage(const char* p); // f100906.1L const ItemPiece* GetItemPiece(uint8_t piece_index) const; // { WORD GetItemCode(BYTE piece_idx) const { return m_ItemPieces[piece_idx].ItemCode; } BYTE GetAmount(BYTE piece_idx) const { return m_ItemPieces[piece_idx].Amount; } DWORD GetUseTime(BYTE piece_idx) const { return m_ItemPieces[piece_idx].UseTime; } BYTE GetEnchant(BYTE piece_idx) const { return m_ItemPieces[piece_idx].Enchant; } BYTE GetRank(BYTE piece_idx) const { return m_ItemPieces[piece_idx].Rank; } // } void SetPriceGuid(ShopManager& mgr IN, PRICEGUID guid); PRICEGUID GetPriceGuid() { return present_info_data_.price_guid_; } // DWORD GetServerKey() const { return present_info_data_.server_key_; } GIFTGUID GetGiftGuid() const { return present_info_data_.gift_guid_; } uint8_t GetState() const { return present_info_data_.state_; } uint8_t GetPieceCount() const { return present_info_data_.number_of_pieces_; } const DWORD64& GetSendDateTime() const { return present_info_data_.send_date_time_; } // compatible interface void SetState(uint8_t state) { present_info_data_.state_ = state; } protected: struct PresentInfoData { DWORD server_key_; //< ¾îµð¿¡ »ç¿ë? GIFTGUID gift_guid_; //< GiftItemID PRICEGUID price_guid_; //< PriceGuid uint8_t state_; //< »óÅ uint8_t number_of_pieces_; //< ItemPieceÀÇ °³¼ö DWORD64 send_date_time_; //< double m_dbSendDate;¿¡¼­ º¯È¯ : YYYYMMDDHHMMSS char item_name_[MAX_ITEM_NAME_LENGTH + 1]; //< ¾ÆÀÌÅÛ À̸§ char send_char_name_[MAX_CHARACTER_NAME_LENGTH + 1]; //< º¸³½ »ç¿ëÀÚ Ä³¸¯ÅÍ À̸§ char send_message_[MAX_GIFT_MESSAGE_LENGTH + 1]; //< º¸³½ ¸Þ¼¼Áö } present_info_data_; public: // to compatible access ItemPiece m_ItemPieces[MAX_PACKAGE_ITEM_SIZE]; private: friend class PresentRecvBox; }; inline PresentRecvBox::PresentInfo::~PresentInfo() { } inline void PresentRecvBox::PresentInfo::Release() { ZeroMemory(&present_info_data_, sizeof(present_info_data_)); } // f100906.1L inline const PresentRecvBox::PresentInfo::ItemPiece* PresentRecvBox::PresentInfo::GetItemPiece(uint8_t piece_index) const { if (present_info_data_.number_of_pieces_ > piece_index) { return &m_ItemPieces[piece_index]; } return NULL; } inline void PresentRecvBox::PresentInfo::SetItemName(const char* p) { strncpy(present_info_data_.item_name_, p, _countof(present_info_data_.item_name_)); present_info_data_.item_name_[_countof(present_info_data_.item_name_) - 1] = '\0'; } inline void PresentRecvBox::PresentInfo::SetSendCharName(const char* p) { strncpy(present_info_data_.send_char_name_, p, _countof(present_info_data_.send_char_name_)); present_info_data_.send_char_name_[_countof(present_info_data_.send_char_name_) - 1] = '\0'; } inline void PresentRecvBox::PresentInfo::SetSendMessage(const char* p) { strncpy(present_info_data_.send_message_, p, _countof(present_info_data_.send_message_)); present_info_data_.send_message_[_countof(present_info_data_.send_message_) - 1] = '\0'; } #endif //SOLAR_SHOP_PRESENT_RECVBOX_H #endif // not defined _NA_0_20110613_GAME_SHOP_RENEWAL