Ejemplo n.º 1
0
        /// <summary>
        /// Gets or creates a skill if non-existing.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>The skill.</returns>
        public Skill GetOrCreateSkill(ushort id)
        {
            Skill skill;

            if (!_skills.TryGetValue(id, out skill))
            {
                var dbSpell = new Database.Models.DbSpell
                {
                    SpellId = id
                };
                skill = new Skill(_player, dbSpell);

                if (dbSpell.Create())
                {
                    _skills.TryAdd(id, skill);
                }
            }

            return(skill);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets or creates a proficiency if non-existing.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>The proficiency.</returns>
        public Proficiency GetOrCreateProficiency(ushort id)
        {
            Proficiency proficiency;

            if (!_proficiencies.TryGetValue(id, out proficiency))
            {
                var dbSpell = new Database.Models.DbSpell
                {
                    SpellId = id
                };
                proficiency = new Proficiency(_player, dbSpell);

                if (dbSpell.Create())
                {
                    _proficiencies.TryAdd(id, proficiency);
                }
            }

            return(proficiency);
        }