コード例 #1
0
        public void SelectCharacter(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var currentAccount = user.Accounts.FirstOrDefault(c => c.TcpId == tcpId);

            string[]         splittedData = package.Substring(3).Split('|');
            int              count        = 2;
            bool             found        = false;
            List <Character> characters   = new List <Character>();

            hub.CallCheck(tcpId).Wait();

            DeepTalk.IsScans.TryGetValue(tcpId, out bool isScan);

            while (count < splittedData.Length && !found)
            {
                string[] _loc11_       = splittedData[count].Split(';');
                int      id            = int.Parse(_loc11_[0]);
                string   characterName = _loc11_[1];
                byte     Level         = byte.Parse(_loc11_[2]);
                short    model         = short.Parse(_loc11_[3]);

                if (isScan)
                {
                    characters.Add(new Character()
                    {
                        BreedId = model, Key = id, Name = characterName, Level = Level
                    });
                }

                if (!isScan && currentAccount != null)
                {
                    if (characterName.ToLower().Equals(currentAccount.CurrentCharacter.Name.ToLower()))
                    {
                        hub.SendPackage($"AS{id}", tcpId, true);
                        hub.SendPackage($"Af", tcpId);
                        hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Selection du personnage {characterName}", tcpId), tcpId).Wait();
                        Debug.WriteLine("Add character " + currentAccount.CurrentCharacter.Key + " to memory");
                        Storage.Instance.AddCharacter(currentAccount.CurrentCharacter);
                        found = true;
                    }
                }
                count++;
            }
            if (isScan)
            {
                user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).Characters = characters;
                manager.ReplaceOneAsync(c => c.Id == user.Id, user).Wait();
                hub.DispatchToClient(new CharactersMessage(characters, tcpId), tcpId).Wait();
                hub.DisconnectCli(tcpId, true).Wait();
            }
        }
コード例 #2
0
        public void GroupInvitationHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, package.Substring(3).Split('|')[0].ToLower() + " t'invite à rejoindre son groupe.", tcpId), tcpId).Wait();
            if (characterGame.HasGroup && package.Substring(3).Split('|')[0].ToLower() == characterGame.Group.Leader.Name.ToLower())
            {
                hub.SendPackage("PA", tcpId);
                hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, "Invitation acceptée.", tcpId), tcpId).Wait();
            }
            else
            {
                hub.SendPackage("PR", tcpId);
                hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, "Invitation refusée.", tcpId), tcpId).Wait();
            }
        }
コード例 #3
0
        public void RegenTimerHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            characterGame.RegenTime = Convert.ToInt32(package.Substring(3));
            hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Votre personnage récupère 1 pdv chaque {characterGame.RegenTime / 1000} secondes", tcpId), tcpId).Wait();
        }
コード例 #4
0
 public void GetServerWorldRemastered(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).GameTicket = package.Split(';')[1];
     manager.ReplaceOneAsync(c => c.Id == user.Id, user);
     hub.Clients.Caller.SendAsync("NewConnection", package.Split(';')[0].Substring(3), 443, true, tcpId, user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).isScan);
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Redirection vers le world ", tcpId), tcpId).Wait();
 }
コード例 #5
0
        public void GetServerState(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            string[] serverList = package.Substring(2).Split('|');
            Server   server     = user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).Server;
            bool     firstTime  = true;

            foreach (string sv in serverList)
            {
                string[] separator = sv.Split(';');

                int         id          = int.Parse(separator[0]);
                ServerState serverState = (ServerState)byte.Parse(separator[1]);

                if (id == server.Id)
                {
                    server.State = serverState;
                    manager.ReplaceOneAsync(c => c.Id == user.Id, user);
                    hub.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, $"Le serveur {server.Name} est {server.State}", tcpId), tcpId).Wait();

                    if (serverState != ServerState.ONLINE)
                    {
                        firstTime = false;
                    }
                }
            }

            if (!firstTime && server.State == ServerState.ONLINE)
            {
                hub.SendPackage("Ax", tcpId);
            }
        }
コード例 #6
0
 public void GetServerWorld(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).GameTicket = package.Substring(14);
     manager.ReplaceOneAsync(c => c.Id == user.Id, user);
     hub.Clients.Caller.SendAsync("NewConnection", Hash.DecryptIp(package.Substring(3, 8)), Hash.DecryptPort(package.Substring(11, 3).ToCharArray()), true, tcpId, user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).isScan);
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Redirection vers le world {Hash.DecryptIp(package.Substring(3, 8))} {Hash.DecryptPort(package.Substring(11, 3).ToCharArray())}", tcpId), tcpId).Wait();
 }
コード例 #7
0
        public void CharacterRegenHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            int regen         = Convert.ToInt32(package.Substring(3));
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            characterGame.Characteristic.VitalityActual += regen;
            hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Vous avez récupéré {regen} points de vie", tcpId), tcpId).Wait();
        }
コード例 #8
0
        public void ItemAddHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            Guid inventoryId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Inventory;
            var  inventory   = Database.Inventories.Find(i => i.Key == inventoryId).First();

            inventory.Items.DeserializeItems(package.Substring(4));
            Database.Inventories.ReplaceOneAsync(i => i.Key == inventoryId, inventory);
            hub.DispatchToClient(new InventoryMessage(tcpId), tcpId).Wait();
        }
コード例 #9
0
 public void GetLoginQueue(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     string[] queueData = package.Substring(2).Split('|');
     hub.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, "[File d'attente] Position " + queueData[0] + "/" + queueData[1], tcpId), tcpId).Wait();
     if (int.Parse(queueData[0]) > 100)
     {
         hub.SendPackage("Af", tcpId);
     }
 }
コード例 #10
0
        public void StatsHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            characterGame.DeserializeCharacter(package);
            var inventory = Database.Inventories.Find(i => i.Key == characterGame.Fk_Inventory).First();

            hub.DispatchToClient(new CharacteristicMessage(characterGame.Characteristic, inventory.Kamas, characterGame.AvailableCharactericsPts, tcpId), tcpId).Wait();
        }
コード例 #11
0
        public void ItemRemoveHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            Guid inventoryId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Inventory;
            var  inventory   = Database.Inventories.Find(i => i.Key == inventoryId).First();

            string[] data = package.Substring(2).Split(';');
            inventory.Items.RemoveAt(inventory.Items.FindIndex(it => it.InventoryId == Convert.ToInt32(package.Substring(2))));
            Database.Inventories.ReplaceOneAsync(i => i.Key == inventoryId, inventory);
            hub.DispatchToClient(new InventoryMessage(tcpId), tcpId).Wait();
        }
コード例 #12
0
        public void EntityPopOrMoveHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            foreach (var playerSplit in package.Substring(3).Split('|'))
            {
                if (playerSplit.Length != 0)
                {
                    if (playerSplit.StartsWith('+'))
                    {
                        Debug.WriteLine(playerSplit.Substring(1));
                        var entity = EntityFactory.Instance.CreateEntity(characterGame.Map.MapId, playerSplit.Substring(1));
                        if (entity != null)
                        {
                            Debug.WriteLine($"Entity {entity.Id} pop or move on cell {entity.CellId}; curr character {entity.Id == characterGame.Key}");
                            if (characterGame.Map.Entities.ContainsKey(entity.Id))
                            {
                                characterGame.Map.Entities[entity.Id].CellId = entity.CellId;
                            }
                            else
                            {
                                characterGame.Map.Entities[entity.Id] = entity;
                            }
                            if (entity.Id == characterGame.Key)
                            {
                                entity.Type          = EntityTypeEnum.TYPE_OWNERCHARACTER;
                                characterGame.CellId = entity.CellId;
                            }

                            hub.DispatchToClient(new MapMessage(characterGame.Map, tcpId), tcpId);
                        }
                    }
                    else if (playerSplit.StartsWith('-'))
                    {
                        characterGame.Map.Entities.Remove(Convert.ToInt32(playerSplit.Substring(1)));
                        hub.DispatchToClient(new MapMessage(characterGame.Map, tcpId), tcpId);
                    }
                }
            }
        }
コード例 #13
0
        public void ItemUpdateHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            Guid inventoryId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Inventory;
            var  inventory   = Database.Inventories.Find(i => i.Key == inventoryId).First();

            string[] data = package.Substring(3).Split(';');
            Item     item = new Item();

            item.DeserializeItem(data[0]);
            inventory.Items[inventory.Items.FindIndex(it => it.InventoryId == item.InventoryId)] = item;
            Database.Inventories.ReplaceOneAsync(i => i.Key == inventoryId, inventory);
            hub.DispatchToClient(new InventoryMessage(tcpId), tcpId).Wait();
        }
コード例 #14
0
        public async Task InteractiveStateUpdateHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            foreach (string interactive in package.Substring(4).Split('|'))
            {
                var datas  = interactive.Split(';');
                var cellId = Convert.ToInt16(datas[0]);
                switch (byte.Parse(datas[2]))
                {
                case 0:
                    characterGame.Map.Interactives[cellId].IsActive = false;
                    hub.DispatchToClient(new MapMessage(characterGame.Map, tcpId), tcpId);
                    break;

                case 1:
                    characterGame.Map.Interactives[cellId].IsActive = true;
                    hub.DispatchToClient(new MapMessage(characterGame.Map, tcpId), tcpId);
                    break;
                }
            }
        }
コード例 #15
0
        public void GetMapHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var characterGame = Storage.Instance.GetCharacter(user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key);

            if (package.Length == 21)
            {
                string[] _loc3 = package.Split('|');
                if (int.TryParse(_loc3[1], out int mapId))
                {
                    hub.SendPackage($"Gdm{mapId}", tcpId);
                    characterGame.Map = new Map(mapId);
                    hub.DispatchToClient(new MapMessage(characterGame.Map, tcpId), tcpId).Wait();
                }
            }
            else
            {
                if (int.TryParse(package.Substring(4).Split('|')[0], out int mapId))
                {
                    characterGame.Map = new Map(mapId);
                    hub.DispatchToClient(new MapMessage(characterGame.Map, tcpId), tcpId).Wait();
                    hub.SendPackage("GI", tcpId);
                }
            }
        }
コード例 #16
0
        public void ItemQuantityUpdateHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            Guid inventoryId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Inventory;
            var  inventory   = Database.Inventories.Find(i => i.Key == inventoryId).First();

            string[] data = package.Substring(2).Split('|');
            Item     item = inventory.Items.Find(it => it.InventoryId == Convert.ToInt32(data[0]));

            if (item != null)
            {
                item.Quantity = Convert.ToInt32(data[1]);
            }
            Database.Inventories.ReplaceOneAsync(i => i.Key == inventoryId, inventory);
            hub.DispatchToClient(new InventoryMessage(tcpId), tcpId).Wait();
        }
コード例 #17
0
        public void GetWelcomeKeyAsync(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            var account = user.Accounts.FirstOrDefault(c => c.TcpId == tcpId);

            if (account.CurrentCharacter != null)
            {
                account.CurrentCharacter.State = CharacterStateEnum.CONNECTING;
            }
            account.WelcomeKey = package.Substring(2);
            manager.ReplaceOneAsync(c => c.Id == user.Id, user);

            hub.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, "Connexion au serveur d'auth", tcpId), tcpId).Wait();

            hub.SendPackage("1.31.3", tcpId);

            hub.SendPackage($"{account.AccountName}\n{Hash.EncryptPassword(account.Password, account.WelcomeKey)}", tcpId);
            hub.SendPackage($"Af", tcpId);
        }
コード例 #18
0
        public void AccountTempBannedError(DeepTalk hub, string package, UserDB account, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            string[]      banInformations = package.Substring(3).Split('|');
            int           days = int.Parse(banInformations[0].Substring(1)), hours = int.Parse(banInformations[1]), minutes = int.Parse(banInformations[2]);
            StringBuilder banInformationsMessage = new StringBuilder().Append("Votre compte sera invalide pendant ");

            if (days > 0)
            {
                banInformationsMessage.Append(days + " jour(s)");
            }
            if (hours > 0)
            {
                banInformationsMessage.Append(hours + " heures");
            }
            if (minutes > 0)
            {
                banInformationsMessage.Append(minutes + " minutes");
            }

            hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, banInformationsMessage.ToString(), tcpId), tcpId).Wait();
        }
コード例 #19
0
        public void ItemMoveHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            Guid inventoryId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Inventory;
            var  inventory   = Database.Inventories.Find(i => i.Key == inventoryId).First();

            string[] data = package.Substring(2).Split('|');
            Item     item = inventory.Items.Find(it => it.InventoryId == Convert.ToInt32(data[0]));

            if (item != null)
            {
                if (String.IsNullOrEmpty(data[1]))
                {
                    item.Position = ItemSlotEnum.SLOT_INVENTORY;
                }
                else
                {
                    item.Position = (ItemSlotEnum)Convert.ToInt32(data[1]);
                }
            }
            Database.Inventories.ReplaceOneAsync(i => i.Key == inventoryId, inventory);
            hub.DispatchToClient(new InventoryMessage(tcpId), tcpId).Wait();
        }
コード例 #20
0
        public async void GetServerList(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
        {
            //AM.Account account = prmClient.Account;
            string[] loc5    = package.Substring(3).Split('|');
            int      counter = 1;
            bool     picked  = false;

            while (counter < loc5.Length && !picked)
            {
                string[] _loc10_      = loc5[counter].Split(',');
                int      serverId     = int.Parse(_loc10_[0]);
                var      userSelected = user.Accounts.FirstOrDefault(c => c.TcpId == tcpId);
                if (serverId == userSelected.Server.Id)
                {
                    if (user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).Server.State == ServerState.ONLINE)
                    {
                        picked = true;
                    }
                    else
                    {
                        var wait = new Random().Next(100, 1000);
                        hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Serveur non accessible pour le moment, je réessaye dans {wait}ms", tcpId), tcpId).Wait();
                        await Task.Delay(wait);
                    }
                }
                else
                {
                    counter++;
                }
            }

            if (picked)
            {
                hub.SendPackage($"AX{user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).Server.Id}", tcpId, true);
            }
        }
コード例 #21
0
 public void StreamingErrorPacketHandle(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Connexion rejetée. Vous n'avez pas pu vous authentifier pour ce serveur car votre connexion a expiré. Assurez-vous de couper les téléchargements, la musique ou les vidéos en continu pour améliorer la qualité et la vitesse de votre connexion.", tcpId), tcpId).Wait();
 }
コード例 #22
0
 public void GuildInvitationHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, package.Substring(3) + " t'invite à rejoindre sa guilde.", tcpId), tcpId).Wait();
     hub.SendPackage("gJE", tcpId);
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_INFORMATION, $"Invitation à rejoindre la guilde refusée", tcpId), tcpId).Wait();
 }
コード例 #23
0
 public void AlreadyConnectingError(DeepTalk hub, string package, UserDB account, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Ce compte est déjà connecté à un serveur de jeu. Veuillez réessayer.", tcpId), tcpId).Wait();
 }
コード例 #24
0
 public void AccountBannedError(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Connexion rejetée. Votre compte a été banni.", tcpId), tcpId).Wait();
 }
コード例 #25
0
 public void WrongVersionError(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "La version de Dofus que vous avez installée n'est pas compatible avec ce serveur. Pour jouer, installez la nouvelle version . Le client DOFUS sera fermé.", tcpId), tcpId).Wait();
 }
コード例 #26
0
 public void AlreadyConnectedError(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Déjà connecté. Essayez encore une fois.", tcpId), tcpId).Wait();
 }
コード例 #27
0
 public void WrongCredentialsError(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Connexion rejetée. Nom de compte ou mot de passe incorrect.", tcpId), tcpId).Wait();
 }
コード例 #28
0
 public void FloodConnexionErrorPacketHandle(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Pour éviter de déranger les autres joueurs, attendez %1 secondes avant de vous reconnecter.", tcpId), tcpId).Wait();
 }
コード例 #29
0
 public void NetworkErrorPacketHandle(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.SYSTEM_ERROR, "Connexion rejetée. Le serveur de jeu n'a pas reçu les informations d'authentification nécessaires après votre identification. Veuillez réessayer et, si le problème persiste, contactez votre administrateur réseau ou votre serveur d'accès Internet. C'est un problème de redirection dû à une mauvaise configuration DNS.", tcpId), tcpId).Wait();
 }
コード例 #30
0
 public void NotSubscribe(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService)
 {
     hub.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, "Vous n'êtes pas abonnée", tcpId), tcpId).Wait();
 }