예제 #1
0
 /// <summary>
 /// Creates a dismount composite. This down't use thread.Sleep() like the buildin one thus it works nicely with behaviors and framelocks. This will decend until bot lands if flying.
 /// </summary>
 /// <param name="reason">The reason to dismount</param>
 /// <returns></returns>
 public static Composite CreateDismount(string reason)
 {
     return(new Sequence(
                new Action(ret => Logger.WriteDebug(Styx.Resources.StyxResources.Stop_and_dismount___ + (!string.IsNullOrEmpty(reason) ? (" Reason: " + reason) : string.Empty))),
                // stop moving
                new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                      new Sequence(
                                          new Action(ret => WoWMovement.MoveStop()),
                                          CreateWaitForLagDuration())
                                      ), // Land if we're flying
                new DecoratorContinue(ret => StyxWoW.Me.IsFlying,
                                      new Sequence(
                                          new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Descend)),
                                          new WaitContinue(30, ret => !StyxWoW.Me.IsFlying, new ActionAlwaysSucceed()),
                                          new Action(ret => WoWMovement.MoveStop(WoWMovement.MovementDirection.Descend))
                                          )), // and finally dismount.
                new Action(r =>
     {
         ShapeshiftForm shapeshift = StyxWoW.Me.Shapeshift;
         if ((shapeshift != ShapeshiftForm.FlightForm) && (shapeshift != ShapeshiftForm.EpicFlightForm))
         {
             Lua.DoString("Dismount()");
         }
         else
         {
             Lua.DoString("RunMacroText('/cancelform')");
         }
     })));
 }
예제 #2
0
        public static Composite CompositeJumpMeele()
        {
            return
                (new PrioritySelector(
                     new DecoratorContinue(ret => ImpMovePlugin.Los,
                                           new Sequence(
                                               new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward)),
                                               new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend)),
                                               new Action(
                                                   ret => StyxWoW.Me.SetFacing((float)((Math.PI + StyxWoW.Me.Rotation) % (2 * Math.PI)))),
                                               new WaitContinue(TimeSpan.FromMilliseconds(1000), ret => false, new ActionAlwaysSucceed()),
                                               new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward)),
                                               new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend)),
                                               new WaitContinue(TimeSpan.FromMilliseconds(750), ret => false, new ActionAlwaysSucceed()),
                                               new Action(
                                                   ret =>
                                                   WoWMovement.Move(LastRight
                                        ? WoWMovement.MovementDirection.TurnLeft
                                        : WoWMovement.MovementDirection.TurnRight)),
                                               new Action(ret => LastRight = !LastRight),


                                               new WaitContinue(TimeSpan.FromMilliseconds(1300), ret => false, new ActionAlwaysSucceed()),
                                               new Action(ret => WoWMovement.MoveStop())
                                               )
                                           )
                     ));
        }
예제 #3
0
        private static bool CheckMoving()
        {
            if (Target.Distance >= 1.5 && Target.IsMoving && !StyxWoW.Me.MovementInfo.MovingForward)
            {
                WoWMovement.Move(WoWMovement.MovementDirection.Forward);
                return(true);
            }


            if (Target.Distance < 1.5 && Target.IsMoving && StyxWoW.Me.MovementInfo.MovingForward)
            {
                WoWMovement.MoveStop(WoWMovement.MovementDirection.Forward);
                return(true);
            }



            //////// OLD
            //if (Target.MovementInfo.IsMoving && !StyxWoW.Me.MovementInfo.MovingForward)
            //{
            //    WoWMovement.Move(WoWMovement.MovementDirection.Forward);
            //    return true;
            //}

            //if (!Target.MovementInfo.IsMoving && StyxWoW.Me.MovementInfo.MovingForward)
            //{
            //    WoWMovement.MoveStop(WoWMovement.MovementDirection.Forward);
            //    return true;
            //}

            return(false);
        }
        public override void Pulse()
        {
            if (!StyxWoW.IsInGame)
            {
                return;
            }

            if (!timerAccept.IsRunning)
            {
                Random r = new Random();

                AcceptingTime = r.Next(240000, 420000);
                //AcceptingTime = r.Next(10000, 20000);

                timerAccept.Start();
            }

            if (timerAccept.ElapsedMilliseconds < AcceptingTime)
            {
                return;
            }

            WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromSeconds(1));

            timerAccept.Stop();
            timerAccept.Reset();
            AcceptingTime = 0;
        }
        private Composite SubBehaviorPS_InitializeVehicleAbilities()
        {
            return
                (new Decorator(context => (Weapon_DevourHuman == null) ||
                               (Weapon_FrozenDeathbolt == null),
                               // Give the WoWclient a few seconds to produce the vehicle action bar...
                               // NB: If we try to use the weapon too quickly after entering vehicle,
                               // then it will cause the WoWclient to d/c.
                               new WaitContinue(TimeSpan.FromSeconds(10),
                                                context => Query.IsVehicleActionBarShowing(),
                                                new Action(context =>
            {
                var weaponArticulation = new WeaponArticulation(WeaponAzimuthMin, WeaponAzimuthMax);

                // (slot 1): http://www.wowhead.com/spell=53114
                Weapon_FrozenDeathbolt =
                    new VehicleWeapon(ActionBarIndex_Attack, weaponArticulation, WeaponMuzzleVelocity)
                {
                    LogAbilityUse = true,
                    LogWeaponFiringDetails = false
                };

                // (slot 3): http://www.wowhead.com/spell=53110
                Weapon_DevourHuman =
                    new VehicleAbility(ActionBarIndex_Heal)
                {
                    LogAbilityUse = true
                };

                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(1500));
            })
                                                )));
        }
        public static async Task AvoidEnemyCast(WoWUnit unit, float enemyAttackRadius, float saveDistance)
        {
            if (!StyxWoW.Me.IsFacing(unit))
            {
                unit.Face();
                await Coroutine.Sleep(300);
            }

            float behemothRotation    = getPositive(unit.RotationDegrees);
            float invertEnemyRotation = getInvert(behemothRotation);

            WoWMovement.MovementDirection move = getPositive(StyxWoW.Me.RotationDegrees) > invertEnemyRotation
                ? WoWMovement.MovementDirection.StrafeRight
                : WoWMovement.MovementDirection.StrafeLeft;

            try
            {
                while (unit.Distance2D <= saveDistance && unit.IsCasting && ((enemyAttackRadius == 0 && !StyxWoW.Me.IsSafelyBehind(unit)) ||
                                                                             (enemyAttackRadius != 0 && unit.IsSafelyFacing(StyxWoW.Me, enemyAttackRadius)) || unit.Distance2D <= 2))
                {
                    WoWMovement.Move(move);
                    unit.Face();
                    await Coroutine.Yield();
                }
            }
            finally
            {
                WoWMovement.MoveStop();
            }
        }
예제 #7
0
        public override void Pulse()
        {
            value = ObjectManager.Me.GetMirrorTimerInfo(MirrorTimerType.Breath).CurrentTime;

            //Debug value printing
            //Logging.Write("Value "+value);

            //If already going up for air
            if (breathing)
            {
                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
            }
            //If we have less than 60 seconds of air
            //Cases: -If there is no bar displayed (i.e. on top of water, value will be 0)
            //       -If you currently have no breath, value goes to around 4294966095
            else if ((value < 60000) && ObjectManager.Me.IsAlive && ObjectManager.Me.IsSwimming &&
                     (value != 0) || (value > 900001))
            {
                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
                Logging.Write("Anti-Drown: Running out of breath! Going up for air!");
                breathing = true;
            }

            //Stop breathing once air is full
            if (value > (ObjectManager.Me.GetMirrorTimerInfo(MirrorTimerType.Breath).MaxValue - 5000))
            {
                breathing = false;
            }
        }
예제 #8
0
 protected override Composite CreateBehavior()
 {
     return(_root ?? (_root =
                          new PrioritySelector(
                              new Action(ctx => WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(100)))
                              )));
 }
예제 #9
0
 private static void flyTo(WoWPoint loc)
 {
     while (_me.Location.Distance(loc) > 2)
     {
         if (Flightor.MountHelper.CanMount && !Flightor.MountHelper.Mounted)
         {
             Flightor.MountHelper.MountUp();
             StyxWoW.SleepForLagDuration();
             Thread.Sleep(1000);
             while (_me.IsCasting)
             {
                 Thread.Sleep(150);
             }
         }
         Flightor.MoveTo(loc);
     }
     Styx.Logic.Pathing.Navigator.FindHeight(loc.X, loc.Y, out _height);
     while (Math.Abs(_me.Location.Z - _height) > 1)
     {
         WoWMovement.Move(WoWMovement.MovementDirection.Descend);
         Thread.Sleep(100);
     }
     Flightor.MountHelper.Dismount();
     while (_me.Location.Distance2D(loc) > 1)
     {
         Navigator.MoveTo(loc);
     }
 }
예제 #10
0
        bool StuckCheck()
        {
            if (!_stuckTimer.IsRunning || _stuckTimer.ElapsedMilliseconds >= 3000)
            {
                _stuckTimer.Reset();
                _stuckTimer.Start();

                WoWUnit veh = GetVehicle();
                if (veh.Location.Distance(_lastPoint) <= 5 || _doingUnstuck)
                {
                    if (!_doingUnstuck)
                    {
                        LogMessage("info", "Stuck... Doing unstuck routine");
                        _direction = WoWMovement.MovementDirection.JumpAscend |
                                     (_rand.Next(0, 2) == 1 ? WoWMovement.MovementDirection.StrafeRight : WoWMovement.MovementDirection.StrafeLeft)
                                     | WoWMovement.MovementDirection.Backwards;
                        WoWMovement.Move(_direction);
                        _doingUnstuck = true;
                        return(true);
                    }
                    else
                    {
                        _doingUnstuck = false;
                        WoWMovement.MoveStop(_direction);
                    }
                }
                _lastPoint = veh.Location;
            }
            return(false);
        }
예제 #11
0
        protected Composite CreateCombatBehavior()
        {
            // NB: This behavior is hooked in at a 'higher priority' than Combat_Main.  We need this
            // because it is sometimes more important to avoid things than fight.

            // NB: We might be in combat with nothing to fight immediately after initiating the event.
            // Be aware of this when altering this behavior.
            bool shadowFogActive = false;
            // WoWUnit prophet = null;
            WoWUnit crowStorm = null;

            return(new PrioritySelector(
                       ctx =>
            {
                shadowFogActive = ObjectManager.GetObjectsOfType <WoWUnit>().Any(u => u.Entry == InvisibleManId && u.HasAura("Shadow Fog"));
                return ProphetKharzul;
            },
                       new Decorator <WoWUnit>(
                           prophet => prophet != null && prophet.ThreatInfo.ThreatValue > 0,
                           new PrioritySelector(
                               new Decorator(
                                   ctx => shadowFogActive,
                                   new PrioritySelector(
                                       // check if we need to move to platform during Shadow Fog. Ignore Shadow Fog if the prophet is not within melee range of the platform and I'm a melee.
                                       new Decorator <WoWUnit>(
                                           prophet =>
                                           Me.Location.Distance(_platformPoint) > 2 ||
                                           Me.Z < 33,
                                           new PrioritySelector(
                                               new Decorator(ctx => _platformPoint.Distance(Me.Location) > 20, new Action(ctx => Navigator.MoveTo(_prophetLocation))),
                                               new Decorator(
                                                   ctx => _platformPoint.Distance(Me.Location) <= 20,
                                                   new Action <WoWUnit>(prophet =>
            {
                if (Query.IsMeleeSpec(Me.Specialization) && prophet.Location.Distance(_platformPoint) >= MeleeRange(prophet))
                {
                    QBCLog.Info("I am melee and Prophet K is not within melee range of platform so I will ignore shadow fog");
                    return RunStatus.Failure;
                }
                TreeRoot.StatusText = "Moving to platform";

                Navigator.PlayerMover.MoveTowards(_platformPoint);
                // we need to jump to get up on the platform
                if (!Me.MovementInfo.IsAscending && _platformPoint.Distance(Me.Location) <= 9 && Me.Z < 33)
                {
                    WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
                }
                return RunStatus.Success;
            })))),
                                       // stop jumping after we're on top of platform.
                                       new Decorator(ctx => Me.MovementInfo.IsAscending,
                                                     new Action(ctx => WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend))))),
                               // Handle Crow Storm. Assume the crow storm is placed on top of platform...
                               new Decorator(
                                   ctx => (crowStorm = ObjectManager.GetObjectsOfType <WoWUnit>().FirstOrDefault(u => u.Entry == CrowStormId && u.Distance < 6.5f)) != null,
                                   new PrioritySelector(
                                       new ActionSetActivity("Moving out of Crow Storm"),
                                       new Action <WoWUnit>(prophet => Navigator.PlayerMover.MoveTowards(WoWMathHelper.CalculatePointFrom(prophet.Location, crowStorm.Location, 7.5f)))))))));
        }
예제 #12
0
 // 18Apr2013-10:41UTC chinajade
 private void AntiAfk()
 {
     if (_afkTimer.IsFinished)
     {
         WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(100));
         _afkTimer.Reset();
     }
 }
예제 #13
0
        protected override RunStatus Run(object context)
        {
            if (LootAction.GetLoot())
            {
                return(RunStatus.Success);
            }
            //  dks can refresh water walking while flying around.
            if (AutoAngler.Instance.MySettings.UseWaterWalking &&
                StyxWoW.Me.Class == WoWClass.DeathKnight && !WaterWalking.IsActive)
            {
                WaterWalking.Cast();
            }
            if (AutoAngler.CurrentPoint == WoWPoint.Zero)
            {
                return(RunStatus.Failure);
            }
            if (AutoAngler.FishAtHotspot && StyxWoW.Me.Location.Distance(AutoAngler.CurrentPoint) <= 3)
            {
                return(RunStatus.Failure);
            }
            //float speed = StyxWoW.Me.MovementInfo.CurrentSpeed;
            //float modifier = _settings.Fly ? 5f : 2f;
            //float precision = speed > 7 ? (modifier*speed)/7f : modifier;
            float precision = StyxWoW.Me.IsFlying ? AutoAnglerSettings.Instance.PathPrecision : 3;

            if (StyxWoW.Me.Location.Distance(AutoAngler.CurrentPoint) <= precision)
            {
                AutoAngler.CycleToNextPoint();
            }
            if (_settings.Fly)
            {
                if (_me.IsSwimming)
                {
                    if (_me.GetMirrorTimerInfo(MirrorTimerType.Breath).CurrentTime > 0)
                    {
                        WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
                    }
                    else if (_me.MovementInfo.IsAscending || _me.MovementInfo.JumpingOrShortFalling)
                    {
                        WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend);
                    }
                }
                if (!StyxWoW.Me.Mounted)
                {
                    Flightor.MountHelper.MountUp();
                }
                Flightor.MoveTo(AutoAngler.CurrentPoint);
            }
            else
            {
                if (!StyxWoW.Me.Mounted && Mount.ShouldMount(AutoAngler.CurrentPoint) && Mount.CanMount())
                {
                    Mount.MountUp(() => AutoAngler.CurrentPoint);
                }
                Navigator.MoveTo(AutoAngler.CurrentPoint);
            }
            return(RunStatus.Success);
        }
예제 #14
0
        protected Composite CreateBehavior_QuestbotMain()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(
                                     new Decorator(
                                         ret => !_isBehaviorDone,
                                         new PrioritySelector(
                                             new Decorator(ret => Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted,
                                                           new Sequence(
                                                               new Action(ret => TreeRoot.StatusText = "Finished!"),
                                                               new WaitContinue(120,
                                                                                new Action(delegate
            {
                _isBehaviorDone = true;
                return RunStatus.Success;
            }))
                                                               )),

                                             new Decorator(
                                                 ret => KillUnit == null,
                                                 new Action(ret => TreeRoot.StatusText = String.Format("Waiting for {0} to Spawn", KillSheya ? "Sheya" : "Lorenth"))
                                                 ),

                                             new Decorator(
                                                 ret => StyxWoW.Me.HasAura("Unstable Lightning Blast") && s_timer.IsFinished,
                                                 new Sequence(
                                                     new Action(ret => s_timer.Reset()),
                                                     new Action(ret => s_moveTimer.Reset()),
                                                     new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft)))),

                                             new Decorator(
                                                 ret => (StyxWoW.Me.IsMoving && KillSheya) || (StyxWoW.Me.IsMoving && !KillSheya && s_moveTimer.IsFinished),
                                                 new Sequence(
                                                     new Action(ret => WoWMovement.MoveStop()),
                                                     new ActionAlwaysSucceed())),


                                             new Decorator(
                                                 ret => KillUnit != null && KillUnit.Location.Distance(KillLocation) > 5,
                                                 new Sequence(
                                                     new Action(ret => _isBehaviorDone = true),
                                                     new ActionAlwaysSucceed())),

                                             new Decorator(
                                                 ret => KillUnit != null && KillUnit.Location.Distance(KillLocation) < 5 && Item != null,
                                                 new Sequence(
                                                     new Action(ret => KillUnit.Target()),
                                                     new SleepForLagDuration(),
                                                     new Action(ret => Item.UseContainerItem()),
                                                     new ActionAlwaysSucceed())),

                                             new ActionAlwaysSucceed()


                                             )))));
        }
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(


                                     new Decorator(ret => Me.QuestLog.GetQuestById(12255) != null && Me.QuestLog.GetQuestById(12255).IsCompleted,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Finished!"),
                                                       new WaitContinue(120,
                                                                        new Action(delegate
            {
                _isDone = true;
                return RunStatus.Success;
            })))),

                                     new Decorator(ret => !Query.IsInVehicle(),
                                                   new Sequence(
                                                       new DecoratorContinue(ret => flylist.Count == 0,
                                                                             new Sequence(
                                                                                 new Action(ret => Navigator.MoveTo(_flyloc)),
                                                                                 new Sleep(1000))),
                                                       new DecoratorContinue(ret => flylist.Count > 0 && flylist[0].Location.Distance(Me.Location) > 5,
                                                                             new Sequence(
                                                                                 new Action(ret => Navigator.MoveTo(flylist[0].Location)),
                                                                                 new Sleep(1000))),
                                                       new DecoratorContinue(ret => flylist.Count > 0 && flylist[0].Location.Distance(Me.Location) <= 5,
                                                                             new Sequence(
                                                                                 new Action(ret => WoWMovement.MoveStop()),
                                                                                 new Action(ret => flylist[0].Interact()),
                                                                                 new Sleep(1000),
                                                                                 new Action(ret => Lua.DoString("SelectGossipOption(1)")),
                                                                                 new Sleep(1000)))

                                                       )),
                                     new Decorator(ret => Query.IsInVehicle(), new ActionRunCoroutine(ctx => VehicleLogic())),

                                     new DecoratorContinue(ret => !Me.IsQuestObjectiveComplete(QuestId, 1) && objmob[0].Location.Distance(Me.Location) <= 20,
                                                           new Sequence(
                                                               new Action(ret => TreeRoot.StatusText = "PWNing " + objmob[0].SafeName),
                                                               new Action(ret => Lua.DoString("VehicleMenuBarActionButton2:Click()")),
                                                               //new Sleep(1500),
                                                               //new Action(ret => Lua.DoString("VehicleMenuBarActionButton3:Click()")),
                                                               new Action(ret => Lua.DoString("VehicleMenuBarActionButton1:Click()")),
                                                               new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Backwards)),
                                                               new SleepForLagDuration(),
                                                               new Action(ret => WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards)),
                                                               new SleepForLagDuration(),
                                                               new Action(ret => objmob[0].Face()),
                                                               new Sleep(500)
                                                               )
                                                           )
                                     )
                             ));
        }
예제 #16
0
        private static void CheckStrafe()
        {
            using (StyxWoW.Memory.AcquireFrame())
            {
                // Test
                //if (Me.Stunned) return;

                // Cancel all strafes - distance
                if (Me.MovementInfo.MovingStrafeRight && Target.Distance >= 2.5)
                {
                    WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeRight);
                    return;
                }

                if (Me.MovementInfo.MovingStrafeLeft && Target.Distance >= 2.5)
                {
                    WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeLeft);
                    return;
                }

                // Cancel all strafes - Angle out of range
                if (Me.MovementInfo.MovingStrafeRight && GetDegree <= 180 && GetDegree >= Cone)
                {
                    WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeRight);
                    return;
                }
                if (Me.MovementInfo.MovingStrafeLeft && GetDegree >= 180 && GetDegree <= (360 - Cone))
                {
                    WoWMovement.MoveStop(WoWMovement.MovementDirection.StrafeLeft);
                    return;
                }

                // Dont strafe if we are not close enough
                if (Target.Distance >= 5)
                {
                    return;
                }


                // 180 > strafe right
                if (GetDegree >= 180 && GetDegree <= (360 - Cone) && !Me.MovementInfo.MovingStrafeRight)
                {
                    WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight, new TimeSpan(99, 99, 99));
                    return;
                }

                // 180 < strafe left
                if (GetDegree <= 180 && GetDegree >= Cone && !Me.MovementInfo.MovingStrafeLeft)
                {
                    WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft, new TimeSpan(99, 99, 99));
                    return;
                }
            }
        }
        private static RunStatus DoCheck(object context)
        {
            if (!StyxWoW.Me.IsSwimming)
            {
                return(RunStatus.Success);
            }

            Logging.Write("[ADNE]: Going for a nibble of air!");
            WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, TimeSpan.FromMilliseconds(5000));
            return(RunStatus.Running);
        }
예제 #18
0
        private async Task <bool> AimDirection()
        {
            const double normRotation = TRAMP_LEFT_SIDE > TRAMP_RIGHT_SIDE ? 0 : 360;

            QBCLog.DeveloperInfo("(AimRotation) Trampoline Boundary - Left Edge: {0}  Right Edge: {1}", TRAMP_LEFT_SIDE, TRAMP_RIGHT_SIDE);

            WoWMovement.MovementDirection whichWay;
            string dirCmd;

            // left/right - get current direction and turn until on trampoline
            if (Me.Transport.RotationDegrees < TRAMP_RIGHT_SIDE)
            {
                whichWay = WoWMovement.MovementDirection.TurnLeft;
                dirCmd   = "TurnLeft";
            }
            else if ((Me.Transport.RotationDegrees + normRotation) > (TRAMP_LEFT_SIDE + normRotation))
            {
                whichWay = WoWMovement.MovementDirection.TurnRight;
                dirCmd   = "TurnRight";
            }
            else // if (whichWay == WoWMovement.MovementDirection.None)
            {
                QBCLog.DeveloperInfo("(AimRotation) Done, Ending Rotation: {0}", Me.Transport.RotationDegrees);
                return(false);
            }

            QBCLog.DeveloperInfo("(AimRotation) Current Rotation: {0} - {1}", Me.Transport.RotationDegrees, whichWay.ToString().ToUpper());
#if WOWMOVEMENT_TIMED_TURNS_STOPFAILING
            WoWMovement.Move(whichWay, TimeSpan.FromMilliseconds(10));
            WoWMovement.MoveStop(whichWay);
            // loop until we actually move
            while (0.001 > (currRotation - Me.Transport.RotationDegrees))
            {
                await CommonCoroutines.SleepForLagDuration();
            }
#elif WOWMOVEMENT_TURNS_STOPFAILING
            WoWMovement.Move(whichWay);
            await Coroutine.Sleep(10);

            WoWMovement.MoveStop(whichWay);
            // loop until we actually move
            while (0.001 > (currRotation - Me.Transport.RotationDegrees))
            {
                await CommonCoroutines.SleepForLagDuration();
            }
#else
            // doing LUA calls these because WoWMovement API doesn't stop turning quickly enough
            Lua.DoString(dirCmd + "Start()");
            await Coroutine.Sleep(10);

            Lua.DoString(dirCmd + "Stop()");
#endif
            return(true);
        }
예제 #19
0
 public void AvoidDormusSpit(string buff)
 {
     Logging.Write("Rarekiller Part Dormus: Strafe left to avoid Damage");
     WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft);
     while (Me.ActiveAuras.ContainsKey(buff) || Me.ActiveAuras.ContainsKey(Rarekiller.Settings.AuraToID) || Me.ActiveAuras.ContainsKey(Rarekiller.Settings.AuraToID))
     {
         Thread.Sleep(25);
     }
     WoWMovement.MoveStop();
     Thread.Sleep(100);
 }
예제 #20
0
 private void BackPeddle()
 {
     if (Me.CurrentTarget != null)
     {
         Log("Backpeddle!");
         WoWMovement.Move(WoWMovement.MovementDirection.Backwards);
         Thread.Sleep(1500);
         WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards);
         Me.CurrentTarget.Face();
     }
 }
예제 #21
0
        private RunStatus AimDirection()
        {
            double normRotation = TRAMP_LEFT_SIDE > TRAMP_RIGHT_SIDE ? 0 : 360;
            double currRotation = Me.Transport.RotationDegrees;

            Dlog("(AimRotation) Trampoline Boundary - Left Edge: {0}  Right Edge: {1}", TRAMP_LEFT_SIDE, TRAMP_RIGHT_SIDE);

            WoWMovement.MovementDirection whichWay = WoWMovement.MovementDirection.None;
            string dirCmd;

            // left/right - get current direction and turn until on trampoline
            if (Me.Transport.RotationDegrees < TRAMP_RIGHT_SIDE)
            {
                whichWay = WoWMovement.MovementDirection.TurnLeft;
                dirCmd   = "TurnLeft";
            }
            else if ((Me.Transport.RotationDegrees + normRotation) > (TRAMP_LEFT_SIDE + normRotation))
            {
                whichWay = WoWMovement.MovementDirection.TurnRight;
                dirCmd   = "TurnRight";
            }
            else // if (whichWay == WoWMovement.MovementDirection.None)
            {
                Dlog("(AimRotation) Done, Ending Rotation: {0}", Me.Transport.RotationDegrees);
                return(RunStatus.Failure);
            }

            Dlog("(AimRotation) Current Rotation: {0} - {1}", Me.Transport.RotationDegrees, whichWay.ToString().ToUpper());
#if WOWMOVEMENT_TIMED_TURNS_STOPFAILING
            WoWMovement.Move(whichWay, TimeSpan.FromMilliseconds(10));
            WoWMovement.MoveStop(whichWay);
            // loop until we actually move
            while (0.001 > (currRotation - Me.Transport.RotationDegrees))
            {
                StyxWoW.SleepForLagDuration();
            }
#elif WOWMOVEMENT_TURNS_STOPFAILING
            WoWMovement.Move(whichWay);
            Thread.Sleep(10);
            WoWMovement.MoveStop(whichWay);
            // loop until we actually move
            while (0.001 > (currRotation - Me.Transport.RotationDegrees))
            {
                StyxWoW.SleepForLagDuration();
            }
#else
            // doing LUA calls these because WoWMovement API doesn't stop turning quickly enough
            Lua.DoString(dirCmd + "Start()");
            Thread.Sleep(10);
            Lua.DoString(dirCmd + "Stop()");
#endif
            return(RunStatus.Success);
        }
예제 #22
0
 private async Task Ascend(int timeMs)
 {
     try
     {
         WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
         await Coroutine.Sleep(timeMs);
     }
     finally
     {
         WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend);
     }
 }
예제 #23
0
        private async Task DoQuest(WoWUnit hammer)
        {
            // make sure bot does not try to handle combat or anything else that can interrupt with quest behavior.
            LevelBot.BehaviorFlags &= ~(BehaviorFlags.Combat | BehaviorFlags.Loot | BehaviorFlags.FlightPath | BehaviorFlags.Vendor);

            if (hammer.DistanceSqr > 45 * 45)
            {
                Navigator.MoveTo(hammer.Location);
                await Coroutine.Sleep(100);
            }
            else
            {
                while (!StyxWoW.Me.QuestLog.GetQuestById(24817).IsCompleted&& StyxWoW.Me.IsAlive && Query.IsViable(hammer))
                {
                    if (StyxWoW.Me.CurrentTargetGuid != hammer.Guid)
                    {
                        hammer.Target();
                        await CommonCoroutines.SleepForLagDuration();

                        continue;
                    }

                    if (!StyxWoW.Me.IsSafelyFacing(hammer))
                    {
                        hammer.Face();
                        await Coroutine.Wait(2000, () => !Query.IsViable(hammer) || StyxWoW.Me.IsSafelyFacing(hammer));
                    }

                    try
                    {
                        WoWMovement.Move(WoWMovement.MovementDirection.Backwards);
                        await Coroutine.Sleep(200);
                    }
                    finally
                    {
                        WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards);
                    }

                    if (CastPetAction(3) || CastPetAction(2) || CastPetAction(1))
                    {
                        await CommonCoroutines.SleepForRandomReactionTime();
                    }

                    await Coroutine.Yield();

                    hammer = Hammer;
                }
            }
        }
예제 #24
0
 private void WalkAway()
 {
     if (Me.CurrentTarget != null)
     {
         WoWMovement.ClickToMove(WoWMathHelper.CalculatePointBehind(Me.Location, Me.RotationDegrees, 10));
         Log("Waliking away.");
         float rotation = Me.RotationDegrees + 180;
         Me.SetFacing(WoWMathHelper.DegreesToRadians(rotation));
         Thread.Sleep(250);
         WoWMovement.Move(WoWMovement.MovementDirection.Forward);
         Thread.Sleep(1500);
         WoWMovement.MoveStop(WoWMovement.MovementDirection.Forward);
         Me.CurrentTarget.Face();
     }
 }
        static public bool Cast()
        {
            bool casted = false;

            if (!IsActive)
            {
                if (_recastSW.IsRunning && _recastSW.ElapsedMilliseconds < 5000)
                {
                    return(false);
                }
                _recastSW.Reset();
                _recastSW.Start();
                int waterwalkingSpellID = 0;
                switch (ObjectManager.Me.Class)
                {
                case Styx.Combat.CombatRoutine.WoWClass.Priest:
                    waterwalkingSpellID = 1706;
                    break;

                case Styx.Combat.CombatRoutine.WoWClass.Shaman:
                    waterwalkingSpellID = 546;
                    break;

                case Styx.Combat.CombatRoutine.WoWClass.DeathKnight:
                    waterwalkingSpellID = 3714;
                    break;
                }
                if (SpellManager.CanCast(waterwalkingSpellID))
                {
                    SpellManager.Cast(waterwalkingSpellID);
                    casted = true;
                }
                WoWItem waterPot = Util.GetIteminBag(8827);
                if (waterPot != null && waterPot.Use())
                {
                    casted = true;
                }
            }
            if (ObjectManager.Me.IsSwimming)
            {
                using (new FrameLock())
                {
                    KeyboardManager.AntiAfk();
                    WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
                }
            }
            return(casted);
        }
예제 #26
0
 protected override Composite CreateBehavior()
 {
     return(_root ?? (_root =
                          new PrioritySelector(
                              new Decorator(
                                  ret => !ObjectManager.Me.HasAura("Mechashark X-Steam"),
                                  new Sequence(
                                      new Action(ret => Navigator.MoveTo(q24817controller[0].Location)),
                                      new Action(ret => q24817controller[0].Interact()),
                                      new Action(ret => Thread.Sleep(5000))
                                      )),
                              new Decorator(
                                  ret => q24817_hammer[0].IsAlive,
                                  new PrioritySelector(
                                      new Decorator(
                                          ret => ObjectManager.Me.CurrentTarget != q24817_hammer[0],
                                          new Sequence(
                                              new Action(ret =>
     {
         if (q24817_hammer.Count > 0 && q24817_hammer[0].Location.Distance(ObjectManager.Me.Location) > 45)
         {
             Navigator.MoveTo(q24817_hammer[0].Location);
             Thread.Sleep(100);
         }
         if (q24817_hammer.Count > 0 && (q24817_hammer[0].Location.Distance(ObjectManager.Me.Location) <= 45))
         {
             while (!ObjectManager.Me.QuestLog.GetQuestById(24817).IsCompleted)
             {
                 q24817_hammer[0].Face();
                 q24817_hammer[0].Target();
                 WoWMovement.Move(WoWMovement.MovementDirection.Backwards);
                 Thread.Sleep(200);
                 WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards);
                 Lua.DoString("CastPetAction(3)");
                 Lua.DoString("CastPetAction(2)");
                 Lua.DoString("CastPetAction(1)");
             }
         }
     }))))),
                              new Decorator(
                                  ret => ObjectManager.Me.QuestLog.GetQuestById(24817).IsCompleted,
                                  new Sequence(
                                      new Action(ret => Lua.DoString("VehicleExit()")),
                                      new Action(ret => IsBehaviorDone = true)))
                              )));
 }
예제 #27
0
        private void MoveAfterPortal()
        {
            if (_Manager.Zone[_CurrentProfile] == "Twilight Highlands")
            {
                if (Me.IsHorde)
                {
                    Thread.Sleep(5000);
                    Log("Moving Outside (Twilight Highlands/Horde).");
                    Stopwatch MovementTimer = new Stopwatch();
                    MovementTimer.Start();
                    Thread.Sleep(100); WoWMovement.Move(WoWMovement.MovementDirection.Forward, TimeSpan.FromSeconds(5)); MovementTimer.Reset();
                    Thread.Sleep(5000);
                    WoWMovement.MoveStop();
                    Navigator.PlayerMover.MoveStop();
                }
            }

            /*
             * <SubRoutine SubRoutineName="Go to Vashj">
             *  <If Condition="Me.IsAlliance" IgnoreCanRun="True">
             *    <FlyToAction Dismount="True" X="-8192.315" Y="448.0859" Z="116.8438" />
             *    <InteractionAction Entry="207691" InteractDelay="0" InteractType="GameObject" GameObjectType="MapObjectTransport" SpellFocus="Anvil" />
             *  </If>
             *  <If Condition="Me.IsHorde" IgnoreCanRun="True">
             *    <FlyToAction Dismount="True" X="2063.337" Y="-4362.29" Z="98.11018" />
             *    <InteractionAction Entry="207690" InteractDelay="0" InteractType="GameObject" GameObjectType="MapObjectTransport" SpellFocus="Anvil" />
             *  </If>
             *  <WaitAction Condition="Me.ZoneId == 5144 || Me.ZoneId == 4815 || Me.ZoneId == 5145" Timeout="10000" />
             *  <If Condition="DistanceTo(-4458.113, 3805.779, -82.66076) &lt; 20" IgnoreCanRun="True">
             *    <MoveToAction MoveType="Location" Pathing="ClickToMove" Entry="0" X="-4448.744" Y="3808.145" Z="-84.44801" />
             *    <CustomAction Code="Lua.DoString(&quot;CallCompanion(\&quot;mount\&quot;, 1)&quot;);" />
             *    <WaitAction Condition="Me.Auras.ContainsKey(&quot;Abyssal Seahorse&quot;)" Timeout="5000" />
             *    <MoveToAction MoveType="Location" Pathing="ClickToMove" Entry="0" X="-4452.531" Y="3805.55" Z="-87.74911" />
             *    <MoveToAction MoveType="Location" Pathing="ClickToMove" Entry="0" X="-4461.966" Y="3800.289" Z="-88.81821" />
             *    <MoveToAction MoveType="Location" Pathing="ClickToMove" Entry="0" X="-4455.411" Y="3784.705" Z="-92.53719" />
             *  </If>
             *  <If Condition="DistanceTo(-6120.206, 4280.641, -348.8216) &lt; 20" IgnoreCanRun="True">
             *    <MoveToAction MoveType="Location" Pathing="ClickToMove" Entry="0" X="-6090.067" Y="4273.509" Z="-352.9627" />
             *    <CustomAction Code="Lua.DoString(&quot;CallCompanion(\&quot;mount\&quot;, 1)&quot;);" />
             *    <WaitAction Condition="Me.Auras.ContainsKey(&quot;Abyssal Seahorse&quot;)" Timeout="5000" />
             *    <MoveToAction MoveType="Location" Pathing="ClickToMove" Entry="0" X="-6105.042" Y="4176.022" Z="-387.1256" />
             *  </If>
             * </SubRoutine>
             */
            DidUsePortal = false;
        }
예제 #28
0
        public static async Task <bool> RushST()
        {
            if (!Me.IsWithinMeleeRangeOf(CurrentTarget))
            {
                return(false);
            }
            // only use if we have FelRush available and Vengeful Retreat is not available
            if (!S.OnCooldown(SB.FelRush) && S.OnCooldown(SB.VengefulRetreat))
            {
                WoWMovement.Move(WoWMovement.MovementDirection.Backwards, 500);
                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, 500);
                S.Cast2(SB.FelRush, C.CombatColor, HS.HavocFelRushSingleTarget, "RushST");
                await Coroutine.Yield();

                return(true);
            }
            return(false);
        }
예제 #29
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(


                                     new Decorator(ret => me.QuestLog.GetQuestById(24817) != null && me.QuestLog.GetQuestById(24817).IsCompleted,
                                                   new Sequence(
                                                       new Action(ret => TreeRoot.StatusText = "Finished!"),
                                                       new WaitContinue(120,
                                                                        new Action(delegate
            {
                _isDone = true;
                return RunStatus.Success;
            })))),
                                     new Decorator(ret => me.QuestLog.GetQuestById(24817) != null && !me.QuestLog.GetQuestById(24817).IsCompleted,
                                                   new Action(ret =>
            {
                if (me.QuestLog.GetQuestById(24817).IsCompleted)
                {
                    Lua.DoString("VehicleExit()");
                    return RunStatus.Success;
                }
                if (objmob.Count > 0 && objmob[0].Location.Distance(me.Location) > 45)
                {
                    Navigator.MoveTo(objmob[0].Location);
                    Thread.Sleep(100);
                }
                if (objmob.Count > 0 && (objmob[0].Location.Distance(me.Location) <= 45))
                {
                    objmob[0].Face();
                    objmob[0].Target();
                    WoWMovement.Move(WoWMovement.MovementDirection.Backwards);
                    WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards);
                    Lua.DoString("CastPetAction(3) CastPetAction(2) CastPetAction(1)");
                }
                return RunStatus.Running;
            }
                                                              ))


                                     )
                             ));
        }
예제 #30
0
        private Composite CreateBehavior_Antistuck()
        {
            return(new PrioritySelector(
                       new Decorator(context => _stuckTimer.IsFinished,
                                     new Sequence(context => _antiStuckMyLoc = WoWMovement.ActiveMover.Location,

                                                  // Check if stuck...
                                                  new DecoratorContinue(context => _antiStuckMyLoc.DistanceSqr(_antiStuckPrevPosition) < (3 * 3),
                                                                        new Sequence(context => _antiStuckPerformSimpleSequence = _antiStuckStuckSucceedTimer.IsFinished,
                                                                                     new DecoratorContinue(context => Me.IsMounted() && !Me.IsFlying,
                                                                                                           new ActionRunCoroutine(context => CommonCoroutines.Dismount("Stuck"))),

                                                                                     // Perform simple unstuck proceedure...
                                                                                     new DecoratorContinue(context => _antiStuckPerformSimpleSequence,
                                                                                                           new Sequence(
                                                                                                               new Action(context => QBCLog.Debug("Stuck. Trying to jump")),
                                                                                                               new Action(context =>
            {
                // ensure bot is moving forward when jumping (Wow will sometimes automatically
                // stop moving if running against a wall)
                if (ShouldPerformCTM)
                {
                    WoWMovement.ClickToMove(Destination);
                }
                WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
            }),
                                                                                                               new Sleep(1000),
                                                                                                               new Action(context => WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend))
                                                                                                               )),

                                                                                     // perform less simple unstuck proceedure
                                                                                     new DecoratorContinue(context => !_antiStuckPerformSimpleSequence,
                                                                                                           new Sequence(context => _antiStuckMoveDirection = GetRandomMovementDirection(),
                                                                                                                        new Action(context => QBCLog.Debug("Stuck. Movement Directions: {0}", _antiStuckMoveDirection)),
                                                                                                                        new Action(context => WoWMovement.Move(_antiStuckMoveDirection)),
                                                                                                                        new Sleep(2000),
                                                                                                                        new Action(context => WoWMovement.MoveStop(_antiStuckMoveDirection)))),

                                                                                     new Action(context => _antiStuckStuckSucceedTimer.Reset()))),

                                                  new Action(context => _antiStuckPrevPosition = _antiStuckMyLoc),
                                                  new Action(context => _stuckTimer.Reset())
                                                  ))));
        }