Example #1
0
        private void LoadProfile()
        {
            var dlg = new OpenFileDialog
            {
                InitialDirectory = AppDomain.CurrentDomain.BaseDirectory,
                Filter           = @"Profiles (*.xml)|*.xml"
            };

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _profileToLoad = dlg.FileName;
                if (_profileToLoad.Contains(".xml"))
                {
                    FlyingEngine.CurrentProfile = new FlyingProfile();
                    FlyingEngine.CurrentProfile.LoadFile(_profileToLoad);
                    FlyingSettings.Profile = _profileToLoad;
                    FlyingSettings.SaveSettings();
                    UpdateControls();
                }
                else
                {
                    Logging.Write(LogType.Warning, "Please select a valid profile type.");
                }
            }
        }
Example #2
0
 private void SaveProfile()
 {
     var dlg = new SaveFileDialog
                   {
                       InitialDirectory = AppDomain.CurrentDomain.BaseDirectory,
                       Filter = @"Profiles (*.xml)|*.xml"
                   };
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         FlyingEngine.CurrentProfile.SaveFile(dlg.FileName);
         FlyingSettings.Profile = dlg.FileName;
         FlyingSettings.SaveSettings();
     }
 }
Example #3
0
 private void ProfileChanged(object sender, EProfileDownloaded e)
 {
     string profileToLoad = e.Path;
     if (profileToLoad.Contains(".xml"))
     {
         FlyingEngine.CurrentProfile = new FlyingProfile();
         FlyingEngine.CurrentProfile.LoadFile(profileToLoad);
         FlyingSettings.Profile = profileToLoad;
         FlyingSettings.SaveSettings();
         UpdateControls();
     }
     else
     {
         MessageBox.Show("Could not load the downloaded profile, invalid profile type");
     }
 }
Example #4
0
        public void Load()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            FlyingSettings.LoadSettings();
            CurrentMode = Mode.Normal;
            if (!string.IsNullOrEmpty(FlyingSettings.Profile) && File.Exists(FlyingSettings.Profile))
            {
                CurrentProfile = new FlyingProfile();
                CurrentProfile.LoadFile(FlyingSettings.Profile);
            }
            else
            {
                CurrentProfile = null;
                Logging.Write("Could not load a valid flying profile");
            }
        }
Example #5
0
        private void SaveSettingsClick(object sender, EventArgs e)
        {
            FlyingSettings.Herb                        = SetupCBHerb.Checked;
            FlyingSettings.Mine                        = SetupCBMine.Checked;
            FlyingSettings.ApproachModifier            = (float)Convert.ToDouble(SetupTBApproachModifier.Text);
            FlyingSettings.MaxUnits                    = SetupTBMaxUnits.Text;
            FlyingSettings.StopOnDeath                 = SetupCBStopOnDeath.Checked;
            FlyingSettings.StopHarvestWithPlayerAround = SetupCBStopHarvest.Checked;
            FlyingSettings.AvoidPlayers                = SetupCBAvoidPlayers.Checked;
            FlyingSettings.FlyingMountBar              = KeysFlyingMountBar.SelectedItem.ToString();
            FlyingSettings.FlyingMountKey              = KeysFlyingMountKey.SelectedItem.ToString();
            FlyingSettings.AutoBlacklist               = CBAutoBlacklist.Checked;
            FlyingSettings.AvoidElites                 = CBAvoidElites.Checked;
            FlyingSettings.FindCorpse                  = SetupCBFindCorpse.Checked;
            FlyingSettings.StopOnFullBags              = CBStopOnFullBags.Checked;
            FlyingSettings.WaitForRessSick             = CBRessWait.Checked;
            FlyingSettings.WaitForLoot                 = CBWaitForLoot.Checked;
            FlyingSettings.DruidAvoidCombat            = CBDruidAvoidCombat.Checked;
            FlyingSettings.ExtraBar                    = KeysExtraBar.SelectedItem.ToString();
            FlyingSettings.ExtraKey                    = KeysExtraKey.SelectedItem.ToString();
            FlyingSettings.SendKeyOnStartCombat        = CBSendKeyOnStartCombat.Checked;
            //Fish
            FlyingSettings.Fish            = CBFish.Checked;
            FlyingSettings.Lure            = CBUseLure.Checked;
            FlyingSettings.MaxTimeAtSchool = SetupTBMaxTimeAtSchool.Value;
            FlyingSettings.FishApproach    = SetupTBFishApproach.Value;
            FlyingSettings.LureBar         = KeysLureBar.SelectedItem.ToString();
            FlyingSettings.LureKey         = KeysLureKey.SelectedItem.ToString();
            FlyingSettings.WaterwalkBar    = KeysWaterwalkBar.SelectedItem.ToString();
            FlyingSettings.WaterwalkKey    = KeysWaterwalkKey.SelectedItem.ToString();

            FlyingSettings.SaveSettings();
            SaveHerbList();
            SaveMineList();
            SaveSchoolList();
            Close();
        }
Example #6
0
 public void Close()
 {
     FlyingSettings.SaveSettings();
     Navigator.Stop();
     CloseWindows();
 }
Example #7
0
        public bool EngineStart()
        {
            FindNode.LoadHarvest();
            FlyingSettings.LoadSettings();
            KeyHelper.AddKey("FMount", "None", FlyingSettings.FlyingMountBar, FlyingSettings.FlyingMountKey);
            KeyHelper.AddKey("Lure", "None", FlyingSettings.LureBar, FlyingSettings.LureKey);
            KeyHelper.AddKey("Waterwalk", "None", FlyingSettings.WaterwalkBar, FlyingSettings.WaterwalkKey);
            KeyHelper.AddKey("CombatStart", "None", FlyingSettings.ExtraBar, FlyingSettings.ExtraKey);
            if (!ObjectManager.InGame)
            {
                Logging.Write(LogType.Info, "Enter game before starting the bot");
                return(false);
            }
            if (ObjectManager.MyPlayer.IsGhost)
            {
                Logging.Write(LogType.Info, "Please ress before starting the bot");
                return(false);
            }
            if (CurrentProfile == null)
            {
                Logging.Write(LogType.Info, "Please load a profile");
                return(false);
            }
            if (CurrentProfile.WaypointsNormal.Count < 2)
            {
                Logging.Write(LogType.Info, "Profile should have more than 2 waypoints");
                return(false);
            }
            Navigation = new FlyingNavigation(CurrentProfile.WaypointsNormal, true, FlyingWaypointsType.Normal);
            Navigator  = new FlyingNavigator();
            ToTown.SetToTown(false);
            switch (CurrentMode)
            {
            case Mode.Normal:
                FlyingStates = new List <MainState>
                {
                    new StateMount(),
                    new StateMoving(),
                    new StateGather(),
                    new StateCombat(),
                    new StateRess(),
                    new StateResting(),
                    new StateMailbox(),
                    new StateToTown(),
                    new StateVendor(),
                    new StateFullBags(),
                };
                break;

            case Mode.TestNormal:
                Logging.Write(LogType.Warning,
                              "Starting flying engine in TestNormal mode, next start will be in normal mode");
                FlyingStates = new List <MainState>
                {
                    new StateMount(),
                    new StateMoving(),
                    new StateFullBags(),
                };
                break;

            case Mode.TestToTown:
                Logging.Write(LogType.Warning,
                              "Starting flying engine in TestToTown mode, next start will be in normal mode");
                FlyingStates = new List <MainState>
                {
                    new StateMount(),
                    new StateMoving(),
                    new StateCombat(),
                    new StateMailbox(),
                    new StateToTown(),
                    new StateVendor(),
                    new StateFullBags(),
                };
                ToTown.SetToTown(true);     //Set town mode to true
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Stuck.Run();
            FlyingBlackList.Load();
            CloseWindows();
            CurrentMode = Mode.Normal;
            _harvest    = 0;
            _kills      = 0;
            _death      = 0;
            _startTime  = DateTime.Now;
            UpdateStats(0, 0, 0);
            return(true);
        }