예제 #1
0
        private void ChangeBelt()
        {
            var methodName = "ChangeBelt";

            LogTrace(methodName);

            if (_randomWaitObject.ShouldWait())
            {
                return;
            }

            //if I'm in station, I need to undock.
            if (_meCache.InStation)
            {
                LogMessage(methodName, LogSeverityTypes.Standard, "Undocking to move to a belt.");
                _movement.QueueDestination(new Destination(DestinationTypes.Undock, string.Empty));
                return;
            }

            //reset the wipe stuff
            _isWipingThisSpawn = false;
            //Also reset the warp-in check
            _doWarpInCheck      = true;
            _warpInCheckCounter = PulsesToWaitForRats;

            //gotta work differently depending on type of belts I'm using.
            //Only allow reseting of IsBeltEmpty if not in anomaly mode
            if (_rattingConfiguration.IsAnomalyMode)
            {
                MoveToNextAnomaly();
            }
            else
            {
                MoveToNextAsteroidBelt();
            }
        }
예제 #2
0
        protected override void ProcessPulseState()
        {
            var methodName = "ProcessPulseState";

            LogTrace(methodName);

            switch (_missionRunnerState)
            {
            //Update the mission cache:
            case MissionRunnerStates.UpdateMissionCache:
                //Initially shut the journal. Needs to be opened by ISXEVE or funky shit happens.
                if (!_startupJournalShut)
                {
                    _startupJournalShut = true;
                    using (var journalWindow = _eveWindowProvider.GetWindowByName(WINDOWNAME_JOURNAL))
                    {
                        if (!LavishScriptObject.IsNullOrInvalid(journalWindow))
                        {
                            journalWindow.Close();
                            return;
                        }
                    }
                }

                if (Core.StealthBot.MissionCache.UpdateCache(0, true))
                {
                    _missionRunnerState = MissionRunnerStates.SelectAgent;
                }
                break;

            //Pick an agent to use
            case MissionRunnerStates.SelectAgent:
                if (_hasMaxRuntimeExpired)
                {
                    return;
                }

                //If downtime is near, don't select an agent. Instead, pause.
                if (Core.StealthBot.MeCache.IsDowntimeNear)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "We're getting close to standard EVE downtime and are pausing missioning.");
                    IsEnabled = false;
                    return;
                }

                //Set the active agent
                SelectAgent();

                //If we didn't get an agent, return.
                if (SelectedAgent == null)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "There are currently no agents available. We're waiting 5 minutes before checking again.");
                    DelayNextPulseBySeconds(300);
                    return;
                }

                //See if we have a matching, accepted mission
                var cachedMission = Core.StealthBot.MissionCache.GetCachedMissionForAgentId(SelectedAgent.Id);
                if (cachedMission != null && cachedMission.State == (int)MissionStates.Accepted)
                {
                    //Set it active.
                    ActiveMission = cachedMission;

                    //Go to the MoveToStart state.
                    _missionRunnerState = MissionRunnerStates.RunMission;
                    goto case MissionRunnerStates.RunMission;
                }

                //No cached mission returned or it wasn't accepted, means we need to go get a mission.
                _missionRunnerState = MissionRunnerStates.MoveToAgent;
                goto case MissionRunnerStates.MoveToAgent;

            case MissionRunnerStates.MoveToAgent:
                //If I'm at the agent, go to MissionStart.
                if (Core.StealthBot.MeCache.SolarSystemId == SelectedAgent.SolarSystemId &&
                    Core.StealthBot.MeCache.InStation && Core.StealthBot.MeCache.StationId == SelectedAgent.StationId)
                {
                    _missionRunnerState = MissionRunnerStates.GetMissionFromAgent;
                    goto case MissionRunnerStates.GetMissionFromAgent;
                }

                if (Core.StealthBot.MeCache.InStation && Core.StealthBot.MeCache.StationId != SelectedAgent.StationId)
                {
                    Core.StealthBot.Movement.QueueDestination(new Destination(DestinationTypes.Undock));
                }

                //If I'm not in the same system, first move there
                if (Core.StealthBot.MeCache.SolarSystemId != SelectedAgent.SolarSystemId)
                {
                    Core.StealthBot.Movement.QueueDestination(new Destination(DestinationTypes.SolarSystem, SelectedAgent.SolarSystemId));
                }
                else if (!Core.StealthBot.MeCache.InStation)
                {
                    //Try to find a matching entitywrapper
                    var stationEntity = Core.StealthBot.EntityProvider.EntityWrappers.FirstOrDefault(
                        entityWrapper => entityWrapper.Name == SelectedAgent.Station);

                    //This will satisfy the conditions of the outer If check, thus it'll hit after dock.
                    Core.StealthBot.Movement.QueueDestination(new Destination(DestinationTypes.Entity, stationEntity.ID)
                    {
                        Distance = 200, Dock = true
                    });
                }
                break;

            case MissionRunnerStates.GetMissionFromAgent:
                switch (_getMissionState)
                {
                case GetMissionStates.Idle:
                    _getMissionState = GetMissionStates.GetMission;
                    goto case GetMissionStates.GetMission;

                case GetMissionStates.GetMission:
                    GetMissionFromAgent();
                    break;

                case GetMissionStates.CheckLoadout:
                    var npcResistanceProfiles = Core.StealthBot.MissionDatabase.GetNpcResistanceProfiles(ActiveMission);
                    var doneRearming          = Core.StealthBot.Ship.RearmShip(npcResistanceProfiles);

                    if (doneRearming)
                    {
                        _getMissionState    = GetMissionStates.Idle;
                        _missionRunnerState = MissionRunnerStates.RunMission;
                    }
                    break;
                }
                break;

            case MissionRunnerStates.RunMission:
                if (_duringMissionRandomWaitObject.ShouldWait())
                {
                    return;
                }

                RunMission();
                break;

            case MissionRunnerStates.TurnInMission:
                if (_betweenMissionsRandomWaitObject.ShouldWait())
                {
                    return;
                }

                TurnInMission();
                break;
            }
        }
예제 #3
0
        public override void Pulse()
        {
            var methodName = "Pulse";

            LogTrace(methodName);

            if (!ShouldPulse())
            {
                return;
            }

            if (!_meCache.InSpace || _meCache.InStation)
            {
                return;
            }

            if (_movement.IsMoving && _movement.MovementType == MovementTypes.Warp)
            {
                //Make sure all modules are off
                _ship.DeactivateModuleList(_ship.MiningLaserModules, true);
                _ship.DeactivateModuleList(_ship.SalvagerModules, true);

                if (Core.StealthBot.Config.MiningConfig.UseMiningDrones && _drones.DronesInSpace > 0)
                {
                    _drones.RecallAllDrones(true);
                }
                return;
            }

            if (_randomWait.ShouldWait())
            {
                return;
            }

            var activeTargetId = _meCache.ActiveTargetId;

            if (activeTargetId <= 0)
            {
                return;
            }

            StartPulseProfiling();
            _capacitor = _meCache.Ship.Capacitor;

            var activeTarget      = _entityProvider.EntityWrappersById[activeTargetId];
            var activeQueueTarget = _targeting.GetActiveQueueTarget();

            if (activeQueueTarget != null && !_targeting.WasTargetChangedThisFrame)
            {
                switch (activeQueueTarget.Type)
                {
                case TargetTypes.Mine:
                    //If it's not in range, approach
                    //Otherwise mine
                    if (_entityProvider.EntityWrappersById[activeQueueTarget.Id].Distance > _ship.MaximumMiningRange &&
                        (_meCache.ToEntity.Approaching == null || _meCache.ToEntity.Approaching.ID != activeQueueTarget.Id))
                    {
                        //Dequeue it, shouldn't be queued any more
                        _targetQueue.DequeueTarget(activeQueueTarget.Id);
                        //Unlock it
                        _targeting.UnlockTarget(activeTarget);
                    }
                    break;

                case TargetTypes.LootSalvage:
                    TractorTarget(activeQueueTarget);
                    break;
                }
            }

            MineTargets();
            EndPulseProfiling();
        }
예제 #4
0
        private BehaviorExecutionResults DropOffCargoToStation()
        {
            var methodName = "DropOffCargoToStation";

            LogTrace(methodName);

            switch (_stationDropOffState)
            {
            case StationDropOffStates.Idle:
                //Just go to the Unload Cargo state.
                _stationDropOffState = StationDropOffStates.UnloadCargoHold;
                goto case StationDropOffStates.UnloadCargoHold;

            case StationDropOffStates.UnloadCargoHold:
                if (_doDropoffRandomWait.ShouldWait())
                {
                    return(BehaviorExecutionResults.Incomplete);
                }

                if (!_ship.IsCargoHoldActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Debug, "Making my ship's cargo hold active.");
                    _ship.MakeCargoHoldActive();
                    return(BehaviorExecutionResults.Incomplete);
                }

                //If I'm mining, only unload ore. Otherwise, unload everything.
                if (_mainConfiguration.ActiveBehavior == BotModes.Mining)
                {
                    _ship.TransferOreInCargoHoldToStationHangar();
                }
                else
                {
                    _ship.TransferCargoHoldToStationHangar();
                }

                _stationDropOffState = StationDropOffStates.UnloadOreHold;
                break;

            case StationDropOffStates.UnloadOreHold:
                if (!_meCache.Ship.Ship.HasOreHold)
                {
                    _stationDropOffState = StationDropOffStates.StackHangar;
                    goto case StationDropOffStates.StackHangar;
                }

                if (!_ship.IsOreHoldActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Debug, "Making my ship's ore hold active.");
                    _ship.MakeOreHoldActive();
                    return(BehaviorExecutionResults.Incomplete);
                }

                //I need to add methods for specifically unloading the ore hold.
                _ship.TransferOreHoldToStationHangar();

                _stationDropOffState = StationDropOffStates.StackHangar;
                break;

            case StationDropOffStates.StackHangar:
                if (!_station.IsStationHangarActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Debug, "Making the station hangar active.");
                    _station.MakeStationHangarActive();
                    return(BehaviorExecutionResults.Incomplete);
                }

                _ship.StackInventory();

                _stationDropOffState = StationDropOffStates.RearmCharges;
                break;

            case StationDropOffStates.RearmCharges:
                //See if we need to rearm crystals.
                var isRearmComplete = _ship.RearmMiningCrystals(null);

                if (!isRearmComplete)
                {
                    break;
                }

                //Set state to idle, but don't use a goto case or it'll break things.
                _stationDropOffState = StationDropOffStates.Idle;
                return(BehaviorExecutionResults.Complete);
            }
            return(BehaviorExecutionResults.Incomplete);
        }
예제 #5
0
        public override void Pulse()
        {
            var methodName = "Pulse";

            LogTrace(methodName);

            if (!ShouldPulse())
            {
                return;
            }

            if (!_meCache.InSpace || _meCache.InStation ||
                (_movement.IsMoving && _movement.MovementType != MovementTypes.Approach))
            {
                return;
            }

            StartPulseProfiling();

            var wasTargetUnlocked = UnlockUnqueuedTargets();

            if (wasTargetUnlocked)
            {
                EndPulseProfiling();
                return;
            }

            WasTargetChangedThisFrame = false;

            //reset the modules dictionary
            _modulesBuilt = false;
            ModulesOnEntity.Clear();

            _queueTargetsByEntityId.Clear();

            if (_targetQueue.Targets.Count == 0)
            {
                _ship.DeactivateModuleList(_ship.SensorBoosterModules, true);
                EndPulseProfiling();
                return;
            }

            //Activate sensor boosters
            _ship.ActivateModuleList(_ship.SensorBoosterModules, true);

            //TargetQueue.SortQueue();
            //StartMethodProfiling("BuildE_QT_Dictionary");
            foreach (QueueTarget queueTarget in _targetQueue.Targets)
            {
                _queueTargetsByEntityId.Add(queueTarget.Id, queueTarget);
            }

            //EndMethodProfiling();
            //StartMethodProfiling("TargetNext");
            if (_randomWait.ShouldWait())
            {
                EndPulseProfiling();
                return;
            }

            if (IsTargetJammed)
            {
                LogMessage(methodName, LogSeverityTypes.Standard, "Targeting jammed, not targeting");
                _alerts.TargetJammed();
                return;
            }
            ProcessTargetQueue();
            //EndMethodProfiling();
            EndPulseProfiling();
        }