/// <summary>
        /// This will get a CreatureSkill wrapper around the BiotaPropertiesSkill record for this player.
        /// If the skill doesn't exist for this Biota, one will be created with a status of Untrained.
        /// </summary>
        public CreatureSkill GetCreatureSkill(Skill skill)
        {
            if (Skills.TryGetValue(skill, out var value))
            {
                return(value);
            }

            var biotaPropertiesSkill = Biota.GetOrAddSkill((ushort)skill, BiotaDatabaseLock, out var skillAdded);

            if (skillAdded)
            {
                biotaPropertiesSkill.SAC = (uint)SkillAdvancementClass.Untrained;
                ChangesDetected          = true;
            }

            Skills[skill] = new CreatureSkill(this, biotaPropertiesSkill);

            return(Skills[skill]);
        }
Beispiel #2
0
        /// <summary>
        /// This will get a CreatureSkill wrapper around the BiotaPropertiesSkill record for this player.
        /// If the skill doesn't exist for this Biota, one will be created with a status of Untrained.
        /// </summary>
        /// <param name="add">If the skill doesn't exist for this biota, adds it</param>
        public CreatureSkill GetCreatureSkill(Skill skill, bool add = true)
        {
            if (Skills.TryGetValue(skill, out var value))
            {
                return(value);
            }

            PropertiesSkill propertiesSkill;

            if (add)
            {
                propertiesSkill = Biota.GetOrAddSkill(skill, BiotaDatabaseLock, out var skillAdded);

                if (skillAdded)
                {
                    propertiesSkill.SAC = SkillAdvancementClass.Untrained;
                    ChangesDetected     = true;
                }

                Skills[skill] = new CreatureSkill(this, skill, propertiesSkill);
            }
            else
            {
                propertiesSkill = Biota.GetSkill(skill, BiotaDatabaseLock);

                if (propertiesSkill != null)
                {
                    Skills[skill] = new CreatureSkill(this, skill, propertiesSkill);
                }
                else
                {
                    return(null);
                }
            }

            return(Skills[skill]);
        }