public void Update(InventoryContentMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } Items = new ObservableCollection <Item>(msg.objects.Select(entry => new Item(entry))); }
public void Update(InventoryContentMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } Inventory.Update(msg); }
public Inventory(PlayedCharacter owner, InventoryContentMessage inventory) : this(owner) { if (inventory == null) { throw new ArgumentNullException("inventory"); } Kamas = inventory.kamas; Update(inventory); }
public void Update(InventoryContentMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } m_items.Clear(); foreach (var item in msg.objects) { m_items.Add(new Item(item)); } }
//private void HandleInventoryContentAndPresetMessage(IAccount account, InventoryContentAndPresetMessage message) //{ // HandleInventoryContentMessage(account, message); //} private void HandleInventoryContentMessage(IAccount account, InventoryContentMessage message) { account.Character.Stats.Kamas = message.Kamas; account.Character.Inventory.Objects = message.Objects; UpdateEquipment(); }
private void HandleCharacterCharacteristicsInformations(InventoryContentMessage message, ConnectedHost source) { this.Kamas = (int)message.kamas; OnUpdated(); }
private void InventoryContentMessageHandler(DofusClient client, InventoryContentMessage message) { client.Account.Character.Stats.Kamas = message.Kamas; client.Account.Character.Inventory = message.Objects; }
public static Task HandleInventoryContentMessage(Account account, InventoryContentMessage message) => Task.Run(() => account.Game.Character.Inventory.Update(message));
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; } }
public static void InventoryContentMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { InventoryContentMessage inventoryContentMessage = (InventoryContentMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { inventoryContentMessage.Deserialize(reader); } foreach (ObjectItem item in inventoryContentMessage.Objects) { Core.Inventory.Item i = new Core.Inventory.Item(item.Effects.ToList(), item.ObjectGID, item.Position, (int)item.Quantity, (int)item.ObjectUID, account); account.Inventory.Items.Add(i); } account.ActualizeInventory(); account.petsList = new List <Pet>(); foreach (Core.Inventory.Item item in account.Inventory.Items) { DataClass itemData = GameData.GetDataObject(D2oFileEnum.Items, item.GID); if ((int)itemData.Fields["typeId"] == 18) { Pet pet = new Pet(item, itemData, account); account.petsList.Add(pet); pet.SetFood(); } } if (account.petsList.Count > 0) { account.Log(new BotTextInformation("Vos " + account.petsList.Count + " familiers vous font un gros bisou de la part de BlueSheep."), 3); } if (!account.IsMITM) { FriendsGetListMessage friendGetListMessage = new FriendsGetListMessage(); account.SocketManager.Send(friendGetListMessage); IgnoredGetListMessage ignoredGetListMessage = new IgnoredGetListMessage(); account.SocketManager.Send(ignoredGetListMessage); SpouseGetInformationsMessage spouseGetInformationsMessage = new SpouseGetInformationsMessage(); account.SocketManager.Send(spouseGetInformationsMessage); Random random = new Random(); const string hexChars = "0123456789ABCDEF"; string key = string.Empty; for (int index = 0; index < 20; index++) { int randomValue = random.Next(100); if (randomValue <= 40) { key += (char)(random.Next(26) + 65); } else if (randomValue <= 80) { key += (char)(random.Next(26) + 97); } else { key += (char)(random.Next(10) + 48); } } int pos = key.Sum(t => t % 16); key += hexChars[pos % 16]; ClientKeyMessage clientKeyMessage = new ClientKeyMessage(key); account.SocketManager.Send(clientKeyMessage); GameContextCreateRequestMessage gameContextCreateRequestMessage = new GameContextCreateRequestMessage(); account.SocketManager.Send(gameContextCreateRequestMessage); ChannelEnablingMessage channelEnablingMessage = new ChannelEnablingMessage(7, false); account.SocketManager.Send(channelEnablingMessage); } }
public static void HandleInventoryContentMessage(Bot bot, InventoryContentMessage message) { bot.Character.Inventory.Update(message); }