コード例 #1
0
        private void HandleMovement(WowUnit target)
        {
            if (target == null)
            {
                return;
            }

            if (hasTargetMoved || (distanceToTarget < 6.0 && !BotMath.IsFacing(LastPlayerPosition, ObjectManager.Player.Rotation, LastTargetPosition, 0.75, 1.25)))
            {
                CharacterManager.MoveToPosition(LastTargetPosition);
            }
            else if (distanceToTarget >= 6.0)
            {
                if (computeNewRoute || MovementEngine.CurrentPath?.Count == 0)
                {
                    List <Vector3> path = PathfindingHandler.GetPath((int)ObjectManager.MapId, LastPlayerPosition, LastTargetPosition);
                    MovementEngine.LoadPath(path);
                    MovementEngine.PostProcessPath();
                }
                else
                {
                    if (MovementEngine.GetNextStep(LastPlayerPosition, out Vector3 positionToGoTo, out bool needToJump))
                    {
                        CharacterManager.MoveToPosition(positionToGoTo);

                        if (needToJump)
                        {
                            CharacterManager.Jump();
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void HandleMovement(WowUnit target)
        {
            if (target == null)
            {
                return;
            }

            if (HookManager.GetBuffs(WowLuaUnit.Player).Any(e => e.Contains("tealth")))
            {
                if (!wasInStealth || hasTargetMoved)
                {
                    isSneaky = true;
                }

                wasInStealth = true;
            }
            else
            {
                isSneaky     = false;
                wasInStealth = false;
            }

            if (distanceToBehindTarget < 3.0)
            {
                if (isSneaky)
                {
                    CharacterManager.MoveToPosition(LastTargetPosition);
                    isSneaky = false;
                }
            }

            bool closeToTarget = distanceToTarget < 12.0 + target.CombatReach;

            if (hasTargetMoved)
            {
                CharacterManager.MoveToPosition(LastBehindTargetPosition);
            }
            else if (closeToTarget)
            {
                if (isSneaky)
                {
                    CharacterManager.MoveToPosition(LastBehindTargetPosition);
                }
                else if (!BotMath.IsFacing(LastPlayerPosition, ObjectManager.Player.Rotation, LastTargetPosition, 0.75, 1.25))
                {
                    CharacterManager.MoveToPosition(LastTargetPosition);
                }
            }
            else
            {
                if (computeNewRoute || MovementEngine.CurrentPath?.Count == 0)
                {
                    List <Vector3> path = PathfindingHandler.GetPath((int)ObjectManager.MapId, LastPlayerPosition, LastBehindTargetPosition);
                    MovementEngine.LoadPath(path);
                    MovementEngine.PostProcessPath();
                }
                else
                {
                    if (MovementEngine.GetNextStep(LastPlayerPosition, ObjectManager.Player.Rotation, out Vector3 positionToGoTo, out bool needToJump))
                    {
                        CharacterManager.MoveToPosition(positionToGoTo);

                        if (needToJump)
                        {
                            CharacterManager.Jump();
                        }
                    }
                }
            }
        }