Class Unit [-] [+]
Represents a non-Player controlled Unit (i.e. NPCs).
Inherits all methods from: Object, WorldObject
Methods
| AddAura | Adds the Aura of the given spell entry on the given target from the Unit. |
| AddThreat | Adds threat to the Unit from the victim. |
| AddUnitState | Adds the given unit state for the Unit. |
| Attack | The Unit tries to attack a given target |
| AttackStop | The Unit stops attacking its target |
| CastCustomSpell | Casts the Spell at target Unit with custom basepoints or casters. See also Unit:CastSpell. |
| CastSpell | Makes the Unit cast the spell on the target. |
| CastSpellAoF | Makes the Unit cast the spell to the given coordinates, used for area effect spells. |
| ClearInCombat | Clears the Unit's combat |
| ClearThreat | Clear the threat of a Unit in the threat list. |
| ClearThreatList | Clears the Unit's threat list. |
| ClearUnitState | Removes the given unit state from the Unit. |
| CountPctFromCurHealth | Returns calculated percentage from Health |
| CountPctFromMaxHealth | Returns calculated percentage from Max Health |
| DeMorph | Unmorphs the Unit setting it's display ID back to the native display ID. |
| DealDamage | Makes the Unit damage the target Unit |
| DealHeal | Makes the Unit heal the target Unit with given spell |
| Dismount | Dismounts the Unit. |
| EmoteState | Makes the Unit perform the given emote continuously. |
| GetAttackers | Returns the Unit's attackers. |
| GetAura | Returns the Aura of the given spell entry on the Unit or nil. |
| GetAuras | Returns a table containing all Auras applied on the Unit. |
| GetBaseSpellPower | Returns the Unit's base spell power |
| GetCharmGUID | Returns the GUID of the Unit's charmed entity. |
| GetCharmerGUID | Returns the Unit's charmer's GUID. |
| GetClass | Returns the Unit's class ID. |
| GetClassAsString | Returns the Unit's class' name in given or default locale or nil. |
| GetClassMask | Returns the class mask |
| GetControllerGUID | Returns the GUID of the Unit's charmer or owner. |
| GetControllerGUIDS | Returns the GUID of the Unit's charmer or owner or its own GUID. |
| GetCreatorGUID | Returns the Unit's creator's GUID. |
| GetCreatureType | Returns the Unit's creature type ID (enumerated in CreatureType.dbc). |
| GetCritterGUID | Returns the Critter Guid |
| GetCurrentSpell | Returns the currently casted Spell of given type or nil. |
| GetDisplayId | Returns the Unit's current display ID. |
| GetFaction | Returns the Unit's faction ID. |
| GetFriendlyUnitsInRange | Returns a table containing friendly Unit's within given range of the Unit. |
| GetGender | Returns the Unit's gender. |
| GetHealth | Returns the Unit's health amount. |
| GetHealthPct | Returns the Unit's health percent. |
| GetLevel | Returns the Unit's level. |
| GetMaxHealth | Returns the Unit's max health. |
| GetMaxPower | Returns the Unit's max power amount for given power type. |
| GetMountId | Returns the Unit's mount's modelID. |
| GetMovementType | Returns the current movement type for this Unit. |
| GetNativeDisplayId | Returns the Unit's native/original display ID. |
| GetOwner | Returns the Unit's owner. |
| GetOwnerGUID | Returns the Unit's owner's GUID. |
| GetPetGUID | Returns the GUID of the Unit's pet. |
| GetPower | Returns the Unit's power amount for given power type. |
| GetPowerPct | Returns the Unit's power percent for given power type. |
| GetPowerType | Returns the Unit's current power type. |
| GetRace | Returns the Unit's race ID. |
| GetRaceAsString | Returns the Unit's race's name in given or default locale or nil. |
| GetRaceMask | Returns the race mask |
| GetSpeed | Returns the Unit's speed of given [UnitMoveType]. |
| GetSpeedRate | Returns the Unit's speed rate of given [UnitMoveType]. |
| GetStandState | Returns the Unit's current stand state. |
| GetStat | Returns Unit's specified stat |
| GetThreat | Returns the threat of a Unit. |
| GetThreatList | Returns the Unit's threat list. |
| GetUnfriendlyUnitsInRange | Returns a table containing unfriendly Unit's within given range of the Unit. |
| GetVehicleKit | Returns Unit's Vehicle methods |
| GetVictim | Returns the Unit's current victim target or nil. |
| GetVisibleAuras | Returns a table containing the Auras shown on the Units buff bar, ordered by aura slot. |
| HandleStatFlatModifier | The Unit modifies a specific stat |
| HasAura | Returns true if the Unit has an aura from the given spell entry. |
| HasUnitState | Returns true if the Unit has the given unit state. |
| HealthAbovePct | Returns true if the Unit's health is above the given percentage. |
| HealthBelowPct | Returns true if the Unit's health is below the given percentage. |
| InterruptSpell | Interrupts Unit's spell state, casting, etc. |
| IsAlive | Returns true if the Unit is alive. |
| IsArmorer | Returns true if the Unit is an armorer and can repair equipment. |
| IsAttackingPlayer | Returns true if the Unit is attacking a player. |
| IsAuctioneer | Returns true if the Unit an auctioneer. |
| IsBanker | Returns true if the Unit is a banker. |
| IsBattleMaster | Returns true if the Unit is a battle master. |
| IsCasting | Returns true if the Unit is casting a spell |
| IsCharmed | Returns true if the Unit is a charmed. |
| IsDead | Returns true if the Unit is dead. |
| IsDying | Returns true if the Unit is dying. |
| IsFullHealth | Returns true if the Unit has full health. |
| IsGossip | Returns true if the Unit is able to show a gossip window. |
| IsGuildMaster | Returns true if the Unit a guild master. |
| IsInAccessiblePlaceFor | Returns true if the Unit is in an accessible place for the given Creature. |
| IsInCombat | Returns true if the Unit is in combat. |
| IsInWater | Returns true if the Unit is in water. |
| IsInnkeeper | Returns true if the Unit an innkeeper. |
| IsMounted | Returns true if the Unit is mounted. |
| IsOnVehicle | Returns true if the Unit is on a Vehicle. |
| IsPvPFlagged | Returns true if the Unit flagged for PvP. |
| IsQuestGiver | Returns true if the Unit is a quest giver. |
| IsRooted | Returns true if the Unit is rooted. |
| IsServiceProvider | Returns true if the Unit provides services like vendor, training and auction. |
| IsSpiritGuide | Returns true if the Unit is a spirit guide. |
| IsSpiritHealer | Returns true if the Unit is a spirit healer. |
| IsSpiritService | Returns true if the Unit is a spirit guide or spirit healer. |
| IsStandState | Returns true if the Unit is standing. |
| IsStopped | Returns true if the Unit is not moving. |
| IsTabardDesigner | Returns true if the Unit is a tabard designer. |
| IsTaxi | Returns true if the Unit is a taxi master. |
| IsTrainer | Returns true if the Unit a trainer. |
| IsUnderWater | Returns true if the Unit is under water. |
| IsVendor | Returns true if the Unit is a vendor. |
| Kill | Makes the Unit kill the target Unit |
| ModifyPower | modifies the Unit's power amount for the given power type. |
| ModifyThreatPct | Modifies threat in pct to the Unit from the victim |
| Mount | Mounts the Unit on the given displayID/modelID. |
| MoveChase | The Unit will chase the target |
| MoveClear | Clears the Unit's movement |
| MoveConfused | The Unit will move confused |
| MoveExpire | The Unit's movement expires and clears movement |
| MoveFleeing | The Unit will flee |
| MoveFollow | The Unit will follow the target |
| MoveHome | The Unit will move to its set home location |
| MoveIdle | The Unit will be idle |
| MoveJump | Makes the Unit jump to the coordinates |
| MoveRandom | The Unit will move at random |
| MoveStop | Stops the Unit's movement |
| MoveTo | The Unit will move to the coordinates |
| NearTeleport | Makes the Unit teleport to given coordinates within same map. |
| PerformEmote | Makes the Unit perform the given emote. |
| RemoveAllAuras | Removes all Aura's from the Unit. |
| RemoveArenaAuras | Removes all positive visible Aura's from the Unit. |
| RemoveAura | Removes Aura of the given spell entry from the Unit. |
| ResetAllThreat | Resets the Unit's threat list, setting all threat targets' threat to 0. |
| SendChatMessageToPlayer | Sends chat message to Player |
| SendUnitEmote | The Unit will emote the message |
| SendUnitSay | The Unit will say the message |
| SendUnitWhisper | The Unit will whisper the message to a Player |
| SendUnitYell | The Unit will yell the message |
| SetConfused | Confuses the Unit, if 'false' specified, the Unit is no longer confused. |
| SetCreatorGUID | Sets creator GUID |
| SetCritterGUID | Sets the Unit's critter companion by GUID. |
| SetDisplayId | Sets the Unit's modelID. |
| SetFFA | Sets the Unit's FFA flag on or off. |
| SetFacing | Sets the Unit's facing/orientation. |
| SetFacingToObject | Sets the Unit to face the given WorldObject's direction. |
| SetFaction | Sets the Unit's faction. |
| SetFeared | Fears the Unit, if 'false' specified, the Unit is no longer feared. |
| SetHealth | Sets the Unit's health. |
| SetImmuneTo | Sets a mechanic immunity for the Unit. |
| SetInCombatWith | Sets the Unit in combat with the enemy Unit. |
| SetLevel | Sets the Unit's level. |
| SetMaxHealth | Sets the Unit's max health. |
| SetMaxPower | Sets the Unit's max power amount for the given power type. |
| SetName | Sets the Unit's name internally. |
| SetNativeDisplayId | Sets the Unit's native/default modelID. |
| SetOwnerGUID | Sets the Unit's owner GUID to given GUID. |
| SetPetGUID | Sets pet GUID |
| SetPower | Sets the Unit's power amount for the given power type. |
| SetPowerType | Sets the Unit's power type. |
| SetPvP | Sets the Unit's PvP on or off. |
| SetRooted | Roots the Unit to the ground, if 'false' specified, unroots the Unit. |
| SetSanctuary | Sets the Unit's sanctuary flag on or off. |
| SetSheath | Sets the Unit's sheath state. |
| SetSpeed | Sets the Unit's speed of given [UnitMoveType] to given speed. If forced, packets sent to clients forcing the visual change. |
| SetSpeedRate | Sets the Unit's speed rate of given [UnitMoveType] to given rate. If forced, packets sent to clients forcing the visual change. |
| SetStandState | Sets the Unit's stand state |
| SetWaterWalk | Toggles (Sets) Unit's water walking |
| StopSpellCast | Stops the Unit's current spell cast |