Example #1
0
 private void CheckCombat()
 {
     if ((wow.Objects[0].IsInCombat == 1) & (wow.IsMounted == 0))
     {
         int Index = GetTarget();
         if (Index != 0)
         {
             double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Index].X, wow.Objects[Index].Y, wow.Objects[Index].Z);
             wow.SelectTarget(wow.Objects[Index].GUID);
             WowControl.FarmStatus = "Fighting";
             Target = wow.Objects[Index].GUID;
             WowControl.UpdateStatus("Fighting with \"" + wow.Objects[Index].Name + "\".");
             WowControl.UpdateCombatLog("Fighting with \"" + wow.Objects[Index].Name + "\".");
             if (WowControl.ClassType == 1)
             {
                 wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
             }
             else
             {
                 if (Range > 30)
                 {
                     wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
                 }
                 else
                 {
                     wow.GoTo(0, 0, 0, 0, 3);
                     WowControl.Sleep(100);
                     wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 1);
                 }
             }
             Abilities.UseAbilities(wow, "");
         }
         return;
     }
 }
Example #2
0
 public static void Button(String AbilityName, int Duration)
 {
     for (int i = 0; i < BindingsList.Count; i++)
     {
         if (BindingsList[i].AbilityName == AbilityName)
         {//Shift, Control, Alt
             Ability[] TempArray = BindingsList.ToArray();
             TempArray[i].LastUse = DateTime.Now;
             BindingsList.Clear();
             for (int n = 0; n < TempArray.Length; n++)
             {
                 Abilities.BindingsList.Add(TempArray[n]);
             }
             if (BindingsList[i].AbilityType == 0)                    //Instant
             {
                 AbilityStatus = "Instant";
             }
             else
             {
                 AbilityStatus = "Casting";
                 WowControl.Stop();
             }
             StartCast = DateTime.Now;
             EndCast   = DateTime.Now.AddMilliseconds(BindingsList[i].CastTime * 1000);
             if (CheckString(BindingsList[i].Modifiers, "Alt") == true)
             {
                 WowControl.KeyToWnd(0x12, false);
             }
             if (CheckString(BindingsList[i].Modifiers, "Control") == true)
             {
                 WowControl.KeyToWnd(0x11, false);
             }
             if (CheckString(BindingsList[i].Modifiers, "Shift") == true)
             {
                 WowControl.KeyToWnd(0x10, false);
             }
             WowControl.KeyToWnd(BindingsList[i].Key, false);
             WowControl.Sleep(Duration);
             WowControl.KeyToWnd(BindingsList[i].Key, true);
             if (CheckString(BindingsList[i].Modifiers, "Alt") == true)
             {
                 WowControl.KeyToWnd(0x12, true);
             }
             if (CheckString(BindingsList[i].Modifiers, "Control") == true)
             {
                 WowControl.KeyToWnd(0x11, true);
             }
             if (CheckString(BindingsList[i].Modifiers, "Shift") == true)
             {
                 WowControl.KeyToWnd(0x10, true);
             }
         }
     }
 }
Example #3
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("You are really wanna delete " + comboBox1.Text + ".cfg ?", "Farm helper request.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         File.Delete(Application.StartupPath + "\\Configs\\" + comboBox1.Text + ".cfg");
         WowControl.Sleep(100);
         WowControl.UpdateStatus("Config " + comboBox1.Text + " deleted!");
         comboBox1.Text = "";
         ReadConfigs();
     }
 }
Example #4
0
        private void FollowWaypoints()
        {
            if (Abilities.AbilityStatus != "Casting")
            {
                if ((Abilities.AbilityStatus == "Ready") & (wow.IsIndoors == 0) & (wow.Objects[0].IsInCombat == 0) & (wow.IsMounted == 0))
                {
                    WowControl.GetOnMount(wow, 1);
                    WowControl.Sleep(2000);
                    LastTime = DateTime.Now;
                }

                for (int i = 0; i < WowControl.WP.ToArray().Length; i++)
                {
                    if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z) < 5)
                    {
                        CurrentWP  = WowControl.WP[i].NextWaypoint;
                        WPDetected = true;
                        break;
                    }
                }
                if (WPDetected == false)
                {
                    CurrentWP  = GetClosestWP(WowControl.WP);
                    WPDetected = true;
                }
                if (CurrentWP >= WowControl.WP.Length)
                {
                    CurrentWP = 0;
                }
                double RangeToLastLoc = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, LastLocation.X, LastLocation.Y, LastLocation.Z);
                LastLocation.X = wow.Objects[0].X;
                LastLocation.Y = wow.Objects[0].Y;
                LastLocation.Z = wow.Objects[0].Z;
                if (RangeToLastLoc > 50)
                {
                    CurrentWP = GetClosestWP(WowControl.WP);
                    WowControl.UpdateStatus("Changed position, detecting closest waypoint.");
                }
                wow.GoTo(WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z, 0, 4);
                if ((DateTime.Now - LastTime).TotalMilliseconds > 3000)
                {
                    LastTime = DateTime.Now;
                    if (wow.IsMounted == 0)
                    {
                        Abilities.Button("Jump");
                    }
                }

                WowControl.UpdateStatus("Going to waypoint № " + CurrentWP + ".");
            }
        }
Example #5
0
        private bool FollowGroup()
        {
            if (WowControl.StayWithGroup == false)
            {
                return(true);
            }
            int ClosestGroup = FindClosestGroup();

            if (ClosestGroup != 1000)
            {
                CurrentWP = GetClosestWP(WowControl.WP);
                if ((Abilities.AbilityStatus == "Ready") & (wow.IsIndoors == 0) & (wow.Objects[0].IsInCombat == 0) & (wow.IsMounted == 0))
                {
                    WowControl.GetOnMount(wow, 1);
                    WowControl.Sleep(2000);
                    LastTime = DateTime.Now;
                }
                if (WowControl.InDoors == 1)
                {
                    WowControl.UpdateStatus("Can't mount, going with group without mount.");
                    Abilities.AbilityStatus = "Ready";
                    WowControl.Sleep(150);
                    wow.GoTo(Groups[ClosestGroup].X, Groups[ClosestGroup].Y, Groups[ClosestGroup].Z, 0, 4);
                    WowControl.WaitTime = DateTime.Now.AddSeconds(2);
                    //WowControl.Sleep(2000);
                    WowControl.InDoors = 0;
                    return(true);
                }
                double RangeToGroup = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, Groups[ClosestGroup].X, Groups[ClosestGroup].Y, Groups[ClosestGroup].Z);
                if (RangeToGroup > 4)
                {
                    wow.GoTo(Groups[ClosestGroup].X, Groups[ClosestGroup].Y, Groups[ClosestGroup].Z, 0, 4);
                }
                if ((DateTime.Now - LastTime).TotalMilliseconds > 3000)
                {
                    LastTime = DateTime.Now;
                    if (wow.IsMounted == 0)
                    {
                        Abilities.Button("Jump");
                    }
                }
                WowControl.UpdateStatus("Going with group.");
                return(true);
            }
            return(false);
        }
Example #6
0
        private bool FollowTarget()
        {
            if (Abilities.Target > 0)
            {
                if (WowControl.ClassType == 1)
                {
                    if (Abilities.AbilityStatus != "Casting")
                    {
                        wow.GoTo(0, 0, 0, wow.Objects[Abilities.Target].GUID, 11);
                    }
                }
                else
                {
                    double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Abilities.Target].X, wow.Objects[Abilities.Target].Y, wow.Objects[Abilities.Target].Z);
                    if (Range > 25)
                    {
                        if (Abilities.AbilityStatus != "Casting")
                        {
                            wow.GoTo(wow.Objects[Abilities.Target].X, wow.Objects[Abilities.Target].Y, wow.Objects[Abilities.Target].Z, wow.Objects[Abilities.Target].GUID, 4);
                        }
                    }
                    else
                    {
                        wow.GoTo(0, 0, 0, 0, 3);
                        WowControl.Sleep(100);
                        wow.GoTo(0, 0, 0, wow.Objects[Abilities.Target].GUID, 1);
                    }
                }
                //wow.SetPlayerToCombat();
                //Abilities.UseAbilities(wow, "Bg");
                //WowControl.UpdateCombatLog("Fighting with " + wow.Objects[Abilities.Target].Name + ".");

                /*if (WowControl.ErrorState == "Bad target")
                 * {
                 *      WowControl.BadObjects.Add(wow.Objects[Abilities.Target].GUID);
                 *      WowControl.UpdateCombatLog("Bad target " + wow.Objects[Abilities.Target].Name + ".");
                 * }*/
                if (WowControl.StayWithGroup == false)
                {
                    return(true);
                }
            }
            return(false);
        }
Example #7
0
 public static void GetOnMount(Memory.Memory wow, int FlyOrGround)
 {
     if (Abilities.AbilityStatus != "Casting")
     {
         if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
         {
             wow.GoTo(0, 0, 0, 0, 3);//Stop
             WowControl.Sleep(500);
             WowControl.FarmStatus = "Mounting";
             if (FlyOrGround == 0)
             {
                 Abilities.Button("Fly mount");
             }
             else
             {
                 Abilities.Button("Ground mount");
             }
         }
     }
     if (wow.LastError == "Нельзя использовать в воде.")
     {
         InWater = 1;
         WowControl.FarmStatus = "In water";
     }
     else
     {
         InWater = 0;
     }
     if (wow.LastError == "Здесь нельзя ездить верхом.")
     {
         InDoors = 1;
     }
     else
     {
         InDoors = 0;
     }
 }
Example #8
0
 public static void Moving(Memory.Memory wow, int Target, int BestAbilityIndex)
 {
     if (Target > 0)
     {
         if (WowControl.ClassType == 1)
         {
             if (Abilities.AbilityStatus != "Casting")
             {
                 Button(BindingsList[BestAbilityIndex].AbilityName);
                 wow.GoTo(0, 0, 0, wow.Objects[Abilities.Target].GUID, 11);
             }
         }
         else
         {
             double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Abilities.Target].X, wow.Objects[Abilities.Target].Y, wow.Objects[Abilities.Target].Z);
             if (Range > 25)
             {
                 if (Abilities.AbilityStatus != "Casting")
                 {
                     wow.GoTo(wow.Objects[Abilities.Target].X, wow.Objects[Abilities.Target].Y, wow.Objects[Abilities.Target].Z, wow.Objects[Abilities.Target].GUID, 4);
                 }
             }
             else
             {
                 Button(BindingsList[BestAbilityIndex].AbilityName);
                 wow.GoTo(0, 0, 0, 0, 3);
                 WowControl.Sleep(100);
                 wow.GoTo(0, 0, 0, wow.Objects[Abilities.Target].GUID, 1);
             }
         }
         if (WowControl.ErrorState == "Bad target")
         {
             //WowControl.BadObjects.Add(wow.Objects[Abilities.Target].GUID);
             WowControl.UpdateCombatLog("Bad target " + wow.Objects[Abilities.Target].Name + ".");
         }
     }
 }
Example #9
0
        public void Process()
        {
            if (WowControl.LoadedWP != wow.Location)
            {
                WowControl.WP = WowControl.LoadWaypoints(wow.Location);
            }
            if (wow.BattlefieldInstanceExpiration != 0)
            {
                WowControl.Sleep(2000);
                wow.Read();
                WowControl.UpdateStatus("Leaving BG.");
                wow.GoTo(0, 0, 0, 0, 3);                //Stop
                WowControl.Command("script LeaveBattlefield()");
                WowControl.WaitTime = DateTime.Now.AddSeconds(30);
                return;
            }
            switch (wow.BgStatus)
            {
            case 0:                    //Not queued
                if ((DateTime.Now - LastTime).TotalMilliseconds > 20000)
                {
                    if ((DateTime.Now - WowControl.LocationChangeTime).TotalSeconds >= 60)
                    {
                        WowControl.UpdateStatus("Joining BG queue.");
                    }
                    LastTime = DateTime.Now;
                    WowControl.btn('H');
                    WowControl.btn('H');
                    WowControl.Sleep(1000);
                    WowControl.Command("script JoinBattlefield(1)");
                    WowControl.WaitTime = DateTime.Now.AddSeconds(5);
                }
                break;

            case 1:                    //Waiting
                if (wow.Objects[0].IsInCombat != 0)
                {
                    Abilities.UseAbilities(wow, "");
                }
                //WowControl.UpdateStatus("Waiting BG.");
                break;

            case 2:                    //Confirm
                if ((DateTime.Now - LastTime).TotalMilliseconds > 5000)
                {
                    WowControl.UpdateStatus("Joining BG.");
                    LastTime = DateTime.Now;
                    WowControl.Command("script  AcceptBattlefieldPort(1,1)");
                    WowControl.WaitTime = DateTime.Now.AddSeconds(20);
                    return;
                }
                break;

            case 3:                    //In BG
                if (wow.Objects[0].Health == 1)
                {
                    StuckTimes = 0;
                    CurrentWP  = GetClosestWP(WowControl.WP);
                    WowControl.BadObjects.Clear();
                    WowControl.UpdateStatus("Waiting for ressurect.");
                    wow.GoTo(0, 0, 0, 0, 3);                            //Stop and waiting for ressurect
                    Abilities.Ability[] Temp = Abilities.BindingsList.ToArray();
                    Abilities.BindingsList.Clear();
                    for (int i = 0; i < Temp.Length; i++)
                    {
                        Temp[i].Try = 0;
                        Abilities.BindingsList.Add(Temp[i]);
                    }
                    RessurectTime = DateTime.Now;
                    return;
                }
                if (wow.Objects[0].Health == 0)
                {
                    WowControl.BadObjects.Clear();
                    WowControl.Sleep(2000);
                    RessurectTime = DateTime.Now;
                    StuckTimes    = 0;
                    WowControl.UpdateStatus("Releasing spirit.");
                    if ((DateTime.Now - LastTime).TotalMilliseconds > 5000)
                    {
                        LastTime = DateTime.Now;
                        WowControl.Command("script  RepopMe()");
                        WowControl.WaitTime = DateTime.Now.AddSeconds(5);
                    }
                    return;
                }
                Abilities.UseAbilities(wow, "Bg");
                if (Abilities.AbilityStatus != "Casting")
                {
                    if (Moving() == true)
                    {
                        return;
                    }
                }
                break;
            }
        }
Example #10
0
 private bool Stuck()
 {
     if (wow.Objects[0].IsInCombat != 0)
     {
         return(false);
     }
     if ((Abilities.AbilityStatus != "Casting") & (WowControl.InWater == 0) & (wow.Speed < 0.005) & (wow.Objects[0].Health > 1) & ((DateTime.Now - RessurectTime).TotalSeconds > 20))
     {
         StuckTimes++;
     }
     else
     {
         StuckTimes = 0;
     }
     if (StuckTimes > 10)
     {
         if ((DateTime.Now - TeleportTime).TotalSeconds > 20)
         {
             TeleportTime = DateTime.Now;
             int Teleport = GetClosestTeleport();
             if (Teleport != 0)
             {
                 WowControl.UpdateStatus("Can't reach waypoint, searching for teleport.");
                 wow.GoTo(wow.Objects[Teleport].X, wow.Objects[Teleport].Y, wow.Objects[Teleport].Z, wow.Objects[Teleport].GUID, 7);
                 WowControl.WaitTime = DateTime.Now.AddSeconds(10);
                 return(true);
             }
         }
         WowControl.UpdateStatus("Can't reach waypoint, going to previous waypoint.");
         CurrentWP--;
         if ((GetClosestWP(WowControl.WP) - CurrentWP) > 3)
         {
             CurrentWP = GetClosestWP(WowControl.WP);
         }
         if (CurrentWP < 0)
         {
             CurrentWP = GetClosestWP(WowControl.WP);
         }
         StuckTimes = 0;
     }
     if (CurrentWP < 0)
     {
         CurrentWP = WowControl.WP.Length;
     }
     if ((Abilities.AbilityStatus == "Ready") & (wow.IsIndoors == 0) & (wow.Objects[0].IsInCombat == 0) & (wow.IsMounted == 0))
     {
         WowControl.GetOnMount(wow, 1);
         WowControl.Sleep(2000);
         LastTime = DateTime.Now;
     }
     if (WowControl.InDoors == 1)
     {
         WowControl.UpdateStatus("Can't mount, going to next waypoint without mount.");
         Abilities.AbilityStatus = "Ready";
         WowControl.Sleep(150);
         wow.GoTo(WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z, 0, 4);
         WowControl.WaitTime = DateTime.Now.AddSeconds(2);
         //WowControl.Sleep(2000);
         WowControl.InDoors = 0;
         return(true);
     }
     return(false);
 }
Example #11
0
        public void Process()
        {
            if (wow.BgStatus == 3)
            {
                WowControl.FarmStatus = "In bg";
                return;
            }
            if (wow.Objects[0].Health == 0)
            {//токашо похерились
                Abilities.AbilityStatus = "Ready";
                Corpse.X = wow.Objects[0].X;
                Corpse.Y = wow.Objects[0].Y;
                Corpse.Z = wow.Objects[0].Z;
                if ((DateTime.Now - LastCheck).TotalMilliseconds > 20000)
                {
                    WowControl.UpdateStatus("Player dead, releasing spirit.");
                    WowControl.Command("script  RepopMe()");
                    LastCheck           = DateTime.Now;
                    WowControl.WaitTime = DateTime.Now.AddSeconds(10);
                }
                return;
            }
            if (wow.Objects[0].Health == 1)
            {
                Abilities.AbilityStatus = "Ready";
                WowControl.UpdateStatus("Going to corpse.");
                wow.GoTo(Corpse.X, Corpse.Y, Corpse.Z, 0, 4);
                if ((DateTime.Now - LastTime).TotalMilliseconds > 1000)
                {
                    LastTime = DateTime.Now;
                    Abilities.Button("Jump");
                }
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, Corpse.X, Corpse.Y, Corpse.Z) < 15)
                {
                    if ((DateTime.Now - LastCheck).TotalMilliseconds > 20000)
                    {
                        WowControl.Command("script  RetrieveCorpse()");
                        LastCheck = DateTime.Now;
                    }
                    WowControl.Sleep(5000);
                }
                return;
            }
            if (wow.IsMounted == 0)
            {
                CheckCombat();
                Abilities.UseAbilities(wow, "");
            }
            if (Abilities.AbilityStatus == "Casting")
            {
                return;
            }
            CheckForLootSkin();
            if (wow.IsMounted != 0)
            {
                TryToMount            = 0;
                WowControl.FarmStatus = "Searching";
            }
            if ((WowControl.FarmStatus == "In water") & (wow.Objects[0].IsInCombat == 0))
            {
                WowControl.UpdateStatus("Bot in water, trying to unstuck.");
                Unstuck();
                return;
            }
            if (WowControl.LoadedWP != wow.Location)
            {
                WowControl.WP = WowControl.LoadWaypoints(wow.Location);
            }
            for (int i = 0; i < WowControl.WP.ToArray().Length; i++)
            {
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z) < 15)
                {
                    CurrentWP  = WowControl.WP[i].NextWaypoint;
                    WPDetected = true;
                    break;
                }
            }
            if (WPDetected == false)
            {
                CurrentWP  = GetClosestWP(WowControl.WP);
                WPDetected = true;
            }
            if (CurrentWP >= WowControl.WP.Length)
            {
                CurrentWP = 0;
            }
            double RangeToLastLoc = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, LastLocation.X, LastLocation.Y, LastLocation.Z);

            LastLocation.X = wow.Objects[0].X;
            LastLocation.Y = wow.Objects[0].Y;
            LastLocation.Z = wow.Objects[0].Z;
            if (RangeToLastLoc > 50)
            {
                CurrentWP = GetClosestWP(WowControl.WP);
                WowControl.UpdateStatus("Changed position, detecting closest waypoint.");
            }
            int    ClosestObject   = 0;
            int    CLosestLootable = 0;
            int    CLosestSkinable = 0;
            double Range           = 0;

            if (((WowControl.LootMobs == true) || (WowControl.FarmSkinning == true)) & (FindClosestGoods() == 0))
            {//Killing mobs block
                if (wow.Objects[0].IsInCombat == 0)
                {
                    if (WowControl.SkiningKillAll == true)
                    {
                        ClosestObject = FindClosestMob();
                    }
                    CLosestLootable = FindClosestLootableMob();
                    if (WowControl.SkinAll == true)
                    {
                        CLosestSkinable = FindClosestSkinableMob();
                    }
                    if (CLosestLootable != 0)
                    {//Лутаем ближайшего моба
                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[CLosestLootable].X, wow.Objects[CLosestLootable].Y, wow.Objects[CLosestLootable].Z);
                        if (((DateTime.Now - LastCheck).Milliseconds > 200) & (wow.IsMounted != 0))
                        {
                            if ((float)Math.Abs(Range - LastRange) < 0.03)
                            {
                                TryToReach++;
                            }
                            LastRange = Range;
                            LastCheck = DateTime.Now;
                        }
                        if (TryToReach > 20)
                        {
                            WowControl.UpdateStatus("Can't reach object.");
                            WowControl.BadObjects.Add(wow.Objects[CLosestLootable].GUID);
                            TryToReach = 0;
                            return;
                        }
                        if (Range > 15)
                        {
                            if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                            {
                                WowControl.GetOnMount(wow, WowControl.FarmMount);
                                return;
                            }
                            if ((wow.IsMounted != 0) & (WowControl.FarmMount == 1) & (DateTime.Now - LastTime).TotalMilliseconds > 3000)
                            {
                                LastTime = DateTime.Now;
                                Abilities.Button("Jump");
                            }
                            wow.GoTo(wow.Objects[CLosestLootable].X, wow.Objects[CLosestLootable].Y, wow.Objects[CLosestLootable].Z, wow.Objects[CLosestLootable].GUID, 4);
                        }
                        else
                        {
                            WowControl.FarmStatus = "Looting";
                            Looting            = true;
                            LootingObject.Guid = wow.Objects[CLosestLootable].GUID;
                            LootingObject.Name = wow.Objects[CLosestLootable].Name;
                            LootingObject.Time = WowControl.GetTimeStr();
                            Move(wow.Objects[0].R /*- (float)Math.PI*/, 5);
                            Abilities.AbilityStatus = "Casting";
                            Abilities.EndCast       = DateTime.Now.AddSeconds(2);
                            WowControl.Sleep(100);
                            wow.GoTo(0, 0, 0, wow.Objects[CLosestLootable].GUID, 6);//Loot
                        }
                        return;
                    }
                    if (CLosestSkinable != 0)
                    {//Скиним ближайшего моба
                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[CLosestLootable].X, wow.Objects[CLosestLootable].Y, wow.Objects[CLosestLootable].Z);
                        if ((DateTime.Now - LastCheck).Milliseconds > 200)
                        {
                            if ((float)Math.Abs(Range - LastRange) < 0.03)
                            {
                                TryToReach++;
                            }
                            LastRange = Range;
                            LastCheck = DateTime.Now;
                        }
                        if (TryToReach > 20)
                        {
                            WowControl.UpdateStatus("Can't reach object.");
                            WowControl.BadObjects.Add(wow.Objects[CLosestLootable].GUID);
                            TryToReach = 0;
                            return;
                        }
                        if (Range < 15)
                        {
                            WowControl.FarmStatus = "Skining";
                            if (wow.LastError == "С этого существа нельзя снять шкуру.")
                            {
                                WowControl.BadObjects.Add(wow.Objects[CLosestSkinable].GUID);
                                WowControl.UpdateStatus(wow.LastError);
                                return;
                            }
                            if (wow.LastError == "Недостаточный уровень навыка.")
                            {
                                WowControl.BadObjects.Add(wow.Objects[CLosestSkinable].GUID);
                                WowControl.UpdateStatus(wow.LastError);
                                return;
                            }
                            Skining = true;
                            TryToSkin++;
                            if (TryToSkin > 5)
                            {
                                WowControl.BadObjects.Add(wow.Objects[CLosestSkinable].GUID);
                                WowControl.UpdateStatus("Can't skin \"" + wow.Objects[CLosestSkinable] + "\".");
                                return;
                            }
                            SkinningObject.Guid = wow.Objects[CLosestSkinable].GUID;
                            SkinningObject.Name = wow.Objects[CLosestSkinable].Name;
                            SkinningObject.Time = WowControl.GetTimeStr();
                            Move(wow.Objects[0].R /*- (float)Math.PI*/, 5);
                            Abilities.AbilityStatus = "Casting";
                            Abilities.EndCast       = DateTime.Now.AddSeconds(4);
                            WowControl.Sleep(100);
                            wow.GoTo(0, 0, 0, wow.Objects[CLosestSkinable].GUID, 9);//Skin
                        }
                        else
                        {
                            if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                            {
                                WowControl.GetOnMount(wow, WowControl.FarmMount);
                                return;
                            }
                            if ((wow.IsMounted != 0) & (WowControl.FarmMount == 1) & (DateTime.Now - LastTime).TotalMilliseconds > 3000)
                            {
                                LastTime = DateTime.Now;
                                Abilities.Button("Jump");
                            }
                            wow.GoTo(wow.Objects[CLosestSkinable].X, wow.Objects[CLosestSkinable].Y, wow.Objects[CLosestSkinable].Z, wow.Objects[CLosestSkinable].GUID, 4);
                        }
                        return;
                    }
                    if (ClosestObject != 0)
                    {//Некого лутать и скинить но есть моб которого нужно отмудохать
                        wow.SelectTarget(wow.Objects[ClosestObject].GUID);
                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestObject].X, wow.Objects[ClosestObject].Y, wow.Objects[ClosestObject].Z + 5);
                        if ((DateTime.Now - LastCheck).Milliseconds > 200)
                        {
                            if (WowControl.ErrorState == "Bad target")
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestObject].GUID);
                                return;
                            }
                            if ((float)Math.Abs(Range - LastRange) < 0.03)
                            {
                                TryToReach++;
                            }
                            LastRange = Range;
                            LastCheck = DateTime.Now;
                        }
                        if (TryToReach > 10)
                        {
                            WowControl.UpdateStatus("Can't reach object.");
                            WowControl.BadObjects.Add(wow.Objects[ClosestObject].GUID);
                            TryToReach = 0;
                            return;
                        }
                        if (Range > 20)
                        {
                            if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                            {
                                WowControl.GetOnMount(wow, WowControl.FarmMount);
                                return;
                            }
                            if ((wow.IsMounted != 0) & (WowControl.FarmMount == 1) & (DateTime.Now - LastTime).TotalMilliseconds > 3000)
                            {
                                LastTime = DateTime.Now;
                                Abilities.Button("Jump");
                            }
                            wow.GoTo(wow.Objects[ClosestObject].X, wow.Objects[ClosestObject].Y, wow.Objects[ClosestObject].Z, wow.Objects[ClosestObject].GUID, 4);
                        }
                        if (WowControl.FarmStatus == "Mounting")
                        {
                            return;
                        }
                        if (WowControl.ClassType == 1)
                        {
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestObject].GUID, 11);
                        }
                        else
                        {
                            Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestObject].X, wow.Objects[ClosestObject].Y, wow.Objects[ClosestObject].Z);
                            if (Range > 30)
                            {
                                wow.GoTo(0, 0, 0, wow.Objects[ClosestObject].GUID, 11);
                            }
                            else
                            {
                                wow.GoTo(0, 0, 0, 0, 3);
                                WowControl.Sleep(100);
                                wow.GoTo(0, 0, 0, wow.Objects[ClosestObject].GUID, 1);
                            }
                        }

                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestObject].X, wow.Objects[ClosestObject].Y, wow.Objects[ClosestObject].Z);
                        int CheckRange = 0;
                        if (WowControl.ClassType == 1)
                        {
                            CheckRange = 7;
                        }
                        else
                        {
                            CheckRange = 30;
                        }
                        if ((wow.Objects[0].IsInCombat == 0) & (Range < CheckRange))
                        {
                            TryToFight++;
                        }
                        if (TryToFight > 10)
                        {
                            TryToFight = 0;
                            WowControl.BadObjects.Add(wow.Objects[ClosestObject].GUID);
                            WowControl.UpdateCombatLog("Can't attack " + wow.Objects[ClosestObject].Name + ".");
                            WowControl.UpdateStatus("Can't attack " + wow.Objects[ClosestObject].Name + ".");
                        }
                        wow.SetPlayerToCombat();
                        Abilities.UseAbilities(wow, "");
                        WowControl.UpdateCombatLog("Fighting with " + wow.Objects[ClosestObject].Name + ".");
                        return;
                    }
                }
            }
            if (WowControl.FarmMining == true)
            {//farm goods block
                int ClosestIndex = FindClosestGoods();
                if (ClosestIndex != 0)
                {//Finded
                    if (IsPlayerCloseToVein(ClosestIndex) == true)
                    {
                        WowControl.UpdateStatus("Another player close, going away.");
                        WowControl.BadObjects.Add(wow.Objects[ClosestIndex].GUID);
                        return;
                    }
                    WowControl.UpdateStatus("Finded \"" + wow.Objects[ClosestIndex].Name + "\".");
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z + 5);
                    if (((DateTime.Now - LastCheck).Milliseconds > 200) & (wow.IsMounted != 0))
                    {
                        if ((float)Math.Abs(Range - LastRange) < 0.03)
                        {
                            TryToLoot++;
                        }
                        LastRange = Range;
                        LastCheck = DateTime.Now;
                    }

                    /*if (TryToLoot > 5)
                     * {
                     *  //WowControl.UpdateStatus("Bot stucked while trying to reach object.");
                     *  Abilities.Button("Jump", 1000);
                     * }*/
                    if (TryToLoot > 20)
                    {
                        WowControl.UpdateStatus("Can't reach object.");
                        WowControl.BadObjects.Add(wow.Objects[ClosestIndex].GUID);
                        TryToLoot = 0;
                        return;
                    }
                    if (Range > 8)
                    {//Далеко от объекта
                        if (wow.IsMounted == 0)
                        {
                            WowControl.GetOnMount(wow, WowControl.FarmMount);
                            return;
                        }
                        if ((wow.IsMounted != 0) & (WowControl.FarmMount == 1) & (DateTime.Now - LastTime).TotalMilliseconds > 3000)
                        {
                            LastTime = DateTime.Now;
                            Abilities.Button("Jump");
                        }
                        WowControl.FarmStatus = "Going to goods";
                        if (wow.Objects[0].Z < wow.Objects[ClosestIndex].Z - 5)
                        {
                            wow.GoTo(wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z + 10, wow.Objects[ClosestIndex].GUID, 4);
                        }
                        else
                        {
                            wow.GoTo(wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z + 10, wow.Objects[ClosestIndex].GUID, 4);
                        }
                    }
                    else
                    {                           //Близко
                        if (wow.IsMounted != 0) //Dismount
                        {
                            WowControl.FarmStatus = "Dismounting";
                            wow.GoTo(0, 0, 0, 0, 3);//Stop
                            if (WowControl.FarmMount == 0)
                            {
                                Abilities.Button("Fly mount");
                            }
                            else
                            {
                                Abilities.Button("Ground mount");
                            }
                            Abilities.AbilityStatus = "Ready";
                            WowControl.Sleep(1500);
                        }
                        WowControl.Sleep(200);
                        WowControl.FarmStatus = "Looting";
                        Looting            = true;
                        LootingObject.Guid = wow.Objects[ClosestIndex].GUID;
                        LootingObject.Name = wow.Objects[ClosestIndex].Name;
                        LootingObject.Time = WowControl.GetTimeStr();
                        if (wow.Objects[ClosestIndex].Type != 3)
                        {
                            //wow.GoTo(wow.Objects[0].X - 10, wow.Objects[0].Y - 10, wow.Objects[0].Z, wow.Objects[0].GUID, 4);
                            Move(wow.Objects[0].R /*- (float)Math.PI*/, 25);
                            WowControl.Sleep(100);
                            //wow.GoTo(0, 0, 0, 0, 3);//Stop
                            wow.GoTo(wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z, wow.Objects[ClosestIndex].GUID, 7);
                        }
                        Abilities.Button("Mote xtrtr");
                        TryToLoot++;
                        if (WowControl.FindTextInString(wow.LastError, "быть не менее") == true)
                        {
                            WowControl.UpdateStatus(wow.LastError);
                            WowControl.BadObjects.Add(wow.Objects[ClosestIndex].GUID);
                        }
                        return;
                    }
                }
                else
                {
                    Abilities.UseAbilities(wow, "");
                    if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                    {
                        WowControl.GetOnMount(wow, WowControl.FarmMount);
                    }
                    if ((wow.IsMounted != 0) & (WowControl.FarmMount == 1) & (DateTime.Now - LastTime).TotalMilliseconds > 3000)
                    {
                        LastTime = DateTime.Now;
                        Abilities.Button("Jump");
                    }
                    else
                    {
                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z);
                        if ((DateTime.Now - LastCheck).Milliseconds > 200)
                        {
                            if ((float)Math.Abs(Range - LastRange) < 0.03)
                            {
                                TryLoFly++;
                            }
                            LastRange = Range;
                            LastCheck = DateTime.Now;
                        }
                        if (TryLoFly > 10)
                        {
                            UnstuckTimes++;
                            WowControl.UpdateStatus("Can't reach waypoint.");
                            TryLoFly = 0;
                            Move(wow.Objects[0].R - (float)(Math.PI * 0.5), 25);
                            WowControl.Sleep(2000);
                            Abilities.Button("Jump", 2000);
                            if (UnstuckTimes > 3)
                            {
                                Unstuck();
                                CurrentWP--;
                                UnstuckTimes = 0;
                                if ((GetClosestWP(WowControl.WP) - CurrentWP) > 3)
                                {
                                    CurrentWP = GetClosestWP(WowControl.WP);
                                }
                            }
                            return;
                        }
                        WowControl.FarmStatus = "Searching";
                        wow.GoTo(WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z, 0, 4);
                        WowControl.UpdateStatus("Going to waypoint № " + CurrentWP + ".");
                    }
                }
            }
        }
Example #12
0
        public void Process()
        {
            double Range = 0;

            if (wow.BgStatus == 3)
            {
                return;
            }
            if (wow.Objects[0].Health == 0)
            {//токашо похерились
                Abilities.AbilityStatus = "Ready";
                Corpse.X = wow.Objects[0].X;
                Corpse.Y = wow.Objects[0].Y;
                Corpse.Z = wow.Objects[0].Z;
                if ((DateTime.Now - LastCheck).TotalMilliseconds > 20000)
                {
                    WowControl.UpdateStatus("Player dead, releasing spirit.");
                    WowControl.Command("script  RepopMe()");
                    LastCheck           = DateTime.Now;
                    WowControl.WaitTime = DateTime.Now.AddSeconds(10);
                }
                return;
            }
            if (wow.Objects[0].Health == 1)
            {
                Abilities.AbilityStatus = "Ready";
                WowControl.UpdateStatus("Going to corpse.");
                wow.GoTo(Corpse.X, Corpse.Y, Corpse.Z, 0, 4);
                if ((DateTime.Now - LastTime).TotalMilliseconds > 1000)
                {
                    LastTime = DateTime.Now;
                    Abilities.Button("Jump");
                }
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, Corpse.X, Corpse.Y, Corpse.Z) < 15)
                {
                    if ((DateTime.Now - LastCheck).TotalMilliseconds > 20000)
                    {
                        WowControl.Command("script  RetrieveCorpse()");
                        LastCheck = DateTime.Now;
                    }
                    WowControl.Sleep(5000);
                }
                return;
            }
            CheckCombat();
            Abilities.UseAbilities(wow);
            if (Abilities.AbilityStatus == "Casting")
            {
                return;
            }
            if (wow.IsMounted != 0)
            {
                TryToMount            = 0;
                WowControl.FarmStatus = "Searching";
            }
            if ((WowControl.FarmStatus == "In water") & (wow.Objects[0].IsInCombat == 0))
            {
                WowControl.UpdateStatus("Bot in water, trying to unstuck.");
                Unstuck();
                return;
            }
            if (WowControl.LoadedWP != wow.Location)
            {
                WowControl.WP = WowControl.LoadWaypoints(wow.Location);
            }
            //if ((WowControl.Stuck(wow.Speed) == true) & (wow.IsMounted != 0))
            //Abilities.Button("Jump", 500);
            for (int i = 0; i < WowControl.WP.ToArray().Length; i++)
            {
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z) < 15)
                {
                    CurrentWP  = WowControl.WP[i].NextWaypoint;
                    WPDetected = true;
                    break;
                }
            }
            if (WPDetected == false)
            {
                CurrentWP  = GetClosestWP(WowControl.WP);
                WPDetected = true;
            }
            if (CurrentWP >= WowControl.WP.Length)
            {
                CurrentWP = 0;
            }
            double RangeToLastLoc = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, LastLocation.X, LastLocation.Y, LastLocation.Z);

            LastLocation.X = wow.Objects[0].X;
            LastLocation.Y = wow.Objects[0].Y;
            LastLocation.Z = wow.Objects[0].Z;
            if (RangeToLastLoc > 50)
            {
                CurrentWP = GetClosestWP(WowControl.WP);
                WowControl.UpdateStatus("Changed position, detecting closest waypoint.");
            }

            int ClosestTarget = 0;

            if (WowControl.SkiningKillAll == true)
            {
                ClosestTarget = FindClosestMob();
            }
            else if (wow.Objects[0].IsInCombat == 1)
            {
                ClosestTarget = FindClosestMob();
            }
            if (ClosestTarget != 0)
            {
                if (wow.Objects[ClosestTarget].Health > 1)
                {
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestTarget].X, wow.Objects[ClosestTarget].Y, wow.Objects[ClosestTarget].Z + 5);
                    if ((DateTime.Now - LastCheck).Milliseconds > 200)
                    {
                        if ((float)Math.Abs(Range - LastRange) < 0.03)
                        {
                            TryToReach++;
                        }
                        LastRange = Range;
                        LastCheck = DateTime.Now;
                    }
                    if (TryToReach > 20)
                    {
                        WowControl.UpdateStatus("Can't reach object.");
                        WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                        TryToReach = 0;
                        return;
                    }
                    if (Range > 30)
                    {
                        if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                        {
                            WowControl.GetOnMount(wow, WowControl.FarmMount);
                        }
                    }
                    if (WowControl.FarmStatus == "Mounting")
                    {
                        return;
                    }
                    wow.SelectTarget(wow.Objects[ClosestTarget].GUID);
                    if (WowControl.ClassType == 1)
                    {
                        wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 11);
                    }
                    else
                    {
                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestTarget].X, wow.Objects[ClosestTarget].Y, wow.Objects[ClosestTarget].Z);
                        if (Range > 30)
                        {
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 11);
                        }
                        else
                        {
                            wow.GoTo(0, 0, 0, 0, 3);
                            WowControl.Sleep(100);
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 1);
                        }
                    }
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestTarget].X, wow.Objects[ClosestTarget].Y, wow.Objects[ClosestTarget].Z);
                    int CheckRange = 0;
                    if (WowControl.ClassType == 1)
                    {
                        CheckRange = 7;
                    }
                    else
                    {
                        CheckRange = 30;
                    }
                    if ((wow.Objects[0].IsInCombat == 0) & (Range < CheckRange))
                    {
                        TryToFight++;
                    }
                    if (TryToFight > 50)
                    {
                        TryToFight = 0;
                        WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                        WowControl.UpdateCombatLog("Can't attack " + wow.Objects[ClosestTarget].Name + ".");
                        WowControl.UpdateStatus("Can't attack " + wow.Objects[ClosestTarget].Name + ".");
                    }
                    WowControl.UpdateCombatLog("Fighting with " + wow.Objects[ClosestTarget].Name + ".");
                }
                else
                {
                    if (wow.Objects[ClosestTarget].IsLootable == 1)
                    {
                        WowControl.UpdateStatus("Looting \"" + wow.Objects[ClosestTarget].Name + "\".");
                        WowControl.FarmStatus = "Looting";
                        Looting            = true;
                        LootingObject.Guid = wow.Objects[ClosestTarget].GUID;
                        LootingObject.Name = wow.Objects[ClosestTarget].Name;
                        LootingObject.Time = WowControl.GetTimeStr();
                        Move(wow.Objects[0].R /*- (float)Math.PI*/, 5);
                        Abilities.AbilityStatus = "Casting";
                        Abilities.EndCast       = DateTime.Now.AddSeconds(2);
                        WowControl.Sleep(100);
                        wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 6);//Loot
                    }
                    else
                    {
                        if (WowControl.SkinAll == true)
                        {
                            WowControl.UpdateStatus("Skining \"" + wow.Objects[ClosestTarget].Name + "\".");
                            WowControl.FarmStatus = "Skining";
                            if (wow.LastError == "С этого существа нельзя снять шкуру.")
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                                WowControl.UpdateStatus(wow.LastError);
                                return;
                            }
                            if (wow.LastError == "Недостаточный уровень навыка.")
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                                WowControl.UpdateStatus(wow.LastError);
                                return;
                            }
                            Skining = true;
                            TryToSkin++;
                            if (TryToSkin > 5)
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                                WowControl.UpdateStatus("Can't skin \"" + wow.Objects[ClosestTarget] + "\".");
                                return;
                            }
                            SkinningObject.Guid = wow.Objects[ClosestTarget].GUID;
                            SkinningObject.Name = wow.Objects[ClosestTarget].Name;
                            SkinningObject.Time = WowControl.GetTimeStr();
                            Move(wow.Objects[0].R /*- (float)Math.PI*/, 5);
                            Abilities.AbilityStatus = "Casting";
                            Abilities.EndCast       = DateTime.Now.AddSeconds(4);
                            WowControl.Sleep(100);
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 9);//Skin
                        }
                    }
                }
            }
            else
            {
                if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                {
                    WowControl.GetOnMount(wow, WowControl.FarmMount);
                }
                else
                {
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z);
                    if ((DateTime.Now - LastCheck).Milliseconds > 200)
                    {
                        if ((float)Math.Abs(Range - LastRange) < 0.03)
                        {
                            TryLoFly++;
                        }
                        LastRange = Range;
                        LastCheck = DateTime.Now;
                    }
                    if (TryLoFly > 10)
                    {
                        UnstuckTimes++;
                        WowControl.UpdateStatus("Can't reach waypoint.");
                        TryLoFly = 0;
                        Move(wow.Objects[0].R - (float)Math.PI, 25);
                        WowControl.Sleep(2000);
                        Abilities.Button("Jump", 2000);
                        if (UnstuckTimes > 3)
                        {
                            CurrentWP--;
                            UnstuckTimes = 0;
                            if ((GetClosestWP(WowControl.WP) - CurrentWP) > 3)
                            {
                                CurrentWP = GetClosestWP(WowControl.WP);
                            }
                        }
                        return;
                    }
                    WowControl.FarmStatus = "Searching";
                    wow.GoTo(WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z, 0, 4);
                    WowControl.UpdateStatus("Going to waypoint № " + CurrentWP + ".");
                }
            }
        }
Example #13
0
        public void Process()
        {
            if (wow.BgStatus == 3)
            {
                return;
            }
            if (wow.Objects[0].Health == 0)
            {//токашо похерились
                Abilities.AbilityStatus = "Ready";
                Corpse.X = wow.Objects[0].X;
                Corpse.Y = wow.Objects[0].Y;
                Corpse.Z = wow.Objects[0].Z;
                if ((DateTime.Now - LastCheck).TotalMilliseconds > 20000)
                {
                    WowControl.UpdateStatus("Player dead, releasing spirit.");
                    WowControl.Command("script  RepopMe()");
                    LastCheck           = DateTime.Now;
                    WowControl.WaitTime = DateTime.Now.AddSeconds(10);
                }
                return;
            }
            if (wow.Objects[0].Health == 1)
            {
                Abilities.AbilityStatus = "Ready";
                WowControl.UpdateStatus("Going to corpse.");
                wow.GoTo(Corpse.X, Corpse.Y, Corpse.Z, 0, 4);
                if ((DateTime.Now - LastTime).TotalMilliseconds > 1000)
                {
                    LastTime = DateTime.Now;
                    Abilities.Button("Jump");
                }
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, Corpse.X, Corpse.Y, Corpse.Z) < 15)
                {
                    if ((DateTime.Now - LastCheck).TotalMilliseconds > 20000)
                    {
                        WowControl.Command("script  RetrieveCorpse()");
                        LastCheck = DateTime.Now;
                    }
                    WowControl.Sleep(5000);
                }
                return;
            }
            if (wow.IsMounted == 0)
            {
                CheckCombat();
            }
            Abilities.UseAbilities(wow);
            if (Abilities.AbilityStatus == "Casting")
            {
                return;
            }
            if (wow.IsMounted != 0)
            {
                TryToMount            = 0;
                WowControl.FarmStatus = "Searching";
            }
            if ((WowControl.FarmStatus == "In water") & (wow.Objects[0].IsInCombat == 0))
            {
                WowControl.UpdateStatus("Bot in water, trying to unstuck.");
                Unstuck();
                return;
            }
            if (WowControl.LoadedWP != wow.Location)
            {
                WowControl.WP = WowControl.LoadWaypoints(wow.Location);
            }
            //if ((WowControl.Stuck(wow.Speed) == true) & (wow.IsMounted != 0))
            //Abilities.Button("Jump", 500);
            for (int i = 0; i < WowControl.WP.ToArray().Length; i++)
            {
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z) < 15)
                {
                    CurrentWP  = WowControl.WP[i].NextWaypoint;
                    WPDetected = true;
                    break;
                }
            }
            if (WPDetected == false)
            {
                CurrentWP  = GetClosestWP(WowControl.WP);
                WPDetected = true;
            }
            if (CurrentWP >= WowControl.WP.Length)
            {
                CurrentWP = 0;
            }
            double RangeToLastLoc = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, LastLocation.X, LastLocation.Y, LastLocation.Z);

            LastLocation.X = wow.Objects[0].X;
            LastLocation.Y = wow.Objects[0].Y;
            LastLocation.Z = wow.Objects[0].Z;
            if (RangeToLastLoc > 50)
            {
                CurrentWP = GetClosestWP(WowControl.WP);
                WowControl.UpdateStatus("Changed position, detecting closest waypoint.");
            }
            int ClosestIndex = FindClosestGoods();

            if (ClosestIndex != 0)
            {//Finded
                if (IsPlayerCloseToVein(ClosestIndex) == true)
                {
                    WowControl.UpdateStatus("Another player close, going away.");
                    WowControl.BadObjects.Add(wow.Objects[ClosestIndex].GUID);
                    return;
                }
                WowControl.UpdateStatus("Finded \"" + wow.Objects[ClosestIndex].Name + "\".");
                double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z + 5);
                if ((DateTime.Now - LastCheck).Milliseconds > 200)
                {
                    if ((float)Math.Abs(Range - LastRange) < 0.03)
                    {
                        TryToLoot++;
                    }
                    LastRange = Range;
                    LastCheck = DateTime.Now;
                }

                /*if (TryToLoot > 5)
                 * {
                 *  //WowControl.UpdateStatus("Bot stucked while trying to reach object.");
                 *  Abilities.Button("Jump", 1000);
                 * }*/
                if (TryToLoot > 20)
                {
                    WowControl.UpdateStatus("Can't reach object.");
                    WowControl.BadObjects.Add(wow.Objects[ClosestIndex].GUID);
                    TryToLoot = 0;
                    return;
                }
                if (Range > 8)
                {//Далеко от объекта
                    if (wow.IsMounted == 0)
                    {
                        WowControl.GetOnMount(wow, WowControl.FarmMount);
                        return;
                    }
                    WowControl.FarmStatus = "Going to goods";
                    if (wow.Objects[0].Z < wow.Objects[ClosestIndex].Z - 5)
                    {
                        wow.GoTo(wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z + 10, wow.Objects[ClosestIndex].GUID, 4);
                    }
                    else
                    {
                        wow.GoTo(wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z + 10, wow.Objects[ClosestIndex].GUID, 4);
                    }
                }
                else
                {                           //Близко
                    if (wow.IsMounted != 0) //Dismount
                    {
                        WowControl.FarmStatus = "Dismounting";
                        wow.GoTo(0, 0, 0, 0, 3);//Stop
                        Abilities.Button("Fly mount");
                        Abilities.AbilityStatus = "Ready";
                        WowControl.Sleep(1500);
                    }
                    WowControl.Sleep(200);
                    WowControl.FarmStatus = "Looting";
                    Looting            = true;
                    LootingObject.Guid = wow.Objects[ClosestIndex].GUID;
                    LootingObject.Name = wow.Objects[ClosestIndex].Name;
                    LootingObject.Time = WowControl.GetTimeStr();
                    if (wow.Objects[ClosestIndex].Type != 3)
                    {
                        //wow.GoTo(wow.Objects[0].X - 10, wow.Objects[0].Y - 10, wow.Objects[0].Z, wow.Objects[0].GUID, 4);
                        Move(wow.Objects[0].R /*- (float)Math.PI*/, 25);
                        WowControl.Sleep(100);
                        //wow.GoTo(0, 0, 0, 0, 3);//Stop
                        wow.GoTo(wow.Objects[ClosestIndex].X, wow.Objects[ClosestIndex].Y, wow.Objects[ClosestIndex].Z, wow.Objects[ClosestIndex].GUID, 7);
                    }
                    Abilities.Button("Mote xtrtr");
                    TryToLoot++;
                    if (WowControl.FindTextInString(wow.LastError, "быть не менее") == true)
                    {
                        WowControl.UpdateStatus(wow.LastError);
                        WowControl.BadObjects.Add(wow.Objects[ClosestIndex].GUID);
                    }
                    return;
                }
            }
            else
            {
                if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                {
                    WowControl.GetOnMount(wow, WowControl.FarmMount);
                }
                else
                {
                    double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z);
                    if ((DateTime.Now - LastCheck).Milliseconds > 200)
                    {
                        if ((float)Math.Abs(Range - LastRange) < 0.03)
                        {
                            TryLoFly++;
                        }
                        LastRange = Range;
                        LastCheck = DateTime.Now;
                    }
                    if (TryLoFly > 10)
                    {
                        UnstuckTimes++;
                        WowControl.UpdateStatus("Can't reach waypoint.");
                        TryLoFly = 0;
                        Move(wow.Objects[0].R - (float)Math.PI, 25);
                        WowControl.Sleep(2000);
                        Abilities.Button("Jump", 2000);
                        if (UnstuckTimes > 3)
                        {
                            CurrentWP--;
                            UnstuckTimes = 0;
                            if ((GetClosestWP(WowControl.WP) - CurrentWP) > 3)
                            {
                                CurrentWP = GetClosestWP(WowControl.WP);
                            }
                        }
                        return;
                    }
                    WowControl.FarmStatus = "Searching";
                    wow.GoTo(WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z, 0, 4);
                    WowControl.UpdateStatus("Going to waypoint № " + CurrentWP + ".");
                }
            }
        }