public static void ChatServerMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ChatServerMessage msg = (ChatServerMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } switch ((int)msg.channel) { case 0: account.Log(new GeneralTextInformation(msg.senderName + ": " + msg.content),1); break; case 1: //account.Log(new DofAlertTextInformation("Bienvenue sur DOFUS, dans le Monde des Douze !" + System.Environment.NewLine + "Il est interdit de transmettre votre identifiant ou votre mot de passe.")); break; case 2: account.Log(new GuildTextInformation(msg.senderName + ": " + msg.content),1); break; case 3: account.Log(new AllianceTextInformation(msg.senderName + ": " + msg.content),1); break; case 5: account.Log(new CommerceTextInformation(msg.senderName + ": " + msg.content),1); break; case 6: account.Log(new RecrutementTextInformation(msg.senderName + ": " + msg.content),1); break; case 9: account.Log(new PrivateTextInformation("de " + msg.senderName + " : " + msg.content),1); break; } }
public static void GameActionFightPointsVariationMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightPointsVariationMessage msg = (GameActionFightPointsVariationMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } BFighter fighter = (BFighter)account.Fight.GetFighter(msg.targetId); if (fighter != null) { switch (msg.actionId) { case 101: case 102: case 120: fighter.ActionPoints = (fighter.ActionPoints + msg.delta); break; case 78: case 127: case 129: fighter.MovementPoints = (fighter.MovementPoints + msg.delta); break; } } }
public static void CharacterExperienceGainMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { CharacterExperienceGainMessage msg = (CharacterExperienceGainMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Log(new ActionTextInformation("Experience gagnée : + " + msg.experienceCharacter + " points d'expérience"), 4); account.CharacterStats.experience += msg.experienceCharacter; double i = account.CharacterStats.experience - account.CharacterStats.experienceLevelFloor; double j = account.CharacterStats.experienceNextLevelFloor - account.CharacterStats.experienceLevelFloor; try { int xppercent = (int)((i / j) * 100); } catch (Exception ex) { } account.ModifBar(1, (int)account.CharacterStats.experienceNextLevelFloor - (int)account.CharacterStats.experienceLevelFloor, (int)account.CharacterStats.experience - (int)account.CharacterStats.experienceLevelFloor, "Experience"); if (account.Fight != null) { account.FightData.xpWon[DateTime.Today] += (int)msg.experienceCharacter; } }
public static void NpcDialogQuestionMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { NpcDialogQuestionMessage msg = (NpcDialogQuestionMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Npc.QuestionId = msg.messageId; int mess = (int)GameData.GetDataObject(D2oFileEnum.NpcMessages, account.Npc.QuestionId).Fields["messageId"]; account.Log(new BotTextInformation("Dialogue : " + BlueSheep.Common.Data.I18N.GetText(mess)), 0); if (account.Npc.QuestionId == 318 && (int)msg.visibleReplies[0] == 259) { //Bank account.Npc.SendReply(259); return; } if (msg.visibleReplies.Length == 0) account.Npc.CloseDialog(); account.Npc.Replies.Clear(); account.Npc.Replies = msg.visibleReplies.Select<short, BlueSheep.Core.Npc.NpcReply>((id) => new BlueSheep.Core.Npc.NpcReply(account.Npc.Npcs[account.Npc.Id], id)).ToList(); if (account.Path != null) { account.Path.SearchReplies(BlueSheep.Common.Data.I18N.GetText(mess)); } }
public static void GameActionFightDispellableEffectMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightDispellableEffectMessage msg = (GameActionFightDispellableEffectMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (msg.effect is FightTemporaryBoostStateEffect) { FightTemporaryBoostStateEffect effect = (FightTemporaryBoostStateEffect)msg.effect; if (effect.targetId == account.Fight.Fighter.Id) { if (account.Fight.DurationByEffect.ContainsKey(effect.stateId)) account.Fight.DurationByEffect.Remove(effect.stateId); account.Fight.DurationByEffect.Add(effect.stateId, effect.turnDuration); } } else if (msg.effect is FightTemporaryBoostEffect) { FightTemporaryBoostEffect effect = (FightTemporaryBoostEffect)msg.effect; if (msg.actionId == 168) ((BFighter)account.Fight.Fighter).ActionPoints = account.Fight.Fighter.ActionPoints - effect.delta; else if (msg.actionId == 169) ((BFighter)account.Fight.Fighter).MovementPoints = account.Fight.Fighter.MovementPoints - effect.delta; } }
public static void NpcDialogQuestionMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { NpcDialogQuestionMessage msg = (NpcDialogQuestionMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Npc.QuestionId = msg.messageId; int mess = (int)GameData.GetDataObject(D2oFileEnum.NpcMessages, account.Npc.QuestionId).Fields["messageId"]; account.Log(new BotTextInformation("Dialogue : " + BlueSheep.Common.Data.I18N.GetText(mess)), 0); if (account.Npc.QuestionId == 318 && (int)msg.visibleReplies[0] == 259) { //Bank account.Npc.SendReply(259); return; } else if (account.Npc.QuestionId == 318) { account.Log(new ErrorTextInformation("Vous n'êtes pas level 10, vous ne pouvez pas utiliser la banque. Fermeture du dialogue."), 0); account.Npc.CloseDialog(); } if (msg.visibleReplies.Length == 0) account.Npc.CloseDialog(); account.Npc.Replies.Clear(); account.Npc.Replies = msg.visibleReplies.Select<short, BlueSheep.Core.Npc.NpcReply>((id) => new BlueSheep.Core.Npc.NpcReply(account.MapData.Npcs.Find(n => n.contextualId == account.Npc.Id).npcId, id)).ToList(); if (account.Path != null) { account.Path.SearchReplies(BlueSheep.Common.Data.I18N.GetText(mess)); } }
public static void JobExperienceMultiUpdateMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { JobExperienceMultiUpdateMessage msg = (JobExperienceMultiUpdateMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } foreach (JobExperience i in msg.experiencesUpdate) { foreach (Core.Job.Job j in account.Jobs) { if (i.jobId == j.Id) { j.Level = i.jobLevel; j.XP = (int)i.jobXP; j.XpLevelFloor =(int)i.jobXpLevelFloor; j.XpNextLevelFloor = (int)i.jobXpNextLevelFloor; break; } } } account.ActualizeJobs(); foreach (JobUC j in account.JobsUC) { j.populateTreeview(); } }
public static void AuthenticationTicketAcceptedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { if (!account.IsMITM) { CharactersListRequestMessage charactersListRequestMessage = new CharactersListRequestMessage(); account.SocketManager.Send(charactersListRequestMessage); } }
public static void GameActionFightDeathMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightDeathMessage msg = (GameActionFightDeathMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.FightData.SetFighterDeath(msg.targetId); }
public static void GameActionFightDispellableEffectMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightDispellableEffectMessage msg = (GameActionFightDispellableEffectMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.FightData.SetEffect(msg.effect, msg.actionId); }
public static void InventoryContentAndPresetMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { InventoryContentAndPresetMessage msg = (InventoryContentAndPresetMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } foreach (ObjectItem item in msg.objects) { Core.Inventory.Item i = new Core.Inventory.Item(item.Effects.ToList(), item.ObjectGID, item.Position, item.Quantity, 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(); } } account.Log(new BotTextInformation("Vos " + account.petsList.Count + " familiers vous font un gros bisou de la part de BlueSheep."), 5); 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((sbyte)7, false); account.SocketManager.Send(channelEnablingMessage); } }
public static void GameActionFightPointsVariationMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightPointsVariationMessage msg = (GameActionFightPointsVariationMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.FightData.SetPointsVariation(msg.targetId, msg.actionId, msg.delta); }
public static void HelloGameMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { if (!account.IsMITM) { AuthenticationTicketMessage authenticationTicketMessage = new AuthenticationTicketMessage(GameConstants.Lang, account.Ticket); account.SocketManager.Send(authenticationTicketMessage); } }
public static void GameActionFightLifePointsLostMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightLifePointsLostMessage msg = (GameActionFightLifePointsLostMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.FightData.UpdateFighterLifePoints(msg.targetId, -msg.loss); }
public static void IdentificationFailedBannedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { IdentificationFailedBannedMessage msg = (IdentificationFailedBannedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Log(new ConnectionTextInformation("Echec de connexion : Vous êtes bannis."), 0); account.SocketManager.DisconnectFromGUI(); }
public static void CharacterLevelUpMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { CharacterLevelUpMessage msg = (CharacterLevelUpMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.ModifBar(8, 0, 0, Convert.ToString(msg.newLevel)); account.Log(new BotTextInformation("Level up ! New level : " + Convert.ToString(msg.newLevel)), 3); }
public static void GameContextRemoveElementMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ExchangeStartOkNpcShopMessage msg = (ExchangeStartOkNpcShopMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.ModifBar(6, 0, 0, "Echange"); }
public static void NpcDialogCreationMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { LeaveDialogMessage msg = (LeaveDialogMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.SetStatus(Status.None); }
public static void CharacterSelectedForceMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { CharacterSelectedForceMessage msg = (CharacterSelectedForceMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } CharacterSelectedForceReadyMessage nmsg = new CharacterSelectedForceReadyMessage(); account.SocketManager.Send(nmsg); }
public static void AccountLoggingKickedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { AccountLoggingKickedMessage btmsg = (AccountLoggingKickedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { btmsg.Deserialize(reader); } account.Log(new ErrorTextInformation(String.Format("Compte banni {0} jours, {1} heures, {2} minutes :'( ", btmsg.days, btmsg.hours, btmsg.minutes)), 0); }
public static void NpcDialogCreationMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { LeaveDialogMessage msg = (LeaveDialogMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.ModifBar(6, 0, 0, "Connecté"); }
public static void ExchangeShopStockStartedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ExchangeShopStockStartedMessage msg = (ExchangeShopStockStartedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.actualizeshop(msg.objectsInfos.ToList()); if (account.NeedToAddItem()) { account.addItemToShop(); } }
public static void CheckIntegrityMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { //using (BigEndianWriter writer = new BigEndianWriter()) //{ // writer.WriteBytes(packetDatas); // MessagePackaging pack = new MessagePackaging(writer); // pack.Pack(6372); // account.SocketManager.Send(pack.Writer.Content); // account.Log(new BotTextInformation("Raw data traité avec succès."), 0); //} }
public static void LeaveDialogMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { NpcDialogCreationMessage msg = (NpcDialogCreationMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Npc.Id = msg.npcId; account.Npc.Entity = account.MapData.Npcs.FirstOrDefault((npc) => npc.contextualId == msg.npcId); account.SetStatus(Status.Speaking); }
public static void AchievementFinishedTreatment(Message message, byte[] packetDatas, AccountUC account) { AchievementFinishedMessage msg = (AchievementFinishedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } DataClass d = GameData.GetDataObject(D2oFileEnum.Achievements, msg.id); account.Log(new ActionTextInformation("Succès débloqué : " + I18N.GetText((int)d.Fields["nameId"])),3); AchievementRewardRequestMessage nmsg = new AchievementRewardRequestMessage(-1); account.SocketManager.Send(nmsg); }
public static void BasicAckMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { BasicAckMessage basicAckMessage = (BasicAckMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { basicAckMessage.Deserialize(reader); } account.LastPacketID.Enqueue(basicAckMessage.lastPacketId); account.LastPacket = basicAckMessage.lastPacketId; }
public static void QueueStatusMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { QueueStatusMessage queueStatusMessage = (QueueStatusMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { queueStatusMessage.Deserialize(reader); } account.Log(new QueueTextInformation("File d'attente : " + queueStatusMessage.position + "/" + queueStatusMessage.total + "."),0); }
public static void LeaveDialogMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { NpcDialogCreationMessage msg = (NpcDialogCreationMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Npc.Id = msg.npcId; account.Npc.Entity = account.Map.Entities.FirstOrDefault((npc) => npc.Id == msg.npcId); account.ModifBar(6, 0, 0, "Dialogue"); }
public static void RawDataMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { //TODO : Bypass this f*****g anti-bot Random random = new Random(); int randomNumber = (int)Math.Floor(random.NextDouble() * 16777215); CheckIntegrityMessage checkIntegrityMessage = new CheckIntegrityMessage(new List<int>() {randomNumber} ); using (BigEndianWriter writer = new BigEndianWriter()) { checkIntegrityMessage.Serialize(writer); MessagePackaging messagePackaging = new MessagePackaging(writer); messagePackaging.Pack((int)checkIntegrityMessage.ProtocolID); account.SocketManager.Send(messagePackaging.Writer.Content); } //using (BigEndianReader reader = new BigEndianReader(packetDatas)) //{ // byte[] content = reader.ReadBytes((int)reader.BytesAvailable); // string d = DateTime.Now.ToShortDateString().Replace('\\', '-').Replace('/', '-'); // File.WriteAllBytes(@"F:\RDMs\" + d + "_RDM.swf", content); // //account.SocketManager.Disconnect(); //} //using (BigEndianWriter writer = new BigEndianWriter()) //{ // TrustStatusMessage tsm = new TrustStatusMessage(true); // tsm.Serialize(writer); // writer.WriteUTF(account.Ticket); // MessagePackaging pack = new MessagePackaging(writer); // pack.Pack((int)tsm.ProtocolID); // account.SocketManager.SendRaw(pack.Writer.Content); //} //using (BigEndianWriter writer = new BigEndianWriter()) //{ // writer.WriteBytes(packetDatas); // MessagePackaging pack = new MessagePackaging(writer); // pack.Pack(6253); // account.SocketManager.SendRaw(pack.Writer.Content); //} // System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create(); // byte[] hash = md5.ComputeHash(pack.Writer.Content); // StringBuilder sb = new StringBuilder(); // for (int i = 0; i < hash.Length; i++) // { // sb.Append(hash[i].ToString("X2")); // } // System.Windows.Forms.MessageBox.Show(sb.ToString()); //} }
/// <summary> /// Serialize and pack the message, and send it. /// </summary> public void Send(BlueSheep.Engine.Types.Message msg) { using (BigEndianWriter writer = new BigEndianWriter()) { msg.Serialize(writer); MessagePackaging pack = new MessagePackaging(writer); pack.Pack((int)msg.ProtocolID); account.SocketManager.Send(pack.Writer.Content); if (account.DebugMode.Checked) { account.Log(new DebugTextInformation("[SND] " + msg.ProtocolID), 0); } } }
public static void GameActionFightLifePointsGainMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameActionFightLifePointsGainMessage msg = (GameActionFightLifePointsGainMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (account.state == Status.Fighting) { if (msg.actionId == 108) // HP Récupérés (delta = combien on a récupérés) { account.FightData.UpdateFighterLifePoints(msg.targetId, msg.delta); } } }
public void AnalysePacket(BlueSheep.Engine.Types.Message msg, byte[] packetdatas) { using (BigEndianReader reader = new BigEndianReader(packetdatas)) { msg.Deserialize(reader); } switch ((int)msg.ProtocolID) { case 226: MapComplementaryInformationsDataMessage packet = (MapComplementaryInformationsDataMessage)msg; //if (this.GoAnalyser((int)packet.SubAreaId)) //{ foreach (GameRolePlayActorInformations informations in packet.actors) { GameRolePlayCharacterInformations infos; if (!(informations is GameRolePlayCharacterInformations)) { continue; } else { infos = (GameRolePlayCharacterInformations)informations; } if (this.GoAgro(infos)) { Agression(informations.contextualId); } if (this.IsGoingToRun(infos)) { if (this.Disconnecting.Checked) { account.SocketManager.DisconnectFromGUI(); } else if (this.UsingItem.Checked && (this.UsedItem.Text.Length > 0)) { Run(); } } } break; case 5632: GameRolePlayShowActorMessage npacket = (GameRolePlayShowActorMessage)msg; GameRolePlayCharacterInformations infoCharacter = npacket.informations as GameRolePlayCharacterInformations; if (this.GoAgro(infoCharacter)) { Agression(infoCharacter.contextualId); } if (this.IsGoingToRun(infoCharacter)) { if (this.Disconnecting.Checked) { account.SocketManager.DisconnectFromGUI(); } else if (this.UsingItem.Checked && (this.UsedItem.Text.Length > 0)) { Run(); } } break; } }