/// <summary> /// Checks for a closed door between start and end. /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="distanceFromPoint">How far to check around each point for a door object.</param> /// <param name="stride">The distance between points to check in the path.</param> /// <param name="dontLeaveFrame">Should the current frame not be left?</param> /// <returns>true if there's a closed door and false otherwise.</returns> public static bool ClosedDoorBetween( Vector2i start, Vector2i end, int distanceFromPoint = 10, int stride = 10, bool dontLeaveFrame = false) { var doors = LokiPoe.ObjectManager.Doors.Where(d => !d.IsOpened).ToList(); if (!doors.Any()) { return(false); } var path = ExilePather.GetPointsOnSegment(start, end, dontLeaveFrame); for (var i = 0; i < path.Count; i += stride) { if (doors.Any(door => door.Position.Distance(path[i]) <= distanceFromPoint)) { return(true); } } return(false); }
/// <summary> /// Returns the number of mobs between 2 points /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="distanceFromPoint"></param> /// <param name="dontLeaveFrame">Should the current frame not be left?</param> /// <returns></returns> public static int NumberOfMobsBetween(Vector2i start, Vector2i end, int distanceFromPoint = 5, bool dontLeaveFrame = false) { var mobs = LokiPoe.ObjectManager.GetObjectsByType <Monster>().Where(d => d.IsActive).ToList(); if (!mobs.Any()) { return(0); } var path = ExilePather.GetPointsOnSegment(start, end, dontLeaveFrame); var count = 0; for (var i = 0; i < path.Count; i += 10) { count += mobs.Count(mob => mob.Position.Distance(path[i]) <= distanceFromPoint); } return(count); }