///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_InventoryTool_Tequila.h
// Author : Will Plano
// Date   : 03/03/2009
//
// Copyright (C) 2009 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#include "Core/Asura.h"

// This file's header...
#include "Inventory/Items/Weapons/Tools/AVP_InventoryTool_Tequila.h"

#include "Animation/Asura_Animation.h"

#include "Animation/AVP_AnimFlags.h"
#include "Inventory/Items/Weapons/Tools/AVP_InventoryTequila_ClientEffectsHandler.h"

AVP_InventoryTool_Tequila::AVP_InventoryTool_Tequila(AVP_Inventory_Group& xParentGroup,
													 const Asura_Hash_ID uHash,
													 const Asura_Hash_ID uBlueprintHash)
: PARENT( xParentGroup, uHash, uBlueprintHash )
{
	m_eItemType = AVP_INVENTORYITEMTYPE_TEQUILA;
}

AVP_RangedWeapon_ClientEffectsHandler* AVP_InventoryTool_Tequila::CreateClientEffectsHandler( Asura_Hash_ID uBlueprintHash, Asura_Hash_ID uOwnerGuid )
{
	return new AVP_InventoryTequila_ClientEffectsHandler( uBlueprintHash, uOwnerGuid );
}

void AVP_InventoryTool_Tequila::UpdateClientState( AVP_ClientEntity_Actor& xClient )
{
	if ( m_pxClientEffectsHandler && m_pxClientEffectsHandler->GetAnimation() )
	{
		u_int uFlags = m_pxClientEffectsHandler->GetAnimation()->GetFlagsForAllAnimsLastFrame();
		static_cast< AVP_InventoryTequila_ClientEffectsHandler* >( m_pxClientEffectsHandler )->GetLeftArmChain().SetAnimVeto( ( uFlags & AVP_ANIMFLAG_NOT_IK_HANDS_AND_TAIL ) != 0 );
	}

	PARENT::UpdateClientState( xClient );
}
