#pragma once

#include <map>
#include <string>
#include <Windows.h>


#include <string>
#include "../../mainproc/RuneDev.h"			// for CRoleSprite*

#include "PG_Script.h"
#include "../../MainProc/NetGlobal.h"

class CNetCli_Script : public CNetGlobal
{
public:
	CNetCli_Script(void);
	~CNetCli_Script(void);

	// 封包註冊
	//-----------------------------------------------------------
	static void _PG_Script_LtoC_QuestAccept_Result		( int iCliID , int iSize , PVOID pData );    
	static void _PG_Script_LtoC_QuestComplete_Result	( int iCliID , int iSize , PVOID pData ); 
	static void _PG_Script_LtoC_QuestDelete_Result		( int iCliID , int iSize , PVOID pData ); 
	static void	_PG_Script_LtoC_QuestFlag				( int iCliID , int iSize , PVOID pData );
	static void	_PG_Script_LtoC_ClickQuestObjResult		( int iCliID , int iSize , PVOID pData );
	static void	_PG_Script_LtoC_QuestKillObjNotify		( int iCliID , int iSize , PVOID pData );
	static void	_PG_Script_LtoC_PlayMotion				( int iCliID , int iSize , PVOID pData );

	//-----------------------------------------------------------
	static bool			Init				();
	static bool			Release				();
	static void			Update				();

	// 由外部呼叫的動作
	//-----------------------------------------------------------
	static void			OnEvent_AddObj					( int iObjID )		{ if( m_pThis ) m_pThis->OnAddObj( iObjID );	}
	static void			OnEvent_DelObj					( int iObjID )		{ if( m_pThis ) m_pThis->OnDelObj( iObjID );	}
	static void			OnEvent_KillObj					( int iObjID )		{ if( m_pThis ) m_pThis->OnKillObj( iObjID );	}

	//static void			OnEvent_TouchQuestNPC			( int iRoleID )		{ ifm_pThis->OnTouchQuestNPC( iRoleID );	}
	static void			OnEvent_TouchQuestNPC			( int iRoleID )		{ if( m_pThis ) m_pThis->OnTouchQuestNPC	( iRoleID );	}
	static void			OnEvent_TouchQuestObj			( int iObjID )		{ if( m_pThis ) m_pThis->OnTouchQuestObj	( iObjID );		}
	static void			OnEvent_TouchPlot				( int iRoleID )		{ TouchEvent( iRoleID ); }

	/*
	static void			OnEvent_TouchQuestNPC			( CRoleSprite* pObj ) {	m_pThis->OnTouchQuestNPC ( pObj );	}
	static void			OnEvent_TouchQuestObj			( CRoleSprite* pObj ) {	m_pThis->OnTouchQuestObj ( pObj );	}
	static void			OnEvent_TouchPlot				( CRoleSprite* pObj ) { m_pThis->OnTouchPlot ( pObj );	}
	static void			OnEvent_RangePlot				( CRoleSprite* pObj ) { m_pThis->OnRangePlot ( pObj );	}
	*/
	

	//static void			OnEvent_QuestDetail			( int iQuestID , int bComplete ) { m_pThis->OnQuestDetail( iQuestID, bComplete ); }
	//static void			OnEvent_AcceptQuest			( int iQuestID ) { m_pThis->OnAcceptQuest( iQuestID ); }
	//static void			OnEvent_AcceptQuest			( int iQuestID ) { m_pThis->OnAcceptQuest( iQuestID ); }

	// 給繼承物件處理用事件
	//---------------------------------------------------------------
	virtual void		OnAddObj						( int iRoleID	) = 0;
	virtual void		OnDelObj						( int iRoleID	) = 0;
	virtual void		OnKillObj						( int iRoleID	) = 0;

	virtual void		OnTouchQuestNPC					( int iRoleID	) = 0;
	virtual void		OnTouchQuestObj					( int iObjID	) = 0;

	/*
	virtual void		OnTouchQuestNPC		( CRoleSprite* pObj ) = 0;
	virtual void		OnTouchQuestObj		( CRoleSprite* pObj ) = 0;
	virtual void		OnTouchPlot			( CRoleSprite* pObj ) = 0;
	virtual void		OnRangePlot			( CRoleSprite* pObj ) = 0;

	virtual void		OnUpdate			() = 0;
	*/
	//virtual void		OnQuestDetail		( int iQuestID , bool bComplete ) = 0;
	//virtual void		OnAcceptQuest		( int iQuestID ) = 0;

	virtual void		OnPlayMotion					( int iObjID, const char* pszMotion ) = 0;

	// 資料
	//---------------------------------------------------------------
	static CNetCli_Script*		m_pThis;

	
	// 發送封包
	//---------------------------------------------------------------
	
	static void			TouchEvent					( int iObjID );
	static void			RangeEvent					( int iObjID );

	static void			AcceptQuest					( int iQuestNpcID, int iQuestID );		
		virtual void		OnQuestAcceptResult		( int iQuestField, int iQuestID, EM_QUESTCHECK_RESULT emResult ) = 0;

	static void			CompleteQuest				( int iQuestNpcID, int iQuestID, int iChoiceID );		
		virtual void		OnQuestCompleteResult	( int iQuestField, int iQuestID, EM_QUESTCHECK_RESULT emResult ) = 0;

	
	static void			DeleteQuest					( int iQuestField, int iQuestID );
		virtual void		OnQuestDeleteResult		( int iQuestField, int iQuestID, EM_QUESTCHECK_RESULT emResult ) = 0;
	
	static void			ClickQuestObj				( int iQuestField, int iQuestID, int iClickObjID, int iClickObj );
		virtual void		OnClickQuestObjResult	( int iResult, int iItemID ) = 0;

	// Zone Server 送來的通知
	virtual void		OnQuestKillObjNotify		( int iQuestField, int iQuestID, int iDeadObjID ) = 0;

	// GM 命令
	//---------------------------------------------------------------
	virtual void		OnQuestFlag					( int iQuestID,	int iValue ) = 0;


	//map< DWORD, StructQuestInfo* >		m_mapQuestInfo;
	//map< DWORD, StructQuestNPC* >		m_mapQuestNPC;
};

