コード例 #1
0
        public void Handle(IEvent @event)
        {
            string currentSystem = _playerStatus.Location;

            IEnumerable <Celestial> remaining = _navigator.GetSystem(currentSystem)?
                                                .Celestials
                                                .Where(c => c.Scanned == false)
                                                .OrderBy(r => r.ShortName);


            bool surfaceScansRemain = false;

            if (remaining == null)
            {
                _communicator.Communicate(_skipPhraseBook.GetRandomPhrase());
                return;
            }

            if (!remaining.Any())
            {
                remaining = _navigator.GetSystem(currentSystem)?
                            .Celestials
                            .Where(c => c.SurfaceScanned == false)
                            .OrderBy(r => r.ShortName);

                if (!remaining.Any())
                {
                    _communicator.Communicate(_completePhrases.GetRandomPhrase());
                    return;
                }
                else
                {
                    surfaceScansRemain = true;
                }
            }

            string script = string.Empty;

            foreach (Celestial celestial in remaining)
            {
                if (celestial == remaining.Last() && remaining.Count() > 1)
                {
                    script += $" {_andPhrase} ";
                }

                script += $"{_planetPhrase} {celestial.ShortName}. ";
            }

            string finalScript = string.Format(_remainingPhrases.GetRandomPhrase(),
                                               remaining.Count(), script,
                                               surfaceScansRemain ? "surface " : "",
                                               PhraseBook.PluralizedEnding(remaining.Count(), "s"));

            _communicator.Communicate(finalScript);
        }
コード例 #2
0
        private string BuildScript(string currentSystem, bool expeditionSystem)
        {
            string script = _scanCompletePhrases.GetRandomPhrase();

            if (!expeditionSystem)
            {
                return(script);
            }

            if (_navigator.GetSystem(currentSystem).Celestials.Any(c => c.Scanned == false))
            {
                int scansRemaining = _navigator.GetRemainingCelestials(currentSystem).Count();

                if (scansRemaining == 1)
                {
                    return(script += _oneRemainingPhrases.GetRandomPhrase());
                }

                return(script += _multipleRemainingPhrases.GetRandomPhraseWith(scansRemaining));
            }

            if (_navigator.ExpeditionComplete)
            {
                return(script += _expeditionCompletePhrases.GetRandomPhrase());
            }

            return(script += _allScansCompletePhrases.GetRandomPhrase());
        }
コード例 #3
0
        public void Handle(IEvent @event)
        {
            Dictionary <string, object> payload = @event.Payload;

            if (payload.ContainsKey("JumpType") && payload["JumpType"].ToString() == "Supercruise")
            {
                return;
            }

            string systemName = payload["StarSystem"].ToString();

            if (ShouldCommunicate)
            {
                _communicator.Communicate(string.Format(_jumpPhraseBook.GetRandomPhrase(), systemName));
            }

            StarSystem system = _navigator.GetSystem(systemName);

            if (system == null)
            {
                if (_communicateSkippableSystems && ShouldCommunicate)
                {
                    _communicator.Communicate(_skipPhraseBook.GetRandomPhrase());
                }

                return;
            }
            if (system.Celestials.All(c => c.Scanned))
            {
                if (_communicateSkippableSystems && ShouldCommunicate)
                {
                    _communicator.Communicate(_alreadyScannedBook.GetRandomPhrase());
                }
                return;
            }

            string script = BuildScanScript(system);

            if (ShouldCommunicate)
            {
                _communicator.Communicate(script);
            }

            script = BuildSystemValueScript(system);

            if (ShouldCommunicate)
            {
                _communicator.Communicate(script);
            }
        }
コード例 #4
0
        public void Handle(IEvent @event)
        {
            string     currentSystem = _playerStatus.Location;
            StarSystem system        = _navigator.GetSystem(currentSystem);

            if (system == null)
            {
                _communicator.Communicate(_skipPhrases.GetRandomPhrase());
                return;
            }

            Celestial nextToScan = _navigator.GetNextCelestial(system);

            _communicator.Communicate(BuildScript(nextToScan));
        }
コード例 #5
0
        public void Handle(IEvent @event)
        {
            string     currentSystem = _playerStatus.Location;
            StarSystem system        = _navigator.GetSystem(currentSystem);

            if (system == null)
            {
                _communicator.Communicate(_skipPhrases.GetRandomPhrase());
                return;
            }

            Celestial nextToScan = system.Celestials
                                   .Where(c => c.Scanned == false)
                                   .OrderBy(r => r.ShortName)
                                   .FirstOrDefault();

            if (nextToScan == null)
            {
                _communicator.Communicate(_completePhrases.GetRandomPhrase());
                return;
            }

            _communicator.Communicate(_nextScanPhrases.GetRandomPhraseWith(nextToScan.ShortName));
        }
コード例 #6
0
        private string BuildScript(string currentSystem, bool expeditionSystem)
        {
            string script = _surfaceScanCompletePhrases.GetRandomPhrase();

            if (!expeditionSystem)
            {
                return(script);
            }

            if (_navigator.GetSystem(currentSystem).Celestials.Any(c => c.SurfaceScanned == false))
            {
                int scansRemaining = _navigator.GetRemainingCelestials(currentSystem, onlySurfaceScans: true).Count();

                if (scansRemaining == 1)
                {
                    return(script += _oneSurfaceRemainingPhrases.GetRandomPhrase());
                }

                return(script += _multipleSurfacesRemainingPhrases.GetRandomPhraseWith(scansRemaining));
            }

            if (_navigator.ExpeditionComplete)
            {
                script += _expeditionCompletePhrases.GetRandomPhrase();
                script += _expeditionValuePhrases.GetRandomPhraseWith(_navigator.ValueForExpedition().ToSpeakableString());
                if (!String.IsNullOrEmpty(_playerStatus.Destination))
                {
                    script += _finalDestinationPhrases.GetRandomPhrase();
                }

                return(script);
            }

            script += _allSurfaceScansCompletePhrases.GetRandomPhrase();
            return(script += _expeditionValuePhrases.GetRandomPhraseWith(_navigator.ValueForExpedition().ToSpeakableString()));
        }
コード例 #7
0
        private string BuildScript(string currentSystem, string celestialName)
        {
            string script = _scanCompletePhrases.GetRandomPhrase();

            StarSystem system = _navigator.GetSystem(currentSystem);
            bool       exhaustedCelestialType = false;

            if (system.Celestials.Any(c => c.Scanned == false))
            {
                Celestial celestial = system.Celestials.First(c => c.Name == celestialName);
                if (celestial != null)
                {
                    // See if there are any more of the same celestial type
                    if (!system.Celestials.Any(c => c.Scanned == false && c.Classification == celestial.Classification))
                    {
                        // We've scanned all the planets of this classification

                        exhaustedCelestialType = true;
                        // "You've completed all the Terraformable water worlds."
                        script += _classificationCompletePhrases.GetRandomPhraseWith(celestial.LongClassification(_values));
                    }
                }

                List <Celestial> remainingCelestials = _navigator.GetRemainingCelestials(currentSystem);
                int scansRemaining = remainingCelestials.Count();

                if (scansRemaining == 1)
                {
                    script += _oneRemainingPhrases.GetRandomPhrase();
                    if (exhaustedCelestialType)
                    {
                        // "1 scan remains, a high metal content planet."
                        script += " a " + remainingCelestials.First().LongClassification(_values);
                    }
                }
                else
                {
                    script += _multipleRemainingPhrases.GetRandomPhraseWith(scansRemaining);
                    if (exhaustedCelestialType)
                    {
                        // "2 scans remain, 2 high metal content planets."
                        script += _navigator.SpokenCelestialList(remainingCelestials);
                    }
                }

                return(script);
            }

            if (_navigator.ExpeditionComplete)
            {
                script += _expeditionCompletePhrases.GetRandomPhrase();
                if (!String.IsNullOrEmpty(_playerStatus.Destination))
                {
                    script += _finalDestinationPhrases.GetRandomPhrase();
                }

                return(script);
            }

            script += _allScansCompletePhrases.GetRandomPhrase();
            script += _switchtoSurfacesPhrases.GetRandomPhrase();
            script += _systemValuePhrases.GetRandomPhraseWith(_navigator.ValueForSystem(currentSystem).ToSpeakableString());
            return(script);
        }