internal static bool PerformFinalDestinationTask2(EveCom.Bookmark bookmark, int warpDistance, ref DateTime nextAction) { // The bookmark no longer exists, assume we are there if (bookmark == null) return true; if (QuestorCache.Instance.InStation) { // We have arrived if (bookmark != null && bookmark.ID == EveCom.Session.StationID) return true; if (DateTime.UtcNow > Time.Instance.LastInSpace.AddSeconds(45)) //do not try to leave the station until you have been docked for at least 45seconds! (this gives some overhead to load the station env + session change timer) { // We are apparently in a station that is incorrect Logging.Log("QuestorManager.BookmarkDestination", "We're docked in the wrong station, undocking", Logging.White); EveCom.CommandExtenders.Execute(EveCom.Command.CmdExitStation); nextAction = DateTime.UtcNow.AddSeconds(30); return false; } return false; } // Is this a station bookmark? if ((int)bookmark.GroupID == (int)Group.Station) { bool arrived = StationDestination2.PerformFinalDestinationTask(bookmark.ID, bookmark.Title, ref nextAction); if (arrived) Logging.Log("QuestorManager.BookmarkDestination", "Arrived at bookmark [" + bookmark.Title + "]", Logging.White); return arrived; } // Its not a station bookmark, make sure we are in space if (QuestorCache.Instance.InStation) { // We are in a station, but not the correct station! if (nextAction < DateTime.UtcNow) { if (DateTime.UtcNow > Time.Instance.LastInSpace.AddSeconds(45)) //do not try to leave the station until you have been docked for at least 45seconds! (this gives some overhead to load the station env + session change timer) { Logging.Log("QuestorManager.BookmarkDestination", "We're docked but our destination is in space, undocking", Logging.White); EveCom.CommandExtenders.Execute(EveCom.Command.CmdExitStation); nextAction = DateTime.UtcNow.AddSeconds(30); } } // We are not there yet return false; } if (!QuestorCache.Instance.InSpace) { // We are not in space and not in a station, wait a bit 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("QuestorManager.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "][No XYZ]", Logging.White); // return true; //} if (bookmark.Distance < warpDistance) { Logging.Log("QuestorManager.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "]", Logging.White); return true; } if (nextAction > DateTime.UtcNow) return false; if (QuestorCache.Instance.GateInGrid() && (bookmark.Distance / 1000) < (int)Distances.MaxPocketsDistanceKm) { Logging.Log("QuestorManager.BookmarkDestination", "Bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "][" + Logging.Yellow + Math.Round((bookmark.Distance / 1000) / 149598000, 2) + Logging.White + "] AU away. Which is [" + Logging.Yellow + Math.Round((bookmark.Distance / 1000), 2) + Logging.White + "].", Logging.White); } if (DateTime.UtcNow > Time.Instance.NextWarpAction && EveCom.MyShip.Mode != EveCom.EntityMode.Warping) { bookmark.WarpTo(); } if (EveCom.MyShip.Mode == EveCom.EntityMode.Warping) { Logging.Log("QuestorManager.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "][" + Math.Round((bookmark.Distance / 1000) / 149598000, 2) + "] AU away. Which is [" + Math.Round((bookmark.Distance / 1000), 2) + "]", Logging.White); nextAction = DateTime.UtcNow.AddSeconds(30); Time.Instance.NextWarpAction = DateTime.UtcNow.AddSeconds(5); return false; } return false; }
internal static bool PerformFinalDestinationTask(EveCom.Bookmark bookmark, int warpDistance) { // The bookmark no longer exists, assume we are not there if (bookmark == null) return false; // Is this a station bookmark? if ((int)bookmark.GroupID == (int)Group.Station) { if (QuestorCache.Instance.InSpace && !QuestorCache.Instance.InStation) { if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info title: [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green); if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info locationID: [" + Logging.Yellow + bookmark.LocationID + Logging.Green + "]", Logging.Green); if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info id: [" + Logging.Yellow + bookmark.ID + Logging.Green + "]", Logging.Green); if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info distance: [" + Logging.Yellow + bookmark.Distance + Logging.Green + "]", Logging.Green); int stationNum = 0; if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "---------------------------------", Logging.Green); foreach (EntityCache station in QuestorCache.Instance.Stations) { stationNum++; if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "[" + stationNum + "] Station Name [" + Logging.Yellow + station.Name + Logging.Green + "]", Logging.Green); if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "[" + stationNum + "] Station Distance [" + Logging.Yellow + station.Distance + Logging.Green + "]", Logging.Green); if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "[" + stationNum + "] Station ID [" + Logging.Yellow + station.EveComEntity.ID + Logging.Green + "]", Logging.Green); if (station.Distance == bookmark.Distance) { ThisStation = station; } } if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "---------------------------------", Logging.Green); } if (ThisStation == null) { Logging.DebugTraveler = true; Logging.Log("TravelerDestination.BookmarkDestination", "Station missing... bookmark distance doesnt match any of the stations in local", Logging.Debug); return false; } bool arrived = StationDestination.PerformFinalDestinationTask(ThisStation.Id); if (arrived) { Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green); } return arrived; } if (QuestorCache.Instance.InStation) { // We have arrived if (bookmark.ItemID == EveCom.Session.StationID) return true; // We are in a station, but not the correct station! if (DateTime.UtcNow > Time.Instance.NextUndockAction) { TravelerDestination.Undock(); return false; } return false; } if (!QuestorCache.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 (!UseInstaBookmark()) 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; //} if (bookmark.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((bookmark.Distance / 1000)) < (int)Distances.MaxPocketsDistanceKm && QuestorCache.Instance.AccelerationGates.Count() != 0) { Logging.Log("TravelerDestination.BookmarkDestination", "Warp to bookmark in same pocket requested but acceleration gate found delaying.", Logging.White); return true; } Defense.DoNotBreakInvul = false; string nameOfBookmark = ""; if (QuestorSettings.Instance.EveServerName == "Tranquility") nameOfBookmark = "Encounter"; if (QuestorSettings.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 (MissionSettings.MissionWarpAtDistanceRange != 0 && bookmark.Title.Contains(nameOfBookmark)) { if (DateTime.UtcNow > Time.Instance.NextWarpAction && EveCom.MyShip.Mode != EveCom.EntityMode.Warping) { bookmark.WarpTo(MissionSettings.MissionWarpAtDistanceRange * 1000); } if (EveCom.MyShip.Mode == EveCom.EntityMode.Warping) { Logging.Log("TravelerDestination.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][" + Logging.Yellow + " At " + MissionSettings.MissionWarpAtDistanceRange + Logging.Green + " km]", Logging.Green); Time.Instance.NextWarpAction = DateTime.UtcNow.AddSeconds(5); return true; } } else { if (DateTime.UtcNow > Time.Instance.NextWarpAction && EveCom.MyShip.Mode != EveCom.EntityMode.Warping) { bookmark.WarpTo(); } if (EveCom.MyShip.Mode == EveCom.EntityMode.Warping) { Logging.Log("TravelerDestination.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][" + Logging.Yellow + Math.Round((bookmark.Distance / 1000) / 149598000, 2) + Logging.Green + " AU away]", Logging.Green); Time.Instance.NextWarpAction = DateTime.UtcNow.AddSeconds(5); return true; } } return false; }