AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Referenceabstract

#include "Unit.h"

Inheritance diagram for Unit:
WorldObject Object WorldLocation Position Creature Player TempSummon Minion Guardian Puppet Totem Pet

Public Types

typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
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::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 ~Unit () override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
void Update (uint32 time) override
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 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
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
uint8 getLevel () const
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
uint8 getClass () const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 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
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
float GetPowerPct (Powers power) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
int32 GetHealthGain (int32 dVal)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 
void RemoveUnitFlag (UnitFlags flags)
 
void ReplaceAllUnitFlags (UnitFlags flags)
 
UnitFlags2 GetUnitFlags2 () const
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint32 GetFaction () const
 
void SetFaction (uint32 faction)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
void HandleEmoteCommand (uint32 emoteId)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
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 const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
NPCFlags GetNpcFlags () const
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags 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 IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
bool IsCritter () const
 
bool IsInFlight () const
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 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 isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
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 *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client.
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client.
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
void SendMovementFlagUpdate (bool self=false)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true)
 
virtual bool SetSwim (bool enable)
 
virtual bool SetCanFly (bool enable, bool packetOnly=false)
 
virtual bool SetWaterWalking (bool enable, bool packetOnly=false)
 
virtual bool SetFeatherFall (bool enable, bool packetOnly=false)
 
virtual bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &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 onDeath=false)
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
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)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
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, uint8 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, uint8 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, uint8 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)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
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 ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
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 name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList)
 
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, uint8 reqEffMask=0) 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
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *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
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
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, bool bySelf=false)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool IsMovementPreventedByCasting () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
Powers GetPowerTypeByAuraGroup (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)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
bool CanHaveThreatList () const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 modelId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
void UnsummonAllTotems (bool onDeath=false)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------—
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 
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 (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 --------—Combo point system----------------—
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void SendComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------—
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void propagateSpeedChange ()
 -------—End of Pet responses methods-------—
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
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)
 
void BuildMovementPacket (ByteBuffer *data) const
 
virtual bool CanSwim () const
 this method checks the current flag of a unit
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool CanEnterWater () const =0
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
bool CanApplyResilience () const
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, Unit *caster) const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
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
 Return collision height sent to client.
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
std::string GetDebugInfo () const override
 
uint32 GetOldFactionId () const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) 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 startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
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
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () 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 (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &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 (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) 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=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) 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, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () 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
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual 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 *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
virtual std::string GetDebugInfo () 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 (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &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
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
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 (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static void DealDamageMods (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, bool allowGM=false, Spell const *spell=nullptr)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static void ProcDamageAndSpell (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, 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
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Protected Types

typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=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 IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

bool IsTriggeredAtSpellProcEvent (Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
 
bool HandleDummyAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, Spell const *spellProc=nullptr)
 
bool HandleAuraProc (Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
 
bool HandleProcTriggerSpell (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
 
bool HandleOverrideClassScriptAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
 
bool HandleAuraRaidProcFromChargeWithValue (AuraEffect *triggeredByAura)
 
bool HandleAuraRaidProcFromCharge (AuraEffect *triggeredByAura)
 
void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
float processDummyAuras (float TakenTotalMod) const
 

Private Attributes

uint32 m_state
 
uint32 m_CombatTimer
 
uint32 m_lastManaUse
 
Diminishing m_Diminishing
 
HostileRefMgr m_HostileRefMgr
 
FollowerRefMgr m_FollowingRefMgr
 
Unitm_comboTarget
 
int8 m_comboPoints
 
std::unordered_set< Unit * > m_ComboPointHolders
 
RedirectThreatInfo _redirectThreatInfo
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
uint32 _oldFactionId
 faction before charm
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed?
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 

Detailed Description

Member Typedef Documentation

◆ AttackerSet

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

◆ AuraApplicationList

◆ AuraApplicationMap

◆ AuraApplicationMapBounds

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

◆ AuraApplicationMapBoundsNonConst

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

◆ AuraEffectList

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

◆ AuraList

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

◆ AuraMap

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

◆ AuraMapBounds

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

◆ AuraMapBoundsNonConst

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

◆ AuraStateAurasMap

◆ AuraStateAurasMapBounds

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

◆ CharmThreatMap

typedef std::map<ObjectGuid, float> Unit::CharmThreatMap
protected

◆ ComboPointHolderSet

◆ ControlSet

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

◆ Diminishing

◆ DynObjectList

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

◆ GameObjectList

typedef GuidList Unit::GameObjectList
protected

◆ PetAuraSet

typedef std::set<PetAura const*> Unit::PetAuraSet

◆ VisibleAuraMap

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
override
360{
361 // set current spells as deletable
362 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
363 if (m_currentSpells[i])
364 {
366 m_currentSpells[i] = nullptr;
367 }
368
370
371 delete i_motionMaster;
372 delete m_charmInfo;
373 delete movespline;
374
377 ASSERT(m_attackers.empty());
378
379 // pussywizard: clear m_sharedVision along with back references
380 if (!m_sharedVision.empty())
381 {
382 do
383 {
384 Player* p = *(m_sharedVision.begin());
385 p->m_isInSharedVisionOf.erase(this);
386 m_sharedVision.remove(p);
387 } while (!m_sharedVision.empty());
388 }
389
390 ASSERT(m_Controlled.empty());
391 ASSERT(m_appliedAuras.empty());
392 ASSERT(m_ownedAuras.empty());
393 ASSERT(m_removedAuras.empty());
394 ASSERT(m_gameObj.empty());
395 ASSERT(m_dynObj.empty());
396
397 if (m_movedByPlayer && m_movedByPlayer != this)
398 LOG_INFO("misc", "Unit::~Unit (A1)");
399
401}
#define ASSERT
Definition: Errors.h:68
std::uint8_t uint8
Definition: Define.h:110
#define LOG_INFO(filterType__,...)
Definition: Log.h:167
#define CURRENT_MAX_SPELL
Definition: Unit.h:985
Definition: Player.h:1046
std::set< Unit * > m_isInSharedVisionOf
Definition: Player.h:2284
bool m_duringRemoveFromWorld
Definition: Unit.h:2589
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition: Unit.h:2501
AuraList m_removedAuras
Definition: Unit.h:2505
ControlSet m_Controlled
Definition: Unit.h:1867
Movement::MoveSpline * movespline
Definition: Unit.h:2440
CharmInfo * m_charmInfo
Definition: Unit.h:2522
MotionMaster * i_motionMaster
Definition: Unit.h:2525
void _DeleteRemovedAuras()
Definition: Unit.cpp:3788
DynObjectList m_dynObj
Definition: Unit.h:2495
SafeUnitPointer m_movedByPlayer
Definition: Unit.h:1888
AttackerSet m_attackers
Definition: Unit.h:2487
Unit * m_attacking
Definition: Unit.h:2488
GameObjectList m_gameObj
Definition: Unit.h:2498
AuraMap m_ownedAuras
Definition: Unit.h:2503
AuraApplicationMap m_appliedAuras
Definition: Unit.h:2504
static void HandleSafeUnitPointersOnDelete(Unit *thisUnit)
Definition: Unit.cpp:4269
SharedVisionList m_sharedVision
Definition: Unit.h:2523
void SetReferencedFromCurrent(bool yes)
Definition: Spell.h:558

References _DeleteRemovedAuras(), ASSERT, CURRENT_MAX_SPELL, HandleSafeUnitPointersOnDelete(), i_motionMaster, LOG_INFO, m_appliedAuras, m_attackers, m_attacking, m_charmInfo, m_Controlled, m_currentSpells, m_duringRemoveFromWorld, m_dynObj, m_gameObj, Player::m_isInSharedVisionOf, m_movedByPlayer, m_ownedAuras, m_removedAuras, m_sharedVision, movespline, and Spell::SetReferencedFromCurrent().

◆ Unit()

Unit::Unit ( bool  isWorldObject)
explicitprotected
206 : WorldObject(isWorldObject),
207 m_movedByPlayer(nullptr),
209 IsAIEnabled(false),
210 NeedChangeAI(false),
212 m_CreatedByPlayer(false),
214 i_AI(nullptr),
215 i_disabledAI(nullptr),
216 m_realRace(0),
217 m_race(0),
219 m_procDeep(0),
221 i_motionMaster(new MotionMaster(this)),
222 m_regenTimer(0),
223 m_ThreatMgr(this),
224 m_vehicle(nullptr),
225 m_vehicleKit(nullptr),
227 m_HostileRefMgr(this),
228 m_comboTarget(nullptr),
230{
231#ifdef _MSC_VER
232#pragma warning(default:4355)
233#endif
236
238
245
246 m_canDualWield = false;
247
248 m_rootTimes = 0;
249
250 m_state = 0;
252
253 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
254 m_currentSpells[i] = nullptr;
255
256 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
257 m_SummonSlot[i].Clear();
258
259 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
260 m_ObjectSlot[i].Clear();
261
263
264 m_interruptMask = 0;
265 m_transform = 0;
266 m_canModifyStats = false;
267
268 for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i)
269 m_spellImmune[i].clear();
270
271 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
272 {
277 }
278 // implement 50% base damage from offhand
280
281 for (uint8 i = 0; i < MAX_ATTACK; ++i)
282 {
285
286 m_weaponDamage[i][MINDAMAGE][1] = 0.f;
287 m_weaponDamage[i][MAXDAMAGE][1] = 0.f;
288 }
289
290 for (uint8 i = 0; i < MAX_STATS; ++i)
291 m_createStats[i] = 0.0f;
292
293 m_attacking = nullptr;
294 m_modMeleeHitChance = 0.0f;
296 m_modSpellHitChance = 0.0f;
298
299 m_CombatTimer = 0;
300 m_lastManaUse = 0;
301
302 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
303 m_threatModifier[i] = 1.0f;
304
305 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
306 m_speed_rate[i] = 1.0f;
307
308 m_charmInfo = nullptr;
309
311
312 // remove aurastates allowing special moves
313 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
314 m_reactiveTimer[i] = 0;
315
316 m_cleanupDone = false;
318
320
321 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
326
327 m_applyResilience = false;
328 _instantCast = false;
329
330 _lastLiquid = nullptr;
331
332 _oldFactionId = 0;
333
334 _isWalkingBeforeCharm = false;
335
337}
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:51
@ UPDATEFLAG_LIVING
Definition: UpdateData.h:44
@ UPDATEFLAG_STATIONARY_POSITION
Definition: UpdateData.h:45
@ UNIT_MASK_NONE
Definition: Unit.h:674
@ OFF_ATTACK
Definition: Unit.h:397
@ MAX_ATTACK
Definition: Unit.h:399
@ BASE_ATTACK
Definition: Unit.h:396
@ RANGED_ATTACK
Definition: Unit.h:398
@ MINDAMAGE
Definition: Unit.h:254
@ MAXDAMAGE
Definition: Unit.h:255
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:285
@ UNIT_MOD_END
Definition: Unit.h:287
@ ALIVE
Definition: Unit.h:316
#define MAX_MOVE_TYPE
Definition: Unit.h:389
#define MAX_SUMMON_SLOT
Definition: Unit.h:1215
@ BASE_VALUE
Definition: Unit.h:245
@ TOTAL_VALUE
Definition: Unit.h:247
@ TOTAL_PCT
Definition: Unit.h:248
@ BASE_PCT
Definition: Unit.h:246
#define BASE_MAXDAMAGE
Definition: Unit.h:39
@ MAX_REACTIVE
Definition: Unit.h:1207
#define MAX_GAMEOBJECT_SLOT
Definition: Unit.h:1217
#define BASE_MINDAMAGE
Definition: Unit.h:38
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1246
#define MAX_STATS
Definition: SharedDefines.h:237
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:264
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1253
#define MAX_SPELL_IMMUNITY
Definition: SharedDefines.h:1376
uint16 m_objectType
Definition: Object.h:228
uint16 m_updateFlag
Definition: Object.h:231
TypeID m_objectTypeId
Definition: Object.h:230
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:360
Definition: Object.h:393
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:509
void Relocate(float x, float y)
Definition: Position.h:73
Definition: Unit.h:948
uint32 m_reactiveTimer[MAX_REACTIVE]
Definition: Unit.h:2527
uint32 m_lastSanctuaryTime
Definition: Unit.h:2137
LiquidTypeEntry const * _lastLiquid
Definition: Unit.h:2538
uint32 m_transform
Definition: Unit.h:2499
uint32 m_CombatTimer
Definition: Unit.h:2572
bool m_canModifyStats
Definition: Unit.h:2517
bool NeedChangeAI
Definition: Unit.h:2350
uint32 m_state
Definition: Unit.h:2571
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]
Definition: Unit.h:2515
int32 m_attackTimer[MAX_ATTACK]
Definition: Unit.h:2483
float m_modAttackSpeedPct[3]
Definition: Unit.h:2091
uint8 m_realRace
Definition: Unit.h:2478
Vehicle * m_vehicle
Definition: Unit.h:2534
uint32 m_rootTimes
Definition: Unit.h:2568
uint8 m_race
Definition: Unit.h:2479
UnitAI * i_AI
Definition: Unit.h:2471
uint32 _lastExtraAttackSpell
Definition: Unit.h:2596
bool _instantCast
Definition: Unit.h:2544
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]
Definition: Unit.h:2069
RedirectThreatInfo _redirectThreatInfo
Definition: Unit.h:2586
float m_createStats[MAX_STATS]
Definition: Unit.h:2485
float m_modRangedHitChance
Definition: Unit.h:2086
DeathState m_deathState
Definition: Unit.h:2490
uint32 m_unitTypeMask
Definition: Unit.h:2537
uint32 m_removedAurasCount
Definition: Unit.h:2507
ThreatMgr m_ThreatMgr
Definition: Unit.h:2530
Unit * m_comboTarget
Definition: Unit.h:2582
AuraMap::iterator m_auraUpdateIterator
Definition: Unit.h:2506
bool m_AutoRepeatFirstCast
Definition: Unit.h:2481
uint16 m_delayed_unit_ai_notify_timer
Definition: Unit.h:2412
int32 m_regenTimer
Definition: Unit.h:2528
bool bRequestForcedVisibilityUpdate
Definition: Unit.h:2413
bool m_ControlledByPlayer
Definition: Unit.h:2362
uint32 m_last_notify_mstime
Definition: Unit.h:2410
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition: Unit.h:2136
int8 m_comboPoints
Definition: Unit.h:2583
uint32 _oldFactionId
faction before charm
Definition: Unit.h:2591
int32 m_baseSpellCritChance
Definition: Unit.h:2088
float m_modMeleeHitChance
Definition: Unit.h:2085
float m_weaponDamage[MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
Definition: Unit.h:2516
Position m_last_notify_position
Definition: Unit.h:2409
Vehicle * m_vehicleKit
Definition: Unit.h:2535
bool IsAIEnabled
Definition: Unit.h:2350
HostileRefMgr m_HostileRefMgr
Definition: Unit.h:2578
bool m_applyResilience
Definition: Unit.h:2541
bool m_canDualWield
Definition: Unit.h:1356
uint32 m_interruptMask
Definition: Unit.h:2513
int32 m_procDeep
Definition: Unit.h:2492
float m_speed_rate[MAX_MOVE_TYPE]
Definition: Unit.h:2520
float m_modSpellHitChance
Definition: Unit.h:2087
UnitAI * i_disabledAI
Definition: Unit.h:2471
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition: Unit.h:2068
bool m_cleanupDone
Definition: Unit.h:2588
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition: Unit.h:2592
bool m_CreatedByPlayer
Definition: Unit.h:2363
uint16 m_delayed_unit_relocation_timer
Definition: Unit.h:2411
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition: Unit.h:2090
uint32 m_lastManaUse
Definition: Unit.h:2573
Definition: MotionMaster.h:110
Definition: MoveSpline.h:40

References _instantCast, _isWalkingBeforeCharm, _lastExtraAttackSpell, _lastLiquid, _oldFactionId, _redirectThreatInfo, ALIVE, BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, bRequestForcedVisibilityUpdate, CURRENT_MAX_SPELL, GHOST_VISIBILITY_ALIVE, m_applyResilience, m_attacking, m_attackTimer, m_auraModifiersGroup, m_auraUpdateIterator, m_baseSpellCritChance, m_canDualWield, m_canModifyStats, m_charmInfo, m_cleanupDone, m_CombatTimer, m_createStats, m_currentSpells, m_deathState, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_duringRemoveFromWorld, m_interruptMask, m_last_notify_mstime, m_last_notify_position, m_lastManaUse, m_modAttackSpeedPct, m_modMeleeHitChance, m_modRangedHitChance, m_modSpellHitChance, m_ObjectSlot, Object::m_objectType, Object::m_objectTypeId, m_ownedAuras, m_reactiveTimer, m_rootTimes, WorldObject::m_serverSideVisibility, m_speed_rate, m_spellImmune, m_state, m_SummonSlot, m_threatModifier, m_transform, Object::m_updateFlag, m_weaponDamage, MAX_ATTACK, MAX_GAMEOBJECT_SLOT, MAX_MOVE_TYPE, MAX_REACTIVE, MAX_SPELL_IMMUNITY, MAX_SPELL_SCHOOL, MAX_STATS, MAX_SUMMON_SLOT, MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), TOTAL_PCT, TOTAL_VALUE, TYPEID_UNIT, TYPEMASK_UNIT, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_END, UPDATEFLAG_LIVING, and UPDATEFLAG_STATIONARY_POSITION.

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit pAttacker)
inline
1359 {
1360 m_attackers.insert(pAttacker);
1361 }

References m_attackers.

Referenced by Attack().

◆ _AddAura()

void Unit::_AddAura ( UnitAura aura,
Unit caster 
)
4355{
4357 m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
4358
4360
4361 if (aura->IsRemoved())
4362 return;
4363
4365 if (aura->IsSingleTarget())
4366 {
4367 ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
4368 /* @HACK: Player is not in world during loading auras.
4369 * Single target auras are not saved or loaded from database
4370 * but may be created as a result of aura links (player mounts with passengers)
4371 */
4372
4373 // register single target aura
4374 caster->GetSingleCastAuras().push_back(aura);
4375 // remove other single target auras
4376 Unit::AuraList& scAuras = caster->GetSingleCastAuras();
4377 for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
4378 {
4379 if ((*itr) != aura &&
4380 (*itr)->IsSingleTargetWith(aura))
4381 {
4382 (*itr)->Remove();
4383 itr = scAuras.begin();
4384 }
4385 else
4386 ++itr;
4387 }
4388 }
4389}
@ SPELL_AURA_CONTROL_VEHICLE
Definition: SpellAuraDefines.h:299
bool IsInWorld() const
Definition: Object.h:101
ObjectGuid GetGUID() const
Definition: Object.h:107
void _RemoveNoStackAurasDueToAura(Aura *aura)
Definition: Unit.cpp:4599
std::list< Aura * > AuraList
Definition: Unit.h:1307
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:2396
AuraList & GetSingleCastAuras()
Definition: Unit.h:1968
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:105
bool IsRemoved() const
Definition: SpellAuras.h:161
uint32 GetId() const
Definition: SpellAuras.cpp:466
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1236
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
void SetIsSingleTarget(bool val)
Definition: SpellAuras.h:166
bool IsSingleTarget() const
Definition: SpellAuras.h:164
bool IsSingleTarget() const
Definition: SpellInfo.cpp:1358

References _RemoveNoStackAurasDueToAura(), ASSERT, Aura::GetCasterGUID(), Object::GetGUID(), Aura::GetId(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::HasEffectType(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Aura::IsRemoved(), Aura::IsSingleTarget(), SpellInfo::IsSingleTarget(), Aura::IsSingleTargetWith(), m_cleanupDone, m_ownedAuras, Aura::SetIsSingleTarget(), and SPELL_AURA_CONTROL_VEHICLE.

Referenced by UnitAura::UnitAura().

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )
5407{
5408 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5409 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
5410}
@ AURA_EFFECT_HANDLE_STAT
Definition: SpellAuraDefines.h:46

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_ApplyAllStatBonuses().

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication aurApp,
uint8  effMask 
)
4446{
4447 Aura* aura = aurApp->GetBase();
4448
4450
4451 if (aurApp->GetRemoveMode())
4452 return;
4453
4454 Unit* caster = aura->GetCaster();
4455
4456 // Update target aura state flag
4457 SpellInfo const* spellInfo = aura->GetSpellInfo();
4458 if (AuraStateType aState = spellInfo->GetAuraState())
4459 {
4460 if (aState != AURA_STATE_CONFLAGRATE)
4461 {
4462 // Sting (hunter's pet ability), Faerie Fire (druid versions)
4463 if (aState == AURA_STATE_FAERIE_FIRE)
4465
4466 ModifyAuraState(aState, true);
4467 }
4468 else if (caster)
4469 {
4471 m_Events.AddEvent(pEvent, m_Events.CalculateTime(700)); // intended 700ms delay before allowing to cast conflagrate
4472 }
4473 }
4474
4475 if (aurApp->GetRemoveMode())
4476 return;
4477
4478 // Sitdown on apply aura req seated
4481
4482 if (aurApp->GetRemoveMode())
4483 return;
4484
4485 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
4486
4487 // apply effects of the aura
4488 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4489 {
4490 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
4491 aurApp->_HandleEffect(i, true);
4492 }
4493
4494 sScriptMgr->OnAuraApply(this, aura);
4495}
@ UNIT_STAND_STATE_SIT
Definition: Unit.h:54
#define sScriptMgr
Definition: ScriptMgr.h:2702
@ SPELL_AURA_MOD_STEALTH
Definition: SpellAuraDefines.h:79
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition: SpellDefines.h:62
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1610
AuraStateType
Definition: SharedDefines.h:1260
@ AURA_STATE_FAERIE_FIRE
Definition: SharedDefines.h:1276
@ AURA_STATE_CONFLAGRATE
Definition: SharedDefines.h:1278
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.h:105
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:158
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Definition: Unit.h:1290
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:10457
EventProcessor m_Events
Definition: Unit.h:2094
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5025
void SetStandState(uint8 state)
Definition: Unit.cpp:16900
bool IsSitState() const
Definition: Unit.cpp:16885
Definition: Unit.h:2658
Unit * GetTarget() const
Definition: SpellAuras.h:61
void _HandleEffect(uint8 effIndex, bool apply)
Definition: SpellAuras.cpp:161
Aura * GetBase() const
Definition: SpellAuras.h:62
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:73
Definition: SpellAuras.h:87
Unit * GetCaster() const
Definition: SpellAuras.cpp:471
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition: SpellAuras.cpp:1279
Definition: SpellInfo.h:314
AuraStateType GetAuraState() const
Definition: SpellInfo.cpp:2045
uint32 AuraInterruptFlags
Definition: SpellInfo.h:351

References AuraApplication::_HandleEffect(), _RemoveNoStackAurasDueToAura(), EventProcessor::AddEvent(), AURA_INTERRUPT_FLAG_NOT_SEATED, AURA_STATE_CONFLAGRATE, AURA_STATE_FAERIE_FIRE, SpellInfo::AuraInterruptFlags, EventProcessor::CalculateTime(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Object::GetGUID(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), IsSitState(), m_Events, MAX_SPELL_EFFECTS, ModifyAuraState(), RemoveAurasByType(), SetStandState(), SPELL_AURA_MOD_STEALTH, sScriptMgr, and UNIT_STAND_STATE_SIT.

Referenced by _ApplyAuraEffect().

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura aura,
uint8  effIndex 
)
4432{
4433 ASSERT(aura);
4434 ASSERT(aura->HasEffect(effIndex));
4436 ASSERT(aurApp);
4437 if (!aurApp->GetEffectMask())
4438 _ApplyAura(aurApp, 1 << effIndex);
4439 else
4440 aurApp->_HandleEffect(effIndex, true);
4441}
void _ApplyAura(AuraApplication *aurApp, uint8 effMask)
Definition: Unit.cpp:4445
Definition: SpellAuras.h:37
uint8 GetEffectMask() const
Definition: SpellAuras.h:66
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:173
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:183

References _ApplyAura(), AuraApplication::_HandleEffect(), ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetEffectMask(), Object::GetGUID(), and Aura::HasEffect().

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura aura,
uint8  effMask 
)
4394{
4395 // can't apply aura on unit which is going to be deleted - to not create a memory leak
4397 // aura musn't be removed
4398 ASSERT(!aura->IsRemoved());
4399
4400 // aura mustn't be already applied on target
4401 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
4402
4403 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
4404 uint32 aurId = aurSpellInfo->Id;
4405
4406 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
4407 // Xinef: Added IsAllowingDeadTarget check
4408 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading()))
4409 return nullptr;
4410
4411 Unit* caster = aura->GetCaster();
4412
4413 AuraApplication* aurApp = new AuraApplication(this, caster, aura, effMask);
4414 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
4415
4416 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4417 // xinef: even if it gets removed, it will be reapplied in a second
4418 if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner())
4419 {
4420 m_interruptableAuras.push_back(aurApp);
4421 AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
4422 }
4423
4424 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
4425 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
4426
4427 aura->_ApplyForTarget(this, caster, aurApp);
4428 return aurApp;
4429}
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
void AddInterruptMask(uint32 mask)
Definition: Unit.h:2163
bool IsAlive() const
Definition: Unit.h:1808
AuraApplicationList m_interruptableAuras
Definition: Unit.h:2511
AuraStateAurasMap m_auraStateAuras
Definition: Unit.h:2512
WorldObject * GetOwner() const
Definition: SpellAuras.h:107
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition: SpellAuras.h:185
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:492
bool IsDeathPersistent() const
Definition: SpellInfo.cpp:1201
uint32 Id
Definition: SpellInfo.h:318
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1211

References Aura::_ApplyForTarget(), AddInterruptMask(), ASSERT, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), Aura::GetCaster(), Object::GetGUID(), Aura::GetOwner(), Aura::GetSpellInfo(), Object::GetTypeId(), SpellInfo::Id, IsAlive(), SpellInfo::IsAllowingDeadTarget(), Aura::IsAppliedOnTarget(), SpellInfo::IsDeathPersistent(), Aura::IsRemoved(), m_appliedAuras, m_auraStateAuras, m_cleanupDone, m_interruptableAuras, Object::ToPlayer(), and TYPEID_PLAYER.

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected
3789{
3790 while (!m_removedAuras.empty())
3791 {
3792 delete m_removedAuras.front();
3793 m_removedAuras.pop_front();
3794 }
3795}

References m_removedAuras.

Referenced by _UpdateSpells(), and ~Unit().

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)
19815{
19816 // Must be called only from aura handler
19817 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
19818 return;
19819
19820 if (m_vehicle)
19821 {
19822 if (m_vehicle == vehicle)
19823 {
19824 if (seatId >= 0 && seatId != GetTransSeat())
19825 {
19826 LOG_DEBUG("vehicles", "EnterVehicle: {} leave vehicle {} seat {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
19827 ChangeSeat(seatId);
19828 }
19829
19830 return;
19831 }
19832 else
19833 {
19834 LOG_DEBUG("vehicles", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
19835 ExitVehicle();
19836 }
19837 }
19838
19839 if (!aurApp || aurApp->GetRemoveMode())
19840 return;
19841
19842 if (Player* player = ToPlayer())
19843 {
19844 if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->IsInCombat())
19845 return;
19846
19847 sScriptMgr->AnticheatSetUnderACKmount(player);
19848 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19849
19851 player->StopCastingCharm();
19852 player->StopCastingBindSight();
19853 Dismount();
19855
19856 // drop flag at invisible in bg
19857 if (Battleground* bg = player->GetBattleground())
19858 bg->EventPlayerDroppedFlag(player);
19859
19861 player->GetSession()->SendPacket(&data);
19862 }
19863
19864 ASSERT(!m_vehicle);
19865 m_vehicle = vehicle;
19866
19867 if (!m_vehicle->AddPassenger(this, seatId))
19868 {
19869 m_vehicle = nullptr;
19870 return;
19871 }
19872
19873 // Xinef: remove movement auras when entering vehicle (food buffs etc)
19875}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
@ AURA_INTERRUPT_FLAG_MOVE
Definition: SpellDefines.h:47
@ AURA_INTERRUPT_FLAG_TURNING
Definition: SpellDefines.h:48
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition: Opcodes.h:1211
Definition: Battleground.h:293
uint32 GetEntry() const
Definition: Object.h:109
int8 GetTransSeat() const
Definition: Object.h:591
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4069
void Dismount()
Definition: Unit.cpp:13435
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.h:2355
void ChangeSeat(int8 seatId, bool next=true)
Definition: Unit.cpp:19877
Vehicle * GetVehicleKit() const
Definition: Unit.h:2353
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5096
void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19896
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:39
bool AddPassenger(Unit *passenger, int8 seatId=-1)
Definition: Vehicle.cpp:307
Definition: WorldPacket.h:27

References Vehicle::AddPassenger(), ASSERT, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, ChangeSeat(), Dismount(), ExitVehicle(), Vehicle::GetBase(), Object::GetEntry(), AuraApplication::GetRemoveMode(), WorldObject::GetTransSeat(), Object::GetTypeId(), GetVehicleKit(), InterruptNonMeleeSpells(), IsAlive(), IsOnVehicle(), LOG_DEBUG, m_vehicle, RemoveAurasByType(), RemoveAurasWithInterruptFlags(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SPELL_AURA_MOUNTED, sScriptMgr, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by AuraEffect::HandleAuraControlVehicle().

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)
19935{
19936 if (!m_vehicle)
19937 return;
19938
19940
19941 Player* player = ToPlayer();
19942
19943 // If player is on mouted duel and exits the mount should immediatly lose the duel
19944 if (player && player->duel && player->duel->IsMounted)
19945 player->DuelComplete(DUEL_FLED);
19946
19947 // This should be done before dismiss, because there may be some aura removal
19948 Vehicle* vehicle = m_vehicle;
19949 Unit* vehicleBase = m_vehicle->GetBase();
19950 m_vehicle = nullptr;
19951
19952 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
19953
19954 Position pos;
19955 if (!exitPosition) // Exit position not specified
19956 pos = vehicleBase->GetPosition(); // This should use passenger's current position, leaving it as it is now
19957 // because we calculate positions incorrect (sometimes under map)
19958 else
19959 pos = *exitPosition;
19960
19961 // HACK
19962 VehicleEntry const* vehicleInfo = vehicle->GetVehicleInfo();
19963 if (vehicleInfo)
19964 {
19965 if (vehicleInfo->m_ID == 380) // Kologarn right arm
19966 {
19967 pos.Relocate(1776.0f, -24.0f, 448.75f, 0.0f);
19968 }
19969 else if (vehicleInfo->m_ID == 91) // Helsman's Ship
19970 {
19971 pos.Relocate(2802.18f, 7054.91f, -0.6f, 4.67f);
19972 }
19973 else if (vehicleInfo->m_ID == 349) // AT Mounts, dismount to the right
19974 {
19975 float x = pos.GetPositionX() + 2.0f * cos(pos.GetOrientation() - M_PI / 2.0f);
19976 float y = pos.GetPositionY() + 2.0f * std::sin(pos.GetOrientation() - M_PI / 2.0f);
19977 float z = GetMapHeight(x, y, pos.GetPositionZ());
19978 if (z > INVALID_HEIGHT)
19979 {
19980 pos.Relocate(x, y, z);
19981 }
19982 }
19983 }
19984
19986
19987 if (player)
19988 {
19990
19991 sScriptMgr->AnticheatSetUnderACKmount(player);
19992 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19993 }
19995 {
19997 data << GetPackGUID();
19998 SendMessageToSet(&data, false);
19999 }
20000
20001 // xinef: hack for flameleviathan seat vehicle
20002 if (!vehicleInfo || vehicleInfo->m_ID != 341)
20003 {
20004 Movement::MoveSplineInit init(this);
20005 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
20006 init.SetFacing(GetOrientation());
20007 init.SetTransportExit();
20008 init.Launch();
20009 }
20010 else
20011 {
20012 float o = pos.GetAngle(this);
20013 Movement::MoveSplineInit init(this);
20014 init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
20015 init.SetFacing(GetOrientation());
20016 init.SetTransportExit();
20017 init.Launch();
20018 DisableSpline();
20019 KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f);
20021 }
20022
20023 // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest
20024 if (GetTypeId() == TYPEID_UNIT && !CanFly() && vehicleInfo && (vehicleInfo->m_ID == 113 || vehicleInfo->m_ID == 8 || vehicleInfo->m_ID == 290 || vehicleInfo->m_ID == 298))
20025 {
20027 }
20028
20029 if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
20030 if (((Minion*)vehicleBase)->GetOwner() == this)
20031 {
20032 if (!vehicleInfo || vehicleInfo->m_ID != 349)
20033 {
20034 vehicle->Dismiss();
20035 }
20036 else if (vehicleBase->GetTypeId() == TYPEID_UNIT)
20037 {
20038 vehicle->Uninstall();
20039 vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000));
20040 }
20041
20042 // xinef: ugly hack, no appripriate hook later to cast spell
20043 if (player)
20044 {
20045 if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER)
20046 player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true);
20047 else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER)
20048 player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true);
20049 }
20050 }
20051
20053 {
20054 // Vehicle just died, we die too
20055 if (vehicleBase->getDeathState() == JUST_DIED)
20057 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
20058 else
20059 {
20060 SetVisible(false);
20061 ToTempSummon()->UnSummon(2000); // Approximation
20062 }
20063 }
20064
20065 if (player)
20067}
@ DELAYED_VEHICLE_TELEPORT
Definition: Player.h:901
@ MOVEMENTFLAG_ROOT
Definition: Unit.h:563
@ UNIT_MASK_ACCESSORY
Definition: Unit.h:684
@ UNIT_MASK_MINION
Definition: Unit.h:676
@ JUST_DIED
Definition: Unit.h:317
@ UNIT_STATE_ROOT
Definition: Unit.h:335
@ UNIT_STATE_MOVE
Definition: Unit.h:344
@ VEHICLE_SPELL_PARACHUTE
Definition: VehicleDefines.h:54
@ VEHICLE_SPELL_SHADE_CONTROL_END
Definition: VehicleDefines.h:57
@ VEHICLE_SPELL_GEIST_CONTROL_END
Definition: VehicleDefines.h:56
@ NPC_EIDOLON_WATCHER
Definition: VehicleDefines.h:62
@ NPC_LITHE_STALKER
Definition: VehicleDefines.h:63
#define INVALID_HEIGHT
Definition: Map.h:164
@ DUEL_FLED
Definition: SharedDefines.h:3586
@ SMSG_SPLINE_MOVE_UNROOT
Definition: Opcodes.h:802
Seconds GetGameTime()
Definition: GameTime.cpp:38
virtual void UnSummon(uint32 msTime=0)
Definition: TemporarySummon.cpp:283
Definition: TemporarySummon.h:76
PackedGuid const & GetPackGUID() const
Definition: Object.h:108
float GetMapHeight(float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
Definition: Object.cpp:3049
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.h:482
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
void GetPosition(float &x, float &y) const
Definition: Position.h:122
float GetPositionY() const
Definition: Position.h:118
float GetAngle(const Position *pos) const
Definition: Position.cpp:77
void DuelComplete(DuelCompleteType type)
Definition: Player.cpp:6309
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2285
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1828
void ResummonPetTemporaryUnSummonedIfAny()
Definition: Player.cpp:14115
uint32 GetDelayedOperations() const
Definition: Player.h:2049
void SetVisible(bool x)
Definition: Unit.cpp:14129
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14447
Unit * GetOwner() const
Definition: Unit.cpp:10560
DeathState getDeathState()
Definition: Unit.h:1811
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition: Unit.h:2262
TempSummon * ToTempSummon()
Definition: Unit.h:2400
void DisableSpline()
Definition: Unit.cpp:655
void AddUnitState(uint32 f)
Definition: Unit.h:1397
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18192
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2274
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:1407
void KnockbackFrom(float x, float y, float speedXY, float speedZ)
Definition: Unit.cpp:19311
Definition: Unit.h:2681
Definition: Vehicle.h:30
void Dismiss()
Definition: Vehicle.cpp:526
VehicleEntry const * GetVehicleInfo() const
Definition: Vehicle.h:40
void RemovePassenger(Unit *passenger)
Definition: Vehicle.cpp:447
void Uninstall()
Definition: Vehicle.cpp:99
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:545
Definition: MoveSplineInit.h:71
Definition: DBCStructure.h:2003
uint32 m_ID
Definition: DBCStructure.h:2004

References EventProcessor::AddEvent(), AddUnitState(), EventProcessor::CalculateTime(), CanFly(), CastSpell(), DELAYED_VEHICLE_TELEPORT, DisableSpline(), Vehicle::Dismiss(), Player::duel, DUEL_FLED, Player::DuelComplete(), Position::GetAngle(), Vehicle::GetBase(), getDeathState(), Player::GetDelayedOperations(), Object::GetEntry(), GameTime::GetGameTime(), WorldObject::GetMapHeight(), GetMotionMaster(), Position::GetOrientation(), GetOwner(), Object::GetPackGUID(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), Vehicle::GetVehicleInfo(), HasUnitMovementFlag(), HasUnitTypeMask(), INVALID_HEIGHT, JUST_DIED, KnockbackFrom(), Movement::MoveSplineInit::Launch(), m_Events, VehicleEntry::m_ID, m_vehicle, MotionMaster::MoveFall(), MOVEMENTFLAG_ROOT, Movement::MoveSplineInit::MoveTo(), NPC_EIDOLON_WATCHER, NPC_LITHE_STALKER, Position::Relocate(), Vehicle::RemovePassenger(), Player::ResummonPetTemporaryUnSummonedIfAny(), WorldObject::SendMessageToSet(), SetControlled(), setDeathState(), Movement::MoveSplineInit::SetFacing(), Player::SetFallInformation(), Movement::MoveSplineInit::SetTransportExit(), SetVisible(), SMSG_SPLINE_MOVE_UNROOT, sScriptMgr, Object::ToPlayer(), ToTempSummon(), TYPEID_UNIT, Vehicle::Uninstall(), UNIT_MASK_ACCESSORY, UNIT_MASK_MINION, UNIT_STATE_MOVE, UNIT_STATE_ROOT, TempSummon::UnSummon(), VEHICLE_SPELL_GEIST_CONTROL_END, VEHICLE_SPELL_PARACHUTE, and VEHICLE_SPELL_SHADE_CONTROL_END.

Referenced by AuraEffect::HandleAuraControlVehicle(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ _IsNoStackAuraDueToAura()

bool Unit::_IsNoStackAuraDueToAura ( Aura appliedAura,
Aura existingAura 
) const

◆ _IsValidAssistTarget()

bool Unit::_IsValidAssistTarget ( Unit const *  target,
SpellInfo const *  bySpell 
) const
13903{
13904 ASSERT(target);
13905
13906 // can assist to self
13907 if (this == target)
13908 return true;
13909
13910 // can't assist unattackable units or GMs
13911 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13912 || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster()))
13913 return false;
13914
13915 // can't assist own vehicle or passenger
13916 if (m_vehicle)
13917 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13918 return false;
13919
13920 // can't assist invisible
13921 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
13922 return false;
13923
13924 // can't assist dead
13925 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13926 return false;
13927
13928 // can't assist untargetable
13929 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13930 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13931 return false;
13932
13933 if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
13934 {
13935 // xinef: do not allow to assist non attackable units
13936 if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
13937 return false;
13938
13940 {
13941 if (target->IsImmuneToPC())
13942 return false;
13943 }
13944 else
13945 {
13946 if (target->IsImmuneToNPC())
13947 return false;
13948 }
13949 }
13950
13951 // can't assist non-friendly targets
13952 if (GetReactionTo(target) < REP_NEUTRAL
13953 && target->GetReactionTo(this) < REP_NEUTRAL
13954 && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)))
13955 return false;
13956
13957 // PvP case
13958 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
13959 {
13960 Player const* targetPlayerOwner = target->GetAffectingPlayer();
13962 {
13963 Player const* selfPlayerOwner = GetAffectingPlayer();
13964 if (selfPlayerOwner && targetPlayerOwner)
13965 {
13966 // can't assist player which is dueling someone
13967 if (selfPlayerOwner != targetPlayerOwner
13968 && targetPlayerOwner->duel)
13969 return false;
13970 }
13971 // can't assist player in ffa_pvp zone from outside
13972 if (target->IsFFAPvP() && !IsFFAPvP())
13973 return false;
13974
13975 // can't assist player out of sanctuary from sanctuary if has pvp enabled
13976 if (target->IsPvP())
13977 if (IsInSanctuary() && !target->IsInSanctuary())
13978 return false;
13979 }
13980 }
13981 // PvC case - player can assist creature only if has specific type flags
13982 // !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
13984 && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
13985 && !target->IsPvP())
13986 {
13987 if (Creature const* creatureTarget = target->ToCreature())
13988 return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST;
13989 }
13990 return true;
13991}
@ UNIT_STATE_UNATTACKABLE
Definition: Unit.h:362
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: Unit.h:451
@ REP_NEUTRAL
Definition: SharedDefines.h:155
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Definition: SharedDefines.h:2693
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition: SharedDefines.h:2679
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
Definition: SharedDefines.h:600
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:589
@ SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC
Definition: SharedDefines.h:579
Definition: Creature.h:46
Creature * ToCreature()
Definition: Object.h:197
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1726
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition: Unit.cpp:10037
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:1480
bool IsInSanctuary() const
Definition: Unit.h:1516
bool IsFFAPvP() const
Definition: Unit.h:1518
Player * GetAffectingPlayer() const
Definition: Unit.cpp:10585

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_CAN_ASSIST, CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, GetAffectingPlayer(), Vehicle::GetBase(), GetReactionTo(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsImmuneToNPC(), IsImmuneToPC(), IsInSanctuary(), IsOnVehicle(), IsPvP(), m_vehicle, REP_NEUTRAL, SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_STATE_UNATTACKABLE.

Referenced by SpellInfo::CheckExplicitTarget(), IsValidAssistTarget(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _IsValidAttackTarget()

bool Unit::_IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell,
WorldObject const *  obj = nullptr 
) const
13783{
13784 ASSERT(target);
13785
13786 // can't attack self
13787 if (this == target)
13788 return false;
13789
13790 // can't attack unattackable units or GMs
13791 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13792 || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster()))
13793 return false;
13794
13795 // can't attack own vehicle or passenger
13796 if (m_vehicle)
13797 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13798 if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter
13799 return false;
13800
13801 // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
13802 //Ignore stealth if target is player and unit in combat with same player
13803 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->GetTypeId() == TYPEID_PLAYER && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
13804 return false;
13805
13806 // can't attack dead
13807 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13808 return false;
13809
13810 // can't attack untargetable
13811 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13812 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13813 return false;
13814
13815 if (Player const* playerAttacker = ToPlayer())
13816 {
13817 if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
13818 return false;
13819 }
13820 // check flags
13822 || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
13823 || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
13824 || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC())
13825 // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
13826 || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
13827 return false;
13828
13829 // CvC case - can attack each other only when one of them is hostile
13831 return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
13832
13833 // PvP, PvC, CvP case
13834 // can't attack friendly targets
13835 ReputationRank repThisToTarget = GetReactionTo(target);
13836 ReputationRank repTargetToThis;
13837
13838 if (repThisToTarget > REP_NEUTRAL
13839 || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL)
13840 return false;
13841
13842 // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
13843 if (repThisToTarget == REP_NEUTRAL &&
13844 repTargetToThis <= REP_NEUTRAL)
13845 {
13846 Player* owner = GetAffectingPlayer();
13847 Unit const* const thisUnit = owner ? owner : this;
13848 if (!(target->GetTypeId() == TYPEID_PLAYER && thisUnit->GetTypeId() == TYPEID_PLAYER) &&
13849 !(target->GetTypeId() == TYPEID_UNIT && thisUnit->GetTypeId() == TYPEID_UNIT))
13850 {
13851 Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : thisUnit->ToPlayer();
13852 Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : thisUnit;
13853
13854 if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
13855 {
13856 if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
13857 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
13858 if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
13859 if (!(repState->Flags & FACTION_FLAG_AT_WAR))
13860 return false;
13861 }
13862 }
13863 }
13864
13865 Creature const* creatureAttacker = ToCreature();
13866 if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
13867 return false;
13868
13869 Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
13870 Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
13871
13872 // check duel - before sanctuary checks
13873 if (playerAffectingAttacker && playerAffectingTarget)
13874 if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->Opponent == playerAffectingTarget && playerAffectingAttacker->duel->State == DUEL_STATE_IN_PROGRESS)
13875 return true;
13876
13877 // PvP case - can't attack when attacker or target are in sanctuary
13878 // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
13879 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
13880 return false;
13881
13882 // additional checks - only PvP case
13883 if (playerAffectingAttacker && playerAffectingTarget)
13884 {
13885 if (target->IsPvP())
13886 return true;
13887
13888 if (IsFFAPvP() && target->IsFFAPvP())
13889 return true;
13890
13892 }
13893 return true;
13894}
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ TYPEMASK_DYNAMICOBJECT
Definition: ObjectGuid.h:54
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:53
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ DUEL_STATE_IN_PROGRESS
Definition: Player.h:373
@ PLAYER_FLAGS_UBER
Definition: Player.h:494
#define WORLD_TRIGGER
Definition: Unit.h:36
@ UNIT_BYTE2_FLAG_UNK1
Definition: Unit.h:137
@ UNIT_FLAG_TAXI_FLIGHT
Definition: Unit.h:468
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition: Unit.h:464
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition: Unit.h:455
@ FACTION_FLAG_AT_WAR
Definition: DBCEnums.h:313
ReputationRank
Definition: SharedDefines.h:151
@ REP_HOSTILE
Definition: SharedDefines.h:153
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:197
uint32 type_flags
Definition: CreatureData.h:216
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:949
ReputationMgr & GetReputationMgr()
Definition: Player.h:2076
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition: Unit.cpp:10007
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:21205
bool IsImmuneToNPC() const
Definition: Unit.h:1683
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10209
bool IsImmuneToPC() const
Definition: Unit.h:1681
Definition: ReputationMgr.h:42
FactionState const * GetState(FactionEntry const *factionEntry) const
Definition: ReputationMgr.h:82
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition: ReputationMgr.h:107
Definition: DBCStructure.h:898
Definition: DBCStructure.h:930

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_FLAG_AT_WAR, GetAffectingPlayer(), Vehicle::GetBase(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetReactionTo(), Player::GetReputationMgr(), ReputationMgr::GetState(), Object::GetTypeId(), SpellInfo::HasAttribute(), Object::HasByteFlag(), HasStealthAura(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsHostileTo(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsInCombatWith(), IsInSanctuary(), IsOnVehicle(), IsPvP(), Object::isType(), m_vehicle, PLAYER_FLAGS_UBER, REP_HOSTILE, REP_NEUTRAL, sFactionStore, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEID_PLAYER, TYPEID_UNIT, TYPEMASK_DYNAMICOBJECT, TYPEMASK_GAMEOBJECT, UNIT_BYTE2_FLAG_UNK1, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NON_ATTACKABLE_2, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_TAXI_FLIGHT, UNIT_STATE_UNATTACKABLE, and WORLD_TRIGGER.

Referenced by SpellInfo::CheckExplicitTarget(), Spell::DoSpellHitOnUnit(), GetMagicHitRedirectTarget(), GetMeleeHitRedirectTarget(), IsValidAttackTarget(), Acore::AnyAoETargetUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect aurEff,
bool  apply 
)
4629{
4630 if (apply)
4631 m_modAuras[aurEff->GetAuraType()].push_back(aurEff);
4632 else
4633 m_modAuras[aurEff->GetAuraType()].remove(aurEff);
4634}
AuraEffectList m_modAuras[TOTAL_AURAS]
Definition: Unit.h:2509
AuraType GetAuraType() const
Definition: SpellAuraEffects.cpp:447

References AuraEffect::GetAuraType(), and m_modAuras.

Referenced by AuraEffect::HandleEffect().

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject dynObj)
6031{
6032 m_dynObj.push_back(dynObj);
6033}

References m_dynObj.

Referenced by DynamicObject::BindToCaster().

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )
5401{
5402 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5403 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
5404}

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_RemoveAllStatBonuses().

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit pAttacker)
inline
1363 {
1364 m_attackers.erase(pAttacker);
1365 }

References m_attackers.

Referenced by Attack(), and AttackStop().

◆ _RemoveNoStackAuraApplicationsDueToAura()

void Unit::_RemoveNoStackAuraApplicationsDueToAura ( Aura aura)

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura aura)
4600{
4601 //SpellInfo const* spellProto = aura->GetSpellInfo();
4602
4603 // passive spell special case (only non stackable with ranks)
4604
4605 // xinef: this check makes caster to have 2 area auras thanks to spec switch
4606 // if (spellProto->IsPassiveStackableWithRanks())
4607 // return;
4608
4609 bool remove = false;
4610 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
4611 {
4612 if (remove)
4613 {
4614 remove = false;
4615 i = m_appliedAuras.begin();
4616 }
4617
4618 if (aura->CanStackWith(i->second->GetBase(), true))
4619 continue;
4620
4622 if (i == m_appliedAuras.end())
4623 break;
4624 remove = true;
4625 }
4626}
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4708
bool CanStackWith(Aura const *checkAura, bool remove) const
Definition: SpellAuras.cpp:2025

References AURA_REMOVE_BY_DEFAULT, Aura::CanStackWith(), m_appliedAuras, and RemoveAura().

Referenced by _AddAura(), and _ApplyAura().

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit caster,
int32 baseAmount = nullptr,
Item castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool  periodicReset = false 
)
4295{
4296 ASSERT(casterGUID || caster);
4297 if (!casterGUID)
4298 casterGUID = caster->GetGUID();
4299
4300 // Xinef: Hax for mixology, best solution qq
4301 if (sSpellMgr->GetSpellGroup(newAura->Id) == 1)
4302 return nullptr;
4303
4304 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
4305 if (!newAura->IsMultiSlotAura())
4306 {
4307 // check if cast item changed
4308 ObjectGuid castItemGUID;
4309 if (castItem)
4310 castItemGUID = castItem->GetGUID();
4311
4312 // find current aura from spell and change it's stackamount, or refresh it's duration
4313 if (Aura* foundAura = GetOwnedAura(newAura->Id, newAura->HasAttribute(SPELL_ATTR0_CU_SINGLE_AURA_STACK) ? ObjectGuid::Empty : casterGUID, newAura->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
4314 {
4315 // effect masks do not match
4316 // extremely rare case
4317 // let's just recreate aura
4318 if (effMask != foundAura->GetEffectMask())
4319 return nullptr;
4320
4321 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
4322 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4323 {
4324 if (!foundAura->HasEffect(i))
4325 continue;
4326
4327 int bp;
4328 if (baseAmount)
4329 bp = *(baseAmount + i);
4330 else
4331 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
4332
4333 int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
4334 *oldBP = bp;
4335 }
4336
4337 // correct cast item guid if needed
4338 if (castItemGUID != foundAura->GetCastItemGUID())
4339 {
4340 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
4341 *oldGUID = castItemGUID;
4342 }
4343
4344 // try to increase stack amount
4345 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, periodicReset);
4346 sScriptMgr->OnAuraApply(this, foundAura);
4347 return foundAura;
4348 }
4349 }
4350
4351 return nullptr;
4352}
std::int32_t int32
Definition: Define.h:104
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition: SpellInfo.h:176
@ SPELL_ATTR0_CU_SINGLE_AURA_STACK
Definition: SpellInfo.h:198
#define sSpellMgr
Definition: SpellMgr.h:818
Definition: ObjectGuid.h:120
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
Definition: Unit.cpp:4692

References ASSERT, AURA_REMOVE_BY_DEFAULT, ObjectGuid::Empty, Object::GetGUID(), GetOwnedAura(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsMultiSlotAura(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR0_CU_SINGLE_AURA_STACK, sScriptMgr, and sSpellMgr.

Referenced by Aura::TryRefreshStackOrCreate().

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication aurApp,
AuraRemoveMode  removeMode 
)
4579{
4580 // aura can be removed from unit only if it's applied on it, shouldn't happen
4581 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
4582
4583 uint32 spellId = aurApp->GetBase()->GetId();
4584 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4585
4586 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4587 {
4588 if (iter->second == aurApp)
4589 {
4590 _UnapplyAura(iter, removeMode);
4591 return;
4592 }
4593 else
4594 ++iter;
4595 }
4596 ABORT();
4597}
#define ABORT
Definition: Errors.h:76
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition: Unit.h:1301
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition: Unit.cpp:4498

References _UnapplyAura(), ABORT, ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), and m_appliedAuras.

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)
4499{
4500 AuraApplication* aurApp = i->second;
4501 ASSERT(aurApp);
4502 ASSERT(!aurApp->GetRemoveMode());
4503 ASSERT(aurApp->GetTarget() == this);
4504
4505 aurApp->SetRemoveMode(removeMode);
4506 Aura* aura = aurApp->GetBase();
4507 LOG_DEBUG("spells.aura", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
4508
4509 // dead loop is killing the server probably
4510 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
4511
4513
4514 Unit* caster = aura->GetCaster();
4515
4516 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
4517 m_appliedAuras.erase(i);
4518
4519 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4520 // xinef: event if it gets removed, it will be reapplied in a second
4521 if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner())
4522 {
4523 m_interruptableAuras.remove(aurApp);
4525 }
4526
4527 bool auraStateFound = false;
4528 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
4529 if (auraState)
4530 {
4531 bool canBreak = false;
4532 // Get mask of all aurastates from remaining auras
4533 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
4534 {
4535 if (itr->second == aurApp)
4536 {
4537 m_auraStateAuras.erase(itr);
4538 itr = m_auraStateAuras.lower_bound(auraState);
4539 canBreak = true;
4540 continue;
4541 }
4542 auraStateFound = true;
4543 ++itr;
4544 }
4545 }
4546
4547 aurApp->_Remove();
4548 aura->_UnapplyForTarget(this, caster, aurApp);
4549
4550 // remove effects of the spell - needs to be done after removing aura from lists
4551 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4552 {
4553 if (aurApp->HasEffect(itr))
4554 aurApp->_HandleEffect(itr, false);
4555 }
4556
4557 // all effect mustn't be applied
4558 ASSERT(!aurApp->GetEffectMask());
4559
4560 // Remove totem at next update if totem loses its aura
4561 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
4562 {
4563 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
4565 }
4566
4567 // Remove aurastates only if were not found
4568 if (!auraStateFound)
4569 ModifyAuraState(auraState, false);
4570
4571 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
4572
4573 // only way correctly remove all auras from list
4574 //if (removedAuras != m_removedAurasCount) new aura may be added
4575 i = m_appliedAuras.begin();
4576}
@ TOTEM_PASSIVE
Definition: Totem.h:25
@ AURA_REMOVE_BY_EXPIRE
Definition: SpellAuraDefines.h:395
void setDeathState(DeathState s, bool despawn=false) override
Definition: TemporarySummon.cpp:396
Totem * ToTotem()
Definition: Unit.h:2399
void UpdateInterruptMask()
Definition: Unit.cpp:759
bool IsTotem() const
Definition: Unit.h:1415
void SetRemoveMode(AuraRemoveMode mode)
Definition: SpellAuras.h:72
void _Remove()
Definition: SpellAuras.cpp:94
bool HasEffect(uint8 effect) const
Definition: SpellAuras.h:67
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:515

References AuraApplication::_HandleEffect(), AuraApplication::_Remove(), Aura::_UnapplyForTarget(), ASSERT, AURA_REMOVE_BY_EXPIRE, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Aura::GetCasterGUID(), AuraApplication::GetEffectMask(), Object::GetGUID(), Aura::GetId(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), AuraApplication::HasEffect(), IsTotem(), JUST_DIED, LOG_DEBUG, m_appliedAuras, m_auraStateAuras, m_interruptableAuras, m_removedAurasCount, MAX_SPELL_EFFECTS, ModifyAuraState(), Minion::setDeathState(), AuraApplication::SetRemoveMode(), TOTEM_PASSIVE, ToTotem(), and UpdateInterruptMask().

Referenced by Aura::_Remove(), _UnapplyAura(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAura(), and RemoveEvadeAuras().

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject dynObj)
6036{
6037 m_dynObj.remove(dynObj);
6038}

References m_dynObj.

Referenced by DynamicObject::UnbindFromCaster().

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected
3854{
3855 SpellInfo const* spellProto = nullptr;
3857 {
3859 }
3860
3861 if (!spellProto)
3862 {
3863 return;
3864 }
3865
3866 static uint32 const HUNTER_AUTOSHOOT = 75;
3867
3868 // Check "realtime" interrupts
3869 if ((GetTypeId() == TYPEID_PLAYER && ToPlayer()->isMoving() && spellProto->Id != HUNTER_AUTOSHOOT) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT))
3870 {
3871 // cancel wand shoot
3872 if (spellProto->Id != HUNTER_AUTOSHOOT)
3874 m_AutoRepeatFirstCast = true;
3875 return;
3876 }
3877
3878 // Apply delay (Hunter's autoshoot not affected)
3879 if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500 && spellProto->Id != HUNTER_AUTOSHOOT)
3880 {
3882 }
3883
3884 m_AutoRepeatFirstCast = false;
3885
3886 // Check for ranged attack timer
3888 {
3890 if (result != SPELL_CAST_OK)
3891 {
3892 if (spellProto->Id != HUNTER_AUTOSHOOT)
3893 {
3895 }
3896
3897 return;
3898 }
3899
3900 // We want to shoot
3901 Spell* spell = new Spell(this, spellProto, TRIGGERED_FULL_MASK);
3902 spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
3903
3904 // Reset attack
3906 }
3907}
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:981
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:148
SpellCastResult
Definition: SharedDefines.h:920
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4002
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4039
void setAttackTimer(WeaponAttackType type, int32 time)
Definition: Unit.h:1340
bool isMoving() const
Definition: Unit.h:2380
int32 getAttackTimer(WeaponAttackType type) const
Definition: Unit.h:1342
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:1343
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:661
Definition: Spell.h:284
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3450
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5612
SpellInfo const *const m_spellInfo
Definition: Spell.h:520

References Spell::CheckCast(), CURRENT_AUTOREPEAT_SPELL, getAttackTimer(), Object::GetTypeId(), SpellInfo::Id, InterruptSpell(), isAttackReady(), isMoving(), IsNonMeleeSpellCast(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_spellInfo, Spell::prepare(), RANGED_ATTACK, resetAttackTimer(), setAttackTimer(), SPELL_CAST_OK, Object::ToPlayer(), TRIGGERED_FULL_MASK, and TYPEID_PLAYER.

Referenced by _UpdateSpells().

◆ _UpdateSpells()

void Unit::_UpdateSpells (