コード例 #1
0
        private bool IsMountedCorrectly()
        {
            Mount.MountWrapper curMount = Mount.Current;
            if (curMount == null)
            {
                return(false);
            }

            if (MountType == ForcedMountType.Flying)
            {
                return(curMount.IsFlyingMount || !Flightor.IsFlyableArea());
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        ///     Mounts or Dismounts according to the provided MOUNTSTRATEGYDELEGATE.
        ///     <para>
        ///         Notes:
        ///         <list type="bullet">
        ///             <item>
        ///                 <description>
        ///                     <para>
        ///                         * A "Dismount" will unmount, or cancel a 'mounted' shapeshift form.
        ///                         Examples of the latter include: Druid Flight Form, Druid Travel Form, Shaman Ghost Wolf, Worgen
        ///                         Running Wild.
        ///                     </para>
        ///                 </description>
        ///             </item>
        ///             <item>
        ///                 <description>
        ///                     <para> * Requests to "Mount" will only be honored if the area allows it.</para>
        ///                 </description>
        ///             </item>
        ///         </list>
        ///     </para>
        /// </summary>
        /// <returns></returns>
        /// <remarks>17Apr2013-03:11UTC chinajade</remarks>
        public static async Task <bool> ExecuteMountStrategy(MountStrategyType mountStrategy, NavType navType = NavType.Fly)
        {
            if (mountStrategy == MountStrategyType.None)
            {
                return(false);
            }

#pragma warning disable 618
            // Dismount needed?
            if (mountStrategy == MountStrategyType.Dismount ||
                mountStrategy == MountStrategyType.CancelShapeshift ||
                mountStrategy == MountStrategyType.DismountOrCancelShapeshift ||
                mountStrategy == MountStrategyType.Land)
            {
                if (!Me.Mounted)
                {
                    return(false);
                }

                if (mountStrategy != MountStrategyType.Land)
                {
                    return(await CommonCoroutines.LandAndDismount("Requested by QB"));
                }

                if (!Me.IsFlying)
                {
                    return(false);
                }

                return(await CommonCoroutines.LandAndDismount("Land requested by QB", false));
            }
#pragma warning restore 618

            if (mountStrategy == MountStrategyType.Mount && Mount.UseMount && Mount.CanMount())
            {
                if (Me.Mounted)
                {
                    // Check if we should switch mounts
                    if (navType == NavType.Fly)
                    {
                        if (Mount.Current.IsFlyingMount || !Flightor.IsFlyableArea())
                        {
                            return(false);
                        }

                        await CommonCoroutines.LandAndDismount("Switching to flying mount");
                    }
                    else
                    {
                        // If ground nav then any mount is fine.
                        return(false);
                    }
                }

                if (navType == NavType.Fly)
                {
                    if (!Flightor.CanFly)
                    {
                        return(false);
                    }

                    return(await CommonCoroutines.SummonFlyingMount());
                }

                return(await CommonCoroutines.SummonGroundMount());
            }

            return(false);
        }