/* ========================================================================== * ÆÄ ÀÏ : ItemScript.h * ¸ñ Àû : * ÀÛ ¼º ÀÚ : ÀÓ ¼Ò ¿¬ * ÀÛ ¼º ÀÏ : 2009-09-28 * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "Lexer.h" #include "Parser.h" class cItemNpcStoreLexer : public cLexer { public: cItemNpcStoreLexer( const char* buffer, unsigned int size ); }; /// ¾ÆÀÌÅÛ npc»óÁ¡ ÅÇ °¹¼ö const int NPCSTORE_TAB_COUNT = 5; enum { eTOKEN_NPCSTORE = 100, /// Npc »óÁ¡ eTOKEN_TAB /// ±â´É }; struct sNpcItemData { unsigned long mTextIdx; unsigned long mRate; unsigned char mForce; tArray mItem; sNpcItemData() { mTextIdx = 0; mRate = 0; mForce = 0; } }; /// °¨¼Ò ¼¼·Â Æ÷ÀÎÆ® enum eNpcItemSellType { eNPC_ITEM_SELL_TYPE_MONEY_OR_COIN, eNPC_ITEM_SELL_TYPE_FIRE, eNPC_ITEM_SELL_TYPE_WATER, eNPC_ITEM_SELL_TYPE_WIND, eNPC_ITEM_SELL_TYPE_EARTH, }; /// ¾ÆÀÌÅÛ Npc »óÁ¡ class cItemNpcStore { public: cItemNpcStore(void); ~cItemNpcStore(void); void Clear(); bool Load( cParser& parser ); bool LoadTab( sNpcItemData* pTab, cParser& parser ); bool IsItemIdx( unsigned long itemIdx ); bool IsItemIdx( unsigned int tabIndex, unsigned long itemIdx ); unsigned int GetTabCount( ) { return mTabAry.GetSize(); } unsigned int GetItemCount( unsigned int tabIndex ); unsigned long GetItemIndex( unsigned int tabIndex, unsigned int cellIndex ); unsigned long GetTextIndex( unsigned int tabIndex ); unsigned long GetItemSellRate( unsigned int tabIndex ); unsigned char GetItemSellType( unsigned int tabIndex ); sNpcItemData* GetNpcItemData ( unsigned int tabIndex ); private: typedef tArray cPAry; cPAry mTabAry; }; class cItemScript { public: /// »ý¼º ¼Ò¸ê cItemScript(void); ~cItemScript(void); bool Init(); void Release(); bool LoadNpcStore ( const cString& pathName ); cItemNpcStore* GetItemNpcStore ( unsigned int npcIndex ) const; private: typedef tPointerHashMap cNpcStoreMap; cNpcStoreMap mNpcStoreMap; public: static cItemScript* mpItemScript; }; #define ITEMSCRIPT cItemScript::mpItemScript