示例#1
0
        public override bool CheckComponent()
        {
            // Currently fighting, do not change target.
            if (!UnitFilters.MobFilter(fface, Target))
            {
                // Still not time to update for new target.
                if (DateTime.Now < _lastTargetCheck.AddSeconds(Constants.UnitArrayCheckRate))
                {
                    return(false);
                }

                // First get the first mob by distance.
                var mobs = _units.MobArray.Where(x => UnitFilters.MobFilter(fface, x))
                           .OrderByDescending(x => x.PartyClaim)
                           .ThenByDescending(x => x.HasAggroed)
                           .ThenBy(x => x.Distance)
                           .ToList();

                // Set our new target at the end so that we don't accidentaly cast on a new target.
                Target = mobs.FirstOrDefault();

                // Update last time target was updated.
                _lastTargetCheck = DateTime.Now;

                if (Target != null)
                {
                    Logger.Write.StateRun("Now targeting " + Target.Name + " : " + Target.Id);
                }
            }

            return(false);
        }
示例#2
0
        public override bool Check()
        {
            if (_restState.Check())
            {
                return(false);
            }

            // Make sure we don't need trusts
            if (new SummonTrustsState(Memory).Check())
            {
                return(false);
            }

            // Mobs has not been pulled if pulling moves are available.
            if (!IsFighting)
            {
                return(false);
            }

            // target null or dead.
            if (!UnitFilters.MobFilter(EliteApi, Target, Config))
            {
                return(false);
            }

            // Engage is enabled and we are not engaged. We cannot proceed.
            if (Config.IsEngageEnabled)
            {
                return(EliteApi.Player.Status.Equals(Status.Fighting));
            }

            // Engage is not checked, so just proceed to battle.
            return(true);
        }
示例#3
0
        public override bool CheckComponent()
        {
            if (new RestState(fface).CheckComponent())
            {
                return(false);
            }

            // Target dead or null.
            if (!UnitFilters.MobFilter(fface, Target))
            {
                return(false);
            }

            // We should approach mobs that have aggroed or have been pulled.
            if (Target.Status.Equals(Status.Fighting))
            {
                return(true);
            }

            // Get usable abilities.
            var usable = Config.Instance.BattleLists["Pull"].Actions
                         .Where(x => ActionFilters.BuffingFilter(fface, x));

            // Approach when there are no pulling moves available.
            if (!usable.Any())
            {
                return(true);
            }

            // Approach mobs if their distance is close.
            return(Target.Distance < 8);
        }
示例#4
0
        public override bool CheckComponent()
        {
            if (new RestComponent(fface).CheckComponent())
            {
                return(false);
            }

            // Mobs has not been pulled if pulling moves are available.
            if (!IsFighting)
            {
                return(false);
            }

            // target null or dead.
            if (!UnitFilters.MobFilter(fface, Target))
            {
                return(false);
            }

            // Engage is enabled and we are not engaged. We cannot proceed.
            if (Config.Instance.IsEngageEnabled)
            {
                return(fface.Player.Status.Equals(Status.Fighting));
            }

            // Engage is not checked, so just proceed to battle.
            return(true);
        }
示例#5
0
 /// <summary>
 ///     Allow component to run when moves need to be triggered or
 ///     FightStarted state needs updating.
 /// </summary>
 /// <returns></returns>
 public override bool Check()
 {
     if (IsFighting) return false;
     if (new RestState(Memory).Check()) return false;
     if (new SummonTrustsState(Memory).Check()) return false;
     if (!UnitFilters.MobFilter(EliteApi, Target)) return false;
     return Config.Instance.BattleLists["Pull"].Actions.Any(x => x.IsEnabled);
 }
示例#6
0
 /// <summary>
 ///     Allow component to run when moves need to be triggered or
 ///     FightStarted state needs updating.
 /// </summary>
 /// <returns></returns>
 public override bool CheckComponent()
 {
     if (new RestComponent(fface).CheckComponent())
     {
         return(false);
     }
     return(UnitFilters.MobFilter(fface, Target));
 }
示例#7
0
 public StateMemory(IMemoryAPI eliteApi)
 {
     EliteApi    = eliteApi;
     Executor    = new Executor(eliteApi);
     UnitService = new UnitService(eliteApi);
     UnitFilters = new UnitFilters();
     Config      = new ProxyConfig();
 }
示例#8
0
        public override bool Check()
        {
            // Prevent making the player stand up from resting.
            if (new RestState(fface).Check())
            {
                return(false);
            }

            // Creature is unkillable and does not meets the
            // user's criteria for valid mobs defined in MobFilters.
            return(!UnitFilters.MobFilter(fface, Target));
        }
示例#9
0
        public override bool Check()
        {
            var config = _configFactory.GetConfig();

            // Waypoint list is empty.
            if (!config.Route.IsPathSet)
            {
                return(false);
            }

            // Route belongs to a different zone.
            if (config.Route.Zone != fface.Player.Zone)
            {
                return(false);
            }

            // Has valid target to fight.
            if (UnitFilters.MobFilter(fface, CombatState.Target))
            {
                return(false);
            }

            // We don't have to rest.
            if (new RestState(fface).Check())
            {
                return(false);
            }

            // We don't have to heal.
            if (new HealingState(fface).Check())
            {
                return(false);
            }

            // We don't need to summon trusts
            if (new SummonTrustsState(fface).Check())
            {
                return(false);
            }

            // We are not bound or struck by an other movement
            // disabling condition.
            if (ProhibitEffects.ProhibitEffectsMovement
                .Intersect(fface.Player.StatusEffects).Any())
            {
                return(false);
            }

            return(true);
        }
示例#10
0
        public override bool Check()
        {
            if (new RestState(Memory).Check())
            {
                return(false);
            }

            if (!UnitFilters.MobFilter(EliteApi, Target))
            {
                return(false);
            }

            // Use skill if we are engaged.
            return(EliteApi.Player.Status.Equals(Status.Fighting));
        }
示例#11
0
        public override bool CheckComponent()
        {
            if (new RestComponent(fface).CheckComponent())
            {
                return(false);
            }

            if (!UnitFilters.MobFilter(fface, Target))
            {
                return(false);
            }

            // Use skill if we are engaged.
            return(fface.Player.Status.Equals(Status.Fighting));
        }
示例#12
0
        public override bool Check()
        {
            if (UnitFilters.MobFilter(EliteApi, Target))
            {
                if (!Config.Instance.BattleLists["Pull"].Actions.Any(x => x.IsEnabled))
                {
                    return(IsFighting = true);
                }
                else
                {
                    return(IsFighting = Target.Status.Equals(Status.Fighting));
                }
            }

            return(IsFighting = false);
        }
示例#13
0
 /// <summary>
 ///     Allow component to run when moves need to be triggered or
 ///     FightStarted state needs updating.
 /// </summary>
 /// <returns></returns>
 public override bool CheckComponent()
 {
     if (IsFighting)
     {
         return(false);
     }
     if (new RestState(fface).CheckComponent())
     {
         return(false);
     }
     if (!UnitFilters.MobFilter(fface, Target))
     {
         return(false);
     }
     return(Config.Instance.BattleLists["Pull"].Actions.Any(x => x.IsEnabled));
 }
示例#14
0
        public override bool Check()
        {
            if (new RestState(fface).Check())
            {
                return(false);
            }

            // target dead or null.
            if (!UnitFilters.MobFilter(fface, Target))
            {
                return(false);
            }

            // Return true if fight has not started.
            return(!Target.Status.Equals(Status.Fighting));
        }
示例#15
0
        public override void RunState()
        {
            // Cast all spells making sure they land. Keeping
            ftools.AbilityExecutor.EnsureSpellsCast(ftools.TargetData.TargetUnit, ftools.PlayerActions.EndList,
                                                    Constants.SPELL_CAST_LATENCY, Constants.GLOBAL_SPELL_COOLDOWN, 0);

            // Get the next target.
            var target = ftools.UnitService.GetTarget(UnitFilters.MobFilter(fface));

            // Set our new target at the end so that we don't accidentaly cast on a
            // new target.
            ftools.TargetData.TargetUnit = target;

            // Set to false in order to use starting moves again in the
            // attack state.
            AttackState.fightStarted = false;
        }
        public override bool Check()
        {
            if (UnitFilters.MobFilter(fface, Target))
            {
                // No moves in pull list, set FightStarted to true to let
                // other components who depend on it trigger.
                if (!Config.Instance.BattleLists["Pull"].Actions.Any(x => x.IsEnabled))
                {
                    return(IsFighting = true);
                }
                else
                {
                    return(IsFighting = Target.Status.Equals(Status.Fighting));
                }
            }

            return(IsFighting = false);
        }
示例#17
0
 /// <summary>
 ///     Allow component to run when moves need to be triggered or
 ///     FightStarted state needs updating.
 /// </summary>
 /// <returns></returns>
 public override bool Check()
 {
     if (IsFighting)
     {
         return(false);
     }
     if (new RestState(Memory).Check())
     {
         return(false);
     }
     if (new SummonTrustsState(Memory).Check())
     {
         return(false);
     }
     if (!UnitFilters.MobFilter(EliteApi, Target, Config))
     {
         return(false);
     }
     return(Config.BattleLists["Pull"].Actions.Any(x => x.IsEnabled));
 }
示例#18
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();
        }
示例#19
0
        public override bool Check()
        {
            if (new RestState(Memory).Check())
            {
                return(false);
            }

            // Make sure we don't need trusts
            if (new SummonTrustsState(Memory).Check())
            {
                return(false);
            }

            // Target dead or null.
            if (!UnitFilters.MobFilter(EliteApi, Target, Config))
            {
                return(false);
            }

            // We should approach mobs that have aggroed or have been pulled.
            if (Target.Status.Equals(Status.Fighting))
            {
                return(true);
            }

            // Get usable abilities.
            var usable = Config.BattleLists["Pull"].Actions
                         .Where(x => ActionFilters.BuffingFilter(EliteApi, x));

            // Approach when there are no pulling moves available.
            if (!usable.Any())
            {
                return(true);
            }

            // Approach mobs if their distance is close.
            return(Target.Distance < 8);
        }
示例#20
0
 public override void RunState()
 {
     ftools.TargetData.TargetUnit = ftools.UnitService.GetTarget(UnitFilters.MobFilter(fface));
 }
 private void InitializeFilters()
 {
     UnitFilters.Add(new UnitNameFilter(_collectionView));
     SelectedUnitFilter = UnitFilters.FirstOrDefault();
 }