Example #1
0
        private BehaviorExecutionResults MoveToDropOffCorporateHangarArray()
        {
            var methodName = "MoveToDropOffCorporateHangarArray";

            LogTrace(methodName);

            //First queue the CHA bookmark
            var cachedBookMark = _bookMarkCache.FirstBookMarkStartingWith(
                _cargoConfiguration.DropoffLocation.BookmarkLabel, true);

            if (cachedBookMark == null)
            {
                LogMessage(methodName, LogSeverityTypes.Critical, "Error: Could not find the dropoff bookmark with label \"{0}\".",
                           _cargoConfiguration.DropoffLocation.BookmarkLabel);
                return(BehaviorExecutionResults.Error);
            }

            //If I'm not on grid with the bookmark, get there
            if (!_bookmarks.IsAtBookmark(cachedBookMark))
            {
                var corporateHangarArrayBookmarkDestination = new Destination(DestinationTypes.BookMark, cachedBookMark.Id)
                {
                    Distance = MinimumDistanceToArray
                };
                _movement.QueueDestination(corporateHangarArrayBookmarkDestination);
                LogMessage(methodName, LogSeverityTypes.Standard, "Moving to dropoff location bookmark with label \"{0}\".", cachedBookMark.Label);
                return(BehaviorExecutionResults.Incomplete);
            }

            if (!_entityProvider.EntityWrappersById.ContainsKey(_cargoConfiguration.DropoffLocation.EntityID))
            {
                LogMessage(methodName, LogSeverityTypes.Critical, "Error: Could not find the dropoff entity with ID {0}.",
                           _cargoConfiguration.DropoffLocation.EntityID);
                return(BehaviorExecutionResults.Error);
            }

            //find the entity for the tower this CHA is at and move to within shield range of it
            var towerEntity = _entityProvider.EntityWrappers.FirstOrDefault(e => e.GroupID == (int)GroupIDs.ControlTower);

            if (towerEntity == null)
            {
                _logging.LogMessage(ModuleName, methodName, LogSeverityTypes.Standard, "Error: Could not find a control tower at dropoff bookmark \"{0}\".", _cargoConfiguration.DropoffLocation.BookmarkLabel);
                return(BehaviorExecutionResults.Error);
            }

            var itemInfo = _isxeveProvider.Eve.ItemInfo(towerEntity.TypeID);

            var destination = new Destination(DestinationTypes.Entity, towerEntity.ID)
            {
                Distance = itemInfo.ShieldRadius
            };

            _movement.QueueDestination(destination);
            LogMessage(methodName, LogSeverityTypes.Standard, "Moving to within {0}m of entity \"{1}\" ({2}, {3}).",
                       itemInfo.ShieldRadius, towerEntity.Name, towerEntity.ID, towerEntity.Distance);
            return(BehaviorExecutionResults.Incomplete);
        }
Example #2
0
        protected override void ProcessPulseState()
        {
            var methodName = "ProcessPulseState";

            LogTrace(methodName);

            LogMessage(methodName, LogSeverityTypes.Debug, "State: {0}",
                       _boostOrcaState);
            switch (_boostOrcaState)
            {
            case BoostOrcaStates.Idle:
                _boostOrcaState = BoostOrcaStates.GetInPosition;
                goto case BoostOrcaStates.GetInPosition;

            case BoostOrcaStates.GetInPosition:
                var boostLocationBookmark = _bookMarkCache.FirstBookMarkMatching(_miningConfiguration.BoostOrcaBoostLocationLabel, true);
                if (boostLocationBookmark == null)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "Error: Could not find a bookmark matching the boost orca location label of \"{0}\" in this system.",
                               _miningConfiguration.BoostOrcaBoostLocationLabel);
                    _boostOrcaState = BoostOrcaStates.Error;
                    return;
                }

                if (_meCache.InStation)
                {
                    LogMessage(methodName, LogSeverityTypes.Debug, "Undocking.");
                    _movement.QueueDestination(
                        new Destination(DestinationTypes.Undock));
                    return;
                }

                //Now I need to get to a safespot in space. Preferrably a tower but I can't know what type it is.
                //If I'm out of warp range, warp to it
                if (!_bookmarks.IsAtBookmark(boostLocationBookmark))
                {
                    _movement.QueueDestination(
                        new Destination(DestinationTypes.BookMark, boostLocationBookmark.Id));
                    LogMessage(methodName, LogSeverityTypes.Standard, "Moving to boost location bookmark \"{0}\".",
                               boostLocationBookmark.Label);
                }
                else
                {
                    _boostOrcaState = BoostOrcaStates.WaitInPosition;
                    goto case BoostOrcaStates.WaitInPosition;
                }
                break;

            case BoostOrcaStates.WaitInPosition:
                //Just chill here and boost for the fleet. Turn on ganglinks as needed.
                if (_ship.GangLinkModules.Count > 0 &&
                    !_ship.GangLinkModules[0].IsActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "Activating ganglink modules.");
                    _ship.ActivateModuleList(_ship.GangLinkModules, true);
                }
                if (_ship.DamageControlModules.Count > 0 &&
                    !_ship.DamageControlModules[0].IsActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "Activating damage control module.");
                    _ship.ActivateModuleList(_ship.DamageControlModules, false);
                }
                break;

            case BoostOrcaStates.Error:
                //Make sure I'm at a safespot; preferrably in space, station if required.
                if (!_safespots.IsSafe())
                {
                    var destination = _safespots.GetSafeSpot();
                    _movement.QueueDestination(destination);
                }

                IsEnabled = false;
                break;
            }
        }