public void WelcomeGame(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) => hub.SendPackage($"AT{user.Accounts.FirstOrDefault(c => c.TcpId == tcpId).GameTicket}", tcpId);
public void JobXpHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { Guid jobsId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Jobs; var jobsBook = Database.Jobs.Find(i => i.Key == jobsId).First(); jobsBook.Jobs.DeserializeJobsXp(package.Substring(3)); Database.Jobs.ReplaceOneAsync(i => i.Key == jobsId, jobsBook); }
public void ChannelUpdateHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { /* * var characterGame = Storage.Instance.Characters[user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Key]; * if (package.Substring(2).StartsWith("+")) * { * foreach (var chan in package.Substring(3).ToCharArray()) * { * if (!characterGame.Channels.Contains(chan)) * characterGame.Channels += chan; * } * } * else * { * foreach (var chan in package.Substring(3).ToCharArray()) * { * if (!characterGame.Channels.Contains(chan)) * characterGame.Channels.Replace(chan.ToString(), ""); * } * } * manager.ReplaceOneAsync(c => c.Id == user.Id, user);*/ }
public void SpellUpdateSuccess(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); var split = package.Substring(3).Split('~'); var pair = new KeyValuePair <int, byte>(Convert.ToInt32(split[0]), Convert.ToByte(split[1])); characterGame.Fk_Spells[characterGame.Fk_Spells.FindIndex(spell => spell.Key == pair.Key)] = pair; // TODO send hub spell msg }
public void OtherDialogClosedHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { } // TODO
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(); }
public void NewLevelHandler(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.Level = Convert.ToByte(package.Substring(2)); }
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(); }
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(); }
public void ConnectPackageHandle(DeepTalk hub, string package, UserDB account, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) => hub.SendPackage("GI", tcpId);
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(); }
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(); } }
public void GetListCharacters(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { var account = user.Accounts.Find(c => c.TcpId == tcpId); hub.SendPackage("Agfr", tcpId); hub.SendPackage($"Ai{account.ClientId}", tcpId); hub.SendPackage("AL", tcpId); hub.SendPackage("Af", tcpId); }
public void ResultServerSelection(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { hub.SendPackage("Ak0", tcpId); hub.SendPackage("AV", tcpId); }
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(); }
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(); }
public void PlayerEmoteHandler(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); var split = package.Substring(3).Split('|'); int playerId = Convert.ToInt32(split[0]), emoteId = Convert.ToInt32(split[1]); if (characterGame.Key != playerId) { return; } if (emoteId == 1 && characterGame.State != CharacterStateEnum.HEALING) { characterGame.State = CharacterStateEnum.HEALING; } else if (emoteId == 0 && characterGame.State == CharacterStateEnum.HEALING) { characterGame.State = CharacterStateEnum.IDLE; } }
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(); }
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(); }
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(); }
public void SpellsHandler(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[2].Equals('o')) { foreach (var data in package.Substring(2, package.Length - 3).Split(';')) { var split = data.Split('~'); var pair = new KeyValuePair <int, byte>(Convert.ToInt32(split[0]), Convert.ToByte(split[1])); var index = characterGame.Fk_Spells.FindIndex(spell => spell.Key == pair.Key); if (index >= 0) { characterGame.Fk_Spells[index] = pair; } else { characterGame.Fk_Spells.Add(pair); } } } // TODO send hub spell msg }
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(); }
public void SpellUpdateError(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { // TODO send hub spell msg }
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(); }
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(); } }
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(); }
public void JobLevelUpHandler(DeepTalk hub, string package, UserDB user, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { Guid jobsId = user.Accounts.Find(c => c.TcpId == tcpId).CurrentCharacter.Fk_Jobs; var datas = package.Substring(2).Split('|'); var jobsBook = Database.Jobs.Find(i => i.Key == jobsId).First(); jobsBook.Jobs.Find(x => x.Id == (JobIdEnum)Convert.ToInt32(datas[0])).Level = Convert.ToInt32(datas[1]); Database.Jobs.ReplaceOneAsync(i => i.Key == jobsId, jobsBook); }
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(); }
public void MessageHandler(DeepTalk hub, string package, UserDB account, string tcpId, IMongoCollection <UserDB> manager, DeepTalkService talkService) { }
public async Task SelectedCharacterPackageHandle(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); var inventory = Database.Inventories.Find(i => i.Key == characterGame.Fk_Inventory).First(); string[] splittedData = package.Substring(4).Split('|'); characterGame.Key = int.Parse(splittedData[0]); characterGame.Name = splittedData[1]; characterGame.Level = byte.Parse(splittedData[2]); characterGame.BreedId = byte.Parse(splittedData[3]); characterGame.Sex = byte.Parse(splittedData[4]); inventory.Items.DeserializeItems(splittedData[9]); characterGame.State = CharacterStateEnum.IDLE; List <IHubClientAction> Actions = new List <IHubClientAction>(); Actions.Add(new HubPackageAction("GC1")); Actions.Add(new HubMethodAction(() => Database.Inventories.ReplaceOneAsync(i => i.Key == characterGame.Fk_Inventory, inventory).Wait())); Actions.Add(new HubClientAction(new LogMessage(LogType.SYSTEM_INFORMATION, "Personnage en ligne", tcpId))); talkService.AddTask(tcpId, user.CliConnectionId, user.ApiKey.Key.ToString(), Actions, new Random().Next(150, 450)); }