// The HB API always returns 0 for our facing when we're in a vehicle.
 // To get the actualy value, we must ask the WoWclient directly.
 private float GetVehicleFacing()
 {
     return
         (Query.IsInVehicle()
         ? WoWMathHelper.NormalizeRadian(Lua.GetReturnVal <float>("return GetPlayerFacing();", 0))
         : Me.RenderFacing);
 }
示例#2
0
        public WoWPoint GetFrontPoint(float distance = 5f)
        {
            float facing = RefWoWObject.Rotation;

            facing = WoWMathHelper.NormalizeRadian(facing);
            return(Location.RayCast(facing, distance));
        }
示例#3
0
        private void FaceAway()
        {
            float rotation = Me.RotationDegrees + 180;

            Me.SetFacing(WoWMathHelper.DegreesToRadians(rotation));
            Log("Facing Away");
        }
示例#4
0
        List <WoWPoint> CreatePathSegment(WoWPoint from, WoWPoint to)
        {
            List <WoWPoint> segment    = new List <WoWPoint>();
            WoWPoint        point      = from;
            float           step       = 50;
            float           noMeshStep = 5;

            for (float i = from.Distance(to) - step; i > 0;)
            {
                point = WoWMathHelper.CalculatePointFrom(from, to, i);
                try
                {
                    float z = Navigator.FindHeights(point.X, point.Y).Max();
                    i -= step;
                    if (Gui.smoothCheck.Checked && z > point.Z)
                    {
                        point.Z = z;
                    }
                    segment.Add(point);
                }
                catch { i -= noMeshStep; }
            }
            segment.Add(to);
            return(segment);
        }
示例#5
0
        public WoWPoint GetSidePoint(float degrees, float distance = 5f)
        {
            float facing = WoWMathHelper.DegreesToRadians(degrees);

            facing = WoWMathHelper.NormalizeRadian(facing);
            return(Location.RayCast(facing, distance));
        }
示例#6
0
 public Composite CreateFeralCatPull()
 {
     return(new PrioritySelector(
                // Make sure we're in cat form first, period.
                new Decorator(
                    ret => Me.Shapeshift != WantedDruidForm,
                    CreateSpellCast("Cat Form")),
                CreateEnsureTarget(),
                CreateSpellBuffOnSelf("Dash", ret => Me.IsMoving && Me.HasAura("Prowl")),
                CreateSpellBuffOnSelf("Prowl"),
                new PrioritySelector(
                    ret => WoWMathHelper.CalculatePointBehind(Me.CurrentTarget.Location, Me.CurrentTarget.Rotation, 1f),
                    new Decorator(
                        ret => ((WoWPoint)ret).Distance2D(Me.Location) > 3f && Navigator.CanNavigateFully(Me.Location, ((WoWPoint)ret)),
                        new Action(ret => Navigator.MoveTo(((WoWPoint)ret)))),
                    CreateMoveToAndFace()),
                new Decorator(
                    ret => Me.HasAura("Prowl"),
                    new PrioritySelector(
                        CreateSpellCast("Pounce"),
                        CreateSpellCast("Ravage", ret => Me.CurrentTarget.MeIsSafelyBehind))),
                CreateSpellCast("Mangle (Cat)"),
                CreateAutoAttack(true)
                ));
 }
示例#7
0
        private bool IsWithinArticulationLimits(WoWUnit vehicle, WoWUnit potentialTarget)
        {
            if ((vehicle == null) || !vehicle.IsValid)
            {
                return(false);
            }

            if ((potentialTarget == null) || !potentialTarget.IsValid)
            {
                return(false);
            }

            double neededAzimuth = Math.Atan((potentialTarget.Location.Z - vehicle.Location.Z)
                                             / vehicle.Location.Distance2D(potentialTarget.Location));
            double neededFacing = WoWMathHelper.CalculateNeededFacing(vehicle.Location, potentialTarget.Location);

            neededFacing = WoWMathHelper.NormalizeRadian((float)neededFacing);

            if ((neededFacing < CannonArticulation_HeadingMin) || (neededFacing > CannonArticulation_HeadingMax))
            {
                return(false);
            }

            if ((neededAzimuth < CannonArticulation_AzimuthMin) || (neededAzimuth > CannonArticulation_AzimuthMax))
            {
                return(false);
            }

            return(true);
        }
        public static WoWPoint PointFromTarget(float distanceFromTarget)
        {
            // Let HB do the math and find a WoWPoint X yards away from the target
            WoWPoint pointFromTarget = WoWMathHelper.CalculatePointFrom(Me.Location, Me.CurrentTarget.Location, distanceFromTarget);

            return(pointFromTarget);
        }
示例#9
0
        public static async Task FaceAwayFromTarget()
        {
            //Core.SafeArea sa = new Core.SafeArea();
            //sa.MinScanDistance = 25;
            //sa.MaxScanDistance = sa.MinScanDistance;
            //sa.RaysToCheck = 36;
            //sa.LineOfSightMob = CurrentTarget;
            //sa.CheckLineOfSightToSafeLocation = true;
            //sa.CheckSpellLineOfSightToMob = false;
            //sa.DirectPathOnly = true;

            //safeSpot = sa.FindLocation();
            //if (safeSpot != Vector3.Zero)
            //{
            //    origSpot = new Vector3(Me.Location.X, Me.Location.Y, Me.Location.Z);
            //    needFacing = Styx.Helpers.WoWMathHelper.CalculateNeededFacing(safeSpot, origSpot);
            //    needFacing = WoWMathHelper.NormalizeRadian(needFacing);
            //    float rotation = WoWMathHelper.NormalizeRadian(Math.Abs(needFacing - Me.RenderFacing));
            //}

            //Me.SetFacing(needFacing);
            //await Coroutine.Sleep(500);
            Me.SetFacing(WoWMathHelper.CalculatePointBehind(Me.Location, 36, 5f));
            await Coroutine.Yield();
        }
        public GoThruPortal(Dictionary <string, string> args)
            : base(args)
        {
            QBCLog.BehaviorLoggingContext = this;

            try
            {
                // NB: Core attributes are parsed by QuestBehaviorBase parent (e.g., QuestId, NonCompeteDistance, etc)

                // Behavior-specific attributes...
                MovePoint = GetAttributeAsNullable <Vector3>("", true, ConstrainAs.Vector3NonEmpty, null) ?? Vector3.Zero;

                // Tunables...
                StartingPoint = GetAttributeAsNullable <Vector3>("Initial", false, ConstrainAs.Vector3NonEmpty, null) ?? Me.Location;
                MaxRetryCount = GetAttributeAsNullable <int>("MaxRetryCount", false, new ConstrainTo.Domain <int>(1, 10), null) ?? 3;
                int retryDelay        = GetAttributeAsNullable <int>("RetryDelay", false, new ConstrainTo.Domain <int>(0, 300000), null) ?? 90000;
                int zoningMaxWaitTime = GetAttributeAsNullable <int>("Timeout", false, new ConstrainTo.Domain <int>(1, 60000), null) ?? 10000;

                MovePoint            = WoWMathHelper.CalculatePointFrom(StartingPoint, MovePoint, -15.0f);
                RetryDelay           = TimeSpan.FromMilliseconds(retryDelay);
                MaxTimeToPortalEntry = TimeSpan.FromMilliseconds(zoningMaxWaitTime);
            }

            catch (Exception except)
            {
                // Maintenance problems occur for a number of reasons.  The primary two are...
                // * Changes were made to the behavior, and boundary conditions weren't properly tested.
                // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes.
                // In any case, we pinpoint the source of the problem area here, and hopefully it
                // can be quickly resolved.
                QBCLog.Exception(except);
                IsAttributeProblem = true;
            }
        }
示例#11
0
        public static Composite CreateStayAwayFromFrozenTargetsBehavior()
        {
            return(new PrioritySelector(
                       ctx => Unit.NearbyUnfriendlyUnits.
                       Where(u => (u.HasAura("Frost Nova") || u.HasAura("Freeze")) &&
                             u.Distance < Spell.MeleeRange).
                       OrderBy(u => u.DistanceSqr).FirstOrDefault(),
                       new Decorator(
                           ret => ret != null && !SingularSettings.Instance.DisableAllMovement,
                           new PrioritySelector(
                               Spell.BuffSelf("Blink"),
                               new Action(ret =>
            {
                WoWPoint moveTo =
                    WoWMathHelper.CalculatePointBehind(
                        ((WoWUnit)ret).Location,
                        ((WoWUnit)ret).Rotation,
                        -(Spell.MeleeRange + 5f));

                if (Navigator.CanNavigateFully(StyxWoW.Me.Location, moveTo))
                {
                    Logger.Write("Getting away from frozen target");
                    Navigator.MoveTo(moveTo);
                    return RunStatus.Success;
                }

                return RunStatus.Failure;
            })))));
        }
        void MoveToBanker()
        {
            WoWPoint  movetoPoint = _loc;
            WoWObject bank        = GetLocalBanker();

            if (bank != null)
            {
                movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, bank.Location, 4);
            }
            // search the database
            else if (movetoPoint == WoWPoint.Zero)
            {
                movetoPoint = MoveToAction.GetLocationFromDB(Bank == BankType.Personal ?
                                                             MoveToAction.MoveToType.NearestBanker : MoveToAction.MoveToType.NearestGB, NpcEntry);
            }
            if (movetoPoint == WoWPoint.Zero)
            {
                IsDone = true;
                Professionbuddy.Err("Unable to find bank");
            }
            if (movetoPoint.Distance(ObjectManager.Me.Location) > 4)
            {
                Util.MoveTo(movetoPoint);
            }
            // since there are many personal bank replacement addons I can't just check if frame is open and be generic.. using events isn't reliable
            else if (bank != null)
            {
                bank.Interact();
            }
            else
            {
                IsDone = true;
                Logging.Write(System.Drawing.Color.Red, "Unable to find a banker at location. aborting");
            }
        }
示例#13
0
        public Composite MovementMoveBehind(UnitSelectionDelegate toUnit)
        {
            return
                (new Decorator(
                     ret =>
                     THSettings.Instance.AutoMove &&
                     DateTime.Now > DoNotMove &&
                     !Me.Mounted &&
                     !IsOverrideModeOn &&
                     !Me.IsCasting &&
                     //!Me.IsChanneling &&
                     toUnit != null &&
                     toUnit(ret) != null &&
                     toUnit(ret) != Me &&
                     toUnit(ret).IsAlive&&
                     //only MovementMoveBehind if IsWithinMeleeRange
                     GetDistance(toUnit(ret)) <= 5 &&
                     !Me.IsBehind(toUnit(ret)) &&
                     //!IsTank(Me) &&
                     //Only Move again After a certain delay or target move 3 yard from original posision
                     (toUnit(ret).IsPlayer ||
                      !toUnit(ret).IsPlayer&& toUnit(ret).CurrentTarget != Me && toUnit(ret).Combat),
                     new Action(ret =>
            {
                WoWPoint pointBehind =
                    toUnit(ret).Location.RayCast(
                        toUnit(ret).Rotation + WoWMathHelper.DegreesToRadians(150), 3f);

                Navigator.MoveTo(pointBehind);
                return RunStatus.Failure;
            })));
        }
示例#14
0
 protected override RunStatus Run(object context)
 {
     if (!IsDone)
     {
         if (TrainerFrame.Instance == null || !TrainerFrame.Instance.IsVisible || !ObjectManager.Me.GotTarget ||
             (ObjectManager.Me.GotTarget && ObjectManager.Me.CurrentTarget.Entry != NpcEntry))
         {
             WoWPoint movetoPoint = _loc;
             WoWUnit  unit        = ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == NpcEntry).
                                    OrderBy(o => o.Distance).FirstOrDefault();
             if (unit != null)
             {
                 movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, unit.Location, 3);
             }
             else if (movetoPoint == WoWPoint.Zero)
             {
                 movetoPoint = MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NpcByID, NpcEntry);
             }
             if (movetoPoint != WoWPoint.Zero && ObjectManager.Me.Location.Distance(movetoPoint) > 4.5)
             {
                 Util.MoveTo(movetoPoint);
             }
             else if (unit != null)
             {
                 if (Me.IsMoving)
                 {
                     WoWMovement.MoveStop();
                 }
                 unit.Target();
                 unit.Interact();
             }
             if (GossipFrame.Instance != null && GossipFrame.Instance.IsVisible &&
                 GossipFrame.Instance.GossipOptionEntries != null)
             {
                 foreach (GossipEntry ge in GossipFrame.Instance.GossipOptionEntries)
                 {
                     if (ge.Type == GossipEntry.GossipEntryType.Trainer)
                     {
                         GossipFrame.Instance.SelectGossipOption(ge.Index);
                         return(RunStatus.Success);
                     }
                 }
             }
             return(RunStatus.Success);
         }
         if (!_concludingStopWatch.IsRunning)
         {
             Lua.DoString("SetTrainerServiceTypeFilter('available', 1) BuyTrainerService(0) ");
             _concludingStopWatch.Start();
         }
         else if (_concludingStopWatch.ElapsedMilliseconds >= 3000)
         {
             _concludingStopWatch.Reset();
             Professionbuddy.Log("Training Completed ");
             IsDone = true;
         }
     }
     return(RunStatus.Failure);
 }
示例#15
0
 public void GotoPick()
 {
     safeMoveTo(WoWMathHelper.CalculatePointAtSide(getPick().Location, getPick().Rotation, PickRange - 2, MEBEHIND()));
     if (Me.Combat)
     {
         return;
     }
 }
示例#16
0
        /// <summary>
        /// Move to within X yards of the target
        /// </summary>
        /// <param name="distanceFromTarget">Distance to move to the target</param>
        public static void MoveTo(float distanceFromTarget)
        {
            // Let HB do the math and find a WoWPoint X yards away from the target
            WoWPoint moveToHere = WoWMathHelper.CalculatePointFrom(Me.Location, Me.CurrentTarget.Location, distanceFromTarget);

            // Use HB navigation to move to a WoWPoint. WoWPoint has been calculated in the above code
            Navigator.MoveTo(moveToHere);
        }
示例#17
0
        public WoWPoint GetBehindPoint(float distance = 5f)
        {
            float facing = RefWoWObject.Rotation;

            facing += WoWMathHelper.DegreesToRadians(180);
            facing  = WoWMathHelper.NormalizeRadian(facing);
            return(Location.RayCast(facing, distance));
        }
示例#18
0
        void backpedal()
        {
            var moveTo = WoWMathHelper.CalculatePointFrom(StyxWoW.Me.Location, StyxWoW.Me.CurrentTarget.Location, SafeMeleeRange + 10f);

            if (Navigator.CanNavigateFully(StyxWoW.Me.Location, moveTo))
            {
                Navigator.MoveTo(moveTo);
            }
        }
示例#19
0
        public static WoWPoint CalculatePointBehindTarget()
        {
            float facing = StyxWoW.Me.CurrentTarget.Rotation;

            facing += WoWMathHelper.DegreesToRadians(180); // was 150 ?
            facing  = WoWMathHelper.NormalizeRadian(facing);

            return(StyxWoW.Me.CurrentTarget.Location.RayCast(facing, Spell.MeleeRange - 2f));
        }
示例#20
0
 protected override RunStatus Run(object context)
 {
     if (!IsDone)
     {
         WoWObject obj = null;
         if (InteractType == InteractActionType.NPC)
         {
             if (Entry != 0)
             {
                 obj =
                     ObjectManager.GetObjectsOfType <WoWUnit>().Where(u => u.Entry == Entry).OrderBy(
                         u => u.Distance).FirstOrDefault();
             }
             else if (ObjectManager.Me.GotTarget)
             {
                 obj = ObjectManager.Me.CurrentTarget;
             }
         }
         else if (InteractType == InteractActionType.GameObject)
         {
             obj =
                 ObjectManager.GetObjectsOfType <WoWGameObject>().OrderBy(u => u.Distance).FirstOrDefault(
                     u => (Entry > 0 && u.Entry == Entry) || (u.SubType == GameObjectType &&
                                                              (GameObjectType != WoWGameObjectType.SpellFocus ||
                                                               (GameObjectType == WoWGameObjectType.SpellFocus &&
                                                                u.SpellFocus == SpellFocus))));
         }
         if (obj != null)
         {
             WoWPoint moveToLoc = WoWMathHelper.CalculatePointFrom(Me.Location, obj.Location, 3);
             if (moveToLoc.Distance(Me.Location) > 4)
             {
                 Util.MoveTo(moveToLoc);
             }
             else
             {
                 if (InteractDelay > 0 &&
                     (!_interactSw.IsRunning || _interactSw.ElapsedMilliseconds < InteractDelay))
                 {
                     _interactSw.Start();
                 }
                 else
                 {
                     _interactSw.Reset();
                     obj.Interact();
                     IsDone = true;
                 }
             }
         }
         if (!IsDone)
         {
             return(RunStatus.Success);
         }
         Professionbuddy.Log("InteractAction complete");
     }
     return(RunStatus.Failure);
 }
示例#21
0
 private bool Solomove()
 {
     if (unitcheck(Enemy) == 1 && Enemy.Distance > 5)
     {
         slog(Color.Black, "Solo: Moving to enemy");
         Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(ObjectManager.Me.Location, ObjectManager.Me.CurrentTarget.Location, 2.5f));
         return(true);
     }
     return(false);
 }
        private async Task <bool> Fight()
        {
            if (!Me.Combat)
            {
                return(false);
            }
            var currentTarget = Me.CurrentTarget;

            if (currentTarget == null)
            {
                return(false);
            }

            if (currentTarget.IsDead)
            {
                Me.ClearTarget();
                return(true);
            }

            // TODO: Find better side point. Rewrite to use mesh sampling instead.
            Vector3 sideLoc = WoWMathHelper.CalculatePointAtSide(currentTarget.Location, Me.CurrentTarget.Rotation, 20f, false);

            if (_cachedSideLoc == Vector3.Zero || Vector3.DistanceSquared(sideLoc, _cachedSideLoc) > 8 * 8)
            {
                _cachedSideLoc = sideLoc;
            }

            if (Navigator.MoveTo(_cachedSideLoc) == MoveResult.PathGenerationFailed)
            {
                _cachedSideLoc = Vector3.Zero;
            }

            if (!MyMount.ActiveAuras.ContainsKey("Defend") || (MyMount.ActiveAuras.ContainsKey("Defend") && MyMount.ActiveAuras["Defend"].StackCount < 3))
            {
                //Me.CurrentTarget.Face();
                UsePetSkill("Defend");
                UsePetSkill("Charge");
                await CommonCoroutines.SleepForRandomReactionTime();
            }
            else
            {
                if (currentTarget.Distance > 8)
                {
                    currentTarget.Face();
                }
                using (StyxWoW.Memory.AcquireFrame())
                {
                    UsePetSkill("Thrust");
                    UsePetSkill("Charge");
                    UsePetSkill("Shield-Breaker");
                    await CommonCoroutines.SleepForRandomReactionTime();
                }
            }
            return(true);
        }
示例#23
0
        protected override RunStatus Run(object context)
        {
            float?bestDirection = GetFaceWaterDirection();

            if (bestDirection.HasValue &&
                !WoWMathHelper.IsFacing(_me.Location, _me.Rotation, _me.Location.RayCast(bestDirection.Value, 10f), WoWMathHelper.DegreesToRadians(15)))
            {
                AutoAngler.Instance.Log("auto facing towards water");
                _me.SetFacing(bestDirection.Value);
            }
            return(RunStatus.Failure);
        }
示例#24
0
        public async static Task <bool> FaceWater()
        {
            float?bestDirection = GetFaceWaterDirection();

            if (bestDirection.HasValue &&
                !WoWMathHelper.IsFacing(StyxWoW.Me.Location, StyxWoW.Me.Rotation, StyxWoW.Me.Location.RayCast(bestDirection.Value, 10f), WoWMathHelper.DegreesToRadians(15)))
            {
                AutoAnglerBot.Log("auto facing towards water");
                Me.SetFacing(bestDirection.Value);
            }
            return(false);
        }
        private async Task <bool> UtilityCoroutine_MoveAndUseCatapult()
        {
            if (!Query.IsInVehicle() || !IsViable(SelectedCatapult))
            {
                return(false);
            }

            // Move vehicle into position...
            if (!Navigator.AtLocation(CurrentTask.PositionForLaunch))
            {
                Navigator.MoveTo(CurrentTask.PositionForLaunch);
                return(true);
            }

            // Adjust heading...
            if (!WoWMathHelper.IsFacing(WoWMovement.ActiveMover.Location, GetVehicleFacing(),
                                        CurrentTask.PositionToLand, WoWMathHelper.DegreesToRadians(0.5f)))
            {
                // Handle heading...
                double neededHeading = WoWMathHelper.CalculateNeededFacing(Me.Location, CurrentTask.PositionToLand);
                neededHeading = WoWMathHelper.NormalizeRadian((float)neededHeading);
                QBCLog.Info("Adjusting firing heading");
                Me.SetFacing((float)neededHeading);
                await Coroutine.Sleep(200);

                return(true);
            }

            // Adjust azimuth...
            double currentAzimuth = WoWMathHelper.NormalizeRadian(Lua.GetReturnVal <float>("return VehicleAimGetAngle();", 0));
            double neededAzimuth  = NormalizeAngleToPi(CurrentTask.NeededAzimuth);

            double azimuthChangeRequired = neededAzimuth - currentAzimuth;

            if (Math.Abs(azimuthChangeRequired) >= 0.01)
            {
                QBCLog.Info("Adjusting firing azimuth");
                // NB: VehicleAimIncrement() handles negative values of 'increment' correctly...
                Lua.DoString("VehicleAimIncrement({0})", azimuthChangeRequired);
                await Coroutine.Sleep(200);

                return(true);
            }

            // Fire..
            QBCLog.Info("Firing Catapult");
            Lua.DoString(Lua_LaunchCommand);

            await Coroutine.Wait(3000, () => !Query.IsInVehicle());

            return(true);
        }
示例#26
0
        protected override RunStatus Run(object context)
        {
            Vendor  ven    = BotPoi.Current.AsVendor;
            WoWUnit vendor = ObjectManager.GetObjectsOfType <WoWUnit>().
                             FirstOrDefault(m => m.Entry == ven.Entry || m.Entry == ven.Entry2);
            WoWPoint loc = vendor != null ? vendor.Location : ven.Location;

            if (_me.Location.Distance(loc) > 4)
            {
                if (AutoAngler.Instance.MySettings.Fly)
                {
                    Flightor.MoveTo(WoWMathHelper.CalculatePointFrom(_me.Location, loc, 4));
                }
                else
                {
                    if (!ObjectManager.Me.Mounted && Mount.ShouldMount(loc) && Mount.CanMount())
                    {
                        Mount.MountUp(() => loc);
                    }
                    Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(_me.Location, loc, 4));
                }
            }
            else
            {
                if (MerchantFrame.Instance == null || !MerchantFrame.Instance.IsVisible)
                {
                    if (vendor == null)
                    {
                        AutoAngler.Instance.Log("No vendor found at location {0}. hearth + logging out instead", loc);
                        BotPoi.Current = new BotPoi(PoiType.InnKeeper);
                        return(RunStatus.Failure);
                    }
                    vendor.Interact();
                }
                else
                {
                    // sell all poor and common items not in protected Items list.
                    List <WoWItem> itemList = _me.BagItems.Where(i => !ProtectedItemsManager.Contains(i.Entry) &&
                                                                 !i.IsSoulbound && !i.IsConjured &&
                                                                 (i.Quality == WoWItemQuality.Poor || i.Quality == WoWItemQuality.Common)).ToList();
                    foreach (var item in itemList)
                    {
                        item.UseContainerItem();
                    }
                    MerchantFrame.Instance.RepairAllItems();
                    BotPoi.Current = new BotPoi(PoiType.None);
                }
            }
            return(RunStatus.Success);
        }
示例#27
0
        //if pool is between CurrentPoint and NextPoint then cycle to nextPoint
        public void CycleToNextIfBehind(WoWGameObject pool)
        {
            WoWPoint cp    = CurrentPoint;
            WoWPoint point = GetNextWayPoint();

            point = new WoWPoint(point.X - cp.X, point.Y - cp.Y, 0);
            point.Normalize();
            float angle = WoWMathHelper.NormalizeRadian((float)Math.Atan2(point.Y, point.X - 1));

            if (WoWMathHelper.IsFacing(CurrentPoint, angle, pool.Location) &&
                CurrentPoint != WayPoints[WayPoints.Count - 1])
            {
                CycleToNextPoint();
            }
        }
示例#28
0
        public static bool IsFacing2D(WoWPoint me, float myFacingRadians, WoWPoint target, float arcRadians)
        {
            me.Z       = target.Z = 0;
            arcRadians = WoWMathHelper.NormalizeRadian(arcRadians);
            float num  = WoWMathHelper.CalculateNeededFacing(me, target);
            float num2 = WoWMathHelper.NormalizeRadian(num - myFacingRadians);

            if (num2 > 3.1415926535897931)
            {
                num2 = (float)(6.2831853071795862 - num2);
            }
            bool result = (num2 <= arcRadians / 2f);

            return(result);
        }
示例#29
0
 private void WalkAway()
 {
     if (Me.CurrentTarget != null)
     {
         WoWMovement.ClickToMove(WoWMathHelper.CalculatePointBehind(Me.Location, Me.RotationDegrees, 10));
         Log("Waliking away.");
         float rotation = Me.RotationDegrees + 180;
         Me.SetFacing(WoWMathHelper.DegreesToRadians(rotation));
         Thread.Sleep(250);
         WoWMovement.Move(WoWMovement.MovementDirection.Forward);
         Thread.Sleep(1500);
         WoWMovement.MoveStop(WoWMovement.MovementDirection.Forward);
         Me.CurrentTarget.Face();
     }
 }
示例#30
0
        public Composite CreateFireMageCombat()
        {
            return(new PrioritySelector(
                       CreateEnsureTarget(),
                       //Move away from frozen targets
                       new Decorator(
                           ret => Me.CurrentTarget.HasAura("Frost Nova") && Me.CurrentTarget.DistanceSqr < 5 * 5,
                           new Action(
                               ret =>
            {
                Logger.Write("Getting away from frozen target");
                WoWPoint moveTo = WoWMathHelper.CalculatePointFrom(Me.Location, Me.CurrentTarget.Location, 10f);

                if (Navigator.CanNavigateFully(Me.Location, moveTo))
                {
                    Navigator.MoveTo(moveTo);
                }
            })),
                       // Make sure we're in range, and facing the damned target. (LOS check as well)
                       CreateMoveToAndFace(39f, ret => Me.CurrentTarget),
                       CreateSpellBuffOnSelf("Ice Block", ret => Me.HealthPercent < 10 && !Me.ActiveAuras.ContainsKey("Hypothermia")),
                       new Decorator(ret => Me.ActiveAuras.ContainsKey("Ice Block"),
                                     new ActionIdle()),
                       CreateSpellBuff("Frost Nova", ret => NearbyUnfriendlyUnits.Any(u => u.DistanceSqr <= 8 * 8)),
                       CreateSpellCast("Evocation", ret => Me.ManaPercent < 20),
                       new Decorator(ret => HaveManaGem() && Me.ManaPercent <= 30,
                                     new Action(ctx => UseManaGem())),
                       CreateSpellBuffOnSelf("Mana Shield", ret => !Me.Auras.ContainsKey("Mana Shield") && Me.HealthPercent <= 75),
                       CreateMagePolymorphOnAddBehavior(),
                       CreateSpellCast("Counterspell", ret => Me.CurrentTarget.IsCasting),
                       CreateSpellCast("Mirror Image", ret => Me.CurrentTarget.HealthPercent > 20),
                       CreateSpellCast("Time Warp", ret => Me.CurrentTarget.HealthPercent > 20),
                       new Decorator(
                           ret => Me.CurrentTarget.HealthPercent > 50,
                           new Sequence(
                               new Action(ctx => Me.CurrentTarget.Face()),
                               new Action(ctx => StyxWoW.SleepForLagDuration()),
                               new PrioritySelector(CreateSpellCast("Flame Orb"))
                               )),
                       CreateSpellCast("Scorch", ret => (!Me.CurrentTarget.HasAura("Critical Mass") || Me.CurrentTarget.Auras["Critical Mass"].TimeLeft.TotalSeconds < 3) && TalentManager.GetCount(2, 20) != 0 && LastSpellCast != "Scorch"),
                       CreateSpellCast("Pyroblast", ret => Me.ActiveAuras.ContainsKey("Hot Streak") && Me.ActiveAuras["Hot Streak"].TimeLeft.TotalSeconds > 1),
                       CreateSpellCast("Fire Blast", ret => Me.ActiveAuras.ContainsKey("Impact")),
                       CreateSpellBuff("Living Bomb", ret => !Me.CurrentTarget.HasAura("Living Bomb")),
                       CreateSpellCast("Combustion", ret => Me.CurrentTarget.ActiveAuras.ContainsKey("Living Bomb") && Me.CurrentTarget.ActiveAuras.ContainsKey("Ignite") && Me.CurrentTarget.ActiveAuras.ContainsKey("Pyroblast!")),
                       CreateSpellCast("Fireball"),
                       CreateFireRangedWeapon()
                       ));
        }