protected override Composite CreateMainBehavior() { return(new PrioritySelector( // If we're not mounted, nothing to do... new Decorator(ret => !Me.IsMounted() && !Me.IsShapeshifted(), new Action(delegate { BehaviorDone(); })), new ActionRunCoroutine(context => UtilityCoroutine.ExecuteMountStrategy(MountStrategyType.DismountOrCancelShapeshift)) )); }
private Composite CreateActualBehavior() { return(new PrioritySelector( new Decorator( ret => MountType == ForcedMountType.Ground, new ActionRunCoroutine(ret => UtilityCoroutine.ExecuteMountStrategy(MountStrategyType.Mount, Styx.NavType.Run))), new Decorator( ret => MountType == ForcedMountType.Flying, new ActionRunCoroutine(ctx => MountForFlying())) )); }
private Composite StateBehaviorPS_MountingVehicle() { return(new PrioritySelector( new Decorator(context => Me.IsQuestComplete(GetQuestId()), new Action(context => { BehaviorDone(string.Format("quest complete")); })), // If we're mounted on something other than the dragon, then dismount... new Decorator(context => Me.Mounted && !Query.IsViable(DragonVehicle), new ActionRunCoroutine(context => UtilityCoroutine.ExecuteMountStrategy(MountStrategyType.Dismount))), // If we're on the dragon, get moving... new Decorator(context => Query.IsViable(DragonVehicle), new PrioritySelector( SubBehaviorPS_InitializeVehicleAbilities(), new Action(context => { BehaviorState = BehaviorStateType.RidingOutToHuntingGrounds; }) )), // If we don't posssess item to summon the dragon, that's fatal... new Decorator(context => { ItemToSummonVehicle = Me.CarriedItems.FirstOrDefault(i => i.Entry == ItemIdToSummonVehicle); return !Query.IsViable(ItemToSummonVehicle); }, new Action(context => { QBCLog.Fatal("Unable to locate ItemId({0}) in inventory.", ItemIdToSummonVehicle); })), // Wait for item to come off cooldown... new Decorator(context => ItemToSummonVehicle.Cooldown > 0, new Action(context => { TreeRoot.StatusText = string.Format("Waiting for {0} cooldown ({1} remaining)", ItemToSummonVehicle.SafeName, Utility.PrettyTime(ItemToSummonVehicle.CooldownTimeLeft)); return RunStatus.Success; })), // Use the item new Decorator(context => !Me.IsCasting, new ActionFail(context => { // If we got booted out of a vehicle for some reason, reset the weapons... Weapon_DevourHuman = null; Weapon_FrozenDeathbolt = null; ItemToSummonVehicle.UseContainerItem(); })) )); }
private async Task <bool> MountForFlying() { if (!Flightor.CanFly) { return(false); } await UtilityCoroutine.ExecuteMountStrategy(MountStrategyType.Mount, Styx.NavType.Fly); try { WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend, 500); await Coroutine.Sleep(250); } finally { Navigator.PlayerMover.MoveStop(); } return(true); }
private async Task <bool> MainCoroutine() { // break if we are done or we are not in combat and targting is not empty, we want the botbase to clear path for us. if (IsDone || (!Me.Combat && Targeting.Instance.FirstUnit != null) || !Me.IsAlive) { return(false); } if (!Query.IsViable(SelectedNpc)) { SelectedNpc = GetNpc(); } if (!Query.IsViable(SelectedNpc) || !Me.IsActuallyInCombat && Targeting.Instance.FirstUnit == null) { // move to search area if (SearchLocation != Vector3.Zero && !Navigator.AtLocation(SearchLocation)) { await UtilityCoroutine.MoveTo(SearchLocation, "Search Area", MovementBy); } // Dismount after reaching search location. else if ((SearchLocation == Vector3.Zero || Navigator.AtLocation(SearchLocation)) && Me.Mounted) { await UtilityCoroutine.ExecuteMountStrategy(MountStrategyType.Dismount); } else { TreeRoot.StatusText = "Waiting for NPC to spawn"; } return(true); } if (SelectedNpc.IsDead && SelectedNpc.TaggedByMe && !VariantQuestIds.Any()) { BehaviorDone(); return(true); } if (SelectedNpc.HasAura(ImmunityAuraId)) { if (BotPoi.Current.AsObject == SelectedNpc) { BotPoi.Clear("Mob is immune"); } var targetedMob = Targeting.Instance.FirstUnit; if (targetedMob != null && ImmunityBreakingMobIds.Contains((int)targetedMob.Entry)) { if (targetedMob.IsTargetingMeOrPet) { // move close enough to shielded NPC so that the exploding mobs will hit it when killed. var myMinDistance = Math.Max(2, MaxRange - targetedMob.MeleeRange); if (SelectedNpc.DistanceSqr > myMinDistance * myMinDistance) { TreeRoot.StatusText = string.Format("Moving closer to {0} before killing {1}", SelectedNpc.SafeName, targetedMob.SafeName); Navigator.MoveTo(SelectedNpc.Location); return(true); } // wait for exploding mob to get within range of shielded mob. if (targetedMob.Location.DistanceSquared(SelectedNpc.Location) > MaxRange * MaxRange) { TreeRoot.StatusText = string.Format( "Waiting for {0} to move withing range of {1}", targetedMob.SafeName, SelectedNpc.SafeName); return(true); } } } } return(false); }
private Composite StateBehaviorPS_MountingVehicle() { return(new PrioritySelector( new Decorator(context => Me.IsQuestComplete(QuestId), new Action(context => { BehaviorDone(); })), // If we're in the vehicle, wait for the ride out to hunting grounds to complete... new Decorator(context => IsInTank(), new PrioritySelector( SubBehaviorPS_InitializeVehicleAbilities(), new Action(context => { BehaviorState = BehaviorStateType.RidingOutToHuntingGrounds; }) )), // If vehicle is in "enter vehicle" animation, wait for the animation to complete... new Decorator(context => FindVehicle_OwnedByMe(MobId_SchnottzSiegeTankInstanced) != null, new PrioritySelector( new CompositeThrottle(Throttle.UserUpdate, new Action(context => { TreeRoot.StatusText = string.Format("Waiting for {0} to become ready.", Utility.GetObjectNameFromId(MobId_SchnottzSiegeTankInstanced)); })), new ActionAlwaysSucceed() )), // Locate a vehicle to mount... new Decorator(context => !Query.IsViable(Vehicle), new PrioritySelector( new Action(context => { Vehicle = Query.FindMobsAndFactions(Utility.ToEnumerable(MobId_SchnottzSiegeTank)) .FirstOrDefault() as WoWUnit; if (Query.IsViable(Vehicle)) { Utility.Target(Vehicle); return RunStatus.Success; } return RunStatus.Failure; // fall through }), // No vehicle found, move to staging area... new Decorator(ctx => !Navigator.AtLocation(Location_VehicleStagingArea), new ActionRunCoroutine( interactUnitContext => UtilityCoroutine.MoveTo( Location_VehicleStagingArea, "Vehicle Staging Area", MovementBy))), // Wait for vehicle to respawn... new CompositeThrottle(Throttle.UserUpdate, new Action(context => { TreeRoot.StatusText = string.Format("Waiting for {0} to respawn.", Utility.GetObjectNameFromId(MobId_SchnottzSiegeTank)); })) )), // Move to vehicle and enter... new CompositeThrottle(Throttle.UserUpdate, new Action(context => { TreeRoot.StatusText = string.Format("Moving to {0}", Vehicle.SafeName); })), new Decorator(context => !Vehicle.WithinInteractRange, new ActionRunCoroutine( interactUnitContext => UtilityCoroutine.MoveTo( Vehicle.Location, Vehicle.SafeName, MovementBy))), new Decorator(context => Me.IsMoving, new Action(context => { Navigator.PlayerMover.MoveStop(); })), new Decorator(context => Me.Mounted, new ActionRunCoroutine(context => UtilityCoroutine.ExecuteMountStrategy(MountStrategyType.DismountOrCancelShapeshift))), new ActionFail(context => { // If we got booted out of a vehicle for some reason, reset the weapons... WeaponFireCannon = null; Utility.Target(Vehicle); Vehicle.Interact(); }), new Wait(TimeSpan.FromMilliseconds(10000), context => IsInTank(), new ActionAlwaysSucceed()), new ActionAlwaysSucceed() )); }
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); }