コード例 #1
0
ファイル: Opening.cs プロジェクト: Sadikk/BlueSheep
        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);
            }
        }
コード例 #2
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;
         }
     }
 }
コード例 #3
0
ファイル: HouseBuy.cs プロジェクト: DjTrilogic/BlueSheep
 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);
     }
 }
コード例 #4
0
ファイル: HouseBuy.cs プロジェクト: DjTrilogic/BlueSheep
 public void UseHouse()
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         InteractiveUseRequestMessage msg = new InteractiveUseRequestMessage(ElementIdd,SkillInstanceID);
         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);
     }
 }
コード例 #5
0
ファイル: Leaving.cs プロジェクト: DjTrilogic/BlueSheep
        public void Init()
        {
            int quantity = 0;
            int objectUID = 0;

            foreach (BlueSheep.Core.Inventory.Item item in account.Inventory.Items)
            {
                bool isFood = false;

                foreach (Pet pet in account.petsList)
                {
                    foreach (Food food in pet.FoodList)
                    {
                        if (item.UID == food.Informations.UID)
                        {
                            isFood = true;
                            break;
                        }
                    }
                }

                if (isFood)
                {
                    quantity = item.Quantity;
                    objectUID = item.UID;
                    break;
                }
            }

            if (objectUID == 0)
            {
                account.Running.GettingFoodFromSafe();
                return;
            }

            account.Running.OnLeaving = true;

            ExchangeObjectMoveMessage exchangeObjectMoveMessage =
                new ExchangeObjectMoveMessage(objectUID, quantity);

            using (BigEndianWriter writer = new BigEndianWriter())
            {
                exchangeObjectMoveMessage.Serialize(writer);

                MessagePackaging messagePackaging = new MessagePackaging(writer);

                messagePackaging.Pack((int)exchangeObjectMoveMessage.ProtocolID);

                account.SocketManager.Send(messagePackaging.Writer.Content);
                account.LastPacketID.Clear();
            }
        }
コード例 #6
0
ファイル: SecurityHandler.cs プロジェクト: Sadikk/BlueSheep
        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());
            //}
        }
コード例 #7
0
ファイル: HouseBuy.cs プロジェクト: Sadikk/BlueSheep
 public void UseHouse()
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         InteractiveUseRequestMessage msg = new InteractiveUseRequestMessage(ElementIdd,SkillInstanceID);
         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] 5001 (InteractiveUseRequestMessage)"), 0);
     }
 }
コード例 #8
0
ファイル: HouseBuy.cs プロジェクト: Sadikk/BlueSheep
 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);
     }
 }
コード例 #9
0
ファイル: Npc.cs プロジェクト: DjTrilogic/BlueSheep
 public void CloseDialog()
 {
     Replies.Clear();
     QuestionId = 0;
     Id = 0;
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         LeaveDialogRequestMessage msg = new LeaveDialogRequestMessage();
         msg.Serialize(writer);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         account.SocketManager.Send(pack.Writer.Content);
     }
 }
コード例 #10
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);
                 }
             }
             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;
         }
     }
 }
コード例 #11
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;
     }
 }
コード例 #12
0
ファイル: LeavingDialog.cs プロジェクト: DjTrilogic/BlueSheep
        public void Init(AccountUC account)
        {
            LeaveDialogRequestMessage leaveDialogRequestMessage = new LeaveDialogRequestMessage();

            using (BigEndianWriter writer = new BigEndianWriter())
            {
                leaveDialogRequestMessage.Serialize(writer);

                MessagePackaging messagePackaging = new MessagePackaging(writer);

                messagePackaging.Pack((int)leaveDialogRequestMessage.ProtocolID);

                account.SocketManager.Send(messagePackaging.Writer.Content);
                account.LastPacketID.Clear();
            }
        }
コード例 #13
0
ファイル: HouseBuy.cs プロジェクト: DjTrilogic/BlueSheep
 public void Buy()
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         HouseBuyRequestMessage msg = new HouseBuyRequestMessage(priceHouse);
         msg.Serialize(writer);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         account.SocketManager.Send(pack.Writer.Content);
     }
     account.Log(new BotTextInformation("Maison achetée pour " + priceHouse + " kamas !"),0);
     if (account.PhraseADire.Text.Length != 0)
     {
         Say(account.PhraseADire.Text);
     }
 }
コード例 #14
0
ファイル: Getting.cs プロジェクト: DjTrilogic/BlueSheep
        public void Init()
        {
            account.Running.OnGetting = true;

            List<int> foodIndex = Foods.GetFoods(account.petsList[account.Running.CurrentPetIndex].Informations.GID);

            ObjectItem objectItem = null;

            foreach (ObjectItem item1 in account.SafeItems)
            {
                if (foodIndex.Contains(item1.ObjectGID))
                    objectItem = item1;
            }

            if (objectItem == null)
            {
                account.Running.NoFood();
                return;
            }

            int abbleWeight = account.Pods.WeightMax -
                              account.Pods.Weight - 1;
            //return;
            DataClass item = GameData.GetDataObject(D2oFileEnum.Items, objectItem.ObjectGID);
            int objectWeight = (int)item.Fields["realWeight"];
            int quantity = abbleWeight / objectWeight;

            if (objectItem.Quantity < quantity)
                quantity = objectItem.Quantity;

            ExchangeObjectMoveMessage exchangeObjectMoveMessage =
                new ExchangeObjectMoveMessage(objectItem.ObjectUID, -quantity);

            using (BigEndianWriter writer = new BigEndianWriter())
            {
                exchangeObjectMoveMessage.Serialize(writer);

                MessagePackaging messagePackaging = new MessagePackaging(writer);

                messagePackaging.Pack((int)exchangeObjectMoveMessage.ProtocolID);

                account.SocketManager.Send(messagePackaging.Writer.Content);
                account.LastPacketID.Clear();
            }
        }
コード例 #15
0
ファイル: BasicHandler.cs プロジェクト: DjTrilogic/BlueSheep
        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);
                }
            }
        }
コード例 #16
0
ファイル: Npc.cs プロジェクト: Sadikk/BlueSheep
 public void TalkToNpc(int npcId)
 {
     npcId = FindContextIdFromNpcId(npcId);
     if (npcId == 0)
         return;
     account.Busy = true;
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         NpcGenericActionRequestMessage msg = new NpcGenericActionRequestMessage(npcId, 3, account.MapData.Id);
         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] 5898 (NpcGenericActionRequestMessage)"), 0);
     }
 }
コード例 #17
0
ファイル: Flood.cs プロジェクト: Sadikk/BlueSheep
 public void SendPrivateTo(string name, string content)
 {
     if (mods.Contains(name))
     {
         account.Log(new ErrorTextInformation("[Flood] Annulation de l'envoi d'un message privé à " + name + " (Modo)"), 0);
         return;
     }
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         ChatClientPrivateMessage msg = new ChatClientPrivateMessage(content, name);
         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);
         account.Log(new PrivateTextInformation("à " + name + " : " + content), 1);
         if (account.DebugMode.Checked)
             account.Log(new DebugTextInformation("[SND] 851 (ChatClientPrivateMessage)"), 0);
     }
 }
コード例 #18
0
ファイル: Flood.cs プロジェクト: Sadikk/BlueSheep
 public void SendMessage(int channel, string content)
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         ChatClientMultiMessage msg = new ChatClientMultiMessage(content, (sbyte)channel);
         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);
         account.FloodUC.Increase(false);
     }
 }
コード例 #19
0
ファイル: CLIParser.cs プロジェクト: Sadikk/BlueSheep
        /// <summary>
        /// Say a message in the specified canal.
        /// </summary>
        /// <returns>The result.</returns>
        private List<string> Say()
        {
            char canal = char.Parse(GetParamValue("-canal"));
            string message = GetParamValue("-message").Replace('/', ' ');
            string dest = GetParamValue("-dest");

            try
            {
                if (canal == 'w' && dest != "null")
                {
                    using (BigEndianWriter writer = new BigEndianWriter())
                    {
                        ChatClientPrivateMessage msg = new ChatClientPrivateMessage(message, dest);
                        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);
                        result.Add("à " + dest + " : " + message + "\n");
                        if (account.DebugMode.Checked)
                            account.Log(new DebugTextInformation("[SND] 851 (ChatClientPrivateMessage)"), 0);
                    }
                }
                else
                {
                    switch (canal)
                    {
                        case 'g':
                            account.Flood.SendMessage(2, message);
                            result.Add("Message envoyé. \n");
                            break;
                        case 'r':
                            account.Flood.SendMessage(6, message);
                                result.Add("Message envoyé. \n");
                            break;
                        case 'b':
                            account.Flood.SendMessage(5, message);
                            result.Add("Message envoyé. \n");
                            break;
                        case 'a':
                            account.Flood.SendMessage(3, message);
                            result.Add("Message envoyé. \n");
                            break;
                        case 's':
                            account.Flood.SendMessage(0, message);
                            result.Add("Message envoyé. \n");
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Add("[ERROR] " + ex.Message + "\n");
                return result;
            }
            if (!(result.Count > 0))
                return Usage("say");
            else
                return result;
        }
コード例 #20
0
ファイル: Map.cs プロジェクト: Sadikk/BlueSheep
 public void UseElement(int id, int skillId)
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         InteractiveUseRequestMessage msg = new InteractiveUseRequestMessage(id, skillId);
         msg.Serialize(writer);
         writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         m_Account.SocketManager.Send(pack.Writer.Content);
     }
     if (m_Account.DebugMode.Checked)
         m_Account.Log(new DebugTextInformation("[SND] 5001 (InteractiveUseRequestMessage)"), 0);
 }
コード例 #21
0
ファイル: Map.cs プロジェクト: DjTrilogic/BlueSheep
        public bool MoveToCell(int cellId)
        {
            if (m_Account.StatusLb.Text == "Combat" || m_Account.StatusLb.Text == "Fighting")
                return false;
            m_Account.ModifBar(6, 0, 0, "Déplacement");
            MovementPath path = (new Pathfinder(m_Account.Map.Data, m_Account.Map)).FindPath(Character.CellId, cellId);
            if (path == null)
                return false;
            List<UInt32> serverMovement = MapMovementAdapter.GetServerMovement(path);
            int timetowait;
            if (serverMovement.Count() < 3)
                timetowait = serverMovement.Count() * 500;
            else
            {
                timetowait = serverMovement.Count() * 300;
            }
            //if (AutoTimeout)
            //    m_Account.Game.Character.State.SetTimeout(StateEnum.Moving, false, TimeoutMin, TimeoutMax);
            //m_Account.Network.SendToServer(new GameMapMovementRequestMessage(serverMovement.Select<uint, short>(ui => (short)ui).ToArray(), Id));
            using (BigEndianWriter writer = new BigEndianWriter())
            {
                GameMapMovementRequestMessage msg = new GameMapMovementRequestMessage(serverMovement.Select<uint, short>(ui => (short)ui).ToArray(), Id);
                msg.Serialize(writer);
                writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
                MessagePackaging pack = new MessagePackaging(writer);
                pack.Pack((int)msg.ProtocolID);
                m_Account.SocketManager.Send(pack.Writer.Content);
            }
            m_Account.Wait(timetowait, timetowait + 100);
            using (BigEndianWriter writer = new BigEndianWriter())
            {
                GameMapMovementConfirmMessage newmsg = new GameMapMovementConfirmMessage();
                newmsg.Serialize(writer);
                MessagePackaging pack = new MessagePackaging(writer);
                pack.Pack((int)newmsg.ProtocolID);
                if (m_Account.Fight != null && m_Account.Fight.IsFollowingGroup())
                {
                    m_Account.SocketManager.Send(pack.Writer.Content);
                    m_Account.Fight.LaunchFight(m_Account.Fight.followinggroup.m_contextualId);
                    //m_Account.Wait(3000, 4000);
                    //if (m_Account.StatusLb.Text != "Combat")
                    //{
                    //    m_Account.Fight.SearchFight();
                    //}
                }
                else
                {
                    m_Account.SocketManager.Send(pack.Writer.Content);
                }
                if (m_Account.Gather != null)
                    m_Account.Gather.Moved = true;
                m_Account.ModifBar(6, 0, 0, "Connecté");
            }

            return true;
        }
コード例 #22
0
ファイル: Map.cs プロジェクト: Sadikk/BlueSheep
        public bool MoveToCell(int cellId)
        {
            if (m_Account.state == Engine.Enums.Status.Fighting)
                return false;
            m_Account.SetStatus(Status.Moving);
            MovementPath path = (new Pathfinder(m_Account.MapData)).FindPath(m_Account.MapData.Character.disposition.cellId, cellId);
            if (path == null)
                return false;
            List<UInt32> serverMovement = MapMovementAdapter.GetServerMovement(path);
            if(serverMovement[serverMovement.Count -1] == m_Account.MapData.Character.disposition.cellId)
            {
                Moving = false;
                ConfirmMove();
                return true;
            }
            int timetowait;
            if (serverMovement.Count() < 3)
                timetowait = serverMovement.Count() * 500;
            else
            {
                timetowait = serverMovement.Count() * 300;
            }
            m_time = timetowait;
            using (BigEndianWriter writer = new BigEndianWriter())
            {
                GameMapMovementRequestMessage msg = new GameMapMovementRequestMessage(serverMovement.Select<uint, short>(ui => (short)ui).ToArray(), m_Account.MapData.Id);
                msg.Serialize(writer);
                writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
                MessagePackaging pack = new MessagePackaging(writer);
                pack.Pack((int)msg.ProtocolID);
                m_Account.SocketManager.Send(pack.Writer.Content);
                Moving = true;
                if (m_Account.DebugMode.Checked)
                    m_Account.Log(new DebugTextInformation("[SND] 950 (GameMapMovementRequestMessage)"), 0);
            }
            //m_Account.Wait(timetowait, timetowait + 100);
            //using (BigEndianWriter writer = new BigEndianWriter())
            //{
            //    GameMapMovementConfirmMessage newmsg = new GameMapMovementConfirmMessage();
            //    newmsg.Serialize(writer);
            //    MessagePackaging pack = new MessagePackaging(writer);
            //    pack.Pack((int)newmsg.ProtocolID);
            //    if (m_Account.Fight != null && m_Account.FightData.IsFollowingGroup && m_Account.FightData.followingGroup.m_cellId == cellId)
            //    {
            //        m_Account.SocketManager.Send(pack.Writer.Content);
            //        if (m_Account.DebugMode.Checked)
            //            m_Account.Log(new DebugTextInformation("[SND] 952 (GameMapMovementConfirmMessage)"), 0);
            //        m_Account.Fight.LaunchFight(m_Account.FightData.followingGroup.m_contextualId);
            //        Thread t = new Thread(new ThreadStart(CheckFight));
            //        t.Start();
            //    }
            //    else if (m_Account.Fight != null && m_Account.FightData.IsFollowingGroup)
            //    {
            //        m_Account.Fight.SearchFight();
            //    }
            //    else if (m_Account.Gather.Id != -1)
            //    {
            //        m_Account.SocketManager.Send(pack.Writer.Content);
            //        if (m_Account.DebugMode.Checked)
            //            m_Account.Log(new DebugTextInformation("[SND] 952 (GameMapMovementConfirmMessage)"), 0);
            //        //UseElement(m_Account.Gather.Id, m_Account.Gather.SkillInstanceUid);
            //        int distance = m_Account.Gather.GetRessourceDistance(m_Account.Gather.Id);
            //        m_Account.Log(new DebugTextInformation("[Gather] New distance from element " + m_Account.Gather.Id + " = " + distance), 0);
            //        if (distance <= m_Account.Inventory.WeaponRange)
            //        {
            //            UseElement(m_Account.Gather.Id, m_Account.Gather.SkillInstanceUid);
            //            m_Account.SetStatus(Status.Gathering);
            //        }
            //        else if (m_Account.Path != null)
            //            m_Account.Path.PerformFlag();
            //        else
            //            m_Account.PerformGather();
            //    }
            //    else
            //    {
            //        m_Account.SocketManager.Send(pack.Writer.Content);
            //        if (m_Account.DebugMode.Checked)
            //            m_Account.Log(new DebugTextInformation("[SND] 952 (GameMapMovementConfirmMessage)"), 0);
            //    }
            //    m_Account.SetStatus(Status.None);
            //}

            return true;
        }
コード例 #23
0
ファイル: BFight.cs プロジェクト: Sadikk/BlueSheep
 /// <summary>
 /// Launch a spell on the specified cellId.
 /// </summary>
 private void LaunchSpell(int spellId, int cellId)
 {
     flag = 1;
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         GameActionFightCastRequestMessage msg = new GameActionFightCastRequestMessage((short)spellId, (short)cellId);
         msg.Serialize(writer);
         writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         m_Account.SocketManager.Send(pack.Writer.Content);
         m_Account.Log(new ActionTextInformation("Lancement d'un sort en " + cellId), 5);
         if (m_Account.DebugMode.Checked)
             m_Account.Log(new DebugTextInformation("[SND] 1005 (GameActionFightCastRequestMessage)"), 0);
     }
 }
コード例 #24
0
ファイル: Map.cs プロジェクト: DjTrilogic/BlueSheep
 public bool MoveToCellWithDistance(int cellId, int maxDistance, bool bool1)
 {
     m_Account.ModifBar(6, 0, 0, "Déplacement");
     MovementPath path = null;
     int savDistance = -1;
     MapPoint characterPoint = new MapPoint(Character.CellId);
     MapPoint targetPoint = new MapPoint(cellId);
     foreach (MapPoint point in GetListPointAtGoodDistance(characterPoint, targetPoint, maxDistance))
     {
         Pathfinder pathFinding = null;
         if ((targetPoint.DistanceToCell(point) > maxDistance) || ((targetPoint.X != point.X) && (targetPoint.Y != point.Y)))
             continue;
         int distance = characterPoint.DistanceTo(point);
         if ((savDistance != -1) && (distance >= savDistance))
             continue;
         if (bool1)
         {
             if (Data.IsWalkable(point.CellId))
                 goto Label_00A8;
             continue;
         }
         if (!(NothingOnCell(point.CellId)))
             continue;
     Label_00A8:
         pathFinding = new Pathfinder(m_Account.Map.Data, m_Account.Map);
         MovementPath path2 = pathFinding.FindPath(Character.CellId, point.CellId);
         if (path2 != null)
         {
             path = path2;
             savDistance = distance;
         }
     }
     if (path == null)
         return false;
     //if (AutoTimeout)
     //    m_Account.Game.Character.State.SetTimeout(StateEnum.Moving, false, TimeoutMin, TimeoutMax);
     List<UInt32> serverMovement = MapMovementAdapter.GetServerMovement(path);
     int timetowait;
     if (serverMovement.Count() < 3)
         timetowait = serverMovement.Count() * 500;
     else
     {
         timetowait = serverMovement.Count() * 300;
     }
     //m_Account.Network.SendToServer(new GameMapMovementRequestMessage(serverMovement.Select<uint, short>(ui => (short)ui).ToArray(), Id));
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         GameMapMovementRequestMessage msg = new GameMapMovementRequestMessage(serverMovement.Select<uint, short>(ui => (short)ui).ToArray(), Id);
         msg.Serialize(writer);
         writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         m_Account.SocketManager.Send(pack.Writer.Content);
     }
     m_Account.Wait(timetowait, timetowait + 100);
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         GameMapMovementConfirmMessage newmsg = new GameMapMovementConfirmMessage();
         newmsg.Serialize(writer);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)newmsg.ProtocolID);
         if (m_Account.Fight != null && m_Account.Fight.IsFollowingGroup())
         {
             m_Account.SocketManager.Send(pack.Writer.Content);
             m_Account.Fight.LaunchFight(m_Account.Fight.followinggroup.m_contextualId);
             //m_Account.Wait(3000, 4000);
             //if (m_Account.StatusLb.Text != "Combat")
             //{
             //    m_Account.Fight.SearchFight();
             //}
         }
         else if (m_Account.Gather.Id != -1)
         {
             m_Account.SocketManager.Send(pack.Writer.Content);
             UseElement(m_Account.Gather.Id, m_Account.Gather.SkillInstanceUid);
         }
         else
         {
             m_Account.SocketManager.Send(pack.Writer.Content);
         }
         m_Account.ModifBar(6, 0, 0, "Connecté");
     }
     return true;
 }
コード例 #25
0
ファイル: ConnectionHandler.cs プロジェクト: Sadikk/BlueSheep
 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 = msg.ticket;
     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.ssl, msg.canCreateNewCharacter, msg.serverId, "127.0.0.1", msg.port, msg.ticket, msg.serverIds);
         using (BigEndianWriter writer = new BigEndianWriter())
         {
             nmsg.Serialize(writer);
             MessagePackaging pack = new MessagePackaging(writer);
             pack.Pack((int)nmsg.ProtocolID);
             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";
     }
 }
コード例 #26
0
ファイル: Map.cs プロジェクト: Sadikk/BlueSheep
 public bool MoveToCellWithDistance(int cellId, int maxDistance, bool bool1)
 {
     MovementPath path = null;
     int savDistance = -1;
     MapPoint characterPoint = new MapPoint(m_Account.MapData.Character.disposition.cellId);
     MapPoint targetPoint = new MapPoint(cellId);
     foreach (MapPoint point in m_Account.MapData.GetListPointAtGoodDistance(characterPoint, targetPoint, maxDistance))
     {
         Pathfinder pathFinding = null;
         if ((targetPoint.DistanceToCell(point) > maxDistance) || ((targetPoint.X != point.X) && (targetPoint.Y != point.Y)))
             continue;
         int distance = characterPoint.DistanceTo(point);
         if ((savDistance != -1) && (distance >= savDistance))
             continue;
         if (bool1)
         {
             if (m_Account.MapData.Data.IsWalkable(point.CellId))
                 goto Label_00A8;
             continue;
         }
         if (!(m_Account.MapData.NothingOnCell(point.CellId)))
             continue;
     Label_00A8:
         pathFinding = new Pathfinder(m_Account.MapData);
     MovementPath path2 = pathFinding.FindPath(m_Account.MapData.Character.disposition.cellId, point.CellId);
         if (path2 != null)
         {
             path = path2;
             savDistance = distance;
         }
     }
     if (path == null)
         return false;
     List<UInt32> serverMovement = MapMovementAdapter.GetServerMovement(path);
     if (serverMovement[serverMovement.Count - 1] == m_Account.MapData.Character.disposition.cellId)
     {
         Moving = false;
         ConfirmMove();
         return true;
     }
     int timetowait;
     if (serverMovement.Count() < 3)
         timetowait = serverMovement.Count() * 514;
     else
     {
         timetowait = serverMovement.Count() * 320;
     }
     m_time = timetowait;
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         GameMapMovementRequestMessage msg = new GameMapMovementRequestMessage(serverMovement.Select<uint, short>(ui => (short)ui).ToArray(), m_Account.MapData.Id);
         msg.Serialize(writer);
         writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         m_Account.SocketManager.Send(pack.Writer.Content);
         m_Account.SetStatus(Status.Moving);
         Moving = true;
         if (m_Account.DebugMode.Checked)
             m_Account.Log(new DebugTextInformation("[SND] 950 (GameMapMovementRequestMessage)"), 0);
     }
     return true;
 }
コード例 #27
0
ファイル: Map.cs プロジェクト: DjTrilogic/BlueSheep
 public void UseElement(int id, int skillId)
 {
     //if (AutoTimeout)
     //    m_Account.Game.Character.State.SetTimeout(StateEnum.Gathering, false, TimeoutMin, TimeoutMax);
     //m_Account.Network.SendToServer(new InteractiveUseRequestMessage(id, skillId));
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         InteractiveUseRequestMessage msg = new InteractiveUseRequestMessage(id, skillId);
         msg.Serialize(writer);
         writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         m_Account.SocketManager.Send(pack.Writer.Content);
     }
 }
コード例 #28
0
ファイル: Map.cs プロジェクト: DjTrilogic/BlueSheep
 public void LaunchChangeMap(int mapId)
 {
     //if (AutoTimeout)
     //    m_Account.Game.Character.State.SetTimeout(StateEnum.Context, false, TimeoutMin, TimeoutMax);
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         ChangeMapMessage msg = new ChangeMapMessage(mapId);
         msg.Serialize(writer);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         m_Account.SocketManager.Send(pack.Writer.Content);
     }
 }
コード例 #29
0
ファイル: HeroicUC.cs プロジェクト: DjTrilogic/BlueSheep
 private void Agression(int targetid)
 {
     GameRolePlayPlayerFightRequestMessage packet = new GameRolePlayPlayerFightRequestMessage
                     {
                         friendly = false,
                         targetCellId = -1,
                         targetId = targetid
                     };
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         packet.Serialize(writer);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)packet.ProtocolID);
         account.SocketManager.Send(pack.Writer.Content);
     }
 }
コード例 #30
0
ファイル: Map.cs プロジェクト: DjTrilogic/BlueSheep
 public void useZaapi(int mapid)
 {
     foreach (InteractiveElement e in InteractiveElements.Values)
     {
         if (e.TypeId == 106)
         {
             MoveToSecureElement((int)e.Id);
             UseElement((int)e.Id,e.EnabledSkills[0].skillInstanceUid);
             m_Account.Wait(500, 1000);
             using (BigEndianWriter writer = new BigEndianWriter())
             {
                 TeleportRequestMessage msg = new TeleportRequestMessage(1,mapid);
                 msg.Serialize(writer);
                 MessagePackaging pack = new MessagePackaging(writer);
                 pack.Pack((int)msg.ProtocolID);
                 m_Account.SocketManager.Send(pack.Writer.Content);
             }
         }
     }
 }
コード例 #31
0
ファイル: BFight.cs プロジェクト: Sadikk/BlueSheep
 /// <summary>
 /// Move to the specified cell (Fight).
 /// </summary>
 private bool MoveToCell(int cellId)
 {
     if (cellId != m_Data.Fighter.CellId)
     {
         if (!(m_Data.IsCellWalkable(cellId)))
         {
             int num = -1;
             int num2 = 5000;
             MapPoint point = new MapPoint(m_Data.Fighter.CellId);
             MapPoint point2 = new MapPoint(cellId);
             int direction = 1;
             while (true)
             {
                 MapPoint nearestCellInDirection = point2.GetNearestCellInDirection(direction, 1);
                 if (m_Data.IsCellWalkable(nearestCellInDirection.CellId))
                 {
                     int num4 = point.DistanceToCell(nearestCellInDirection);
                     if (num4 < num2)
                     {
                         num2 = num4;
                         num = nearestCellInDirection.CellId;
                     }
                 }
                 direction = (direction + 2);
                 if (direction > 7)
                 {
                     if (num == -1)
                         return false;
                     cellId = num;
                     break;
                 }
             }
         }
         SimplePathfinder pathfinder = new SimplePathfinder(m_Account.MapData);
         pathfinder.SetFight(m_Data.Fighters, m_Data.Fighter.MovementPoints);
         MovementPath path = pathfinder.FindPath(m_Data.Fighter.CellId, cellId);
         if (path != null)
         {
             List<UInt32> serverMovement = MapMovementAdapter.GetServerMovement(path);
             using (BigEndianWriter writer = new BigEndianWriter())
             {
                 GameMapMovementRequestMessage msg = new GameMapMovementRequestMessage(serverMovement.ToList().Select<uint, short>(ui => (short)ui).ToArray(), m_Account.MapData.Id);
                 msg.Serialize(writer);
                 writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
                 MessagePackaging pack = new MessagePackaging(writer);
                 pack.Pack((int)msg.ProtocolID);
                 flag = 0;
                 m_Account.SocketManager.Send(pack.Writer.Content);
                 if (m_Account.DebugMode.Checked)
                     m_Account.Log(new DebugTextInformation("[SND] 950 (GameMapMovementRequestMessage)"), 0);
             }
             return true;
         }
     }
     return false;
 }
コード例 #32
0
ファイル: BasicHandler.cs プロジェクト: DjTrilogic/BlueSheep
        public static void SequenceNumberRequestMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            account.Sequence++;

            SequenceNumberMessage sequenceNumberMessage = new SequenceNumberMessage((ushort)account.Sequence);

            using (BigEndianWriter writer = new BigEndianWriter())
            {
                sequenceNumberMessage.Serialize(writer);

                MessagePackaging messagePackaging = new MessagePackaging(writer);

                messagePackaging.Pack((int)sequenceNumberMessage.ProtocolID);

                account.SocketManager.Send(messagePackaging.Writer.Content);
            }
        }