Class Facades.Target

The target facade maps all the information that can be retrieved by the World of Warcraft API target related methods.

This class can also be used to access the target with many other purposes, like setting the target marker.

Methods

facades.target:getGuid () Gets the target GUID.
facades.target:getHealth () Gets the target health.
facades.target:getHealthPercentage () Gets the target health in percentage.
facades.target:getMark () Gets the target raid marker in the target, if any.
facades.target:getMaxHealth () Gets the maximum health of the specified unit.
facades.target:getName () Gets the target name.
facades.target:hasTarget () Determines whether the player has a target or not.
facades.target:isAlive () Determines whether the target is alive.
facades.target:isDead () Determines whether the target is dead.
facades.target:isMarked () Determines whether the target is marked or not.
facades.target:isNotTaggable () Determines whether the target is already tagged by other player.
facades.target:isTaggable () Determines whether the target is taggable or not.
facades.target:mark (raidMarker) Adds or removes a raid marker on the target.

Metamethods

facades.target:__construct () Target constructor.


Methods

facades.target:getGuid ()
Gets the target GUID.

Returns:

    string or nil The target GUID, or nil if the player has no target
facades.target:getHealth ()
Gets the target health.

In the World of Warcraft API, the UnitHealth('target') function behaves differently for NPCs and other players. For NPCs, it returns the absolute value of their health, whereas for players, it returns a value between 0 and 100 representing the percentage of their current health compared to their total health.

Returns:

    number or nil The target health, or nil if the player has no target
facades.target:getHealthPercentage ()
Gets the target health in percentage.

This method returns a value between 0 and 1, representing the target's health percentage.

Returns:

    number or nil The target health percentage, or nil if the player has no target
facades.target:getMark ()
Gets the target raid marker in the target, if any.

Returns:

    Models.RaidMarker or nil The target raid marker, or nil if the player has no target
facades.target:getMaxHealth ()
Gets the maximum health of the specified unit.

In the World of Warcraft API, the UnitHealthMax function is used to retrieve the maximum health of a specified unit. When you call UnitHealthMax('target'), it returns the maximum amount of health points that the targeted unit can have at full health. This function is commonly used by addon developers and players to track and display health-related information, such as health bars and percentages.

Returns:

    number or nil The maximum health of the target, or nil if the player has no target
facades.target:getName ()
Gets the target name.

Returns:

    string or nil The target name, or nil if the player has no target
facades.target:hasTarget ()
Determines whether the player has a target or not.

Returns:

    boolean Whether the player has a target or not
facades.target:isAlive ()
Determines whether the target is alive.

Returns:

    boolean or nil Whether the target is alive or not, or nil if the player has no target
facades.target:isDead ()
Determines whether the target is dead.

Returns:

    boolean or nil Whether the target is dead or not, or nil if the player has no target
facades.target:isMarked ()
Determines whether the target is marked or not.

A marked target is a target that has a raid marker on it.

Returns:

    boolean Whether the target is marked or not
facades.target:isNotTaggable ()
Determines whether the target is already tagged by other player.

Returns:

    boolean or nil Whether the target is not taggable or not, or nil if the player has no target

See also:

facades.target:isTaggable ()
Determines whether the target is taggable or not.

In Classic World of Warcraft, a taggable enemy is an enemy is an enemy that can grant experience, reputation, honor, loot, etc. Of course, that would depend on the enemy level, faction, etc. But this method checks if another player hasn't tagged the enemy before the current player.

As an example, if the player targets an enemy with a gray health bar, it means it's not taggable, then this method will return false.

Returns:

    boolean or nil Whether the target is taggable or not, or nil if the player has no target
facades.target:mark (raidMarker)
Adds or removes a raid marker on the target.

Parameters:

  • raidMarker Models.RaidMarker The raid marker to be added or removed from the target

See also:

Metamethods

facades.target:__construct ()
Target constructor.
generated by LDoc 1.5.0 Last updated 2024-09-11 16:27:53