/* ====================================================================================== * ÆÄ ÀÏ : SkillManager.h , SkillManager.cpp * ¸ñ Àû : ½ºÅ³ °ü¸® * ÀÛ ¼º ÀÚ : À̹ý¼® * ÀÛ ¼º ÀÏ : 2007³â 07¿ù 06ÀÏ * * Ãß°¡³»¿ë : * Ãß°¡³¯Â¥ ÀÛ¾÷ÀÚ Ãß°¡³»¿ë * * ÁÖÀÇ»çÇ× : skillobject´Â dummy »ý¼º -> server·Î ºÎÅÍ ÀÎÁõÈÄ -> managed·Î º¯°æ influenceobject´Â ¼­¹ö·Î ºÎÅÍ ¹ÞÀº Á¤º¸·Î¸¸ »ý¼ºµÈ´Ù. * ======================================================================================*/ #pragma once #include "IndexGenerator.h" #include "SkillObject.h" class cSkillExecuter; class cDamagePrintManager; struct sHaveSkill; struct sKeepSkill { unsigned char mStep; long mCastingTime; long mTotalTime; /// ½ºÅ³ ½ºÅ©¸³Æ®¿¡¼­ °¡Á®¿À´Â ÃÑ´ë±â½Ã°£ /// long mStartTime; long mRestTime; sKeepSkill() { mStep = 0; mCastingTime = 0; mRestTime = 0; mTotalTime = 0; mStartTime = 0; } }; class cSkillManager { public: static cSkillManager* mpSkillManager; public: cSkillManager(); ~cSkillManager(); bool Init(); void Open(); void Close(); void Process( unsigned long deltaTime, unsigned long accumTime ); /// ÀԷ ó¸® bool ProcessLButtonClick( int mouseX, int mouseY ); bool ProcessLButtonDClick( int mouseX, int mouseY ); cSkillObject* AllocSkillObject(); void FreeSkillObject( cSkillObject* ptr ); cInfluenceObject* AllocInfluenceObject(); void FreeInfluenceObject(cInfluenceObject* ptr); cApplyObject* AllocApplyObject(); void FreeApplyObject(cApplyObject* ptr); cChannelingSkillObject* AllocChannelingSkillObject(); void FreeChannelingSkillObject( cChannelingSkillObject* ptr ); unsigned long CreateHeroSkillObject( unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser, cBaseObject* pTarget, float speedFactor = 1.0f ); unsigned long CreateHeroSkillObject( unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser, NiPoint3 fieldPos, float speedFactor = 1.0f ); unsigned long CreateHeroMapChangeSkillObject( unsigned long skillIdx, cBaseObject* pUser ); unsigned long CreateHeroVehicleSkillObject( unsigned long skillIdx, cBaseObject* pUser ); unsigned long CreateHeroBlinkSkillObject( unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser ); void CreateSkillObject( unsigned long uIdx, unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser, cBaseObject* pTarget, float speedFactor = 1.0f ); void CreateSkillObject( unsigned long uIdx, unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser, NiPoint3 fieldPos, float speedFactor = 1.0f ); void CreateMapChangeSkillObject( unsigned long uIdx, unsigned long skillIdx, cBaseObject* pUser ); void CreateVehicleSkillObject( unsigned long uIdx, unsigned long skillIdx, cBaseObject* pUser ); void CreateBlinkSkillObject( unsigned long uIdx, unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser, NiPoint3 blinkPos ); cSkillObject* CreateNoneStopObject( unsigned long skillIdx, unsigned char skillStep, cBaseObject* pUser ); cSkillObject* CreateRevisionSkillObject( unsigned long uIdx, unsigned long skillIdx, unsigned char skillStep, unsigned char attackerType, unsigned long dramaKey, bool tranMon ); cSkillObject* CreateRevisionChannelingSkillObject( unsigned long uIdx, unsigned long skillIdx, unsigned char skillStep, unsigned char attackerType, unsigned long dramaKey, bool tranMon, float fieldX, float fieldY, unsigned long playerIdx ); void DeleteSkillObject( cSkillObject* p ); cInfluenceObject* CreateInfluenceObject( unsigned long uIdx, unsigned long infIdx, unsigned long skillIdx, cBaseObject* pTarget, unsigned char deleteType ); cInfluenceObject* CreateInfluenceObjectEx( unsigned long uIdx, unsigned long infIdx, unsigned long skillIdx, cBaseObject* pTarget, unsigned char deleteType, unsigned long restTime ); void DeleteInfluenceObject( cInfluenceObject* p ); void DeleteInfluenceObject( unsigned long uniqueIdx ); cInfluenceObject* GetInfluenceObject( unsigned long uniqueIdx ); cApplyObject* CreateApplyObject( cBaseObject* pUser, cBaseObject* pTarget, unsigned char weaponType, eAPPLYDRAMA_TYPE type ); cApplyObject* CreateApplyObject( cBaseObject* pTarget, unsigned long influenceIdx ); cApplyObject* CreateActApplyObject( cBaseObject* pTarget, unsigned long actIdx ); void DeleteApplyObject( cApplyObject* p ); /// Hero º¸À¯ ½ºÅ³ Á¤º¸ void InitKeepSkill( sHaveSkill* pdata ); void AddKeepSkill( unsigned long skillIdx, unsigned char skillStep ); void ClearAllKeepSkill(); void UpdateAllSkill(); void InitSkillUI(); bool IsUsedKeepSkill( unsigned long skillIdx, unsigned char skillStep ); bool IsUsedMonsterSkill( unsigned long skillIdx ); void StartCoolTime( unsigned long skillIdx, unsigned long restTime = ULONG_MAX ); void StartCoolTimeMon( unsigned long skillIdx, unsigned long restTime = ULONG_MAX ); void ClearCoolTimeMon(); sKeepSkill* GetCoolTimeMon( unsigned long skillIdx ); void ClearSkillCooltime( unsigned long exceptskillIdx ); /// ±¸¸Å °¡´ÉÇÑ ½ºÅ³ÀÎÁö¸¦ üũÇÑ´Ù. bool CheckBuySkill( unsigned long skillIdx, unsigned char skillStep ); sKeepSkill* GetKeepInfo( unsigned long skillIdx ); void UpdateSkillStep( unsigned long idx, unsigned char step, bool stepUpdateAuto ); /// network msg parser void NetworkMsgParser( char* pMsg ); /// 071024 PKH ½ºÅ×ÀÌÅͽº °è»ê±â¿¡¼­ »ç¿ë tPointerHashMap* GetInfluenceMap() { return &mInfluenceMap; } tPointerHashMap* GetKeepSkillMap() { return &mKeepSkillMap; } unsigned long GetDummySkillCount() { return mDummySkillMap.GetSize(); } unsigned long GetSkillCount() { return mSkillObjectMap.GetSize(); } unsigned long GetInfluenceCount() { return mInfluenceMap.GetSize(); } unsigned long GetApplyCount() { return mApplyObjectMap.GetSize(); } protected: void DeleteProcess(); void UpdateExtraCooltime( unsigned long skillIdx, unsigned long restTime, unsigned long groupIdx ); protected: /// memory tPool mSkillObjectPool; tPool mInfluenceObjectPool; tPool mApplyObjectPool; tPool mChannelingSkillObjectPool; ////////////////////////////////////////////////////////////////////////// // skill process typedef tPointerHashMap cSkillObjectMap; typedef tArray cDeleteArray; /// ¼­¹ö·Î ºÎÅÍ °ËÁõÀ» ¹Þ±â Àü ó¸®¿ë °´Ã¼ (HERO¿ë) cSkillObjectMap mDummySkillMap; cIndexGenerator mDummyIndexGen; cIndexGenerator mApplyIndexGen; /// °ü¸® °´Ã¼ key = server create index cSkillObjectMap mSkillObjectMap; cSkillObjectMap mInfluenceMap; cSkillObjectMap mApplyObjectMap; /// »èÁ¦¿ë °´Ã¼ cDeleteArray mDeleteSkillArray; cDeleteArray mDeleteInfluenceArray; cDeleteArray mDeleteApplyObjectArray; ////////////////////////////////////////////////////////////////////////// typedef cSkillObjectMap cSkillMap; cSkillMap mKeepSkillMap; /// ¸ó½ºÅÍ º¯½Å»óŽà ÄðŸÀÓ ÀúÀå sKeepSkill mMonSkillCool[eMONSTERATTACK_MAX]; /// ½ºÅ³ ½ÇÇàÀÚ cSkillExecuter* mpSkillExecuter; /// µ¥¹ÌÁö Ãâ·ÂÀÚ cDamagePrintManager* mpDamagePrintManager; }; #define SKILLMAN cSkillManager::mpSkillManager inline cSkillObject* cSkillManager::AllocSkillObject() { return mSkillObjectPool.Alloc(); } inline void cSkillManager::FreeSkillObject(cSkillObject* ptr) { mSkillObjectPool.Free(ptr); } inline cInfluenceObject* cSkillManager::AllocInfluenceObject() { return mInfluenceObjectPool.Alloc(); } inline void cSkillManager::FreeInfluenceObject(cInfluenceObject* ptr) { mInfluenceObjectPool.Free(ptr); } inline cApplyObject* cSkillManager::AllocApplyObject() { return mApplyObjectPool.Alloc(); } inline void cSkillManager::FreeApplyObject(cApplyObject* ptr) { mApplyObjectPool.Free(ptr); } inline cChannelingSkillObject* cSkillManager::AllocChannelingSkillObject() { return mChannelingSkillObjectPool.Alloc(); } inline void cSkillManager::FreeChannelingSkillObject(cChannelingSkillObject* ptr) { mChannelingSkillObjectPool.Free(ptr); } inline void cSkillManager::DeleteSkillObject( cSkillObject* p ) { if( p ) { if( p->IsRemoved() == false ) { p->Removed(); mDeleteSkillArray.PushBack( p ); } } } inline void cSkillManager::DeleteApplyObject( cApplyObject* p ) { if( p ) { if( p->IsRemoved() == false ) { p->Removed(); mDeleteApplyObjectArray.PushBack( p ); } } } inline sKeepSkill* cSkillManager::GetKeepInfo( unsigned long skillIdx ) { return (sKeepSkill*)mKeepSkillMap.GetAt( skillIdx ); } inline cInfluenceObject* cSkillManager::GetInfluenceObject( unsigned long uniqueIdx ) { return (cInfluenceObject*) mInfluenceMap.GetAt( uniqueIdx ); }