예제 #1
0
 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();
         }
     }
 }
예제 #2
0
        public void ConfirmMove()
        {
            m_Account.Wait(m_time, m_time + 100);
            using (BigEndianWriter writer = new BigEndianWriter())
            {
                if (Moving)
                {
                    m_Account.SocketManager.Send(new GameMapMovementConfirmMessage());
                    Moving = false;
                }
                m_Account.SetStatus(Status.None);

                if (m_MapId != -1)
                {
                    LaunchChangeMap(m_MapId);
                    return;
                }
                else if (m_elemId != -1 && m_Account.Gather.Id == -1)
                {
                    UseElement(m_elemId);
                }
                if (m_Account.Fight != null && m_Account.FightData.IsFollowingGroup && m_Account.FightData.followingGroup.m_cellId == m_Account.MapData.Character.disposition.cellId)
                {
                    m_Account.Fight.LaunchFight(m_Account.FightData.followingGroup.m_contextualId);
                }
                else if (m_Account.Fight != null && m_Account.FightData.IsFollowingGroup)
                {
                    m_Account.Fight.SearchFight();
                }
                else if (m_Account.Gather.Id != -1)
                {
                    //if (m_Account.MapData.CanGatherElement(m_Account.Gather.Id, m_Account.Inventory.WeaponRange))
                    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);
                    m_Account.Log(new DebugTextInformation("[CanGatherElement] " + m_Account.MapData.CanGatherElement(m_Account.Gather.Id, m_Account.Inventory.WeaponRange).ToString()), 0);
                    //if (distance <= m_Account.Inventory.WeaponRange)
                    if (m_Account.MapData.CanGatherElement(m_Account.Gather.Id, m_Account.Inventory.WeaponRange))
                    {
                        m_Account.SetStatus(Status.Gathering);
                        UseElement(m_Account.Gather.Id, m_Account.Gather.SkillInstanceUid);
                    }
                    else if (m_Account.Path != null)
                    {
                        m_Account.Gather.BanElementId(m_Account.Gather.Id);
                        m_Account.Path.PerformFlag();
                    }
                    else
                    {
                        m_Account.SetStatus(Status.None);
                        m_Account.Gather.BanElementId(m_Account.Gather.Id);
                        m_Account.PerformGather();
                    }
                }
                else
                {
                    m_Account.SetStatus(Status.None);
                }
            }
        }
예제 #3
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.
 }
예제 #4
0
        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("[FROM " + msg.Author + " ] : " + msg.Content), 0);
            account.Log(new BotTextInformation("You has been locked for " + msg.LockDuration + ". Stopping BlueSheep actions while blocked..."), 0);
            account.Log(new ErrorTextInformation("Y a un popup sur l'écran, surement un modo :s"), 0);
            account.Wait(msg.LockDuration, msg.LockDuration);
            //account.SocketManager.Disconnect("Alerte au modo ! Alerte au modo !");
        }
예제 #5
0
        public void Init()
        {
            if (m_CurrentPetIndex == account.petsList.Count)//MainForm.ActualMainForm.MainRunning.CurrentBot.PetsList.Count)
            {
                //MainForm.ActualMainForm.MainRunning.NextBot();
                account.SetNextMeal();
                return;
            }

            if ((CheckTime(account.petsList[m_CurrentPetIndex])) ||
                ((m_Feeding != null) && (m_Feeding.SecondFeeding)))
            {
                if (
                    account.petsList[m_CurrentPetIndex].Informations.Position == 8)
                {
                    Console.WriteLine();
                }

                if (account.petsList[m_CurrentPetIndex].FoodList.Count == 0)
                {
                    if (account.Safe == null)
                    {
                        NoFood();
                        return;
                    }

                    if (!m_OnSafe)
                    {
                        m_OnSafe   = true;
                        m_Openning = new Opening();
                        m_Openning.Init(account);
                        return;
                    }

                    LeavingFoodToSafe();
                    return;
                }

                m_Feeding = new Feeding(account);
                m_Feeding.Init(account.petsList[m_CurrentPetIndex]);
                account.Wait(500, 1000);
                m_CurrentPetIndex++;
                return;
            }

            m_CurrentPetIndex++;
            Init();
        }
예제 #6
0
        public static void ExchangeStartedWithPodsMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            ExchangeStartedWithPodsMessage msg = (ExchangeStartedWithPodsMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (account.GestItemsUC.ListenerBox.Checked)
            {
                return;
            }
            List <int> items = account.GestItemsUC.GetItemsToTransfer();

            account.Inventory.TransferItems(items);
            account.Wait(2000, 3000);
            account.Inventory.ExchangeReady();
        }
예제 #7
0
        public static void PartyMemberInFightMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            PartyMemberInFightMessage msg = (PartyMemberInFightMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (msg.FightMap.MapId == account.MapData.Id && msg.MemberName == account.MyGroup.GetMaster().CharacterBaseInformations.Name)
            {
                account.Wait(500, 1500);
                using (BigEndianWriter writer = new BigEndianWriter())
                {
                    GameFightJoinRequestMessage msg2 = new GameFightJoinRequestMessage(msg.MemberId, msg.FightId);
                    account.SocketManager.Send(msg2);
                }
            }
        }
예제 #8
0
        public void StartFlooding(int channel, bool useSmiley, bool useNumbers, string content, int interval)
        {
            stop = false;
            string ncontent = content;

            while (stop == false)
            {
                if (useSmiley == true)
                {
                    ncontent = AddRandomSmiley(content);
                }
                if (useNumbers == true)
                {
                    ncontent = AddRandomNumber(content);
                }
                SendMessage(channel, ncontent);
                account.Wait(interval * 1000, interval * 1000);
            }
        }
예제 #9
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";
            }
        }
예제 #10
0
 /// <summary>
 /// Perform the auto-timeout.
 /// </summary>
 public void PerformAutoTimeoutFight(int originalTime)
 {
     m_Account.Wait(Convert.ToInt32(originalTime * m_Account.NUDTimeoutFight.Value), Convert.ToInt32(originalTime * m_Account.NUDTimeoutFight.Value));
 }
예제 #11
0
        public void PerformAction()
        {
            if (account.Path == null)
            {
                return;
            }
            while (account.Busy == true)
            {
                account.Wait(1, 5);
            }
            switch (m_action)
            {
            case "move(":
                m_delta = RandomDir((string)m_delta);
                if (account.IsMaster == true && account.MyGroup != null)
                {
                    account.MyGroup.MoveGroup((string)m_delta);
                    account.Wait(2000, 3000);
                    // account.Path.Stop = true;
                }
                else if (account.IsSlave == false)
                {
                    account.Map.ChangeMap((string)m_delta);
                    account.Wait(2000, 3000);
                    //account.Path.Stop = true;
                }
                else
                {
                    account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ?)"), 0);
                }
                break;

            case "object(":
                if (account.IsMaster == true && account.MyGroup != null)
                {
                    account.MyGroup.UseItemGroup(account.Inventory.GetItemFromGID(Convert.ToInt32(m_delta)).UID);
                    account.Wait(2000, 3000);
                    //account.Path.Stop = true;
                }
                else if (account.IsSlave == false)
                {
                    account.Inventory.UseItem(account.Inventory.GetItemFromGID(Convert.ToInt32(m_delta)).UID);
                    //account.Path.Stop = true;
                }
                else
                {
                    account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ? plus d'objet ?)"), 0);
                }
                break;

            case "cell(":
                if (account.IsMaster == true && account.MyGroup != null)
                {
                    account.MyGroup.MoveToCellGroup(Convert.ToInt32(m_delta));
                    account.Wait(2000, 3000);
                    //account.Path.Stop = true;
                }
                else if (account.IsSlave == false)
                {
                    account.Map.MoveToCell(Convert.ToInt32(m_delta));
                    //account.Path.Stop = true;
                }
                else
                {
                    account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ? plus d'objet ?)"), 0);
                }
                account.Log(new BotTextInformation("Trajet : Déplacement sur la cellule " + Convert.ToString(m_delta)), 5);
                break;

            case "npc(":
                //TODO : Rework with group
                account.Npc.TalkToNpc(Convert.ToInt32(m_delta));
                break;

            case "use(":
                account.Map.MoveToSecureElement(Convert.ToInt32(m_delta));
                account.Map.UseElement(Convert.ToInt32(m_delta));
                break;

            case "zaap(":
                if (account.IsMaster == true && account.MyGroup != null)
                {
                    account.MyGroup.UseZaapGroup();
                    account.Wait(2000, 3000);
                    //account.Path.Stop = true;
                }
                else if (account.IsSlave == false)
                {
                    account.Map.useZaap(Convert.ToInt32(account.Path.Current_Action.m_delta));
                    //account.Path.Stop = true;
                }
                else
                {
                    account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ? plus d'objet ?)"), 0);
                }
                break;

            case "zaapi(":
                if (account.IsMaster == true && account.MyGroup != null)
                {
                    account.MyGroup.UseZaapiGroup();
                    account.Wait(2000, 3000);
                    //account.Path.Stop = true;
                }
                else if (account.IsSlave == false)
                {
                    account.Map.useZaapi(Convert.ToInt32(account.Path.Current_Action.m_delta));
                    //account.Path.Stop = true;
                }
                else
                {
                    account.Log(new ErrorTextInformation("Impossible d'enclencher le déplacement. (mûle ? plus d'objet ?)"), 0);
                }
                break;
            }
        }