예제 #1
0
 public HealingViewModel(FarmingTools farmingTools)
     : base(farmingTools)
 {
     AddHealingCommand    = new DelegateCommand(AddHealingItem);
     DeleteHealingCommand = new DelegateCommand <Object>(DeleteHealing);
     ClearHealingCommand  = new DelegateCommand(ClearHealing);
 }
예제 #2
0
 public TargetsViewModel(FarmingTools farmingTools)
     : base(farmingTools)
 {
     this.AddCommand    = new DelegateCommand(AddTargetCommand);
     this.DeleteCommand = new DelegateCommand(DeleteTargetCommand);
     this.ClearCommand  = new DelegateCommand(ClearTargetsCommand);
 }
예제 #3
0
 public BattlesViewModel(FarmingTools farmingTools)
     : base(farmingTools)
 {
     AddActionCommand    = new DelegateCommand <Object>(AddAction);
     DeleteActionCommand = new DelegateCommand <Object>(DeleteAction);
     ClearActionsCommand = new DelegateCommand(ClearActions);
 }
예제 #4
0
        public RoutesViewModel(FarmingTools farmingTools) : base(farmingTools)
        {
            WaypointRecorder.Tick    += new EventHandler(RouteRecorder_Tick);
            WaypointRecorder.Interval = new TimeSpan(0, 0, 1);

            ClearRouteCommand  = new DelegateCommand(ClearRoute);
            RecordRouteCommand = new DelegateCommand <Object>(RecordRoute);
            SaveCommand        = new DelegateCommand(SaveRoute);
            LoadCommand        = new DelegateCommand(LoadRoute);
        }
예제 #5
0
        public MainViewModel(FarmingTools farmingTools) : base(farmingTools)
        {
            // Get events from view models to update the status bar's text.
            App.EventAggregator.GetEvent <StatusBarUpdateEvent>().Subscribe((a) => { StatusBarText = a; });

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

            // Create start command handler.
            StartCommand = new DelegateCommand(Start);
        }
예제 #6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Set up the event aggregator for updates to the status bar from
            // multiple view models.
            EventAggregator = new EventAggregator();

            // Let user select ffxi process
            frmStartup ProcessSelectionScreen = new frmStartup();

            ProcessSelectionScreen.ShowDialog();

            // Validate the selection
            var m_process = ProcessSelectionScreen.POL_Process;

            // Check if the user made a selection.
            if (m_process == null)
            {
                System.Windows.Forms.MessageBox.Show("No valid process was selected: Exiting now.");
                Environment.Exit(0);
            }

            // Save the selected fface instance.
            _fface = ProcessSelectionScreen.FFXI_Session;

            // Set up the game engine if valid.
            FarmingTools.LoadSettings();

            // Set up UnitService to use this mob filter instead of its
            // default mob filter.
            FarmingTools.UnitService.MobFilter = UnitFilters.MobFilter(_fface);

            // Create a new game engine to control our character.
            GameEngine = new GameEngine(_fface);

            // new DebugSpellCasting(_fface).Show();

            // new DebugCreatures(_fface, FarmingTools.UnitService).Show();
        }
예제 #7
0
        public static Func <Unit, bool> MobFilter(FFACE fface)
        {
            var ftools = FarmingTools.GetInstance(fface);

            // Function to use to filter surrounding mobs by.
            return(new Func <Unit, bool>((Unit x) =>
            {
                // No fface? Bail.
                if (fface == null)
                {
                    return false;
                }

                //FIXED: Added null check to avoid certain states
                // secretly throwing null pointer exceptions.
                // If the mob is null, bail.
                if (x == null)
                {
                    return false;
                }

                // Mob not active
                if (!x.IsActive)
                {
                    return false;
                }

                // INFO: fixes trying to attack dead mob problem.
                // Mob is dead
                if (x.IsDead)
                {
                    return false;
                }

                // Allow for mobs with an npc bit of sometimes 4 (colibri)
                // and ignore mobs that are invisible npcbit = 0
                if (x.NPCBit <= 0 || x.NPCBit >= 16)
                {
                    return false;
                }

                // Type is not mob
                if (!x.NPCType.Equals(NPCType.Mob))
                {
                    return false;
                }

                // Mob is out of range
                if (!(x.Distance < ftools.UserSettings.MiscSettings.DetectionDistance))
                {
                    return false;
                }

                // Mob too high out of reach.
                if (x.YDifference > ftools.UserSettings.MiscSettings.HeightThreshold)
                {
                    return false;
                }

                // Has aggroed and user doesn't want to kill aggro
                if (x.HasAggroed && !ftools.UserSettings.FilterInfo.AggroFilter)
                {
                    return false;
                }

                // Party has claim but we don't want to kill party mobs.
                if (x.PartyClaim && !ftools.UserSettings.FilterInfo.PartyFilter)
                {
                    return false;
                }

                // Mob not claimed but we don't want to kill unclaimed mobs.
                if (!x.IsClaimed && !ftools.UserSettings.FilterInfo.UnclaimedFilter)
                {
                    return false;
                }

                // If mob is on the ignored list ignore it.
                if (ftools.UserSettings.FilterInfo.IgnoredMobs.Contains(x.Name))
                {
                    return false;
                }

                // Not on our targets list.
                if (!ftools.UserSettings.FilterInfo.TargetedMobs.Contains(x.Name) && ftools.UserSettings.FilterInfo.TargetedMobs.Count > 0)
                {
                    return false;
                }

                //INFO: claimid is broken on the private server so keep id checks off.
                // The mob is claimed but it is not our claim.

                //FIX: Temporary fix until player.serverid is fixed.
                if (x.IsClaimed && x.ClaimedID != fface.PartyMember[0].ServerID)
                {
                    // and the claim filter is off, invalid. if the filter is on
                    // the program will attack claimed mobs.
                    if (!ftools.UserSettings.FilterInfo.ClaimedFilter)
                    {
                        return false;
                    }
                }

                // Mob is valid
                return true;
            }));
        }
예제 #8
0
 public IgnoredViewModel(FarmingTools farmingTools) : base(farmingTools)
 {
     AddIgnoredUnitCommand    = new DelegateCommand(AddIgnoredUnit);
     DeleteIgnoredUnitCommand = new DelegateCommand(DeleteIgnoredUnit);
     ClearIgnoredUnitsCommand = new DelegateCommand(ClearIgnoredUnits);
 }
예제 #9
0
 public BaseState(FFACE fface)
 {
     this.fface  = fface;
     this.ftools = FarmingTools.GetInstance(fface);
 }
예제 #10
0
 protected override void OnExit(ExitEventArgs e)
 {
     FarmingTools.SaveSettings();
 }
예제 #11
0
 public CastingModel(FFACE fface)
 {
     this._fface  = fface;
     this._ftools = FarmingTools.GetInstance(fface);
 }
예제 #12
0
 public WeaponsViewModel(FarmingTools farmingTools) : base(farmingTools)
 {
     SetCommand = new DelegateCommand(SetWeaponSkill);
 }
예제 #13
0
 public RestingViewModel(FarmingTools farmingTools) : base(farmingTools)
 {
 }
예제 #14
0
 public UnitFilteringViewModel(FarmingTools farmingTools) : base(farmingTools)
 {
     RestoreDefaultsCommand = new DelegateCommand(RestoreDefaults);
 }
예제 #15
0
 protected ViewModelBase(FarmingTools farmingTools)
 {
     this.ftools = farmingTools;
 }