Exemplo n.º 1
0
        private void SequenceNumberRequestMessageHandler(DofusClient client, SequenceNumberRequestMessage message)
        {
            client.Account.LatencyFrame.Sequence++;
            var sequenceNumberMessage = new SequenceNumberMessage((ushort)client.Account.LatencyFrame.Sequence);

            client.Send(sequenceNumberMessage);
        }
Exemplo n.º 2
0
        public static void SendServerListMessage(DofusClient client, int charactercount)
        {
            var servers = new List <GameServerInformations>();

            servers.Add(new GameServerInformations((ushort)ConfigurationManager.Instance.ServerId, (sbyte)WorldServer.Instance.ServerState, 0, true, (sbyte)charactercount, 1));
            client.Send(new ServersListMessage(servers, 0, true));
        }
Exemplo n.º 3
0
        private void HelloGameMessageHandler(DofusClient client, HelloGameMessage message)
        {
            client.Logger.Log("Connecté au serveur de jeu.");
            var atm = new AuthenticationTicketMessage("fr", client.Account.Ticket);

            client.Send(atm);
        }
Exemplo n.º 4
0
        private void BasicCharactersListMessageHandler(DofusClient client, BasicCharactersListMessage message)
        {
            if (message.Characters.Count == 0)
            {
                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));
            }
        }
Exemplo n.º 5
0
        private void MapComplementaryInformationsDataMessageHandler(DofusClient client,
                                                                    MapComplementaryInformationsDataMessage message)
        {
            if (client.Account.Character.IsFirstConnection)
            {
                client.Send(new GuidedModeQuitRequestMessage());
                client.Account.Character.IsFirstConnection = false;
            }

            foreach (var actor in message.Actors)
            {
                if (actor.ContextualId != client.Account.Character.Id)
                {
                    continue;
                }
                client.Account.Character.CellId = actor.Disposition.CellId;
                break;
            }

            client.Account.Character.MapId = message.MapId;
            client.Account.Character.MapData.Clear();
            client.Account.Character.GatherManager.BannedElementId.Clear();
            client.Account.Character.MapData.ParseLocation(message.MapId);
            client.Account.Character.MapData.ParseActors(message.Actors.ToArray());
            client.Account.Character.MapData.ParseInteractiveElement(message.InteractiveElements.ToArray());
            client.Account.Character.MapData.ParseStatedElement(message.StatedElements.ToArray());
        }
Exemplo n.º 6
0
        private void HelloGameMessageHandler(DofusClient Client, HelloGameMessage Message)
        {
            Client.Logger.Log("Connecté au serveur de jeu.");
            AuthenticationTicketMessage ATM = new AuthenticationTicketMessage("fr", Client.Account.Ticket);

            Client.Send(ATM);
        }
Exemplo n.º 7
0
        private void BasicCharactersListMessageHandler(DofusClient Client, BasicCharactersListMessage Message)
        {
            CharacterBaseInformations c = Message.Characters[0];

            Client.Logger.Log("Connexion sur le personnage " + c.Name);
            Client.Send(new CharacterSelectionMessage(c.ObjectID));
        }
Exemplo n.º 8
0
 private void GameRolePlayPlayerFightFriendlyRequestedMessageHandler(DofusClient client,
                                                                     GameRolePlayPlayerFightFriendlyRequestedMessage message)
 {
     client.Logger.Log($"Le joueur id: {message.SourceId} vous défi.", LogMessageType.Info);
     Randomize.RunBetween(
         () => client.Send(new GameRolePlayPlayerFightFriendlyAnswerMessage(message.FightId, false)), 2000,
         4000);
 }
Exemplo n.º 9
0
        private void BasicLatencyStatsRequestMessageHandler(DofusClient client, BasicLatencyStatsRequestMessage message)
        {
            var basicLatencyStatsMessage = new BasicLatencyStatsMessage(
                (ushort)client.Account.LatencyFrame.GetLatencyAvg(),
                (ushort)client.Account.LatencyFrame.GetSamplesCount(),
                (ushort)client.Account.LatencyFrame.GetSamplesMax());

            client.Send(basicLatencyStatsMessage);
        }
Exemplo n.º 10
0
        private void CharacterNameSuggestionSuccessMessageHandler(DofusClient client, CharacterNameSuggestionSuccessMessage message)
        {
            client.Logger.Log($"Pseudo Suggérer: {message.Suggestion}");
            client.Account.Character.Name = message.Suggestion;

            var test = new CharacterCanBeCreatedRequestMessage();

            client.Send(test);
        }
Exemplo n.º 11
0
        private void HelloConnectMessageHandler(DofusClient Client, HelloConnectMessage Message)
        {
            Client.Logger.Log("Connecté au serveur d'authentification.");
            sbyte[]               Credentials           = RSA.Encrypt(Message.Key, Client.Account.Login, Client.Account.Password, Message.Salt);
            VersionExtended       Version               = new VersionExtended(2, 41, 1, 120980, 0, (sbyte)BuildTypeEnum.RELEASE, 1, 1);
            IdentificationMessage IdentificationMessage = new IdentificationMessage(true, false, false, Version, "fr", Credentials, 0, 0, new ushort[0]);

            Client.Logger.Log("Envois des informations d'identification...");
            Client.Send(IdentificationMessage);
        }
Exemplo n.º 12
0
        private void NicknameRegistrationMessageHandler(DofusClient client, NicknameRegistrationMessage message)
        {
            client.Logger.Log("Vous devez choisir un pseudo pour pouvoir vous connecter.", LogMessageType.Public);
            var random          = new Random();
            var nickname        = random.RandomString(10);
            var nicknameMessage = new NicknameChoiceRequestMessage(nickname);

            client.Send(nicknameMessage);
            client.Account.Nickname = nickname;
        }
Exemplo n.º 13
0
Arquivo: Map.cs Projeto: Mixi59/Cookie
        public bool MoveToCell(int cellid, bool changemap = false)
        {
            var pathFinder = new Pathfinder();

            pathFinder.SetMap(_client.Account.Character.MapData, true);
            var timePath =
                pathFinder.GetPath((short)_client.Account.Character.CellId, (short)cellid);
            var path = pathFinder.GetCompressedPath(timePath);

            if (path == null || timePath == null)
            {
                return(false);
            }

            _time = VelocityHelper.GetPathVelocity(timePath,
                                                   path.Length < 4 ? MovementTypeEnum.Walking : MovementTypeEnum.Running);

            if (path[path.Length - 1] == _client.Account.Character.CellId)
            {
                _moving = false;
                _client.Account.Character.Status = CharacterStatus.None;
                ConfirmMove(changemap);
                return(true);
            }

            var msg = new GameMapMovementRequestMessage(path.ToList(), _client.Account.Character.MapId);

            _client.Send(msg);
            ConfirmMove(changemap);
            _client.Account.Character.Status = CharacterStatus.Moving;
            _moving = true;
            return(true);
        }
Exemplo n.º 14
0
        private void RawDataMessageHandler(DofusClient Client, RawDataMessage Message)
        {
            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);

            Client.Send(rawData);
        }
Exemplo n.º 15
0
        private void HelloConnectMessageHandler(DofusClient client, HelloConnectMessage message)
        {
            client.Logger.Log("Connecté au serveur d'authentification.");
            var credentials = Rsa.Encrypt(message.Key, client.Account.Login, client.Account.Password, message.Salt);
            //var version = new VersionExtended(2, 42, 0, 121441, 0, (sbyte) BuildTypeEnum.RELEASE, 1, 1);
            var version = new VersionExtended(GameConstant.Major, GameConstant.Minor, GameConstant.Release,
                                              GameConstant.Revision, GameConstant.Patch, GameConstant.BuildType, GameConstant.Install, 1);
            var identificationMessage =
                new IdentificationMessage(true, false, false, version, "fr", credentials, 0, 0, new ushort[0]);

            client.Logger.Log("Envois des informations d'identification...");
            client.Send(identificationMessage);
        }
Exemplo n.º 16
0
        private void RawDataMessageHandler(DofusClient client, RawDataMessage message)
        {
            var tt = new List <int>();

            for (var i = 0; i <= 255; i++)
            {
                var random = new Random();
                var test   = random.Next(-127, 127);
                tt.Add(test);
            }
            var rawData = new CheckIntegrityMessage(tt);

            client.Send(rawData);
        }
Exemplo n.º 17
0
 private void CharacterLoadingCompleteMessageHandler(DofusClient client, CharacterLoadingCompleteMessage message)
 {
     client.Send(new FriendsGetListMessage());
     client.Send(new IgnoredGetListMessage());
     client.Send(new SpouseGetInformationsMessage());
     client.Send(new ClientKeyMessage(FlashKeyGenerator.GetRandomFlashKey(client.Account.Nickname)));
     client.Send(new GameContextCreateRequestMessage());
     client.Send(new ChannelEnablingMessage(7, false));
 }
Exemplo n.º 18
0
        private void ServerListMessageHandler(DofusClient client, ServerListMessage message)
        {
            if (message.AlreadyConnectedToServerId != 0)
            {
                client.Send(new ServerSelectionMessage(message.AlreadyConnectedToServerId));
                return;
            }

            var server = message.Servers.Find(s => (ServerStatusEnum)s.Status == ServerStatusEnum.ONLINE &&
                                              s.IsSelectable && s.CharactersCount > 0);


            if (server == null)
            {
                // TODO: Check if server 11 is online and selectable
                client.Send(new ServerSelectionMessage(11));
                client.Logger.Log("Selection du serveur automatique : Brumaire");
                return;
            }
            else
            {
                client.Send(new ServerSelectionMessage(server.ObjectID));
            }
        }
Exemplo n.º 19
0
 private void ServerListMessageHandler(DofusClient Client, ServerListMessage Message)
 {
     foreach (var Server in Message.Servers)
     {
         if (Server.CharactersCount > 0 && Server.IsSelectable)
         {
             if ((ServerStatusEnum)Server.Status == ServerStatusEnum.ONLINE)
             {
                 Client.Send(new ServerSelectionMessage(Server.ObjectID));
             }
             else
             {
                 Client.Logger.Log((ServerNameEnum)Server.ObjectID + ": " + (ServerStatusEnum)Server.Status);
             }
             break;
         }
     }
 }
Exemplo n.º 20
0
        private void CharacterStatsListMessageHandler(DofusClient client, CharacterCanBeCreatedResultMessage message)
        {
            // Si nous ne pouvons pas créer de personnages, nous arrêtons la fonction
            if (!message.YesYouCan)
            {
                return;
            }
            // Sinon, nous choisissons une classe au hasard
            var breedId = (byte)Randomize.GetRandomNumber(1, 18);
            // Nous récupérons les informations de la classe avec les D2O
            var breed = ObjectDataManager.Instance.Get <Breed>(breedId);
            // Nous récupérons la couleur de base de la classe, et nous faisons un léger random sur la couleur
            var breedColors = breed.MaleColors.Select(i => Randomize.GetRandomNumber((int)i - 30000, (int)i + 30000)).ToList();
            // On récupère la liste des cosmetics disponibles pour cette classe et ce sexe
            var headsList = ObjectDataManager.Instance.EnumerateObjects <Head>().ToList().FindAll(h => h.Breed == breedId && h.Gender == 0);
            // Nous selectionnons au hasard un cosmetics dans la liste
            var head = headsList[Randomize.GetRandomNumber(0, 7)];
            //// Nous envoyons la requête pour créer le personnage
            var test = new CharacterCreationRequestMessage(client.Account.Character.Name, breedId, false, breedColors, (ushort)head.Id);

            client.Send(test);
        }
Exemplo n.º 21
0
 private void AuthenticationTicketAcceptedMessageHandler(DofusClient client,
                                                         AuthenticationTicketAcceptedMessage message)
 {
     Thread.Sleep(300);
     client.Send(new CharactersListRequestMessage());
 }
 public static void HandleBasicPing(BasicPingMessage message, DofusClient client)
 {
     client.Send(new BasicPongMessage(message.quiet));
 }
Exemplo n.º 23
0
 public static void HandleBasicPing(BasicPingMessage message, DofusClient client)
 {
     client.Send(new BasicPongMessage(message.quiet));
 }
Exemplo n.º 24
0
        private void HandleSendChatMessage()
        {
            if (_client.Account.Character.Status == CharacterStatus.Disconnected)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(ChatTextBox.Text))
            {
                _client.Logger.Log("Vous ne pouvez pas envoyer un texte vide.", LogMessageType.Public);
            }
            else
            {
                if (ChatTextBox.Text.Length > 2 && ChatTextBox.Text[0] == '.')
                {
                    var txt = ChatTextBox.Text.Substring(1);
                    try
                    {
                        CommandManager.ParseAndCall(_client, txt);
                    }
                    catch
                    {
                        _client.Logger.Log("Commande Incorrecte ou qui a échouée.", LogMessageType.Public);
                    }

                    ChatTextBox.BeginInvoke(new Action(() => ChatTextBox.Text = ""));
                    return;
                }


                if (ChatTextBox.Text.Length < 2)
                {
                    _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL,
                                                            ChatTextBox.Text));
                }
                else
                {
                    var txt     = ChatTextBox.Text.Substring(0, 2);
                    var chattxt = ChatTextBox.Text.Replace(txt, "");
                    switch (txt)
                    {
                    case "/g":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_GUILD,
                                                                    chattxt));
                        }
                        break;

                    case "/s":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL,
                                                                    chattxt));
                        }
                        break;

                    case "/t":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_TEAM,
                                                                    chattxt));
                        }
                        break;

                    case "/a":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_ALLIANCE,
                                                                    chattxt));
                        }
                        break;

                    case "/p":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_PARTY,
                                                                    chattxt));
                        }
                        break;

                    case "/k":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_ARENA,
                                                                    chattxt));
                        }
                        break;

                    case "/b":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_SALES,
                                                                    chattxt));
                        }
                        break;

                    case "/r":
                        if (string.IsNullOrWhiteSpace(chattxt))
                        {
                            _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_SEEK,
                                                                    chattxt));
                        }
                        break;

                    default:
                        _client.Send(new ChatClientMultiMessage((byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL,
                                                                ChatTextBox.Text));
                        break;
                    }
                    ChatTextBox.BeginInvoke(new Action(() => ChatTextBox.Text = ""));
                }
            }
        }
Exemplo n.º 25
0
 private void CurrentMapMessageHandler(DofusClient client, CurrentMapMessage message)
 {
     client.Account.Character.MapId = message.MapId;
     client.Send(new MapInformationsRequestMessage(message.MapId));
 }
Exemplo n.º 26
0
 private void ExchangeRequestedTradeMessageHandler(DofusClient client, ExchangeRequestedTradeMessage message)
 {
     client.Logger.Log($"Le joueur id: {message.Source} vous demande en échange.", LogMessageType.Info);
     client.Send(new ExchangeAcceptMessage());
 }
Exemplo n.º 27
0
 public static void SendSystemMessage(DofusClient client, string message)
 {
     client.Send(new SystemMessageDisplayMessage(true, 61, new List <string> {
         message
     }));
 }