/* ==========================================================================
* 파    일 : PVP_Common.h
* 목    적 : 
* 작 성 자 : 박경희
* 작 성 일 : 2008-09-04
* 주의사항 :
*===========================================================================*/
#pragma once 

#include "CommonNetworkMsgStruct.h" 

#pragma pack(push,1) 

const int				PVP_DM_TEAM_CNT = 18;						/// 데스매치 팀인원
const int				PVP_DM_NEWGAME_TIME = 30 * SECOND;			/// 데스매치 게임 시작 주기			30
const int				PVP_DM_NOTICE_TIME = 1 * MINUTE;			/// 데스매치 공지 발송 시간			5
const int				PVP_DM_JOIN_TIME = 1 * MINUTE;				/// 데스매치 입장 시간
const float				PVP_DM_READY_MOVE_RANGE = 2500.0f;			/// 대기상태에서 이동 가능 범위
const int				PVP_DM_READY_TIME = 30 * SECOND;			/// 데스매치 전투시작 카운트
const int				PVP_DM_READY_PRINT_TIME = 10 * SECOND;		/// 데스매치 전투시작 카운트
const int				PVP_DM_READY_OUT_TIME = 1 * MINUTE;			/// 데스매치 전투시작 카운트 불가시 게임 out 시간
const int				PVP_DM_TEAM_MINCNT = 0;						/// 데스매치시 한팀 최소 인원		6
const int				PVP_DM_TEAM_MINCNT_TIME = 0 * MINUTE;		/// 데스매치시 팀인원 부족시 시간 제한		5
const int				PVP_DM_FIGHT_TIME = 3 * MINUTE;			/// 데스매치 모든조건을 체크하는 전투시간	10
																	/// ※(전체 시간 - PVP_DM_TEAM_MINCNT_TIME) 
const int				PVP_DM_DEST_POINT = 100;					/// 데스매치 목표 포인트
const int				PVP_DM_MEMBER_DIE_POINT = 1;				/// 데스매치팀원 죽은경우 포인트
const int				PVP_DM_LEADER_MEMBER_KILL_POINT = 2;		/// 데스매치수장이 적팀원을 죽인 포인트
const int				PVP_DM_LEADER_DIE_POINT = 5;				/// 데스매치수장 죽은경우 포인트
const int				PVP_DM_LEADER_CHANGETIME = 1 * MINUTE;		/// 수장이 선택된 후 다음 선택 시간
const int				PVP_DM_LEADER_DIECHANGETIME = 5 * SECOND;	/// 수장이 죽은 후 다음 선택 시간
const int				PVP_DM_RESURRECTION_TIME = 10 * SECOND;		/// 데스매치시 죽은경우 부활대기 시간
const int				PVP_DM_OUTWAIT_TIME = 1 * MINUTE;			/// 데스매치 게임종료후 자동 종료 대기 시간
const int				PVP_DM_START_POSIDX_A = 21011;				/// A진영 시작 포인트
const int				PVP_DM_START_POSIDX_B = 21012;				/// B진영 시작 포인트
const int				PVP_DM_LEADER_SKILL = 300001;				/// 리더 전용 효과
const int				PVP_DM_LEADER_INFLUENCE = 100001;			/// 리더 전용 효과
const int				PVP_DM_LEADER_INFLUENCE2 = 100008;			/// 리더 전용 효과
const int				PVP_DM_NODAMAGE_INFLUENCE = 100002;			/// 무적 효과
const int				PVP_DM_CANTPVP_INFLUENCE = 0;			/// PVP 진입 불가 효과		100003
const int				PVP_DM_WIN_INFLUENCE = 100006;				/// 승리 보상 효과
const int				PVP_DM_LOSE_INFLUENCE = 100007;				/// 패배 보상 효과

/// unsigned char
enum ePVPDM_TEAM_TYPE
{
	ePVPDM_TEAMTYPE_A = 0,
	ePVPDM_TEAMTYPE_B,

	ePVPDM_TEAMTYPE_MAX,
};

enum ePVPDM_END_TYPE
{
	ePVPDM_ENDTYPE_POINT,					/// 포인트 달성
	ePVPDM_ENDTYPE_TIME,					/// 시간 초과(포인트량)
	ePVPDM_ENDTYPE_MEMBER,					/// 인원수
	ePVPDM_ENDTYPE_LEADERDIE,				/// 수장 사망 횟수
	ePVPDM_ENDTYPE_FASTJOIN,				/// 맵 입장 순서
};

struct sPvPDMMemberInfo
{
	unsigned long		mPlayerIdx;			/// 고유번호
	unsigned long		mLeaderKillCnt;		/// 수장 죽인수
	unsigned long		mKillCnt;			/// 죽인수
	unsigned long		mDeathCnt;			/// 죽은수

	void Init()
	{
		mPlayerIdx = 0;
		mKillCnt = 0;
		mDeathCnt = 0;
	}
};

struct sPvPDMTeamInfo
{
	unsigned char		mMemberCnt;			/// 팀인원
    unsigned long		mLeaderIdx;			/// 수장 idx
	unsigned long		mLeaderChangeTime;	/// 수장 변경 시간
	unsigned long		mPoint;				/// 습득 포인트
	unsigned long		mLeaderDieCnt;		/// 수장 죽은 수
	bool				mFire;				/// 세력별 동맹팀
	bool				mWater;
	bool				mWind;
	bool				mEarth;
};

struct sDMInfo
{
	unsigned char		mType;
	unsigned short		mMapNumber;
	unsigned char		mMinLevel;
	unsigned char		mMaxLevel;
	unsigned long		mKillPoint;
	unsigned long		mLeaderKillPoint;
	unsigned long		mDeathPoint;
	unsigned long		mWinMyForcePoint;
	unsigned long		mWinFamilyForcePoint;
	unsigned long		mLoseMyForcePoint;
	unsigned long		mLoseCheckPoint;
	unsigned long		mWinMyForceFriendly;
	unsigned long		mWinFamilyForceFriendly;
	unsigned long		mLoseMyForceFriendly;
	unsigned long		mLoseCheckFriendly;
};

struct sDMMemberGive
{
	unsigned char		mLevel;
	unsigned long		mWinMoney;
	unsigned long		mLoseMoney;
	unsigned long		mWinExp;
	unsigned long		mLoseExp;
	unsigned long		mWinSxp;
	unsigned long		mLoseSxp;

};

struct MSG_SYN_PVP_DM_NOTICE : public MSGROOT
{
	unsigned char		mLeftTime;			/// 남은 시간(분)
};

struct MSG_SYN_PVP_DM_JOIN : public MSGROOT
{
	unsigned char		mMinLevel;
	unsigned char		mMaxLevel;
	unsigned long		mLeftTime;			/// 남은 시간
};

struct MSG_RES_PVP_DM_JOIN : public MSGROOT
{
	unsigned long		mDMIdx;
	unsigned char		mTeamType;		/// ePVPDM_TEAM_TYPE
};

struct sMsgMemberInfo
{
	unsigned long		mCharacterIdx;
	wchar_t				mName[MAX_NAME_BUFFER_SIZE];
	unsigned char		mForceType;						/// eFORCE_TYPE
};

struct MSG_SYN_PVP_DM_MEMBERIN : public MSGROOT
{
	sMsgMemberInfo		mMemberInfo;
};

struct MSG_RES_PVP_DM_MEMBERIN : public MSGROOT
{
	bool				mFireForce;			/// 팀세력 유무
	bool				mWaterForce;
	bool				mWindForce;
	bool				mEarthForce;
	unsigned char		mMemberCnt;			/// 접속중인 유저 카운트
	sMsgMemberInfo		mMemberInfo[1];		/// 점속중인 유저 정보

	MSG_RES_PVP_DM_MEMBERIN()
	{
		memset( this, 0, sizeof(MSG_RES_PVP_DM_MEMBERIN) );
	}

	unsigned long GetMsgLength() { return sizeof(MSG_RES_PVP_DM_MEMBERIN) - sizeof(mMemberInfo) + (mMemberCnt * sizeof(sMsgMemberInfo));} 
};

struct MSG_SYN_PVP_DM_MEMBEROUT : public MSGROOT
{
	unsigned long		mCharacterIdx;
};

struct MSG_SYN_PVP_DM_LEADERCHANGE : public MSGROOT
{
	unsigned long		mCharacterIdx;		/// 수장 플레이어IDX
};

struct MSG_SYN_PVP_FIGHT : public MSGROOT
{
	unsigned long		mFightTime;		/// 전투 시간
};

struct MSG_SYN_PVP_DM_SCORE : public MSGROOT
{
	unsigned char		mTeamType;		/// ePVPDM_TEAM_TYPE
	unsigned long		mTotalScore;
	unsigned long		mPlusScore;
	unsigned long		mPlayerIdx;
	unsigned long		mPlayerScore;
};

struct sPvPDMTeamScore
{
	unsigned long		mCharacterIdx;
	unsigned long		mScore;
};

struct MSG_SYN_PVP_DM_FIGHTEND : public MSGROOT
{
    unsigned char		mEndType;
	unsigned long		mFireFriendly;
	unsigned long		mFirePoint;
	unsigned long		mWaterFriendly;
	unsigned long		mWaterPoint;
	unsigned long		mWindFriendly;
	unsigned long		mWindPoint;
	unsigned long		mEarthFriendly;
	unsigned long		mEarthPoint;
	unsigned long		mMoney;
	unsigned long		mSxp;
	unsigned long		mExp;
	unsigned long		mTeamCnt;
	sPvPDMTeamScore		mTeam[1];

	/// 실제보내는 메세지 크기
	unsigned long GetMsgLength() { return sizeof(MSG_SYN_PVP_DM_FIGHTEND) - sizeof(mTeam) + (mTeamCnt * sizeof(sPvPDMTeamScore)); }
};

struct MSG_RES_PVP_DM_RANKINFO : public MSGROOT
{
	unsigned long		mTeamCnt;
	sPvPDMTeamScore		mTeam[1];

	/// 실제보내는 메세지 크기
	unsigned long GetMsgLength() { return sizeof(MSG_RES_PVP_DM_RANKINFO) - sizeof(mTeam) + (mTeamCnt * sizeof(sPvPDMTeamScore)); }
};

#pragma pack(pop) 
