#pragma once #include "Task.h" #include "FrameSync.h" #include "GameServerSession.h" #include "DnWorld.h" class CDnWorld; class CDNGameRoom; class CDnDungeonHistory; class CPvPRespawnLogic; class CDnPlayerActor; class CDnGameTask : public CTask, public CGameServerSession { public: CDnGameTask( CMultiRoom *pRoom ); virtual ~CDnGameTask(); #ifdef __COVERITY__ #else FRIEND_TEST( Allocator_unittest, vector ); #endif enum DungeonClearStateEnum { DCS_None, DCS_RequestDungeonClear, DCS_ClearResultStay, DSC_RequestRankResult, DSC_RankResultStay, DCS_RequestSelectRewardItem, DCS_SelectRewardItemStay, DCS_RequestRewardItemStay, DCS_RewardItemStay, DCS_RequestRewardItemResult, DCS_RewardItemResultStay, DCS_RequestWarpDungeon, DCS_WarpDungeonStay, DCS_WarpStandBy, DCS_DLRequestChallenge, }; protected: CFrameSkip m_FrameSkip; CFrameSkip m_FrameSkipProjectile; CDnWorld *m_pWorld; int m_nGameTaskType; int m_nMapTableID; #if defined(PRE_ADD_RENEW_RANDOM_MAP) int m_nRootMapTableID; #endif std::vector m_vPermitPassClassIds; int m_nPermitMapLevel; TDUNGEONDIFFICULTY m_StageDifficulty; // ¿ø·¡ »ç¿ë ¸ñÀû º¯°æ!! ½ºÅ×ÀÌÁö ·¹º§ÀÌ 5°¡Áö·Î º¯°æµÈ´Ù!! Easy, Normal, Hard, Hell, Special int m_nStartPositionIndex; bool m_bReleaseWorld; bool m_bEnteredDungeon; int m_nEnterDungeonTableID; int m_nEnterMapTableID; int m_nReturnDungeonClearWorldID; int m_nReturnDungeonClearStartPositionIndex; #if defined(PRE_SHARE_MAP_CLEARCOUNT) int m_nShareCountMapIndex; #endif DNVector(DnActorHandle) m_hVecMonsterList; DNVector(DnActorHandle) m_hVecNpcList; struct ActorBirthStruct :public TBoostMemoryPool { int nAreaUniqueID; DNVector(DnActorHandle) hVecList; }; std::vector m_pVecActorBirthList; std::map m_pMapDungeonHistory; bool m_bGameProcessDelay; float m_fGameProcessDelayDelta; bool m_bWaitPlayCutScene; bool m_bCutSceneAutoFadeIn; bool m_bDungeonFailed; DungeonClearStateEnum m_DungeonClearState; float m_fDungeonClearDelta; bool m_bDungeonClearQuestComplete; bool m_bDungeonClearSendWarpEnable; bool m_bIgnoreDungeonClearRewardItem; #if defined( PRE_SKIP_REWARDBOX ) int m_nRewardBoxUserCount; #endif float m_fAIDelta; float m_fProjectileDelta; DWORD m_dwStageCreateTime; bool m_bIsTimeAttack; float m_fTimeAttackDelta; float m_fOriginTimeAttackDelta; std::map m_nMapSetMonsterReference; #ifdef PRE_ADD_STAGE_DAMAGE_LIMIT struct StageDamageLimitStruct { float fDamageLimit; float fStateLimit; }; StageDamageLimitStruct m_sStageDamageLimitStruct; #endif #if defined( PRE_ADD_HEAL_TABLE_REGULATION ) struct StageHealLimitStruct { float fHealLimit_Type1; float fHealLimit_Type2; }; StageHealLimitStruct m_sStageHealLimitStruct; #endif // ¸ó½ºÅÍ »ý¼º½Ã¿¡¸¸ ¾²ÀÌ´Â ½ºÆ®·°ÃÄÀÔ´Ï´Ù. ¿ÜºÎ¿¡¼­ Á¢±ÙÇÒÀÏ ¾ø½À´Ï´Ù. struct MonsterTableStruct { std::string szName; int nActorTableID; }; struct GenerationMonsterStruct { int nActorTableID; int nMonsterTableID; CEtWorldEventArea *pArea; int nMonsterSpawn; }; struct AreaStruct { int nCompoundIndex; int nMin; int nMax; CEtWorldEventArea *pArea; int nMonsterSpawn; }; struct MonsterCompoundStruct { int nMonsterTableID; int nPossessionProb; int nValue; }; struct MonsterSetStruct { int nSetID; int nPosID; CEtWorldEventArea *pArea; int nMonsterSpawn; }; struct MonsterSetProbStruct { int nItemID; int nProb; }; struct MonsterGroupStruct { int nGroupID; int nCount; }; //ChannelMerit const TMeritInfo * m_pMeritInfo; // ´øÀü Ŭ¸®¾î½Ã »ç¿ëÇÏ´Â ½ºÆ®·°ÃÄ struct TreasureBoxLevelStruct { char cTreasureLevel; int nOffset; }; // struct sWarpStruct { bool bActivated; CSWarpDungeon sWarp; } m_sWarpDungeonStruct; #if defined( PRE_ADD_STAGE_WEIGHT ) TStageWeightData m_StageWeightData; #endif // #if defined( PRE_ADD_STAGE_WEIGHT ) protected: bool GenerationMonster( int nRandomSeed ); bool GenerationNpc( int nRandomSeed ); bool GenerationSetMonster( int nRandomSeed ); void ResetSetMonsterReference(); int CalcMonsterIDFromMonsterGroupID( int nItemID ); int CalcSetMonsterReference( int nSetID, bool bNewReference = false ); void CalcSetMonsterGroupList( int nSetTableID, std::map &nMapResult ); char GetTreasureBoxType( int nOffset, DNVector(TreasureBoxLevelStruct) &VecList ); void SetStartPosition( CDNUserSession* pSession, int nPartyIndex ); bool InitializeWorld( const char *szGridName ); void InitializeMonster( DnActorHandle hMonster, DWORD dwUniqueID, int nMonsterID, SOBB &GenerationArea, CEtWorldEventArea *pBirthArea = NULL, int nForceSkillLevel = -1 ); void BackupDungeonHistory(); void RecoveryDungeonHistory( int nMapIndex ); void ClearDungeonHistory(); void CalcDungeonClear(); #if defined(PRE_SHARE_MAP_CLEARCOUNT) void ResetDungeonClear( bool bCreate, int nMapIndex = -1, int nGateIndex = -1, int nEnterMapTabeID = -1, int nDungeonClearTableID = -1, int nShareCountMapIndex = 0 ); #else void ResetDungeonClear( bool bCreate, int nMapIndex = -1, int nGateIndex = -1, int nEnterMapTabeID = -1, int nDungeonClearTableID = -1 ); #endif void SetGameProcessDelay( int nDelay ); // void UpdatePlayerWorldLevel(); bool CheckAndSyncCutScenePlay(); void CheckAndSyncCutSceneSkip( CDNUserSession *pSession ); virtual void ChangeDungeonClearState( DungeonClearStateEnum State ); virtual bool ProcessDungeonClearState( LOCAL_TIME LocalTime, float fDelta ); void InitializeCP(); void InitializeBreakIntoPlayerCP( CDNUserSession * pSession ); virtual bool OnInitializePlayerActor( CDNUserSession* pSession, const int iVectorIndex ); void InitializeMerit(); static bool Sort_SetMonster_SetID( MonsterSetStruct &a, MonsterSetStruct &b ); static bool Sort_SetMonster_PosID( MonsterSetStruct &a, MonsterSetStruct &b ); void RequestDungeonClearBase(); void AddDungeonClearUserInfo( std::vector & vInfo, std::vector & vPartyStruct ); int CalcBonusCP( const int nDungeonClearID, const int nMaxComboCount, const int nKillBossCount, CDnPlayerActor * pPlayerActor ); int CalcCP( std::vector & vInfo, std::vector & vPartyStruct, const int nDungeonClearID ); BYTE CalcRank( std::vector & vecRankRatio, const int nStandardCP, const int nCP ); public: virtual void Process( LOCAL_TIME LocalTime, float fDelta ); bool Initialize(); bool InitializePlayerActor(); virtual bool OnInitializeBreakIntoActor( CDNUserSession* pSession, const int iVectorIndex ); virtual bool InitializeStage( int nCurrentMapIndex, int nGateIndex, TDUNGEONDIFFICULTY StageDifficulty, int nRandomSeed, bool bContinueStage, bool bDirectConnect, int nGateSelect ); // nStageConstructionLevel, nStartPositionIndex Àº 1ºÎÅÍ ½ÃÀÛ.. ÁÖÀÇÇϽñæ bool InitializeStage( const char *szGridName, int nMapTableID, TDUNGEONDIFFICULTY StageDifficulty, int nStartPositionIndex); virtual bool InitializeNextStage( const char *szGridName, int nMapTableID, TDUNGEONDIFFICULTY StageDifficulty, int nStartPositionIndex ); virtual bool PostInitializeStage( int nRandomSeed ); void FinalizeStage(); int GetGameTaskType() { return m_nGameTaskType; } int GetMapTableID() { return m_nMapTableID; } int GetStartPositionIndex(){ return m_nStartPositionIndex; } TDUNGEONDIFFICULTY GetStageDifficulty() { return m_StageDifficulty; } void SetStageDifficulty( TDUNGEONDIFFICULTY Difficulty ) { m_StageDifficulty = Difficulty; } void GetPermitPassClassIDs(int * pClassArr, int nArrMaxSize); int GetPermitMapLevel() { return m_nPermitMapLevel; } int CheckRecoveryDungeonHistorySeed( int nMapIndex, int nRandomSeed ); void CheckMerit(CDnPlayerActor * pActor, int nCheckType, int nCalcVal, UINT &nOutVal); DnActorHandle CreateNpc(int nNpcIndex, TNpcData* pNpcData, EtVector3 vPos, float fRot); void DestroyNpc(UINT nUniqueID); void RequestGenerationNpc( int nNpcID, float x, float y, float z, float fRotate, int nAreaUniqueID = -1 ); void RequestDestroyNpc(int nAreaUniqueID); DnActorHandle RequestGenerationMonsterFromMonsterID( int nMonsterID, EtVector3 &vPosition, EtVector3& vVel, EtVector3& vResistance, SOBB *pGenerationArea = NULL, int nAreaUniqueID = -1, int nTeamSetting = -1 ); DnActorHandle RequestGenerationMonsterFromActorID( int nMonsterID, int nActorID, EtVector3 &vPosition, EtVector3& vVel, EtVector3& vResistance, SOBB *pGenerationArea = NULL, int nAreaUniqueID = -1, int nTeamSetting = -1, bool bRandomFrameSummon = true, EtQuat* pqRotation = NULL, int nForceSkillLevel = -1 ); void RequestGenerationMonsterFromMonsterGroupID( int nMonsterGroupID, int nCount, SOBB &GenerationArea, int nAreaUniqueID = -1, DNVector(DnActorHandle) *pVecResult = NULL, int nTeamSetting = -1 ); void RequestGenerationMonsterFromSetMonsterID( int nSetMonsterID, int nPositionID, SOBB &GenerationArea, int nAreaUniqueID = -1, DNVector(DnActorHandle) *pVecResult = NULL, int nTeamSetting = -1, bool bResetReference = false ); void RequestGenerationMonsterFromSetMonsterID( int nSetMonsterID, int nPositionID, std::vector &pVecAreaUniqueList, DNVector(DnActorHandle) *pVecResult = NULL, int nTeamSetting = -1, bool bResetReference = false ); bool CheckMonsterIsInsideArea( int nAreaUniqueID, int nTargetUniqueID ); bool CheckMonsterLessHP( int iMonsterID, int iHP ); bool CheckInsideAreaMonsterLessHP( int iAreaUniqueID, int iHP ); int GetInsideAreaMonsterHPPercent( int iAreaUniqueID ); EtVector3 GetGenerationRandomPosition( SOBB *pOBB ); void RequestDestroyAllMonster( bool bDropItem, int nTeam = -1 ); void RequestChangeGameSpeed( float fSpeed, DWORD dwDelay ); // ServerSession virtual int OnRecvNpcTalkMsg( CDNUserSession * pSession, CSNpcTalk *pPacket, int nLen ); virtual int OnRecvNpcTalkEndMsg( CDNUserSession * pSession, CSNpcTalkEnd *pPacket, int nLen ); virtual int OnRecvChatChatMsg( CDNUserSession * pSession, CSChat *pPacket, int nLen ); virtual int OnRecvChatPrivateMsg( CDNUserSession * pSession, CSChatPrivate *pPacket, int nLen ); virtual int OnRecvDiceMsg( CDNUserSession * pSession, CSDice *pPacket, int nLen ); virtual int OnRecvChatChatRoomMsg( CDNUserSession * pSession, CSChatChatRoom *pPacket, int nLen ); #if defined (PRE_ADD_ANTI_CHAT_SPAM) virtual int OnRecvChatSpammer( CDNUserSession * pSession, bool* bSpammer ); #endif virtual int OnRecvRoomRequestDungeonFailed( CDNUserSession *pSession, char *pPacket ); virtual int OnRecvRoomWarpDungeon( CDNUserSession * pSession, CSWarpDungeon *pPacket ); virtual int OnRecvRoomSelectRewardItem( CDNUserSession * pSession, CSSelectRewardItem *pPacket ); virtual int OnRecvRoomIdentifyRewardItem( CDNUserSession * pSession, CSIdentifyRewardItem *pPacket ); virtual int OnRecvQuestCompleteCutScene( CDNUserSession * pSession, char *pPacket ); virtual int OnRecvQuestSkipCutScene( CDNUserSession * pSession, char *pPacket ); virtual int OnRecvSelectAppellation( CDNUserSession *pSession, CSSelectAppellation *pPacket ); virtual int OnRecvCollectionBook( CDNUserSession *pSession, CSCollectionBook *pPacket ); // RUDPGameSession ¿¡¼­ µé¾î¿À´Â°Å. void OnRecvVillageState( CDNUserSession *pSession, MAGAVillageState *pPacket ); virtual void SetSyncComplete( bool bFlag ); void InsertBirthAreaList( DnActorHandle hActor, int nAreaUniqueID ); void RemoveBirthAreaList( int nAreaUniqueID ); void RemoveBirthAreaList( DnActorHandle hActor, int nAreaUniqueID ); DWORD GetBirthAreaLiveCount( int nAreaUniqueID ); DWORD GetBirthAreaTotalCount( int nAreaUniqueID ); bool GetBirthAreaLiveActors( int nAreaUniqueID, DNVector(DnActorHandle)& out ); void RequestGateInfo( CDNUserSession* pBreakIntoGameSession=NULL ); virtual void RequestDungeonClear( bool bClear = true, DnActorHandle hIgnoreActor = CDnActor::Identity(), bool bIgnoreRewardItem = false ); void RequestDungeonFailed( bool bForce=false, bool bTimeOut=false ); void RequestChangeGateInfo( char cGateIndex, EWorldEnum::PermitGateEnum PermitFlag ); #ifdef _TEST_CODE_KAL void RequestDungeonClear_ForCheat(int mapTableID, DWORD clearTime, int meritBonusID, int enterGateIdx, char partyMemeberCount, int completeExp, int rankIdx, int difficulty); #endif DnPropHandle RequestGenerationProp( int nPropTableID, int nReqClassID, EtVector3 &vPosition, EtVector3 &vRotation, EtVector3 &vScale, int nLifeTime, void* pAdditionalPropInfo ); void RequestPlayCutScene( int nCutSceneTableID, bool bFadeIn, int nQuestIndex, int nQuestStep); bool IsWaitPlayCutScene() { return m_bWaitPlayCutScene; } void RequestChangeMap( int nMapIndex, char cGateNo ); //#52874 ¸ó½ºÅÍ ¼ÒȯÀ» ¹ß»çü·Î ÇÒ °æ¿ì STE_SummonMonster ½Ã±×³ÎÀ» ó¸® ÇÏ´Â ½ÃÁ¡ÀÌ ½ºÅ³ »ç¿ë ½ÃÁ¡°ú ´Ù¸¥ °æ¿ì°¡ ÀÖ´Ù. //¹ß»çü¿¡¼­ ÀÌ ÇÔ¼öÀ» È£Ãâ ÇÒ °æ¿ì ¹ß»çü ½ºÅ³ID¸¦ ÀÔ·Â ¹Þ¾Æ¼­ hOwnerÀÇ Çö½ÃÁ¡¿¡¼­ »ç¿ëµÇ´Â ½ºÅ³°ú ºñ±³ÇÔ. void RequestSummonMonster( DnActorHandle hOwner, SummonMonsterStruct* pStruct, bool bReCreateFollowStageMonster = false, int nSkillID = -1 ); //Ä®¸®ÀÇ Puppet»óÅÂÈ¿°ú¿¡¼­ ¼ÒȯµÇ´Â ¸ó½ºÅÍÀÎ °æ¿ì hOwnerÀÇ À§Ä¡°¡ ¾Æ´Ï¶ó ½ºÅ³userÀÇ À§Ä¡¸¦ ±âÁØÀ¸·Î ¸ó½ºÅÍ ¼ÒȯÀÌ ÀÌ·ç¾îÀú¾ß ÇÑ´Ù. //±×·¡¼­ ºÎµæÀÌ ÇÏ°Ô ÇÔ¼ö¸¦ Ãß°¡ÇÑ´Ù. DnActorHandle RequestSummonMonsterBySkill( DnActorHandle hOwner, DnActorHandle hSkillUser, SummonMonsterStruct* pStruct, bool bReCreateFollowStageMonster = false, int nSkillID = -1 ); void RequestNestDungeonClear( DnActorHandle hActor ); #ifdef PRE_ADD_STAGE_DAMAGE_LIMIT void CalcStageDamageLimit( int nMapIndex ); StageDamageLimitStruct *GetStageDamageLimit(){ return &m_sStageDamageLimitStruct; } #endif #if defined( PRE_ADD_HEAL_TABLE_REGULATION ) void CalcStageHealLimit( int nMapIndex ); StageHealLimitStruct & GetStageHealLimit() { return m_sStageHealLimitStruct; } #endif void RequestNestDungeonClear( int iForceMapIndex=0 ); void RequestEnableDungeonClearWarpAlarm( bool bEnable ); bool IsEnteredDungeon() { return m_bEnteredDungeon; } int GetDungeonEnterTableID() { return m_nEnterDungeonTableID; } int GetEnterMapTableID() { return m_nEnterMapTableID; } bool IsDungeonFailed() { return m_bDungeonFailed; } void RefreshDungeonClearState(); #if defined(PRE_SHARE_MAP_CLEARCOUNT) int GetShareCountMapIndex() { return m_nShareCountMapIndex; } #endif DungeonClearStateEnum GetDungeonClearState() const { return m_DungeonClearState; } CDNUserSession* GetPartyLeaderSession(); void EnableDungeonClearWarpQuestFlag(); virtual void OnInitializeStartPosition( CDNUserSession* pSession, const int iPartyIndex ); virtual void OnDie( DnActorHandle hActor, DnActorHandle hHitter ) {} virtual void OnDamage( DnActorHandle hActor, DnActorHandle hHitter, const INT64 iDamage ) {} virtual void OnGhost( DnActorHandle hActor ) {} virtual void OnLeaveUser( UINT uiSessionID ){} void SyncMonster( CDNUserSession* pBreakIntoGameSession ); void SyncNpc( CDNUserSession* pBreakIntoGameSession ); bool IsTimeAttack() const { return m_bIsTimeAttack; } void ProcessTimeAttack( float fDelta ); void StartTimeAttack( int iMin, int iSec ); void StopTimeAttack(); int GetRemainTimeAttackSec() const; int GetOriginTimeAttackSec() const; void SyncTimeAttack( CDNUserSession* pSession=NULL ); void EnableGameWarpDungeonClearToLeader(); void SendGameWarpDungeonClearToLeader(); #if defined(PRE_ADD_STAGECLEAR_TIMECHECK) bool CheckDungeonClearAbuseTime(DWORD dwClearTime, int nMapID); #endif // #if defined(PRE_ADD_STAGECLEAR_TIMECHECK) #ifdef PRE_FIX_PARTY_STAGECLEAR_CHANGEMASTER void SetWarpDungeonClearToLeaderCheck(bool bSet); #endif void SendActorShow( CDNUserSession* pBreakIntoGameSession, DnActorHandle hActor ); void SendActorHide( CDNUserSession* pBreakIntoGameSession, DnActorHandle hActor ); #if defined( PRE_ADD_NAMEDITEM_SYSTEM ) virtual void CheckSelectNamedItem( CDNUserSession * pSession, TItem& RewardItem, BYTE cIndex ); virtual void SwapNamedItemToNormalItem( CDNUserSession * pSession, TItem& RewardItem ); void CheckSelectNamedItemResult( CDNUserSession * pSession, TACheckNamedItemCount* pA ); #endif #if defined( PRE_ALTEIAWORLD_EXPLORE ) void ResetAlteiaWorldmap(); #endif DWORD GetStageCreateTime() { return m_dwStageCreateTime; } #if defined( PRE_ADD_STAGE_WEIGHT ) const TStageWeightData * GetStageWeightData(); void SetStageWeightData( int nStageWeightID ); #endif // #if defined( PRE_ADD_STAGE_WEIGHT ) private: bool _CheckRequestNestDungeonClear( int iMapIndex ); void _SendActorShow( CDNUserSession* pBreakIntoGameSession, DnActorHandle hActor ); void _SendActorHide( CDNUserSession* pBreakIntoGameSession, DnActorHandle hActor ); void _SendActorTeam( CDNUserSession* pBreakIntoGameSession, DnActorHandle hActor ); ////////////////////////////////////////////////////////////////////////// // ¸ó½ºÅÍ »ý¼º À§Ä¡(Random/Center)¸¦ À§ÇÑ ÇÔ¼ö Ãß°¡ protected: bool GenerationMonster(DNVector(MonsterSetStruct) &VecSetMonsterList, int nInitalizeType, int nTeamSetting, DNVector(DnActorHandle) * pVecResult); public: int GetMonsterSpawnType(int nAreaUniqueID); ////////////////////////////////////////////////////////////////////////// #if defined(PRE_ADD_65808) void ApplySummonMonsterGlyph(DnActorHandle hOwner, CDnMonsterActor* pMonsterActor, int nGlyphID); #endif // PRE_ADD_65808 }; class IBoostPoolDnGameTask : public CDnGameTask, public TBoostMemoryPool< IBoostPoolDnGameTask > { public: IBoostPoolDnGameTask( CMultiRoom *pRoom ):CDnGameTask(pRoom){} virtual ~IBoostPoolDnGameTask(){} };