public static bool ReadKey(ILogger logger, KeyAction key)
        {
            if (string.IsNullOrEmpty(key.Key))
            {
                logger.LogError($"You must specify either 'Key' (ConsoleKey value) or 'KeyName' (ConsoleKey enum name) for { key.Name}");
                return(false);
            }

            if (KeyMapping.ContainsKey(key.Key))
            {
                key.ConsoleKey = KeyMapping[key.Key];
            }
            else
            {
                var values = Enum.GetValues(typeof(ConsoleKey)) as IEnumerable <ConsoleKey>;
                if (values == null)
                {
                    return(false);
                }
                var consoleKey = values.FirstOrDefault(k => k.ToString() == key.Key);

                if (consoleKey == 0)
                {
                    logger.LogError($"You must specify a valid 'KeyName' (ConsoleKey enum name) for { key.Name}");
                    return(false);
                }

                key.ConsoleKey = consoleKey;
            }

            return(true);
        }
        public void InitialiseRequirements(KeyAction item)
        {
            item.RequirementObjects.Clear();
            foreach (string requirement in item.Requirements)
            {
                item.RequirementObjects.Add(GetRequirement(item.Name, requirement));
            }

            CreateMinRequirement(item.RequirementObjects, "Mana", item.MinMana);
            CreateMinRequirement(item.RequirementObjects, "Rage", item.MinRage);
            CreateMinRequirement(item.RequirementObjects, "Energy", item.MinEnergy);
            CreateMinComboPointsRequirement(item.RequirementObjects, item);
            item.CreateCooldownRequirement();
        }
 private void CreateMinComboPointsRequirement(List <Requirement> RequirementObjects, KeyAction item)
 {
     if (item.MinComboPoints > 0)
     {
         RequirementObjects.Add(new Requirement
         {
             HasRequirement = () => playerReader.ComboPoints >= item.MinComboPoints,
             LogMessage     = () => $"Combo point {playerReader.ComboPoints} >= {item.MinComboPoints}"
         });
     }
 }