예제 #1
0
 public override void Stop()
 {
     base.Stop();
     WaypointQueue.Clear();
     AmeisenCore.RunSlashCommand("/cleartarget");
     Target = null;
 }
예제 #2
0
        public override void Start()
        {
            // Startup Method
            if (CombatPackage.SpellStrategy != null)
            {
                // Updte me, target and pet
                Me?.Update();
                Target?.Update();
                Pet?.Update();

                CombatPackage.SpellStrategy.Startup(Me, Target, Pet);
            }
            WaypointQueue.Clear();
            base.Start();
        }
예제 #3
0
        private void MoveToNode()
        {
            if (WaypointQueue.Count > 0)
            {
                Me.Update();
                Vector3 initialPosition = Me.pos;
                if (WaypointQueue.Count == 0)
                {
                    return;
                }

                Vector3 targetPosition = WaypointQueue.Dequeue();
                double  distance       = Utils.GetDistance(initialPosition, targetPosition);

                if (distance > AmeisenDataHolder.Settings.followDistance)
                {
                    CheckIfWeAreStuckIfYesJump(Me.pos, LastPosition);

                    if (targetPosition.Z == 0)
                    {
                        targetPosition.Z = Me.pos.Z;
                    }

                    List <Vector3> navmeshPath = new List <Vector3>()
                    {
                        targetPosition
                    };

                    if (distance > AmeisenDataHolder.Settings.pathfindingUsageThreshold)
                    {
                        navmeshPath = UsePathfinding(Me.pos, targetPosition);

                        if (navmeshPath == null || navmeshPath.Count == 0)
                        {
                            Thread.Sleep(1000);
                            return;
                        }

                        if (navmeshPath.Count > 1)
                        {
                            navmeshPath.Add(targetPosition); // original position
                        }

                        movementDistance = AmeisenCore.IsMounted ? 8 : 3; // Mount distance adjustments

                        foreach (Vector3 pos in navmeshPath)
                        {
                            Me.Update();
                            double posDistance = Utils.GetDistance(Me.pos, pos);
                            int    tries       = 0;

                            if (posDistance < movementDistance)
                            {
                                continue;
                            }

                            while (tries < 10 && posDistance > movementDistance)
                            {
                                AmeisenCore.MovePlayerToXYZ(pos, InteractionType.MOVE);
                                posDistance = Utils.GetDistance(Me.pos, pos);
                                tries++;
                                Thread.Sleep(20);
                            }

                            Me.Update();
                            double distanceTraveled = posDistance - Utils.GetDistance(Me.pos, pos);
                            // if we havent moved 0.2m in this time, screw this path
                            if (tries == 10 && distanceTraveled < 0.2)
                            {
                                WaypointQueue.Clear();
                                break;
                            }
                        }
                    }
                    else
                    {
                        AmeisenCore.MovePlayerToXYZ(navmeshPath.First(), InteractionType.MOVE);
                    }

                    Me.Update();
                    LastPosition = Me.pos;
                }
            }
            else
            {
            }
        }