public static string GenerateTicketKey(SilverSocket socket, Account account) { var ticketKey = string.Format("{0}|{1}|{2}", (DateTime.Now).ToUniversalTime().ToString(CultureInfo.InvariantCulture), socket.IP, account); return ticketKey; }
private void CheckAccount(string packet) { var username = packet.Split('#')[0]; var password = packet.Split('#')[1]; Account = Database.AccountRepository.GetAccount(Constant.UsernameColumnName, username); if (Account == null || Hash.Encrypt(Account.Password, _key) != password) { SendPackets(Packet.WrongDofusAccount); RemoveMeOnList(); } else if (RealmServer.Clients.Count(x => x.Account.Username.Equals(username, StringComparison.OrdinalIgnoreCase)) > 1 || Account.Connected) { SendPackets(Packet.AlredyConnected); RealmServer.Disconnect(Account.Id); ToGameClient.SendPacket(string.Format("{0}{1}", Packet.DisconnectMe, Account.Id)); RemoveMeOnList(); } else if (Account.BannedUntil != null && Account.BannedUntil > DateTime.Now) { SendPackets(Packet.BannedAccount); RemoveMeOnList(); } else { SendPackets(string.Format("{0}{1}", Packet.DofusPseudo, Account.Pseudo)); SendPackets(string.Format("{0}{1}", Packet.Community, 0)); // 0 : communauté fr RefreshServerList(); SendPackets(string.Format("{0}{1}", Packet.IsAdmin, Account.GmLevel > 0 ? 1 : 0)); SendPackets(string.Format("{0}{1}", Packet.SecretQuestion, Account.Question.Replace(" ", "+"))); _stateConnxion = StateConnecion.CheckingServer; } }