Beispiel #1
0
 private void CheckCombat()
 {
     if ((wow.Objects[0].IsInCombat == 1) & (wow.IsMounted == 0))
     {
         int Index = GetTarget();
         if (Index != 0)
         {
             double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Index].X, wow.Objects[Index].Y, wow.Objects[Index].Z);
             wow.SelectTarget(wow.Objects[Index].GUID);
             WowControl.FarmStatus = "Fighting";
             Target = wow.Objects[Index].GUID;
             WowControl.UpdateStatus("Fighting with \"" + wow.Objects[Index].Name + "\".");
             WowControl.UpdateCombatLog("Fighting with \"" + wow.Objects[Index].Name + "\".");
             if (WowControl.ClassType == 1)
             {
                 wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
             }
             else
             {
                 if (Range > 30)
                 {
                     wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
                 }
                 else
                 {
                     wow.GoTo(0, 0, 0, 0, 3);
                     WowControl.Sleep(100);
                     wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 1);
                 }
             }
             Abilities.UseAbilities(wow, "");
         }
         return;
     }
 }
Beispiel #2
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 #3
0
        private void CheckCombat()
        {
            if ((wow.Objects[0].IsInCombat == 1) & (wow.IsMounted == 0))
            {
                int Index = FindClosestMob();
                if (Index != 0)
                {
                    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 (wow.Objects[Index].IsInCombat == 1)
                    {
                        switch (WowControl.ClassType)
                        {
                        case 0:    //Ranged
                            wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 1);
                            break;

                        case 1:    //Melee
                            wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
                            break;
                        }
                    }
                    Abilities.UseAbilities(wow);
                }
                return;
            }
        }
Beispiel #4
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 #5
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 #6
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 #7
0
        public static void UseAbilities(Memory.Memory wow, String Type)
        {
            Ability[] Bindings = BindingsList.ToArray();
            Prioritets = new AbilityPrioritet[BindingsList.Count, wow.Objects.Count];
            if (EndCast <= DateTime.Now)
            {
                AbilityStatus = "Ready";
            }
            if (AbilityStatus == "Ready")
            {
                for (int i = 0; i < Bindings.Length; i++)
                {                //Прогоняем все абилы
                    if (Bindings[i].Try < 5)
                    {
                        if ((DateTime.Now - Bindings[i].LastUse).TotalSeconds >= Bindings[i].CoolDown)
                        {
                            if ((Bindings[i].InCombat >= 0) & (Bindings[i].InCombat <= 2))
                            {
                                CheckAbilityOptions(i, wow, Type);
                            }
                        }
                    }
                }

                int MaxPriority      = 0;
                int BestAbilityIndex = -1;
                int BestUnit         = -1;
                for (int Unit = 0; Unit < wow.Objects.Count; Unit++)
                {
                    for (int i = 0; i < BindingsList.Count; i++)
                    {
                        if (MaxPriority < Prioritets[i, Unit].Prioritet)
                        {
                            BestUnit         = Unit;
                            MaxPriority      = Prioritets[i, Unit].Prioritet;
                            BestAbilityIndex = i;
                        }
                    }
                }
                if (BestAbilityIndex != -1)
                {
                    Target = WowControl.GetUnitIndexByGuid(wow, Prioritets[BestAbilityIndex, BestUnit].GUID);
                    WowControl.SelectTarget(Prioritets[BestAbilityIndex, BestUnit].GUID);
                    if (Target != 0)
                    {
                        Moving(wow, Target, BestAbilityIndex);
                    }
                    if (Target == 0)
                    {
                        Button(BindingsList[BestAbilityIndex].AbilityName);
                    }
                    int Health = 0;
                    if (wow.Objects[Target].MaxHealth != 0)
                    {
                        Health = (int)Convert.ToInt64(Convert.ToDouble(wow.Objects[Target].Health) / Convert.ToDouble(wow.Objects[Target].MaxHealth) * 100);
                    }
                    WowControl.UpdateCombatLog(WowControl.GetTimeStr() + " Using \"" + Bindings[BestAbilityIndex].AbilityName + "\" on \"" + wow.Objects[Target].Name + "\" Health = " + Health + ".");
                    Bindings[BestAbilityIndex].LastUse = BindingsList[BestAbilityIndex].LastUse;
                }
                else
                {
                    Target = -1;
                }
                BindingsList.Clear();
                for (int i = 0; i < Bindings.Length; i++)
                {
                    BindingsList.Add(Bindings[i]);
                }
            }
        }