コード例 #1
0
        public override void Pulse()
        {
            var methodName = "Pulse";

            LogTrace(methodName);

            if (_mainConfiguration.ActiveBehavior != BotModes.BoostOrca || !ShouldPulse() || _movement.IsMoving)
            {
                return;
            }

            if (!_ship.IsInventoryReady)
            {
                return;
            }

            if (Core.StealthBot.Defense.IsFleeing)
            {
                _boostOrcaState = BoostOrcaStates.Idle;
                return;
            }

            SetPulseState();
            ProcessPulseState();
        }
コード例 #2
0
        protected override void SetPulseState()
        {
            var methodName = "SetPulseState";

            LogTrace(methodName);

            if (HasMaxRuntimeExpired())
            {
                _boostOrcaState = BoostOrcaStates.Error;
                return;
            }

            if (_meCache.FleetMembers.Count == 0)
            {
                _boostOrcaState = BoostOrcaStates.WaitingForFleet;
            }
            else if (_boostOrcaState == BoostOrcaStates.WaitingForFleet)
            {
                _boostOrcaState = BoostOrcaStates.Idle;
            }
        }
コード例 #3
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;
            }
        }