public bool ConsumeRes( Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount, ConsumeType consumeType, ref object message, bool isFailure )
        {
            Container c = from.Backpack;

            CraftContext context = craftSystem.GetContext( from );

            m_System = craftSystem;

            if ( c == null || !(c is BaseContainer) )
                return false;

            BaseContainer ourPack = (BaseContainer)c;

            if ( m_NeedHeat && !Find( from, m_HeatSources ) )
            {
                message = 1044487; // You must be near a fire source to cook.
                return false;
            }

            if ( m_NeedOven && !Find( from, m_Ovens ) )
            {
                message = 1044493; // You must be near an oven to bake that.
                return false;
            }

            if ( m_NeedMill && !Find( from, m_Mills ) )
            {
                message = 1044491; // You must be near a flour mill to do that.
                return false;
            }

            Type[][] types = new Type[m_arCraftRes.Count][];
            int[] amounts = new int[m_arCraftRes.Count];

            maxAmount = int.MaxValue;

            CraftSubResCol resCol = ( m_UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes );

            for ( int i = 0; i < types.Length; ++i )
            {
                CraftRes craftRes = m_arCraftRes.GetAt( i );
                Type baseType = craftRes.ItemType;

                // Resource Mutation
                if ( (baseType == resCol.ResType) && ( typeRes != null ) )
                {
                    baseType = typeRes;

                    CraftSubRes subResource = resCol.SearchFor( baseType );

                    if ( subResource != null && from.Skills[craftSystem.MainSkill].Base < subResource.RequiredSkill )
                    {
                        message = subResource.Message;
                        return false;
                    }
                }
                // ******************

                for ( int j = 0; types[i] == null && j < m_TypesTable.Length; ++j )
                {
                    if ( m_TypesTable[j][0] == baseType )
                        types[i] = m_TypesTable[j];
                }

                if ( types[i] == null )
                    types[i] = new Type[]{ baseType };

                amounts[i] = craftRes.Amount;

                // For stackable items that can be crafted more than one at a time
                if ( UseAllRes )
                {
                    if ( !context.CheckedHues )
                        if ( RetainsColorFrom( m_System, types[i][0] ) )
                            CheckMulitpleHues( from, types[i] );

                    int tempAmount = ourPack.GetAmountCompared( types[i], new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo );

                    tempAmount /= amounts[i];
                    if ( tempAmount < maxAmount )
                    {
                        maxAmount = tempAmount;

                        if ( maxAmount == 0 )
                        {
                            CraftRes res = m_arCraftRes.GetAt( i );

                            if ( res.MessageNumber > 0 )
                                message = res.MessageNumber;
                            else if ( !String.IsNullOrEmpty( res.MessageString ) )
                                message = res.MessageString;
                            else
                                message = 502925; // You don't have the resources required to make that item.

                            return false;
                        }
                    }
                }
                // ****************************

                if ( isFailure && !craftSystem.ConsumeOnFailure( from, types[i][0], this ) )
                    amounts[i] = 0;
            }

            // We adjust the amount of each resource to consume the max posible
            if ( UseAllRes )
            {
                for ( int i = 0; i < amounts.Length; ++i )
                    amounts[i] *= maxAmount;
            }
            else
                maxAmount = -1;

            Item consumeExtra = null;

            if ( m_NameNumber == 1041267 )
            {
                // Runebooks are a special case, they need a blank recall rune

                List<RecallRune> runes = ourPack.FindItemsByType<RecallRune>();

                for ( int i = 0; i < runes.Count; ++i )
                {
                    RecallRune rune = runes[i];

                    if ( rune != null && !rune.Marked )
                    {
                        consumeExtra = rune;
                        break;
                    }
                }

                if ( consumeExtra == null )
                {
                    message = 1044253; // You don't have the components needed to make that.
                    return false;
                }
            }

            int index = 0;

            // Consume ALL
            if ( consumeType == ConsumeType.All )
            {
                m_ResHue = 0; m_ResAmount = 0;
                m_System = craftSystem;

                if ( IsQuantityType( types ) )
                    index = ConsumeQuantity( ourPack, types, amounts );
                else
                    index = ourPack.ConsumeTotalGroupedCompared( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo );

                resHue = m_ResHue;
            }

            // Consume Half ( for use all resource craft type )
            else if ( consumeType == ConsumeType.Half )
            {
                for ( int i = 0; i < amounts.Length; i++ )
                {
                    amounts[i] /= 2;

                    if ( amounts[i] < 1 )
                        amounts[i] = 1;
                }

                m_ResHue = 0; m_ResAmount = 0;
                m_System = craftSystem;

                if ( IsQuantityType( types ) )
                    index = ConsumeQuantity( ourPack, types, amounts );
                else
                    index = ourPack.ConsumeTotalGroupedCompared( types, amounts, true, new OnItemConsumed( OnResourceConsumed ), new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo );

                resHue = m_ResHue;
            }

            else // ConstumeType.None ( it's basicaly used to know if the crafter has enough resource before starting the process )
            {
                index = -1;

                if ( IsQuantityType( types ) )
                {
                    for ( int i = 0; i < types.Length; i++ )
                    {
                        if ( GetQuantity( ourPack, types[i] ) < amounts[i] )
                        {
                            index = i;
                            break;
                        }
                    }
                }
                else
                {
                    for ( int i = 0; i < types.Length; i++ )
                    {
                        if ( !context.CheckedHues )
                            if ( RetainsColorFrom( m_System, types[i][0] ) )
                                CheckMulitpleHues( from, types[i] );

                        if ( craftSystem.UsesHueSelector( this, types[i][0] )  )
                        {
                            if ( context.CompareHueTo == null && context.Hues.Count > 1 )
                            {
                                m_BeginHueSelector = true;
                                m_TypeToCompare = types[i][0];
                                return false;
                            }
                        }

                        if ( ourPack.GetComparedGroupAmount( types[i], true, new CheckItemGroup( CheckHueGrouping ), context.CompareHueTo ) < amounts[i] )
                        {
                            index = i;
                            break;
                        }
                    }
                }
            }

            if ( index == -1 )
            {
                if ( consumeType != ConsumeType.None )
                    if ( consumeExtra != null )
                        consumeExtra.Delete();

                return true;
            }
            else
            {
                CraftRes res = m_arCraftRes.GetAt( index );

                if ( res.MessageNumber > 0 )
                    message = res.MessageNumber;
                else if ( res.MessageString != null && res.MessageString != String.Empty )
                    message = res.MessageString;
                else
                    message = 502925; // You don't have the resources required to make that item.

                return false;
            }
        }