Пример #1
0
        public bool LearnSkill(string skillName)
        {
            if (!HasLearned(skillName))
            {
                PlayerSkillInfos.Add(skillName, new PlayerSkillInfo());
                UpdateTriggerWords(skillName);
                return(true);
            }

            return(false);
        }
Пример #2
0
        public bool IsSkillReady(string skillName)
        {
            var definition = CustomSkillsPlugin.Instance.CustomSkillDefinitionLoader.TryGetDefinition(skillName);

            if (definition != null)
            {
                if (PlayerSkillInfos.TryGetValue(skillName, out var skillInfo))
                {
                    var levelDef = definition.Levels[skillInfo.CurrentLevel];

                    return((DateTime.Now - skillInfo.CooldownStartTime) > levelDef.CastingCooldown);
                }
            }

            return(false);
        }
Пример #3
0
        /// <summary>
        /// Attempts to get both the requested skill definition, and its current level definition for the current session.
        /// </summary>
        /// <param name="skillName"></param>
        /// <param name="skillDefinition"></param>
        /// <param name="levelDefinition"></param>
        /// <returns>True if both skill and level could be retrieved</returns>
        internal bool TryGetSkillAndLevel(string skillName, out CustomSkillDefinition skillDefinition, out CustomSkillLevelDefinition levelDefinition)
        {
            skillDefinition = CustomSkillsPlugin.Instance.CustomSkillDefinitionLoader.TryGetDefinition(skillName);
            levelDefinition = null;

            if (skillDefinition != null)
            {
                if (PlayerSkillInfos.TryGetValue(skillName, out var skillInfo))
                {
                    levelDefinition = skillDefinition.Levels[skillInfo.CurrentLevel];
                    return(true);
                }
            }

            return(false);
        }
Пример #4
0
 public bool HasLearned(string skillName) => PlayerSkillInfos.ContainsKey(skillName);