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();
            }
        }
Ejemplo n.º 2
0
 private void Face(WoWUnit tar)
 {
     if (Manual)
     {
         tar.Face();
     }
 }
Ejemplo n.º 3
0
 private void Face(WoWUnit tar)
 {
     if (Styx.BotManager.Current.Name != "LazyRaider")
     {
         tar.Face();
     }
 }
Ejemplo n.º 4
0
 public static void Face(WoWUnit unit)
 {
     if (PaladinSettings.Instance.EnableMovement || PaladinSettings.Instance.EnableFacing)
     {
         unit.Face();
     }
 }
        private Composite CreateBehavior_Kill()
        {
            const uint torvaldErikssonId = 27377;

            var     movetoLocation  = new WoWPoint(2939.321, -2536.72, 123.3394);
            WoWUnit torvaldEriksson = null;

            return
                (new PrioritySelector(
                     ctx =>
                     torvaldEriksson =
                         ObjectManager.GetObjectsOfTypeFast <WoWUnit>().FirstOrDefault(u => u.Entry == torvaldErikssonId && u.IsAlive),
                     // move in position
                     new Decorator(
                         ctx => WoWMovement.ActiveMover.Location.DistanceSqr(movetoLocation) > 5 * 5,
                         new Action(ctx => Flightor.MoveTo(movetoLocation))),
                     new Decorator(ctx => WoWMovement.ActiveMover.IsMoving, new Action(ctx => WoWMovement.MoveStop())),
                     new Decorator(
                         ctx => torvaldEriksson != null,
                         new PrioritySelector(
                             // target
                             new Decorator(
                                 ctx => WoWMovement.ActiveMover.CurrentTargetGuid != torvaldEriksson.Guid,
                                 new Action(ctx => torvaldEriksson.Target())),
                             // face
                             new Decorator(
                                 ctx => !WoWMovement.ActiveMover.IsSafelyFacing(torvaldEriksson, 30),
                                 new Action(ctx => torvaldEriksson.Face())),
                             new Action(ctx => AimAndFire(torvaldEriksson))))));
        }
Ejemplo n.º 6
0
        public static async Task <bool> FaceTarget(WoWUnit target)
        {
            if (target == null || Me.IsSafelyFacing(target) || !target.IsValidCombatUnit() || HK.RotationOnlyOn || !GeneralSettings.Instance.GeneralFacing)
            {
                return(false);
            }

            if (!lastTimeFaced.IsRunning || (target.Guid == lastUnitGuid && lastTimeFaced.ElapsedMilliseconds > 500))
            {
                L.infoLog("Not facing target; will attempt to", InfoColor);
            }

            target.Face();



            lastUnitGuid = target.Guid;
            if (Me.IsWithinMeleeRangeOf(target) && Me.IsMoving && GeneralSettings.Instance.GeneralMovement && !Managers.Hotkeys.RotationOnlyOn)
            {
                return(await CommonCoroutines.StopMoving());
            }
            if (!lastTimeFaced.IsRunning)
            {
                lastTimeFaced.Start();
            }
            else
            {
                lastTimeFaced.Restart();
            }
            await Coroutine.Yield();

            return(true);
        }
Ejemplo n.º 7
0
        public static void AvoidFrontal(WoWUnit npcID, int radius, int range)
        {
            // npcName: NPC ID number, radius: (how wide is the cone in deg) 0 is safely behind, range: Range of the spell
            if (!StyxWoW.Me.IsFacing(npcID)) { npcID.Face(); }

            var rotation = GetPositive(npcID.RotationDegrees);
            var invertRotation = GetInvert(rotation);
            var move = GetPositive(StyxWoW.Me.RotationDegrees) > invertRotation ? WoWMovement.MovementDirection.StrafeRight : WoWMovement.MovementDirection.StrafeLeft;

            while (npcID.Distance2D <= range && npcID.IsCasting && ((radius == 0 && !StyxWoW.Me.IsSafelyBehind(npcID)) ||
                  (radius != 0 && npcID.IsSafelyFacing(StyxWoW.Me, radius)) || npcID.Distance2D <= 2)) {
                WoWMovement.Move(move);
                npcID.Face();
            }
            WoWMovement.MoveStop();
        }
Ejemplo n.º 8
0
        /*
         * public static void AvoidEnemyAOE(WoWPoint location, List<WoWDynamicObject> Objects, string Aura, int TraceStep)
         * {
         *  if (Objects == null)
         *  { Logging.Write("no Lightning Pools found .."); return; }
         *  Logging.Write("found {0} {1}! start RayCast ..", Objects.Count, Aura);
         *
         *  int MinDistToPools = (int)(Objects[0].Radius * 1.6f);
         *  int MaxDistToMove = MinDistToPools * 2;
         *
         *  // get save location
         *  WoWPoint newP = getSaveLocation(location, Objects, MinDistToPools, MaxDistToMove, TraceStep);
         *
         *  if (newP == WoWPoint.Empty)
         *  {
         *      // no save location found, move 2sec Strafe Left
         *      WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft, TimeSpan.FromSeconds(2));
         *      Thread.Sleep(TimeSpan.FromSeconds(2));
         *  }
         *  else
         *  {
         *      // move to save location
         *      while (StyxWoW.Me.HasAura(Aura) && StyxWoW.Me.Location.Distance(newP) > 0.2f)
         *      {
         *          Navigator.MoveTo(newP);
         *          Thread.Sleep(80);
         *      }
         *  }
         *
         *  WoWMovement.MoveStop();
         *  if (StyxWoW.Me.CurrentTargetGuid != 0)
         *      StyxWoW.Me.CurrentTarget.Face();
         *
         *  //Styx.CommonBot.Blacklist.Add(
         *  //Styx.CommonBot.Profiles.Blackspot vv = new Styx.CommonBot.Profiles.Blackspot(
         * }
         *
         * private static bool wlog(WoWDynamicObject obj)
         * { Logging.Write("add pool - dis2D: {0}", obj.Distance2D); return true; }
         * public static List<WoWDynamicObject> getLightningPoolList
         * {
         *  get
         *  {
         *      ObjectManager.Update();
         *      return (from lp in ObjectManager.GetObjectsOfType<WoWDynamicObject>()
         *              orderby lp.Distance2D ascending
         *              where lp.Entry == 129657
         *              where wlog(lp)
         *              select lp).ToList();
         *  }
         * }
         *
         * public static List<WoWDynamicObject> getCausticPitchList
         * {
         *  get
         *  {
         *      ObjectManager.Update();
         *      return (from lp in ObjectManager.GetObjectsOfType<WoWDynamicObject>()
         *              orderby lp.Distance2D ascending
         *              where lp.Entry == 126336
         *              where wlog(lp)
         *              select lp).ToList();
         *  }
         * }
         *
         * public static List<WoWDynamicObject> getVenomSplashList
         * {
         *  get
         *  {
         *      ObjectManager.Update();
         *      return (from lp in ObjectManager.GetObjectsOfType<WoWDynamicObject>()
         *              orderby lp.Distance2D ascending
         *              where lp.Entry == 79607
         *              where wlog(lp)
         *              select lp).ToList();
         *  }
         * }
         *
         #region RayCast
         *
         * private static WoWPoint getSaveLocation(WoWPoint Location, List<WoWDynamicObject> badObjects, int minDist, int maxDist, int traceStep)
         * {
         *  Logging.Write("Navigation: Looking for save Location around {0}.", Location);
         *
         *  try
         *  {
         *      //float _PIx2 = 3.14159f * 2f;
         *      float _PIx2 = ((float)new Random().Next(1, 80) * (1.248349f + (float)new Random().NextDouble()));
         *
         *      for (int i = 0, x = minDist; i < traceStep && x < maxDist; i++)
         *      {
         *          WoWPoint p = Location.RayCast((i * _PIx2) / traceStep, x);
         *
         *          p.Z = getGroundZ(p);
         *
         *          if (p.Z != float.MinValue && StyxWoW.Me.Location.Distance2D(p) > 1 &&
         *              (badObjects.FirstOrDefault(_obj => _obj.Location.Distance2D(p) <= minDist) == null) &&
         *              //(ObjectManager.GetObjectsOfType<WoWUnit>().FirstOrDefault(u => u.Location.Distance2D(p) < 20 && u.IsAlive && !u.Combat) == null) &&
         *              Navigator.GeneratePath(StyxWoW.Me.Location, p).Length != 0)
         *          {
         *              if (getHighestSurroundingSlope(p) < 1.2f)
         *              {
         *                  Logging.Write("Navigation: Moving to {0}. Distance: {1}", p, Location.Distance(p));
         *                  return p;
         *              }
         *          }
         *
         *          if (i == (traceStep - 1))
         *          {
         *              i = 0;
         *              x++;
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  { Logging.WriteException(ex); }
         *
         *
         *  Logging.Write(" - No valid points returned by RayCast ...");
         *  return WoWPoint.Empty;
         *
         * }
         *
         * /// <summary>
         * /// Credits to exemplar.
         * /// </summary>
         * /// <returns>Z-Coordinates for PoolPoints so we don't jump into the water.</returns>
         * private static float getGroundZ(WoWPoint p)
         * {
         *  WoWPoint ground = WoWPoint.Empty;
         *
         *  GameWorld.TraceLine(new WoWPoint(p.X, p.Y, (p.Z + 100)), new WoWPoint(p.X, p.Y, (p.Z - 5)), GameWorld.CGWorldFrameHitFlags.HitTestGroundAndStructures/* | GameWorld.CGWorldFrameHitFlags.HitTestBoundingModels | GameWorld.CGWorldFrameHitFlags.HitTestWMO*/ /*, out ground);
         *
         *  if (ground != WoWPoint.Empty)
         *  {
         *      Logging.Write(" - Ground Z: {0}.", ground.Z);
         *      return ground.Z;
         *  }
         *  Logging.Write(" - Ground Z returned float.MinValue.");
         *  return float.MinValue;
         * }
         *
         * /// <summary>
         * /// Credits to funkescott.
         * /// </summary>
         * /// <returns>Highest slope of surrounding terrain, returns 100 if the slope can't be determined</returns>
         * private static float getHighestSurroundingSlope(WoWPoint p)
         * {
         *  Logging.Write("Navigation: Sloapcheck on Point: {0}", p);
         *  float _PIx2 = 3.14159f * 2f;
         *  float highestSlope = -100;
         *  float slope = 0;
         *  int traceStep = 15;
         *  float range = 0.5f;
         *  WoWPoint p2;
         *  for (int i = 0; i < traceStep; i++)
         *  {
         *      p2 = p.RayCast((i * _PIx2) / traceStep, range);
         *      p2.Z = getGroundZ(p2);
         *      slope = Math.Abs(getSlope(p, p2));
         *      if (slope > highestSlope)
         *      {
         *          highestSlope = (float)slope;
         *      }
         *  }
         *  Logging.Write(" - Highslope {0}", highestSlope);
         *  return Math.Abs(highestSlope);
         * }
         *
         * /// <summary>
         * /// Credits to funkescott.
         * /// </summary>
         * /// <param name="p1">from WoWPoint</param>
         * /// <param name="p2">to WoWPoint</param>
         * /// <returns>Return slope from WoWPoint to WoWPoint.</returns>
         * private static float getSlope(WoWPoint p1, WoWPoint p2)
         * {
         *  float rise = p2.Z - p1.Z;
         *  float run = (float)Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2));
         *
         *  return rise / run;
         * }
         #endregion
         */
        #endregion

        #region AvoidFrontal
        public static void AvoidFrontal(WoWUnit npcID, int radius, int range)   // npcName: NPC ID number, radius: (how wide is the cone in deg) 0 is safely behind, range: Range of the spell
        {
            if (!StyxWoW.Me.IsFacing(npcID))
            {
                npcID.Face();
            }

            var rotation       = GetPositive(npcID.RotationDegrees);
            var invertRotation = GetInvert(rotation);
            var move           = GetPositive(StyxWoW.Me.RotationDegrees) > invertRotation ? WoWMovement.MovementDirection.StrafeRight : WoWMovement.MovementDirection.StrafeLeft;

            while (npcID.Distance2D <= range && npcID.IsCasting && ((radius == 0 && !StyxWoW.Me.IsSafelyBehind(npcID)) ||
                                                                    (radius != 0 && npcID.IsSafelyFacing(StyxWoW.Me, radius)) || npcID.Distance2D <= 2))
            {
                WoWMovement.Move(move);
                npcID.Face();
            }
            WoWMovement.MoveStop();
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     (Non-Blocking) Attempts to face the specified target.
        /// </summary>
        /// <returns>Returns true if we are able to safely face the target</returns>
        public static async Task FaceTarget(WoWUnit target, Func <bool> conditionCheck = null)
        {
            if (conditionCheck != null && !conditionCheck())
            {
                return;
            }

            target.Face();
            await CommonCoroutines.SleepForLagDuration();
        }
 /// <summary>
 /// Function to Avoid Camel Spit
 /// </summary>
 public void AvoidSpit(WoWUnit Unit)
 {
     if (!StyxWoW.Me.IsFacing(Unit))
     {
         Unit.Face(); Thread.Sleep(100);
     }
     Logging.Write(Colors.MediumPurple, "Rarekiller: Avoid Camel Spit");
     //94967 = Aura Spit
     while (Me.HasAura(94967))
     {
         WoWMovement.Move(WoWMovement.MovementDirection.StrafeRight);
         if (Rarekiller.ToonInvalid)
         {
             return;
         }
     }
     WoWMovement.MoveStop();
     Unit.Face();
     Logging.Write(Colors.MediumPurple, "Rarekiller: successfully avoided Camel Spit");
 }
Ejemplo n.º 11
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;
                }
            }
        }
Ejemplo n.º 12
0
 public void Pull(WoWUnit unit)
 {
     if (unit == null || !unit.IsValid)
     {
         return;
     }
     try
     {
         Mover.StopMoving();
         unit.Face();
         unit.Select();
         Manager.LocalPlayer.StartAttack();
         PullSpell.ExecuteEx(unit);
     }
     catch (Exception) { }
 }
Ejemplo n.º 13
0
        // ------------ Spell Functions
        /// <summary>
        /// Casts a Spell on a Unit
        /// </summary>
        /// <param name="spellName">The Spellname as String</param>
        /// <param name="Unit">The Enemy</param>
        /// <param name="wait">true and he will wait till the Cast is finished</param>
        /// <returns>true if the cast was sucessfull</returns>
        static public bool CastSafe(string spellName, WoWUnit Unit, bool wait)
        {
            bool SpellSuccess = false;

            if (!SpellManager.HasSpell(spellName))
            {
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: I don't have Spell {0}", spellName);
                return(false);
            }

            WoWMovement.MoveStop();
            if (Unit != Me)
            {
                Unit.Target();
                if (!Me.IsFacing(Unit))
                {
                    Unit.Face();
                    Thread.Sleep(100);
                }
            }

            if (!SpellManager.CanCast(spellName))
            {
                Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: cannot cast spell '{0}' yet - cd={1}, gcd={2}, casting={3} ",
                                        SpellManager.Spells[spellName].Name,
                                        SpellManager.Spells[spellName].Cooldown,
                                        SpellManager.GlobalCooldown,
                                        Me.IsCasting
                                        );
                return(false);
            }
            Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: * Cast Distance: {0}", Unit.Location.Distance(Me.Location).ToString());
            SpellSuccess = SpellManager.Cast(spellName, Unit);
            Logging.Write(Colors.MediumPurple, "Rarekiller: * {0} - {1}", spellName, SpellSuccess);
            Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller Developer Log: Global Cooldown running - Variable in HB {0}", SpellManager.GlobalCooldown);
            if (wait)
            {
                Thread.Sleep(500);
                while (Me.IsCasting)
                {
                    Thread.Sleep(50);
                }
                Thread.Sleep(500);
            }
            return(SpellSuccess);
        }
Ejemplo n.º 14
0
 public static void Face(WoWUnit mob)
 {
     DateTime stoptime = DateTime.Now.AddSeconds(1);
     if (StyxWoW.Me.Location == mob.Location)
     {
         KeyboardManager.PressKey((char)Keys.Back);
         Thread.Sleep(50);
         KeyboardManager.ReleaseKey((char)Keys.Back);
         return;
     }
     while (!StyxWoW.Me.IsSafelyFacing(mob) && DateTime.Now < stoptime)
     {
         FTWLogger.debug(Color.Violet, "Facing {0}", mob.SafeName());
         mob.Face();
         Thread.Sleep(10);
     }
 }
Ejemplo n.º 15
0
        public override void Combat()
        {
            using (new FrameLock())
            {
                WoWUnit Target = StyxWoW.Me.CurrentTarget;

                if (Target == null)
                {
                    return;
                }

                // Handle Movement's
                if (Target.IsWithinMeleeRange == false)
                {
                    Managers.NavMan.MoveBehind(Target);
                }

                // Handle behind
                if (Target.IsPlayer && !Target.MeIsBehind && Target.IsWithinMeleeRange)
                {
                    Managers.NavMan.MoveBehind(Target);
                }

                if (!Me.IsMoving && !Me.IsSafelyFacing(Target))
                {
                    Target.Face();
                }

                // bug with being on a mount
                if (Me.Mounted)
                {
                    Mount.Dismount();
                }

                Managers.BGHealers._Instance = new BGHealers();

                // Handle Combat
                switch (Managers.Spec.CurrentSpec)
                {
                case eSpec.Subtlety:
                    Spec.Subtlety.Combat.pulse();
                    break;
                }
            }
        }
Ejemplo n.º 16
0
        public static void Face(WoWUnit mob)
        {
            DateTime stoptime = DateTime.Now.AddSeconds(1);

            if (StyxWoW.Me.Location == mob.Location)
            {
                KeyboardManager.PressKey((char)Keys.Back);
                Thread.Sleep(50);
                KeyboardManager.ReleaseKey((char)Keys.Back);
                return;
            }
            while (!StyxWoW.Me.IsSafelyFacing(mob) && DateTime.Now < stoptime)
            {
                FTWLogger.debug(Color.Violet, "Facing {0}", mob.SafeName());
                mob.Face();
                Thread.Sleep(10);
            }
        }
Ejemplo n.º 17
0
 private async Task ah()
 {
     await Task.Run(async() =>
     {
         WoWUnit auc = findAuctioner();
         auc.Face();
         auc.Target();
         while (!auc.WithinInteractRange)
         {
             await Task.Run(async() =>
             {
                 //Navigator.MoveTo(auc.Location);
                 WoWMovement.ClickToMove(auc.Location);
                 await Task.Delay(100);
             });
         }
         WoWMovement.MoveStop();
         auc.Interact();
     });
 }
Ejemplo n.º 18
0
 private void doWork()
 {
     if (Me.GotTarget && Me.CurrentTarget.IsAuctioneer && Me.CurrentTarget.CanInteract)
     {
         if (Me.IsMoving && Me.CurrentTarget.WithinInteractRange)
         {
             WoWMovement.MoveStop();
         }
         doStuffWithNPC();
     }
     else if (Me.GotTarget && Me.CurrentTarget.IsAuctioneer && !Me.CurrentTarget.CanInteract)
     {
         Me.CurrentTarget.Face();
         moveToNPC();
     }
     else if (!Me.GotTarget || !Me.CurrentTarget.IsAuctioneer)
     {
         WoWUnit foundAuctioner = findAuctioner();
         foundAuctioner.Target();
         foundAuctioner.Face();
     }
 }
Ejemplo n.º 19
0
        protected Composite CreateBehavior_QuestbotMain()
        {
            return(_root ?? (_root =
                                 new Decorator(ctx => !_isBehaviorDone && (!Me.IsActuallyInCombat || IgnoreCombat),
                                               new PrioritySelector(

                                                   new Decorator(ret => Counter > NumOfTimes && QuestId == 0,
                                                                 new Action(ret => _isBehaviorDone = true)),

                                                   new Decorator(
                                                       ret => UseType == QBType.Current,
                                                       new PrioritySelector(
                                                           new Decorator(
                                                               new Sequence(
                                                                   new Action(ret => TreeRoot.StatusText = "Using Pet Ability:" + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                                   new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                                   new SleepForLagDuration(),
                                                                   new Action(ret => Lua.DoString("CastPetAction({0})", AttackButton)),
                                                                   new SleepForLagDuration(),
                                                                   new Action(ret => Counter++),
                                                                   new Sleep(WaitTime))
                                                               ))),

                                                   new Decorator(
                                                       ret => UseType == QBType.Location,
                                                       new PrioritySelector(
                                                           new Decorator(
                                                               ret => Me.Location.Distance(MoveToLocation) > 3,
                                                               new Sequence(
                                                                   new Action(ret => TreeRoot.StatusText = "Moving To Use Ability at Location, Distance: " + MoveToLocation.Distance(Me.Location)),
                                                                   new Action(ret => Navigator.MoveTo(MoveToLocation)))),
                                                           new Sequence(
                                                               new Action(ret => TreeRoot.StatusText = "Using Pet Ability At Location:" + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                               new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                               new SleepForLagDuration(),
                                                               new Action(ret => Lua.DoString("CastPetAction({0})", AttackButton)),
                                                               new SleepForLagDuration(),
                                                               new Action(ret => Counter++),
                                                               new Sleep(WaitTime))
                                                           )),

                                                   new Decorator(
                                                       ret => UseType == QBType.ToObject,
                                                       new PrioritySelector(
                                                           new Decorator(
                                                               ret => UseObject == null && Me.Location.DistanceSquared(MoveToLocation) >= 2 * 2,
                                                               new Sequence(
                                                                   new Action(ret => TreeRoot.StatusText = "Moving To Use Ability around Location. Distance: " + MoveToLocation.Distance(Me.Location)),
                                                                   new Action(ret => Navigator.MoveTo(MoveToLocation)))),
                                                           new Decorator(
                                                               ret => UseObject != null,
                                                               new PrioritySelector(
                                                                   new Decorator(
                                                                       ret => UseObject.DistanceSqr >= Range * Range,
                                                                       new Sequence(
                                                                           new Action(ret => TreeRoot.StatusText = "Moving closer to the Target, Distance: " + MoveToLocation.Distance(Me.Location)),
                                                                           new Action(ret => Navigator.MoveTo(UseObject.Location)))),
                                                                   new Decorator(
                                                                       ret => UseObject.DistanceSqr < MinRange * MinRange,
                                                                       new Sequence(
                                                                           new Action(ret => TreeRoot.StatusText = "Too Close, Backing Up"),
                                                                           new Action(ret => Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(Me.Location, UseObject.Location, (float)MinRange + 2f)))
                                                                           )),
                                                                   new Sequence(
                                                                       new Action(ret => TreeRoot.StatusText = "Using Pet Ability On Target : " + UseObject.SafeName + " " + Counter + " Out of " + NumOfTimes + " Times"),
                                                                       new Action(ret => UseObject.Target()),
                                                                       new Action(ret => Navigator.PlayerMover.MoveStop()),
                                                                       new Action(ret => UseObject.Face()),
                                                                       new SleepForLagDuration(),
                                                                       new Action(ret => Lua.DoString("CastPetAction({0})", AttackButton)),
                                                                       new Action(ret => Counter++),
                                                                       new SleepForLagDuration(),
                                                                       new Action(ret => _npcBlacklist.Add(UseObject.Guid)),
                                                                       new Sleep(WaitTime)))),
                                                           new Action(ret => TreeRoot.StatusText = "No objects around. Waiting")
                                                           ))
                                                   ))));
        }
Ejemplo n.º 20
0
 private void Face(WoWUnit tar)
 {
     if (Styx.BotManager.Current.Name != "LazyRaider")
     {
         tar.Face();
     }
 }
Ejemplo n.º 21
0
 private void Face(WoWUnit tar)
 {
     if (Manual)
     {
         tar.Face();
     }
 }
Ejemplo n.º 22
0
        // ------------ Spell Functions
        static public bool CastSafe(string spellName, WoWUnit Unit, bool wait)
        {
            bool SpellSuccess = false;

            if (Me.IsCasting)
            {
                Logging.WriteDebug("Rarekiller Part Spells: I was already Casting");
                return(false);
            }
            if (!SpellManager.HasSpell(spellName))
            {
                Logging.WriteDebug("Rarekiller Part Spells: I don't have Spell {0}", spellName);
                return(false);
            }

            if (SpellManager.HasSpell(spellName) && !Me.IsCasting)
            {
                if (SpellManager.Spells[spellName].CastTime > 1)
                {
                    WoWMovement.MoveStop();
                }
                Unit.Target();
                Thread.Sleep(100);
                Unit.Face();
                Thread.Sleep(150);

                while (StyxWoW.GlobalCooldown)
                {
                    Thread.Sleep(10);
                }

                if (!SpellManager.CanCast(spellName))
                {
                    Logging.WriteDebug("Rarekiller Part Spells: cannot cast spell '{0}' yet - cd={1}, gcd={2}, casting={3} ",
                                       SpellManager.Spells[spellName].Name,
                                       SpellManager.Spells[spellName].Cooldown,
                                       StyxWoW.GlobalCooldown,
                                       Me.IsCasting
                                       );
                    return(false);
                }

                SpellSuccess = SpellManager.Cast(spellName);

                Thread.Sleep(200);

                //if (StyxWoW.GlobalCooldown || Me.IsCasting)
                //	SpellSuccess = true;
                if (SpellSuccess)
                {
                    Logging.Write("Rarekiller Part Spells: * {0}.", spellName);
                }
                if (wait)
                {
                    while (StyxWoW.GlobalCooldown || Me.IsCasting)
                    {
                        Thread.Sleep(100);
                    }
                }

                Logging.WriteDebug("Rarekiller Part Spells: Spell successfull? {0}.", SpellSuccess);
                return(SpellSuccess);
            }

            Logging.WriteDebug("Rarekiller Part Spells: Can't cast {0}.", spellName);
            return(false);
        }
        public static void Routine(WoWUnit _unit)
        {
            while (_unit != null && _unit.IsAlive && !StyxWoW.Me.IsSwimming && _unit.Distance <= CharacterSettings.Instance.PullDistance && !StyxWoW.Me.Mounted)
            {
                WoWSpell AutoAtack = WoWSpell.FromId(6603);

                #region PALDIN
                if (StyxWoW.Me.Class == WoWClass.Paladin)
                {
                    TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                    WoWUnit AOEunit = BotCKS.getNode(_unit, 9, 2);
                    WoWSpell Weihe = WoWSpell.FromId(26573);
                    WoWSpell HammerDR = WoWSpell.FromId(53595);
                    WoWSpell HZorn = WoWSpell.FromId(2812);
                    WoWSpell KStoß = WoWSpell.FromId(35395);
                    WoWSpell GSturm = WoWSpell.FromId(53385);
                    WoWSpell SiegelDW = WoWSpell.FromId(31801);
                    WoWSpell Richturteil = WoWSpell.FromId(20271);

                    // need buff?
                    if (SpellManager.HasSpell(SiegelDW.Id) && !StyxWoW.Me.HasAura(SiegelDW.Name) && !Styx.StyxWoW.GlobalCooldown)
                    {
                        TreeRoot.StatusText = "CritterKillSquad: need buff " + SiegelDW.Name + " ...";
                        BotCKS.slog("need buff " + SiegelDW.Name);
                        SiegelDW.Cast();
                        Thread.Sleep(BotCKS.ran.Next(400, 800));
                    }

                    if (AOEunit != null)
                    {
                        if (AOEunit.Distance >= 3)
                        {
                            MoveToNode(AOEunit, 3);
                        }

                        TreeRoot.StatusText = "CritterKillSquad: search for best " + Weihe.Name + " point ...";
                        if (SpellManager.HasSpell(GSturm) && !GSturm.Cooldown && !Styx.StyxWoW.GlobalCooldown && StyxWoW.Me.HolyPowerPercent > 0)
                        {
                            TreeRoot.StatusText = "CritterKillSquad: cast " + GSturm.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
                            BotCKS.slog("Cast " + GSturm.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
                            GSturm.Cast();

                        }
                        else if (SpellManager.HasSpell(HammerDR) && !HammerDR.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                        {
                            if (AOEunit.Distance >= 3)
                                MoveToNode(AOEunit, 3);

                            if (!StyxWoW.Me.GotTarget || !StyxWoW.Me.CurrentTarget.IsAlive || StyxWoW.Me.CurrentTarget != AOEunit)
                            {
                                TreeRoot.StatusText = "CritterKillSquad: face " + AOEunit.Name + " ...";
                                AOEunit.Target();
                                AOEunit.Face();
                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                            }
                            TreeRoot.StatusText = "CritterKillSquad: Cast " + HammerDR.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
                            BotCKS.slog("Cast " + HammerDR.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
                            HammerDR.Cast();
                            StyxWoW.Me.ClearTarget();
                        }
                        else if (SpellManager.HasSpell(Weihe) && !Weihe.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                        {
                            TreeRoot.StatusText = "CritterKillSquad: cast " + Weihe.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
                            BotCKS.slog("Cast " + Weihe.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
                            Weihe.Cast();
                        }
                        else if (SpellManager.HasSpell(HZorn) && !HZorn.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                        {
                            TreeRoot.StatusText = "CritterKillSquad: Cast " + HZorn.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name;
                            BotCKS.slog("Cast " + HZorn.Name + " on ≈ " + BotCKS.AOEcount + " " + AOEunit.Name);
                            HZorn.Cast();
                        }
                        else
                        {
                            TreeRoot.StatusText = "CritterKillSquad: [WAIT] " + Weihe.Name + " & " + HammerDR.Name + " & " + HZorn.Name + " on cooldown ...";
                            Thread.Sleep(300);
                            //continue;
                        }
                        Thread.Sleep(BotCKS.ran.Next(200, 700));
                    }
                    else if (SpellManager.HasSpell(KStoß.Id) && !Styx.StyxWoW.GlobalCooldown && !KStoß.Cooldown)
                    {
                        if (_unit.Distance >= 3)
                            MoveToNode(_unit, 3);

                        TreeRoot.StatusText = "CritterKillSquad: Cast " + KStoß.Name + " ...";
                        BotCKS.slog("Cast " + KStoß.Name);

                        if (!StyxWoW.Me.GotTarget || !StyxWoW.Me.CurrentTarget.IsAlive || StyxWoW.Me.CurrentTarget != _unit)
                        {
                            TreeRoot.StatusText = "CritterKillSquad: face " + _unit.Name + " ...";
                            _unit.Target();
                            _unit.Face();
                            Thread.Sleep(BotCKS.ran.Next(200, 500));
                        }

                        KStoß.Cast();
                        Thread.Sleep(BotCKS.ran.Next(950, 1200));
                        StyxWoW.Me.ClearTarget();
                    }
                    else if (SpellManager.HasSpell(Richturteil.Id) && !Styx.StyxWoW.GlobalCooldown && !Richturteil.Cooldown && StyxWoW.Me.HasAura(SiegelDW.Name))
                    {
                        TreeRoot.StatusText = "CritterKillSquad: Cast " + Richturteil.Name + " ...";
                        BotCKS.slog("Cast " + Richturteil.Name);
                        _unit.Target();
                        Richturteil.Cast();
                        Thread.Sleep(BotCKS.ran.Next(950, 1200));
                    }
                    else if(_unit.IsAlive)
                    {
                        if (_unit.Distance >= 3)
                        {
                            BotCKS.StuckDetector();
                            MoveToNode(_unit, 3);
                        }

                        TreeRoot.StatusText = "CritterKillSquad: no Cast ready! Interact with " + _unit.Name;
                        BotCKS.slog("no Cast ready! Interact with " + _unit.Name);
                        _unit.Target(); _unit.Interact();
                        Thread.Sleep(BotCKS.ran.Next(200, 500));
                    }

                }
                #endregion

                else

                    #region SHAMAN
                    if (StyxWoW.Me.Class == WoWClass.Shaman)
                    {
                        TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                        bool canErdbeben = true;
                        WoWUnit AOEunit = BotCKS.getNode(_unit, 11, 3); //AOEunit = null;

                        WoWSpell erdbeben = WoWSpell.FromId(61882);
                        WoWSpell gewitter = WoWSpell.FromId(51490);
                        WoWSpell blitzschlag = WoWSpell.FromId(403);

                        if (AOEunit != null && AOEunit.IsAlive && !Styx.StyxWoW.GlobalCooldown && ((SpellManager.HasSpell(gewitter) && !gewitter.Cooldown) || (SpellManager.HasSpell(erdbeben) && !erdbeben.Cooldown)))
                        {
                            if (SpellManager.HasSpell(erdbeben) && !erdbeben.Cooldown && AOEunit != null && canErdbeben && StyxWoW.Me.ManaPercent > 35)
                            {
                                if (AOEunit != null && (AOEunit.Distance >= CharacterSettings.Instance.PullDistance || (AOEunit.Distance <= CharacterSettings.Instance.PullDistance && !_unit.InLineOfSight)))
                                {
                                    MoveToNode(CharacterSettings.Instance.PullDistance, AOEunit);
                                }

                                erdbeben.Cast();
                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                                if (!LegacySpellManager.ClickRemoteLocation(AOEunit.Location))
                                {
                                    string txt = String.Format("{0} FAILED: cancelling {0}!!", erdbeben.Name);
                                    BotCKS.slog(txt);
                                    TreeRoot.StatusText = "CritterKillSquad: " + txt;

                                    if (StyxWoW.Me.IsCasting)
                                        SpellManager.StopCasting();

                                    canErdbeben = false;
                                    continue;
                                }
                                else
                                {
                                    string txt = String.Format("{0} successful: click {0} on ≈ {2} {1}", erdbeben.Name, BotCKS.AOEcount, AOEunit.Name);
                                    BotCKS.slog(txt);
                                    TreeRoot.StatusText = "CritterKillSquad: " + txt;
                                    Thread.Sleep(BotCKS.ran.Next(2280, 2600));
                                }

                            }
                            else if (SpellManager.HasSpell(gewitter) && !gewitter.Cooldown && AOEunit != null && !Styx.StyxWoW.GlobalCooldown)
                            {
                                if (AOEunit.Distance >= 3)
                                {
                                    MoveToNode(AOEunit, 3);
                                }

                                TreeRoot.StatusText = "CritterKillSquad: cast " + gewitter.Name + " ...";
                                gewitter.Cast();
                            }
                            Thread.Sleep(BotCKS.ran.Next(200, 700));
                        }
                        else
                        {
                            WoWMovement.MoveStop();
                            while (_unit != null && _unit.IsAlive && !StyxWoW.Me.IsSwimming && _unit.InLineOfSight && _unit.Distance <= CharacterSettings.Instance.PullDistance)
                            {
                                if (!StyxWoW.Me.GotTarget || !StyxWoW.Me.CurrentTarget.IsAlive || StyxWoW.Me.CurrentTarget != _unit)
                                {
                                    TreeRoot.StatusText = "CritterKillSquad: face " + _unit.Name + " ...";
                                    _unit.Target();
                                    _unit.Face();
                                    Thread.Sleep(200);
                                }
                                TreeRoot.StatusText = "CritterKillSquad: attacking " + _unit.Name;
                                if (!Styx.StyxWoW.GlobalCooldown && !StyxWoW.Me.IsCasting)
                                    blitzschlag.Cast(); //RoutineManager.Current.Combat(); _unit.Interact();
                                Thread.Sleep(BotCKS.ran.Next(100, 300));
                            }
                        }

                    }
                    #endregion
                    else
                #region Priest
                if (StyxWoW.Me.Class == WoWClass.Priest)
                {
                    TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                    WoWUnit AOEunit = BotCKS.getNode(_unit, 11, 2); //AOEunit = null;

                    WoWSpell HNova = WoWSpell.FromId(15237);

                    if (AOEunit != null && SpellManager.HasSpell(HNova.Id) && StyxWoW.Me.ManaPercent >= 15 && !HNova.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                    {
                        if (AOEunit.Distance >= 3)
                            MoveToNode(AOEunit, 3);

                        TreeRoot.StatusText = "CritterKillSquad: cast " + HNova.Name + " on ≈ " + BotCKS.AOEcount;
                        BotCKS.slog("cast " + HNova.Name + " on ≈ " + BotCKS.AOEcount);
                        HNova.Cast();
                        Thread.Sleep(BotCKS.ran.Next(800, 1500));

                    }
                    else if (_unit.IsAlive)
                    {
                        if (_unit.Distance >= 3)
                        {
                            BotCKS.StuckDetector();
                            MoveToNode(_unit, 3);
                        }

                        TreeRoot.StatusText = "CritterKillSquad: " + HNova.Name + " is not ready! Interact with " + _unit.Name;
                        BotCKS.slog(HNova.Name + " is not ready! Interact with " + _unit.Name);
                        _unit.Target(); _unit.Interact();

                        if(!StyxWoW.Me.IsAutoAttacking)
                        AutoAtack.Cast();

                        Thread.Sleep(BotCKS.ran.Next(200, 500));
                    }

                }
                #endregion
                else

                    #region Hunter
                    if (StyxWoW.Me.Class == WoWClass.Hunter)
                    {
                        TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                        WoWUnit AOEunit = BotCKS.getNode(_unit, 11, 2);
                        WoWPoint m = WoWPoint.Empty;

                        WoWSpell MultiShot = WoWSpell.FromId(2643);
                        WoWSpell AutoShot = WoWSpell.FromId(75);

                        if (AOEunit != null && SpellManager.HasSpell(MultiShot.Id) && !MultiShot.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                        {
                            while (AOEunit.Distance <= 10)
                            {
                                if (m == WoWPoint.Empty)
                                    m = BotCKS.getSaveLocation(AOEunit.Location, 11, 20, 60);

                                WoWMovement.ClickToMove(m);
                            }

                            TreeRoot.StatusText = "CritterKillSquad: cast " + MultiShot.Name + " on ≈ " + BotCKS.AOEcount;
                            BotCKS.slog("cast " + MultiShot.Name + " on ≈ " + BotCKS.AOEcount);

                            AOEunit.Target();
                            AOEunit.Face();
                            MultiShot.Cast();
                            Thread.Sleep(BotCKS.ran.Next(200, 500));
                            m = WoWPoint.Empty;
                        }
                        else if (_unit.IsAlive)
                        {
                            while (_unit.Distance <= 10)
                            {
                                if (m == WoWPoint.Empty)
                                    m = BotCKS.getSaveLocation(_unit.Location, 11, 20, 60);

                                WoWMovement.ClickToMove(m);
                            }

                            TreeRoot.StatusText = "CritterKillSquad: cast " + AutoShot.Name;
                            BotCKS.slog("cast " + AutoShot.Name);

                            _unit.Target(); _unit.Face();
                            AutoShot.Cast();
                            Thread.Sleep(BotCKS.ran.Next(800, 1500));
                        }

                    }
                    #endregion
                    else

                        #region Warlock
                        if (StyxWoW.Me.Class == WoWClass.Warlock)
                        {
                            TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                            WoWUnit AOEunit = BotCKS.getNode(_unit, 12, 2);
                            bool canRainofFire = true;

                            WoWSpell Metamorphosis = WoWSpell.FromId(47241);
                            WoWSpell HandofGuldan = WoWSpell.FromId(71521);
                            WoWSpell Felstorm = WoWSpell.FromId(89751);
                            WoWSpell RainofFire = WoWSpell.FromId(5740);
                            WoWSpell ShadowBolt = WoWSpell.FromId(686);

                            if (SpellManager.HasSpell(Metamorphosis.Id) && !Metamorphosis.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                            {
                                TreeRoot.StatusText = "CritterKillSquad: cast " + Metamorphosis.Name;
                                BotCKS.slog("cast " + Metamorphosis.Name);
                                Metamorphosis.Cast();
                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                            }

                            if (AOEunit != null && SpellManager.HasSpell(HandofGuldan.Id) && !HandofGuldan.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                            {
                                TreeRoot.StatusText = "CritterKillSquad: cast " + HandofGuldan.Name + " on ≈ " + BotCKS.AOEcount;
                                BotCKS.slog("cast " + HandofGuldan.Name + " on ≈ " + BotCKS.AOEcount);
                                AOEunit.Target(); AOEunit.Face();
                                HandofGuldan.Cast();
                                Thread.Sleep(BotCKS.ran.Next(2100, 3000));
                            }
                            else if (AOEunit != null && SpellManager.HasSpell(Felstorm.Id) && !Felstorm.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                            {
                                if (AOEunit.Distance >= 3)
                                    MoveToNode(AOEunit, 3);

                                TreeRoot.StatusText = "CritterKillSquad: cast " + Felstorm.Name + " on ≈ " + BotCKS.AOEcount;
                                BotCKS.slog("cast " + Felstorm.Name + " on ≈ " + BotCKS.AOEcount);
                                Felstorm.Cast();
                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                            }
                            else if (AOEunit != null && SpellManager.HasSpell(RainofFire.Id) && !RainofFire.Cooldown && canRainofFire && !Styx.StyxWoW.GlobalCooldown)
                            {
                                if (AOEunit != null && (AOEunit.Distance >= CharacterSettings.Instance.PullDistance || (AOEunit.Distance <= CharacterSettings.Instance.PullDistance && !_unit.InLineOfSight)))
                                {
                                    MoveToNode(CharacterSettings.Instance.PullDistance, AOEunit);
                                }

                                RainofFire.Cast();
                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                                if (!LegacySpellManager.ClickRemoteLocation(AOEunit.Location))
                                {
                                    string txt = String.Format("{0} FAILED: cancelling {0}!!", RainofFire.Name);
                                    BotCKS.slog(txt);
                                    TreeRoot.StatusText = "CritterKillSquad: " + txt;

                                    if (StyxWoW.Me.IsCasting)
                                        SpellManager.StopCasting();

                                    canRainofFire = false;
                                    continue;
                                }
                                else
                                {
                                    string txt = String.Format("{0} successful: click {0} on ≈ {2} {1}", RainofFire.Name, BotCKS.AOEcount, AOEunit.Name);
                                    BotCKS.slog(txt);
                                    TreeRoot.StatusText = "CritterKillSquad: " + txt;
                                    Thread.Sleep(BotCKS.ran.Next(2280, 3100));
                                }
                            }
                            else if (_unit.IsAlive && SpellManager.HasSpell(ShadowBolt.Id) && !ShadowBolt.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                            {
                                TreeRoot.StatusText = "CritterKillSquad: cast " + ShadowBolt.Name;
                                BotCKS.slog("cast " + ShadowBolt.Name);

                                _unit.Target(); _unit.Face();
                                ShadowBolt.Cast();
                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                            }

                        }
                        #endregion

                        else

                            #region DeathKnight
                            if (StyxWoW.Me.Class == WoWClass.DeathKnight)
                            {
                                TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                                bool canDeathAndDecay = true;
                                WoWUnit AOEunit = BotCKS.getNode(_unit, 11, 2);
                                WoWUnit AOEunit2 = BotCKS.getNode(_unit, 30, 2);

                                WoWSpell BloodBoil = WoWSpell.FromId(48721);
                                WoWSpell DeathAndDecay = WoWSpell.FromId(39658);

                                if (AOEunit2 != null && SpellManager.HasSpell(DeathAndDecay.Id) && !DeathAndDecay.Cooldown && !Styx.StyxWoW.GlobalCooldown && canDeathAndDecay)
                                {

                                    while (!AOEunit2.InLineOfSight)
                                    {
                                        WoWMovement.ClickToMove(AOEunit2.Location);
                                    }

                                    TreeRoot.StatusText = "CritterKillSquad: cast " + DeathAndDecay.Name + " on ≈ " + BotCKS.AOEcount;
                                    BotCKS.slog("cast " + DeathAndDecay.Name + " on ≈ " + BotCKS.AOEcount);

                                    DeathAndDecay.Cast();
                                    Thread.Sleep(BotCKS.ran.Next(200, 500));
                                    if (!LegacySpellManager.ClickRemoteLocation(AOEunit.Location))
                                    {
                                        string txt = String.Format("{0} FAILED: cancelling {0}!!", DeathAndDecay.Name);
                                        BotCKS.slog(txt);
                                        TreeRoot.StatusText = "CritterKillSquad: " + txt;

                                        if (StyxWoW.Me.IsCasting)
                                            SpellManager.StopCasting();

                                        canDeathAndDecay = false;
                                        continue;
                                    }
                                    else
                                    {
                                        string txt = String.Format("{0} successful: click {0} on ≈ {2} {1}", DeathAndDecay.Name, BotCKS.AOEcount, AOEunit.Name);
                                        BotCKS.slog(txt);
                                        TreeRoot.StatusText = "CritterKillSquad: " + txt;
                                        Thread.Sleep(BotCKS.ran.Next(700, 3100));
                                    }

                                }

                                if (AOEunit != null && SpellManager.HasSpell(BloodBoil.Id) && !BloodBoil.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                                {
                                    if (AOEunit.Distance >= 3)
                                    {
                                        MoveToNode(AOEunit, 3);
                                    }

                                    TreeRoot.StatusText = "CritterKillSquad: cast " + BloodBoil.Name + " on ≈ " + BotCKS.AOEcount;
                                    BotCKS.slog("cast " + BloodBoil.Name + " on ≈ " + BotCKS.AOEcount);

                                    AOEunit.Target(); AOEunit.Face();
                                    BloodBoil.Cast();
                                    Thread.Sleep(BotCKS.ran.Next(200, 500));
                                }
                                else if (_unit.IsAlive && !StyxWoW.Me.IsAutoAttacking)
                                {
                                    if (_unit.Distance >= 3)
                                    {
                                        MoveToNode(_unit, 3);
                                    }

                                    TreeRoot.StatusText = "CritterKillSquad: cast " + AutoAtack.Name;
                                    BotCKS.slog("cast " + AutoAtack.Name);
                                    _unit.Target(); _unit.Face();
                                    AutoAtack.Cast();
                                    Thread.Sleep(BotCKS.ran.Next(200, 500));
                                }

                            }
                            #endregion

                            else

                                #region Rogue
                                if (StyxWoW.Me.Class == WoWClass.Rogue)
                                {
                                    TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                                    WoWUnit AOEunit = BotCKS.getNode(_unit, 9, 2);

                                    WoWSpell FanOfKnives = WoWSpell.FromId(51723);

                                    if (AOEunit != null && SpellManager.HasSpell(FanOfKnives.Id) && !FanOfKnives.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                                    {
                                        if (AOEunit.Distance >= 3)
                                        {
                                            MoveToNode(AOEunit, 3);
                                        }

                                        TreeRoot.StatusText = "CritterKillSquad: cast " + FanOfKnives.Name + " on ≈ " + BotCKS.AOEcount;
                                        BotCKS.slog("cast " + FanOfKnives.Name + " on ≈ " + BotCKS.AOEcount);

                                        FanOfKnives.Cast();
                                        Thread.Sleep(BotCKS.ran.Next(400, 800));
                                    }
                                    else if (_unit.IsAlive)
                                    {
                                        if (_unit.Distance >= 3)
                                        {
                                            BotCKS.StuckDetector();
                                            MoveToNode(_unit, 3);
                                        }

                                        TreeRoot.StatusText = "CritterKillSquad: cast " + AutoAtack.Name;
                                        BotCKS.slog("cast " + AutoAtack.Name);

                                        _unit.Target(); _unit.Face();

                                        if(!StyxWoW.Me.IsAutoAttacking)
                                        AutoAtack.Cast();
                                    }
                                }
                                #endregion

                                else

                                    #region Mage
                                    if (StyxWoW.Me.Class == WoWClass.Mage)
                                    {
                                        TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                                        WoWUnit AOEunit = BotCKS.getNode(_unit, 11, 2);

                                        WoWSpell ArcaneExplosion = WoWSpell.FromId(1449);

                                        if (AOEunit != null && SpellManager.HasSpell(ArcaneExplosion.Id) && !ArcaneExplosion.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                                        {
                                            if (AOEunit.Distance >= 3)
                                            {
                                                MoveToNode(AOEunit, 3);
                                            }

                                            TreeRoot.StatusText = "CritterKillSquad: cast " + ArcaneExplosion.Name + " on ≈ " + BotCKS.AOEcount;
                                            BotCKS.slog("cast " + ArcaneExplosion.Name + " on ≈ " + BotCKS.AOEcount);

                                            ArcaneExplosion.Cast();
                                            Thread.Sleep(BotCKS.ran.Next(200, 500));
                                        }
                                        else if (_unit.IsAlive)
                                        {
                                            if (_unit.Distance >= 3)
                                            {
                                                BotCKS.StuckDetector();
                                                MoveToNode(_unit, 3);
                                            }

                                            _unit.Target(); _unit.Face();

                                            if(!StyxWoW.Me.IsAutoAttacking)
                                            AutoAtack.Cast();
                                        }
                                    }
                                    #endregion

                                    else

                                        #region Warrior
                                        if (StyxWoW.Me.Class == WoWClass.Warrior)
                                        {
                                            TreeRoot.StatusText = "CritterKillSquad: slay node ...";
                                            WoWUnit AOEunit = BotCKS.getNode(_unit, 9, 2);

                                            WoWSpell BattleShout = WoWSpell.FromId(6673);
                                            WoWSpell ThunderClap = WoWSpell.FromId(6343);
                                            WoWSpell HeroicLeap = WoWSpell.FromId(6544);

                                            if (SpellManager.HasSpell(BattleShout.Id) && !BattleShout.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                                            {
                                                TreeRoot.StatusText = "CritterKillSquad: cast " + BattleShout.Name;
                                                BotCKS.slog("cast " + BattleShout.Name);

                                                BattleShout.Cast();
                                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                                            }

                                            if (AOEunit != null && SpellManager.HasSpell(ThunderClap.Id) && !ThunderClap.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                                            {
                                                if (AOEunit.Distance >= 3)
                                                {
                                                    MoveToNode(AOEunit, 3);
                                                }

                                                TreeRoot.StatusText = "CritterKillSquad: cast " + ThunderClap.Name + " on ≈ " + BotCKS.AOEcount;
                                                BotCKS.slog("cast " + ThunderClap.Name + " on ≈ " + BotCKS.AOEcount);

                                                ThunderClap.Cast();
                                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                                            }
                                            else if (AOEunit != null && SpellManager.HasSpell(HeroicLeap.Id) && !HeroicLeap.Cooldown && !Styx.StyxWoW.GlobalCooldown)
                                            {
                                                if (AOEunit.Distance >= 3)
                                                {
                                                    MoveToNode(AOEunit, 3);
                                                }

                                                TreeRoot.StatusText = "CritterKillSquad: cast " + ThunderClap.Name + " on ≈ " + BotCKS.AOEcount;
                                                BotCKS.slog("cast " + ThunderClap.Name + " on ≈ " + BotCKS.AOEcount);

                                                HeroicLeap.Cast();
                                                Thread.Sleep(BotCKS.ran.Next(200, 500));
                                            }
                                            else if (_unit.IsAlive)
                                            {
                                                if (_unit.Distance >= 3)
                                                {
                                                    BotCKS.StuckDetector();
                                                    MoveToNode(_unit, 3);
                                                }

                                                _unit.Target(); _unit.Face();
                                                if(!StyxWoW.Me.IsAutoAttacking)
                                                AutoAtack.Cast();

                                            }
                                        }
                                        #endregion

            }
            WoWMovement.MoveStop();
            BotCKS.StopStuckDetector();
                BotCKS.AOEcount = 0;
        }
Ejemplo n.º 24
0
        public override void Pull()
        {
            // Quick Target check to see if ok to pull
            if (Utils.SafeChecks.TargetSafe == false)
            {
                return;
            }

            WoWUnit Target = Me.CurrentTarget;

            // Move closer,  Sap distance is 10ft
            if (Target.Distance > 10 && !Spell.HasMyAura("Sap", StyxWoW.Me.CurrentTarget))
            {
                Managers.NavMan.MoveBehind(Target);
                return;
            }

            // We need to face
            if ((!Me.IsSafelyFacing(Target, 90)) && (!Me.IsMoving))
            {
                Target.Face();
                return;
            }

            // Wait for full energy b4 we burst
            if (StyxWoW.Me.EnergyPercent != 100)
            {
                return;
            }

            // Next we will need to get a sap off to stop the person from moving
            // We have to check if his in combat some how,
            if (ClassSettings._Instance.GeneralToSap)
            {
                if (Target.Combat == false)
                {
                    if ((SpellManager.CanCast("Sap")) && (!Spell.HasMyAura("Sap", Target)) && (Target.IsHumanoid))
                    {
                        if (Spell.Cast("Sap", Target))
                        {
                            StyxWoW.SleepForLagDuration();   // Some reason energy isnt working properly? great..... -> bandade..
                            return;
                        }
                    }
                }
            }

            // We need to check if we are behind and have correct distance.
            if ((!Target.IsPlayerBehind) || !Target.IsWithinMeleeRange)
            {
                Managers.NavMan.MoveBehind(Target);
                return;
            }

            // Our Pull Timer
            PullTimer.Reset();
            PullTimer.Start();

            // Do what we need to!
            switch (Managers.Spec.CurrentSpec)
            {
            case eSpec.Subtlety:
                Spec.Subtlety.Pull.Pulse();
                break;
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        ///     (Non-Blocking) Attempts to face the specified target.
        /// </summary>
        /// <returns>Returns true if we are able to safely face the target</returns>
        public static async Task FaceTarget(WoWUnit target, Func<bool> conditionCheck = null)
        {
            if (conditionCheck != null && !conditionCheck())
                return;

            target.Face();
            await CommonCoroutines.SleepForLagDuration();
        }
Ejemplo n.º 26
0
        public Composite CreateBehavior_KillMantid()
        {
            WoWUnit   attackTarget        = null;
            WoWUnit   IronShredder        = null;
            WaitTimer DeathFromAboveTimer = WaitTimer.TenSeconds;

            return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle() && (IronShredder = Me.CharmedUnit) != null,
                                 new PrioritySelector(ctx => attackTarget = GetAttackTarget(),
                                                      new Decorator(ctx => attackTarget != null,
                                                                    new PrioritySelector(
                                                                        new ActionSetActivity("Moving to Attack"),
                                                                        new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid,
                                                                                      new ActionFail(ctx => attackTarget.Target())),
                                                                        new Decorator(ctx => !Me.IsSafelyFacing(attackTarget) || !IronShredder.IsSafelyFacing(attackTarget),
                                                                                      new ActionFail(ctx => attackTarget.Face())),

                                                                        // cast 'Death From Above' ability on targets outside of melee
                                                                        new Decorator(
                                                                            ctx =>
                                                                            IronShredder.Location.DistanceSquared(attackTarget.Location) > 10 * 10 && IronShredder.Location.DistanceSquared(attackTarget.Location) < 70 * 70 && DeathFromAboveTimer.IsFinished,
                                                                            new Sequence(
                                                                                new Action(ctx => Lua.DoString("CastPetAction(2)")),
                                                                                new WaitContinue(2, ctx => StyxWoW.Me.CurrentPendingCursorSpell != null, new ActionAlwaysSucceed()),
                                                                                new Action(ctx => SpellManager.ClickRemoteLocation(attackTarget.Location)),
                                                                                new Action(ctx => DeathFromAboveTimer.Reset()))),

                                                                        // cast 'Elecrostatic Distortion' ability on melee range target.
                                                                        new Decorator(
                                                                            ctx => IronShredder.Location.DistanceSquared(attackTarget.Location) <= 25 * 25,
                                                                            new PrioritySelector(
                                                                                new Decorator(
                                                                                    ctx => IronShredder.Location.DistanceSquared(attackTarget.Location) <= 25 * 25 && (Me.IsMoving || Me.CharmedUnit.IsMoving),
                                                                                    new ActionFail(ctx => WoWMovement.ClickToMove(Me.CharmedUnit.Location))),
                                                                                new Action(ctx => Lua.DoString("CastPetAction(1)")))),
                                                                        new Decorator(ctx => IronShredder.Location.DistanceSquared(attackTarget.Location) > 25 * 25,
                                                                                      new Action(ctx => Navigator.MoveTo(attackTarget.Location))))),
                                                      new Decorator(
                                                          ctx => attackTarget == null,
                                                          new PrioritySelector(
                                                              new Decorator(
                                                                  ctx => IronShredder.Location.DistanceSquared(_waitPoint) > 10 * 10,
                                                                  new PrioritySelector(
                                                                      new Action(ctx => Navigator.MoveTo(_waitPoint)))),
                                                              new ActionSetActivity("No viable targets, waiting."))),
                                                      new ActionAlwaysSucceed())));
        }
        /// <summary>
        /// Function to Find and Kill Dormus
        /// </summary>
        public void findAndKillDormus()
        {
            bool CastSuccess = false;
            //Testcases --> 51756 = Blutelfenjunge --> 52008 = Resortangestellter --> 50245 = Dormus
            int IDDormus = 50245;
            //Testcases --> 6346 = Fear Ward --> 974 = Earthsschild --> Dormus' Rage = 93269
            int IDDormusAura = 93269;

            ObjectManager.Update();
            WoWUnit Dormus = ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.Entry == IDDormus).OrderBy(u => u.Distance).FirstOrDefault();

            #region Move to Dormus Helperpoint
            while (Me.HasAura(IDDormusAura) && Dormus == null && !Me.Combat && Me.Location.Distance(DormusPoint) > 5 && Me.Location.Distance(DormusPoint) < 500)
            {
                WoWMovement.ClickToMove(DormusPoint);
                Logging.Write(Colors.MediumPurple, "Rarekiller: Dormus not in sight, Swim to Dormus Helper Point");
                Thread.Sleep(500);

                ObjectManager.Update();
                Dormus = ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.Entry == IDDormus).OrderBy(u => u.Distance).FirstOrDefault();
            }
            #endregion

            if (Dormus != null)
            {
                if (!Dormus.IsDead)
                {
                    Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find {0}", Dormus.Name);

                    if (Rarekiller.Settings.Alert)
                    {
                        Rarekiller.Alert();
                    }

                    Dormus.Target();

                    #region Move to Dormus
                    // ------------- Move to Dormus with Klick to Move -------------------

                    while (DormusPoint.Distance(Me.Location) > 5 && Me.HasAura(IDDormusAura) && !Dormus.IsDead && !Rarekiller.Settings.ReachedDormusHelperpoint)
                    {
                        WoWMovement.ClickToMove(DormusPoint);
                        Thread.Sleep(100);
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Move out of Water to Helperpoint");
                        if (Rarekiller.ToonInvalidCombat)
                        {
                            return;
                        }
                    }
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Reached Dormus Helperpoint");
                    Rarekiller.Settings.ReachedDormusHelperpoint = true;

                    while (Dormus.Location.Distance(Me.Location) > 3 && Me.HasAura(IDDormusAura) && !Dormus.IsDead)
                    {
                        if (Navigator.CanNavigateFully(Me.Location, Dormus.Location))
                        {
                            Navigator.MoveTo(Dormus.Location);
                        }
                        else
                        {
                            Logging.Write(Colors.MediumPurple, "Rarekiller: Navigation Issue, use Click to Move");
                            WoWMovement.ClickToMove(Dormus.Location);
                        }
                        Thread.Sleep(100);
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Dormus");
                        if (Rarekiller.ToonInvalidCombat)
                        {
                            return;
                        }
                    }
                    WoWMovement.MoveStop();
                    #endregion

                    #region Pull Dormus
                    // ------------- pull Dormus  -------------------
                    Logging.Write(Colors.MediumPurple, "Rarekiller: Distance: {0}", Dormus.Location.Distance(Me.Location));
                    Dormus.Target();
                    Dormus.Face();
                    Thread.Sleep(100);


                    if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, Dormus, false);
                    }
                    //CastSuccess = SpellManager.Cast(Rarekiller.Settings.Pull, Dormus);
                    else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell))
                    {
                        CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, Dormus, false);
                    }
                    //CastSuccess = SpellManager.Cast(Rarekiller.Spells.FastPullspell, Dormus);
                    else
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: I have no Pullspell");
                    }
                    if (!CastSuccess && SpellManager.HasSpell("Shoot"))
                    {
                        CastSuccess = RarekillerSpells.CastSafe("Shoot", Dormus, true);
                    }
                    //CastSuccess = SpellManager.Cast("Shoot", Dormus);
                    if (CastSuccess)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: successfully pulled Dormus");
                        Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Pull Distance: {0}", Dormus.Location.Distance(Me.Location));
                        return;
                    }
                    else if (!CastSuccess && Me.Combat)
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: got Aggro");
                    }
                    else
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Pull Fails --> next try");
                    }
                    #endregion
                }
                else if (!Blacklist.Contains(Dormus.Guid, Rarekiller.Settings.Flags))
                {
                    if (Dormus.CanLoot)
                    {
                        if (!Rarekiller.Loothelper(Dormus))
                        {
                            return;
                        }
                    }

                    if (!Blacklist.Contains(Dormus.Guid, Rarekiller.Settings.Flags))
                    {
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but sadly he's dead", Dormus.Name);
                        Blacklist.Add(Dormus.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60));
                        Logging.Write(Colors.MediumPurple, "Rarekiller: Blacklist Unit for 60 Minutes.");
                    }
                }
            }
        }
        public override void Pulse()
        {
            #region pulsechecks
            if (!TreeRoot.IsRunning)
            {
                return;
            }
            if (Me.Combat && !Me.GotTarget)
            {
                GetClosestLiveUnitByID(24978).Target();
            }
            if (Me.Combat || Me.Dead || Me.IsGhost || Me.IsResting)
            {
                return;
            }
            #endregion
            QuestlistUpdate();
            //Logging.WriteDebug(TreeRoot.GoalText);
            if (TreeRoot.GoalText == "Goal: Kill Sunwell - Quest Bunny - Poratl x 1")
            {
                TreeRoot.GoalText = "DHX Goal: Take Poratl Reading";
            }
            if (TreeRoot.GoalText == "Goal: Kill Sunwell - Quest Bunny - Sunwell x 1")
            {
                TreeRoot.GoalText = "DHX Goal: Take BloodCrystal Reading";
            }
            if (TreeRoot.GoalText == "Goal: Kill Sunwell - Quest Bunny - Shrine x 1")
            {
                TreeRoot.GoalText = "DHX Goal: Take Shrine Reading";
            }
            if (TreeRoot.GoalText == "Goal: Kill mob with ID 25086 10 times")
            {
                TreeRoot.GoalText = "DHX Goal: Free 10 Greengill Slaves";
            }
            #region looting fix
            List <WoWUnit> LootMobList = ObjectManager.GetObjectsOfType <WoWUnit>();
            if (!StyxWoW.Me.Combat)
            {
                foreach (WoWUnit unit in LootMobList)
                {
                    if (!unit.IsAlive && unit.CanLoot)
                    {
                        while (StyxWoW.Me.Location.Distance(unit.Location) > 4 || unit.CanLoot)
                        {
                            try
                            {
                                WoWMovement.ClickToMove(unit.Location);
                            }
                            catch { }
                            if (StyxWoW.Me.Location.Distance(unit.Location) <= 4)
                            {
                                try
                                {
                                    if (unit.CanLoot)
                                    {
                                        unit.Interact();
                                        Styx.Logic.Inventory.Frames.LootFrame.LootFrame.Instance.LootAll();
                                        LootMobList.Remove(unit);
                                    }
                                    else if (unit.CanLoot)
                                    {
                                        while (unit.CanLoot)
                                        {
                                            unit.Interact();
                                            Styx.Logic.Inventory.Frames.LootFrame.LootFrame.Instance.LootAll();
                                        }
                                        LootMobList.Remove(unit);
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            if (!StyxWoW.Me.GotTarget && !StyxWoW.Me.Combat && Styx.Logic.LootTargeting.Instance.LootingList.Count == 0)
            {
                LootMobList.Clear();
            }
            #endregion
            #region bloodberry bush loot reliability
            WoWObject bloddberrybush = GetClosestObjectByID(187333);
            if (bloddberrybush != null)
            {
                if (bloddberrybush.Distance < 5 && !Me.Combat)
                {
                    bloddberrybush.Interact();
                }
            }
            #endregion
            #region emissary of hate
            if (InvChkByID(34414))
            {
                if (Me.CanLoot || Me.Looting)
                {
                    return;
                }
                WoWUnit emissary = GetUnitByID(25003);
                if (emissary != null)
                {
                    if (emissary.Dead && emissary.Distance < 10)
                    {
                        useItemByID(34414);
                    }
                }
            }
            #endregion
            #region dont stop now
            ObjectManager.Update();
            while (KeyChkByID(34477) && InvTotalByID(34479) < 3 && IsQuestCompleted(11547))
            {
                Logging.WriteDebug("found key");
                WoWObject orechest = GetClosestObjectByID(187264);
                if (orechest != null)
                {
                    Logging.WriteDebug("found chest");
                    while (orechest.Distance > 3)
                    {
                        if (Me.Combat || Me.Dead || Me.IsGhost)
                        {
                            return;
                        }
                        Navigator.MoveTo(orechest.Location);
                        if (orechest.Distance < 5)
                        {
                            Navigator.Clear(); WoWMovement.MoveStop();
                            orechest.Interact();
                            Thread.Sleep(3000);
                        }
                        ObjectManager.Update();
                        return;
                    }
                }
            }
            while (!IsQuestCompleted(11536) && TreeRoot.GoalText == "Goal: Collect Darkspine Iron Ore x 3" && !KeyChkByID(34477))
            {
                if (Me.Combat || Me.Dead || Me.IsGhost)
                {
                    return;
                }
                WoWUnit oretarget = GetClosestLiveUnitByID(25060);
                oretarget.Target();
                oretarget.Face();
                Me.ToggleAttack();
                if (oretarget.Distance > 5)
                {
                    Navigator.MoveTo(oretarget.Location);
                }
            }
            #endregion
            #region pay 10 gold
            if (SSQuestIDList.Contains(11548))
            {
                Lua.DoString("StaticPopup1Button1:Click()");
            }
            #endregion

            #region greengill
            if (Me.CanLoot || Me.Looting)
            {
                return;
            }
            if (InvChkByID(34483))
            {
                WoWUnit greengilltarget = GetClosestUnitByID(25084);
                if (greengilltarget != null)
                {
                    if (greengilltarget.Distance < 36)
                    {
                        useItemByID(34483);
                        Styx.Logic.Combat.SpellManager.ClickRemoteLocation(greengilltarget.Location);
                        Thread.Sleep(4000);
                    }
                }
            }
            #endregion
            if (InvTotalByID(34338) >= 4)
            {
                arms1 = true;
            }
            #region turnin Arm the Wards
            if ((TreeRoot.GoalText == "Goal: Collect Mana Remnants x 4" || TreeRoot.GoalText == "Goal: TurnIn Arm the Wards!") && IsQuestCompleted(11523) && SSQuestIDList.Contains(11523) && !SSCompQuests.Contains(11523))
            {
                bool     handindone = false;
                WoWPoint armsgoto   = new WoWPoint(12892.95, -6880.174, 9.040649);
                while (armsgoto.Distance(Me.Location) > 0 || !handindone)
                {
                    if (TreeRoot.GoalText != "Goal: TurnIn Arm the Wards!")
                    {
                        TreeRoot.GoalText = "Goal: TurnIn Arm the Wards!";
                    }
                    Navigator.MoveTo(armsgoto);
                    while (armsgoto.Distance(Me.Location) < 3 && !handindone)
                    {
                        Navigator.Clear();
                        WoWMovement.MoveStop();
                        GetUnitByID(24967).Interact();
                        Thread.Sleep(2000);
                        Lua.DoString("GossipTitleButton1:Click()");
                        Thread.Sleep(2000);
                        QuestBot.QuestHelper.QuestFrame.CompleteQuest();
                        handindone = true;
                        return;
                    }
                }
            }
            #endregion
            #region ES
            if (SSQuestIDList.Contains(11525) && InvChkByID(34368) && !IsQuestCompleted(11525) && (!Me.CanLoot || !Me.Looting))
            {
                ObjectManager.Update();
                if (Me.Dead || Me.Combat || Me.IsGhost || Me.CanLoot || Me.Looting || Me.IsResting)
                {
                    return;
                }
                if (!IsQuestCompleted(11525))
                {
                    if (Me.Dead || Me.Combat || Me.IsGhost || Me.CanLoot || Me.Looting || Me.IsResting)
                    {
                        return;
                    }
                    WoWUnit ClosestUnit = GetClosestUnitByID(24972);
                    if (ClosestUnit == null)
                    {
                        return;
                    }
                    if (ClosestUnit.KilledByMe)
                    {
                        while (ClosestUnit.Distance > 5)
                        {
                            if (Me.Dead || Me.Combat || Me.IsGhost || Me.CanLoot || Me.Looting || Me.IsResting)
                            {
                                Navigator.Clear(); WoWMovement.MoveStop();
                                return;
                            }
                            Navigator.MoveTo(ClosestUnit.Location);
                        }
                        TargetByGUID(ClosestUnit.Guid);
                        Navigator.Clear(); WoWMovement.MoveStop();
                        useItemByID(34368);
                        Thread.Sleep(3000);
                        return;
                    }
                    if (ClosestUnit.Entry == 24972 && !ClosestUnit.TaggedByOther && !ClosestUnit.TaggedByMe && !ClosestUnit.Dead && !IsQuestCompleted(11525))
                    {
                        Logging.Write("found 1 alive");
                        if (ClosestUnit.Distance < 30)
                        {
                            ClosestUnit.Target();
                            Me.ToggleAttack();
                            while (!Me.Combat && ClosestUnit.Distance < 50)
                            {
                                if (Me.Dead || Me.Combat || Me.IsGhost || Me.CanLoot || Me.Looting || Me.IsResting)
                                {
                                    Navigator.Clear(); WoWMovement.MoveStop();
                                    return;
                                }
                                Navigator.MoveTo(ClosestUnit.Location);
                                Me.ToggleAttack();
                            }
                        }
                        return;
                    }
                }
            }
            #endregion
            while (arms1 && !IsQuestCompleted(11523) && IsQuestCompleted(11525))
            {
                if (Me.Dead || Me.Combat || Me.IsGhost || Me.CanLoot || Me.Looting || Me.IsResting)
                {
                    return;
                }
                WoWPoint armsgoto = new WoWPoint(12913.55, -6932.246, 3.872839);
                while (armsgoto.Distance(Me.Location) > 0)
                {
                    if (Me.Dead || Me.Combat || Me.IsGhost || Me.CanLoot || Me.Looting || Me.IsResting)
                    {
                        return;
                    }
                    Navigator.MoveTo(armsgoto);
                    if (armsgoto.Distance(Me.Location) < 5)
                    {
                        useItemByID(34338);
                        Thread.Sleep(5000);
                        return;
                    }
                }
                return;
            }
            #region Know your ley lines
            if (InvChkByID(34533))
            {
                WoWObject ley1 = GetClosestObjectByID(25156);
                WoWObject ley2 = GetClosestObjectByID(25157);
                WoWObject ley3 = GetClosestObjectByID(25154);
                if (ley1 != null && !ley1done && ley1.Distance2D < 5)
                {
                    Logging.WriteDebug("ley 1");
                    Thread.Sleep(2000);
                    Navigator.Clear(); WoWMovement.MoveStop();
                    useItemByID(34533);
                    Thread.Sleep(6000);
                    ley1done = true;

//<Hotspot X="12575.54" Y="-6915.316" Z="4.602137" />
                }
                if (ley2 != null && !ley2done && ley2.Distance2D < 5)
                {
                    Logging.WriteDebug("ley 2");
                    Thread.Sleep(2000);
                    Navigator.Clear(); WoWMovement.MoveStop();
                    useItemByID(34533);
                    Thread.Sleep(6000);
                    ley2done = true;
                }
                //<Hotspot X="12771.83" Y="-6705.073" Z="2.288224" />
                if (ley3 != null && !ley3done && ley3.Distance2D < 5)
                {
                    Logging.WriteDebug("ley 2");
                    Thread.Sleep(2000);
                    Navigator.Clear(); WoWMovement.MoveStop();
                    useItemByID(34533);
                    Thread.Sleep(6000);
                    ley3done = true;
                }
            }
            #endregion
        }
Ejemplo n.º 29
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(
                                     new Action(c =>
            {
                if (Me.HealthPercent < 2)
                {
                    return RunStatus.Failure;
                }
                if (Me.HealthPercent < 60 && !Me.IsActuallyInCombat)
                {
                    WoWItem food = Consumable.GetBestFood(true);
                    CharacterSettings.Instance.FoodName = food != null ? food.Name : string.Empty;
                    Rest.Feed();
                    return RunStatus.Running;
                }
                if (IsInVehicle)
                {
                    _isBehaviorDone = true;
                    return RunStatus.Success;
                }
                WoWUnit Horse = ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.Entry == 28782).OrderBy(u => u.Distance).FirstOrDefault();
                if (Horse != null)
                {
                    if (!Me.IsActuallyInCombat)
                    {
                        if (Horse.Distance > 4)
                        {
                            Navigator.MoveTo(Horse.Location);
                        }
                        else
                        {
                            Horse.Interact();
                        }
                    }
                    if (Me.IsActuallyInCombat)
                    {
                        if (Me.CurrentTarget != null)
                        {
                            if (Me.CurrentTarget.Dead)
                            {
                                Me.ClearTarget();
                            }
                            else if (Me.CurrentTarget.Entry == 28768)
                            {
                                if (!Me.IsSafelyFacing(Horse))
                                {
                                    Horse.Face();
                                }
                            }
                            else if (!Me.IsSafelyFacing(Me.CurrentTarget))
                            {
                                Me.CurrentTarget.Face();
                            }
                            if (Me.IsMoving)
                            {
                                WoWMovement.MoveStop();
                            }
                            if (!Me.IsSafelyFacing(Me.CurrentTarget))
                            {
                                Me.CurrentTarget.Face();
                            }
                            if (SpellManager.CanCast("Icy Touch"))
                            {
                                SpellManager.Cast("Icy Touch");
                            }
                            if (SpellManager.CanCast("Plague Strike"))
                            {
                                SpellManager.Cast("Plague Strike");
                            }
                            if (SpellManager.CanCast("Blood Strike"))
                            {
                                SpellManager.Cast("Blood Strike");
                            }
                            if (SpellManager.CanCast("Death Coil"))
                            {
                                SpellManager.Cast("Death Coil");
                            }
                        }
                    }
                }
                else
                {
                    Navigator.MoveTo(Location);
                }

                return RunStatus.Running;
            }

                                                ))));
        }
        public Composite CreateBehavior_KillGnomereganStealthFighter()
        {
            WoWUnit   attackTarget           = null;
            WoWUnit   PrideofKezan           = null;
            WaitTimer WildWeaselRocketsTimer = WaitTimer.FiveSeconds;

            return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle() && (PrideofKezan = Me.CharmedUnit) != null,
                                 new PrioritySelector(ctx => attackTarget = GetAttackTarget(),
                                                      new Decorator(ctx => attackTarget != null,
                                                                    new PrioritySelector(
                                                                        new ActionSetActivity("Moving to Attack"),
                                                                        new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid,
                                                                                      new ActionFail(ctx => attackTarget.Target())),
                                                                        new Decorator(ctx => !Me.IsSafelyFacing(attackTarget) || !PrideofKezan.IsSafelyFacing(attackTarget),
                                                                                      new ActionFail(ctx => attackTarget.Face())),

                                                                        // cast 'Wild Weasel Rockets' ability
                                                                        new Decorator(
                                                                            ctx => PrideofKezan.Location.DistanceSqr(attackTarget.Location) < 25 * 25 && WildWeaselRocketsTimer.IsFinished,
                                                                            new Sequence(
                                                                                new Action(ctx => Lua.DoString("CastPetAction(2)")),
                                                                                new Action(ctx => WildWeaselRocketsTimer.Reset()))),

                                                                        // cast 'Machine Gun' ability
                                                                        new Decorator(
                                                                            ctx => PrideofKezan.Location.DistanceSqr(attackTarget.Location) <= 25 * 25,
                                                                            new Sequence(
                                                                                new Action(ctx => Lua.DoString("CastPetAction(1)")))),

                                                                        new Decorator(ctx => PrideofKezan.Location.DistanceSqr(attackTarget.Location) > 25 * 25,
                                                                                      new Action(ctx => WoWMovement.ClickToMove(attackTarget.Location))))),
                                                      new Decorator(
                                                          ctx => attackTarget == null,
                                                          new PrioritySelector(
                                                              new Decorator(
                                                                  ctx => PrideofKezan.Location.DistanceSqr(_waitPoint) > 10 * 10,
                                                                  new Sequence(
                                                                      new Action(ctx => WoWMovement.ClickToMove(_waitPoint)))),
                                                              new ActionSetActivity("No viable targets, waiting."))),
                                                      new ActionAlwaysSucceed())));
        }
Ejemplo n.º 31
0
        // ------------ Spell Functions
        public static bool CastSafe(string spellName, WoWUnit Unit, bool wait)
        {
            bool SpellSuccess = false;
            if (Me.IsCasting)
            {
                Logging.Write("Rarekiller Part Spells: I was already Casting");
                return false;
            }
            if (!SpellManager.HasSpell(spellName))
            {
                Logging.Write("Rarekiller Part Spells: I don't have Spell {0}", spellName);
                return false;
            }

            if (SpellManager.HasSpell(spellName) && !Me.IsCasting)
            {
                if (SpellManager.Spells[spellName].CastTime > 1)
                    WoWMovement.MoveStop();
                Unit.Target();
                Thread.Sleep(100);
                Unit.Face();
                Thread.Sleep(150);

                while (SpellManager.GlobalCooldown)
                {
                    Thread.Sleep(10);
                }

                if (!SpellManager.CanCast(spellName))
                {
                    Logging.Write("Rarekiller Part Spells: cannot cast spell '{0}' yet - cd={1}, gcd={2}, casting={3} ",
                        SpellManager.Spells[spellName].Name,
                        SpellManager.Spells[spellName].Cooldown,
                        SpellManager.GlobalCooldown,
                        Me.IsCasting
                        );
                    return false;
                }

                SpellSuccess = SpellManager.Cast(spellName);

                Thread.Sleep(200);

                //if (SpellManager.GlobalCooldown || Me.IsCasting)
                //	SpellSuccess = true;
                if (SpellSuccess)
                    Logging.Write("Rarekiller Part Spells: * {0}.", spellName);
                if (wait)
                {
                    while (SpellManager.GlobalCooldown || Me.IsCasting)
                    {
                        Thread.Sleep(100);
                    }
                }

                Logging.Write("Rarekiller Part Spells: Spell successfull? {0}.", SpellSuccess);
                return SpellSuccess;
            }

            Logging.Write("Rarekiller Part Spells: Can't cast {0}.", spellName);
            return false;
        }
Ejemplo n.º 32
0
        /// <summary>
        /// this behavior will move the bot StrafeRight/StrafeLeft only if enemy is casting and we needed to move!
        /// Credits to BarryDurex.
        /// </summary>
        /// <param name="EnemyAttackRadius">EnemyAttackRadius or 0 for move Behind</param>
        public static void AvoidEnemyCast(WoWUnit Unit, float EnemyAttackRadius, float SaveDistance)
        {
            if (!StyxWoW.Me.IsFacing(Unit)) { Unit.Face(); Thread.Sleep(300); }

            float BehemothRotation = getPositive(Unit.RotationDegrees);
            float invertEnemyRotation = getInvert(BehemothRotation);

            WoWMovement.MovementDirection move = WoWMovement.MovementDirection.None;

            if (getPositive(StyxWoW.Me.RotationDegrees) > invertEnemyRotation) { move = WoWMovement.MovementDirection.StrafeRight; } else { move = WoWMovement.MovementDirection.StrafeLeft; }

            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();
            }
            WoWMovement.MoveStop();
        }
        public Composite CreateBehavior_KillMantid()
        {
            WoWUnit   attackTarget   = null;
            WoWUnit   yeti           = null;
            WaitTimer leapSmashTimer = WaitTimer.TenSeconds;

            return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle() && (yeti = Me.CharmedUnit) != null,
                                 new PrioritySelector(ctx => attackTarget = GetAttackTarget(),
                                                      new Decorator(ctx => attackTarget != null,
                                                                    new PrioritySelector(
                                                                        new ActionFail(ctx => _stuckTimer.Reset()),
                                                                        new ActionSetActivity("Moving to Attack"),
                                                                        new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid,
                                                                                      new ActionFail(ctx => attackTarget.Target())),
                                                                        new Decorator(ctx => !Me.IsSafelyFacing(attackTarget) || !yeti.IsSafelyFacing(attackTarget),
                                                                                      new ActionFail(ctx => attackTarget.Face())),
                                                                        // cast 'Hozen Snack' ability to heal up.
                                                                        new Decorator(ctx => yeti.HealthPercent <= 70,
                                                                                      new ActionFail(ctx => Lua.DoString("CastPetAction(4)"))),
                                                                        // cast 'Leap Smash' ability on targets outside of melee
                                                                        new Decorator(
                                                                            ctx =>
                                                                            yeti.Location.DistanceSqr(attackTarget.Location) > 30 * 30 && yeti.Location.DistanceSqr(attackTarget.Location) < 90 * 90 && leapSmashTimer.IsFinished,
                                                                            new Sequence(
                                                                                new Action(ctx => Lua.DoString("CastPetAction(1)")),
                                                                                new WaitContinue(2, ctx => StyxWoW.Me.CurrentPendingCursorSpell != null, new ActionAlwaysSucceed()),
                                                                                new Action(ctx => SpellManager.ClickRemoteLocation(attackTarget.Location)),
                                                                                new Action(ctx => leapSmashTimer.Reset()))),
                                                                        // cast 'Headbutt' ability on melee range target.
                                                                        new Decorator(
                                                                            ctx => yeti.Location.DistanceSqr(attackTarget.Location) <= 25 * 25,
                                                                            new PrioritySelector(
                                                                                new Decorator(
                                                                                    ctx => yeti.Location.DistanceSqr(attackTarget.Location) <= 25 * 25 && (Me.IsMoving || Me.CharmedUnit.IsMoving),
                                                                                    new ActionFail(ctx => WoWMovement.ClickToMove(Me.CharmedUnit.Location))),
                                                                                new Action(ctx => Lua.DoString("CastPetAction(2)")))),
                                                                        new Decorator(ctx => yeti.Location.DistanceSqr(attackTarget.Location) > 25 * 25,
                                                                                      new Action(ctx => Navigator.MoveTo(attackTarget.Location))))),
                                                      new Decorator(
                                                          ctx => attackTarget == null,
                                                          new PrioritySelector(
                                                              new Decorator(
                                                                  ctx => yeti.Location.DistanceSqr(_waitPoint) > 10 * 10,
                                                                  new PrioritySelector(
                                                                      // can't set path precision so I'll just handle it directly...
                                                                      // the yeti takes wide turns so needs a higher path precision than normal
                                                                      new Decorator(
                                                                          ctx =>
            {
                var nav = Navigator.NavigationProvider as MeshNavigator;
                if (nav == null)
                {
                    return false;
                }
                if (nav.CurrentMovePath == null || nav.CurrentMovePath.Index >= nav.CurrentMovePath.Path.Points.Length)
                {
                    return false;
                }
                WoWPoint point = nav.CurrentMovePath.Path.Points[nav.CurrentMovePath.Index];
                return point.DistanceSqr(yeti.Location) < 6 * 6;
            },
                                                                          new Action(ctx => ((MeshNavigator)Navigator.NavigationProvider).CurrentMovePath.Index++)),

                                                                      CreateBehavior_Antistuck(),

                                                                      new Action(ctx => Navigator.MoveTo(_waitPoint)))),
                                                              new ActionSetActivity("No viable targets, waiting."))),
                                                      new ActionAlwaysSucceed())));
        }
Ejemplo n.º 34
0
        public Composite CreateBehavior_KillGnome()
        {
            WoWUnit attackTarget = null;

            return(new Decorator(r => !Me.IsQuestComplete(QuestId) && Query.IsInVehicle(),
                                 new PrioritySelector(ctx => attackTarget = GetAttackTarget(),
                                                      new Decorator(ctx => attackTarget != null,
                                                                    new PrioritySelector(
                                                                        new ActionFail(ctx => _stuckTimer.Reset()),
                                                                        new ActionSetActivity("Moving to Attack"),
                                                                        new Decorator(ctx => Me.CurrentTargetGuid != attackTarget.Guid,
                                                                                      new ActionFail(ctx => attackTarget.Target())),
                                                                        new Decorator(ctx => !WoWMovement.ActiveMover.IsSafelyFacing(attackTarget, 30),
                                                                                      new ActionFail(ctx => attackTarget.Face())),

                                                                        // cast 'Incinerate' ability on melee range target.
                                                                        new Decorator(
                                                                            ctx => Me.Location.DistanceSqr(attackTarget.Location) <= 15 * 15,
                                                                            new PrioritySelector(
                                                                                new Decorator(
                                                                                    ctx => Me.Location.DistanceSqr(attackTarget.Location) <= 15 * 15 && (Me.IsMoving || Me.CharmedUnit.IsMoving),
                                                                                    new ActionFail(ctx => WoWMovement.ClickToMove(Me.CharmedUnit.Location))),
                                                                                new Action(ctx => Lua.DoString("CastPetAction(1)")))),
                                                                        new Decorator(ctx => Me.Location.DistanceSqr(attackTarget.Location) > 15 * 15,
                                                                                      new Action(ctx => Navigator.MoveTo(attackTarget.Location))))),
                                                      new Decorator(
                                                          ctx => attackTarget == null,
                                                          new PrioritySelector(
                                                              new Decorator(
                                                                  ctx => Me.Location.DistanceSqr(_waitPoint) > 10 * 10,
                                                                  new PrioritySelector(
                                                                      // can't set path precision so I'll just handle it directly...
                                                                      // the IronShredder takes wide turns so needs a higher path precision than normal
                                                                      new Decorator(
                                                                          ctx =>
            {
                var nav = Navigator.NavigationProvider as MeshNavigator;
                if (nav == null)
                {
                    return false;
                }
                if (nav.CurrentMovePath == null || nav.CurrentMovePath.Index >= nav.CurrentMovePath.Path.Points.Length)
                {
                    return false;
                }
                WoWPoint point = nav.CurrentMovePath.Path.Points[nav.CurrentMovePath.Index];
                return point.DistanceSqr(Me.Location) < 6 * 6;
            },
                                                                          new Action(ctx => ((MeshNavigator)Navigator.NavigationProvider).CurrentMovePath.Index++)),

                                                                      CreateBehavior_Antistuck(),

                                                                      new Action(ctx => Navigator.MoveTo(_waitPoint)))),
                                                              new ActionSetActivity("No viable targets, waiting."))),
                                                      new ActionAlwaysSucceed())));
        }