Beispiel #1
0
        private int GetTarget()
        {
            int    ClosestIndex = 0;
            double MinRange     = 10000;

            for (int i = 1; i < wow.Objects.Count; i++)
            {
                if (wow.Objects[i].GUID == Target)
                {
                    if ((wow.Objects[i].Health == 0) & (wow.Objects[i].Name != ""))
                    {
                        WowControl.UpdateStatus("\"" + wow.Objects[i].Name + "\" owned xD.");
                        WowControl.UpdateCombatLog("\"" + wow.Objects[i].Name + "\" owned xD.");
                    }
                }
                if (wow.Objects[i].IsInCombat == 1)
                {
                    double Range = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                    if (Range < MinRange)
                    {
                        ClosestIndex = i;
                        if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                        {
                            MinRange = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                        }
                    }
                }
            }
            return(ClosestIndex);
        }
Beispiel #2
0
        private int FindClosestSkinableMob()
        {
            int    ClosestIndex = 0;
            double MinRange     = 10000;

            for (int i = 0; i < wow.Objects.Count; i++)
            {
                bool Bad = false;
                if (WowControl.BadObjects.Count > 0)
                {
                    for (int c = 0; c < WowControl.BadObjects.Count; c++)
                    {
                        if (WowControl.BadObjects[c] == wow.Objects[i].GUID)
                        {
                            Bad = true;
                        }
                    }
                }
                if ((Bad == false) & (wow.Objects[i].Type == 3) & (wow.Objects[i].Level > 1) & (wow.Objects[i].IsLootable == 0))
                {
                    if ((WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange) & (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < WowControl.SkiningRange))
                    {
                        ClosestIndex = i;
                        if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                        {
                            MinRange = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                        }
                    }
                }
            }
            return(ClosestIndex);
        }
Beispiel #3
0
 private void Loot(int Index)
 {
     if (Abilities.AbilityStatus == "Casting")
     {
         Status = "Looting";
     }
     else if ((Status == "Looting") & (Abilities.AbilityStatus == "Ready"))
     {
         Status = "Ready";
     }
     if (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) > 10)
     {
         if (wow.Objects[0].Z < wow.Objects[Index].Z)
         {
             wow.GoTo(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[Index].Z + 30, wow.Objects[Index].GUID, 4);
         }
         else
         {
             wow.GoTo(wow.Objects[Index].X, wow.Objects[Index].Y, wow.Objects[Index].Z, wow.Objects[Index].GUID, 4);
         }
     }
     else
     {
         if (wow.Objects[Index].Type == 3)
         {
             Abilities.Button("Mote xtrtr");
         }
         else
         {
             wow.GoTo(wow.Objects[Index].X, wow.Objects[Index].Y, wow.Objects[Index].Z, wow.Objects[Index].GUID, 7);
         }
     }
 }
Beispiel #4
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;
     }
 }
Beispiel #5
0
        private int FindClosestGoods()
        {
            int    ClosestIndex = 0;
            double MinRange     = 10000;

            for (int n = 0; n < WowControl.Goods.Count; n++)
            {
                for (int i = 0; i < wow.Objects.Count; i++)
                {
                    bool Bad = false;
                    if (WowControl.BadObjects.Count > 0)
                    {
                        for (int c = 0; c < WowControl.BadObjects.Count; c++)
                        {
                            if (WowControl.BadObjects[c] == wow.Objects[i].GUID)
                            {
                                Bad = true;
                            }
                        }
                    }
                    if ((Bad == false) & (wow.Objects[i].Type != 4) & (wow.Objects[i].Name == WowControl.Goods[n]))
                    {
                        if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                        {
                            ClosestIndex = i;
                            if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                            {
                                MinRange = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                            }
                        }
                    }
                }
            }
            return(ClosestIndex);
        }
Beispiel #6
0
        private int FindClosestMob()
        {
            int    ClosestIndex = 0;
            double MinRange     = 10000;
            bool   Looted       = false;
            bool   Skined       = true;

            for (int i = 0; i < wow.Objects.Count; i++)
            {
                bool Bad = false;
                if (WowControl.BadObjects.Count > 0)
                {
                    for (int c = 0; c < WowControl.BadObjects.Count; c++)
                    {
                        if (WowControl.BadObjects[c] == wow.Objects[i].GUID)
                        {
                            Bad = true;
                        }
                    }
                }
                if ((Bad == false) & (wow.Objects[i].Type == 3) & (wow.Objects[i].Level > 1))
                {
                    if ((WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange) & (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < WowControl.SkiningRange))
                    {
                        ClosestIndex = i;
                        if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                        {
                            MinRange = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                        }
                    }
                }
                if (SkinningObject.Guid == wow.Objects[i].GUID)
                {
                    Skined = false;
                }
                if ((LootingObject.Guid == wow.Objects[i].GUID) & (wow.Objects[i].IsLootable == 0))
                {
                    Looted = true;
                }
            }
            if ((Skined == true) & (Skining == true))
            {
                Skining   = false;
                TryToSkin = 0;
                WowControl.Loot.Add(SkinningObject);
                CurrentWP = GetClosestWP(WowControl.WP);
                WowControl.UpdateStatus("Skined: \"" + SkinningObject.Name + "\".");
            }
            if ((Looted == true) & (Looting == true) & (Skining == false))
            {
                Looted    = false;
                TryToLoot = 0;
                CurrentWP = GetClosestWP(WowControl.WP);
                WowControl.UpdateStatus("Looted : \"" + LootingObject.Name + "\".");
            }
            return(ClosestIndex);
        }
Beispiel #7
0
        private int DetectWPSearchRange()
        {
            /*int CourseLenght = 0;
             * for (int i = 0; i < WowControl.WP.Length; i++)
             *      if (i < WowControl.WP.Length - 1)
             *              CourseLenght += (int)WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WowControl.WP[i + 1].X, WowControl.WP[i + 1].Y, WowControl.WP[i + 1].Z);
             */
            int I = WowControl.WP.Length / 2;
            int T = (int)WowControl.CheckPoint(WowControl.WP[I].X, WowControl.WP[I].Y, WowControl.WP[I].Z, WowControl.WP[I + 1].X, WowControl.WP[I + 1].Y, WowControl.WP[I + 1].Z);

            return((int)(T * 1.3));         //Convert.ToInt32(CourseLenght * 1.2 / WowControl.WP.Length);
        }
Beispiel #8
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 + ".");
            }
        }
Beispiel #9
0
        private int FindClosestGoods()
        {
            int    ClosestIndex = 0;
            double MinRange     = 10000;
            bool   Looted       = true;

            for (int n = 0; n < WowControl.Goods.Count; n++)
            {
                for (int i = 0; i < wow.Objects.Count; i++)
                {
                    bool Bad = false;
                    if (WowControl.BadObjects.Count > 0)
                    {
                        for (int c = 0; c < WowControl.BadObjects.Count; c++)
                        {
                            if (WowControl.BadObjects[c] == wow.Objects[i].GUID)
                            {
                                Bad = true;
                            }
                        }
                    }
                    if ((Bad == false) & (wow.Objects[i].Type != 4) & (wow.Objects[i].Name == WowControl.Goods[n]))
                    {
                        if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                        {
                            ClosestIndex = i;
                            if (WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z) < MinRange)
                            {
                                MinRange = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                            }
                        }
                    }
                    if ((LootingObject.Guid == wow.Objects[i].GUID) & (Bad == false))
                    {
                        Looted = false;
                    }
                }
            }
            if ((Looted == true) & (Looting == true))
            {
                Looting   = false;
                TryToLoot = 0;
                WowControl.Loot.Add(LootingObject);
                CurrentWP = GetClosestWP(WowControl.WP);
                WowControl.UpdateStatus("Looted: \"" + LootingObject.Name + "\".");
            }
            return(ClosestIndex);
        }
Beispiel #10
0
        private int GetClosestWP(int CurrentWP, MainForm.Coords[] WP)
        {
            int    ClosestIndex = 0;
            double ClosestRange = 10000;

            for (int i = 0; i < WP.Length; i++)
            {
                double p = WowControl.CheckPoint(WP[i].X, WP[i].Y, WP[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                if (p < ClosestRange)
                {
                    ClosestIndex = i;
                    ClosestRange = WowControl.CheckPoint(WP[CurrentWP].X, WP[CurrentWP].Y, WP[CurrentWP].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                }
            }
            return(ClosestIndex);
        }
Beispiel #11
0
        private int GetClosestWP(MainForm.WayPoints[] WP)
        {
            double MinRange     = 10000;
            int    ClosestIndex = 0;

            for (int i = 0; i < WP.Length; i++)
            {
                double Range = WowControl.CheckPoint(WP[i].X, WP[i].Y, WP[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                if (Range < MinRange)
                {
                    ClosestIndex = i;
                    MinRange     = WowControl.CheckPoint(WP[i].X, WP[i].Y, WP[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                }
            }
            return(ClosestIndex);
        }
Beispiel #12
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);
        }
Beispiel #13
0
        private int GetClosestWP(float X, float Y, float Z)
        {
            MainForm.WayPoints WP = new MainForm.WayPoints();
            WP.X = X; WP.Y = Y; WP.Z = Z;
            double MinRange     = 10000;
            int    ClosestIndex = 0;

            for (int i = 0; i < WowControl.WP.Length; i++)
            {
                double Range = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
                if (Range < MinRange)
                {
                    ClosestIndex = i;
                    MinRange     = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
                }
            }
            return(ClosestIndex);
        }
Beispiel #14
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);
        }
Beispiel #15
0
 private void WPTimer_Tick(object sender, EventArgs e)
 {
     if (checkBox1.Checked == true)
     {
         MainForm.WayPoints New  = new MainForm.WayPoints();
         MainForm.Coords    Temp = new MainForm.Coords();
         wow.Read();
         if (wow.Objects.Count == 0)
         {
             return;
         }
         Temp.X = wow.Objects[0].X;
         Temp.Y = wow.Objects[0].Y;
         Temp.Z = wow.Objects[0].Z;
         if (PCoord.ToArray().Length == 0)
         {
             New.X            = wow.Objects[0].X;
             New.Y            = wow.Objects[0].Y;
             New.Z            = wow.Objects[0].Z;
             New.NextWaypoint = WayPoints.Count + 1;
             WayPoints.Add(New);
             FillListBox();
             PCoord.Add(Temp);
         }
         else
         {
             if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, PCoord[PCoord.ToArray().Length - 1].X, PCoord[PCoord.ToArray().Length - 1].Y, PCoord[PCoord.ToArray().Length - 1].Z) > WPRange)
             {
                 New.X            = wow.Objects[0].X;
                 New.Y            = wow.Objects[0].Y;
                 New.Z            = wow.Objects[0].Z;
                 New.NextWaypoint = WayPoints.Count + 1;
                 WayPoints.Add(New);
                 if (checkBox2.Checked == true)
                 {
                     SetNextWP();
                 }
                 FillListBox();
                 PCoord.Add(Temp);
             }
         }
     }
 }
Beispiel #16
0
        private List <WaypointsInfo> GetClosestWPList(int WPNO, int Course, int WPRange, int FinishWaypoint)
        {
            List <WaypointsInfo> Result = new List <WaypointsInfo>();

            MainForm.WayPoints WP = new MainForm.WayPoints();
            WP.X = WowControl.WP[WPNO].X; WP.Y = WowControl.WP[WPNO].Y; WP.Z = WowControl.WP[WPNO].Z;
            for (int i = 0; i < WowControl.WP.Length; i++)
            {
                double Range = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
                if ((Range < WPRange) & (WaypointAlreadyInCourse(i, Course) == false))
                {
                    WaypointsInfo Temp = new WaypointsInfo();
                    Temp.Index = i;
                    Temp.Range = Range;
                    Result.Add(Temp);
                }
            }
            Result.Sort((a, b) => a.Range.CompareTo(b.Range));
            return(Result);
        }
Beispiel #17
0
        private int GetClosestTeleport()
        {
            double MinRange = 10000;

            int ClosestIndex = 0;

            for (int i = 0; i < wow.Objects.Count; i++)
            {
                if ((wow.Objects[i].Type == 5) & ((wow.Objects[i].Name == "Телепорт") || (wow.Objects[i].Name == "Портал защитника")))
                {
                    double Range = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                    if (Range < MinRange)
                    {
                        ClosestIndex = i;
                        MinRange     = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z);
                    }
                }
            }
            return(ClosestIndex);
        }
Beispiel #18
0
        private bool IsPlayerCloseToVein(int index)
        {
            double PlayerRange = 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);

            for (int i = 0; i < wow.Objects.Count; i++)
            {
                if (wow.Objects[i].Type == 4)
                {
                    double EnemyRange = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, wow.Objects[index].X, wow.Objects[index].Y, wow.Objects[index].Z);
                    if (EnemyRange < 10)
                    {
                        if (EnemyRange < PlayerRange)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #19
0
 private void CalculateCourses()
 {
     for (int i = 0; i < Courses.Count; i++)
     {
         if (CourseIsBad(i) == false)
         {
             int CourseLenght = 0;
             for (int c = 0; c < Courses[i].Count; c++)
             {
                 if (c < Courses[i].Count - 1)
                 {
                     CourseLenght += (int)WowControl.CheckPoint(WowControl.WP[Courses[i][c]].X, WowControl.WP[Courses[i][c]].Y, WowControl.WP[Courses[i][c]].Z, WowControl.WP[Courses[i][c + 1]].X, WowControl.WP[Courses[i][c + 1]].Y, WowControl.WP[Courses[i][c + 1]].Z);
                 }
             }
             WaypointsInfo Temp = new WaypointsInfo();
             Temp.Index = i;
             Temp.Range = CourseLenght;
             CalculatedCourses.Add(Temp);
         }
     }
 }
Beispiel #20
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 + ".");
         }
     }
 }
Beispiel #21
0
        public static bool SubCheckAbilityOptions(int AbilityIndex, Memory.Memory wow, String Type, int Unit)
        {
            bool result      = false;
            int  PlayerRange = 0;

            if (WowControl.ClassType == 0)            //Ranged
            {
                PlayerRange = 30;
            }
            else
            {
                PlayerRange = 7;
            }
            if (AbilityIndex == 14)
            {
                int y = 0;
                y++;
            }
            double Range = Convert.ToInt32(WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Unit].X, wow.Objects[Unit].Y, wow.Objects[Unit].Z));

            for (int i = 0; i < BindingsList[AbilityIndex].OptionsList.Count; i++)
            {
                if ((BindingsList[AbilityIndex].OptionsList[i].Unit == "Player") & (Unit == 0))
                {
                    if (i == 0)
                    {
                        result = CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                    }
                    else
                    {
                        if (BindingsList[AbilityIndex].OptionsList[i - 1].AndOr == "AND")
                        {
                            result = result & CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                        }
                        else if (BindingsList[AbilityIndex].OptionsList[i - 1].AndOr == "OR")
                        {
                            result = result | CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                        }
                    }
                }
                else if ((BindingsList[AbilityIndex].OptionsList[i].Unit == "Enemy") & (wow.Objects[Unit].Faction != wow.Objects[0].Faction) & (Range <= WowControl.EnemyCheckRange))
                {
                    if (i == 0)
                    {
                        result = CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                    }
                    else
                    {
                        if (BindingsList[AbilityIndex].OptionsList[i - 1].AndOr == "AND")
                        {
                            result = result & CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                        }
                        else if (BindingsList[AbilityIndex].OptionsList[i - 1].AndOr == "OR")
                        {
                            result = result | CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                        }
                    }
                }
                else if ((BindingsList[AbilityIndex].OptionsList[i].Unit == "Friend") & (wow.Objects[Unit].Faction == wow.Objects[0].Faction) & (Range <= WowControl.FriendCheckRange))
                {
                    if (i == 0)
                    {
                        result = CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                    }
                    else
                    {
                        if (BindingsList[AbilityIndex].OptionsList[i - 1].AndOr == "AND")
                        {
                            result = result & CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                        }
                        else if (BindingsList[AbilityIndex].OptionsList[i - 1].AndOr == "OR")
                        {
                            result = result | CheckOptionsValues(Unit, BindingsList[AbilityIndex].OptionsList[i].Parameter, BindingsList[AbilityIndex].OptionsList[i].Condition, BindingsList[AbilityIndex].OptionsList[i].Value, wow);
                        }
                    }
                }
            }
            if (result == true)
            {            //Выставляем приоритет
                int Priority = 0;
                if (wow.Objects[Unit].MaxHealth != 0)
                {
                    int Health = (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100);
                    if (wow.Objects[Unit].Faction == wow.Objects[0].Faction)
                    {                    //Friend or player
                        if (Unit == 0)   //Player
                        {
                            Priority = Health * 2;
                        }
                        else
                        {
                            Priority = Convert.ToInt32(Health + (PlayerRange - Range) * 100 / 30);
                        }
                    }
                    else
                    {                    //Enemy
                        Priority = Convert.ToInt32(Health + (PlayerRange - Range) * 100 / 30);
                    }
                    if (Prioritets[AbilityIndex, Unit].Prioritet < Priority)
                    {
                        Prioritets[AbilityIndex, Unit].Prioritet = Priority;
                    }
                    if (Priority >= Prioritets[AbilityIndex, Unit].Prioritet)
                    {
                        Prioritets[AbilityIndex, Unit].GUID = wow.Objects[Unit].GUID;
                    }
                    if ((Math.Abs(wow.Objects[0].Level - wow.Objects[Unit].Level) > 5) & (Type == "Bg"))
                    {
                        Prioritets[AbilityIndex, Unit].Prioritet = 0;
                    }
                }

                /*
                 * for (int i = 0; i < BindingsList[AbilityIndex].OptionsList.Count; i++)
                 * {//Прогоняем все опции для абилы
                 *      if (wow.Objects[Unit].MaxHealth != 0)
                 *      {
                 *              if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Friend")
                 *              {
                 *                      if (BindingsList[AbilityIndex].OptionsList[i].Parameter != "SpellID")
                 *                              Priority = (100 - (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100)) * 3;
                 *                      else Priority = 90;
                 *                      if (Unit == 0)
                 *                              Priority *= 2;
                 *              }
                 *              if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Player")
                 *                      if (BindingsList[AbilityIndex].OptionsList[i].Parameter != "SpellID")
                 *                              Priority = (100 - (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100)) * 4;
                 *                      else Priority = 90;
                 *              if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Enemy")
                 *              {
                 *                      double param =(PlayerRange - Range) / 10;
                 *                      if (param > 0)
                 *                              Priority = (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100 * param);
                 *              }
                 *      }
                 *      if (Prioritets[AbilityIndex, Unit].Prioritet < Priority)
                 *              Prioritets[AbilityIndex, Unit].Prioritet = Priority;
                 *
                 *      /*
                 *      if (BindingsList[AbilityIndex].OptionsList[i].Parameter == "SpellID")
                 *      {
                 *              if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Friend")
                 *              {
                 *                      Priority = (100 - (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100)) * 3;
                 *                      if (Unit == 0)
                 *                              Priority *= 2;
                 *              }
                 *              if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Player")
                 *                      Priority = (100 - (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100)) * 4;
                 *              if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Enemy")
                 *              {
                 *                      int param = Convert.ToInt32((PlayerRange - Range) / 10);
                 *                      Priority = (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100) * param;
                 *              }
                 *      } else if (BindingsList[AbilityIndex].OptionsList[i].Parameter == "Health")
                 *      {
                 *              if (wow.Objects[Unit].MaxHealth != 0)
                 *              {
                 *                      if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Friend")
                 *                      {
                 *                              Priority = (100 - (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100)) * 3;
                 *                              if (Unit == 0)
                 *                                      Priority *= 2;
                 *                      }
                 *                      if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Player")
                 *                              Priority = (100 - (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100)) * 4;
                 *                      if (BindingsList[AbilityIndex].OptionsList[i].Unit == "Enemy")
                 *                      {
                 *                              int param = Convert.ToInt32((PlayerRange - Range) / 10);
                 *                              Priority = (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100) * param;
                 *                      }
                 *              }
                 *              if (Prioritets[AbilityIndex, Unit].Prioritet < Priority)
                 *                      Prioritets[AbilityIndex, Unit].Prioritet = Priority;
                 *      } else if (BindingsList[AbilityIndex].OptionsList[i].Parameter == "Range")
                 *      {
                 *              if (Prioritets[AbilityIndex, Unit].Prioritet == 0)
                 *                      if (WowControl.ClassType == 0)//Ranged
                 *                              Priority = 100 - Convert.ToInt32(WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Unit].X, wow.Objects[Unit].Y, wow.Objects[Unit].Z));
                 *                      else Priority = 100 - Convert.ToInt32(WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Unit].X, wow.Objects[Unit].Y, wow.Objects[Unit].Z)) * 2;
                 *              if (Prioritets[AbilityIndex, Unit].Prioritet < Priority)
                 *                      Prioritets[AbilityIndex, Unit].Prioritet = Priority;
                 *      } else if (BindingsList[AbilityIndex].OptionsList[i].Parameter == "Power")
                 *      {
                 *              if (Prioritets[AbilityIndex, Unit].Prioritet == 0)
                 *                      Priority = 70;
                 *      }
                 *
                 * }*/
            }
            return(result);
        }
Beispiel #22
0
        private int FindClosestGroup()
        {
            Groups.Clear();
            int GroupRange             = WowControl.GroupRange;
            int RangeFromPlayerToGroup = WowControl.RangeFromPlayerToGroup;
            int MinPlayersInGroup      = WowControl.MinPlayersInGroup;

            for (int i = 1; i < wow.Objects.Count; i++)
            {
                if ((wow.Objects[i].Health > 1) & (wow.Objects[i].Faction == wow.Objects[0].Faction))
                {
                    GroupInfo Temp = new GroupInfo();
                    Temp.Indexes = new List <int>();
                    if (Groups.Count == 0)
                    {
                        Temp.X = wow.Objects[i].X;
                        Temp.Y = wow.Objects[i].Y;
                        Temp.Z = wow.Objects[i].Z;
                        Temp.CountPlayers++;
                        Temp.Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z);
                        Temp.Indexes.Add(i);
                        Groups.Add(Temp);
                    }
                    else
                    {
                        bool InGroup = false;
                        for (int g = 0; g < Groups.Count; g++)
                        {
                            double Range = WowControl.CheckPoint(wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z, Groups[g].X, Groups[g].Y, Groups[g].Z);
                            if (Range < GroupRange)
                            {
                                InGroup = true;
                                GroupInfo[] TempGroup = Groups.ToArray();
                                //TempGroup[g].Indexes = new List<int>(Groups[g].Indexes.Count);
                                //for (int count = 0; count < Groups[g].Indexes.Count; count++)
                                //TempGroup[g].Indexes.Add(Groups[g].Indexes[count]);
                                TempGroup[g].Indexes.Add(i);
                                TempGroup[g].CountPlayers++;
                                float x = 0, y = 0, z = 0;
                                for (int gi = 0; gi < TempGroup[g].Indexes.Count; gi++)
                                {
                                    x += wow.Objects[TempGroup[g].Indexes[gi]].X;
                                    y += wow.Objects[TempGroup[g].Indexes[gi]].Y;
                                    z += wow.Objects[TempGroup[g].Indexes[gi]].Z;
                                }
                                TempGroup[g].X     = x / TempGroup[g].Indexes.Count;
                                TempGroup[g].Y     = y / TempGroup[g].Indexes.Count;
                                TempGroup[g].Z     = z / TempGroup[g].Indexes.Count;
                                TempGroup[g].Range = WowControl.CheckPoint(TempGroup[g].X, TempGroup[g].Y, TempGroup[g].Z, Groups[0].X, Groups[0].Y, Groups[0].Z);
                                Groups.Clear();
                                for (int c = 0; c < TempGroup.Length; c++)
                                {
                                    Groups.Add(TempGroup[c]);
                                    //for (int ii = 0; ii < TempGroup[c].Indexes.Count; ii++)
                                    //Groups[c].Indexes.Add(TempGroup[c].Indexes[ii]);
                                }
                            }
                        }
                        if (InGroup == false)
                        {
                            Temp.X = wow.Objects[i].X;
                            Temp.Y = wow.Objects[i].Y;
                            Temp.Z = wow.Objects[i].Z;
                            Temp.CountPlayers++;
                            Temp.Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[i].X, wow.Objects[i].Y, wow.Objects[i].Z);
                            Temp.Indexes.Add(i);
                            Groups.Add(Temp);
                        }
                    }
                }
            }
            double MinRange     = 10000;
            int    ClosestGroup = 1000;

            for (int i = 0; i < Groups.Count; i++)
            {
                double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, Groups[i].X, Groups[i].Y, Groups[i].Z);
                if (Range < RangeFromPlayerToGroup)
                {
                    if ((Groups[i].Range != 0) & (Groups[i].Range < MinRange) & (Groups[i].Range < RangeFromPlayerToGroup) & (Groups[i].CountPlayers >= MinPlayersInGroup))
                    {
                        MinRange     = Groups[i].Range;
                        ClosestGroup = i;
                    }
                }
            }
            return(ClosestGroup);
        }
Beispiel #23
0
        public static bool CheckOptionsValues(int Unit, String Parameter, String Condition, String Value, Memory.Memory wow)
        {
            bool result     = false;
            int  UnitParam  = 0;
            int  ValueParam = Convert.ToInt32(Value);

            if (Parameter == "Health")
            {
                if (wow.Objects[Unit].MaxHealth != 0)
                {
                    UnitParam = (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Unit].Health) / Convert.ToDouble(wow.Objects[Unit].MaxHealth) * 100);
                }
            }
            if (Parameter == "SpellID")
            {
                if (IsSpellOntarget(wow, Unit, Convert.ToInt32(Value)) == true)
                {
                    if (Condition == "=")
                    {
                        return(true);
                    }
                    else if (Condition == "!=")
                    {
                        return(false);
                    }
                }
                else
                {
                    if (Condition == "=")
                    {
                        return(false);
                    }
                    else if (Condition == "!=")
                    {
                        return(true);
                    }
                }
            }
            if (Parameter == "Range")
            {
                UnitParam = Convert.ToInt32(WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Unit].X, wow.Objects[Unit].Y, wow.Objects[Unit].Z));
            }
            if (Parameter == "Power")
            {
                UnitParam = wow.Objects[Unit].Power;
            }
            if (Condition == ">")
            {
                result = (UnitParam > ValueParam);
            }
            else if (Condition == "<")
            {
                result = (UnitParam < ValueParam);
            }
            else if (Condition == "=")
            {
                result = (UnitParam == ValueParam);
            }
            else if (Condition == "!=")
            {
                result = (UnitParam != ValueParam);
            }
            return(result);
        }
Beispiel #24
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 + ".");
                }
            }
        }
Beispiel #25
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 + ".");
                    }
                }
            }
        }
Beispiel #26
0
        private bool FollowCourse()
        {
            int FinishWP      = 0;
            int OptimalCourse = 0;

            if ((DateTime.Now - LastCourseDetect).TotalSeconds > 10)
            {
                LastCourseDetect = DateTime.Now;
                int RangeFromPlayerToGroup = WowControl.RangeFromPlayerToGroup;
                WowControl.RangeFromPlayerToGroup = 2500;
                int ClosestGroup = FindClosestGroup();
                WowControl.RangeFromPlayerToGroup = RangeFromPlayerToGroup;
                if (ClosestGroup != 1000)
                {
                    LastGroup = ClosestGroup;
                    //CurrentWP = 0;
                    FinishWP = GetClosestWP(Groups[ClosestGroup].X, Groups[ClosestGroup].Y, Groups[ClosestGroup].Z);
                }
                else
                {
                    return(false);
                }
                //if (LastGroup != ClosestGroup)
                {
                    FindCourse(FinishWP);
                    CurrentWP = 0;
                }
            }
            if (CalculatedCourses.Count == 0)
            {
                FindCourse(FinishWP);
                CurrentWP = 0;
            }
            if (CalculatedCourses.Count != 0)
            {
                /*for (int i = 0; i < Courses[CalculatedCourses[OptimalCourse].Index].Count; i++)
                 * {
                 *      if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[Courses[CalculatedCourses[0].Index][i]].X, WowControl.WP[Courses[CalculatedCourses[0].Index][i]].Y, WowControl.WP[Courses[CalculatedCourses[0].Index][i]].Z) < 5)
                 *      {
                 *              CurrentWP = i + 1;
                 *              break;
                 *      }
                 * }*/
                if (CurrentWP >= Courses[CalculatedCourses[0].Index].Count)
                {
                    return(false);
                }
                if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[Courses[CalculatedCourses[0].Index][CurrentWP]].X, WowControl.WP[Courses[CalculatedCourses[0].Index][CurrentWP]].Y, WowControl.WP[Courses[CalculatedCourses[0].Index][CurrentWP]].Z) < 5)
                {
                    CurrentWP++;
                }
                int CourseWP = Courses[CalculatedCourses[OptimalCourse].Index][CurrentWP];
                wow.GoTo(WowControl.WP[CourseWP].X, WowControl.WP[CourseWP].Y, WowControl.WP[CourseWP].Z, 0, 4);
                WowControl.UpdateStatus("Going to course waypoint № " + CurrentWP + ".");
                if ((DateTime.Now - LastTime).TotalMilliseconds > 3000)
                {
                    LastTime = DateTime.Now;
                    if (wow.IsMounted == 0)
                    {
                        Abilities.Button("Jump");
                    }
                }
                return(true);
            }
            return(false);
        }
Beispiel #27
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 + ".");
                }
            }
        }