Exemple #1
0
        public override bool PerformFinalDestinationTask()
        {
            // The destination is the solar system, not the station in the solar system.
            if (Cache.Instance.InStation && !Cache.Instance.InSpace)
            {
                if (_nextTravelerDestinationAction < DateTime.UtcNow)
                {
                    TravelerDestination.Undock();
                    return(false);
                }

                // We are not there yet
                return(false);
            }

            if (_nextTravelerDestinationAction > DateTime.UtcNow)
            {
                return(false);
            }

            _undockAttempts = 0;

            if (!useInstaBookmark())
            {
                return(false);
            }

            // The task was to get to the solar system, we're there :)
            Logging.Log("TravelerDestination.SolarSystemDestination", "Arrived in system", Logging.White);
            return(true);
        }
Exemple #2
0
        internal static bool PerformFinalDestinationTask(DirectBookmark bookmark, int warpDistance)
        {
            // The bookmark no longer exists, assume we are not there
            if (bookmark == null)
            {
                return(false);
            }

            // Is this a station bookmark?
            if (bookmark.Entity != null && bookmark.Entity.GroupId == (int)Group.Station)
            {
                bool arrived = StationDestination.PerformFinalDestinationTask(bookmark.Entity.Id, bookmark.Entity.Name);
                if (arrived)
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
                }

                return(arrived);
            }

            if (Cache.Instance.InStation)
            {
                // We have arrived
                if (bookmark.ItemId.HasValue && bookmark.ItemId == Cache.Instance.DirectEve.Session.StationId)
                {
                    return(true);
                }

                // We are in a station, but not the correct station!
                if (DateTime.UtcNow > Cache.Instance.NextUndockAction)
                {
                    TravelerDestination.Undock();
                    return(false);
                }

                return(false);
            }

            if (!Cache.Instance.InSpace)
            {
                // We are not in space and not in a station, wait a bit
                return(false);
            }

            if (_nextTravelerDestinationAction > DateTime.UtcNow)
            {
                return(false);
            }

            _undockAttempts = 0;

            if (Cache.Instance.UndockBookmark != null)
            {
                double distanceToUndockBookmark = Cache.Instance.DistanceFromMe(bookmark.X ?? 0, bookmark.Y ?? 0, bookmark.Z ?? 0);
                if (distanceToUndockBookmark < (int)Distances.WarptoDistance)
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at undock bookmark [" + Logging.Yellow + Cache.Instance.UndockBookmark.Title + Logging.Green + "]", Logging.Green);
                    Cache.Instance.UndockBookmark = null;
                }
                else
                {
                    if (Cache.Instance.UndockBookmark.WarpTo())
                    {
                        Logging.Log("TravelerDestination.BookmarkDestination", "Warping to undock bookmark [" + Logging.Yellow + Cache.Instance.UndockBookmark.Title + Logging.Green + "][" + Logging.Yellow + Math.Round((distanceToUndockBookmark / 1000) / 149598000, 2) + Logging.Green + " AU away]", Logging.Green);
                        _nextTravelerDestinationAction = DateTime.UtcNow.AddSeconds(Time.Instance.TravelerInWarpedNextCommandDelay_seconds);
                        //if (!Combat.ReloadAll(Cache.Instance.EntitiesNotSelf.OrderBy(t => t.Distance).FirstOrDefault(t => t.Distance < (double)Distance.OnGridWithMe))) return false;
                        return(false);
                    }
                }
            }

            // This bookmark has no x / y / z, assume we are there.
            if (bookmark.X == -1 || bookmark.Y == -1 || bookmark.Z == -1)
            {
                Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][No XYZ]", Logging.Green);
                return(true);
            }

            double distance = Cache.Instance.DistanceFromMe(bookmark.X ?? 0, bookmark.Y ?? 0, bookmark.Z ?? 0);

            if (distance < warpDistance)
            {
                Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
                return(true);
            }

            if (_nextTravelerDestinationAction > DateTime.UtcNow)
            {
                return(false);
            }

            if (Math.Round((distance / 1000)) < (int)Distances.MaxPocketsDistanceKm && Cache.Instance.AccelerationGates.Count() != 0)
            {
                Logging.Log("TravelerDestination.BookmarkDestination", "Warp to bookmark in same pocket requested but acceleration gate found delaying.", Logging.White);
                return(true);
            }

            Cache.Instance.DoNotBreakInvul = false;
            string nameOfBookmark = "";

            if (Settings.Instance.EveServerName == "Tranquility")
            {
                nameOfBookmark = "Encounter";
            }
            if (Settings.Instance.EveServerName == "Serenity")
            {
                nameOfBookmark = "遭遇战";
            }
            if (nameOfBookmark == "")
            {
                nameOfBookmark = "Encounter";
            }
            //if (!Combat.ReloadAll(Cache.Instance.EntitiesNotSelf.OrderBy(t => t.Distance).FirstOrDefault(t => t.Distance < (double)Distance.OnGridWithMe))) return false;
            if (Cache.Instance.MissionWarpAtDistanceRange != 0 && bookmark.Title.Contains(nameOfBookmark))
            {
                if (bookmark.WarpTo(Cache.Instance.MissionWarpAtDistanceRange * 1000))
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][" + Logging.Yellow + " At " + Cache.Instance.MissionWarpAtDistanceRange + Logging.Green + " km]", Logging.Green);
                }
            }
            else
            {
                if (bookmark.WarpTo())
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][" + Logging.Yellow + Math.Round((distance / 1000) / 149598000, 2) + Logging.Green + " AU away]", Logging.Green);
                }
            }

            return(false);
        }
Exemple #3
0
        internal static bool PerformFinalDestinationTask(long stationId, string stationName)
        {
            if (Cache.Instance.InStation && Cache.Instance.DirectEve.Session.StationId == stationId)
            {
                Logging.Log("TravelerDestination.StationDestination", "Arrived in station", Logging.Green);
                return(true);
            }

            if (Cache.Instance.InStation && DateTime.UtcNow > Cache.Instance.LastInSpace.AddSeconds(10))
            {
                // We are in a station, but not the correct station!
                if (DateTime.UtcNow > Cache.Instance.NextUndockAction)
                {
                    TravelerDestination.Undock();
                    return(false);
                }

                // We are not there yet
                return(false);
            }

            if ((DateTime.UtcNow > Cache.Instance.LastInStation.AddSeconds(10)) && !Cache.Instance.InSpace)
            {
                // We are not in station and not in space?  Wait for a bit
                return(false);
            }

            if (_nextTravelerDestinationAction > DateTime.UtcNow)
            {
                return(false);
            }

            _undockAttempts = 0;

            if (!useInstaBookmark())
            {
                return(false);
            }

            //else Logging.Log("TravelerDestination.BookmarkDestination","undock bookmark missing: " + Cache.Instance.DirectEve.GetLocationName((long)Cache.Instance.DirectEve.Session.StationId) + " and " + Settings.Instance.UndockPrefix + " did not both exist in a bookmark");

            if (Cache.Instance.Stations == null)
            {
                // We are there but no stations? Wait a bit
                return(false);
            }

            EntityCache station = Cache.Instance.EntitiesByName(stationName, Cache.Instance.Stations).FirstOrDefault();

            if (station == null)
            {
                // We are there but no station? Wait a bit
                return(false);
            }

            if (station.Distance < (int)Distances.DockingRange)
            {
                if (station.Dock())
                {
                    Logging.Log("TravelerDestination.StationDestination", "Dock at [" + Logging.Yellow + station.Name + Logging.Green + "] which is [" + Math.Round(station.Distance / 1000, 0) + "k away]", Logging.Green);
                    return(false); //we do not return true until we actually appear in the destination (station in this case)
                }

                return(false);
            }

            if (station.Distance < (int)Distances.WarptoDistance)
            {
                if (DateTime.UtcNow > Cache.Instance.NextApproachAction)
                {
                    Logging.Log("TravelerDestination.StationDestination", "Approaching[" + Logging.Yellow + station.Name + Logging.Green + "] which is [" + Math.Round(station.Distance / 1000, 0) + "k away]", Logging.Green);
                    station.Approach();
                    return(false);
                }

                return(false);
            }

            if (station.WarpTo())
            {
                Logging.Log("TravelerDestination.StationDestination", "Warp to and dock at [" + Logging.Yellow + station.Name + Logging.Green + "][" + Math.Round((station.Distance / 1000) / 149598000, 2) + " AU away]", Logging.Green);
                return(false);
            }

            return(false);
        }