Example #1
0
 private void CheckCombat()
 {
     if ((wow.Objects[0].IsInCombat == 1) & (wow.IsMounted == 0))
     {
         int Index = GetTarget();
         if (Index != 0)
         {
             double Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[Index].X, wow.Objects[Index].Y, wow.Objects[Index].Z);
             wow.SelectTarget(wow.Objects[Index].GUID);
             WowControl.FarmStatus = "Fighting";
             Target = wow.Objects[Index].GUID;
             WowControl.UpdateStatus("Fighting with \"" + wow.Objects[Index].Name + "\".");
             WowControl.UpdateCombatLog("Fighting with \"" + wow.Objects[Index].Name + "\".");
             if (WowControl.ClassType == 1)
             {
                 wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
             }
             else
             {
                 if (Range > 30)
                 {
                     wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 11);
                 }
                 else
                 {
                     wow.GoTo(0, 0, 0, 0, 3);
                     WowControl.Sleep(100);
                     wow.GoTo(0, 0, 0, wow.Objects[Index].GUID, 1);
                 }
             }
             Abilities.UseAbilities(wow, "");
         }
         return;
     }
 }
Example #2
0
        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;
            }
        }
Example #3
0
        public void Process()
        {
            if (WowControl.LoadedWP != wow.Location)
            {
                WowControl.WP = WowControl.LoadWaypoints(wow.Location);
            }
            if (wow.BattlefieldInstanceExpiration != 0)
            {
                WowControl.Sleep(2000);
                wow.Read();
                WowControl.UpdateStatus("Leaving BG.");
                wow.GoTo(0, 0, 0, 0, 3);                //Stop
                WowControl.Command("script LeaveBattlefield()");
                WowControl.WaitTime = DateTime.Now.AddSeconds(30);
                return;
            }
            switch (wow.BgStatus)
            {
            case 0:                    //Not queued
                if ((DateTime.Now - LastTime).TotalMilliseconds > 20000)
                {
                    if ((DateTime.Now - WowControl.LocationChangeTime).TotalSeconds >= 60)
                    {
                        WowControl.UpdateStatus("Joining BG queue.");
                    }
                    LastTime = DateTime.Now;
                    WowControl.btn('H');
                    WowControl.btn('H');
                    WowControl.Sleep(1000);
                    WowControl.Command("script JoinBattlefield(1)");
                    WowControl.WaitTime = DateTime.Now.AddSeconds(5);
                }
                break;

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

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

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

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

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

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

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

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

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

            int ClosestTarget = 0;

            if (WowControl.SkiningKillAll == true)
            {
                ClosestTarget = FindClosestMob();
            }
            else if (wow.Objects[0].IsInCombat == 1)
            {
                ClosestTarget = FindClosestMob();
            }
            if (ClosestTarget != 0)
            {
                if (wow.Objects[ClosestTarget].Health > 1)
                {
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestTarget].X, wow.Objects[ClosestTarget].Y, wow.Objects[ClosestTarget].Z + 5);
                    if ((DateTime.Now - LastCheck).Milliseconds > 200)
                    {
                        if ((float)Math.Abs(Range - LastRange) < 0.03)
                        {
                            TryToReach++;
                        }
                        LastRange = Range;
                        LastCheck = DateTime.Now;
                    }
                    if (TryToReach > 20)
                    {
                        WowControl.UpdateStatus("Can't reach object.");
                        WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                        TryToReach = 0;
                        return;
                    }
                    if (Range > 30)
                    {
                        if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                        {
                            WowControl.GetOnMount(wow, WowControl.FarmMount);
                        }
                    }
                    if (WowControl.FarmStatus == "Mounting")
                    {
                        return;
                    }
                    wow.SelectTarget(wow.Objects[ClosestTarget].GUID);
                    if (WowControl.ClassType == 1)
                    {
                        wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 11);
                    }
                    else
                    {
                        Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestTarget].X, wow.Objects[ClosestTarget].Y, wow.Objects[ClosestTarget].Z);
                        if (Range > 30)
                        {
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 11);
                        }
                        else
                        {
                            wow.GoTo(0, 0, 0, 0, 3);
                            WowControl.Sleep(100);
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 1);
                        }
                    }
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, wow.Objects[ClosestTarget].X, wow.Objects[ClosestTarget].Y, wow.Objects[ClosestTarget].Z);
                    int CheckRange = 0;
                    if (WowControl.ClassType == 1)
                    {
                        CheckRange = 7;
                    }
                    else
                    {
                        CheckRange = 30;
                    }
                    if ((wow.Objects[0].IsInCombat == 0) & (Range < CheckRange))
                    {
                        TryToFight++;
                    }
                    if (TryToFight > 50)
                    {
                        TryToFight = 0;
                        WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                        WowControl.UpdateCombatLog("Can't attack " + wow.Objects[ClosestTarget].Name + ".");
                        WowControl.UpdateStatus("Can't attack " + wow.Objects[ClosestTarget].Name + ".");
                    }
                    WowControl.UpdateCombatLog("Fighting with " + wow.Objects[ClosestTarget].Name + ".");
                }
                else
                {
                    if (wow.Objects[ClosestTarget].IsLootable == 1)
                    {
                        WowControl.UpdateStatus("Looting \"" + wow.Objects[ClosestTarget].Name + "\".");
                        WowControl.FarmStatus = "Looting";
                        Looting            = true;
                        LootingObject.Guid = wow.Objects[ClosestTarget].GUID;
                        LootingObject.Name = wow.Objects[ClosestTarget].Name;
                        LootingObject.Time = WowControl.GetTimeStr();
                        Move(wow.Objects[0].R /*- (float)Math.PI*/, 5);
                        Abilities.AbilityStatus = "Casting";
                        Abilities.EndCast       = DateTime.Now.AddSeconds(2);
                        WowControl.Sleep(100);
                        wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 6);//Loot
                    }
                    else
                    {
                        if (WowControl.SkinAll == true)
                        {
                            WowControl.UpdateStatus("Skining \"" + wow.Objects[ClosestTarget].Name + "\".");
                            WowControl.FarmStatus = "Skining";
                            if (wow.LastError == "С этого существа нельзя снять шкуру.")
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                                WowControl.UpdateStatus(wow.LastError);
                                return;
                            }
                            if (wow.LastError == "Недостаточный уровень навыка.")
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                                WowControl.UpdateStatus(wow.LastError);
                                return;
                            }
                            Skining = true;
                            TryToSkin++;
                            if (TryToSkin > 5)
                            {
                                WowControl.BadObjects.Add(wow.Objects[ClosestTarget].GUID);
                                WowControl.UpdateStatus("Can't skin \"" + wow.Objects[ClosestTarget] + "\".");
                                return;
                            }
                            SkinningObject.Guid = wow.Objects[ClosestTarget].GUID;
                            SkinningObject.Name = wow.Objects[ClosestTarget].Name;
                            SkinningObject.Time = WowControl.GetTimeStr();
                            Move(wow.Objects[0].R /*- (float)Math.PI*/, 5);
                            Abilities.AbilityStatus = "Casting";
                            Abilities.EndCast       = DateTime.Now.AddSeconds(4);
                            WowControl.Sleep(100);
                            wow.GoTo(0, 0, 0, wow.Objects[ClosestTarget].GUID, 9);//Skin
                        }
                    }
                }
            }
            else
            {
                if ((wow.IsMounted == 0) & (wow.IsIndoors == 0))
                {
                    WowControl.GetOnMount(wow, WowControl.FarmMount);
                }
                else
                {
                    Range = WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z);
                    if ((DateTime.Now - LastCheck).Milliseconds > 200)
                    {
                        if ((float)Math.Abs(Range - LastRange) < 0.03)
                        {
                            TryLoFly++;
                        }
                        LastRange = Range;
                        LastCheck = DateTime.Now;
                    }
                    if (TryLoFly > 10)
                    {
                        UnstuckTimes++;
                        WowControl.UpdateStatus("Can't reach waypoint.");
                        TryLoFly = 0;
                        Move(wow.Objects[0].R - (float)Math.PI, 25);
                        WowControl.Sleep(2000);
                        Abilities.Button("Jump", 2000);
                        if (UnstuckTimes > 3)
                        {
                            CurrentWP--;
                            UnstuckTimes = 0;
                            if ((GetClosestWP(WowControl.WP) - CurrentWP) > 3)
                            {
                                CurrentWP = GetClosestWP(WowControl.WP);
                            }
                        }
                        return;
                    }
                    WowControl.FarmStatus = "Searching";
                    wow.GoTo(WowControl.WP[CurrentWP].X, WowControl.WP[CurrentWP].Y, WowControl.WP[CurrentWP].Z, 0, 4);
                    WowControl.UpdateStatus("Going to waypoint № " + CurrentWP + ".");
                }
            }
        }
Example #6
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 + ".");
                }
            }
        }