/* ==========================================================================
* 파    일 : Drop.h
* 목    적 : 드롭 시스템
* 작 성 자 : 박경희
* 작 성 일 : 2007-02-20
* 주의사항 :
*===========================================================================*/
#pragma once

#include <map>
#include "RangeCheck.h"

class cDropScript;
class tDefragmentArray;
class cMonster;
class cPlayer;

struct sDropNType;
struct sDropSWType;
struct sPlayerDamage;
struct sDropNTypeGather;

class cDrop
{

public:

	static cDrop*	mpDrop;

	cDrop(void);
	~cDrop(void);

	bool			Init();
	void			Release();

	/// 몬스터
	void			MonsterDrop( unsigned long monsterIdx, unsigned long playerIdx, unsigned long partyIdx );
	void			MonsterQuestDrop( unsigned long monsterIdx, unsigned long playerIdx, unsigned long partyIdx );
	/// 레벨차에 따른 exp, sxp 증감치 포함된 실제 경험치
	float			MonsterDropExpIncrease( float takeExp, unsigned char playerLevel, unsigned char monsterLevel );

	/// 채집
	void			GatherDrop( cGathering* pGathering, unsigned long playerIdx );

private:

	/// 몬스터 
	void			MonsterDropValue( cMonster* pMonster );										/// money, exp, sxp 드롭 처리
	void			MonsterDropNType( unsigned long monsterClassIdx );							/// N일반 드롭 처리
	void			MonsterDropNTypeSelect( sDropNType* pDropNType );							/// N일반 드롭 아이템 선택
	void			MonsterDropSType( unsigned long monsterClassIdx );							/// S(특수)드롭 처리
	void			MonsterDropWType( unsigned char monsterLv, unsigned char monsterType );		/// W(월드)드롭 처리
	void			MonsterDropSWTypeSelect( sDropSWType* pDropSWType, bool isSType );			/// S(특수)W(월드)드롭 아이템 선택
	void			MonsterDropQType( cMonster* pMonster, cPlayer* pPlayer );					/// 퀘스트 아이템 드랍
	bool			MonsterCheckDrop( cMonster* pMonster, cPlayer* pPlayer );					/// 드롭 조건 체크

	/// 채집
	void			GatherDropValue( cGathering* pGathering, unsigned long playerIdx );
	void			GatherDropNType( cGathering* pGathering );
	void			GatherDropNTypeSelect( sDropNTypeGather* pDropNTypeGather );
	void			GatherDropSType( cGathering* pGathering );
	void			GatherDropQType( cGathering* pGathering, unsigned long playerIdx );

private:

	cDropScript*	mpDropScript;

	typedef tArray<void*> cAry;
	typedef tHashSet<unsigned long> cHashSet;
	typedef tHashMap<unsigned long, unsigned long> cHashMap;

	cHashMap		mDropItemCntMap;

	/// 몬스터를 공격한 유저들의 파티 리스트
	cHashSet		partyIdxSet;

	/// 충돌 범위 체크
	cRangeCheck		rangechk;

};

#define DROP cDrop::mpDrop
