public void AddSpell(Spell spell) { if (Collection.ContainsKey(spell.SpellID)) { return; } Collection.Add(spell.SpellID, spell); CharacterSpells.Add(new character_spell() { guid = Owner.ObjectGUID.Low, spell = (long)spell.SpellID }); CharacterDatabase.SaveChanges(); Owner.Session.SendPacket(new PSLearnSpell((uint)spell.SpellID)); }
private List <Spell> GetCharacterCreationSpells() { List <Spell> result = new List <Spell>(); List <playercreateinfo_spell> newCharacterSpells = PlayerCreateSpells.Where(s => s.race == Owner.Character.race && s.@class == Owner.Character.@class).ToList(); newCharacterSpells.ForEach(s => { Spell spell = this.CreateSpell(s.Spell); CharacterSpells.Add(new character_spell() { guid = Owner.ObjectGUID.Low, spell = (long)spell.SpellID }); result.Add(spell); }); CharacterDatabase.SaveChanges(); return(result); }