<commit_before>public static class Meditation
{
    public static void Meditate(int manaMinimum)
    {
        UO.Log($"Meditating at least to {manaMinimum}, current mana is {UO.Me.CurrentMana}");
    
        UO.WarModeOff();
        UO.Wait(100);
    
        while (UO.Me.CurrentMana < manaMinimum)
        {
            UO.UseSkill(Skill.Meditation);
            UO.Wait(2000);
        }
    }
    
    public static void Meditate()
    {
        UO.WarModeOff();

        UO.Log($"Meditating to maximum mana {UO.Me.MaxMana}, current mana is {UO.Me.CurrentMana}");
        while (UO.Me.CurrentMana < UO.Me.MaxMana)
        {
            UO.UseSkill(Skill.Meditation);
            UO.Wait(2000);
        }
    }
}<commit_msg>Adding meditation with support for abort condition.<commit_after>using System;

public static class Meditation
{
    public static TimeSpan MeditationAttemptInterval { get; } = TimeSpan.FromSeconds(2);

    public static void Meditate(int manaMinimum)
    {
        UO.Log($"Meditating at least to {manaMinimum}, current mana is {UO.Me.CurrentMana}");
    
        UO.WarModeOff();
        UO.Wait(100);
    
        while (UO.Me.CurrentMana < manaMinimum)
        {
            UO.UseSkill(Skill.Meditation);
            UO.Wait(MeditationAttemptInterval);
        }
    }
    
    public static void Meditate()
    {
        UO.WarModeOff();

        UO.Log($"Meditating to maximum mana {UO.Me.MaxMana}, current mana is {UO.Me.CurrentMana}");
        while (UO.Me.CurrentMana < UO.Me.MaxMana)
        {
            UO.UseSkill(Skill.Meditation);
            UO.Wait(MeditationAttemptInterval);
        }
    }
    
    public static void Meditate(Func<bool> abortConditionFunc)
    {
        UO.WarModeOff();
        DateTime lastMeditionAttempt = DateTime.MinValue;

        UO.Log($"Meditating to maximum mana {UO.Me.MaxMana}, current mana is {UO.Me.CurrentMana}");
        while (UO.Me.CurrentMana < UO.Me.MaxMana)
        {
            if (abortConditionFunc != null && abortConditionFunc())
            {
                UO.Log("Meditation aborted");
                return;
            }

            var now = DateTime.UtcNow;
            
            if (now - lastMeditionAttempt > MeditationAttemptInterval)
            {
                UO.UseSkill(Skill.Meditation);
                lastMeditionAttempt = now;
            }
            
            UO.Wait(100);
        }
    }
}
{'fraction_non_alphanumeric': 0.10858794384805945, 'fraction_numerical': 0.007431874483897605, 'mean_word_length': 1.820721769499418, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '234415', 'n_tokens_mistral': 808, 'n_tokens_neox': 767, 'n_words': 141}