Esempio n. 1
0
        public override void Run(IGameContext context)
        {
            // Has the user decided that we should approach targets?
            if (context.Config.IsApproachEnabled)
            {
                // Move to target if out of melee range.
                context.API.Navigator.DistanceTolerance = context.Config.MeleeDistance;
                context.API.Navigator.GotoNPC(context.Target.Id, context.Config.IsObjectAvoidanceEnabled, context.Config.IsThirdPersonCombatEnabled);
            }

            // Face mob.
            context.API.Navigator.FaceHeading(context.Target.Position);

            // Target mob if not currently targeted.
            Player.SetTarget(context.API, context.Target);

            // Has the user decided we should engage in battle.
            if (context.Config.IsEngageEnabled)
            {
                if (!context.API.Player.Status.Equals(Status.Fighting) && context.Target.Distance < 25)
                {
                    context.API.Windower.SendString(Constants.AttackTarget);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 ///     Force the player to stand up before attempting anything else.
 /// </summary>
 public override void Exit(IGameContext context)
 {
     while (context.API.Player.Status == Status.Healing)
     {
         Player.Stand(context.API);
     }
 }
Esempio n. 3
0
        /// <summary>
        ///     Force player when changing targets.
        /// </summary>
        public override void Enter(IGameContext context)
        {
            context.API.Navigator.Reset();

            while (context.API.Player.Status == Status.Fighting)
            {
                Player.Disengage(context.API);
            }
        }
Esempio n. 4
0
        public override void Run(IGameContext context)
        {
            // Target mob if not currently targeted.
            Player.SetTarget(context.API, context.Target);

            // Has the user decided that we should approach targets?
            if (context.Config.IsApproachEnabled)
            {
                // Move to target if out of melee range.
                var path = context.NavMesh.FindPathBetween(context.API.Player.Position, context.Target.Position);
                if (path.Count > 0)
                {
                    if (path.Count > 1)
                    {
                        context.API.Navigator.DistanceTolerance = 0.5;
                    }
                    else
                    {
                        context.API.Navigator.DistanceTolerance = context.Config.MeleeDistance;
                    }

                    while (path.Count > 0 && path.Peek().Distance(context.API.Player.Position) <= context.API.Navigator.DistanceTolerance)
                    {
                        path.Dequeue();
                    }

                    if (path.Count > 0)
                    {
                        var node = path.Peek();

                        float deltaX = node.X - context.API.Player.Position.X;
                        float deltaY = node.Y - context.API.Player.Position.Y;
                        float deltaZ = node.Z - context.API.Player.Position.Z;
                        context.API.Follow.SetFollowCoords(deltaX, deltaY, deltaZ);
                    }
                    else
                    {
                        context.API.Navigator.FaceHeading(context.Target.Position);
                        context.API.Follow.Reset();

                        // Has the user decided we should engage in battle.
                        if (context.Config.IsEngageEnabled)
                        {
                            if (!context.API.Player.Status.Equals(Status.Fighting) && context.Target.Distance < 25)
                            {
                                context.API.Windower.SendString(Constants.AttackTarget);
                            }
                        }
                    }
                }
            }
            else
            {
                // Face mob.
                context.API.Navigator.FaceHeading(context.Target.Position);
            }
        }
Esempio n. 5
0
        public override void Enter(IGameContext context)
        {
            // Stop resting.
            if (context.Player.Status.Equals(Status.Healing))
            {
                Player.Stand(context.API);
            }

            // Stop moving.
            context.API.Navigator.Reset();
        }
Esempio n. 6
0
        /// <summary>
        ///     Begin resting our health and magic.
        /// </summary>
        public override void Run(IGameContext context)
        {
            // Check for effects taht stop resting.
            if (ProhibitEffects.ProhibitEffectsDots
                .Intersect(context.API.Player.StatusEffects).Any())
            {
                return;
            }

            Player.Rest(context.API);
        }
Esempio n. 7
0
        /// <summary>
        ///     Use pulling moves if applicable to make the target
        ///     mob aggressive to us.
        /// </summary>
        public override void Run(IGameContext context)
        {
            // Has the user decided we should engage in battle.
            if (context.Target.Distance <= 25 && context.Config.IsEngageEnabled)
            {
                Player.Engage(context.API);
            }

            var actions = context.Config.BattleLists["Pull"].Actions.ToList();
            var usable  = actions.Where(x => ActionFilters.TargetedFilter(context.API, x, context.Target)).ToList();

            context.Memory.Executor.UseTargetedActions(context, usable, context.Target);
        }
Esempio n. 8
0
        public override void Run(IGameContext context)
        {
            // Target mob if not currently targeted.
            Player.SetTarget(context.API, context.Target);

            // Has the user decided that we should approach targets?
            if (context.Config.IsApproachEnabled)
            {
                // Move to target if out of melee range.
                var path = context.NavMesh.FindPathBetween(context.API.Player.Position, context.Target.Position);

                // Has the user decided we should engage in battle.
                if (context.Target.Distance <= 25 && context.Config.IsEngageEnabled)
                {
                    Player.Engage(context.API);
                }

                if (context.Target.Distance <= Config.Instance.MeleeDistance)
                {
                    context.API.Navigator.FaceHeading(context.Target.Position, false);
                    context.API.Navigator.Reset();
                }
                else if (path.Count > 0)
                {
                    context.API.Navigator.DistanceTolerance = 3.0;

                    while (path.Count > 0 && path.Peek().Distance(context.API.Player.Position) <= context.API.Navigator.DistanceTolerance)
                    {
                        path.Dequeue();
                    }

                    if (path.Count > 0)
                    {
                        if (path.Peek().Distance(context.Target.Position) <= Config.Instance.MeleeDistance ||
                            context.API.Player.Position.Distance(context.Target.Position) <= Config.Instance.MeleeDistance)
                        {
                            context.API.Navigator.DistanceTolerance = Config.Instance.MeleeDistance;
                        }
                        context.API.Navigator.GotoNPC(context.Target.Id, path.Peek(), true);
                    }
                    else
                    {
                        context.API.Navigator.GotoNPC(context.Target.Id, context.Target.Position, false);
                    }
                }
            }
        }
Esempio n. 9
0
        public override void Run(IGameContext context)
        {
            // First get the first mob by distance.
            var mobs = context.Units.Where(x => x.IsValid).ToList();

            mobs = TargetPriority.Prioritize(mobs).ToList();

            var lastTarget = context.Target;

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

            if (target.IsValid && lastTarget != target)
            {
                context.Target = target;

                // FIXME: if random path is set, do not reset? make this configurable?
                context.Config.Route.ResetCurrentWaypoint();

                LogViewModel.Write("Now targeting " + context.Target.Name + " : " + context.Target.Id);
            }

            Player.SetTarget(context.API, target);
        }
Esempio n. 10
0
 /// <summary>
 ///     Begin resting our health and magic.
 /// </summary>
 public override void Run(IGameContext context)
 {
     Player.Rest(context.API);
 }
Esempio n. 11
0
 public override void Enter(IGameContext context)
 {
     Player.Stand(context.API);
     context.API.Navigator.Reset();
     context.API.Navigator.FaceHeading(context.Target.Position, false);
 }
Esempio n. 12
0
 public override void Enter(IGameContext context)
 {
     Player.Stand(context.API);
     context.API.Navigator.Reset();
 }