private static void LoadToonsForAccountID(Account a) { if (_characters == null) { _characters = new AccountDBDataSetTableAdapters.charactersTableAdapter(); } var data = _characters.GetToonsByOwnerID(a.Serial); foreach (var row in data) a.Toons.Add(ServerToon.LoadDataBlob(row)); }
internal static Toon CreateToon(Account p, ProtoShared.Packets.FromClient.CreateCharacter createCharacter) { if (_characters == null) _characters = new AccountDBDataSetTableAdapters.charactersTableAdapter(); Toon toon = new Toon(); toon.SceneSerial = 1; toon.Name = createCharacter.Name; toon.Location = new Vector3D(905, 13, 593); toon.Attributes.Add(new Attrib() { ID = AttribType.Health, Value = 50 }); toon.Attributes.Add(new Attrib() { ID = AttribType.MaxHealth, Value = 50 }); _characters.Insert(p.Serial, toon.Name, toon.GetData()); LoadToonsForAccountID(p); return p.Toons.Where(t => t.Name.Equals(createCharacter.Name)).First(); }
internal static void SaveToon(Toon toon) { if (_characters == null) _characters = new AccountDBDataSetTableAdapters.charactersTableAdapter(); Logger.Log("Saved Toon " + toon.Name); _characters.UpdateToon(toon.Name, toon.GetData(), toon.Serial); }