Пример #1
0
        private void CharactersListMessageHandler(DofusClient Client, CharactersListMessage Message)
        {
            CharacterBaseInformations c = Message.Characters[0];

            Client.Logger.Log("Connexion sur le personnage " + c.Name);
            Client.Send(new CharacterSelectionMessage(c.ObjectID));
        }
Пример #2
0
        public static Task HandleCharactersListMessage(Account account, CharactersListMessage message)
        => Task.Run(async() =>
        {
            account.Game.Server.Update(message);

            if (account.AccountConfig.CharacterCreation.Create)
            {
                await account.Extensions.CharacterCreation.Update(message);
                return;
            }

            if (message.Characters.Count > 0)
            {
                var character = string.IsNullOrEmpty(account.AccountConfig.Character) ?
                                message.Characters[0] :
                                message.Characters.FirstOrDefault(c => c.Name == account.AccountConfig.Character);


                // In case the character the user wants wasn't found
                if (character == null)
                {
                    account.Logger.LogError("CharacterSelectionFrame", LanguageManager.Translate("78", account.AccountConfig.Character));
                }
                else
                {
                    account.Logger.LogDebug("CharacterSelectionFrame", LanguageManager.Translate("79", character.Name, character.Level));
                    await account.Network.SendMessageAsync(new CharacterSelectionMessage((int)character.Id));
                }
            }
            else
            {
                account.Logger.LogError("CharacterSelectionFrame", LanguageManager.Translate("80"));
            }
        });
Пример #3
0
 public void Update(CharactersListMessage message)
 {
     if (message.Characters.Count > 0)
     {
         Characters.AddRange(message.Characters);
     }
 }
 public void HandleCharactersListMessage(Bot bot, CharactersListMessage message)
 {
     View.Dispatcher.BeginInvoke(new Action(() =>
     {
         SelectCharacterCommand.RaiseCanExecuteChanged();
         DeleteCharacterCommand.RaiseCanExecuteChanged();
     }));
 }
Пример #5
0
 public void Update(CharactersListMessage msg)
 {
     if (msg == null)
     {
         throw new ArgumentNullException("msg");
     }
     CharactersList = new CharactersList(msg);
 }
Пример #6
0
        public void HandleSelectionCharacter(CharactersListMessage message)
        {
            var character = message.characters[0];
            CharacterSelectionMessage reponse = new CharacterSelectionMessage(character.id);

            client.Network.Send(reponse);
            new ChatFrame(client);
            Optimus.Common.Log.Logger.GetInstance("PlayerD{Debug}").Debug(string.Format("Character : {0} level : {1} selected.", character.name, character.level));
        }
Пример #7
0
 public static void HandleCharactersListMessage(FakeClient client, CharactersListMessage message)
 {
     if (client.Id == 1)
     {
         client.Send(new CharacterSelectionMessage(message.characters.First(x => x.name == "Loom2").id));
     }
     if (client.Id == 2)
     {
         client.Send(new CharacterSelectionMessage(message.characters.First(x => x.name == "Loom").id));
     }
 }
Пример #8
0
        public static void HandleCharactersListMessage(FakeClient client, CharactersListMessage message)
        {
            if (!message.characters.Any())
            {
                var head = BreedManager.Instance.GetHead(x => x.Breed == (int)PlayableBreedEnum.Cra);

                /*client.Send(new CharacterCreationRequestMessage("FakeCharacter#" + client.Id, (sbyte)PlayableBreedEnum.Cra,
                 *  false, Enumerable.Repeat(-1, 5), head.Id));*/
            }
            else
            {
                client.Send(new CharacterSelectionMessage(message.characters.First().id));
            }
        }
Пример #9
0
        private void HandleCharactersListMessage(IAccount account, CharactersListMessage message)
        {
            if (message.Characters.Count == 0)
            {
                Logger.Default.Log("Pas de personnage.");
                Logger.Default.Log("Création du personnage en cours.");
                account.Network.SendToServer(new CharacterNameSuggestionRequestMessage());
            }
            else
            {
                var c = message.Characters[0];
                Logger.Default.Log("Connexion sur le personnage " + c.Name);

                account.Network.SendToServer(account.Character.IsFirstConnection == false
                    ? new CharacterSelectionMessage(c.ObjectID)
                    : new CharacterFirstSelectionMessage(false, c.ObjectID));
            }
        }
Пример #10
0
        private void CharactersListMessageHandler(DofusClient client, CharactersListMessage message)
        {
            if (message.Characters.Count == 0)
            {
                client.Logger.Log("Pas de personnage.");
                client.Logger.Log("Création du personnage en cours.");
                client.Send(new CharacterNameSuggestionRequestMessage());
            }
            else
            {
                var c = message.Characters[0];
                client.Logger.Log("Connexion sur le personnage " + c.Name);

                client.Send(client.Account.Character.IsFirstConnection == false
                    ? new CharacterSelectionMessage(c.ObjectID)
                    : new CharacterFirstSelectionMessage(false, c.ObjectID));
            }
        }
Пример #11
0
        public static void CharactersListMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            CharactersListMessage charactersListMessage = (CharactersListMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                charactersListMessage.Deserialize(reader);
            }

            account.CharacterBaseInformations = charactersListMessage.characters[0];

            //MainForm.ActualMainForm.ActualizeAccountInformations();

            if (!account.IsMITM)
            {
                CharacterSelectionMessage characterSelectionMessage = new CharacterSelectionMessage(account.CharacterBaseInformations.id);
                account.SocketManager.Send(characterSelectionMessage);
            }
        }
Пример #12
0
        public static void CharactersListMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            CharactersListMessage charactersListMessage = (CharactersListMessage)message;

            //packetDatas = packetDatas.ToList().SkipWhile(a => a == 0).ToArray();

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                charactersListMessage.Deserialize(reader);
            }

            account.CharacterBaseInformations = charactersListMessage.Characters[0];

            //MainForm.ActualMainForm.ActualizeAccountInformations();

            if (!account.IsMITM)
            {
                CharacterSelectionMessage characterSelectionMessage = new CharacterSelectionMessage((ulong)account.CharacterBaseInformations.ObjectID);
                account.SocketManager.Send(characterSelectionMessage);
            }
        }
Пример #13
0
 public CharactersList(CharactersListMessage msg)
     : base(new ObservableCollection <CharactersListEntry>(msg.characters.Select(entry => new CharactersListEntry(entry))))
 {
 }
 public static void HandleCharactersListMessage(Bot bot, CharactersListMessage message)
 {
     bot.AddFrame(new CharacterSelectionViewModel(bot));
 }
Пример #15
0
        public async Task Update(CharactersListMessage message)
        {
            if (!_account.AccountConfig.CharacterCreation.Create)
            {
                return;
            }

            // If the character has been successfuly created
            if (_created)
            {
                // Set Create to false so that we don't create a character each time we connect
                _account.AccountConfig.CharacterCreation.Create = false;
                GlobalConfiguration.Instance.Save();

                // Copy configurations if asked for
                try
                {
                    if (!string.IsNullOrEmpty(_account.AccountConfig.CharacterCreation.ParametersToCopy))
                    {
                        File.Copy(Path.Combine(Configuration.ConfigurationsPath, _account.AccountConfig.CharacterCreation.ParametersToCopy),
                                  Path.Combine(Configuration.ConfigurationsPath, $"{_account.AccountConfig.Username}_{message.Characters[0].Name}.config"), overwrite: true);
                        _account.Logger.LogInfo(LanguageManager.Translate("516"), LanguageManager.Translate("519"));
                    }
                    if (!string.IsNullOrEmpty(_account.AccountConfig.CharacterCreation.FightsConfigurationToCopy))
                    {
                        File.Copy(Path.Combine(FightsConfiguration.ConfigurationsPath, _account.AccountConfig.CharacterCreation.FightsConfigurationToCopy),
                                  Path.Combine(FightsConfiguration.ConfigurationsPath, $"{_account.AccountConfig.Username}_{message.Characters[0].Name}.fconfig"), overwrite: true);
                        _account.Logger.LogInfo(LanguageManager.Translate("516"), LanguageManager.Translate("520"));
                    }
                }
                catch (Exception ex)
                {
                    _account.Logger.LogError(LanguageManager.Translate("516"), ex.ToString());
                }

                _account.Logger.LogDebug(LanguageManager.Translate("516"), LanguageManager.Translate("521", message.Characters[0].Name));
                _account.Network.SendMessage(new CharacterFirstSelectionMessage((int)message.Characters[0].Id, true));
                return;
            }

            _account.Logger.LogInfo(LanguageManager.Translate("516"), LanguageManager.Translate("522"));
            string name      = _account.AccountConfig.CharacterCreation.Name;
            int    breed     = _account.AccountConfig.CharacterCreation.Breed == -1 ? Randomize.GetRandomInt(1, BreedsUtility.Breeds.Max(b => b.Id) + 1) : _account.AccountConfig.CharacterCreation.Breed;
            bool   sex       = (_account.AccountConfig.CharacterCreation.Sex == -1 ? Randomize.GetRandomInt(0, 2) : _account.AccountConfig.CharacterCreation.Sex) == 1;
            int    headOrder = _account.AccountConfig.CharacterCreation.Head == -1 ? Randomize.GetRandomInt(0, 8) : _account.AccountConfig.CharacterCreation.Head;

            // If the user wanted a random name, use DT's random name generator
            if (name == "")
            {
                _account.Logger.LogDebug(LanguageManager.Translate("516"), LanguageManager.Translate("523"));
                _nameTcs = new TaskCompletionSource <string>();
                _account.Network.SendMessage(new CharacterNameSuggestionRequestMessage());
                _nameTcs.Task.Wait();
                name = _nameTcs.Task.Result;
                _account.Logger.LogInfo(LanguageManager.Translate("516"), LanguageManager.Translate("524", name));
            }

            await Task.Delay(1000);

            // Send the character creation request message, take in consideration random stuff to generate
            _account.Network.SendMessage(new CharacterCreationRequestMessage(name, breed, sex, (uint)BreedsUtility.GetCosmeticId(breed, sex, headOrder), _account.AccountConfig.CharacterCreation.Colors));
        }
Пример #16
0
 public static void HandleCharactersListMessage(Bot bot, CharactersListMessage message)
 {
     bot.ClientInformations.Update(message);
     bot.Display = DisplayState.CharacterSelection;
 }
Пример #17
0
        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;
            }
        }