public static List <WoWUnit> FindMobsWithinAggroRange( WoWPoint destination, bool ignoreMobsInBlackspots, double nonCompeteDistance, IEnumerable <int> excludedUnitIds = null, double extraRangePadding = 0.0) { excludedUnitIds = excludedUnitIds ?? Enumerable.Empty <int>(); using (StyxWoW.Memory.AcquireFrame()) { return ((from wowUnit in ObjectManager.GetObjectsOfType <WoWUnit>(true, false) where IsViableForPulling(wowUnit, ignoreMobsInBlackspots, nonCompeteDistance) && wowUnit.IsHostile // exclude opposing faction: both players and their pets show up as "PlayerControlled" && !wowUnit.PlayerControlled // exclude any units that are candidates for interacting && !excludedUnitIds.Contains((int)wowUnit.Entry) // Do not pull mobs on the AvoidMobs list && !ProfileManager.CurrentOuterProfile.AvoidMobs.Contains(wowUnit.Entry) let collectionDistance = destination.CollectionDistance(wowUnit.Location) where collectionDistance <= (wowUnit.MyAggroRange + extraRangePadding) orderby wowUnit.DistanceSqr select wowUnit) .ToList()); } }
private static async Task <bool> SetMountState(WoWPoint destination, NavType navType = NavType.Fly) { // Are we mounted, and not supposed to be? if (!Mount.UseMount && Me.IsMounted()) { if (await ExecuteMountStrategy(MountStrategyType.Dismount)) { return(true); } } // Are we unmounted, and mount use is permitted? // NB: We don't check for IsMounted(), in case the ExecuteMountStrategy decides a mount switch is necessary // (based on NavType). if (Mount.UseMount && destination.CollectionDistance(WoWMovement.ActiveMover.Location) > CharacterSettings.Instance.MountDistance) { if (await ExecuteMountStrategy(MountStrategyType.Mount, navType)) { return(true); } } return(false); }