<commit_before>#load "Specs.csx"

using System;
using Infusion.Commands;

public delegate void LightSourceDelegate();

public static class LightSources
{
    public static readonly LightSourceDelegate Torch = () =>
        MakeLightByUse(Specs.Torch);
    
    public static readonly LightSourceDelegate Potion = () =>
        MakeLightByUse(Specs.NightsighPoition);
        
    public static readonly LightSourceDelegate Spell = () =>
    {
        UO.CastSpell(Infusion.Spell.NightSight);
        UO.WaitForTarget();
        UO.Target(UO.Me);
    };
    
    private static void MakeLightByUse(ItemSpec spec)
    {
        var item =
            UO.Items.InContainer(UO.Me.BackPack).Matching(spec).FirstOrDefault();
        if (item != null)
        {
            UO.Use(item);
            UO.Wait(1000);
        }
        else
            UO.Alert($"Cannot find {Specs.TranslateToName(spec) ?? "any source of light"}.");
    }
}

public static class Light
{
    private static GameJournal lightCheckJournal = UO.CreateJournal();

    public static LightSourceDelegate PreferredLightSource { get; set; } = LightSources.Torch;<commit_msg>Adding delay after casting light.<commit_after>#load "Specs.csx"

using System;
using Infusion.Commands;

public delegate void LightSource();

public static class LightSources
{
    public static readonly LightSource Torch = () =>
        MakeLightByUse(Specs.Torch);
    
    public static readonly LightSource Potion = () =>
        MakeLightByUse(Specs.NightsighPoition);
        
    public static readonly LightSource Spell = () =>
    {
        UO.CastSpell(Infusion.Spell.NightSight);
        UO.WaitForTarget();
        UO.Target(UO.Me);
        UO.Wait(2000);
    };
    
    private static void MakeLightByUse(ItemSpec spec)
    {
        var item =
            UO.Items.InContainer(UO.Me.BackPack).Matching(spec).FirstOrDefault();
        if (item != null)
        {
            UO.Use(item);
            UO.Wait(1000);
        }
        else
            UO.Alert($"Cannot find {Specs.TranslateToName(spec) ?? "any source of light"}.");
    }
}

public static class Light
{
    private static GameJournal lightCheckJournal = UO.CreateJournal();

    public static LightSource PreferredLightSource { get; set; } = LightSources.Torch;
{'fraction_non_alphanumeric': 0.105562855891371, 'fraction_numerical': 0.005256241787122208, 'mean_word_length': 2.591194968553459, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4802225', 'n_tokens_mistral': 685, 'n_tokens_neox': 675, 'n_words': 146}