Example #1
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));
 }
Example #2
0
 private void HandleCharacterLoadingCompleteMessage(IAccount account, CharacterLoadingCompleteMessage message)
 {
     account.Network.SendToServer(new FriendsGetListMessage());
     account.Network.SendToServer(new IgnoredGetListMessage());
     account.Network.SendToServer(new SpouseGetInformationsMessage());
     account.Network.SendToServer(new ClientKeyMessage(FlashKeyGenerator.GetRandomFlashKey(account.Nickname)));
     account.Network.SendToServer(new GameContextCreateRequestMessage());
     account.Network.SendToServer(new ChannelEnablingMessage(7, false));
 }
Example #3
0
        public static Task HandleCharacterSelectedSuccessMessage(Account account, CharacterSelectedSuccessMessage message)
        => Task.Run(async() =>
        {
            account.Game.Character.Update(message);

            await account.Network.SendCallAsync(new kpiStartSessionMessage(account.Login));
            await account.Network.SendCallAsync(new moneyGoultinesAmountRequestMessage());
            await account.Network.SendMessageAsync(new QuestListRequestMessage());
            await account.Network.SendMessageAsync(new FriendsGetListMessage());
            await account.Network.SendMessageAsync(new IgnoredGetListMessage());
            await account.Network.SendMessageAsync(new SpouseGetInformationsMessage());
            await account.Network.SendCallAsync(new bakSoftToHardCurrentRateRequestMessage());
            await account.Network.SendCallAsync(new bakHardToSoftCurrentRateRequestMessage());
            await account.Network.SendCallAsync(new restoreMysteryBoxMessage());
            await account.Network.SendMessageAsync(new ClientKeyMessage(FlashKeyGenerator.GetRandomFlashKey()));
            await account.Network.SendMessageAsync(new GameContextCreateRequestMessage());

            MercyBotMain.Instance.Server.SendMessage(new BotSelectedSuccesMessage(account.AccountConfig.Username, (int)account.Game.Character.Id, account.Game.Character.Name,
                                                                                  account.Game.Server.Name, account.Game.Character.Level));
        });
Example #4
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;
            }
        }