//////////////////////////////////////////////////////////////////////////////
//
// File: AVP_ClientEntity_PlayerObjective.h
//
//(AJK - 13.10.2008) Created
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////


#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __AVP_ClientEntity_PlayerObjective__
#define __AVP_ClientEntity_PlayerObjective__

// ASURA
#include "Entity/Asura_Entity.h"
#include "GUIMenu/Asura_GUIMenu_Element_Text.h"

// AVP
#include "Entity/ObjectiveSystem/PlayerObjective/AVP_ServerEntity_PlayerObjective.h"

class AVP_ClientEntity_PlayerObjective : public Asura_Entity_Client
{
public:

	static void Create( const Asura_Message* pxMsg );

	static AVP_ClientEntity_PlayerObjective* FindEntity( Asura_Guid uGUID )				       { return s_xList.FindEntity( uGUID ); }

	static const Asura_Hashed_List<AVP_ClientEntity_PlayerObjective>* GetList( void )	       { return &s_xList;                    }

	virtual bool HandleMessage( const Asura_Message* pxMsg );

	// Objectives Getters/Setters
	bool	IsCompleted()   const { return IsFlagged(AVP_ServerEntity_PlayerObjective::FLAG_COMPLETED); }
	void	SetAsCompleted  (bool bTrue) { bTrue ? AddFlag( AVP_ServerEntity_PlayerObjective::FLAG_COMPLETED ) : RemoveFlag(AVP_ServerEntity_PlayerObjective::FLAG_COMPLETED); }
 
	void    SetFlags(u_int uFlags) { m_uFlags = uFlags;}

	Asura_GUIMenu_Element_Text& GetObjectiveText() { return m_xObjectiveText;}

protected:

	AVP_ClientEntity_PlayerObjective();
	virtual ~AVP_ClientEntity_PlayerObjective();

private:
	// Flag functions
	void                    AddFlag    (u_int uFlag) { m_uFlags |= uFlag;               }
	void                    RemoveFlag (u_int uFlag) { m_uFlags &= ~uFlag;              }
	bool                    IsFlagged  (u_int uFlag) const { return ((m_uFlags & uFlag) != 0); }

	Asura_GUIMenu_Element_Text  m_xObjectiveText;
	u_int                       m_uFlags;

	static Asura_Hashed_List<AVP_ClientEntity_PlayerObjective> s_xList;
   
	typedef Asura_Entity_Client PARENT;
};
#endif // #ifndef __AVP_ClientEntity_PlayerObjective__
