TrinityCore
Unit Class Referenceabstract

#include <Unit.h>

Classes

struct  ValuesUpdateForPlayerWithMaskSender
 
struct  VisibleAuraSlotCompare
 

Public Types

typedef std::set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlList
 
typedef std::vector< Unit * > UnitVector
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::forward_list< AuraEffect * > AuraEffectList
 
typedef std::forward_list< Aura * > AuraList
 
typedef std::forward_list< AuraApplication * > AuraApplicationList
 
typedef std::array< DiminishingReturn, DIMINISHING_MAXDiminishing
 
typedef std::vector< std::pair< uint32, AuraApplication * > > AuraApplicationProcContainer
 
typedef std::set< AuraApplication *, VisibleAuraSlotCompareVisibleAuraContainer
 

Public Member Functions

virtual ~Unit ()
 
bool IsAIEnabled () const
 
void AIUpdateTick (uint32 diff)
 
UnitAIGetAI () const
 
void ScheduleAIChange ()
 
void PushAI (UnitAI *newAI)
 
bool PopAI ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
virtual bool IsAffectedByDiminishingReturns () const
 
DiminishingLevels GetDiminishing (DiminishingGroup group) const
 
void IncrDiminishing (SpellInfo const *auraSpellInfo)
 
bool ApplyDiminishingToDuration (SpellInfo const *auraSpellInfo, int32 &duration, WorldObject *caster, DiminishingLevels previousLevel) const
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
virtual void Update (uint32 time) override
 
void setAttackTimer (WeaponAttackType type, uint32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
uint32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
float GetCombatReach () const override
 
void SetCombatReach (float combatReach)
 
float GetBoundingRadius () const
 
void SetBoundingRadius (float boundingRadius)
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj) const
 
bool IsWithinMeleeRangeAt (Position const &pos, Unit const *obj) const
 
float GetMeleeRange (Unit const *target) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK) const =0
 
bool IsWithinBoundaryRadius (const Unit *obj) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet const & getAttackers () const
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
UnitEnsureVictim () const
 
void ValidateAttackersAndOwnTarget ()
 
void CombatStop (bool includingCast=false, bool mutualPvP=true)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 
void SendMeleeAttackStart (Unit *victim)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
int32 GetContentTuning () const
 
uint8 GetLevel () const
 
uint8 GetLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool sendUpdate=true)
 
uint8 GetRace () const
 
void SetRace (uint8 race)
 
uint64 GetRaceMask () const
 
uint8 GetClass () const
 
void SetClass (uint8 classId)
 
uint32 GetClassMask () const
 
Gender GetGender () const
 
void SetGender (Gender gender)
 
virtual Gender GetNativeGender () const
 
virtual void SetNativeGender (Gender gender)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val, int32 bonusVal)
 
int32 GetResistance (SpellSchools school) const
 
int32 GetBonusResistanceMod (SpellSchools school) const
 
int32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
void SetBonusResistanceMod (SpellSchools school, int32 val)
 
uint64 GetHealth () const
 
uint64 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint64 CountPctFromMaxHealth (int32 pct) const
 
uint64 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint64 val)
 
void SetMaxHealth (uint64 val)
 
void SetFullHealth ()
 
int64 ModifyHealth (int64 val)
 
int64 GetHealthGain (int64 dVal)
 
void TriggerOnHealthChangeAuras (uint64 oldVal, uint64 newVal)
 
virtual float GetHealthMultiplierForTarget (WorldObject const *) const
 
virtual float GetDamageMultiplierForTarget (WorldObject const *) const
 
virtual float GetArmorMultiplierForTarget (WorldObject const *) const
 
Powers GetPowerType () const
 
void SetPowerType (Powers power, bool sendUpdate=true)
 
void SetOverrideDisplayPowerId (uint32 powerDisplayId)
 
Powers CalculateDisplayPowerType () const
 
void UpdateDisplayPower ()
 
int32 GetPower (Powers power) const
 
int32 GetMinPower (Powers power) const
 
int32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
int32 CountPctFromMaxPower (Powers power, int32 pct) const
 
void SetPower (Powers power, int32 val, bool withPowerUpdate=true)
 
void SetMaxPower (Powers power, int32 val)
 
void TriggerOnPowerChangeAuras (Powers power, int32 oldVal, int32 newVal)
 
void SetFullPower (Powers power)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
void ApplyModManaCostMultiplier (float manaCostMultiplier, bool apply)
 
void ApplyModManaCostModifier (SpellSchools school, int32 mod, bool apply)
 
uint32 GetBaseAttackTime (WeaponAttackType att) const
 
void SetBaseAttackTime (WeaponAttackType att, uint32 val)
 
void UpdateAttackTimeField (WeaponAttackType att)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetModCastingSpeed (float castingSpeed)
 
void SetModSpellHaste (float spellHaste)
 
void SetModHaste (float haste)
 
void SetModRangedHaste (float rangedHaste)
 
void SetModHasteRegen (float hasteRegen)
 
void SetModTimeRate (float timeRate)
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 
void RemoveUnitFlag (UnitFlags flags)
 
void ReplaceAllUnitFlags (UnitFlags flags)
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
bool HasUnitFlag3 (UnitFlags3 flags) const
 
void SetUnitFlag3 (UnitFlags3 flags)
 
void RemoveUnitFlag3 (UnitFlags3 flags)
 
void ReplaceAllUnitFlags3 (UnitFlags3 flags)
 
void SetCreatedBySpell (int32 spellId)
 
void SetNameplateAttachToGUID (ObjectGuid guid)
 
Emote GetEmoteState () const
 
void SetEmoteState (Emote emote)
 
SheathState GetSheath () const
 
void SetSheath (SheathState sheathed)
 
uint32 GetFaction () const override
 
void SetFaction (uint32 faction) override
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
UnitPVPStateFlags GetPvpFlags () const
 
bool HasPvpFlag (UnitPVPStateFlags flags) const
 
void SetPvpFlag (UnitPVPStateFlags flags)
 
void RemovePvpFlag (UnitPVPStateFlags flags)
 
void ReplaceAllPvpFlags (UnitPVPStateFlags flags)
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
virtual void SetPvP (bool state)
 
UnitPetFlag GetPetFlags () const
 
bool HasPetFlag (UnitPetFlag flags) const
 
void SetPetFlag (UnitPetFlag flags)
 
void RemovePetFlag (UnitPetFlag flags)
 
void ReplaceAllPetFlags (UnitPetFlag flags)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
UnitStandStateType GetStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (UnitStandStateType state, uint32 animKitID=0)
 
void SetVisFlag (UnitVisFlags flags)
 
void RemoveVisFlag (UnitVisFlags flags)
 
void ReplaceAllVisFlags (UnitVisFlags flags)
 
AnimTier GetAnimTier () const
 
void SetAnimTier (AnimTier animTier, bool notifyClient=true)
 
bool IsMounted () const
 
uint32 GetMountDisplayId () const
 
void SetMountDisplayId (uint32 mountDisplayId)
 
uint32 GetCosmeticMountDisplayId () const
 
void SetCosmeticMountDisplayId (uint32 mountDisplayId)
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
MountCapabilityEntry const * GetMountCapability (uint32 mountType) const
 
void UpdateMountCapability ()
 
void SendDurabilityLoss (Player *receiver, uint32 percent)
 
void PlayOneShotAnimKitId (uint16 animKitId)
 
void SetAIAnimKitId (uint16 animKitId)
 
uint16 GetAIAnimKitId () const override
 
void SetMovementAnimKitId (uint16 animKitId)
 
uint16 GetMovementAnimKitId () const override
 
void SetMeleeAnimKitId (uint16 animKitId)
 
uint16 GetMeleeAnimKitId () const override
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void KillSelf (bool durabilityLoss=true, bool skipSettingDeathState=false)
 
void GetProcAurasTriggeredOnEvent (AuraApplicationProcContainer &aurasTriggeringProc, AuraApplicationList *procAuras, ProcEventInfo &eventInfo)
 
void TriggerAurasProcOnEvent (AuraApplicationList *myProcAuras, AuraApplicationList *targetProcAuras, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, AuraApplicationProcContainer &procAuras)
 
void HandleEmoteCommand (Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
 
void DoMeleeAttackIfReady ()
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
void SetLastDamagedTargetGuid (ObjectGuid guid)
 
ObjectGuid GetLastDamagedTargetGuid () const
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false, bool blocked=false, Spell *spell=nullptr)
 
void DealSpellDamage (SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
 
uint32 GetDamageReduction (uint32 damage) const
 
virtual bool CanApplyResilience () const
 
int32 CalculateAOEAvoidance (int32 damage, uint32 schoolMask, bool npcCaster) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, SpellInfo const *spellInfo) const override
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const override
 
float GetUnitDodgeChance (WeaponAttackType attType, Unit const *victim) const
 
float GetUnitParryChance (WeaponAttackType attType, Unit const *victim) const
 
float GetUnitBlockChance (WeaponAttackType attType, Unit const *victim) const
 
float GetUnitMissChance () const
 
float GetUnitCriticalChanceDone (WeaponAttackType attackType) const
 
float GetUnitCriticalChanceTaken (Unit const *attacker, WeaponAttackType attackType, float critDone) const
 
float GetUnitCriticalChanceAgainst (WeaponAttackType attackType, Unit const *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spellInfo) const
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual float GetBlockPercent (uint8) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
NPCFlags GetNpcFlags () const
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
NPCFlags2 GetNpcFlags2 () const
 
bool HasNpcFlag2 (NPCFlags2 flags) const
 
void SetNpcFlag2 (NPCFlags2 flags)
 
void RemoveNpcFlag2 (NPCFlags2 flags)
 
void ReplaceAllNpcFlags2 (NPCFlags2 flags)
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsAreaSpiritHealer () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsWildBattlePet () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
bool IsAreaSpiritHealerIndividual () const
 
bool IsCritter () const
 
bool IsInFlight () const
 
bool CanHaveThreatList () const
 ====================== THREAT & COMBAT ==================== More...
 
virtual bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
void EngageWithTarget (Unit *who)
 
CombatManagerGetCombatManager ()
 
CombatManager const & GetCombatManager () const
 
void AtTargetAttacked (Unit *target, bool canInitialAggro)
 
bool IsImmuneToAll () const
 
void SetImmuneToAll (bool apply, bool keepCombat)
 
virtual void SetImmuneToAll (bool apply)
 
bool IsImmuneToPC () const
 
void SetImmuneToPC (bool apply, bool keepCombat)
 
virtual void SetImmuneToPC (bool apply)
 
bool IsImmuneToNPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat)
 
virtual void SetImmuneToNPC (bool apply)
 
bool IsUninteractible () const
 
void SetUninteractible (bool apply)
 
bool CannotTurn () const
 
void SetCannotTurn (bool apply)
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
void SetInCombatWith (Unit *enemy, bool addSecondUnitSuppressed=false)
 
void ClearInCombat ()
 
void UpdatePetCombatState ()
 
bool IsThreatened () const
 
bool IsThreatenedBy (Unit const *who) const
 
ThreatManagerGetThreatManager ()
 
ThreatManager const & GetThreatManager () const
 
void SendClearTarget ()
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, flag128 familyFlags) const
 
virtual bool HasSpell (uint32) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool IsFeared () const
 
bool HasRootAura () const
 
bool IsPolymorphed () const
 
bool IsFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true) const
 
bool IsInWater () const
 
bool IsUnderWater () const
 
bool IsOnOceanFloor () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (HealInfo &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 spellId, int32 damage, int32 overEnergize, Powers powerType)
 
void EnergizeBySpell (Unit *victim, SpellInfo const *spellInfo, int32 damage, Powers powerType)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint32 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisual (Unit *target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false, float launchDelay=0.0f)
 
void SendPlaySpellVisual (Position const &targetPosition, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false, float launchDelay=0.0f)
 
void SendCancelSpellVisual (uint32 id)
 
void SendPlaySpellVisualKit (uint32 id, uint32 type, uint32 duration) const
 
void SendCancelSpellVisualKit (uint32 id)
 
void CancelSpellMissiles (uint32 spellId, bool reverseMissile=false, bool abortSpell=false)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage const *log)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId, bool isPeriodic)
 
void NearTeleportTo (Position const &pos, bool casting=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false)
 
void SendTeleportPacket (Position const &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
virtual bool UpdatePosition (Position const &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client. More...
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client. More...
 
void SendMoveKnockBack (Player *player, float speedXY, float speedZ, float vcos, float vsin)
 
void KnockbackFrom (Position const &origin, float speedXY, float speedZ, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
 
void JumpTo (float speedXY, float speedZ, float angle, Optional< Position > dest={})
 
void JumpTo (WorldObject *obj, float speedZ, bool withOrientation=false)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
 
bool IsPlayingHoverAnim () const
 
void SetPlayHoverAnim (bool enable, bool sendUpdate=true)
 
void CalculateHoverHeight ()
 
void SetHoverHeight (float hoverHeight)
 
bool IsGravityDisabled () const
 
bool IsWalking () const
 
bool IsHovering () const
 
bool SetWalk (bool enable)
 
bool SetDisableGravity (bool disable, bool updateAnimTier=true)
 
bool SetFall (bool enable)
 
bool SetSwim (bool enable)
 
bool SetCanFly (bool enable)
 
bool SetWaterWalking (bool enable)
 
bool SetFeatherFall (bool enable)
 
bool SetHover (bool enable, bool updateAnimTier=true)
 
bool SetCollision (bool disable)
 
bool SetCanTransitionBetweenSwimAndFly (bool enable)
 
bool SetCanTurnWhileFalling (bool enable)
 
bool SetCanDoubleJump (bool enable)
 
bool SetDisableInertia (bool disable)
 
void SendSetVehicleRecId (uint32 vehicleId)
 
MovementForces const * GetMovementForces () const
 
void ApplyMovementForce (ObjectGuid id, Position origin, float magnitude, MovementForceType type, Position direction={}, ObjectGuid transportGuid=ObjectGuid::Empty)
 
void RemoveMovementForce (ObjectGuid id)
 
bool SetIgnoreMovementForces (bool ignore)
 
void UpdateMovementForcesModMagnitude ()
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float const ori, bool force=true)
 
void SetFacingToObject (WorldObject const *object, bool force=true)
 
void SetFacingToPoint (Position const &point, bool force=true)
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState () const
 
virtual void setDeathState (DeathState s)
 
ObjectGuid GetOwnerGUID () const override
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const override
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetBattlePetCompanionGUID () const
 
void SetBattlePetCompanionGUID (ObjectGuid guid)
 
ObjectGuid GetDemonCreatorGUID () const
 
void SetDemonCreatorGUID (ObjectGuid guid)
 
UnitGetDemonCreator () const
 
PlayerGetDemonCreatorPlayer () const
 
ObjectGuid GetCharmerGUID () const
 
UnitGetCharmer () const
 
ObjectGuid GetCharmedGUID () const
 
UnitGetCharmed () const
 
bool IsControlledByPlayer () const
 
PlayerGetControllingPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const override
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmerOrOwner () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< TempSummon * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled ()
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void SetPetNumberForClient (uint32 petNumber)
 
void SetPetNameTimestamp (uint32 timestamp)
 
void SetMovedUnit (Unit *target)
 
UnitGetUnitBeingMoved () const
 
PlayerGetPlayerMovingMe () const
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
uint32 GetBattlePetCompanionNameTimestamp () const
 
void SetBattlePetCompanionNameTimestamp (uint32 timestamp)
 
uint32 GetBattlePetCompanionExperience () const
 
void SetBattlePetCompanionExperience (uint32 experience)
 
uint32 GetWildBattlePetLevel () const
 
void SetWildBattlePetLevel (uint32 wildBattlePetLevel)
 
Aura_TryStackingOrRefreshingExistingAura (AuraCreateInfo &createInfo)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint32 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint32 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAurasDueToAura (Aura *aura, bool owned)
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasByType (AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, uint16 num=1)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, WorldObject *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, WorldObject *stealer, int32 stolenCharges=1)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras (bool onPhaseChange=false)
 
template<typename InterruptFlags >
void RemoveAurasWithInterruptFlags (InterruptFlags flag, SpellInfo const *source=nullptr)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint64 mechanicMaskToRemove, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, uint32 exceptSpellId=0, bool withEffectMechanics=false)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAurasOnEvade ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveAllAurasExceptType (AuraType type1, AuraType type2)
 
void RemoveAllGroupBuffsFromCaster (ObjectGuid casterGUID)
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraEffectListGetAuraEffectsByType (AuraType type)
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraApplicationGetAuraApplication (uint32 spellId, std::function< bool(AuraApplication const *)> const &predicate) const
 
AuraApplicationGetAuraApplication (uint32 spellId, std::function< bool(Aura const *)> const &predicate) const
 
AuraApplicationGetAuraApplication (std::function< bool(AuraApplication const *)> const &predicate) const
 
AuraApplicationGetAuraApplication (std::function< bool(Aura const *)> const &predicate) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
AuraGetAura (uint32 spellId, std::function< bool(Aura const *)> const &predicate) const
 
AuraGetAura (std::function< bool(Aura const *)> const &predicate) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
void GetDispellableAuraList (WorldObject const *caster, uint32 dispelMask, DispelChargesList &dispelList, bool isReflect=false) const
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
 
bool HasAura (std::function< bool(Aura const *)> const &predicate) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auraType, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auraType, int32 miscValue) const
 
bool HasAuraTypeWithAffectMask (AuraType auraType, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auraType, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
template<typename InterruptFlags >
bool HasNegativeAuraWithInterruptFlag (InterruptFlags flag, ObjectGuid guid=ObjectGuid::Empty) const
 
bool HasAuraWithMechanic (uint64 mechanicMask) const
 
bool HasStrongerAuraWithDR (SpellInfo const *auraSpellInfo, Unit *caster) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, bool remove=false)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifier (AuraType auraType) const
 
float GetTotalAuraMultiplier (AuraType auraType) const
 
int32 GetMaxPositiveAuraModifier (AuraType auraType) const
 
int32 GetMaxNegativeAuraModifier (AuraType auraType) const
 
int32 GetTotalAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
float GetTotalAuraMultiplier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxPositiveAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxNegativeAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auraType, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auraType, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auraType, uint32 misc_mask, AuraEffect const *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auraType, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auraType, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auraType, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auraType, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auraType, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auraType, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auraType, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auraType, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auraType, SpellInfo const *affectedSpell) const
 
void InitStatBuffMods ()
 
void UpdateStatBuffMod (Stats stat)
 
void UpdateStatBuffModForClient (Stats stat)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
virtual int32 GetCreatePowerValue (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
uint32 GetChannelSpellId () const
 
void SetChannelSpellId (uint32 channelSpellId)
 
uint32 GetChannelSpellXSpellVisualId () const
 
uint32 GetChannelScriptVisualId () const
 
void SetChannelVisual (SpellCastVisual channelVisual)
 
void AddChannelObject (ObjectGuid guid)
 
void SetChannelObject (uint32 slot, ObjectGuid guid)
 
void RemoveChannelObject (ObjectGuid guid)
 
void ClearChannelObjects ()
 
void SetCurrentCastSpell (Spell *pSpell)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
 
void FinishSpell (CurrentSpellTypes spellType, SpellCastResult result=SPELL_CAST_OK)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual SpellInfo const * GetCastSpellInfo (SpellInfo const *spellInfo, TriggerCastFlags &triggerFlag) const
 
uint32 GetCastSpellXSpellVisualId (SpellInfo const *spellInfo) const override
 
virtual bool HasSpellFocus (Spell const *=nullptr) const
 
virtual bool IsMovementPreventedByCasting () const
 
bool CanCastSpellWhileMoving (SpellInfo const *spellInfo) const
 
bool IsSilenced (SpellSchoolMask schoolMask) const
 
void SetSilencedSchoolMask (SpellSchoolMask schoolMask)
 
void ReplaceAllSilencedSchoolMask (SpellSchoolMask schoolMask)
 
SpellHistoryGetSpellHistory ()
 
SpellHistory const * GetSpellHistory () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool IsDisallowedMountForm (uint32 spellId, ShapeshiftForm form, uint32 displayId) const
 
void HandleStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
 
void ApplyStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float amount)
 
void SetStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float val)
 
void SetStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float val)
 
float GetFlatModifierValue (UnitMods unitMod, UnitModifierFlatType modifierType) const
 
float GetPctModifierValue (UnitMods unitMod, UnitModifierPctType modifierType) const
 
void UpdateUnitMod (UnitMods unitMod)
 
virtual bool CheckAttackFitToAuraRequirement (WeaponAttackType, AuraEffect const *) const
 
virtual void UpdateDamageDoneMods (WeaponAttackType attackType, int32 skipEnchantSlot=-1)
 
void UpdateAllDamageDoneMods ()
 
void UpdateDamagePctDoneMods (WeaponAttackType attackType)
 
void UpdateAllDamagePctDoneMods ()
 
float GetTotalStatValue (Stats stat) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
bool CanModifyStats () const
 
void SetCanModifyStats (bool modifyStats)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual uint32 GetPowerIndex (Powers power) const =0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
void SetAttackPower (int32 attackPower)
 
void SetAttackPowerModPos (int32 attackPowerMod)
 
void SetAttackPowerModNeg (int32 attackPowerMod)
 
void SetAttackPowerMultiplier (float attackPowerMult)
 
void SetRangedAttackPower (int32 attackPower)
 
void SetRangedAttackPowerModPos (int32 attackPowerMod)
 
void SetRangedAttackPowerModNeg (int32 attackPowerMod)
 
void SetRangedAttackPowerMultiplier (float attackPowerMult)
 
void SetMainHandWeaponAttackPower (int32 attackPower)
 
void SetOffHandWeaponAttackPower (int32 attackPower)
 
void SetRangedWeaponAttackPower (int32 attackPower)
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType, bool includeWeapon=true) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage) const =0
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct) const
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized) const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=float(M_PI)) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=float(M_PI)) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
virtual void OnPhaseChange ()
 
void UpdateObjectVisibility (bool forced=true) override
 
VisibleAuraContainer const & GetVisibleAuras () const
 
bool HasVisibleAura (AuraApplication *aurApp) const
 
void SetVisibleAura (AuraApplication *aurApp)
 
void SetVisibleAuraUpdate (AuraApplication *aurApp)
 
void RemoveVisibleAura (AuraApplication *aurApp)
 
bool HasInterruptFlag (SpellAuraInterruptFlags flags) const
 
bool HasInterruptFlag (SpellAuraInterruptFlags2 flags) const
 
void AddInterruptMask (SpellAuraInterruptFlags flags, SpellAuraInterruptFlags2 flags2)
 
void UpdateInterruptMask ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
float GetDisplayScale () const
 
virtual void SetDisplayId (uint32 displayId, bool setNative=false)
 
uint32 GetNativeDisplayId () const
 
float GetNativeDisplayScale () const
 
void RestoreDisplayId (bool ignorePositiveAurasPreventingMounting=false)
 
void SetTransformSpell (uint32 spellid)
 
uint32 GetTransformSpell () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId) const
 
std::vector< DynamicObject * > GetDynObjects (uint32 spellId) const
 
void RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
std::vector< GameObject * > GetGameObjects (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void _RegisterAreaTrigger (AreaTrigger *areaTrigger)
 
void _UnregisterAreaTrigger (AreaTrigger *areaTrigger)
 
AreaTriggerGetAreaTrigger (uint32 spellId) const
 
std::vector< AreaTrigger * > GetAreaTriggers (uint32 spellId) const
 
void RemoveAreaTrigger (uint32 spellId)
 
void RemoveAreaTrigger (AuraEffect const *aurEff)
 
void RemoveAllAreaTriggers ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit const *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
void UnsummonAllTotems ()
 
bool IsMagnet () const
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask) const
 
int32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr) const
 
float SpellDamagePctDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo) const
 
int32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype) const
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask) const
 
int32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr) const
 
float SpellHealingPctDone (Unit *victim, SpellInfo const *spellProto) const
 
int32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype) const
 
int32 MeleeDamageBonusDone (Unit *pVictim, int32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, Mechanics mechanic=MECHANIC_NONE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
 
int32 MeleeDamageBonusTaken (Unit *attacker, int32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
bool IsBlockCritical ()
 
float SpellCritChanceDone (Spell *spell, AuraEffect const *aurEff, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
 
float SpellCritChanceTaken (Unit const *caster, Spell *spell, AuraEffect const *aurEff, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType=BASE_ATTACK) const
 
void ApplySpellImmune (uint32 spellId, SpellImmunity op, uint32 type, bool apply)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const
 
uint32 GetSchoolImmunityMask () const
 
uint32 GetDamageImmunityMask () const
 
uint64 GetMechanicImmunityMask () const
 
EnumFlag< SpellOtherImmunityGetSpellOtherImmunityMask () const
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo, SpellEffectInfo const *spellEffectInfo=nullptr) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, WorldObject const *caster, bool requireImmunityPurgesEffectAttribute=false) const
 
void UpdateSpeed (UnitMoveType mtype)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float newValue)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
void FollowerAdded (AbstractFollower *f)
 
void FollowerRemoved (AbstractFollower *f)
 
void RemoveAllFollowers ()
 
MotionMasterGetMotionMaster ()
 
MotionMaster const * GetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 
bool IsStopped () const
 
void StopMoving ()
 
void PauseMovement (uint32 timer=0, uint8 slot=0, bool forced=true)
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint32 f)
 
void RemoveExtraUnitMovementFlag (uint32 f)
 
bool HasExtraUnitMovementFlag (uint32 f) const
 
uint32 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag2 (uint32 f)
 
void RemoveExtraUnitMovementFlag2 (uint32 f)
 
bool HasExtraUnitMovementFlag2 (uint32 f) const
 
uint32 GetExtraUnitMovementFlags2 () const
 
void SetExtraUnitMovementFlags2 (uint32 f)
 
bool IsSplineEnabled () const
 
void SetControlled (bool apply, UnitState state)
 
void ApplyControlStatesIfNeeded ()
 
void SendPetActionFeedback (PetActionFeedback msg, uint32 spellId)
 -------—Pet responses methods--------------— More...
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void PropagateSpeedChange ()
 -------—End of Pet responses methods-------— More...
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup ()
 
bool CanProc () const
 
void SetCantProc (bool apply)
 
int32 GetProcChainLength () const
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry, bool loading=false)
 
void RemoveVehicleKit (bool onRemoveFromWorld=false)
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
void SetVehicle (Vehicle *vehicle)
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
UnitGetVehicleRoot () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) More...
 
void HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
virtual void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
bool isMoving () const
 
bool isTurning () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
virtual bool CanEnterWater () const =0
 
virtual bool CanSwim () const
 
float GetHoverOffset () const
 
void RewardRage (uint32 baseRage)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool IsLoading () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
Pet const * ToPet () const
 
TotemToTotem ()
 
Totem const * ToTotem () const
 
TempSummonToTempSummon ()
 
TempSummon const * ToTempSummon () const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid const &)=0
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
int32 GetHighestExclusiveSameEffectSpellGroupValue (AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
 
bool IsHighestExclusiveAura (Aura const *aura, bool removeOtherAuraApplications=false)
 
bool IsHighestExclusiveAuraEffect (SpellInfo const *spellInfo, AuraType auraType, int32 effectAmount, uint32 auraEffectMask, bool removeOtherAuraApplications=false)
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
float GetCollisionHeight () const override
 
uint32 GetVirtualItemId (uint32 slot) const
 
uint16 GetVirtualItemAppearanceMod (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
 
bool IsCombatDisallowed () const
 
void SetIsCombatDisallowed (bool apply)
 
void AddWorldEffect (int32 worldEffectId)
 
void RemoveWorldEffect (int32 worldEffectId)
 
void ClearWorldEffects ()
 
std::string GetDebugInfo () const override
 
void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) const override
 
void BuildValuesUpdateForPlayerWithMask (UpdateData *data, UF::ObjectData::Mask const &requestedObjectMask, UF::UnitData::Mask const &requestedUnitMask, Player const *target) const
 
void AtStartOfEncounter (EncounterType type)
 
void AtEndOfEncounter (EncounterType type)
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
virtual void Update (uint32 diff)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
PhaseShiftGetPhaseShift ()
 
PhaseShift const & GetPhaseShift () const
 
PhaseShiftGetSuppressedPhaseShift ()
 
PhaseShift const & GetSuppressedPhaseShift () const
 
bool InSamePhase (PhaseShift const &phaseShift) const
 
bool InSamePhase (WorldObject const *obj) const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsInWorldPvpZone () const
 
bool IsOutdoors () const
 
ZLiquidStatus GetLiquidStatus () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string newname)
 
std::string GetNameForLocaleIdx (LocaleConstant) const override
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
bool IsWithinLOSInMap (WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
Position GetHitSpherePointFor (Position const &dest) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (Position const &pos1, Position const &pos2, float size=0) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void SendCombatLogMessage (WorldPackets::CombatLog::CombatLogServerPacket *combatLog) const
 
virtual uint8 GetLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 soundId, Player *target=nullptr)
 
void PlayDirectSound (uint32 soundId, Player *target=nullptr, uint32 broadcastTextId=0)
 
void PlayDirectMusic (uint32 musicId, Player *target=nullptr)
 
void PlayObjectSound (int32 soundKitId, ObjectGuid targetObject, Player *target=nullptr, int32 broadcastTextId=0)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool implicitDetect=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
ZoneScriptFindZoneScript () const
 
ZoneScriptGetZoneScript () const
 
ScenarioGetScenario () const
 
TempSummonSummonCreature (uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonCreature (uint32 entry, float x, float y, float z, float o=0, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonPersonalClone (Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, Player *privateObjectOwner=nullptr)
 
GameObjectSummonGameObject (uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
CreatureFindNearestCreatureWithOptions (float range, FindCreatureOptions const &options) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool spawnedOnly=true) const
 
GameObjectFindNearestGameObjectWithOptions (float range, FindGameObjectOptions const &options) const
 
GameObjectFindNearestUnspawnedGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float range) const
 
virtual ObjectGuid GetCreatorGUID () const =0
 
virtual ObjectGuid GetOwnerGUID () const =0
 
virtual ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
UnitGetOwner () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
PlayerGetSpellModOwner () const
 
int32 CalculateSpellDamage (Unit const *target, SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
double ApplyEffectModifiers (SpellInfo const *spellInfo, uint8 effIndex, double value) const
 
int32 CalcSpellDuration (SpellInfo const *spellInfo, std::vector< SpellPowerCost > const *powerCosts) const
 
int32 ModSpellDuration (SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
 
void ModSpellDurationTime (SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
 
virtual float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, SpellInfo const *spellInfo) const
 
virtual SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
virtual uint32 GetFaction () const =0
 
virtual void SetFaction (uint32)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (WorldObject const *target) const
 
bool IsNeutralToAll () const
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
 
void SendPlayOrphanSpellVisual (ObjectGuid const &target, uint32 spellVisualId, float travelSpeed, bool speedAsTime=false, bool withSourceOrientation=false)
 
void SendPlayOrphanSpellVisual (Position const &targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime=false, bool withSourceOrientation=false)
 
void SendCancelOrphanSpellVisual (uint32 id)
 
bool IsValidAttackTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
bool IsValidAssistTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
virtual uint32 GetCastSpellXSpellVisualId (SpellInfo const *spellInfo) const
 
template<typename Container >
void GetGameObjectListWithEntryInGrid (Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetGameObjectListWithOptionsInGrid (Container &gameObjectContainer, float maxSearchRange, FindGameObjectOptions const &options) const
 
template<typename Container >
void GetCreatureListWithEntryInGrid (Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetCreatureListWithOptionsInGrid (Container &creatureContainer, float maxSearchRange, FindCreatureOptions const &options) const
 
template<typename Container >
void GetPlayerListInGrid (Container &playerContainer, float maxSearchRange, bool alive=true) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
virtual void UpdateObjectVisibilityOnDestroy ()
 
void UpdatePositionData ()
 
void BuildUpdate (UpdateDataMapType &) override
 
bool AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
void SetFarVisible (bool on)
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
TransportBaseGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
Position const & GetTransOffset () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (TransportBase *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetFloorZ () const
 
virtual float GetCollisionHeight () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
std::string GetDebugInfo () const override
 
virtual uint16 GetAIAnimKitId () const
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
bool IsPrivateObject () const
 
ObjectGuid GetPrivateObjectOwner () const
 
void SetPrivateObjectOwner (ObjectGuid const &owner)
 
bool CheckPrivateObjectOwnerVisibility (WorldObject const *seer) const
 
SmoothPhasingGetOrCreateSmoothPhasing ()
 
SmoothPhasingGetSmoothPhasing ()
 
SmoothPhasing const * GetSmoothPhasing () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid const & GetGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
void SetDynamicFlag (uint32 flag)
 
void RemoveDynamicFlag (uint32 flag)
 
void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player const *target) const
 
void BuildValuesUpdateBlockForPlayerWithFlag (UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
 
void BuildDestroyUpdateBlock (UpdateData *data) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
ByteBufferPrepareValuesUpdateBuffer (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
virtual void ClearUpdateMask (bool remove)
 
virtual std::string GetNameForLocaleIdx (LocaleConstant locale) const =0
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
virtual void BuildUpdate (UpdateDataMapType &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsAreaTrigger () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger const * ToAreaTrigger () const
 
bool IsSceneObject () const
 
SceneObjectToSceneObject ()
 
SceneObject const * ToSceneObject () const
 
bool IsConversation () const
 
ConversationToConversation ()
 
Conversation const * ToConversation () const
 
template<typename T >
void ForceUpdateFieldChange (UF::UpdateFieldSetter< T > const &)
 
virtual std::string GetDebugInfo () const
 
virtual LootGetLootForPlayer (Player const *player) const
 
virtual void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const *loc)
 
void WorldRelocate (uint32 mapId, Position const &pos)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
bool operator== (Position const &a) const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float o)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Streamer< XY > PositionXYStream ()
 
ConstStreamer< XY > PositionXYStream () const
 
Streamer< XYZ > PositionXYZStream ()
 
ConstStreamer< XYZ > PositionXYZStream () const
 
Streamer< XYZO > PositionXYZOStream ()
 
ConstStreamer< XYZO > PositionXYZOStream () const
 
Streamer< PackedXYZ > PositionPackedXYZStream ()
 
ConstStreamer< PackedXYZ > PositionPackedXYZStream () const
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float ToAbsoluteAngle (float relAngle) const
 
float ToRelativeAngle (float absAngle) const
 
float GetRelativeAngle (float x, float y) const
 
float GetRelativeAngle (Position const &pos) const
 
float GetRelativeAngle (Position const *pos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const &pos, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool IsWithinDoubleVerticalCylinder (Position const *center, float radius, float height) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float objSize, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static std::vector< AuraEffect * > CopyAuraEffectList (AuraEffectList const &list)
 
static float CalculateAverageResistReduction (WorldObject const *caster, SpellSchoolMask schoolMask, Unit const *victim, SpellInfo const *spellInfo=nullptr)
 
static void DealDamageMods (Unit const *attacker, Unit const *victim, uint32 &damage, uint32 *absorb)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true)
 
static void Kill (Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
 
static void DealHeal (HealInfo &healInfo)
 
static void ProcSkillsAndAuras (Unit *actor, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
static void ApplyResilience (Unit const *victim, int32 *damage)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit *victim, uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK, uint8 attackerLevel=0)
 
static uint32 CalcSpellResistedDamage (Unit const *attacker, Unit *victim, uint32 damage, SpellSchoolMask schoolMask, SpellInfo const *spellInfo)
 
static void CalcAbsorbResist (DamageInfo &damageInfo, Spell *spell=nullptr)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
static PlayerToPlayer (Object *o)
 
static Player const * ToPlayer (Object const *o)
 
static CreatureToCreature (Object *o)
 
static Creature const * ToCreature (Object const *o)
 
static UnitToUnit (Object *o)
 
static Unit const * ToUnit (Object const *o)
 
static GameObjectToGameObject (Object *o)
 
static GameObject const * ToGameObject (Object const *o)
 
static CorpseToCorpse (Object *o)
 
static Corpse const * ToCorpse (Object const *o)
 
static DynamicObjectToDynObject (Object *o)
 
static DynamicObject const * ToDynObject (Object const *o)
 
static AreaTriggerToAreaTrigger (Object *o)
 
static AreaTrigger const * ToAreaTrigger (Object const *o)
 
static SceneObjectToSceneObject (Object *o)
 
static SceneObject const * ToSceneObject (Object const *o)
 
static ConversationToConversation (Object *o)
 
static Conversation const * ToConversation (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

bool m_canDualWield
 
ControlList m_Controlled
 
std::array< ObjectGuid, MAX_SUMMON_SLOTm_SummonSlot
 
std::array< ObjectGuid, MAX_GAMEOBJECT_SLOTm_ObjectSlot
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
float m_baseSpellCritChance
 
std::array< uint32, MAX_ATTACKm_baseAttackSpeed
 
std::array< float, MAX_ATTACKm_modAttackSpeedPct
 
std::array< uint32, MAX_ATTACKm_attackTimer
 
SpellImmuneContainer m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
ObjectGuid LastCharmerGUID
 
std::unique_ptr< Movement::MoveSplinemovespline
 
UF::UpdateField< UF::UnitData, 0, TYPEID_UNITm_unitData
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
UF::UpdateFieldHolder m_values
 
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECTm_objectData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Protected Types

typedef std::vector< DynamicObject * > DynObjectList
 
typedef std::list< GameObject * > GameObjectList
 
typedef std::vector< AreaTrigger * > AreaTriggerList
 

Protected Member Functions

void SetAI (UnitAI *newAI)
 
UnitAIGetTopAI () const
 
void RefreshAI ()
 
UnitAIGetScheduledChangeAI ()
 
bool HasScheduledAIChange () const
 
 Unit (bool isWorldObject)
 
UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const override
 
void BuildValuesCreate (ByteBuffer *data, Player const *target) const override
 
void BuildValuesUpdate (ByteBuffer *data, Player const *target) const override
 
void DestroyForPlayer (Player *target) const override
 
void ClearUpdateMask (bool remove) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void DisableSpline ()
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate (ZLiquidStatus oldLiquidStatus, Optional< LiquidData > const &newLiquidData)
 
virtual void AtEnterCombat ()
 
virtual void AtExitCombat ()
 
virtual void AtEngage (Unit *)
 
virtual void AtDisengage ()
 
void SetFeared (bool apply)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool packetOnly=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool CanNeverSee (WorldObject const *obj) const
 
virtual bool CanAlwaysSee (WorldObject const *) const
 
virtual bool IsNeverVisibleFor (WorldObject const *seer, bool allowServersideObjects=false) const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *seer) const
 
virtual bool IsInvisibleDueToDespawn (WorldObject const *seer) const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *seer) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _Create (ObjectGuid const &guid)
 
template<typename T >
void SetUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void SetUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
void RemoveUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void RemoveDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void ClearDynamicUpdateFieldValues (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
void RemoveOptionalUpdateFieldValue (UF::OptionalUpdateFieldSetter< T > setter)
 
template<typename T >
void SetUpdateFieldStatValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void ApplyModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type mod, bool apply)
 
template<typename T >
void ApplyPercentModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, float percent, bool apply)
 
template<typename Action >
void DoWithSuppressingObjectUpdates (Action &&action)
 
void BuildMovementUpdate (ByteBuffer *data, CreateObjectBits flags, Player *target) const
 
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const
 
virtual void BuildValuesCreate (ByteBuffer *data, Player const *target) const =0
 
virtual void BuildValuesUpdate (ByteBuffer *data, Player const *target) const =0
 
virtual bool AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

bool m_ControlledByPlayer
 
std::array< float, MAX_STATSm_createStats
 
std::array< float, MAX_STATSm_floatStatPosBuff
 
std::array< float, MAX_STATSm_floatStatNegBuff
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
int32 m_procChainLength
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
AreaTriggerList m_areaTrigger
 
uint32 m_transformSpell
 
std::array< Spell *, CURRENT_MAX_SPELLm_currentSpells
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
std::array< AuraEffectList, TOTAL_AURASm_modAuras
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
EnumFlag< SpellAuraInterruptFlagsm_interruptMask
 
EnumFlag< SpellAuraInterruptFlags2m_interruptMask2
 
float m_auraFlatModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
 
float m_auraPctModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
 
float m_weaponDamage [MAX_ATTACK][2]
 
bool m_canModifyStats
 
VisibleAuraContainer m_visibleAuras
 
Trinity::Containers::FlatSet< AuraApplication *, VisibleAuraSlotComparem_visibleAurasToUpdate
 
std::array< float, MAX_MOVE_TYPEm_speed_rate
 
Unitm_unitMovedByMe
 
Playerm_playerMovingMe
 
Unitm_charmer
 
Unitm_charmed
 
std::unique_ptr< CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
std::unique_ptr< MotionMasteri_motionMaster
 
std::array< uint32, MAX_REACTIVEm_reactiveTimer
 
uint32 m_regenTimer
 
Vehiclem_vehicle
 
std::unique_ptr< Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
uint32 m_movementCounter
 Incrementing counter used in movement packets. More...
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
bool const m_isWorldObject
 
ZoneScriptm_zoneScript
 
TransportBasem_transport
 
uint32 m_zoneId
 
uint32 m_areaId
 
float m_staticFloorZ
 
bool m_outdoors
 
ZLiquidStatus m_liquidStatus
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
CreateObjectBits m_updateFlag
 
bool m_objectUpdated
 

Private Types

typedef std::stack< std::shared_ptr< UnitAI > > UnitAIStack
 

Private Member Functions

void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
void InterruptMovementBasedAuras ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
void ProcSkillsAndReactives (bool isVictim, Unit *procTarget, ProcFlagsInit const &typeMask, ProcFlagsHit hitMask, WeaponAttackType attType)
 
void UpdateCharmAI ()
 
void RestoreDisabledAI ()
 

Private Attributes

uint32 m_state
 
TimeTracker m_splineSyncTimer
 
Diminishing m_Diminishing
 
CombatManager m_combatManager
 
ThreatManager m_threatManager
 
UnitAIStack i_AIs
 
std::shared_ptr< UnitAIi_AI
 
bool m_aiLocked
 
std::unordered_set< AbstractFollower * > m_followingMe
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
bool _instantCast
 
uint32 _oldFactionId
 faction before charm More...
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed? More...
 
bool _playHoverAnim
 
uint16 _aiAnimKitId
 
uint16 _movementAnimKitId
 
uint16 _meleeAnimKitId
 
std::unique_ptr< SpellHistory_spellHistory
 
std::unique_ptr< MovementForces_movementForces
 
PositionUpdateInfo _positionUpdateInfo
 
bool _isCombatDisallowed
 

Friends

class VehicleJoinEvent
 
class CombatManager
 
class ThreatManager
 

Detailed Description

Definition at line 621 of file Unit.h.

Member Typedef Documentation

◆ AreaTriggerList

typedef std::vector<AreaTrigger*> Unit::AreaTriggerList
protected

Definition at line 1845 of file Unit.h.

◆ AttackerSet

typedef std::set<Unit*> Unit::AttackerSet

Definition at line 624 of file Unit.h.

◆ AuraApplicationList

typedef std::forward_list<AuraApplication*> Unit::AuraApplicationList

Definition at line 641 of file Unit.h.

◆ AuraApplicationMap

Definition at line 632 of file Unit.h.

◆ AuraApplicationMapBounds

typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> Unit::AuraApplicationMapBounds

Definition at line 633 of file Unit.h.

◆ AuraApplicationMapBoundsNonConst

typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> Unit::AuraApplicationMapBoundsNonConst

Definition at line 634 of file Unit.h.

◆ AuraApplicationProcContainer

typedef std::vector<std::pair<uint32 , AuraApplication*> > Unit::AuraApplicationProcContainer

Definition at line 644 of file Unit.h.

◆ AuraEffectList

typedef std::forward_list<AuraEffect*> Unit::AuraEffectList

Definition at line 639 of file Unit.h.

◆ AuraList

typedef std::forward_list<Aura*> Unit::AuraList

Definition at line 640 of file Unit.h.

◆ AuraMap

typedef std::multimap<uint32, Aura*> Unit::AuraMap

Definition at line 628 of file Unit.h.

◆ AuraMapBounds

typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> Unit::AuraMapBounds

Definition at line 629 of file Unit.h.

◆ AuraMapBoundsNonConst

typedef std::pair<AuraMap::iterator, AuraMap::iterator> Unit::AuraMapBoundsNonConst

Definition at line 630 of file Unit.h.

◆ AuraStateAurasMap

Definition at line 636 of file Unit.h.

◆ AuraStateAurasMapBounds

typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> Unit::AuraStateAurasMapBounds

Definition at line 637 of file Unit.h.

◆ ControlList

typedef std::set<Unit*> Unit::ControlList

Definition at line 625 of file Unit.h.

◆ Diminishing

Definition at line 642 of file Unit.h.

◆ DynObjectList

typedef std::vector<DynamicObject*> Unit::DynObjectList
protected

Definition at line 1839 of file Unit.h.

◆ GameObjectList

typedef std::list<GameObject*> Unit::GameObjectList
protected

Definition at line 1842 of file Unit.h.

◆ UnitAIStack

typedef std::stack<std::shared_ptr<UnitAI> > Unit::UnitAIStack
private

Definition at line 1947 of file Unit.h.

◆ UnitVector

typedef std::vector<Unit*> Unit::UnitVector

Definition at line 626 of file Unit.h.

◆ VisibleAuraContainer

Definition at line 647 of file Unit.h.

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
virtual

Definition at line 387 of file Unit.cpp.

388{
389 // set current spells as deletable
390 for (size_t i = 0; i < m_currentSpells.size(); ++i)
391 {
392 if (m_currentSpells[i])
393 {
394 m_currentSpells[i]->SetReferencedFromCurrent(false);
395 m_currentSpells[i] = nullptr;
396 }
397 }
398
400
402
405 ASSERT(m_attackers.empty());
406 ASSERT(m_sharedVision.empty());
407 ASSERT(m_Controlled.empty());
408 ASSERT(m_appliedAuras.empty());
409 ASSERT(m_ownedAuras.empty());
410 ASSERT(m_removedAuras.empty());
411 ASSERT(m_dynObj.empty());
412 ASSERT(m_gameObj.empty());
413 ASSERT(m_areaTrigger.empty());
416}
#define ASSERT
Definition: Errors.h:68
void KillAllEvents(bool force)
bool m_duringRemoveFromWorld
Definition: Unit.h:1959
Unit * m_unitMovedByMe
Definition: Unit.h:1875
AuraList m_removedAuras
Definition: Unit.h:1854
AreaTriggerList m_areaTrigger
Definition: Unit.h:1846
std::array< Spell *, CURRENT_MAX_SPELL > m_currentSpells
Definition: Unit.h:1850
ControlList m_Controlled
Definition: Unit.h:1197
void _DeleteRemovedAuras()
Definition: Unit.cpp:2831
DynObjectList m_dynObj
Definition: Unit.h:1840
AttackerSet m_attackers
Definition: Unit.h:1831
Unit * m_attacking
Definition: Unit.h:1832
GameObjectList m_gameObj
Definition: Unit.h:1843
AuraMap m_ownedAuras
Definition: Unit.h:1852
AuraApplicationMap m_appliedAuras
Definition: Unit.h:1853
SharedVisionList m_sharedVision
Definition: Unit.h:1880
Player * m_playerMovingMe
Definition: Unit.h:1876
EventProcessor m_Events
Definition: Object.h:757
+ Here is the call graph for this function:

◆ Unit()

Unit::Unit ( bool  isWorldObject)
explicitprotected

Definition at line 306 of file Unit.cpp.

306 :
307 WorldObject(isWorldObject), m_lastSanctuaryTime(0), LastCharmerGUID(), movespline(std::make_unique<Movement::MoveSpline>()),
310 m_unitMovedByMe(nullptr), m_playerMovingMe(nullptr), m_charmer(nullptr), m_charmed(nullptr),
311 i_motionMaster(std::make_unique<MotionMaster>(this)), m_regenTimer(0), m_vehicle(nullptr),
314 _spellHistory(std::make_unique<SpellHistory>(this))
315{
318
320
321 m_baseAttackSpeed = { };
322 m_attackTimer = { };
323 m_modAttackSpeedPct.fill(1.0f);
324
325 m_canDualWield = false;
326
328
329 m_state = 0;
331
332 m_currentSpells = { };
333
335
336 m_canModifyStats = false;
337
338 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
339 {
345 }
346 // implement 50% base damage from offhand
348
349 for (uint8 i = 0; i < MAX_ATTACK; ++i)
350 {
353 }
354
355 m_createStats = { };
356 m_floatStatPosBuff = { };
357 m_floatStatNegBuff = { };
358
359 m_attacking = nullptr;
360 m_modMeleeHitChance = 0.0f;
362 m_modSpellHitChance = 0.0f;
364
365 m_speed_rate.fill(1.0f);
366
367 // remove aurastates allowing special moves
368 m_reactiveTimer = { };
369
370 m_cleanupDone = false;
372
374
375 _lastLiquid = nullptr;
376
377 _oldFactionId = 0;
378 _isWalkingBeforeCharm = false;
379 _instantCast = false;
380 _isCombatDisallowed = false;
381
383}
uint8_t uint8
Definition: Define.h:145
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:60
@ SERVERSIDE_VISIBILITY_GHOST
@ MAX_ATTACK
@ GHOST_VISIBILITY_ALIVE
#define BASE_MAXDAMAGE
Definition: UnitDefines.h:34
#define BASE_MINDAMAGE
Definition: UnitDefines.h:33
@ BASE_VALUE
Definition: Unit.h:147
@ TOTAL_VALUE
Definition: Unit.h:149
@ BASE_PCT_EXCLUDE_CREATE
Definition: Unit.h:148
@ UNIT_MASK_NONE
Definition: Unit.h:344
@ MINDAMAGE
Definition: Unit.h:162
@ MAXDAMAGE
Definition: Unit.h:163
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:209
@ UNIT_MOD_END
Definition: Unit.h:211
@ ALIVE
Definition: Unit.h:241
@ TOTAL_PCT
Definition: Unit.h:156
@ BASE_PCT
Definition: Unit.h:155
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:428
uint16 m_objectType
Definition: Object.h:386
CreateObjectBits m_updateFlag
Definition: Object.h:389
TypeID m_objectTypeId
Definition: Object.h:388
EnumFlag< SpellAuraInterruptFlags2 > m_interruptMask2
Definition: Unit.h:1863
std::unique_ptr< SpellHistory > _spellHistory
Definition: Unit.h:1971
float m_baseSpellCritChance
Definition: Unit.h:1460
uint32 m_lastSanctuaryTime
Definition: Unit.h:1533
LiquidTypeEntry const * _lastLiquid
Definition: Unit.h:1891
std::unique_ptr< MotionMaster > i_motionMaster
Definition: Unit.h:1882
bool m_canModifyStats
Definition: Unit.h:1868
std::array< uint32, MAX_REACTIVE > m_reactiveTimer
Definition: Unit.h:1884
bool _isCombatDisallowed
Definition: Unit.h:1976
Diminishing m_Diminishing
Definition: Unit.h:1937
uint32 m_regenTimer
Definition: Unit.h:1885
uint32 m_state
Definition: Unit.h:1934
Vehicle * m_vehicle
Definition: Unit.h:1887
float m_weaponDamage[MAX_ATTACK][2]
Definition: Unit.h:1867
int32 m_procChainLength
Definition: Unit.h:1837
uint32 _lastExtraAttackSpell
Definition: Unit.h:1954
bool _instantCast
Definition: Unit.h:1960
std::array< float, MAX_STATS > m_floatStatPosBuff
Definition: Unit.h:1828
float m_auraFlatModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
Definition: Unit.h:1865
std::array< uint32, MAX_ATTACK > m_baseAttackSpeed
Definition: Unit.h:1462
float m_modRangedHitChance
Definition: Unit.h:1458
DeathState m_deathState
Definition: Unit.h:1834
uint32 m_unitTypeMask
Definition: Unit.h:1890
uint32 m_removedAurasCount
Definition: Unit.h:1856
uint32 m_movementCounter
Incrementing counter used in movement packets.
Definition: Unit.h:1930
AuraMap::iterator m_auraUpdateIterator
Definition: Unit.h:1855
bool m_ControlledByPlayer
Definition: Unit.h:1825
ThreatManager m_threatManager
Definition: Unit.h:1943
uint32 _oldFactionId
faction before charm
Definition: Unit.h:1962
Unit * m_charmed
Definition: Unit.h:1878
float m_modMeleeHitChance
Definition: Unit.h:1457
uint32 m_transformSpell
Definition: Unit.h:1848
bool m_aiLocked
Definition: Unit.h:1950
uint16 _movementAnimKitId
Definition: Unit.h:1968
uint16 _meleeAnimKitId
Definition: Unit.h:1969
std::array< float, MAX_STATS > m_createStats
Definition: Unit.h:1827
std::unique_ptr< Movement::MoveSpline > movespline
Definition: Unit.h:1753
bool _playHoverAnim
Definition: Unit.h:1965
std::array< float, MAX_MOVE_TYPE > m_speed_rate
Definition: Unit.h:1873
std::array< float, MAX_ATTACK > m_modAttackSpeedPct
Definition: Unit.h:1463
Unit * m_charmer
Definition: Unit.h:1877
bool m_canDualWield
Definition: Unit.h:699
uint16 _aiAnimKitId
Definition: Unit.h:1967
ObjectGuid LastCharmerGUID
Definition: Unit.h:1693
int32 m_procDeep
Definition: Unit.h:1836
std::array< uint32, MAX_ATTACK > m_attackTimer
Definition: Unit.h:1464
CombatManager m_combatManager
Definition: Unit.h:1941
float m_modSpellHitChance
Definition: Unit.h:1459
std::array< float, MAX_STATS > m_floatStatNegBuff
Definition: Unit.h:1829
bool m_cleanupDone
Definition: Unit.h:1958
EnumFlag< SpellAuraInterruptFlags > m_interruptMask
Definition: Unit.h:1862
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition: Unit.h:1963
float m_auraPctModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
Definition: Unit.h:1866
WorldObject(bool isWorldObject)
Definition: Object.cpp:867
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:599
bool MovementUpdate
Definition: Object.h:85
+ Here is the call graph for this function:

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit pAttacker)

Definition at line 5618 of file Unit.cpp.

5619{
5620 m_attackers.insert(pAttacker);
5621}
+ Here is the caller graph for this function:

◆ _AddAura()

void Unit::_AddAura ( UnitAura aura,
Unit caster 
)

Definition at line 3290 of file Unit.cpp.

3291{
3293 m_ownedAuras.emplace(aura->GetId(), aura);
3294
3295 _RemoveNoStackAurasDueToAura(aura, true);
3296
3297 if (aura->IsRemoved())
3298 return;
3299
3300 aura->SetIsSingleTarget(caster && aura->GetSpellInfo()->IsSingleTarget());
3301 if (aura->IsSingleTarget())
3302 {
3304 /* @HACK: Player is not in world during loading auras.
3305 * Single target auras are not saved or loaded from database
3306 * but may be created as a result of aura links.
3307 */
3308
3309 std::vector<Aura*> aurasSharingLimit;
3310 // remove other single target auras
3311 for (Aura* scAura : caster->GetSingleCastAuras())
3312 if (scAura->IsSingleTargetWith(aura))
3313 aurasSharingLimit.push_back(scAura);
3314
3315 // register single target aura
3316 caster->GetSingleCastAuras().push_front(aura);
3317
3318 uint32 maxOtherAuras = aura->GetSpellInfo()->MaxAffectedTargets - 1;
3319 while (aurasSharingLimit.size() > maxOtherAuras)
3320 {
3321 aurasSharingLimit.back()->Remove();
3322 aurasSharingLimit.pop_back();
3323 }
3324 }
3325}
uint32_t uint32
Definition: Define.h:143
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:138
bool IsRemoved() const
Definition: SpellAuras.h:204
uint32 GetId() const
Definition: SpellAuras.h:134
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:133
void SetIsSingleTarget(bool val)
Definition: SpellAuras.h:208
bool IsSingleTarget() const
Definition: SpellAuras.h:206
ObjectGuid const & GetGUID() const
Definition: Object.h:159
bool IsInWorld() const
Definition: Object.h:153
uint32 MaxAffectedTargets
Definition: SpellInfo.h:407
bool IsSingleTarget() const
Definition: SpellInfo.cpp:1886
void _RemoveNoStackAurasDueToAura(Aura *aura, bool owned)
Definition: Unit.cpp:3553
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:1735
AuraList & GetSingleCastAuras()
Definition: Unit.h:1309
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )

Definition at line 4439 of file Unit.cpp.

4440{
4441 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
4442 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
4443}
@ AURA_EFFECT_HANDLE_STAT
+ Here is the caller graph for this function:

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication aurApp,
uint32  effMask 
)

Definition at line 3385 of file Unit.cpp.

3386{
3387 Aura* aura = aurApp->GetBase();
3388
3389 _RemoveNoStackAurasDueToAura(aura, false);
3390
3391 if (aurApp->GetRemoveMode())
3392 return;
3393
3394 // Update target aura state flag
3395 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
3396 {
3397 uint32 aStateMask = (1 << (aState - 1));
3398 // force update so the new caster registers it
3399 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) && *m_unitData->AuraState & aStateMask)
3401 else
3402 ModifyAuraState(aState, true);
3403 }
3404
3405 if (aurApp->GetRemoveMode())
3406 return;
3407
3408 // Sitdown on apply aura req seated
3411
3412 Unit* caster = aura->GetCaster();
3413
3414 if (aurApp->GetRemoveMode())
3415 return;
3416
3417 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
3418
3419 // apply effects of the aura
3420 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3421 {
3422 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
3423 aurApp->_HandleEffect(i, true);
3424 }
3425
3426 if (Player* player = ToPlayer())
3427 {
3428 if (sConditionMgr->IsSpellUsedInSpellClickConditions(aurApp->GetBase()->GetId()))
3429 player->UpdateVisibleGameobjectsOrSpellClicks();
3430
3431 player->FailCriteria(CriteriaFailEvent::GainAura, aurApp->GetBase()->GetId());
3432 player->StartCriteria(CriteriaStartEvent::GainAura, aurApp->GetBase()->GetId());
3433 player->UpdateCriteria(CriteriaType::GainAura, aurApp->GetBase()->GetId());
3434 }
3435}
#define sConditionMgr
Definition: ConditionMgr.h:365
#define MAX_SPELL_EFFECTS
Definition: DBCEnums.h:1953
#define PER_CASTER_AURA_STATE_MASK
AuraStateType
@ UNIT_STAND_STATE_SIT
Definition: UnitDefines.h:43
void _HandleEffect(uint8 effIndex, bool apply)
Definition: SpellAuras.cpp:156
Aura * GetBase() const
Definition: SpellAuras.h:77
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:90
Unit * GetCaster() const
Definition: SpellAuras.cpp:513
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Player * ToPlayer()
Definition: Object.h:202
UF::UpdateFieldHolder m_values
Definition: Object.h:253
void ForceUpdateFieldChange(UF::UpdateFieldSetter< T > const &)
Definition: Object.h:257
AuraStateType GetAuraState() const
Definition: SpellInfo.cpp:2538
bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:469
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:683
Definition: Unit.h:622
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10034
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1791
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:5866
bool IsSitState() const
Definition: Unit.cpp:10019
UpdateField< uint32, 32, 47 > AuraState
Definition: UpdateFields.h:311
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura aura,
uint8  effIndex 
)

Definition at line 3371 of file Unit.cpp.

3372{
3373 ASSERT(aura);
3374 ASSERT(aura->HasEffect(effIndex));
3376 ASSERT(aurApp);
3377 if (!aurApp->GetEffectMask())
3378 _ApplyAura(aurApp, 1 << effIndex);
3379 else
3380 aurApp->_HandleEffect(effIndex, true);
3381}
uint32 GetEffectMask() const
Definition: SpellAuras.h:81
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:224
void _ApplyAura(AuraApplication *aurApp, uint32 effMask)
Definition: Unit.cpp:3385
+ Here is the call graph for this function:

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura aura,
uint32  effMask 
)

Definition at line 3329 of file Unit.cpp.

3330{
3331 // can't apply aura on unit which is going to be deleted - to not create a memory leak
3333
3334 // just return if the aura has been already removed
3335 // this can happen if OnEffectHitTarget() script hook killed the unit or the aura owner (which can be different)
3336 if (aura->IsRemoved())
3337 {
3338 TC_LOG_ERROR("spells", "Unit::_CreateAuraApplication() called with a removed aura. Check if OnEffectHitTarget() is triggering any spell with apply aura effect (that's not allowed!)\nUnit: {}\nAura: {}", GetDebugInfo(), aura->GetDebugInfo());
3339 return nullptr;
3340 }
3341
3342 // aura mustn't be already applied on target
3343 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
3344
3345 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
3346 uint32 aurId = aurSpellInfo->Id;
3347
3348 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
3349 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() &&
3350 (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading()))
3351 return nullptr;
3352
3353 Unit* caster = aura->GetCaster();
3354
3355 AuraApplication * aurApp = new AuraApplication(this, caster, aura, effMask);
3356 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
3357
3358 if (aurSpellInfo->HasAnyAuraInterruptFlag())
3359 {
3360 m_interruptableAuras.push_front(aurApp);
3361 AddInterruptMask(aurSpellInfo->AuraInterruptFlags, aurSpellInfo->AuraInterruptFlags2);
3362 }
3363
3364 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
3365 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
3366
3367 aura->_ApplyForTarget(this, caster, aurApp);
3368 return aurApp;
3369}
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
virtual std::string GetDebugInfo() const
bool IsAppliedOnTarget(ObjectGuid guid) const
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:542
TypeID GetTypeId() const
Definition: Object.h:172
uint32 const Id
Definition: SpellInfo.h:325
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:373
bool IsDeathPersistent() const
Definition: SpellInfo.cpp:1658
bool HasAnyAuraInterruptFlag() const
Definition: SpellInfo.cpp:1465
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:372
std::string GetDebugInfo() const override
Definition: Unit.cpp:13656
bool IsAlive() const
Definition: Unit.h:1150
AuraApplicationList m_interruptableAuras
Definition: Unit.h:1860
void AddInterruptMask(SpellAuraInterruptFlags flags, SpellAuraInterruptFlags2 flags2)
Definition: Unit.h:1543
AuraStateAurasMap m_auraStateAuras
Definition: Unit.h:1861
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected

Definition at line 2831 of file Unit.cpp.

2832{
2833 while (!m_removedAuras.empty())
2834 {
2835 delete m_removedAuras.front();
2836 m_removedAuras.pop_front();
2837 }
2838
2840}
+ Here is the caller graph for this function:

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)

Definition at line 12048 of file Unit.cpp.

12049{
12050 // Must be called only from aura handler
12051 ASSERT(aurApp);
12052
12053 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
12054 return;
12055
12056 if (m_vehicle)
12057 {
12058 if (m_vehicle != vehicle)
12059 {
12060 TC_LOG_DEBUG("entities.vehicle", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
12061 ExitVehicle();
12062 }
12063 else if (seatId >= 0 && seatId == GetTransSeat())
12064 return;
12065 else
12066 {
12067 //Exit the current vehicle because unit will reenter in a new seat.
12069 }
12070 }
12071
12072 if (aurApp->GetRemoveMode())
12073 return;
12074
12075 if (Player* player = ToPlayer())
12076 {
12077 if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->IsInCombat())
12078 {
12079 vehicle->GetBase()->RemoveAura(const_cast<AuraApplication*>(aurApp));
12080 return;
12081 }
12082
12083 if (vehicle->GetBase()->GetTypeId() == TYPEID_UNIT)
12084 {
12085 // If a player entered a vehicle that is part of a formation, remove it from said formation
12086 if (CreatureGroup* creatureGroup = vehicle->GetBase()->ToCreature()->GetFormation())
12087 creatureGroup->RemoveMember(vehicle->GetBase()->ToCreature());
12088 }
12089 }
12090
12091 ASSERT(!m_vehicle);
12092 (void)vehicle->AddVehiclePassenger(this, seatId);
12093}
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
@ SPELL_AURA_CONTROL_VEHICLE
CreatureGroup * GetFormation()
Definition: Creature.h:353
static Creature * ToCreature(Object *o)
Definition: Object.h:206
uint32 GetEntry() const
Definition: Object.h:160
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3793
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3666
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.cpp:11398
Vehicle * GetVehicleKit() const
Definition: Unit.h:1696
virtual void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:12127
Unit * GetBase() const
Definition: Vehicle.h:48
bool AddVehiclePassenger(Unit *unit, int8 seatId=-1)
Definition: Vehicle.cpp:421
int8 GetTransSeat() const
Definition: Object.h:737
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)

It's possible m_vehicle is NULL, when this function is called indirectly from @VehicleJoinEvent::Abort. In that case it was not possible to add the passenger to the vehicle. The vehicle aura has already been removed from the target in the aforementioned function and we don't need to do anything else at this point.

Definition at line 12146 of file Unit.cpp.

12147{
12151 if (!m_vehicle)
12152 return;
12153
12154 // This should be done before dismiss, because there may be some aura removal
12156 Vehicle* vehicle = m_vehicle->RemovePassenger(this);
12157
12158 if (!vehicle)
12159 {
12160 TC_LOG_ERROR("entities.vehicle", "RemovePassenger() couldn't remove current unit from vehicle. Debug info: {}", GetDebugInfo());
12161 return;
12162 }
12163
12164 Player* player = ToPlayer();
12165
12166 // If the player is on mounted duel and exits the mount, he should immediatly lose the duel
12167 if (player && player->duel && player->duel->IsMounted)
12168 player->DuelComplete(DUEL_FLED);
12169
12170 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
12171
12173
12174 if (player)
12175 player->SetFallInformation(0, GetPositionZ());
12176
12177 Position pos;
12178 // If we ask for a specific exit position, use that one. Otherwise allow scripts to modify it
12179 if (exitPosition)
12180 pos = *exitPosition;
12181 else
12182 {
12183 // Set exit position to vehicle position and use the current orientation
12184 pos = vehicle->GetBase()->GetPosition();
12186
12187 // Change exit position based on seat entry addon data
12188 if (seatAddon)
12189 {
12191 pos.RelocateOffset({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
12193 pos.Relocate({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
12194 }
12195 }
12196
12197 std::function<void(Movement::MoveSplineInit&)> initializer = [=, this, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
12198 {
12199 float height = pos.GetPositionZ() + vehicleCollisionHeight;
12200
12201 // Creatures without inhabit type air should begin falling after exiting the vehicle
12202 if (GetTypeId() == TYPEID_UNIT && !CanFly() && height > GetMap()->GetWaterOrGroundLevel(GetPhaseShift(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + vehicleCollisionHeight, &height))
12203 init.SetFall();
12204
12205 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
12206 init.SetFacing(pos.GetOrientation());
12207 init.SetTransportExit();
12208 };
12210
12211 if (player)
12213
12214 if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION) && vehicle->GetBase()->GetTypeId() == TYPEID_UNIT)
12215 if (((Minion*)vehicle->GetBase())->GetOwner() == this)
12216 vehicle->GetBase()->ToCreature()->DespawnOrUnsummon(vehicle->GetDespawnDelay());
12217
12219 {
12220 // Vehicle just died, we die too
12221 if (vehicle->GetBase()->getDeathState() == JUST_DIED)
12223 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
12224 else
12225 ToTempSummon()->UnSummon(2000); // Approximation
12226 }
12227
12229}
@ MOTION_PRIORITY_HIGHEST
@ EVENT_VEHICLE_EXIT
@ DUEL_FLED
@ UNIT_MASK_ACCESSORY
Definition: Unit.h:354
@ UNIT_MASK_MINION
Definition: Unit.h:346
@ JUST_DIED
Definition: Unit.h:242
@ UNIT_STATE_ROOT
Definition: Unit.h:260
@ UNIT_STATE_MOVE
Definition: Unit.h:270
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2422
float GetWaterOrGroundLevel(PhaseShift const &phaseShift, float x, float y, float z, float *ground=nullptr, bool swim=false, float collisionHeight=2.03128f)
Definition: Map.cpp:1744
void LaunchMoveSpline(std::function< void(Movement::MoveSplineInit &init)> &&initializer, uint32 id=0, MovementGeneratorPriority priority=MOTION_PRIORITY_NORMAL, MovementGeneratorType type=EFFECT_MOTION_TYPE)
void DuelComplete(DuelCompleteType type)
Definition: Player.cpp:7717
void SetFallInformation(uint32 time, float z)
Definition: Player.cpp:26557
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1973
void ResummonPetTemporaryUnSummonedIfAny()
Definition: Player.cpp:27065
virtual void UnSummon(uint32 msTime=0)
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:10833
float GetCollisionHeight() const override
Definition: Unit.cpp:13630
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition: Unit.h:1637
TempSummon * ToTempSummon()
Definition: Unit.h:1743
void AddUnitState(uint32 f)
Definition: Unit.h:726
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition: Unit.cpp:4082
DeathState getDeathState() const
Definition: Unit.h:1153
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:731
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:8565
Vehicle * RemovePassenger(WorldObject *passenger) override
Removes the passenger from the vehicle.
Definition: Vehicle.cpp:492
VehicleSeatAddon const * GetSeatAddonForSeatOfPassenger(Unit const *passenger) const
Gets the vehicle seat addon data for the seat of a passenger.
Definition: Vehicle.cpp:355
Milliseconds GetDespawnDelay()
Definition: Vehicle.cpp:962
Map * GetMap() const
Definition: Object.h:604
PhaseShift & GetPhaseShift()
Definition: Object.h:505
float GetPositionZ() const
Definition: Position.h:78
float GetOrientation() const
Definition: Position.h:79
void SetOrientation(float orientation)
Definition: Position.h:71
float GetPositionX() const
Definition: Position.h:76
void GetPosition(float &x, float &y) const
Definition: Position.h:81
float GetPositionY() const
Definition: Position.h:77
void RelocateOffset(Position const &offset)
Definition: Position.cpp:34
void Relocate(float x, float y)
Definition: Position.h:63
VehicleExitParameters ExitParameter
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _RegisterAreaTrigger()

void Unit::_RegisterAreaTrigger ( AreaTrigger areaTrigger)

Definition at line 5296 of file Unit.cpp.

5297{
5298 m_areaTrigger.push_back(areaTrigger);
5299 if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
5300 ToCreature()->AI()->JustRegisteredAreaTrigger(areaTrigger);
5301}
virtual void JustRegisteredAreaTrigger(AreaTrigger *)
Definition: CreatureAI.h:126
CreatureAI * AI() const
Definition: Creature.h:187
Creature * ToCreature()
Definition: Object.h:208
bool IsAIEnabled() const
Definition: Unit.h:653
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect aurEff,
bool  apply 
)

Definition at line 3573 of file Unit.cpp.

3574{
3575 if (apply)
3576 {
3577 m_modAuras[aurEff->GetAuraType()].push_front(aurEff);
3578 if (Player* player = ToPlayer())
3579 {
3580 player->StartCriteria(CriteriaStartEvent::GainAuraEffect, aurEff->GetAuraType());
3581 player->FailCriteria(CriteriaFailEvent::GainAuraEffect, aurEff->GetAuraType());
3582 }
3583 }
3584 else
3586}
AuraType GetAuraType() const
std::array< AuraEffectList, TOTAL_AURAS > m_modAuras
Definition: Unit.h:1858
void apply(T *val)
Definition: ByteConverter.h:41
std::list< T, Alloc >::iterator RemoveUnique(std::list< T, Alloc > &list, T const &value)
Definition: ListUtils.h:27
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject dynObj)

Definition at line 5131 of file Unit.cpp.

5132{
5133 m_dynObj.push_back(dynObj);
5134 if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
5136}
virtual void JustRegisteredDynObject(DynamicObject *)
Definition: CreatureAI.h:122
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )

Definition at line 4433 of file Unit.cpp.

4434{
4435 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
4436 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
4437}
+ Here is the caller graph for this function:

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit pAttacker)

Definition at line 5623 of file Unit.cpp.

5624{
5625 m_attackers.erase(pAttacker);
5626}
+ Here is the caller graph for this function:

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura aura,
bool  owned 
)

Definition at line 3553 of file Unit.cpp.

3554{
3555 SpellInfo const* spellProto = aura->GetSpellInfo();
3556
3557 // passive spell special case (only non stackable with ranks)
3558 if (spellProto->IsPassiveStackableWithRanks())
3559 return;
3560
3561 if (!IsHighestExclusiveAura(aura))
3562 {
3563 aura->Remove();
3564 return;
3565 }
3566
3567 if (owned)
3568 RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AURA_REMOVE_BY_DEFAULT);
3569 else
3570 RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AURA_REMOVE_BY_DEFAULT);
3571}
@ AURA_REMOVE_BY_DEFAULT
bool CanStackWith(Aura const *existingAura) const
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
bool IsPassiveStackableWithRanks() const
Definition: SpellInfo.cpp:1633
void RemoveOwnedAuras(std::function< bool(Aura const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3752
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3739
bool IsHighestExclusiveAura(Aura const *aura, bool removeOtherAuraApplications=false)
Definition: Unit.cpp:13414
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( AuraCreateInfo createInfo)

Definition at line 3230 of file Unit.cpp.

3231{
3232 ASSERT(!createInfo.CasterGUID.IsEmpty() || createInfo.Caster);
3233
3234 // Check if these can stack anyway
3235 if (!createInfo.CasterGUID && !createInfo.GetSpellInfo()->IsStackableOnOneSlotWithDifferentCasters())
3236 createInfo.CasterGUID = createInfo.Caster->GetGUID();
3237
3238 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
3239 if (!createInfo.GetSpellInfo()->IsMultiSlotAura())
3240 {
3241 // check if cast item changed
3242 ObjectGuid castItemGUID = createInfo.CastItemGUID;
3243
3244 // find current aura from spell and change it's stackamount, or refresh it's duration
3245 if (Aura* foundAura = GetOwnedAura(createInfo.GetSpellInfo()->Id, createInfo.GetSpellInfo()->IsStackableOnOneSlotWithDifferentCasters() ? ObjectGuid::Empty : createInfo.CasterGUID, createInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
3246 {
3247 // effect masks do not match
3248 // extremely rare case
3249 // let's just recreate aura
3250 if (createInfo.GetAuraEffectMask() != foundAura->GetEffectMask())
3251 return nullptr;
3252
3253 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
3254 for (SpellEffectInfo const& spellEffectInfo : createInfo.GetSpellInfo()->GetEffects())
3255 {
3256 AuraEffect const* auraEff = foundAura->GetEffect(spellEffectInfo.EffectIndex);
3257 if (!auraEff)
3258 continue;
3259
3260 int32 bp;
3261 if (createInfo.BaseAmount)
3262 bp = *(createInfo.BaseAmount + spellEffectInfo.EffectIndex);
3263 else
3264 bp = int32(spellEffectInfo.BasePoints);
3265
3266 int32* oldBP = const_cast<int32*>(&(auraEff->m_baseAmount)); // todo 6.x review GetBaseAmount and GetCastItemGUID in this case
3267 *oldBP = bp;
3268 }
3269
3270 // correct cast item guid if needed
3271 if (castItemGUID != foundAura->GetCastItemGUID())
3272 {
3273 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
3274 *oldGUID = castItemGUID;
3275 uint32* oldItemId = const_cast<uint32*>(&foundAura->m_castItemId);
3276 *oldItemId = createInfo.CastItemId;
3277 int32* oldItemLevel = const_cast<int32*>(&foundAura->m_castItemLevel);
3278 *oldItemLevel = createInfo.CastItemLevel;
3279 }
3280
3281 // try to increase stack amount
3282 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, createInfo.ResetPeriodicTimer);
3283 return foundAura;
3284 }
3285 }
3286
3287 return nullptr;
3288}
int32_t int32
Definition: Define.h:139
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition: SpellInfo.h:148
int32 const m_baseAmount
static ObjectGuid const Empty
Definition: ObjectGuid.h:272
bool IsEmpty() const
Definition: ObjectGuid.h:317
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:158
bool IsStackableOnOneSlotWithDifferentCasters() const
Definition: SpellInfo.cpp:1643
bool IsMultiSlotAura() const
Definition: SpellInfo.cpp:1638
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:576
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, Aura *except=nullptr) const
Definition: Unit.cpp:3650
ObjectGuid CasterGUID
int32 const * BaseAmount
ObjectGuid CastItemGUID
uint32 GetAuraEffectMask() const
SpellInfo const * GetSpellInfo() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication aurApp,
AuraRemoveMode  removeMode 
)

Definition at line 3532 of file Unit.cpp.

3533{
3534 // aura can be removed from unit only if it's applied on it, shouldn't happen
3535 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
3536
3537 uint32 spellId = aurApp->GetBase()->GetId();
3538 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
3539
3540 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
3541 {
3542 if (iter->second == aurApp)
3543 {
3544 _UnapplyAura(iter, removeMode);
3545 return;
3546 }
3547 else
3548 ++iter;
3549 }
3550 ABORT();
3551}
#define ABORT
Definition: Errors.h:74
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition: Unit.h:634
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition: Unit.cpp:3438
+ Here is the call graph for this function:

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)

Definition at line 3438 of file Unit.cpp.

3439{
3440 AuraApplication * aurApp = i->second;
3441 ASSERT(aurApp);
3442 ASSERT(!aurApp->GetRemoveMode());
3443 ASSERT(aurApp->GetTarget() == this);
3444
3445 aurApp->SetRemoveMode(removeMode);
3446 Aura* aura = aurApp->GetBase();
3447 TC_LOG_DEBUG("spells", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
3448
3449 // dead loop is killing the server probably
3450 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
3451
3453
3454 Unit* caster = aura->GetCaster();
3455
3456 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
3457 m_appliedAuras.erase(i);
3458
3460 {
3463 }
3464
3465 bool auraStateFound = false;
3466 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
3467 if (auraState)
3468 {
3469 bool canBreak = false;
3470 // Get mask of all aurastates from remaining auras
3471 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
3472 {
3473 if (itr->second == aurApp)
3474 {
3475 m_auraStateAuras.erase(itr);
3476 itr = m_auraStateAuras.lower_bound(auraState);
3477 canBreak = true;
3478 continue;
3479 }
3480 auraStateFound = true;
3481 ++itr;
3482 }
3483 }
3484
3485 aurApp->_Remove();
3486 aura->_UnapplyForTarget(this, caster, aurApp);
3487
3488 // remove effects of the spell - needs to be done after removing aura from lists
3489 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
3490 {
3491 if (aurApp->HasEffect(itr))
3492 aurApp->_HandleEffect(itr, false);
3493 }
3494
3495 // all effect mustn't be applied
3496 ASSERT(!aurApp->GetEffectMask());
3497
3498 // Remove totem at next update if totem loses its aura
3499 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && IsTotem())
3500 {
3501 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
3503 }
3504
3505 // Remove aurastates only if needed and were not found
3506 if (auraState)
3507 {
3508 if (!auraStateFound)
3509 ModifyAuraState(auraState, false);
3510 else
3511 {
3512 // update for casters, some shouldn't 'see' the aura state
3513 uint32 aStateMask = (1 << (auraState - 1));
3514 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) != 0)
3516 }
3517 }
3518
3519 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
3520
3521 if (Player* player = ToPlayer())
3522 {
3523 if (sConditionMgr->IsSpellUsedInSpellClickConditions(aurApp->GetBase()->GetId()))
3524 player->UpdateVisibleGameobjectsOrSpellClicks();
3525
3526 player->FailCriteria(CriteriaFailEvent::LoseAura, aurApp->GetBase()->GetId());
3527 }
3528
3529 i = m_appliedAuras.begin();
3530}
@ AURA_REMOVE_BY_EXPIRE
@ TOTEM_PASSIVE
Definition: Totem.h:25
Unit * GetTarget() const
Definition: SpellAuras.h:76
void SetRemoveMode(AuraRemoveMode mode)
Definition: SpellAuras.h:89
bool HasEffect(uint8 effect) const
Definition: SpellAuras.h:82
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:562
void setDeathState(DeathState s) override
Totem * ToTotem()
Definition: Unit.h:1740
void UpdateInterruptMask()
Definition: Unit.cpp:694
bool IsTotem() const
Definition: Unit.h:737
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _UnregisterAreaTrigger()

void Unit::_UnregisterAreaTrigger ( AreaTrigger areaTrigger)

Definition at line 5303 of file Unit.cpp.

5304{
5305 std::erase(m_areaTrigger, areaTrigger);
5306 if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
5307 ToCreature()->AI()->JustUnregisteredAreaTrigger(areaTrigger);
5308}
virtual void JustUnregisteredAreaTrigger(AreaTrigger *)
Definition: CreatureAI.h:127
+ Here is the call graph for this function:

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject dynObj)

Definition at line 5138 of file Unit.cpp.

5139{
5140 std::erase(m_dynObj, dynObj);
5141 if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
5143}
virtual void JustUnregisteredDynObject(DynamicObject *)
Definition: CreatureAI.h:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected

Definition at line 2903 of file Unit.cpp.

2904{
2905 SpellInfo const* autoRepeatSpellInfo = m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo;
2906
2907 // check "realtime" interrupts
2908 // don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
2909 if ((isMoving() && m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckMovement() != SPELL_CAST_OK) || IsNonMeleeSpellCast(false, false, true, autoRepeatSpellInfo->Id == 75))
2910 {
2911 // cancel wand shoot
2912 if (autoRepeatSpellInfo->Id != 75)
2914 return;
2915 }
2916
2917 // castroutine
2919 {
2920 // Check if able to cast
2921 SpellCastResult result = m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true);
2922 if (result != SPELL_CAST_OK)
2923 {
2924 if (autoRepeatSpellInfo->Id != 75)
2926 else if (GetTypeId() == TYPEID_PLAYER)
2927 Spell::SendCastResult(ToPlayer(), autoRepeatSpellInfo, m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_SpellVisual, m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_castId, result);
2928
2929 return;
2930 }
2931
2932 // we want to shoot
2933 Spell* spell = new Spell(this, autoRepeatSpellInfo, TRIGGERED_IGNORE_GCD);
2935 }
2936}
@ RANGED_ATTACK
SpellCastResult
@ SPELL_CAST_OK
@ TRIGGERED_IGNORE_GCD
Will ignore GCD.
Definition: SpellDefines.h:247
@ SPELL_STATE_PREPARING
Definition: Spell.h:234
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:587
Definition: Spell.h:254
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, int32 *param1=nullptr, int32 *param2=nullptr)
Definition: Spell.cpp:4636
SpellCastResult prepare(SpellCastTargets const &targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3419
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3056
bool isMoving() const
Definition: Unit.h:1716
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:685
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3014
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _UpdateSpells()

void Unit::_UpdateSpells ( uint32  time)
protected

Definition at line 2842 of file Unit.cpp.

2843{
2844 _spellHistory->Update();
2845
2848
2849 // remove finished spells from current pointers
2850 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
2851 {
2852 if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
2853 {
2854 m_currentSpells[i]->SetReferencedFromCurrent(false);
2855 m_currentSpells[i] = nullptr; // remove pointer
2856 }
2857 }
2858
2859 // m_auraUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
2861 {
2862 Aura* i_aura = m_auraUpdateIterator->second;
2863 ++m_auraUpdateIterator; // need shift to next for allow update if need into aura update
2864 i_aura->UpdateOwner(time, this);
2865 }
2866
2867 // remove expired auras - do that after updates(used in scripts?)
2868 for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
2869 {
2870 if (i->second->IsExpired())
2872 else if (i->second->GetSpellInfo()->IsChanneled() && i->second->GetCasterGUID() != GetGUID() && !ObjectAccessor::GetWorldObject(*this, i->second->GetCasterGUID()))
2873 RemoveOwnedAura(i, AURA_REMOVE_BY_CANCEL); // remove channeled auras when caster is not on the same map
2874 else
2875 ++i;
2876 }
2877
2878 for (AuraApplication* visibleAura : m_visibleAurasToUpdate)
2879 visibleAura->ClientUpdate();
2880
2881 m_visibleAurasToUpdate.clear();
2882
2884
2885 if (!m_gameObj.empty())
2886 {
2887 GameObjectList::iterator itr;
2888 for (itr = m_gameObj.begin(); itr != m_gameObj.end();)
2889 {
2890 if (!(*itr)->isSpawned())
2891 {
2892 (*itr)->SetOwnerGUID(ObjectGuid::Empty);
2893 (*itr)->SetRespawnTime(0);
2894 (*itr)->Delete();
2895 m_gameObj.erase(itr++);
2896 }
2897 else
2898 ++itr;
2899 }
2900 }
2901}
@ AURA_REMOVE_BY_CANCEL
@ SPELL_STATE_FINISHED
Definition: Spell.h:236
#define CURRENT_MAX_SPELL
Definition: Unit.h:591
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: