コード例 #1
0
        private void TryWarping(double destX, double destY, double destZ)
        {
            if (memory.IsLocked("Warping"))
            {
                return;
            }


            var point       = new Point3D(GetRayCast(18));
            var landingZone = new RoundZone(destX, destY, 8);

            double x = point.X,
                   y = point.Y,
                   z = point.Z, polyZ = 0;


            var poly = gps.GetPolyByCoords(x, y);

            if (poly != null)
            {
                polyZ = poly.points.OrderBy(p => Host.dist(p.x, p.y, p.z)).First().z;
            }


            bool isCastReady = ((InNavMesh(x, y, z) && (Host.me.Z + 2.5) > Host.getZFromHeightMap(x, y)) || (IsPointInMesh(x, y) && polyZ != 0 && (Host.me.Z + 2.5) > polyZ))

                               && Host.me.dist(x, y) < Host.me.dist(destX, destY) &&
                               GetNavDist(x, y, z, destX, destY, destZ) < GetNavDist(destX, destY, destZ) &&
                               landingZone.PointInZone(point.X, point.Y);


            if (isCastReady && Host.UseSkill(Skills.Teleportation))
            {
                memory.Lock("Warping", 1400);
            }
        }
コード例 #2
0
        public GpsPoint GetFightPoint()
        {
            var zone = new RoundZone(FightZone.X, FightZone.Y, 1);

            return(GetFightPoints().Where(p => zone.PointInZone(p.x, p.y)).FirstOrDefault());
        }
コード例 #3
0
ファイル: MyQuestHelp.cs プロジェクト: airen1/QuesterWorking
        //Фарм
        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);
        }