class RarityOfEquippedConsumableItemPrereqState extends PrereqState
{
}

class RarityOfEquippedConsumableItemPrereq extends IScriptablePrereq
{
	var m_consumableItemTag : CName;
	var m_qualityLessThan : gamedataQuality;

	protected override function Initialize( recordID : TweakDBID )
	{
		m_consumableItemTag = TweakDBInterface.GetCName( recordID + T".consumableItemTag", 'Inhaler' );
		m_qualityLessThan = ( ( gamedataQuality )( ( ( Int32 )( EnumValueFromName( 'gamedataQuality', TweakDBInterface.GetCName( recordID + T".qualityLessThan", 'Common' ) ) ) ) ) );
	}

	public const override function IsFulfilled( game : GameInstance, context : IScriptable ) : Bool
	{
		var result : Bool;
		var playerItems : array< weak< gameItemData > >;
		var qualityRecord : gamedataQuality;
		var healingItem : TweakDBID;
		GameInstance.GetTransactionSystem( game ).GetItemListByTag( GetPlayer( game ), m_consumableItemTag, playerItems );
		healingItem = ItemID.GetTDBID( playerItems[ 0 ].GetID() );
		qualityRecord = TweakDBInterface.GetItemRecord( healingItem ).Quality().Type();
		result = RPGManager.ConvertQualityToCombinedValue( m_qualityLessThan ) > RPGManager.ConvertQualityToCombinedValue( qualityRecord );
		return result;
	}

}

