Module unit.Units

Handles updating and retrieving units (enemies and friends) within the game.

Functions

API.UpdateHealTarget (range) Updates the primary heal target based on priority, dispellable status, and lowest health.
API.GetEnemiesInRange (range) Retrieves a list of enemy units within a specified range.
API.GetNearestEnemy (facing) Retrieves the nearest enemy unit.
API.GetLowestEnemy (facing) Retrieves the enemy unit with the lowest health.
Unit:GetEnemiesInSplashRangeCount (range) Retrieves the count of enemy units within a specified splash range around this unit.
Unit:GetEnemiesInSplashRange (range) Retrieves a table of enemy units within a specified splash range around this unit.
API.GetFriendsInRange (range) Retrieves a list of friendly units within a specified range.
API.GetLowestFriend (range, condition) Retrieves the friendly unit with the lowest health within a specified range, optionally filtered by a condition.
API.GetFriendsHP (range) Calculates the average health percentage of friendly units within a specified range.
API.GetFriendsBelowHP (hp, range) Retrieves a list of friendly units whose health percentage is below or equal to a specified value, within a given range.
API.GetFriendsBelowHPCount (hp, range) Retrieves the count of friendly units whose health percentage is below or equal to a specified value, within a given range.
API.GetDispellableFriend (range) Retrieves the most dispellable friendly unit within a specified range.
Unit:IsPriorityHealTarget (self) Checks if this unit is a priority heal target.
API.GetPriorityFriend (range) Retrieves a priority friendly unit within a specified range.
API.GetMainTank (range) Retrieves the first friendly tank found within a specified range.
API.GetHighestDPSUnits (range) Retrieves a sorted list of friendly units by their total damage dealt (highest DPS first), within a specified range.
API.GetHighestHealUnits (range) Retrieves a sorted list of friendly units by their total healing done (highest healing first), within a specified range.
Unit:GetFriendsInSplashRangeCount (range, hp) Retrieves the count of friendly units within a specified splash range around this unit, optionally filtering by health percentage.
Unit:GetFriendsInSplashRange (range, hp) Retrieves a table of friendly units within a specified splash range around this unit, optionally filtering by health percentage.
API.GetHealTarget () Retrieves the currently set heal target.


Functions

API.UpdateHealTarget (range)
Updates the primary heal target based on priority, dispellable status, and lowest health.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    boolean True if a new heal target was set, false otherwise.
API.GetEnemiesInRange (range)
Retrieves a list of enemy units within a specified range.

Parameters:

  • range number The maximum range to consider enemies.

Returns:

    table A table of enemy unit objects within the specified range.
API.GetNearestEnemy (facing)
Retrieves the nearest enemy unit.

Parameters:

  • facing boolean|nil If true, only considers enemies that are not facing blacklisted.

Returns:

    Unit|nil The nearest enemy unit, or nil if no enemies are found.
API.GetLowestEnemy (facing)
Retrieves the enemy unit with the lowest health.

Parameters:

  • facing boolean|nil If true, only considers enemies that are not facing blacklisted.

Returns:

    Unit|nil The enemy unit with the lowest health, or nil if no enemies are found.
Unit:GetEnemiesInSplashRangeCount (range)
Retrieves the count of enemy units within a specified splash range around this unit.

Parameters:

  • range number The splash range to consider.

Returns:

    number The number of enemy units within the splash range. Returns 0 if the unit does not exist or ForceSingleTarget is enabled.
Unit:GetEnemiesInSplashRange (range)
Retrieves a table of enemy units within a specified splash range around this unit.

Parameters:

  • range number The splash range to consider.

Returns:

    table A table of enemy unit objects within the splash range. Returns an empty table if the unit does not exist or ForceSingleTarget is enabled.
API.GetFriendsInRange (range)
Retrieves a list of friendly units within a specified range.

Parameters:

  • range number The maximum range to consider friends.

Returns:

    table A table of friendly unit objects within the specified range.
API.GetLowestFriend (range, condition)
Retrieves the friendly unit with the lowest health within a specified range, optionally filtered by a condition.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.
  • condition function|nil An optional function that takes a unit as input and returns true if the unit should be considered, false otherwise.

Returns:

    Unit|nil The friendly unit with the lowest health, or nil if no suitable friends are found.
API.GetFriendsHP (range)
Calculates the average health percentage of friendly units within a specified range.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    number The average health percentage of friendly units, or 0 if no valid friends are found.
API.GetFriendsBelowHP (hp, range)
Retrieves a list of friendly units whose health percentage is below or equal to a specified value, within a given range.

Parameters:

  • hp number The maximum health percentage for units to be included.
  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    table A table of friendly unit objects that meet the criteria.
API.GetFriendsBelowHPCount (hp, range)
Retrieves the count of friendly units whose health percentage is below or equal to a specified value, within a given range.

Parameters:

  • hp number The maximum health percentage for units to be counted.
  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    number The number of friendly units that meet the criteria.
API.GetDispellableFriend (range)
Retrieves the most dispellable friendly unit within a specified range. Dispellability is determined by the highest stack of dispellable debuffs, then by the longest duration.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    Unit|nil The most dispellable friendly unit, or nil if none are found.
Unit:IsPriorityHealTarget (self)
Checks if this unit is a priority heal target. A unit is a priority heal target if their health is not full and they match a priority NPC ID or have a priority debuff.

Parameters:

  • self Unit The unit object.

Returns:

    boolean True if the unit is a priority heal target, false otherwise.
API.GetPriorityFriend (range)
Retrieves a priority friendly unit within a specified range. A priority friend is a unit that meets the criteria defined in Unit:IsPriorityHealTarget.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    Unit|nil A priority friendly unit, or nil if none are found.
API.GetMainTank (range)
Retrieves the first friendly tank found within a specified range.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    Unit|nil The friendly tank unit, or nil if no tank is found.
API.GetHighestDPSUnits (range)
Retrieves a sorted list of friendly units by their total damage dealt (highest DPS first), within a specified range. The sorting is only applied if Details is available and the segment elapsed time is greater than 5 seconds.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    table A table of friendly unit objects, sorted by DPS.
API.GetHighestHealUnits (range)
Retrieves a sorted list of friendly units by their total healing done (highest healing first), within a specified range. The sorting is only applied if Details is available and the segment elapsed time is greater than 5 seconds.

Parameters:

  • range number|nil The maximum range to consider units. Defaults to 40 yards.

Returns:

    table A table of friendly unit objects, sorted by healing.
Unit:GetFriendsInSplashRangeCount (range, hp)
Retrieves the count of friendly units within a specified splash range around this unit, optionally filtering by health percentage.

Parameters:

  • range number The splash range to consider.
  • hp number|nil The maximum health percentage for units to be counted. Defaults to 100.

Returns:

    number The number of friendly units within the splash range. Returns 0 if the unit does not exist or ForceSingleTarget is enabled.
Unit:GetFriendsInSplashRange (range, hp)
Retrieves a table of friendly units within a specified splash range around this unit, optionally filtering by health percentage.

Parameters:

  • range number The splash range to consider.
  • hp number|nil The maximum health percentage for units to be included. Defaults to 100.

Returns:

    table A table of friendly unit objects within the splash range. Returns an empty table if the unit does not exist or ForceSingleTarget is enabled.
API.GetHealTarget ()
Retrieves the currently set heal target.

Returns:

    Unit The current heal target unit.
generated by LDoc 1.5.0 Last updated 2025-08-07 15:27:51