Exemplo n.º 1
0
            public override async Task <bool> Run()
            {
                var huntingGrounds = HuntingGroundsProvider();

                // Only one hunting ground waypoint to move to and at that waywpoint?
                if (huntingGrounds.Waypoints.Count == 1 && huntingGrounds.CurrentWaypoint().AtLocation(WoWMovement.ActiveMover.Location))
                {
                    await(_messageThrottle ?? (_messageThrottle = new ThrottleCoroutineTask(TimeSpan.FromSeconds(10), LogMessage)));

                    // Terminate of no targets available?
                    if (TerminateBehaviorIfNoTargetsProvider != null)
                    {
                        TerminateBehaviorIfNoTargetsProvider();
                    }
                    return(false);
                }

                // Move to next hunting ground waypoint...
                if (await MoveTo(huntingGrounds, MovementByDelegate()))
                {
                    return(true);
                }


                return(false);
            }
 public override async Task <bool> Run()
 {
     if (LootTargeting.LootMobs && Me.FreeBagSlots <= 0)
     {
         await(_throttle ?? (_throttle = new ThrottleCoroutineTask(TimeSpan.FromMinutes(10), LogWarning)));
     }
     return(false);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Mounts a vehicle
        /// </summary>
        /// <param name="searchLocation">The search location.</param>
        /// <param name="movementBy">The movement type.</param>
        /// <param name="extraVehicleQualifiers">The extra vehicle qualifiers.</param>
        /// <param name="vehicleIds">The vehicle ids.</param>
        /// <returns>
        ///   <c>true</c> if any action was taken; <c>false</c> otherwise
        /// </returns>
        public static async Task <bool> MountVehicle(
            Vector3 searchLocation,
            MovementByType movementBy = MovementByType.FlightorPreferred,
            Func <WoWUnit, bool> extraVehicleQualifiers = null,
            params int[] vehicleIds)
        {
            if (Query.IsInVehicle())
            {
                return(false);
            }

            var vehicle = Query.FindUnoccupiedVehicles(vehicleIds, extraVehicleQualifiers).FirstOrDefault();

            if (vehicle == null)
            {
                if (!Navigator.AtLocation(searchLocation))
                {
                    return(await MoveTo(searchLocation, "Vehicle search area", movementBy));
                }

                await
                    (s_mountVehicleUserUpdateThrottle ??
                    (s_mountVehicleUserUpdateThrottle =
                         new ThrottleCoroutineTask(
                             TimeSpan.FromSeconds(10),
                             async() => QBCLog.Info("Waiting for a vehicle to become available"))));
                return(true);
            }

            if (!vehicle.WithinInteractRange)
            {
                return(await MoveTo(vehicle.Location, vehicle.SafeName, movementBy, vehicle.InteractRange));
            }

            if (await CommonCoroutines.Dismount("Getting inside vehicle"))
            {
                await Coroutine.Sleep(Delay.BeforeButtonClick);
            }
            vehicle.Interact();
            await Coroutine.Sleep(Delay.AfterInteraction);

            return(true);
        }