public static void ObjectModifiedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ObjectModifiedMessage msg = (ObjectModifiedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } for (int index = 0; index < account.Inventory.Items.Count; index++) { if (account.Inventory.Items[index].UID == msg.Object.ObjectUID) { account.Inventory.Items[index] = new Core.Inventory.Item(msg.Object.Effects, msg.Object.ObjectGID, msg.Object.Position, (int)msg.Object.Quantity, (int)msg.Object.ObjectUID, account); } } DataClass ItemData = GameData.GetDataObject(D2oFileEnum.Items, msg.Object.ObjectGID); if ((int)ItemData.Fields["typeId"] == 18) { Pet pet = new Pet(new Core.Inventory.Item(msg.Object.Effects.ToList(), msg.Object.ObjectGID, msg.Object.Position, (int)msg.Object.Quantity, (int)msg.Object.ObjectUID, account), ItemData, account); if (account.PetsModifiedList == null) { account.PetsModifiedList = new List <Pet>(); } account.PetsModifiedList.Add(pet); account.Log(new ActionTextInformation("Familier nourri : " + BlueSheep.Common.Data.I18N.GetText((int)ItemData.Fields["nameId"]) + " " + "."), 3); } }
private void LaunchPath(object sender, EventArgs e) { if (FilesList.SelectedItems.Count > 0 & Account != null) { //Account.selectedfile = FilesList.SelectedItems[0].SubItems[3].Text; Account.Path = new Core.Path.PathManager(Account, FilesList.SelectedItems[0].SubItems[5].Text, FilesList.SelectedItems[0].SubItems[0].Text); //Account.Path.Stop = true; Account.Log(new BotTextInformation("Trajet chargé : " + FilesList.SelectedItems[0].Text), 0); Account.Path.pathBot = FilesList.SelectedItems[0].Text; if (Account.Fight == null) { Account.Log(new ErrorTextInformation("WARNING : T'as chargé aucune IA, fait gaffe mon coco :p"), 0); } this.Close(); } }
public void Init(AccountUC account) { int skillUID = 0; foreach (InteractiveElementSkill skill in account.Safe.enabledSkills) { if (skill.skillId == 104) { skillUID = skill.skillInstanceUid; break; } } InteractiveUseRequestMessage interactiveUseRequestMessage = new InteractiveUseRequestMessage( account.Safe.elementId, skillUID); using (BigEndianWriter writer = new BigEndianWriter()) { interactiveUseRequestMessage.Serialize(writer); writer.Content = account.HumanCheck.hash_function(writer.Content); MessagePackaging messagePackaging = new MessagePackaging(writer); messagePackaging.Pack((int)interactiveUseRequestMessage.ProtocolID); account.SocketManager.Send(messagePackaging.Writer.Content); account.LastPacketID.Clear(); if (account.DebugMode.Checked) { account.Log(new BlueSheep.Interface.Text.DebugTextInformation("[SND] 5001 (InteractiveUseRequestMessage)"), 0); } } }
private void Say(string sentence) { using (BigEndianWriter writer = new BigEndianWriter()) { ChatClientMultiMessage msg = new ChatClientMultiMessage(sentence, (sbyte)0); msg.Serialize(writer); writer.Content = account.HumanCheck.hash_function(writer.Content); 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] 861 (ChatClientMultiMessage)"), 0); } } }
public FloodUC(AccountUC account) { InitializeComponent(); m_Account = account; string pathPlayers = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BlueSheep", "Accounts", m_Account.AccountName, "Flood"); if (!Directory.Exists(pathPlayers)) Directory.CreateDirectory(pathPlayers); PrivateExitBox.Hide(); FloodContent = ""; Dictionary<string, int> temp = new Dictionary<string, int>(); if (File.Exists(pathPlayers + @"\Players.txt")) { var sr = new StreamReader(pathPlayers + @"\Players.txt"); while (!sr.EndOfStream) { string line = sr.ReadLine(); string[] parsed = line.Split(','); if (parsed.Length > 1) { temp.Add(parsed[0], int.Parse(parsed[1])); PlayerListLb.Items.Add(line); } else { sr.Close(); File.Delete(pathPlayers + @"\Players.txt"); return; } } sr.Close(); m_Account.Log(new DebugTextInformation("[ADVANCED FLOOD] Players loaded."), 5); } }
public void Treat(int packetID, byte[] packetDatas) { List <InstanceInfo> enqueue = new List <InstanceInfo>(); foreach (InstanceInfo instance in m_Instances) { if (instance.ProtocolID == packetID) { enqueue.Add(instance); } } foreach (InstanceInfo instance in enqueue) { Message message = (Message)Activator.CreateInstance(instance.MessageType); MethodInfo method = instance.Method; if (account.DebugMode.Checked) { account.Log(new BotTextInformation("[RCV] " + packetID + " (" + method.Name.Remove(method.Name.IndexOf("Treatment")) + ")"), 0); } if (method == null) { return; } object[] parameters = { message, packetDatas, account }; method.Invoke(null, parameters); } }
public static void ObjectAddedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ObjectAddedMessage msg = (ObjectAddedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } ObjectItem item = msg.Object; Core.Inventory.Item i = new Core.Inventory.Item(item.Effects, item.ObjectGID, item.Position, (int)item.Quantity, (int)item.ObjectUID, account); account.Inventory.Items.Add(i); string[] row1 = { i.GID.ToString(), i.UID.ToString(), i.Name, i.Quantity.ToString(), i.Type.ToString(), i.Price.ToString() }; System.Windows.Forms.ListViewItem li = new System.Windows.Forms.ListViewItem(row1); li.ToolTipText = i.Description; account.AddItem(li, account.LVItems); if (i.Type == "Sac de ressource") { foreach (JobUC uc in account.JobsUC) { if (uc.OpenBagCb.Checked) { account.Inventory.UseItem(i.UID); account.Log(new ActionTextInformation("Ouverture automatique d'un sac de récolte : " + i.Name), 2); } } } if (account.Running != null) { foreach (Pet pet in account.petsList) { pet.SetFood(); } } }
public static void ObtainedItemMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { ObtainedItemMessage msg = (ObtainedItemMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (account.Gather.resourceName == "Unknown") { return; } account.SetStatus(Status.None); account.Log(new ActionTextInformation("Ressource récoltée : " + account.Gather.resourceName + " +" + msg.baseQuantity), 3); if (account.Gather.Stats.ContainsKey(account.Gather.resourceName)) { account.Gather.Stats[account.Gather.resourceName] += msg.baseQuantity; } else { account.Gather.Stats.Add(account.Gather.resourceName, msg.baseQuantity); } account.Gather.Current_Job.ActualizeStats(account.Gather.Stats); if (account.PerformGather() == false && account.Path != null) { account.Path.PerformActionsStack(); } }
public void PulseRegen() { if (((m_Account.CharacterStats.lifePoints / m_Account.CharacterStats.maxLifePoints) * 100) < m_Account.RegenChoice.Value) { m_Account.SetStatus(Status.Regenerating); List <Item> items = GetRegenItems(); if (items.Count > 0) { if (UseItems(items)) { m_Account.Wait(500, 1000); PulseRegen(); return; } } int maxLife = Convert.ToInt32(m_Account.CharacterStats.maxLifePoints); int life = Convert.ToInt32(m_Account.CharacterStats.lifePoints); int time = Convert.ToInt32(Math.Round(Convert.ToDecimal(maxLife - life) / 2)); BlueSheep.Common.Protocol.Messages.EmotePlayRequestMessage msg = new BlueSheep.Common.Protocol.Messages.EmotePlayRequestMessage(1); m_Account.SocketManager.Send(msg); m_Account.Log(new GeneralTextInformation(String.Format("Régénération pendant {0} secondes.", time)), 2); m_Account.Wait(time * 1000, (time + 1) * 1000); if (m_Account.Path != null && m_Account.Path.Launched) { m_Account.Path.ParsePath(); } } }
private void PerformAutoDeletion(object sender, System.Timers.ElapsedEventArgs e) { if (LVGestItems.InvokeRequired) { Invoke(new AutoDeleteCallback(PerformAutoDeletion), sender, e); return; } if (account.state == BlueSheep.Engine.Enums.Status.Fighting) { account.Log(new ErrorTextInformation("La suppression automatique ne peut être effectuée en combat. Suppression automatique annulée. Mais elle reviendra muéhhééhhé"), 2); Reset(); return; } if (LVGestItems.Items.Count > 0) { foreach (ListViewItem item in LVGestItems.Items) { if (item.SubItems[1].Text == "Suppression automatique") { BlueSheep.Core.Inventory.Item i = account.Inventory.GetItemFromName(item.SubItems[0].Text); if (i != null) { account.Inventory.DeleteItem(i.UID, i.Quantity); } } } Reset(); } else { Reset(); } }
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 BasicLatencyStatsRequestMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { BasicLatencyStatsMessage basicLatencyStatsMessage = new BasicLatencyStatsMessage((ushort)account.LatencyFrame.GetLatencyAvg(), account.LatencyFrame.GetSamplesCount(), account.LatencyFrame.GetSamplesMax()); //account.Log(new BotTextInformation("ROLEPLEY RECU"),0); //BasicLatencyStatsMessage basicLatencyStatsMessage = new BasicLatencyStatsMessage(account.LatencyFrame.RolePley(), // account.LatencyFrame.GetSamplesCount(), account.LatencyFrame.GetSamplesMax()); if (!account.IsMITM) { using (BigEndianWriter writer = new BigEndianWriter()) { basicLatencyStatsMessage.Serialize(writer); writer.Content = account.HumanCheck.hash_function(writer.Content); MessagePackaging messagePackaging = new MessagePackaging(writer); messagePackaging.Pack((int)basicLatencyStatsMessage.ProtocolID); account.SocketManager.Send(messagePackaging.Writer.Content); if (account.DebugMode.Checked) { account.Log(new BlueSheep.Interface.Text.DebugTextInformation("[SND] 5663 (BasicLatencyStatsMessage)"), 0); } } } }
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 void DeleteItem(int uid, int quantity) { if (ItemExists(uid) && ItemQuantity(uid) > 0) { ObjectDeleteMessage msg = new ObjectDeleteMessage(uid, quantity); Account.SocketManager.Send(msg); Account.Log(new ActionTextInformation("Suppression de " + GetItemFromUID(uid).Name + "(x" + quantity + ")."), 2); } }
/// <summary> /// Define the required parameters that the user of the program /// must provide. /// </summary> /// <param name="expectedParams"> /// The list of the required parameters. /// </param> private void DefineRequiredParameters(string[] requiredParameterNames) { CLIParser.requiredParameters = new Dictionary <string, string>(); foreach (string param in requiredParameterNames) { string temp = param; temp = temp.Trim(); if (string.IsNullOrEmpty(param)) { string ERRORMessage = "ERROR: The required command line parameter '" + param + "' is empty."; account.Log(new ErrorTextInformation(ERRORMessage), 0); } CLIParser.requiredParameters.Add(param, string.Empty); } }
public static void ExchangeErrorMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { account.Log(new CharacterTextInformation("Echec de l'ouverture du coffre."), 0); if (account.Running != null) { account.Running.OnSafe = false; } }
private void FloodPlayersBt_Click(object sender, EventArgs e) { this.FloodContent = this.FloodContentRbox.Text; foreach (var elem in PlayerListLb.Items) { try { string[] parsed = ((string)elem).Split(','); this.FloodContent = this.FloodContent.Replace("%name%", parsed[0]).Replace("%level%", parsed[1]); m_Account.Flood.SendPrivateTo((string)parsed[0], this.FloodContent); } catch (Exception) { m_Account.Log(new ErrorTextInformation("Impossible d'envoyer le message à: " + (string)elem), 3); } } }
public void CheckStatisticsUp() { foreach (Pet petModified in account.PetsModifiedList) { if (m_CurrentPetIndex >= account.petsList.Count) { continue; } if (petModified.Informations.UID == account.petsList[m_CurrentPetIndex].Informations.UID) { Pet pet = account.petsList[m_CurrentPetIndex]; if (pet.Effect != petModified.Effect) { account.Log(new ActionTextInformation("Up de caractéristique, " + petModified.Datas.Name + " " + petModified.Informations.UID + "."), 4); m_Feeding.SecondFeeding = true; } else { m_Feeding.SecondFeeding = false; } break; } } 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 petToAdd = new Pet(item, itemData, account); account.petsList.Add(petToAdd); } } account.PetsModifiedList = null; Init(); }
public static void CharacterSelectedSuccessMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { CharacterSelectedSuccessMessage characterSelectedSuccessMessage = (CharacterSelectedSuccessMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { characterSelectedSuccessMessage.Deserialize(reader); } account.CharacterBaseInformations = characterSelectedSuccessMessage.Infos; account.Log(new BotTextInformation(account.CharacterBaseInformations.Name + " de niveau " + account.CharacterBaseInformations.Level + " est connecté."), 1); account.Log(new BotTextInformation("Breed: " + ((BreedEnum)account.CharacterBaseInformations.Breed).Description() + " Sex: " + ((Sex)Convert.ToInt32(account.CharacterBaseInformations.Sex)).Description()), 1); account.ModifBar(7, 0, 0, account.AccountName + " - " + account.CharacterBaseInformations.Name); account.ModifBar(8, 0, 0, Convert.ToString(account.CharacterBaseInformations.Level)); //MainForm.ActualMainForm.ActualizeAccountInformations(); }
public static void TextInformationTreatment(Message message, byte[] packetDatas, AccountUC account) { TextInformationMessage msg = (TextInformationMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } switch (msg.msgId) { case 89: 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."), 1); break; case 153: account.Log(new DofInfoCanal("Votre adresse ip actuelle est " + msg.parameters[0]), 0); break; case 171: account.Log(new ErrorTextInformation(string.Format("Impossible de lancer ce sort, vous avez une portée de {0} à {1}, et vous visez à {2} !", msg.parameters[0], msg.parameters[1], msg.parameters[2])), 4); break; case 34: account.Log(new ErrorTextInformation(string.Format("Vous avez perdu {0} points d'énergie", msg.parameters[0])), 0); account.Log(new ErrorTextInformation("Combat perdu"), 0); if (account.Fight != null) { account.Fight.winLoseDic["Perdu"]++; account.ActualizeFightStats(account.Fight.winLoseDic, account.Fight.xpWon); } break; } //default: //DataClass data = GameData.GetDataObjects(D2oFileEnum.InfoMessages)[msg.msgType * 10000 + msg.msgId]; //string text = I18N.GetText((int)data.Fields["textId"]); //for (int i = 0; i < msg.parameters.Length; i++) //{ // var parameter = msg.parameters[i]; // text = text.Replace("%" + (i + 1), parameter); //} //account.Log(new DofAlertTextInformation(text), 0); }
public bool HasRightTool() { bool h = job.HasRightTool(); if (!h) { account.Log(new ErrorTextInformation("L'outil n'est pas équipé :( "), 0); } return(h); }
public static void AuthenticationTicketAcceptedRefusedTreatment(Message message, byte[] packetDatas, AccountUC account) { AuthenticationTicketRefusedMessage msg = new AuthenticationTicketRefusedMessage(); using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Log(new ErrorTextInformation("Error : Authentication Ticket Refused"), 0); }
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 void ParseBuffer(byte[] data) { m_Reader.Add(data, 0, data.Length); if (m_Reader.BytesAvailable <= 0) { return; } while (m_Reader.BytesAvailable != 0) { if (Build()) { if ((account.IsMITM) && (!ForbiddenHeaders.Contains((int)m_ProtocolID))) { using (BigEndianWriter writer = new BigEndianWriter()) { writer.WriteBytes(m_Data); MessagePackaging pack = new MessagePackaging(writer); pack.Pack((int)m_ProtocolID); account.SocketManager.SendToDofusClient(pack.Writer.Content); account.Log(new BotTextInformation("SND (-> Dof) " + m_ProtocolID), 0); } } //using ( // StreamWriter fileWriter = // new StreamWriter( // Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + // @"\BlueSheep\Packets.txt", true)) // fileWriter.WriteLine("[" + DateTime.Now.ToShortTimeString() + "] Paquet reçu : " + m_ProtocolID); Treatment.Treatment treatment = new Treatment.Treatment(account); if (m_ProtocolID == 6372) { using (BigEndianWriter writer = new BigEndianWriter()) { writer.WriteBytes(m_Data); MessagePackaging pack = new MessagePackaging(writer); pack.Pack(6372); account.SocketManager.Send(pack.Writer.Content); } } if (m_ProtocolID != null) { treatment.Treat(m_ProtocolID.Value, m_Data); } m_Header = null; m_Length = null; m_Data = null; m_LenghtType = null; m_ProtocolID = null; } else { break; } } }
public static void GameFightTurnEndMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { GameFightTurnEndMessage msg = (GameFightTurnEndMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } if (msg.id == account.CharacterBaseInformations.id) { int num4 = 0; List <int> list = new List <int>(); account.Fight.IsFighterTurn = false; account.Fight.TotalLaunchBySpell.Clear(); //Nettoyage des variables de vérification de lancement d'un sort account.Fight.TotalLaunchByCellBySpell.Clear(); //Nettoyage des variables de vérification de lancement d'un sort for (int i = 0; i < account.Fight.DurationByEffect.Keys.Count; i++) { Dictionary <int, int> durationPerEffect = account.Fight.DurationByEffect; num4 = Enumerable.ElementAtOrDefault <int>(account.Fight.DurationByEffect.Keys, i); durationPerEffect[num4] = (durationPerEffect[num4] - 1); if (account.Fight.DurationByEffect[Enumerable.ElementAtOrDefault <int>(account.Fight.DurationByEffect.Keys, i)] <= 0) { list.Add(Enumerable.ElementAtOrDefault <int>(account.Fight.DurationByEffect.Keys, i)); } } while (list.Count > 0) { account.Fight.DurationByEffect.Remove(list[0]); list.RemoveAt(0); } for (int i = 0; i < account.Fight.LastTurnLaunchBySpell.Keys.Count; i++) { Dictionary <int, int> dictionary = account.Fight.LastTurnLaunchBySpell; num4 = Enumerable.ElementAtOrDefault <int>(account.Fight.LastTurnLaunchBySpell.Keys, i); dictionary[num4] = (dictionary[num4] - 1); if (account.Fight.LastTurnLaunchBySpell[Enumerable.ElementAtOrDefault <int>(account.Fight.LastTurnLaunchBySpell.Keys, i)] <= 0) { list.Add(Enumerable.ElementAtOrDefault <int>(account.Fight.LastTurnLaunchBySpell.Keys, i)); } } while (list.Count > 0) { account.Fight.LastTurnLaunchBySpell.Remove(list[0]); list.RemoveAt(0); } account.Log(new BotTextInformation("Fin du tour"), 5); } BFighter fighter = (BFighter)account.Fight.GetFighter(msg.id); if (fighter != null) { fighter.ActionPoints = fighter.GameFightMinimalStats.maxActionPoints; fighter.MovementPoints = fighter.GameFightMinimalStats.maxMovementPoints; } }
public static void SelectedServerDataExtendedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { SelectedServerDataExtendedMessage msg = (SelectedServerDataExtendedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } //account.Log(new BotTextInformation(selectedServerDataExtendedMessage.address + " " + (int)selectedServerDataExtendedMessage.port)); account.Ticket = AES.AES.TicketTrans(msg.Ticket).ToString(); account.HumanCheck = new HumanCheck(account); account.SocketManager.IsChangingServer = true; if (!account.IsMITM) { account.Log(new ConnectionTextInformation("Connexion au serveur " + BlueSheep.Common.Data.I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Servers, msg.ServerId).Fields["nameId"])), 0); account.SocketManager.Connect(new ConnectionInformations(msg.Address, (int)msg.Port, "de jeu")); account.loginstate = "de jeu"; } else { SelectedServerDataExtendedMessage nmsg = new SelectedServerDataExtendedMessage(msg.CanCreateNewCharacter, msg.ServerId, msg.Address, msg.Port, msg.Ticket, msg.ServerIds); using (BigEndianWriter writer = new BigEndianWriter()) { nmsg.Serialize(writer); MessagePackaging pack = new MessagePackaging(writer); pack.Pack((int)nmsg.MessageID); account.SocketManager.SendToDofusClient(pack.Writer.Content); //account.SocketManager.DisconnectFromDofusClient(); account.SocketManager.DisconnectServer("42 packet handling."); account.SocketManager.ListenDofus(); account.Wait(100, 200); } account.Log(new ConnectionTextInformation("Connexion au serveur " + BlueSheep.Common.Data.I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Servers, msg.ServerId).Fields["nameId"])), 0); account.SocketManager.Connect(new ConnectionInformations(msg.Address, (int)msg.Port, "de jeu")); account.loginstate = "de jeu"; } }
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 SystemMessageDisplayMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { SystemMessageDisplayMessage msg = (SystemMessageDisplayMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } msg.Parameters.ForEach(item => account.Log(new DofAlertTextInformation(item), 0)); // account.SocketManager.Disconnect("Alerte au modo ! Alerte au modo !"); }
public static void PopupWarningMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { PopupWarningMessage msg = (PopupWarningMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } account.Log(new ErrorTextInformation("Y a un popup sur l'écran, surement un modo :s"), 0); account.SocketManager.DisconnectFromGUI(); }
private void ThrowIfERRORs() { StringBuilder ERRORMessage = new StringBuilder(); if (missingRequiredParameters.Count > 0 || missingValue.Count > 0 || rawArguments.Count > 0) { ERRORMessage.Append("ERROR: Processing Command Line Arguments\n"); } if (missingRequiredParameters.Count > 0) { ERRORMessage.Append("Missing Required Parameters\n"); foreach (string missingParam in missingRequiredParameters) { ERRORMessage.Append("\t" + missingParam + "\n"); } } if (missingValue.Count > 0) { ERRORMessage.Append("Missing Values\n"); foreach (string value in missingValue) { ERRORMessage.Append("\t" + value + "\n"); } } if (rawArguments.Count > 0) { ERRORMessage.Append("Unknown Parameters"); foreach (string unknown in rawArguments) { ERRORMessage.Append("\t" + unknown + "\n"); } } if (ERRORMessage.Length > 0) { account.Log(new ErrorTextInformation(ERRORMessage.ToString()), 0); } }
public static void IdentificationFailedMessageTreatment(Message message, byte[] packetDatas, AccountUC account) { IdentificationFailedMessage identificationFailedMessage = (IdentificationFailedMessage)message; account.Log(new ErrorTextInformation("Echec de l'identification."), 0); using (BigEndianReader reader = new BigEndianReader(packetDatas)) { identificationFailedMessage.Deserialize(reader); } IdentificationFailureReasonEnum.Test(identificationFailedMessage.reason, account); account.SocketManager.DisconnectFromGUI(); }