Example #1
0
        public void ItemGatherFromGameObjectClassic(Quest quest, Zone zone, List <uint> farmMobIds, int objectiveindex, Host host, double z)
        {
            var badRadius = 0;

            host.FarmModule.SetFarmProps(zone, farmMobIds);
            while (host.MainForm.On && !host.AutoQuests.IsQuestCompliteClassic(quest.Id, objectiveindex) && host.FarmModule.ReadyToActions && host.FarmModule.FarmState == FarmState.FarmProps)
            {
                if (host.MyIsNeedRepair())
                {
                    break;
                }

                if (host.MyIsNeedSell())
                {
                    break;
                }

                if (host.MyIsNeedBuy())
                {
                    break;
                }

                Thread.Sleep(100);

                if (host.FarmModule.BestProp == null && !host.MyIsNeedRegen())
                {
                    badRadius++;
                }
                else
                {
                    badRadius = 0;
                }

                if (host.FarmModule.BestMob != null)
                {
                    badRadius = 0;
                }

                if (badRadius > 50)
                {
                    if (zone.ZoneType == EZoneType.Circle)
                    {
                        if (((RoundZone)zone).Radius < 50)
                        {
                            continue;
                        }
                    }

                    var loc = Vector3F.Zero;
                    foreach (var myNpcLoc in host.MyGameObjectLocss.GameObjectLocs)
                    {
                        if (!farmMobIds.Contains(myNpcLoc.Id))
                        {
                            continue;
                        }

                        foreach (var vector3F in myNpcLoc.ListLoc.OrderBy(i => host.Me.Distance2D(i)))
                        {
                            if (host.Me.Distance2D(vector3F) < 50)
                            {
                                continue;
                            }

                            if (!zone.PointInZone(vector3F.X, vector3F.Y))
                            {
                                continue;
                            }

                            if (!host.CommonModule.CheckPathForLoc(host.Me.Location, vector3F))
                            {
                                continue;
                            }

                            var bad = false;
                            foreach (var badVector3F in BadVector3Fs)
                            {
                                if (vector3F.Distance(badVector3F) < 50)
                                {
                                    bad = true;
                                }
                            }
                            if (bad)
                            {
                                continue;
                            }

                            loc = vector3F;
                        }
                    }

                    if (loc != Vector3F.Zero)
                    {
                        host.log("Не могу найти GameObject 1, подбегаю к  " + host.Me.Distance(loc) + "    " + loc);
                        if (host.CommonModule.MoveTo(loc, 20))
                        {
                            BadVector3Fs.Add(loc);
                        }
                        continue;
                    }

                    var findPoint = zone.GetRandomPoint();
                    // ReSharper disable once CompareOfFloatsByEqualityOperator
                    if (z == 0)
                    {
                        z = host.Me.Location.Z;
                    }

                    var path = host.GetSmoothPath(host.Me.Location, new Vector3F(findPoint.X, findPoint.Y, z));
                    if (path.Path.Count > 100)
                    {
                        continue;
                    }

                    var vectorPoint = new Vector3F(findPoint.X, findPoint.Y, z);
                    if (!host.CommonModule.CheckPathForLoc(host.Me.Location, vectorPoint))
                    {
                        continue;
                    }
                    // ReSharper disable once CompareOfFloatsByEqualityOperator
                    if (host.GetNavMeshHeight(vectorPoint) != 0)
                    {
                        host.log("Не могу найти GameObject, подбегаю в центр зоны " + host.Me.Distance(vectorPoint) + "    " + vectorPoint);
                        host.CommonModule.MoveTo(vectorPoint, 20);
                    }
                }
            }
            host.FarmModule.StopFarm();
            Thread.Sleep(1000);
        }
Example #2
0
        //Фарм
        public void MonsterHuntClassic(Quest quest, Zone zone, List <uint> farmMobIds, int objectiveindex, Host host, double z)
        {
            var badRadius = 0;

            foreach (var farmMobId in farmMobIds)
            {
                host.log("Мобы для квеста  " + farmMobId);
                var factionIds = new List <uint>();
                switch (quest.Id)
                {
                case 826:
                    break;

                case 837:
                    break;

                case 784:
                    break;

                case 789:
                    break;

                default:
                {
                    /*  foreach (var myNpcLoc in host.MyNpcLocss.NpcLocs)
                     * {
                     *    if (farmMobId == myNpcLoc.Id)
                     *    {
                     *        factionIds.Add(myNpcLoc.FactionId);
                     *        break;
                     *    }
                     * }*/
                }
                break;
                }
                host.FarmModule.FactionIds = factionIds;
            }

            host.FarmModule.SetFarmMobs(zone, farmMobIds);
            while (!host.AutoQuests.IsQuestCompliteClassic(quest.Id, objectiveindex) && host.FarmModule.ReadyToActions && host.FarmModule.FarmState == FarmState.FarmMobs)
            {
                Thread.Sleep(100);
                if (host.MyIsNeedSell())
                {
                    break;
                }

                if (host.MyIsNeedRepair())
                {
                    break;
                }

                if (host.MyIsNeedBuy())
                {
                    break;
                }

                if (host.FarmModule.BestMob == null && !host.MyIsNeedRegen())
                {
                    badRadius++;
                }
                else
                {
                    badRadius = 0;
                }

                if (badRadius > 50)
                {
                    if (zone.ZoneType == EZoneType.Circle)
                    {
                        if ((zone as RoundZone).Radius < 50)
                        {
                            continue;
                        }
                    }
                    var loc = Vector3F.Zero;
                    foreach (var myNpcLoc in host.MyNpcLocss.NpcLocs)
                    {
                        if (!farmMobIds.Contains(myNpcLoc.Id))
                        {
                            continue;
                        }

                        foreach (var vector3F in myNpcLoc.ListLoc.OrderBy(i => host.Me.Distance2D(i)))
                        {
                            if (host.Me.Distance2D(vector3F) < 50)
                            {
                                continue;
                            }

                            if (!zone.PointInZone(vector3F.X, vector3F.Y))
                            {
                                continue;
                            }

                            var bad = false;
                            foreach (var badVector3F in BadVector3Fs)
                            {
                                if (vector3F.Distance(badVector3F) < 50)
                                {
                                    bad = true;
                                }
                            }
                            if (bad)
                            {
                                continue;
                            }

                            if (!host.CommonModule.CheckPathForLoc(host.Me.Location, vector3F))
                            {
                                continue;
                            }

                            loc = vector3F;
                        }
                    }

                    if (loc != Vector3F.Zero)
                    {
                        host.log("Не могу найти Monster 1, подбегаю к  " + host.Me.Distance(loc) + "    " + loc);
                        if (host.CommonModule.MoveTo(loc, 20))
                        {
                            BadVector3Fs.Add(loc);
                        }
                        continue;
                    }

                    var findPoint = zone.GetRandomPoint();
                    // ReSharper disable once CompareOfFloatsByEqualityOperator
                    if (z == 0)
                    {
                        z = host.Me.Location.Z;
                    }

                    var path = host.GetSmoothPath(host.Me.Location, new Vector3F(findPoint.X, findPoint.Y, z));
                    if (path.Path.Count > 100)
                    {
                        continue;
                    }

                    if (!host.CommonModule.CheckPathForLoc(host.Me.Location, new Vector3F(findPoint.X, findPoint.Y, z)))
                    {
                        continue;
                    }

                    var vectorPoint = new Vector3F(findPoint.X, findPoint.Y, z);
                    host.log("Не могу найти Monster 2, подбегаю в центр зоны " + host.Me.Distance(vectorPoint) + "    " + vectorPoint);
                    host.CommonModule.MoveTo(vectorPoint, 20);
                }
            }
            host.FarmModule.StopFarm();
            Thread.Sleep(1000);

            if (host.CharacterSettings.Mode != Mode.QuestingClassic)
            {
                return;
            }

            if (host.FarmModule.FarmState == FarmState.Disabled)
            {
                return;
            }

            if (quest.Id == 835 || quest.Id == 1525 || quest.Id == 257 || quest.Id == 258 || quest.Id == 2499)
            {
                return;
            }

            var sw = new Stopwatch();

            sw.Start();
            if (zone.ZoneType != EZoneType.Circle)
            {
                return;
            }

            host.MainForm.SetQuestIdText("Grind 20 min");
            zone = new RoundZone((zone as RoundZone).X, (zone as RoundZone).Y, 200);

            host.FarmModule.SetFarmMobs(zone, new List <uint>());
            while (sw.ElapsedMilliseconds < 1200000 && host.FarmModule.ReadyToActions && host.FarmModule.FarmState == FarmState.FarmMobs)
            {
                Thread.Sleep(100);

                if (host.MyIsNeedSell())
                {
                    break;
                }

                if (host.MyIsNeedRepair())
                {
                    break;
                }

                if (host.MyIsNeedBuy())
                {
                    break;
                }

                if (host.FarmModule.BestMob == null && !host.MyIsNeedRegen())
                {
                    badRadius++;
                }
                else
                {
                    badRadius = 0;
                }

                host.MainForm.SetQuestStateText(sw.Elapsed.Minutes + ":" + sw.Elapsed.Seconds);
                if (badRadius > 50)
                {
                    if (zone.ZoneType == EZoneType.Circle)
                    {
                        if ((zone as RoundZone).Radius < 50)
                        {
                            continue;
                        }
                    }
                    var loc = Vector3F.Zero;
                    foreach (var myNpcLoc in host.MyNpcLocss.NpcLocs)
                    {
                        if (!farmMobIds.Contains(myNpcLoc.Id))
                        {
                            continue;
                        }

                        foreach (var vector3F in myNpcLoc.ListLoc.OrderBy(i => host.Me.Distance2D(i)))
                        {
                            if (host.Me.Distance2D(vector3F) < 50)
                            {
                                continue;
                            }

                            if (!zone.PointInZone(vector3F.X, vector3F.Y))
                            {
                                continue;
                            }

                            if (!host.CommonModule.CheckPathForLoc(host.Me.Location, vector3F))
                            {
                                continue;
                            }

                            var bad = false;
                            foreach (var badVector3F in BadVector3Fs)
                            {
                                if (vector3F.Distance(badVector3F) < 50)
                                {
                                    bad = true;
                                }
                            }
                            if (bad)
                            {
                                continue;
                            }

                            loc = vector3F;
                        }
                    }

                    if (loc != Vector3F.Zero)
                    {
                        host.log("Не могу найти Monster 1, подбегаю к  " + host.Me.Distance(loc) + "    " + loc);
                        if (host.CommonModule.MoveTo(loc, 20))
                        {
                            BadVector3Fs.Add(loc);
                        }
                        continue;
                    }

                    var findPoint = zone.GetRandomPoint();
                    // ReSharper disable once CompareOfFloatsByEqualityOperator
                    if (z == 0)
                    {
                        z = host.Me.Location.Z;
                    }

                    var path = host.GetSmoothPath(host.Me.Location, new Vector3F(findPoint.X, findPoint.Y, z));
                    if (path.Path.Count > 100)
                    {
                        continue;
                    }

                    if (!host.CommonModule.CheckPathForLoc(host.Me.Location, new Vector3F(findPoint.X, findPoint.Y, z)))
                    {
                        continue;
                    }

                    var vectorPoint = new Vector3F(findPoint.X, findPoint.Y, z);
                    host.log("Не могу найти Monster 2, подбегаю в центр зоны " + host.Me.Distance(vectorPoint) + "    " + vectorPoint);
                    host.CommonModule.MoveTo(vectorPoint, 20);
                }
            }
            host.FarmModule.StopFarm();
            Thread.Sleep(1000);
        }