Module unit.Player.Main

This is the Player unit module.

Functions

Player:IsInitialSpec () Checks if the player is currently in their initial specialization.
Player:SpecIndex () Returns the index of the player's current specialization.
Player:SpecID () Returns the ID of the player's current specialization.
Player:SpecName () Returns the localized name of the player's current specialization.
Player:IsMounted () Checks if the player is currently mounted or in a travel form that provides a mount-like state.
Player:IsInParty () Checks if the player is currently in a party.
Player:IsInRaid () Checks if the player is currently in a raid group.
Player:IsInGroup () Checks if the player is currently in any group (party or raid).
Player:GroupSize () Returns the number of members in the player's current group (party or raid).
Player:Race () Get the player's current race.
Player:IsRace (race) Checks if the player's race matches the given race.
Player:HeroTree () Returns the name of the player's active Hero Tree.
Player:HeroTreeID () Returns the ID of the player's active Hero Tree.
Player:ListHeroTrees () Returns a table of all known Hero Trees for the player.
Player:IsInVehicle () Checks if the player is currently in a vehicle.
Player:ActiveMitigationNeeded () Checks if active mitigation is needed for the player, based on current target's casts and buffs/debuffs.
API.AoeDamageIncoming () Checks if AoE damage is incoming from the current target.
Player:StealthRemains (checkCombat, checkSpecial, bypassRecovery) Returns the remaining duration of any active stealth effect on the player.
Player:StealthUp (checkCombat, checkSpecial, bypassRecovery) Checks if the player is currently in a stealth effect.
Player:StealthDown (checkCombat, checkSpecial, bypassRecovery) Checks if the player is NOT currently in a stealth effect.
Player:HealingAbsorbed () Checks if the player has any healing absorption debuffs active.
Player:UpdateSpells () Updates the list of spells learned by the player and their pet.
Player:UpdateTalents () Updates the list of talents learned by the player.
Player:HasTalent (id) Checks if the player has a specific talent by its ID.
Player:UpdateGlyphs () Updates the list of glyphs known by the player.
Player:HasGlyph (id) Checks if the player has a specific glyph by its ID.
Player:GetTotemInfo (totemNumber) Retrieves information about a specific totem.
Player:TotemRemains (totemNumber) Returns the remaining duration of a specific totem.
Player:TotemName (totemNumber) Returns the name of a specific totem.
Player:GCD () Returns the player's Global Cooldown (GCD) in seconds.
Player:GCDRemains () Returns the remaining time on the player's Global Cooldown (GCD).
Player:GCDStartTime () Returns the start time of the player's last Global Cooldown (GCD).
Player:AttackPower () Returns the player's current Attack Power.
Player:AttackPowerDamageMod (offHand) Calculates the player's Attack Power Damage Modifier, considering main hand or off-hand.
Player:CritChancePct () Returns the player's current Critical Chance percentage.
Player:HastePct () Returns the player's current Haste percentage.
Player:SpellHaste () Returns the player's Spell Haste modifier.
Player:MasteryPct () Returns the player's current Mastery percentage.
Player:VersatilityDmgPct () Returns the player's Versatility Damage Done percentage.
Player:InstanceInfo () Returns detailed information about the current instance.
Player:InstanceType () Returns the type of the current instance.
Player:InstanceID () Returns the ID of the current instance.
Player:InstanceDifficulty () Returns the difficulty of the current instance.
Player:IsInInstancedPvP () Checks if the player is currently in an instanced PvP area (Arena or Battleground).
Player:IsInRaidArea () Checks if the player is currently in a raid area.
Player:IsInDungeonArea () Checks if the player is currently in a dungeon area.
Player:IsInInstanceArea () Checks if the player is currently in any instance area (raid, dungeon, or instanced PvP).


Functions

Player:IsInitialSpec ()
Checks if the player is currently in their initial specialization. This typically means a specialization that is not a class-specific one, or before any specialization is chosen.

Returns:

    boolean True if the player is in an initial specialization, false otherwise.
Player:SpecIndex ()
Returns the index of the player's current specialization. If the player is in their initial specialization, it returns 1.

Returns:

    number The index of the current specialization.
Player:SpecID ()
Returns the ID of the player's current specialization.

Returns:

    number The ID of the current specialization.
Player:SpecName ()
Returns the localized name of the player's current specialization.

Returns:

    string The name of the current specialization.
Player:IsMounted ()
Checks if the player is currently mounted or in a travel form that provides a mount-like state.

Returns:

    boolean True if the player is mounted or in a mount-like form, false otherwise.
Player:IsInParty ()
Checks if the player is currently in a party.

Returns:

    boolean True if the player is in a party, false otherwise.
Player:IsInRaid ()
Checks if the player is currently in a raid group.

Returns:

    boolean True if the player is in a raid group, false otherwise.
Player:IsInGroup ()
Checks if the player is currently in any group (party or raid).

Returns:

    boolean True if the player is in a party or raid, false otherwise.
Player:GroupSize ()
Returns the number of members in the player's current group (party or raid).

Returns:

    number The number of group members.
Player:Race ()
Get the player's current race.

Returns:

    string The localized name of the player's race (e.g., "Dwarf", "Human", "Orc").
Player:IsRace (race)
Checks if the player's race matches the given race.

Parameters:

  • race string The race name to check against (e.g., "Dwarf").

Returns:

    boolean True if the player's race matches the input, false otherwise.
Player:HeroTree ()
Returns the name of the player's active Hero Tree.

Returns:

    string|nil The name of the active hero tree, or nil if none is active.
Player:HeroTreeID ()
Returns the ID of the player's active Hero Tree.

Returns:

    number|nil The ID of the active hero tree, or nil if none is active.
Player:ListHeroTrees ()
Returns a table of all known Hero Trees for the player.

Returns:

    table A table where keys are Hero Tree IDs and values are their names.
Player:IsInVehicle ()
Checks if the player is currently in a vehicle. This function also considers a whitelist of debuffs that, if present, mean the player is *not* truly in a vehicle.

Returns:

    boolean True if the player is in a vehicle, false otherwise.
Player:ActiveMitigationNeeded ()
Checks if active mitigation is needed for the player, based on current target's casts and buffs/debuffs. This function considers if the player is tanking the target or if the target is a valid enemy.

Returns:

    boolean True if active mitigation is needed, false otherwise.
API.AoeDamageIncoming ()
Checks if AoE damage is incoming from the current target.

Returns:

    boolean True if AoE damage is incoming, false otherwise.
Player:StealthRemains (checkCombat, checkSpecial, bypassRecovery)
Returns the remaining duration of any active stealth effect on the player.

Parameters:

  • checkCombat boolean Optional. If true, also checks for combat stealth effects.
  • checkSpecial boolean Optional. If true, also checks for special stealth effects (e.g., Shadowmeld).
  • bypassRecovery boolean Optional. If true, recovery debuffs are bypassed when checking buff uptime.

Returns:

    number The remaining duration in seconds, or 0 if no stealth effect is active.
Player:StealthUp (checkCombat, checkSpecial, bypassRecovery)
Checks if the player is currently in a stealth effect.

Parameters:

  • checkCombat boolean Optional. If true, also checks for combat stealth effects.
  • checkSpecial boolean Optional. If true, also checks for special stealth effects (e.g., Shadowmeld).
  • bypassRecovery boolean Optional. If true, recovery debuffs are bypassed when checking buff uptime.

Returns:

    boolean True if the player is in stealth, false otherwise.
Player:StealthDown (checkCombat, checkSpecial, bypassRecovery)
Checks if the player is NOT currently in a stealth effect.

Parameters:

  • checkCombat boolean Optional. If true, also checks for combat stealth effects.
  • checkSpecial boolean Optional. If true, also checks for special stealth effects (e.g., Shadowmeld).
  • bypassRecovery boolean Optional. If true, recovery debuffs are bypassed when checking buff uptime.

Returns:

    boolean True if the player is not in stealth, false otherwise.
Player:HealingAbsorbed ()
Checks if the player has any healing absorption debuffs active.

Returns:

    boolean True if the player is currently experiencing healing absorption, false otherwise.
Player:UpdateSpells ()
Updates the list of spells learned by the player and their pet. This function queries the game's spellbook APIs to populate `Player.spellLearned`. Supports different logic for Retail and Mists of Pandaria expansions.
Player:UpdateTalents ()
Updates the list of talents learned by the player. This function queries the game's talent APIs to populate `Player.talents` and `Player.heroTrees`. Supports different logic for Retail and Mists of Pandaria expansions.
Player:HasTalent (id)
Checks if the player has a specific talent by its ID.

Parameters:

  • id number The ID of the talent to check.

Returns:

    boolean True if the player has the talent, false otherwise.
Player:UpdateGlyphs ()
Updates the list of glyphs known by the player. This function only applies to the Mists of Pandaria expansion.
Player:HasGlyph (id)
Checks if the player has a specific glyph by its ID.

Parameters:

  • id number The ID of the glyph to check.

Returns:

    boolean True if the player has the glyph, false otherwise.
Player:GetTotemInfo (totemNumber)
Retrieves information about a specific totem.

Parameters:

  • totemNumber number The index of the totem (1-4).

Returns:

  1. boolean haveTotem True if the totem exists.
  2. string totemName The name of the totem.
  3. number startTime The time the totem was cast (GetTime()).
  4. number duration The total duration of the totem.
Player:TotemRemains (totemNumber)
Returns the remaining duration of a specific totem.

Parameters:

  • totemNumber number The index of the totem (1-4).

Returns:

    number The remaining duration in seconds, or 0 if the totem is not active or has expired.
Player:TotemName (totemNumber)
Returns the name of a specific totem.

Parameters:

  • totemNumber number The index of the totem (1-4).

Returns:

    string The name of the totem, or 0 if no totem is found at that index.
Player:GCD ()
Returns the player's Global Cooldown (GCD) in seconds. The GCD can be affected by haste and specializations.

Returns:

    number The Global Cooldown duration in seconds.
Player:GCDRemains ()
Returns the remaining time on the player's Global Cooldown (GCD).

Returns:

    number The remaining GCD time in seconds.
Player:GCDStartTime ()
Returns the start time of the player's last Global Cooldown (GCD).

Returns:

    number The start time of the GCD.
Player:AttackPower ()
Returns the player's current Attack Power.

Returns:

    number The player's Attack Power.
Player:AttackPowerDamageMod (offHand)
Calculates the player's Attack Power Damage Modifier, considering main hand or off-hand.

Parameters:

  • offHand boolean Optional. If true, calculates for the off-hand weapon.

Returns:

    number The calculated Attack Power Damage Modifier.
Player:CritChancePct ()
Returns the player's current Critical Chance percentage.

Returns:

    number The Critical Chance percentage.
Player:HastePct ()
Returns the player's current Haste percentage.

Returns:

    number The Haste percentage.
Player:SpellHaste ()
Returns the player's Spell Haste modifier.

Returns:

    number The Spell Haste modifier.
Player:MasteryPct ()
Returns the player's current Mastery percentage.

Returns:

    number The Mastery percentage.
Player:VersatilityDmgPct ()
Returns the player's Versatility Damage Done percentage.

Returns:

    number The Versatility Damage Done percentage.
Player:InstanceInfo ()
Returns detailed information about the current instance.

Returns:

    tuple Various instance information (e.g., instance type, difficulty, ID).
Player:InstanceType ()
Returns the type of the current instance.

Returns:

    string The instance type (e.g., "arena", "pvp", "raid", "party").
Player:InstanceID ()
Returns the ID of the current instance.

Returns:

    number The instance ID.
Player:InstanceDifficulty ()
Returns the difficulty of the current instance.

Returns:

    number The instance difficulty.
Player:IsInInstancedPvP ()
Checks if the player is currently in an instanced PvP area (Arena or Battleground).

Returns:

    boolean True if the player is in instanced PvP, false otherwise.
Player:IsInRaidArea ()
Checks if the player is currently in a raid area.

Returns:

    boolean True if the player is in a raid, false otherwise.
Player:IsInDungeonArea ()
Checks if the player is currently in a dungeon area.

Returns:

    boolean True if the player is in a dungeon, false otherwise.
Player:IsInInstanceArea ()
Checks if the player is currently in any instance area (raid, dungeon, or instanced PvP).

Returns:

    boolean True if the player is in any instance, false otherwise.
generated by LDoc 1.5.0 Last updated 2025-08-07 15:27:51