float CAttributeContainer::ApplyAttributeFloat( float flValue, const CBaseEntity *pEntity, string_t strAttributeClass )
{
	if ( m_bParsingMyself || m_hOuter.Get() == NULL )
		return flValue;

	m_bParsingMyself = true;;

	// This should only ever be used by econ entities.
	CEconEntity *pEconEnt = assert_cast<CEconEntity *>( m_hOuter.Get() );
	CEconItemView *pItem = pEconEnt->GetItem();

	CEconItemAttribute *pAttribute = pItem->IterateAttributes( strAttributeClass );

	if ( pAttribute )
	{
		EconAttributeDefinition *pStatic = pAttribute->GetStaticData();

		switch ( pStatic->description_format )
		{
		case ATTRIB_FORMAT_ADDITIVE:
		case ATTRIB_FORMAT_ADDITIVE_PERCENTAGE:
			flValue += pAttribute->value;
			break;
		case ATTRIB_FORMAT_PERCENTAGE:
		case ATTRIB_FORMAT_INVERTED_PERCENTAGE:
			flValue *= pAttribute->value;
			break;
		case ATTRIB_FORMAT_OR:
		{
			// Oh, man...
			int iValue = (int)flValue;
			int iAttrib = (int)pAttribute->value;
			iValue |= iAttrib;
			flValue = (float)iValue;
			break;
		}
		}
	}

	m_bParsingMyself = false;

	flValue = BaseClass::ApplyAttributeFloat( flValue, pEntity, strAttributeClass );

	return flValue;
}
//-----------------------------------------------------------------------------
// Purpose: Search for an attribute and apply its value.
//-----------------------------------------------------------------------------
string_t CAttributeContainer::ApplyAttributeString( string_t strValue, const CBaseEntity *pEntity, string_t strAttributeClass )
{
	if ( m_bParsingMyself || m_hOuter.Get() == NULL )
		return strValue;

	m_bParsingMyself = true;;

	// This should only ever be used by econ entities.
	CEconEntity *pEconEnt = assert_cast<CEconEntity *>( m_hOuter.Get() );
	CEconItemView *pItem = pEconEnt->GetItem();

	CEconItemAttribute *pAttribute = pItem->IterateAttributes( strAttributeClass );

	if ( pAttribute )
	{
		strValue = AllocPooledString( pAttribute->value_string.Get() );
	}

	m_bParsingMyself = false;

	return BaseClass::ApplyAttributeString( strValue, pEntity, strAttributeClass );
}