示例#1
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);
        }