private void GotoAgent(StorylineState nextState) { if (_nextAction > DateTime.UtcNow) { return; } DirectAgent storylineagent = Cache.Instance.DirectEve.GetAgentById(Cache.Instance.CurrentStorylineAgentId); if (storylineagent == null) { _States.CurrentStorylineState = StorylineState.Done; return; } StationDestination baseDestination = Traveler.Destination as StationDestination; if (baseDestination == null || baseDestination.StationId != storylineagent.StationId) { Traveler.Destination = new StationDestination(storylineagent.SolarSystemId, storylineagent.StationId, Cache.Instance.DirectEve.GetLocationName(storylineagent.StationId)); return; } if (!_highSecChecked && storylineagent.SolarSystemId != Cache.Instance.DirectEve.Session.SolarSystemId) { // if we haven't already done so, set Eve's autopilot if (!_setDestinationStation) { if (!Traveler.SetStationDestination(storylineagent.StationId)) { Logging.Log("Storyline", "GotoAgent: Unable to find route to storyline agent. Skipping.", Logging.Yellow); _States.CurrentStorylineState = StorylineState.Done; return; } _setDestinationStation = true; _nextAction = DateTime.UtcNow.AddSeconds(Cache.Instance.RandomNumber(2, 4)); return; } // Make sure we have got a clear path to the agent if (!Cache.Instance.CheckifRouteIsAllHighSec()) { if (_highSecCounter < 5) { _highSecCounter++; return; } Logging.Log("Storyline", "GotoAgent: Unable to determine whether route is all high security status or not. Skipping.", Logging.Yellow); _States.CurrentStorylineState = StorylineState.Done; _highSecCounter = 0; return; } if (!Cache.Instance.RouteIsAllHighSecBool) { Logging.Log("Storyline", "GotoAgent: Route to agent is through low-sec systems. Skipping.", Logging.Yellow); _States.CurrentStorylineState = StorylineState.Done; return; } _highSecChecked = true; } if (Cache.Instance.PotentialCombatTargets.Any()) { Combat.ProcessState(); } Traveler.ProcessState(); if (_States.CurrentTravelerState == TravelerState.AtDestination) { _States.CurrentStorylineState = nextState; Traveler.Destination = null; _setDestinationStation = false; } if (Settings.Instance.DebugStates) { Logging.Log("Traveler.State is", _States.CurrentTravelerState.ToString(), Logging.White); } }