多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
These are functions which act on one or more units. Units are identified by[UnitIds](https://wow.gamepedia.com/UnitId "UnitId"). [GetUnitSpeed](https://wow.gamepedia.com/API_GetUnitSpeed "API GetUnitSpeed")("unit") - Returns the moving speed of the unit. [UnitAffectingCombat](https://wow.gamepedia.com/API_UnitAffectingCombat "API UnitAffectingCombat")("unit") - Determine if the unit is in combat or has aggro. (returns nil if "false" and 1 if "true") [UnitAlternatePowerCounterInfo](https://wow.gamepedia.com/index.php?title=API_UnitAlternatePowerCounterInfo&action=edit&redlink=1 "API UnitAlternatePowerCounterInfo (page does not exist)")("unit") [UnitAlternatePowerInfo](https://wow.gamepedia.com/index.php?title=API_UnitAlternatePowerInfo&action=edit&redlink=1 "API UnitAlternatePowerInfo (page does not exist)")("unit") [UnitAlternatePowerTextureInfo](https://wow.gamepedia.com/index.php?title=API_UnitAlternatePowerTextureInfo&action=edit&redlink=1 "API UnitAlternatePowerTextureInfo (page does not exist)")("unit", textureIndex, \[timerIndex\]) [UnitArmor](https://wow.gamepedia.com/API_UnitArmor "API UnitArmor")("unit") - Returns the armor statistics relevant to the specified unit. [UnitAttackPower](https://wow.gamepedia.com/API_UnitAttackPower "API UnitAttackPower")("unit") - Returns the unit's melee attack power and modifiers. [UnitAttackSpeed](https://wow.gamepedia.com/API_UnitAttackSpeed "API UnitAttackSpeed")("unit") - Returns the unit's melee attack speed for each hand. [UnitCanAssist](https://wow.gamepedia.com/API_UnitCanAssist "API UnitCanAssist")("unit", "otherUnit") - Indicates whether the first unit can assist the second unit. [UnitCanAttack](https://wow.gamepedia.com/API_UnitCanAttack "API UnitCanAttack")("unit", "otherUnit") - Returns true if the first unit can attack the second, false otherwise. [UnitCanCooperate](https://wow.gamepedia.com/API_UnitCanCooperate "API UnitCanCooperate")("unit", "otherUnit") - Returns true if the first unit can cooperate with the second, false otherwise. [UnitCanPetBattle](https://wow.gamepedia.com/index.php?title=API_UnitCanPetBattle&action=edit&redlink=1 "API UnitCanPetBattle (page does not exist)")() [UnitCastingInfo](https://wow.gamepedia.com/API_UnitCastingInfo "API UnitCastingInfo")("unit") - Returns information about the spell currently being cast by the specified unit. [UnitChannelInfo](https://wow.gamepedia.com/API_UnitChannelInfo "API UnitChannelInfo")("unit") - Returns information about the spell currently being channeled by the specified unit. [UnitClass](https://wow.gamepedia.com/API_UnitClass "API UnitClass")("unit") - Returns the class name of the specified unit (e.g., "Warrior" or "Shaman"). [UnitClassBase](https://wow.gamepedia.com/API_UnitClassBase "API UnitClassBase")("unit") [UnitClassification](https://wow.gamepedia.com/API_UnitClassification "API UnitClassification")("unit") - Returns the classification of the specified unit (e.g., "elite" or "worldboss"). [UnitCreatureFamily](https://wow.gamepedia.com/API_UnitCreatureFamily "API UnitCreatureFamily")("unit") - Returns the type of creature of the specified unit (e.g., "Crab"). [UnitCreatureType](https://wow.gamepedia.com/API_UnitCreatureType "API UnitCreatureType")("unit") - Returns the classification type of creature of the specified unit (e.g., "Beast"). [UnitDamage](https://wow.gamepedia.com/API_UnitDamage "API UnitDamage")("unit") - Returns the damage statistics relevant to the specified unit. [UnitDetailedThreatSituation](https://wow.gamepedia.com/API_UnitDetailedThreatSituation "API UnitDetailedThreatSituation")("unit", "unitMob") - Returns detailed information about the specified unit's threat on a mob. [UnitDistanceSquared](https://wow.gamepedia.com/API_UnitDistanceSquared "API UnitDistanceSquared")("unit") - Returns the squared distance to a unit in your group. [UnitEffectiveLevel](https://wow.gamepedia.com/API_UnitEffectiveLevel "API UnitEffectiveLevel")() [UnitExists](https://wow.gamepedia.com/API_UnitExists "API UnitExists")("unit") - Returns 1 if the specified unit exists, nil otherwise. [UnitFactionGroup](https://wow.gamepedia.com/API_UnitFactionGroup "API UnitFactionGroup")("unit") - Returns the faction group id and name of the specified unit. (eg. "Alliance") - string returned is localization-independent (used in filepath) [UnitFullName](https://wow.gamepedia.com/API_UnitFullName "API UnitFullName")() [UnitGetAvailableRoles](https://wow.gamepedia.com/index.php?title=API_UnitGetAvailableRoles&action=edit&redlink=1 "API UnitGetAvailableRoles (page does not exist)")() [UnitGetIncomingHeals](https://wow.gamepedia.com/API_UnitGetIncomingHeals "API UnitGetIncomingHeals")("unit"\[, "healer"\]) - Returns the predicted heals cast on the specified unit. [UnitGetTotalAbsorbs](https://wow.gamepedia.com/API_UnitGetTotalAbsorbs "API UnitGetTotalAbsorbs")("unit") - Returns the total amount of damage the unit can absorb before losing health. [UnitGetTotalHealAbsorbs](https://wow.gamepedia.com/API_UnitGetTotalHealAbsorbs "API UnitGetTotalHealAbsorbs")() [UnitGroupRolesAssigned](https://wow.gamepedia.com/API_UnitGroupRolesAssigned "API UnitGroupRolesAssigned")("unit") - Returns the assigned role in a group formed via the Dungeon Finder Tool. [UnitGUID](https://wow.gamepedia.com/API_UnitGUID "API UnitGUID")("unit") - Returns the GUID as a string for the specified unit matching the GUIDs used by the new combat logs. [UnitHPPerStamina](https://wow.gamepedia.com/index.php?title=API_UnitHPPerStamina&action=edit&redlink=1 "API UnitHPPerStamina (page does not exist)")() [UnitHasIncomingResurrection](https://wow.gamepedia.com/API_UnitHasIncomingResurrection "API UnitHasIncomingResurrection")("unit") - Returns whether the unit is currently being resurrected. [UnitHasLFGDeserter](https://wow.gamepedia.com/API_UnitHasLFGDeserter "API UnitHasLFGDeserter")("unit") - Returns whether the unit is currently unable to use the dungeon finder due to leaving a group prematurely. [UnitHasLFGRandomCooldown](https://wow.gamepedia.com/API_UnitHasLFGRandomCooldown "API UnitHasLFGRandomCooldown")("unit") - Returns whether the unit is currently under the effects of the random dungeon cooldown. [UnitHasRelicSlot](https://wow.gamepedia.com/index.php?title=API_UnitHasRelicSlot&action=edit&redlink=1 "API UnitHasRelicSlot (page does not exist)")("unit") [UnitHealth](https://wow.gamepedia.com/API_UnitHealth "API UnitHealth")("unit") - Returns the current health, in points, of the specified unit. [UnitHealthMax](https://wow.gamepedia.com/API_UnitHealthMax "API UnitHealthMax")("unit") - Returns the maximum health, in points, of the specified unit. [UnitInOtherParty](https://wow.gamepedia.com/index.php?title=API_UnitInOtherParty&action=edit&redlink=1 "API UnitInOtherParty (page does not exist)")() [UnitInPhase](https://wow.gamepedia.com/index.php?title=API_UnitInPhase&action=edit&redlink=1 "API UnitInPhase (page does not exist)")() [UnitIsInMyGuild](https://wow.gamepedia.com/index.php?title=API_UnitIsInMyGuild&action=edit&redlink=1 "API UnitIsInMyGuild (page does not exist)")("unit") - Returns whether the specified unit is in the same guild as the player's character. [UnitInRange](https://wow.gamepedia.com/API_UnitInRange "API UnitInRange")("unit") - Returns true if the unit (party or raid only) is in range of a typical spell such as flash heal. [UnitIsAFK](https://wow.gamepedia.com/API_UnitIsAFK "API UnitIsAFK")("unit") - Only works for friendly units. [UnitIsCharmed](https://wow.gamepedia.com/API_UnitIsCharmed "API UnitIsCharmed")("unit") - Returns true if the specified unit is charmed, false otherwise. [UnitIsConnected](https://wow.gamepedia.com/API_UnitIsConnected "API UnitIsConnected")("unit") - Returns 1 if the specified unit is connected or npc, nil if offline or not a valid unit. [UnitIsControlling](https://wow.gamepedia.com/index.php?title=API_UnitIsControlling&action=edit&redlink=1 "API UnitIsControlling (page does not exist)")() [UnitIsCorpse](https://wow.gamepedia.com/index.php?title=API_UnitIsCorpse&action=edit&redlink=1 "API UnitIsCorpse (page does not exist)")("unit") - Returns true if the specified unit is a corpse, false otherwise. [UnitIsDead](https://wow.gamepedia.com/API_UnitIsDead "API UnitIsDead")("unit") - Returns true if the specified unit is dead, nil otherwise. [UnitIsDeadOrGhost](https://wow.gamepedia.com/API_UnitIsDeadOrGhost "API UnitIsDeadOrGhost")("unit") - Returns true if the specified unit is dead or a ghost, nil otherwise. [UnitIsDND](https://wow.gamepedia.com/API_UnitIsDND "API UnitIsDND")("unit") - Only works for friendly units. [UnitIsEnemy](https://wow.gamepedia.com/API_UnitIsEnemy "API UnitIsEnemy")("unit", "otherUnit") - Returns true if the specified units are enemies, false otherwise. [UnitIsFeignDeath](https://wow.gamepedia.com/API_UnitIsFeignDeath "API UnitIsFeignDeath")("unit") - Returns true if the specified unit (must be a member of your group) is feigning death. [UnitIsFriend](https://wow.gamepedia.com/API_UnitIsFriend "API UnitIsFriend")("unit", "otherUnit") - Returns true if the specified units are friends (PC of same faction or friendly NPC), false otherwise. [UnitIsGhost](https://wow.gamepedia.com/API_UnitIsGhost "API UnitIsGhost")("unit") - Returns true if the specified unit is a ghost, false otherwise. [UnitIsGroupAssistant](https://wow.gamepedia.com/API_UnitIsGroupAssistant "API UnitIsGroupAssistant")() [UnitIsOtherPlayersPet](https://wow.gamepedia.com/index.php?title=API_UnitIsOtherPlayersPet&action=edit&redlink=1 "API UnitIsOtherPlayersPet (page does not exist)")() [UnitIsOwnerOrControllerOfUnit](https://wow.gamepedia.com/API_UnitIsOwnerOrControllerOfUnit "API UnitIsOwnerOrControllerOfUnit")("controllingUnit", "controlledUnit") [UnitIsPlayer](https://wow.gamepedia.com/API_UnitIsPlayer "API UnitIsPlayer")("unit") - Returns true if the specified unit is a player character, false otherwise. [UnitIsPossessed](https://wow.gamepedia.com/API_UnitIsPossessed "API UnitIsPossessed")("unit") - Returns whether the specified unit is currently under control of another (i.e. "pet" when casting Mind Control). [UnitIsQuestBoss](https://wow.gamepedia.com/index.php?title=API_UnitIsQuestBoss&action=edit&redlink=1 "API UnitIsQuestBoss (page does not exist)")("unit") - Returns true if the specified unit is the "boss" (objective) of a kill quest. If true, then the default UI displays a shield with a yellow "!" on it on the unit's unitframe. [UnitIsRaidOfficer](https://wow.gamepedia.com/index.php?title=API_UnitIsRaidOfficer&action=edit&redlink=1 "API UnitIsRaidOfficer (page does not exist)")("unit") - Returns whether the specified unit is an officer in your raid. [UnitIsSameServer](https://wow.gamepedia.com/API_UnitIsSameServer "API UnitIsSameServer")("unit") - Returns whether the specified unit is from the same server as the player's character. [UnitIsTapDenied](https://wow.gamepedia.com/index.php?title=API_UnitIsTapDenied&action=edit&redlink=1 "API UnitIsTapDenied (page does not exist)")() [UnitIsTrivial](https://wow.gamepedia.com/API_UnitIsTrivial "API UnitIsTrivial")("unit") - Returns true if the specified unit is trivial (Trivial means the unit is "grey" to the player. false otherwise. [UnitIsUnconscious](https://wow.gamepedia.com/index.php?title=API_UnitIsUnconscious&action=edit&redlink=1 "API UnitIsUnconscious (page does not exist)")() [UnitIsUnit](https://wow.gamepedia.com/API_UnitIsUnit "API UnitIsUnit")("unit", "otherUnit") - Determine if two units are the same unit. [UnitIsVisible](https://wow.gamepedia.com/API_UnitIsVisible "API UnitIsVisible")("unit") - 1 if visible, nil if not. [UnitLeadsAnyGroup](https://wow.gamepedia.com/index.php?title=API_UnitLeadsAnyGroup&action=edit&redlink=1 "API UnitLeadsAnyGroup (page does not exist)")() [UnitLevel](https://wow.gamepedia.com/API_UnitLevel "API UnitLevel")("unit") - Returns the level of a unit. [UnitName](https://wow.gamepedia.com/API_UnitName "API UnitName")("unit") - Returns the name (and realm name) of a unit. [UnitNumPowerBarTimers](https://wow.gamepedia.com/index.php?title=API_UnitNumPowerBarTimers&action=edit&redlink=1 "API UnitNumPowerBarTimers (page does not exist)")() [UnitPlayerControlled](https://wow.gamepedia.com/API_UnitPlayerControlled "API UnitPlayerControlled")("unit") - Returns true if the specified unit is controlled by a player, false otherwise. [UnitPlayerOrPetInParty](https://wow.gamepedia.com/API_UnitPlayerOrPetInParty "API UnitPlayerOrPetInParty")("unit") - Returns 1 if the specified unit/pet is a member of the player's party, nil otherwise (returns nil for "player" and "pet") [UnitPlayerOrPetInRaid](https://wow.gamepedia.com/API_UnitPlayerOrPetInRaid "API UnitPlayerOrPetInRaid")("unit") - Returns 1 if the specified unit/pet is a member of the player's raid, nil otherwise (returns nil for "player" and "pet") [UnitPower](https://wow.gamepedia.com/API_UnitPower "API UnitPower")("unit"\[, type\]) - Returns current power of the specified unit (Replaces[UnitMana](https://wow.gamepedia.com/API_UnitMana "API UnitMana")) [UnitPowerBarTimerInfo](https://wow.gamepedia.com/index.php?title=API_UnitPowerBarTimerInfo&action=edit&redlink=1 "API UnitPowerBarTimerInfo (page does not exist)")() [UnitPowerDisplayMod](https://wow.gamepedia.com/API_UnitPowerDisplayMod "API UnitPowerDisplayMod")(powerType) [UnitPowerMax](https://wow.gamepedia.com/API_UnitPowerMax "API UnitPowerMax")("unit"\[, type\]) - Returns max power of the specified unit (Replaces[UnitManaMax](https://wow.gamepedia.com/API_UnitManaMax "API UnitManaMax")) [UnitPowerType](https://wow.gamepedia.com/API_UnitPowerType "API UnitPowerType")("unit") - Returns a number corresponding to the power type (e.g., mana, rage or energy) of the specified unit. [UnitRace](https://wow.gamepedia.com/API_UnitRace "API UnitRace")("unit") - Returns the race name of the specified unit (e.g., "Human" or "Troll"). [UnitRangedAttackPower](https://wow.gamepedia.com/API_UnitRangedAttackPower "API UnitRangedAttackPower")("unit") - Returns the ranged attack power of the unit. [UnitRangedDamage](https://wow.gamepedia.com/API_UnitRangedDamage "API UnitRangedDamage")("unit") - Returns the ranged attack speed and damage of the unit. [UnitRealmRelationship](https://wow.gamepedia.com/API_UnitRealmRelationship "API UnitRealmRelationship")() [UnitReaction](https://wow.gamepedia.com/API_UnitReaction "API UnitReaction")("unit", "otherUnit") - Returns a number corresponding to the reaction (aggressive, neutral or friendly) of the first unit towards the second unit. [UnitSelectionColor](https://wow.gamepedia.com/API_UnitSelectionColor "API UnitSelectionColor")("unit"\[, useExtendedColors\]) - Returns RGBA values for the color of a unit's selection (the outline around and the circle underneath a player character or an NPC). [UnitSelectionType](https://wow.gamepedia.com/API_UnitSelectionType "API UnitSelectionType")("unit"\[, useExtendedColors\]) - Returns a number corresponding to the type of a unit's selection (the outline around and the circle underneath a player character or an NPC). [UnitSetRole](https://wow.gamepedia.com/API_UnitSetRole "API UnitSetRole")() [UnitSex](https://wow.gamepedia.com/API_UnitSex "API UnitSex")("unit") - Returns a code indicating the gender of the specified unit, if known. (1=unknown, 2=male, 3=female) [UnitShouldDisplayName](https://wow.gamepedia.com/index.php?title=API_UnitShouldDisplayName&action=edit&redlink=1 "API UnitShouldDisplayName (page does not exist)")() [UnitSpellHaste](https://wow.gamepedia.com/API_UnitSpellHaste "API UnitSpellHaste")("unit" or "name") - Returns the current spell haste percentage for a unit. [UnitStagger](https://wow.gamepedia.com/API_UnitStagger "API UnitStagger")() [UnitStat](https://wow.gamepedia.com/API_UnitStat "API UnitStat")("unit", statIndex) - Returns the statistics relevant to the specified unit and basic attribute (e.g., strength or intellect). [UnitThreatPercentageOfLead](https://wow.gamepedia.com/index.php?title=API_UnitThreatPercentageOfLead&action=edit&redlink=1 "API UnitThreatPercentageOfLead (page does not exist)")() [UnitThreatSituation](https://wow.gamepedia.com/API_UnitThreatSituation "API UnitThreatSituation")("unit", "mobUnit") - Returns the specified unit's threat status on a mob. [GetThreatStatusColor](https://wow.gamepedia.com/API_GetThreatStatusColor "API GetThreatStatusColor")(status) - Returns RGB values for a given UnitThreatSituation return value. [UnitTreatAsPlayerForDisplay](https://wow.gamepedia.com/API_UnitTreatAsPlayerForDisplay "API UnitTreatAsPlayerForDisplay")("unit") - Whether a unit should be treated as if it was an actual player. [UnitTrialXP](https://wow.gamepedia.com/index.php?title=API_UnitTrialXP&action=edit&redlink=1 "API UnitTrialXP (page does not exist)")("unit") [UnitTrialBankedLevels](https://wow.gamepedia.com/index.php?title=API_UnitTrialBankedLevels&action=edit&redlink=1 "API UnitTrialBankedLevels (page does not exist)")("unit") [UnitWeaponAttackPower](https://wow.gamepedia.com/index.php?title=API_UnitWeaponAttackPower&action=edit&redlink=1 "API UnitWeaponAttackPower (page does not exist)")("unit") [UnitXP](https://wow.gamepedia.com/API_UnitXP "API UnitXP")("unit") - Returns the number of experience points the specified unit has in their current level. (only works on your player) [UnitXPMax](https://wow.gamepedia.com/API_UnitXPMax "API UnitXPMax")("unit") - Returns the number of experience points the specified unit needs to reach their next level. (only works on your player) UI[GetUnitName](https://wow.gamepedia.com/API_GetUnitName "API GetUnitName")("unit", showServerName) - Returns a string with the unit's name and realm name if applicable.