コード例 #1
0
 private bool MoveToCell(int cellId)
 {
     if (cellId != Fighter.CellId)
     {
         if (!(IsCellWalkable(cellId)))
         {
             int      num       = -1;
             int      num2      = 5000;
             MapPoint point     = new MapPoint(Fighter.CellId);
             MapPoint point2    = new MapPoint(cellId);
             int      direction = 1;
             while (true)
             {
                 MapPoint nearestCellInDirection = point2.GetNearestCellInDirection(direction, 1);
                 if (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((BlueSheep.Data.D2p.Map)m_Account.Map.Data);
         pathfinder.SetFight(Fighters, Fighter.MovementPoints);
         MovementPath path = pathfinder.FindPath(Fighter.CellId, cellId);
         if (path != null)
         {
             List <UInt32> serverMovement = MapMovementAdapter.GetServerMovement(path);
             //Account.Network.SendToServer(new GameMapMovementRequestMessage(serverMovement.ToList().Select<uint, short>(ui => (short)ui).ToArray(), Account.Game.Map.Id));
             using (BigEndianWriter writer = new BigEndianWriter())
             {
                 GameMapMovementRequestMessage msg = new GameMapMovementRequestMessage(serverMovement.ToList().Select <uint, short>(ui => (short)ui).ToArray(), m_Account.Map.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);
                 if (m_Account.DebugMode.Checked)
                 {
                     m_Account.Log(new BotTextInformation("[SND] 950 (GameMapMovementRequestMessage)"), 0);
                 }
             }
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
ファイル: Flood.cs プロジェクト: YoshinoErmit/BlueSheep
        public void SendPrivateTo(string name)
        {
            string content = account.FloodContent;

            if (account.IsRandomingSmileyBox.Checked == true)
            {
                content = AddRandomSmiley(content);
            }
            if (account.IsRandomingNumberBox.Checked == true)
            {
                content = AddRandomNumber(content);
            }
            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 BotTextInformation("[SND] 851 (ChatClientPrivateMessage)"), 0);
                }
            }
        }
コード例 #3
0
        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);
                    }
                }
            }
        }
コード例 #4
0
 private void LaunchSpell(int spellId, int cellId)
 {
     //foreach (BFighter fighter in Fighters)
     //{
     //    if (fighter.CellId == cellId)
     //    {
     //        GameActionFightCastOnTargetRequestMessage msg = new GameActionFightCastOnTargetRequestMessage((short)spellId, fighter.Id);
     //        m_Account.SocketManager.Send(msg);
     //        m_Account.Log(new ActionTextInformation("Lancement d'un sort en " + cellId), 5);
     //        return;
     //    }
     //}
     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 BotTextInformation("[SND] 1005 (GameActionFightCastRequestMessage)"), 0);
         }
     }
 }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
ファイル: SecurityHandler.cs プロジェクト: shadowok/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
 public void SendReply(int replyId)
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         NpcDialogReplyMessage msg = new NpcDialogReplyMessage((short)replyId);
         msg.Serialize(writer);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.ProtocolID);
         account.SocketManager.Send(pack.Writer.Content);
     }
 }
コード例 #8
0
ファイル: Leaving.cs プロジェクト: shadowok/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();
            }
        }
コード例 #9
0
 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);
     }
 }
コード例 #10
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);
         }
     }
 }
コード例 #11
0
 public static void AuthenticationTicketAcceptedMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     if (!account.IsMITM)
     {
         CharactersListRequestMessage charactersListRequestMessage = new CharactersListRequestMessage();
         using (BigEndianWriter writer = new BigEndianWriter())
         {
             charactersListRequestMessage.Serialize(writer);
             MessagePackaging messagePackaging = new MessagePackaging(writer);
             messagePackaging.Pack((int)charactersListRequestMessage.ProtocolID);
             account.SocketManager.Send(messagePackaging.Writer.Content);
         }
     }
 }
コード例 #12
0
 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);
     }
 }
コード例 #13
0
ファイル: Getting.cs プロジェクト: shadowok/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();
            }
        }
コード例 #14
0
 public static void HelloGameMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     if (!account.IsMITM)
     {
         AuthenticationTicketMessage authenticationTicketMessage = new AuthenticationTicketMessage(GameConstants.Lang,
                                                                                                   account.Ticket);
         using (BigEndianWriter writer = new BigEndianWriter())
         {
             authenticationTicketMessage.Serialize(writer);
             MessagePackaging messagePackaging = new MessagePackaging(writer);
             messagePackaging.Pack((int)authenticationTicketMessage.ProtocolID);
             account.SocketManager.Send(messagePackaging.Writer.Content);
         }
     }
 }
コード例 #15
0
 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);
         }
     }
 }
コード例 #16
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);
         }
     }
 }
コード例 #17
0
 public void UseElement(int id, int skillId)
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         InteractiveUseRequestMessage msg = new InteractiveUseRequestMessage((uint)id, (uint)skillId);
         msg.Serialize(writer);
         writer.Content = m_Account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.MessageID);
         m_Account.SocketManager.Send(pack.Writer.Content);
     }
     if (m_Account.DebugMode.Checked)
     {
         m_Account.Log(new DebugTextInformation("[SND] 5001 (InteractiveUseRequestMessage)"), 0);
     }
 }
コード例 #18
0
 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);
     }
 }
コード例 #19
0
ファイル: LeavingDialog.cs プロジェクト: shadowok/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();
            }
        }
コード例 #20
0
        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);
            }
        }
コード例 #21
0
 public void SendMessage(int channel, string content)
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         ChatClientMultiMessage msg = new ChatClientMultiMessage(content, (byte)channel);
         msg.Serialize(writer);
         writer.Content = account.HumanCheck.hash_function(writer.Content);
         MessagePackaging pack = new MessagePackaging(writer);
         pack.Pack((int)msg.MessageID);
         account.SocketManager.Send(pack.Writer.Content);
         if (account.DebugMode.Checked)
         {
             account.Log(new DebugTextInformation("[SND] 861 (ChatClientMultiMessage)"), 0);
         }
         account.FloodUC.Increase(false);
     }
 }
コード例 #22
0
 /// <summary>
 /// LaunchSpell() permet de lancer un sort.
 /// </summary>
 /// <param name="spellId">ID du sort à lancer</param>
 /// <param name="cellId">Cell ID cible</param>
 private void LaunchSpell(int spellId, int cellId)
 {
     using (BigEndianWriter writer = new BigEndianWriter())
     {
         GameActionFightCastRequestMessage msg = new GameActionFightCastRequestMessage((short)spellId, (short)cellId);
         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 ActionTextInformation("Lancement d'un sort en " + cellId), 5);
         if (Account.DebugMode.Checked)
         {
             Account.Log(new BotTextInformation("[SND] 1005 (GameActionFightCastRequestMessage)"), 0);
         }
     }
 }
コード例 #23
0
ファイル: HeroicUC.cs プロジェクト: shadowok/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);
            }
        }
コード例 #24
0
 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);
     }
     if (m_Account.DebugMode.Checked)
     {
         m_Account.Log(new BotTextInformation("[SND] 5001 (InteractiveUseRequestMessage)"), 0);
     }
 }
コード例 #25
0
        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";
            }
        }
コード例 #26
0
 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);
             }
         }
     }
 }
コード例 #27
0
 public void PulseRegen()
 {
     if ((m_Account.CharacterStats.lifePoints / m_Account.CharacterStats.maxLifePoints) < m_Account.RegenChoice.Value)
     {
         m_Account.SetStatus(Status.Regenerating);
         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));
         using (BigEndianWriter writer = new BigEndianWriter())
         {
             EmotePlayRequestMessage msg2 = new EmotePlayRequestMessage(1);
             msg2.Serialize(writer);
             MessagePackaging pack = new MessagePackaging(writer);
             pack.Pack((int)msg2.ProtocolID);
             m_Account.SocketManager.Send(pack.Writer.Content);
         }
         m_Account.Log(new GeneralTextInformation(String.Format("Régénération pendant {0} secondes.", time)), 2);
         m_Account.Wait(time * 1000, (time + 1) * 1000);
     }
     // TODO : Continue path after this.
 }
コード例 #28
0
ファイル: Npc.cs プロジェクト: pingwiniasty/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);
         }
     }
 }
コード例 #29
0
 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.MessageID);
         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);
         }
     }
 }
コード例 #30
0
        public bool MoveToCellWithDistance(int cellId, int maxDistance, bool bool1)
        {
            m_Account.SetStatus(Status.Moving);
            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);
                if (m_Account.DebugMode.Checked)
                {
                    m_Account.Log(new BotTextInformation("[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.Fight.IsFollowingGroup() && m_Account.Fight.followinggroup.m_cellId == cellId)
                {
                    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.Fight != null && m_Account.Fight.IsFollowingGroup())
                {
                    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.SetStatus(Status.None);
            }
            return(true);
        }