private async Task <bool> StateCoroutine_ReturningToBase() { if (!(Me.HasAura(AuraId_EmergencyRocketPack) || Me.HasAura(AuraId_Parachute))) { // If still in vehicle, then use spell to start journey home... if (WeaponEmergencyRocketPack.IsAbilityReady() && WeaponEmergencyRocketPack.UseAbility()) { return(true); } // If journey complete, behavior is done... if (!Me.IsMoving) { BehaviorDone(); return(true); } await(_updateUser_ReturningToBase ?? (_updateUser_ReturningToBase = new ThrottleCoroutineTask( Throttle.UserUpdate, async() => TreeRoot.StatusText = "Returning to base"))); } return(false); }
private async Task <bool> StateCoroutine_CompletingObjectives() { // If for some reason no longer in the vehicle, go fetch another... if (!IsInBalloon()) { QBCLog.Warning("We've been jettisoned from vehicle unexpectedly--will try again."); BehaviorState = BehaviorStateType.MountingVehicle; return(true); } // If quest is complete, then head back... if (Me.IsQuestComplete(GetQuestId())) { BehaviorState = BehaviorStateType.ReturningToBase; return(true); } await(_updateUser_CompletingObjectives ?? (_updateUser_CompletingObjectives = new ThrottleCoroutineTask( Throttle.UserUpdate, async() => TreeRoot.StatusText = "Completing Quest Objectives"))); // Select new best target, if our current one is no longer useful... if (!IsViableForTargeting(SelectedTarget)) { var questId = GetQuestId(); if (!IsViableForTargeting(SelectedTarget) && !Me.IsQuestObjectiveComplete(questId, 1)) { SelectedTarget = FindBestTarget(MobId_Objective1_SteamwheedleSurvivor); WeaponChoice = WeaponLifeRocket; } if (!IsViableForTargeting(SelectedTarget) && !Me.IsQuestObjectiveComplete(questId, 2)) { SelectedTarget = FindBestTarget(MobId_Objective2_SouthseaBlockader); WeaponChoice = WeaponPirateDestroyingBomb; } } // Aim & Fire at the selected target... else { // If weapon aim cannot address selected target, blacklist target for a few seconds... if (!WeaponChoice.WeaponAim(SelectedTarget)) { _targetBlacklist.Add(SelectedTarget, TimeSpan.FromSeconds(5)); return(false); } // If weapon could not be fired, wait for it to become ready... if (!WeaponChoice.WeaponFire()) { return(false); } // Weapon was fired, blacklist target so we can choose another... _targetBlacklist.Add(SelectedTarget, TimeSpan.FromSeconds(15)); await Coroutine.Sleep((int)Delay.AfterWeaponFire.TotalMilliseconds); } return(true); }
private async Task <bool> StateCoroutine_RidingOutToHuntingGrounds() { // If for some reason no longer in the vehicle, go fetch another... if (!IsInBalloon()) { QBCLog.Warning("We've been jettisoned from vehicle unexpectedly--will try again."); BehaviorState = BehaviorStateType.MountingVehicle; return(true); } // Ride to hunting grounds complete when spells are enabled... if (WeaponLifeRocket.IsWeaponUsable()) { BehaviorState = BehaviorStateType.CompletingObjectives; return(true); } await(_updateUser_RidingOutToHuntingGrounds ?? (_updateUser_RidingOutToHuntingGrounds = new ThrottleCoroutineTask( Throttle.UserUpdate, async() => TreeRoot.StatusText = "Riding out to hunting grounds"))); return(false); }
private async Task <bool> StateCoroutine_MountingVehicle() { if (Me.IsQuestComplete(QuestId)) { BehaviorDone(); return(true); } if (IsInBalloon()) { await SubCoroutine_InitializeVehicleAbilities(); BehaviorState = BehaviorStateType.RidingOutToHuntingGrounds; return(true); } // Locate a vehicle to mount... if (!Query.IsViable(Vehicle)) { Vehicle = Query.FindMobsAndFactions(Utility.ToEnumerable(MobId_SteamwheedleRescueBalloon)) .FirstOrDefault() as WoWUnit; if (Query.IsViable(Vehicle)) { Utility.Target(Vehicle); return(true); } // No vehicle found, move to staging area... if (!Navigator.AtLocation(VehicleStagingArea)) { return(await UtilityCoroutine.MoveTo(VehicleStagingArea, "Vehicle Staging Area", MovementBy)); } await(_updateUser_MountingVehicle_waitingForSpawn ?? (_updateUser_MountingVehicle_waitingForSpawn = new ThrottleCoroutineTask( Throttle.UserUpdate, async() => TreeRoot.StatusText = string.Format("Waiting for {0} to respawn.", Utility.GetObjectNameFromId(MobId_SteamwheedleRescueBalloon))))); // Wait for vehicle to respawn... return(true); } // Wait for vehicle to respawn... await(_updateUser_MountingVehicle_movingToVehicle ?? (_updateUser_MountingVehicle_movingToVehicle = new ThrottleCoroutineTask( Throttle.UserUpdate, async() => TreeRoot.StatusText = string.Format("Moving to {0}", Vehicle.SafeName)))); if (!Vehicle.WithinInteractRange) { return(await UtilityCoroutine.MoveTo(Vehicle.Location, Vehicle.SafeName, MovementBy)); } if (Me.IsMoving) { await CommonCoroutines.StopMoving(); } if (Me.Mounted && await UtilityCoroutine.ExecuteMountStrategy( MountStrategyType.DismountOrCancelShapeshift)) { return(true); } // If we got booted out of a vehicle for some reason, reset the weapons... WeaponLifeRocket = null; WeaponPirateDestroyingBomb = null; WeaponEmergencyRocketPack = null; Utility.Target(Vehicle); await Coroutine.Sleep((int)Delay.AfterInteraction.TotalMilliseconds); Vehicle.Interact(); await Coroutine.Wait(10000, IsInBalloon); return(true); }