
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_InventoryItem_Messages.h
// Author : Andy Tate
// Date   : 16-Nov-2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __AVP_INVENTORYITEM_MESSAGES_H__
#define __AVP_INVENTORYITEM_MESSAGES_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_Message_InventoryItem
// Author       : Andy Tate
// Date         : 16-Nov-2007
//
// Description  : Base class used when sending inventory-item messages.
////////////////////////////////////////////////////////////////////////////////

class AVP_Message_InventoryItem
{
public:
	// Public functions...
	void			SetGroupHash(const Asura_Hash_ID uHash)	{ m_uGroupHash = uHash; }
	Asura_Hash_ID	GetGroupHash(void) const				{ return(m_uGroupHash); }

	void			SetItemHash(const Asura_Hash_ID uHash)	{ m_uItemHash = uHash; }
	Asura_Hash_ID	GetItemHash(void) const					{ return(m_uItemHash); }


protected:
	// Protected variables...

	// Protected functions...


private:
	// Private variables...
	Asura_Hash_ID	m_uGroupHash;	// The hash-ID of the group our item is in.
	Asura_Hash_ID	m_uItemHash;	// The hash-ID of the item within this group.

	// Private functions...
	AVP_Message_InventoryItem(void);
	AVP_Message_InventoryItem(const AVP_Message_InventoryItem& xOther);
	~AVP_Message_InventoryItem();

	AVP_Message_InventoryItem&	operator=(const AVP_Message_InventoryItem& xOther);

};   // End of class 'AVP_Message_InventoryItem'.



////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_Message_InventoryItem_BeginUsing
// Author       : Andy Tate
// Date         : 16-Nov-2007
//
// Description  : Class to store the message-data when beginning usage of an
//				  inventory-item.
////////////////////////////////////////////////////////////////////////////////

class AVP_Message_InventoryItem_BeginUsing : public AVP_Message_InventoryItem
{
public:
	// Public functions...
	void	SetTransitionType(const u_int uType)	{ Asura_Assertf( uType < ( 1 << 8 ), ( "Not enough bits in message transition type %d", uType ) ); m_uTransitionType = uType; }
	u_int	GetTransitionType(void) const			{ return(m_uTransitionType); }

	void	SetUsageType(const u_int uType)	{ Asura_Assertf( uType < ( 1 << 8 ), ( "Not enough bits in message for usage type %d", uType ) ); m_uUsageType = uType; }
	u_int	GetUsageType(void) const		{ return(m_uUsageType); }

	void	SetQuantity(const u_int uQuantity)	{ Asura_Assertf( uQuantity < ( 1 << 16 ), ( "Not enough bits in message for quantity %d", uQuantity ) ); m_uQuantity = uQuantity; }
	u_int	GetQuantity(void) const				{ return(m_uQuantity); }


protected:
	// Protected variables...

	// Protected functions...


private:
	// Private variables...
	union
	{
		u_int		m_uFlags;					// Single access-point for the flags.

		struct
		{
			u_int	m_uTransitionType	: 8,	// The transition type to use.
					m_uUsageType		: 8,	// The type of usage to perform.
					m_uQuantity			: 16,	// The quantity held be the master.
										: 0;	// 0 spare-bits
		};
	};

	// Private functions...
	AVP_Message_InventoryItem_BeginUsing(void);
	AVP_Message_InventoryItem_BeginUsing(const AVP_Message_InventoryItem_BeginUsing& xOther);
	~AVP_Message_InventoryItem_BeginUsing();

	AVP_Message_InventoryItem_BeginUsing&	operator=(const AVP_Message_InventoryItem_BeginUsing& xOther);

};   // End of class 'AVP_Message_InventoryItem_BeginUsing'.



////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_Message_InventoryItem_BeginIdling
// Author       : Andy Tate
// Date         : 16-Nov-2007
//
// Description  : Class to store the message-data when ending usage of an
//				  inventory-item.
////////////////////////////////////////////////////////////////////////////////

class AVP_Message_InventoryItem_BeginIdling : public AVP_Message_InventoryItem
{
public:
	// Public functions...
	void	SetTransitionType(const u_int uType)	{ Asura_Assertf( uType < ( 1 << 8 ), ( "Not enough bits in message transition type %d", uType ) ); m_uTransitionType = uType; }
	u_int	GetTransitionType(void) const			{ return(m_uTransitionType); }

	void	SetUsageType(const u_int uType)	{ Asura_Assertf( uType < ( 1 << 8 ), ( "Not enough bits in message for usage type %d", uType ) ); m_uUsageType = uType; }
	u_int	GetUsageType(void) const		{ return(m_uUsageType); }

	void	SetQuantity(const u_int uQuantity)	{ Asura_Assertf( uQuantity < ( 1 << 16 ), ( "Not enough bits in message for quantity %d", uQuantity ) ); m_uQuantity = uQuantity; }
	u_int	GetQuantity(void) const				{ return(m_uQuantity); }

protected:
	// Protected variables...

	// Protected functions...


private:
	// Private variables...
	union
	{
		u_int		m_uFlags;					// Single access-point for the flags.

		struct
		{
			u_int	m_uTransitionType	: 8,	// The transition type to use.
					m_uUsageType		: 8,	// The type of usage to perform.
					m_uQuantity			: 16,	// The quantity held be the master.
										: 0;	// 0 spare-bits
		};
	};

	// Private functions...
	AVP_Message_InventoryItem_BeginIdling(void);
	AVP_Message_InventoryItem_BeginIdling(const AVP_Message_InventoryItem_BeginIdling& xOther);
	~AVP_Message_InventoryItem_BeginIdling();

	AVP_Message_InventoryItem_BeginIdling&	operator=(const AVP_Message_InventoryItem_BeginIdling& xOther);

};   // End of class 'AVP_Message_InventoryItem_BeginIdling'.



////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_Message_InventoryItem_RequestEndUsage
// Author       : Andy Tate
// Date         : 16-Nov-2007
//
// Description  : Class to request the ending usage of an inventory-item.
////////////////////////////////////////////////////////////////////////////////

class AVP_Message_InventoryItem_RequestEndUsage : public AVP_Message_InventoryItem
{
public:
	// Public functions...
	void	SetTransitionType(const u_int uType)	{ m_uTransitionType = uType; }
	u_int	GetTransitionType(void) const			{ return(m_uTransitionType); }


protected:
	// Protected variables...

	// Protected functions...


private:
	// Private variables...
	union
	{
		u_int		m_uFlags;					// Single access-point for the flags.

		struct
		{
			u_int	m_uTransitionType	: 8,	// The transition type to use.
										: 0;	// 24 spare-bits
		};
	};

	// Private functions...
	AVP_Message_InventoryItem_RequestEndUsage(void);
	AVP_Message_InventoryItem_RequestEndUsage(const AVP_Message_InventoryItem_RequestEndUsage& xOther);
	~AVP_Message_InventoryItem_RequestEndUsage();

	AVP_Message_InventoryItem_RequestEndUsage&	operator=(const AVP_Message_InventoryItem_RequestEndUsage& xOther);

};   // End of class 'AVP_Message_InventoryItem_RequestEndUsage'.


#endif   // ifndef __AVP_INVENTORYITEM_MESSAGES_H__


/// End of file. ///
