public static void HandleEnumCharactersResult(CharacterSession session) { var gameAccount = session.GameAccount; var charList = DB.Character.Where<Character>(c => c.GameAccountId == gameAccount.Id); var enumCharactersResult = new Packet(ServerMessage.EnumCharactersResult); enumCharactersResult.PutBit(1); enumCharactersResult.PutBit(0); enumCharactersResult.Flush(); enumCharactersResult.Write(charList.Count); enumCharactersResult.Write(0); foreach (var c in charList) { var guid = new SmartGuid { Type = GuidType.Player, MapId = (ushort)c.Map, CreationBits = c.Guid }; var guildGuid = new SmartGuid { Type = GuidType.Guild, CreationBits = c.GuildGuid }; enumCharactersResult.Write(guid); enumCharactersResult.Write(c.ListPosition); enumCharactersResult.Write(c.Race); enumCharactersResult.Write(c.Class); enumCharactersResult.Write(c.Sex); enumCharactersResult.Write(c.Skin); enumCharactersResult.Write(c.Face); enumCharactersResult.Write(c.HairStyle); enumCharactersResult.Write(c.HairColor); enumCharactersResult.Write(c.FacialHairStyle); enumCharactersResult.Write(c.Level); enumCharactersResult.Write(c.Zone); enumCharactersResult.Write(c.Map); enumCharactersResult.Write(c.X); enumCharactersResult.Write(c.Y); enumCharactersResult.Write(c.Z); enumCharactersResult.Write(guildGuid); enumCharactersResult.Write(c.CharacterFlags); enumCharactersResult.Write(c.CustomizeFlags); enumCharactersResult.Write(c.Flags3); enumCharactersResult.Write(c.PetCreatureDisplayId); enumCharactersResult.Write(c.PetLevel); enumCharactersResult.Write(c.PetCreatureFamily); enumCharactersResult.Write(0); enumCharactersResult.Write(0); for (var i = 0; i < 23; i++) { enumCharactersResult.Write(0); enumCharactersResult.Write(0); enumCharactersResult.Write<byte>(0); } enumCharactersResult.PutBits(c.Name.Length, 6); enumCharactersResult.PutBit(1); enumCharactersResult.PutBit(0); enumCharactersResult.Write(c.Name); } session.Send(enumCharactersResult); }
public static void HandleDeleteChar(CharacterSession session, SmartGuid guid) { var gameAccount = session.GameAccount; var deleteChar = new Packet(ServerMessage.DeleteChar); if (DB.Character.Delete<Character>(c => c.Guid == guid.Low && c.GameAccountId == gameAccount.Id)) deleteChar.Write(CharDeleteCode.Success); else deleteChar.Write(CharDeleteCode.Failed); session.Send(deleteChar); }