예제 #1
0
        public bool HeadingSet(WoWObject wowObject)
        {
            if (Query.IsInVehicle() && Query.IsViable(wowObject))
            {
                // ClickToMoveInfo.InteractGuid contains the GUID of the wowObject that player is auto-facing
                // We don't want to spam ConstantFace since that causes issues.
                if (WoWMovement.ClickToMoveInfo.InteractGuid != wowObject.Guid)
                {
                    WoWMovement.ConstantFace(wowObject.Guid);
                }
                return(true);
            }

            WoWMovement.StopFace();
            return(false);
        }
        // 11Mar2013-04:41UTC chinajade
        public bool WeaponAim(Vector3 selectedLocation)
        {
            AimedLocation = null;
            if (selectedLocation == Vector3.Zero)
            {
                QBCLog.Warning("No target location for WeaponAim!");
                WoWMovement.StopFace();
                return(false);
            }

            if (!UtilAimPreReqsPassed())
            {
                return(false);
            }

            var spell = FindVehicleAbilitySpell();
            // No aiming is required if ability targets terrain using mouse cursor
            //if (spell != null && spell.CanTargetTerrain)
            //{
            //	// make sure target is within range of spell
            //	if (Me.Location.Distance(selectedLocation) > spell.MaxRange)
            //		return false;

            //	AimedLocation = selectedLocation;
            //	return true;
            //}

            // Calculate the azimuth...
            // TODO: Take vehicle rotations (pitch, roll) into account
            var azimuth = CalculateBallisticLaunchAngle(selectedLocation);

            if (!azimuth.HasValue || !WeaponArticulation.AzimuthSet(azimuth.Value))
            {
                return(false);
            }

            // For heading, we just face the location...
            if (!WeaponArticulation.HeadingSet(selectedLocation))
            {
                return(false);
            }

            AimedLocation = selectedLocation;
            return(true);
        }
        // 11Mar2013-04:41UTC chinajade
        public bool WeaponAim(WoWObject selectedTarget)
        {
            AimedLocation = null;
            // If target is moving, lead it...
            var wowUnit = selectedTarget as WoWUnit;

            if (Query.IsViable(wowUnit) && wowUnit.IsMoving)
            {
                var projectileFlightTime = CalculateTimeOfProjectileFlight(selectedTarget.Location);
                var anticipatedLocation  = selectedTarget.AnticipatedLocation(projectileFlightTime);

                WoWMovement.StopFace();
                return(WeaponAim(anticipatedLocation));
            }

            if (!Query.IsViable(selectedTarget))
            {
                QBCLog.Warning("No target for WeaponAim!");
                WoWMovement.StopFace();
                return(false);
            }

            if (!UtilAimPreReqsPassed())
            {
                return(false);
            }

            // Show user what we're targeting...
            Utility.Target(selectedTarget);

            var spell = FindVehicleAbilitySpell();
            // Terrain is targeted when firing weapon.
            // Commented out until repairs are made.
            //if (spell != null && spell.CanTargetTerrain)
            //{
            //	// make sure target is within range of spell
            //	if ( Me.Location.Distance(selectedTarget.Location) > spell.MaxRange)
            //		return false;

            //	AimedLocation = selectedTarget.Location;
            //	return true;
            //}

            // Calculate the azimuth...
            // TODO: Take vehicle rotations (pitch, roll) into account
            var azimuth = CalculateBallisticLaunchAngle(selectedTarget.Location);

            //// Debugging--looking for pitch/roll contributions...
            //// NB: It currently looks like the GetWorldMatrix() does not populate enough info to make
            //// this calculation.
            //if (azimuth.HasValue)
            //{
            //    var pitch = StyxWoW.Memory.Read<float>(WoWMovement.ActiveMover.BaseAddress + 0x820 + 0x24);
            //    QBCLog.Debug("{0} {1:F3}/ {2:F3} pitch: {3:F3}", WoWMovement.ActiveMover.Name, azimuth, azimuth - pitch, pitch);

            //    QBCDebug.ShowVehicleArticulationChain(WoWMovement.ActiveMover);
            //}

            if (!azimuth.HasValue || !WeaponArticulation.AzimuthSet(azimuth.Value))
            {
                return(false);
            }

            // For heading, we just face the location...
            if (!WeaponArticulation.HeadingSet(selectedTarget))
            {
                return(false);
            }

            AimedLocation = selectedTarget.Location;
            return(true);
        }
예제 #4
0
        public static Composite CreateDisengageBehavior()
        {
            return
                (new Decorator(
                     ret => IsDisengageNeeded(),
                     new Sequence(
                         new ActionDebugString(ret => "face away from or towards safespot as needed"),
                         new Action(delegate
            {
                if (useRocketJump)
                {
                    needFacing = Styx.Helpers.WoWMathHelper.CalculateNeededFacing(Me.Location, safeSpot);
                }
                else
                {
                    needFacing = Styx.Helpers.WoWMathHelper.CalculateNeededFacing(safeSpot, Me.Location);
                }

                needFacing = WoWMathHelper.NormalizeRadian(needFacing);
                float rotation = WoWMathHelper.NormalizeRadian(Math.Abs(needFacing - Me.RenderFacing));
                Logger.Write(Color.Cyan, "DIS: turning {0:F0} degrees {1} safe landing spot",
                             WoWMathHelper.RadiansToDegrees(rotation), useRocketJump ? "towards" : "away from");
                Me.SetFacing(needFacing);
            }),

                         new ActionDebugString(ret => "wait for facing to complete"),
                         new PrioritySelector(
                             new Wait(new TimeSpan(0, 0, 1), ret => Me.IsDirectlyFacing(needFacing), new ActionAlwaysSucceed()),
                             new Action(ret =>
            {
                Logger.Write(Color.Cyan, "DIS: timed out waiting to face safe spot - need:{0:F4} have:{1:F4}", needFacing, Me.RenderFacing);
                return RunStatus.Failure;
            })
                             ),

                         // stop facing
                         new Action(ret =>
            {
                Logger.Write(Color.Cyan, "DIS: cancel facing now we point the right way");
                WoWMovement.StopFace();
            }),

                         new ActionDebugString(ret => "set time of disengage just prior"),
                         new Sequence(
                             new PrioritySelector(
                                 new Decorator(ret => !useRocketJump, Spell.BuffSelf("Disengage")),
                                 new Decorator(ret => useRocketJump, Spell.BuffSelf("Rocket Jump")),
                                 new Action(ret => Logger.Write(Color.Cyan, "DIS: {0} cast appears to have failed", useRocketJump ? "Rocket Jump" : "Disengage"))
                                 ),
                             new Action(ret =>
            {
                NextDisengageAllowed = DateTime.Now.Add(new TimeSpan(0, 0, 0, 0, 750));
                Logger.Write(Color.Cyan, "DIS: finished {0} cast", useRocketJump ? "Rocket Jump" : "Disengage");
                if (Kite.IsKitingActive())
                {
                    Kite.EndKiting(String.Format("BP: Interrupted by {0}", useRocketJump ? "Rocket Jump" : "Disengage"));
                }
                return RunStatus.Success;
            })
                             )

                         )
                     ));
        }
예제 #5
0
        private static WoWUnit Target;                      // My target


        internal static void PulseMovement()
        {
            try
            {
                // Experimenting with Facing
                if (ObjectManager.Me.CurrentTarget == null)
                {
                    WoWMovement.StopFace();
                }

                // bunch of fuckoff checks to make sure we can even do the movements.
                if (StyxWoW.IsInGame == false)
                {
                    return;
                }
                if (Me.IsValid == false)
                {
                    return;
                }
                if (Me.CurrentTarget == null)
                {
                    return;
                }
                if (Me.GotTarget == false)
                {
                    return;
                }
                if (Me.Mounted)
                {
                    return;
                }
                if (Me.Dead)
                {
                    return;
                }
                if (Settings._Instance.PlayersOnly)
                {
                    if (Me.CurrentTarget.IsPlayer == false)
                    {
                        return;
                    }
                }

                // Target stuff
                Target = Me.CurrentTarget;
                if (Target.Distance > 10)
                {
                    return;
                }
                if (Target.Dead)
                {
                    return;
                }
                //if (Target.IsFriendly) return;


                // Do our movement stuff
                CheckFace();
                if (CheckMoving())
                {
                    return;
                }
                if (CheckStop())
                {
                    return;
                }
            }
            catch (System.Exception) { }
        }