private void SelectedServerDataMessageMessageHandler(DofusClient Client, SelectedServerDataMessage Message) { Client.Logger.Log("Sélection du serveur " + (ServerNameEnum)Message.ServerId); Client.Account.Ticket = AES.DecodeWithAES(Message.Ticket); Client.Logger.Log("Connexion en cours <" + Message.Address + ":" + Message.Port + ">"); Client.ChangeRemote(Message.Address, Message.Port); }
public void Update(SelectedServerDataMessage message) { Id = message.ServerId; Name = DataManager.Get <Servers>(Id).NameId; ServerSelected?.Invoke(); }
private void SelectedServerDataMessageMessageHandler(DofusClient client, SelectedServerDataMessage message) { client.Logger.Log("Sélection du serveur " + D2OParsing.GetServerName(message.ServerId)); client.Account.Ticket = AES.DecodeWithAES(message.Ticket); client.Logger.Log("Connexion en cours <" + message.Address + ":" + message.Port + ">"); client.ChangeRemote(message.Address, message.Port); }
public static Task HandleSelectedServerDataMessage(Account account, SelectedServerDataMessage message) => Task.Run(async() => { account.Game.Server.Update(message); account.FramesData.Ticket = message.Ticket; await account.Network.SwitchToGameServer(message.Address, message.Port, message.ServerId, message.Access); });
public static void HandleSelectedServerDataMessage(FakeClient client, SelectedServerDataMessage message) { client.Disconnect(true); client.Ticket = new string(message.ticket.Select(x => (char)x).ToArray()); client.WorldIp = message.address; client.WorldPort = message.port; //client.Connect(message.address, message.port); }
private void HandleSelectedServerDataMessage(IAccount account, SelectedServerDataMessage message) { var ticket = AES.DecodeWithAES(message.Ticket); var tuple = _mTickets[ticket]; tuple.Item1.Network.ExpectedDisconnection = true; tuple.Item1.Ticket = ticket; }
private bool HandleSelectedServerDataMessage(SelectedServerDataMessage message, ConnectedHost source) { mGameAdress = message.address; message.address = RemoteSetting.Default.GameListenAdress; message.port = (ushort)RemoteSetting.Default.GameListenPort; mHost.SendMessage(message, DestinationEnum.CLIENT); mHost.PreMigrate(); return(false); }
private void HandleSelectedServerDataMessage(Bot bot, SelectedServerDataMessage message) { m_tickets.Add(message.ticket, Tuple.Create((BotMITM)bot, new SelectedServerDataMessage(message.serverId, message.address, message.port, message.canCreateNewCharacter, message.ticket))); message.address = m_configuration.FakeWorldHost; message.port = (ushort)m_configuration.FakeWorldPort; ((BotMITM)bot).ExpectedDisconnection = true; logger.Debug("Client redirected to {0}:{1}", message.address, message.port); }
public void Update(SelectedServerDataMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } SelectedServer = ObjectDataManager.Instance.Get <Server>(msg.serverId); ConnectionTicket = msg.ticket; ServerAddress = msg.address; ServerPort = msg.port; CanCreateNewCharacter = msg.canCreateNewCharacter; }
public void TreatPacket(int packetID, byte[] packetContent) { BigEndianReader reader = new BigEndianReader(); switch (packetID) { case 42: SelectedServerDataMessage Ssdm = new SelectedServerDataMessage(); Ssdm.Deserialize(reader); ClientForm.WriteLog(Ssdm.ServerId + " " + Ssdm.Address + " " + Ssdm.Port + " " + Ssdm.CanCreateNewCharacter); break; } }
public TicketEntry(string _accountName, uint _instance, SelectedServerDataMessage _serverMsg) { AccountName = _accountName; Instance = _instance; ServerMsg = _serverMsg; }
private void ServerDataReceived(object sender, SimpleClient.DataReceivedEventArgs e) { try { var messageDataReader = new BigEndianReader(e.Data.Data); NetworkMessage message = MessageReceiver.BuildMessage((uint)e.Data.MessageId.Value, messageDataReader); SaveMsg(message, ConnectionDestination.Server); if (ServerMessageReceived != null) { OnServerMessageReceived(new MessageReceivedEventArgs(message)); } if (message == null) { Send(e.Data, ConnectionDestination.Client); return; } // here if (message.MessageId == 6469 || message.MessageId == 42) { SelectedServerDataMessage msg = (SelectedServerDataMessage)message; TicketsManager.RegisterTicket(Client.AccountName, Client.Network.Instance, msg); ((ClientNetwork)Client.Network).Ticket = true; Client.Network.Send(new SelectedServerDataMessage(msg.serverId, "127.0.0.1", new uint[] { 443 }, msg.canCreateNewCharacter, msg.ticket), ConnectionDestination.Client); message.Cancel = true; Client.UnloadClient(); } if (message.MessageId == 22) { IdentificationSuccessMessage msg = (IdentificationSuccessMessage)message; Client.AccountName = msg.login; } if (message.MessageId == 153) { CharacterSelectedSuccessMessage msg = (CharacterSelectedSuccessMessage)message; Client.Dock.Invoke((MethodInvoker) delegate { Client.Dock.Text = msg.infos.name + " (" + Client.AccountName + ")"; }); } if (!message.Cancel) { Send(e.Data, ConnectionDestination.Client); messageDataReader.Dispose(); message = null; } } catch (Exception ex) { if (Client != null && WindowManager.MainWindow.Logger != null) { WindowManager.MainWindow.Logger.Error("[Network] ServerDataReceived Function -> " + ex.Message); } } }
private void HandleSelectedServerDataMessage(IAccount account, SelectedServerDataMessage message) { // }
public static void RegisterTicket(string accountName, uint instance, SelectedServerDataMessage serverMsg) { lock (CheckLock) { Tickets.Add(new TicketEntry(accountName, instance, serverMsg)); } }
private void ServerSelected(SelectedServerDataMessage message) { client.Account.Ticket = message.ticket; client.Network.Reconnect(message.address, message.port); new GameAuthentification(client); }
public static void HandleSelectedServerDataMessage(Bot bot, SelectedServerDataMessage message) { bot.ClientInformations.Update(message); }
public static void HandleSelectedServerDataMessage(FakeClient client, SelectedServerDataMessage message) { client.Disconnect(true); //client.Ticket = message.ticket; client.Connect(message.address, message.port); }
public void HandleSelectedServerDataMessage(Bot bot, SelectedServerDataMessage message) { Bot.RemoveFrame(this); }
private void OnServerDataReceived(object sender, SimpleClient.DataReceivedEventArgs e) { BigEndianReader bigEndianReader = new BigEndianReader(e.Data.Data); NetworkMessage msg = MessageReceiver.BuildMessage((uint)e.Data.MessageId.Value, (IDataReader)bigEndianReader); if (msg == null) { this.Send(e.Data, NetworkDestinationEnum.Client); } else { switch (msg.MessageId) { case 1: if (!this.Game) { this.Send(e.Data, NetworkDestinationEnum.Client); this.Window = new UserForm(this); this.Window.Text = "Nouveau client"; WindowManager.AddChildrenForm((Form)this.Window); break; } break; case 22: this.Window.Text = ((IdentificationSuccessMessage)msg).Login; this.Send(e.Data, NetworkDestinationEnum.Client); break; case 42: SelectedServerDataMessage serverDataMessage = (SelectedServerDataMessage)msg; TicketsManager.RegisterTicket(serverDataMessage.Address, (ushort)serverDataMessage.Ports[0], this.Instance, this.Window); this.Send((NetworkMessage) new SelectedServerDataMessage(serverDataMessage.ServerId, "127.0.0.1", Configuration.GamePort, serverDataMessage.CanCreateNewCharacter, serverDataMessage.Ticket), NetworkDestinationEnum.Client); this.Register = true; break; case 101: this.Send((NetworkMessage) new AuthenticationTicketMessage(this.Lang, this.Ticket), NetworkDestinationEnum.Server); break; case 153: CharacterSelectedSuccessMessage selectedSuccessMessage = (CharacterSelectedSuccessMessage)msg; UserForm window = this.Window; window.Text = window.Text + " (" + selectedSuccessMessage.Infos.Name + ")"; this.Send(e.Data, NetworkDestinationEnum.Client); break; case 6253: this.RDM = ((RawDataMessage)msg).Content; this.Window.Button_SaveRDM.Enabled = true; this.Send(e.Data, NetworkDestinationEnum.Client); break; case 6469: SelectedServerDataExtendedMessage dataExtendedMessage = (SelectedServerDataExtendedMessage)msg; TicketsManager.RegisterTicket(dataExtendedMessage.Address, (ushort)dataExtendedMessage.Ports[0], this.Instance, this.Window); this.Send((NetworkMessage) new SelectedServerDataExtendedMessage(dataExtendedMessage.ServerId, "127.0.0.1", Configuration.GamePort, dataExtendedMessage.CanCreateNewCharacter, dataExtendedMessage.Ticket, dataExtendedMessage.Servers), NetworkDestinationEnum.Client); this.Register = true; break; default: this.Send(e.Data, NetworkDestinationEnum.Client); break; } this.OnMessageReceived(new SyncClient.MessageReceivedEventArgs(msg, e.Data)); } }
public void OnReceivedPacket(object source, PacketEventArg e) { ServerPacketEnum PacketType = (ServerPacketEnum)e.Packet.MessageID; switch (PacketType) { case ServerPacketEnum.ProtocolRequired: break; case ServerPacketEnum.CredentialsAcknowledgementMessage: break; case ServerPacketEnum.BasicAckMessage: break; case ServerPacketEnum.TextInformationMessage: TextInformationMessage text = (TextInformationMessage)e.Packet; Log(LogMessageType.Arena, ((TextInformationTypeEnum)text.MsgType).ToString() + "ID = " + text.MsgId); for (int i = 0; i < text.Parameters.Count; i++) { string t = text.Parameters[i]; Log(LogMessageType.Arena, "Parameter[" + i + "] " + t); } break; case ServerPacketEnum.HelloGameMessage: Log(LogMessageType.Info, "Connecté au serveur de jeu."); HelloGameMessage helloGame = (HelloGameMessage)e.Packet; AuthenticationTicketMessage ATM = new AuthenticationTicketMessage("fr", _ticket.ToString()); _GameSocket.Send(ATM); break; case ServerPacketEnum.RawDataMessage: List <int> tt = new List <int>(); for (int i = 0; i <= 255; i++) { Random random = new Random(); int test = random.Next(-127, 127); } CheckIntegrityMessage rawData = new CheckIntegrityMessage(tt); _GameSocket.Send(rawData); break; case ServerPacketEnum.HelloConnectMessage: Log(LogMessageType.Info, "Connecté au serveur d'authentification."); HelloConnectMessage helloConnectMessage = (HelloConnectMessage)e.Packet; sbyte[] credentials = RSA.RSAKey.Encrypt(helloConnectMessage.key, accountNameTextField.Text, accountPasswordTextField.Text, helloConnectMessage.salt); VersionExtended version = new VersionExtended(2, 41, 1, 120264, 1, (sbyte)BuildTypeEnum.RELEASE, 1, 1); IdentificationMessage idm = new IdentificationMessage(autoConnectCheckBox.Checked, false, false, version, "fr", credentials, 0, 0, new ushort[0]); Log(LogMessageType.Info, "Envois des informations d'identification..."); _ServerSocket.Send(idm); break; case ServerPacketEnum.LoginQueueStatusMessage: LoginQueueStatusMessage loginQueueStatusMessage = (LoginQueueStatusMessage)e.Packet; if (loginQueueStatusMessage.Position != 0 && loginQueueStatusMessage.Total != 0) { Log(LogMessageType.Info, "Vous êtes en position " + loginQueueStatusMessage.Position + " sur " + loginQueueStatusMessage.Total + " dans la file d'attente."); } break; case ServerPacketEnum.CurrentMapMessage: CurrentMapMessage currentMap = (CurrentMapMessage)e.Packet; _GameSocket.Send(new MapInformationsRequestMessage(currentMap.MapId)); break; case ServerPacketEnum.QueueStatusMessage: QueueStatusMessage queueStatusMessage = (QueueStatusMessage)e.Packet; if (queueStatusMessage.Position != 0 && queueStatusMessage.Total != 0) { Log(LogMessageType.Info, "Vous êtes en position " + queueStatusMessage.Position + " sur " + queueStatusMessage.Total + " dans la file d'attente."); } break; case ServerPacketEnum.IdentificationFailedMessage: IdentificationFailedMessage msg = (IdentificationFailedMessage)e.Packet; Log(LogMessageType.Public, "Identification échouée !"); Log(LogMessageType.Public, ((IdentificationFailureReasonEnum)msg.Reason).ToString()); DisconnectHandler(); break; case ServerPacketEnum.IdentificationSuccessMessage: break; case ServerPacketEnum.ServerListMessage: ServersListMessage servers = (ServersListMessage)e.Packet; foreach (GameServerInformations i in servers.Servers) { if (i.CharactersCount > 0 && i.IsSelectable && (ServerStatusEnum)i.Status == ServerStatusEnum.ONLINE) { _ServerSocket.Send(new ServerSelectionMessage(i.ObjectID)); break; } } break; case ServerPacketEnum.SelectedServerDataMessage: SelectedServerDataMessage selected = (SelectedServerDataMessage)e.Packet; Log(LogMessageType.Info, "Connexion au serveur " + (ServerNameEnum)selected.ServerId + "..."); _ticket = AES.AES.TicketTrans(selected.Ticket); _GameSocket = new DofusBotSocket(_deserializer, new IPEndPoint(IPAddress.Parse(selected.Address), selected.Port)); Log(LogMessageType.Info, "Connexion en cours <" + selected.Address + ":" + selected.Port + ">"); _GameSocket.ConnectEndListen(); _ServerSocket.CloseSocket(); _ServerSocket = null; break; case ServerPacketEnum.SelectedServerDataExtendedMessage: SelectedServerDataExtendedMessage selectedExtended = (SelectedServerDataExtendedMessage)e.Packet; Log(LogMessageType.Info, "Connecté au serveur : " + (ServerNameEnum)selectedExtended.ServerId + "..."); _ticket = AES.AES.TicketTrans(selectedExtended.Ticket); _GameSocket = new DofusBotSocket(_deserializer, new IPEndPoint(IPAddress.Parse(selectedExtended.Address), selectedExtended.Port)); Log(LogMessageType.Info, "Connexion en cours <" + selectedExtended.Address + ":" + selectedExtended.Port + ">"); _GameSocket.ConnectEndListen(); _ServerSocket.CloseSocket(); _ServerSocket = null; break; case ServerPacketEnum.AuthenticationTicketAcceptedMessage: AuthenticationTicketAcceptedMessage accepted = (AuthenticationTicketAcceptedMessage)e.Packet; Thread.Sleep(500); _GameSocket.Send(new CharactersListRequestMessage()); break; case ServerPacketEnum.AuthenticationTicketRefusedMessage: break; case ServerPacketEnum.GameContextCreateMessage: break; case ServerPacketEnum.SetCharacterRestrictionsMessage: break; case ServerPacketEnum.BasicNoOperationMessage: break; case ServerPacketEnum.NotificationListMessage: break; case ServerPacketEnum.CharacterSelectedSuccessMessage: break; case ServerPacketEnum.InventoryContentMessage: InventoryContentMessage inventory = (InventoryContentMessage)e.Packet; Invoke((MethodInvoker) delegate { kamasLabel.Text = inventory.Kamas.ToString(); }); break; case ServerPacketEnum.SetUpdateMessage: break; case ServerPacketEnum.ShortcutBarContentMessage: break; case ServerPacketEnum.RoomAvailableUpdateMessage: break; case ServerPacketEnum.HavenBagPackListMessage: break; case ServerPacketEnum.EmoteListMessage: break; case ServerPacketEnum.JobDescriptionMessage: JobDescriptionMessage jobs = (JobDescriptionMessage)e.Packet; foreach (JobDescription j in jobs.JobsDescription) { foreach (SkillActionDescription s in j.Skills) { //Log(LogMessageType.Noob, "Métier: " + j.JobId + " | Skill: " + s.SkillId); } } break; case ServerPacketEnum.JobExperienceMultiUpdateMessage: break; case ServerPacketEnum.JobCrafterDirectorySettingsMessage: break; case ServerPacketEnum.AlignmentRankUpdateMessage: break; case ServerPacketEnum.ServerExperienceModificatorMessage: break; case ServerPacketEnum.DareCreatedListMessage: break; case ServerPacketEnum.AlmanachCalendarDateMessage: break; case ServerPacketEnum.CharacterCapabilitiesMessage: break; case ServerPacketEnum.GameRolePlayArenaUpdatePlayerInfosAllQueuesMessage: break; case ServerPacketEnum.AchievementListMessage: break; case ServerPacketEnum.BasicLatencyStatsRequestMessage: break; case ServerPacketEnum.GameContextRemoveElementMessage: break; case ServerPacketEnum.GameMapChangeOrientationMessage: break; case ServerPacketEnum.GameRolePlayShowActorMessage: break; case ServerPacketEnum.SpouseStatusMessage: break; case ServerPacketEnum.SequenceNumberRequestMessage: break; case ServerPacketEnum.GuildMemberWarnOnConnectionStateMessage: break; case ServerPacketEnum.WarnOnPermaDeathStateMessage: break; case ServerPacketEnum.FriendGuildWarnOnAchievementCompleteStateMessage: break; case ServerPacketEnum.FriendWarnOnLevelGainStateMessage: break; case ServerPacketEnum.FriendWarnOnConnectionStateMessage: break; case ServerPacketEnum.BasicTimeMessage: break; case ServerPacketEnum.ServerSettingsMessage: break; case ServerPacketEnum.ServerOptionalFeaturesMessage: break; case ServerPacketEnum.ServerSessionConstantsMessage: break; case ServerPacketEnum.StatedElementUpdatedMessage: break; case ServerPacketEnum.InteractiveElementUpdatedMessage: break; case ServerPacketEnum.InteractiveUsedMessage: break; case ServerPacketEnum.AccountCapabilitiesMessage: break; case ServerPacketEnum.TrustStatusMessage: break; case ServerPacketEnum.PrismsListMessage: break; case ServerPacketEnum.CharacterExperienceGainMessage: break; case ServerPacketEnum.IdolListMessage: break; case ServerPacketEnum.SpellListMessage: break; break; case ServerPacketEnum.EnabledChannelsMessage: break; case ServerPacketEnum.GameMapMovementMessage: break; case ServerPacketEnum.DareSubscribedListMessage: break; case ServerPacketEnum.UpdateMapPlayersAgressableStatusMessage: break; case ServerPacketEnum.CharacterStatsListMessage: break; case ServerPacketEnum.MapComplementaryInformationsDataMessage: MapComplementaryInformationsDataMessage mapInfos = (MapComplementaryInformationsDataMessage)e.Packet; Invoke((MethodInvoker) delegate { currentMapIdLabel.Text = mapInfos.MapId.ToString(); }); break; case ServerPacketEnum.LifePointsRegenBeginMessage: break; case ServerPacketEnum.GameContextDestroyMessage: break; case ServerPacketEnum.IgnoredListMessage: break; case ServerPacketEnum.FriendsListMessage: FriendsListMessage friendsList = (FriendsListMessage)e.Packet; foreach (FriendInformations f in friendsList.FriendsList) { Log(LogMessageType.Noob, "Amis: " + f.AccountName + " | Dernière Connexion: " + DateExtensions.UnixTimestampToDateTime(f.LastConnection).ToLongDateString() + " | Points de Succès: " + f.AchievementPoints); } break; case ServerPacketEnum.AccountHouseMessage: break; case ServerPacketEnum.StartupActionsListMessage: break; case ServerPacketEnum.ChatCommunityChannelCommunityMessage: break; case ServerPacketEnum.DareRewardsListMessage: break; case ServerPacketEnum.DareWonListMessage: break; case ServerPacketEnum.MailStatusMessage: break; case ServerPacketEnum.ChannelEnablingChangeMessage: break; case ServerPacketEnum.InventoryWeightMessage: InventoryWeightMessage IWM = (InventoryWeightMessage)e.Packet; Invoke((MethodInvoker) delegate { PodsProgressValue = IWM.Weight; PodsProgressMaximum = IWM.WeightMax; PodsProgress.Refresh(); }); break; case ServerPacketEnum.CharacterLoadingCompleteMessage: _GameSocket.Send(new FriendsGetListMessage()); _GameSocket.Send(new IgnoredGetListMessage()); _GameSocket.Send(new SpouseGetInformationsMessage()); _GameSocket.Send(new ClientKeyMessage(FlashKeyGenerator.GetRandomFlashKey(accountNameTextField.Text))); _GameSocket.Send(new GameContextCreateRequestMessage()); _GameSocket.Send(new ChannelEnablingMessage(7, false)); break; case ServerPacketEnum.CharactersListMessage: CharactersListMessage charactersList = (CharactersListMessage)e.Packet; List <CharacterBaseInformations> characters = charactersList.Characters; for (int i = 0; i < characters.Count; i++) { CharacterBaseInformations c = characters[i]; Log(LogMessageType.Info, "Connexion sur le personnage " + c.Name); _GameSocket.Send(new CharacterSelectionMessage((ulong)c.ObjectID)); break; } break; default: Log(LogMessageType.Admin, "Packet: [" + (ServerPacketEnum)e.Packet.MessageID + "] is not handled."); break; } }