Example #1
0
        public void SaveNameInMemory(BlueSheep.Common.Protocol.Types.GameRolePlayCharacterInformations infos)
        {
            string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BlueSheep", "Accounts", account.AccountName, "Flood");
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            try
            {
                if (listOfPlayers.Count > 0)
                {
                    if (listOfPlayers.Keys.ToList().Find(p => p == infos.name) != null)
                    {
                        account.Log(new ErrorTextInformation("[ADVANCED FLOOD] Player already loaded !"), 5);
                        return;
                    }
                }
                var swriter = new StreamWriter(path + @"\Players.txt", true);
                int level = Math.Abs((infos.alignmentInfos.characterPower - infos.contextualId));
                swriter.WriteLine(infos.name + "," + Convert.ToString(level));
                swriter.Close();
                listOfPlayers.Add(infos.name, level);
                account.FloodUC.AddItem(infos.name + "," + Convert.ToString(level));
                account.Log(new BotTextInformation("[ADVANCED FLOOD] Player added."), 5);
            }
            catch (Exception ex)
            {
                account.Log(new ErrorTextInformation("[ADVANCED FLOOD] Unable to add the player."), 5);
                account.Log(new ErrorTextInformation(ex.ToString()), 5);
            }
        }
Example #2
0
        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;

            }
        }
Example #3
0
 // Methods
 public Pathfinder(BlueSheep.Data.D2p.Map Map, Map map)
 {
     this.Map = map;
     this.MapData = Map;
     if (Map.Id == 2561)
     {
         this.ListCellIdFighters.Add(53);
     }
 }
Example #4
0
 /// <summary>
 /// Update the state of an Stated element.
 /// </summary>
 public void UpdateStatedElement(BlueSheep.Common.Protocol.Types.StatedElement element)
 {
     Elements.StatedElement Selement = new Elements.StatedElement((uint)element.elementCellId, (uint)element.elementId,(uint)element.elementState);
     if (StatedElements.Find(s => s.Id == Selement.Id) != null)
         StatedElements.Find(s => s.Id == Selement.Id).State = Selement.State;
     else
         StatedElements.Add(Selement);
 }
Example #5
0
 /// <summary>
 /// Update the state of an interactive element.
 /// </summary>
 public void UpdateInteractiveElement(BlueSheep.Common.Protocol.Types.InteractiveElement element)
 {
     Elements.InteractiveElement Ielement = new Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List<InteractiveElementSkill>(element.enabledSkills), new List<InteractiveElementSkill>(element.disabledSkills));
     Tuple<Elements.InteractiveElement, int> temp = new Tuple<Elements.InteractiveElement, int>(null, 0);
     foreach (KeyValuePair<Elements.InteractiveElement, int> pair in InteractiveElements)
     {
         if (pair.Key.Id == Ielement.Id)
             temp = new Tuple<Elements.InteractiveElement, int>(pair.Key, pair.Value);
     }
     if (temp.Item1 != null)
     {
         InteractiveElements.Remove(temp.Item1);
         InteractiveElements.Add(Ielement, temp.Item2);
     }
     else
         InteractiveElements.Add(Ielement, -1);
 }
Example #6
0
 /// <summary>
 /// Parse the stated elements array from MapComplementaryInformationsDataMessage.
 /// </summary>
 public void ParseStatedElements(BlueSheep.Common.Protocol.Types.StatedElement[] statedElements)
 {
     foreach (var statedElementDofus in statedElements)
     {
          StatedElements.Add(new BlueSheep.Core.Map.Elements.StatedElement((uint)statedElementDofus.elementCellId, (uint)statedElementDofus.elementId, (uint)statedElementDofus.elementState));
     }
 }
Example #7
0
 /// <summary>
 /// Parse the interactive elements array from MapComplementaryInformationsDataMessage.
 /// </summary>
 public void ParseInteractiveElements(BlueSheep.Common.Protocol.Types.InteractiveElement[] interactiveElements)
 {
     foreach (BlueSheep.Common.Protocol.Types.InteractiveElement element in interactiveElements)
     {
         if (element.elementTypeId == 85)
             m_Account.Safe = element;
         Elements.InteractiveElement Ielement = new Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List<InteractiveElementSkill>(element.enabledSkills), new List<InteractiveElementSkill>(element.disabledSkills));
         InteractiveElements.Add(Ielement, -1);
         if (Ielement.EnabledSkills.Count > 0)
         {
             foreach (var layer in this.Data.Layers)
             {
                 foreach (var cell in layer.Cells)
                 {
                     foreach (var layerElement in cell.Elements)
                     {
                         if (layerElement is GraphicalElement)
                         {
                             GraphicalElement graphicalElement = (GraphicalElement)layerElement;
                             if (graphicalElement.Identifier == Ielement.Id)
                                 InteractiveElements[Ielement] = cell.CellId;
                         }
                     }
                 }
             }
         }
     }
 }
Example #8
0
 public void SendPrivateTo(BlueSheep.Common.Protocol.Types.GameRolePlayCharacterInformations infos, string content = "")
 {
     if (content == "")
         content = account.FloodUC.FloodContent;
     int level = Math.Abs((infos.alignmentInfos.characterPower - infos.contextualId));
     content = content.Replace("%name%", infos.name).Replace("%level%", Convert.ToString(level));
     if (account.FloodUC.IsRandomingSmileyBox.Checked == true)
         content = AddRandomSmiley(content);
     if (account.FloodUC.IsRandomingNumberBox.Checked == true)
         content = AddRandomNumber(content);
     SendPrivateTo(infos.name, content);
     account.FloodUC.Increase(true);
 }
Example #9
0
 /// <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);
     }
 }