예제 #1
0
        private BehaviorExecutionResults DropOffCargoToStationCorporateHangars()
        {
            var methodName = "DropoffAtStationCorpHangarArray";

            LogTrace(methodName);

            switch (_stationDropOffState)
            {
            case StationDropOffStates.Idle:
                _stationDropOffState = StationDropOffStates.InitializeStationCorporateHangars;
                goto case StationDropOffStates.InitializeStationCorporateHangars;

            case StationDropOffStates.InitializeStationCorporateHangars:
                LogMessage(methodName, LogSeverityTypes.Debug, "Initializing station corporate hangars for item transfer.");
                _station.InitializeStationCorpHangars();

                _stationDropOffState = StationDropOffStates.UnloadCargoHold;
                break;

            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.TransferOreInCargoHoldToStationCorporateHangars();
                }
                else
                {
                    _ship.TransferCargoHoldToStationCorporateHangars();
                }

                _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.TransferOreHoldToStationCorporateHangars();

                _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:
                var rearmComplete = _ship.RearmMiningCrystals(null);

                if (!rearmComplete)
                {
                    break;
                }

                _stationDropOffState = StationDropOffStates.Idle;
                return(BehaviorExecutionResults.Complete);
            }

            return(BehaviorExecutionResults.Incomplete);
        }