// 30Jun2013-07:42UTC chinajade
        public static WoWPetSpell FindPetActionByName(string petActionName)
        {
            var petAction = Me.PetSpells.FirstOrDefault(p => p.ToString() == petActionName);

            if (petAction == null)
            {
                QBCLog.MaintenanceError("or [USER ERROR]: PetAction('{0}') is either not known, or not hot-barred.",
                                        petActionName);
            }

            return(petAction);
        }
예제 #2
0
        public static async Task <bool> MoveTo(
            WoWPoint destination,
            string destinationName,
            MovementByType movementBy = MovementByType.FlightorPreferred)
        {
            Contract.Requires(destinationName != null, context => "destinationName may not be null");

            if (movementBy == MovementByType.None)
            {
                return(false);
            }

            var activeMover = WoWMovement.ActiveMover;

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

            if (!IsMoveToMessageThrottled)
            {
                if (string.IsNullOrEmpty(destinationName))
                {
                    destinationName = destination.ToString();
                }
                TreeRoot.StatusText = "Moving to " + destinationName;
            }

            switch (movementBy)
            {
            case MovementByType.FlightorPreferred:
                if (await TryFlightor(destination))
                {
                    return(true);
                }

                if (await TryNavigator(destination, destinationName))
                {
                    return(true);
                }

                if (await TryClickToMove(destination, NavType.Fly))
                {
                    return(true);
                }
                break;

            case MovementByType.NavigatorPreferred:
                if (await TryNavigator(destination, destinationName))
                {
                    return(true);
                }

                if (await TryClickToMove(destination, NavType.Run))
                {
                    return(true);
                }
                break;

            case MovementByType.NavigatorOnly:
                if (await TryNavigator(destination, destinationName))
                {
                    return(true);
                }
                break;

            case MovementByType.ClickToMoveOnly:
                var navType = activeMover.MovementInfo.CanFly ? NavType.Fly : NavType.Run;
                if (await TryClickToMove(destination, navType))
                {
                    return(true);
                }
                break;

            case MovementByType.None:
                break;

            default:
                QBCLog.MaintenanceError("Unhandled MovementByType of {0}", movementBy);
                break;
            }
            return(false);
        }
        // 11Mar2013-04:41UTC chinajade
        public bool WeaponFire()
        {
            if (!AimedLocation.HasValue)
            {
                QBCLog.MaintenanceError("Weapon {0} has not been aimed!", Name);
                return(false);
            }

            var isWeaponUsed = UseAbility();

            if (isWeaponUsed)
            {
                // Commented out for now. Will be revisited when issue #HB-926 is worked on.
                //if (CanTargetTerrain)
                //{
                //	SpellManager.ClickRemoteLocation(AimedLocation.Value);
                //	return true;
                //}

                double instantaneousMuzzleVelocity = CalculateMuzzleVelocity();

                if (!double.IsNaN(instantaneousMuzzleVelocity))
                {
                    MuzzleVelocities_Summation += instantaneousMuzzleVelocity;
                    ++MuzzleVelocities_Count;
                    MeasuredMuzzleVelocity_Average = MuzzleVelocities_Summation / MuzzleVelocities_Count;

                    MuzzleVelocityInFps = FixedMuzzleVelocity.HasValue
                        ? FixedMuzzleVelocity.Value
                        : MeasuredMuzzleVelocity_Average;

                    if (double.IsNaN(MeasuredMuzzleVelocity_Min) || (instantaneousMuzzleVelocity < MeasuredMuzzleVelocity_Min))
                    {
                        MeasuredMuzzleVelocity_Min = instantaneousMuzzleVelocity;
                    }

                    if (double.IsNaN(MeasuredMuzzleVelocity_Max) || (instantaneousMuzzleVelocity > MeasuredMuzzleVelocity_Max))
                    {
                        MeasuredMuzzleVelocity_Max = instantaneousMuzzleVelocity;
                    }

                    if (LogWeaponFiringDetails)
                    {
                        QBCLog.DeveloperInfo(
                            "Weapon {1} fired:{0}"
                            + "  Angle: {2:F3}{0}"
                            + "  MuzzleVelocity: {3:F2} {4}{0}"
                            + "  MeasureMuzzleVelocities: {5:F2} instantaneous / {6:F2} avg / {7:F2} min / {8:F2} max{0}"
                            + "  Target Distance: {9:F2}{0}"
                            + "  Projectile Flight Time: {10}",
                            Environment.NewLine,
                            Name,
                            WeaponArticulation.AzimuthGet(),
                            MuzzleVelocityInFps,
                            (FixedMuzzleVelocity.HasValue ? "fixed" : "used"),
                            instantaneousMuzzleVelocity,
                            MeasuredMuzzleVelocity_Average,
                            MeasuredMuzzleVelocity_Min,
                            MeasuredMuzzleVelocity_Max,
                            Me.Location.Distance(AimedLocation.Value),
                            Utility.PrettyTime(CalculateTimeOfProjectileFlight(AimedLocation.Value), true, false));
                    }

                    AimedLocation = null;   // weapon fired--force re-aim for next shot
                }
            }

            return(isWeaponUsed);
        }
예제 #4
0
        /// <summary>
        /// This coroutine was meant to be used mostly for 'vehicle' encounters.  Normal combat routines
        /// do not work well (or at all) in these situations.  Examples include:<list type="bullet">
        /// <item><description><para> * The 'poles' for "The Lesson of Dry Fur" (http://wowhead.com/quest=29661)
        /// </para></description></item>
        /// <item><description><para> * The 'Great White Plainshawk' for "A Lesson in Bravery" (http://wowhead.com/quest=29918)
        /// </para></description></item>
        /// </list>
        /// </summary>
        public static async Task <bool> MiniCombatRoutine()
        {
            var target = StyxWoW.Me.CurrentTarget;

            if (!Query.IsViableForFighting(target))
            {
                AutoAttackOff();
                return(false);
            }
            AutoAttackOn();

            var activeMover = WoWMovement.ActiveMover;

            // Make certain we are facing the target...
            // NB: Since this behavior is frequently employed while we're "on vehicles"
            // "facing" doesn't always work.  If we are unable to 'face' successfully,
            // we don't want that to stop us from trying our special attaks.  Thus,
            // not returning right away
            if (activeMover != null && !activeMover.IsSafelyFacing(target, 30))
            {
                StyxWoW.Me.SetFacing(target.Location);
            }

            switch (StyxWoW.Me.Class)
            {
            case WoWClass.DeathKnight:
                return(TryCast(49998));                                 // Death Strike: http://wowhead.com/spell=49998

            case WoWClass.Druid:
                return((!StyxWoW.Me.HasAura(768) && TryCast(5176)) ||   // Wrath: http://wowhead.com/spell=5176
                       (!StyxWoW.Me.HasAura(768) && TryCast(768)) ||    // Cat Form: http://wowhead.com/spell=768
                       TryCast(1822) ||                                 // Rake: http://wowhead.com/spell=1822
                       TryCast(22568) ||                                // Ferocious Bite: http://wowhead.com/spell=22568
                       TryCast(33917));                                 // Mangle: http://wowhead.com/spell=33917

            case WoWClass.Hunter:
                return(TryCast(3044) ||                                 // Arcane Shot: http://wowhead.com/spell=3044
                       TryCast(56641));                                 // Steady Shot: http://wowhead.com/spell=56641

            case WoWClass.Mage:
                return(TryCast(44614) ||                                // Frostfire Bolt: http://wowhead.com/spell=44614
                       TryCast(126201) ||                               // Frostbolt: http://wowhead.com/spell=126201
                       TryCast(2136));                                  // Fire Blast: http://wowhead.com/spell=2136

            case WoWClass.Monk:
                return(TryCast(100780) ||                               // Jab: http://wowhead.com/spell=100780
                       TryCast(100787));                                // Tiger Palm: http://wowhead.com/spell=100787

            case WoWClass.Paladin:
                return(TryCast(35395) ||                                // Crusader Strike: http://wowhead.com/spell=35395
                       TryCast(20271));                                 // Judgment: http://wowhead.com/spell=20271

            case WoWClass.Priest:
                return((!target.HasAura(589) && TryCast(589)) ||        // Shadow Word: Pain: http://wowhead.com/spell=589
                       TryCast(15407) ||                                // Mind Flay: http://wowhead.com/spell=15407
                       TryCast(585));                                   // Smite: http://wowhead.com/spell=585

            case WoWClass.Rogue:
                return(TryCast(2098) ||                                 // Eviscerate: http://wowhead.com/spell=2098
                       TryCast(1752));                                  // Sinster Strike: http://wowhead.com/spell=1752

            case WoWClass.Shaman:
                return(TryCast(17364) ||                                // Stormstrike: http://wowhead.com/spell=17364
                       TryCast(403) ||                                  // Lightning Bolt: http://wowhead.com/spell=403
                       TryCast(73899));                                 // Primal Strike: http://wowhead.com/spell=73899

            case WoWClass.Warlock:
                return(TryCast(686));                                   // Shadow Bolt: http://wowhead.com/spell=686

            case WoWClass.Warrior:
                return(TryCast(78) ||                                   // Heroic Strike: http://wowhead.com/spell=78
                       TryCast(34428) ||                                // Victory Rush: http://wowhead.com/spell=34428
                       TryCast(23922) ||                                // Shield Slam: http://wowhead.com/spell=23922
                       TryCast(20243));                                 // Devastate: http://wowhead.com/spell=20243

            default:
                QBCLog.MaintenanceError("Class({0}) is unhandled", StyxWoW.Me.Class);
                TreeRoot.Stop();
                return(false);
            }
        }