예제 #1
0
파일: WowControl.cs 프로젝트: Bia10/clrn
        public static int LoadBinds(int ConfigStart, int ConfigEnd, String[] Config)
        {
            Abilities.Ability Temp = new Abilities.Ability();
            Abilities.BindingsList.Clear();
            int[] Slashes        = new int[11];
            bool  FoundedAbility = false;
            int   AbilityIndex   = 0;

            for (int i = ConfigStart; i < ConfigEnd; i++)
            {
                int Start      = 0;
                int End        = 0;
                int SlashCount = 0;
                FoundedAbility = false;
                for (int n = 0; n < Config[i].Length; n++)
                {
                    String TempStr = Config[i].Substring(n, 1);
                    if (TempStr == "%")
                    {
                        Start          = n;
                        FoundedAbility = true;
                    }
                    if (TempStr == ";")
                    {
                        End = n;
                    }
                    if (TempStr == "\\")
                    {
                        Slashes[SlashCount] = n;
                        SlashCount++;
                    }
                }
                if (FoundedAbility == true)
                {
                    try
                    {
                        Temp.AbilityName = Config[i].Substring(0, Start);
                        Temp.AbilityTxt  = Config[i].Substring(Start + 1, (Slashes[0] - 1 - Start));
                        Temp.Key         = Convert.ToInt32(Config[i].Substring(Slashes[0] + 1, (Slashes[1] - 1 - Slashes[0])));
                        Temp.NotEditable = Convert.ToBoolean(Config[i].Substring(Slashes[1] + 1, (Slashes[2] - 1 - Slashes[1])));
                        Temp.Modifiers   = Convert.ToString(Config[i].Substring(Slashes[2] + 1, (Slashes[3] - 1 - Slashes[2])));
                        Temp.CastTime    = (float)Convert.ToDouble(Config[i].Substring(Slashes[3] + 1, (Slashes[4] - 1 - Slashes[3])));
                        Temp.CoolDown    = (float)Convert.ToDouble(Config[i].Substring(Slashes[4] + 1, (Slashes[5] - 1 - Slashes[4])));
                        Temp.InCombat    = Convert.ToInt32(Config[i].Substring(Slashes[5] + 1, (Slashes[6] - 1 - Slashes[5])));
                        Temp.AbilityType = Convert.ToInt32(Config[i].Substring(Slashes[6] + 1, (End - 1 - Slashes[6])));
                    } catch (Exception) { WowControl.Log.Add(WowControl.GetTimeStr() + "Got error while loading binds. Maybe old version cfg."); }
                    Abilities.BindingsList.Add(Temp);
                    int OptionsCount = GetOptionsListCount(Config, i, Temp.AbilityName);
                    if (OptionsCount > 0)
                    {
                        LoadOptionsList(Config, i + 1, OptionsCount, AbilityIndex);
                    }
                    AbilityIndex++;
                }
            }
            return(0);
        }
예제 #2
0
 private void SaveCfg(String CfgName)
 {
     WowControl.Config.Clear();
     WowControl.Config.Add("[Variables]");
     WowControl.SaveVariable(WowControl.FarmHonor, "FarmHonor");
     WowControl.SaveVariable(WowControl.FarmMining, "FarmMining");
     WowControl.SaveVariable(WowControl.FarmSkinning, "FarmSkinning");
     WowControl.SaveVariable(WowControl.SkiningKillAll, "SkiningKillAll");
     WowControl.SaveVariable(WowControl.SkinAll, "SkinAll");
     WowControl.SaveVariable(WowControl.LootMobs, "LootMobs");
     WowControl.SaveVariable(WowControl.StayWithGroup, "StayWithGroup");
     WowControl.SaveVariable(WowControl.ClassType, "ClassType");
     WowControl.SaveVariable(WowControl.FriendCheckRange, "CheckRange");
     WowControl.SaveVariable(WowControl.EnemyCheckRange, "EnemyCheckRange");
     WowControl.SaveVariable(WowControl.HealDDPriority, "HealDDPriority");
     WowControl.SaveVariable(WowControl.GroupRange, "GroupRange");
     WowControl.SaveVariable(WowControl.MinPlayersInGroup, "MinPlayersInGroup");
     WowControl.SaveVariable(WowControl.RangeFromPlayerToGroup, "RangeFromPlayerToGroup");
     WowControl.SaveVariable(WowControl.SkiningRange, "SkiningRange");
     WowControl.SaveVariable(WowControl.FarmMount, "FarmMount");
     WowControl.SaveVariable(Autoreconnect, "Autoreconnect");
     WowControl.SaveVariable(WowControl.Account, "Account");
     WowControl.SaveVariable(CharNo, "CharNo");
     WowControl.SaveVariable(RealmNo, "RealmNo");
     Abilities.MakeBinds();
     WowControl.Config.Add("[End]");
     if (CfgName != "")
     {
         File.WriteAllLines(Application.StartupPath + "\\Configs\\" + CfgName + ".cfg", WowControl.Config.ToArray());
         WowControl.Log.Add(WowControl.GetTimeStr() + " Config " + CfgName + " saved!");
     }
     else
     {
         MessageBox.Show("Type config name", "Farm helper error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
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 + ".");
                    }
                }
            }
        }
예제 #4
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 + ".");
                }
            }
        }
예제 #5
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]);
                }
            }
        }
예제 #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 + ".");
                }
            }
        }
예제 #7
0
 private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
 {
     WowControl.Log.Add(WowControl.GetTimeStr() + "Got error while loading binds. Maybe old version cfg.");
 }