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); }
/// <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); }