示例#1
0
 private void StopEngine()
 {
     Logger.Write.BotStop("Bot now paused");
     EventPublisher.InformUser("Program paused.");
     StartPauseHeader = "St_art";
     GameEngine.Stop();
 }
示例#2
0
 private void StartEngine()
 {
     Logger.Write.BotStart("Bot now running");
     EventPublisher.InformUser("Program running.");
     StartPauseHeader = "P_ause";
     GameEngine.Start();
 }
示例#3
0
 private void RestoreDefaults()
 {
     DetectionDistance = Constants.DetectionDistance;
     HeightThreshold   = Constants.HeightThreshold;
     MeleeDistance     = Constants.MeleeDistance;
     WanderDistance    = Constants.DetectionDistance;
     GlobalCooldown    = Constants.GlobalSpellCooldown;
     EventPublisher.InformUser("Defaults have been restored.");
 }
示例#4
0
        /// <summary>
        /// Stops the player from running continously.
        /// </summary>
        private void ResetNavigator()
        {
            // Return when the user has not selected a process.
            if (FFACE == null)
            {
                EventPublisher.InformUser("No process has been selected.");
                return;
            }

            FFACE.Navigator.Reset();
        }
示例#5
0
 /// <summary>
 ///     Saves the route data.
 /// </summary>
 private void Save()
 {
     if (_settings.TrySave(Route))
     {
         EventPublisher.InformUser("Path has been saved.");
     }
     else
     {
         EventPublisher.InformUser("Failed to save path.");
     }
 }
示例#6
0
        /// <summary>
        ///     Loads the route data.
        /// </summary>
        private void Load()
        {
            Route = _settings.TryLoad <ObservableCollection <Position> >();

            if (Route != null)
            {
                EventPublisher.InformUser("Path has been loaded.");
            }
            else
            {
                EventPublisher.InformUser("Failed to load the path.");
            }
        }
示例#7
0
 /// <summary>
 ///     Saves the player's data to file.
 /// </summary>
 private void Save()
 {
     try
     {
         _settingsManager.TrySave(Config.Instance);
         EventPublisher.InformUser("Settings have been saved.");
         Logger.Write.SaveSettings("Settings saved");
     }
     catch (InvalidOperationException ex)
     {
         Console.WriteLine(ex.Message);
         EventPublisher.InformUser("Failed to save settings.");
     }
 }
示例#8
0
        /// <summary>
        ///     Tells the program to start farming.
        /// </summary>
        public void Start()
        {
            // Return when the user has not selected a process.
            if (FFACE == null)
            {
                EventPublisher.InformUser("No process has been selected.");
                return;
            }

            if (GameEngine.IsWorking)
            {
                StopEngine();
            }
            else
            {
                StartEngine();
            }
        }
示例#9
0
        /// <summary>
        ///     Pauses and resumes the path recorder based on
        ///     its current state.
        /// </summary>
        private void Record()
        {
            // Return when the user has not selected a process.
            if (FFACE == null)
            {
                EventPublisher.InformUser("No process has been selected.");
                return;
            }

            if (!_recorder.IsRecording)
            {
                _recorder.Start();
                RecordHeader = "Recording!";
            }
            else
            {
                _recorder.Stop();
                RecordHeader = "Record";
            }
        }
示例#10
0
        /// <summary>
        ///     Selects a process to user for this application.
        /// </summary>
        private void SelectProcess()
        {
            // Let user select ffxi process
            var selectionView = new ProcessSelectionView();

            selectionView.ShowDialog();

            // Grab the view model with the game sessions.
            var viewModel = selectionView.DataContext as ProcessSelectionViewModel;

            // If the view has a process selection view model binded to it.
            if (viewModel != null)
            {
                // Get the selected process.
                var process = viewModel.SelectedProcess;

                // User never selected a process.
                if (process == null || !viewModel.IsProcessSelected)
                {
                    Logger.Write.ProcessNotFound("Process not found");
                    EventPublisher.InformUser("No valid process was selected.");
                    return;
                }

                // Log that a process selected.
                Logger.Write.ProcessFound("Process found");

                // Get memory reader set in config file.
                var fface = MemoryWrapper.Create(process.Id);

                // Set the fface Session.
                SetSession(fface);

                // Tell the user the program has loaded the player's data
                EventPublisher.InformUser("Bot Loaded: " + fface.Player.Name);

                // Set the main window's title to the player's name.
                MainWindowTitle = "EasyFarm - " + fface.Player.Name;
            }
        }
示例#11
0
        /// <summary>
        ///     Loads easyfarm settings from file.
        /// </summary>
        private void Load()
        {
            try
            {
                // Load the settings.
                var settings = _settingsManager.TryLoad <Config>();

                // Did we fail to load the settings?
                if (settings == null)
                {
                    EventPublisher.InformUser("Failed to load settings.");
                    return;
                }

                // Inform the user of our success.
                Config.Instance = settings;
                EventPublisher.InformUser("Settings have been loaded.");
                Logger.Write.SaveSettings("Settings loaded");
            }
            catch (InvalidOperationException)
            {
                EventPublisher.InformUser("Failed to load settings.");
            }
        }