/* ========================================================================== * ÀÛ ¼º ÀÚ : ±è°¡¶÷ * ÀÛ ¼º ÀÏ : 2008.09.05 * ³» ¿ë : * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "PVP_Common.h" const unsigned long PVP_WAIT_TIME = 1000 * 60; class cPlayer; enum ePVPState { ePVPState_None, ePVPState_Notice, // ÀÔÀå¾Ë¸² ePVPState_Count, // ÀÔÀå ´ë±â ePVPState_Wait, // ´ë±â ePVPState_MapChangeWait, // ¸Ê üÀÎÁö ´ë±â // ePVPState_Enable, // ÀüÅõ °¡´É(¸ÊÀ̵¿ÈÄ) ePVPState_Ready, // ÀüÅõ ´ë±â ePVPState_Fight, // ÀüÅõ ePVPState_Result, // °á°ú }; struct sMyTeamInfo { unsigned long mPlayerIdx; TCHAR mName[MAX_NAME_BUFFER_SIZE]; unsigned char mForceType; unsigned long mKillCnt; unsigned long mDeathCnt; unsigned long mScoreResult; }; class cPVPManager { public: static cPVPManager* mpSingleton; public: cPVPManager(); ~cPVPManager(); void Open(); void Close(); void Process( unsigned long deltaTime, unsigned long accumTime ); bool IsEnableAttack( cPlayer* player ); bool IsMyTeam( cPlayer* player ); inline bool IsEnableBattle() { return (mPVPState >= ePVPState_Enable && mPVPState <= ePVPState_Result); } inline void SetEnableBattle( bool set ) { mPVPState = (set)? ePVPState_Enable:ePVPState_None; } // ÀüÀå ÀÚ¸®ºñ¿ò ½Å°í void RequestReport( cStringT name ); // void ChangeState( ePVPState state ); void NetworkMsgParser( char* pMsg ); inline unsigned char GetMinLevel() { return mMinLevel; } inline unsigned char GetMaxLevel() { return mMaxLevel; } inline ePVPState GetPVPState() { return mPVPState; } inline unsigned short GetPVPType() { return mPVPType; } inline unsigned long GetWaitLeftTime() { return mWaitLeftTime; } inline unsigned long GetGoalPoint() { return mGoalPoint; } inline unsigned long GetTeamAScore() { return mTeamAScore; } inline unsigned long GetTeamBScore() { return mTeamBScore; } void LinkPvpForceEffect( cPlayer* player, unsigned char forceType ); public: static cPVPManager* GetSingleton(); void AddTeamPlayerInfo( sMsgMemberInfo* memberInfo ); void UpdateTeamPlayerInfo( unsigned long playerIdx, unsigned long value, bool kill ); void DelTeamPlayerInfo( unsigned long playerIdx ); void OpenRank( bool update ); void OpenResult( MSG_SYN_PVP_DM_FIGHTEND* pmsg, bool win ); protected: // ÀüÀå ŸÀÔ unsigned short mPVPType; // »óÅ ePVPState mPVPState; // Á¤º¸ unsigned long mLeaderIdx; unsigned char mMinLevel; unsigned char mMaxLevel; unsigned long mFightLeftTime; unsigned long mReadyPrintTime; unsigned long mWaitLeftTime; // ´ë±â ½Ã°£ bool mUpdateRankInfo; typedef tPointerHashMap cMyTeamInfoMap; cMyTeamInfoMap mTeamInfoMap; // Á¡¼ö unsigned long mGoalPoint; unsigned long mTeamAScore; unsigned long mTeamBScore; // ½Å°í ¶ô bool mRequestLock; }; inline cPVPManager* cPVPManager::GetSingleton() { return mpSingleton; } #define PVPMAN cPVPManager::GetSingleton()